Mercurial > fem-fenics-eugenio
annotate src/mesh.h @ 253:5e9b5bbdc56b
Support both DOLFIN 1.3.0 and 1.4.0
* src/dolfin_compat.h: use a macro to set the correct shared_ptr (std or boost)
author | Eugenio Gianniti <eugenio.gianniti@mail.polimi.it> |
---|---|
date | Tue, 29 Jul 2014 18:05:56 +0200 |
parents | 9e944b0d0fc8 |
children |
rev | line source |
---|---|
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
1 /* |
151 | 2 Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net> |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
3 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
4 This program is free software; you can redistribute it and/or modify it under |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
5 the terms of the GNU General Public License as published by the Free Software |
151 | 6 Foundation; either version 3 of the License, or (at your option) any later |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
7 version. |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
8 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, but WITHOUT |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
12 details. |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
13 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License along with |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
15 this program; if not, see <http://www.gnu.org/licenses/>. |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
16 */ |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
17 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
18 #ifndef _MESH_OCTAVE_ |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
19 #define _MESH_OCTAVE_ |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
20 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
21 #include <dolfin.h> |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
22 #include <octave/oct.h> |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
23 #include <octave/oct-map.h> |
253
5e9b5bbdc56b
Support both DOLFIN 1.3.0 and 1.4.0
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
173
diff
changeset
|
24 #include "dolfin_compat.h" |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
25 |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
26 class mesh : public octave_base_value |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
27 { |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
28 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
29 public: |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
30 |
173
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
31 mesh () |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
32 : octave_base_value () {} |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
33 |
173
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
34 mesh (const dolfin::Mesh& _msh) |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
35 : octave_base_value (), pmsh (new dolfin::Mesh(_msh)) {} |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
36 |
173
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
37 mesh (Array<double>& p, |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
38 Array<octave_idx_type>& e, |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
39 Array<octave_idx_type>& t); |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
40 |
173
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
41 mesh (std::string _filename) |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
42 : octave_base_value (), pmsh (new dolfin::Mesh(_filename)) {} |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
43 |
173
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
44 void |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
45 print (std::ostream& os, bool pr_as_read_syntax = false) const |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
46 { |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
47 os << "msh : " << pmsh ->label () |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
48 << " with " << pmsh -> num_vertices () |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
49 << " vertices " << std::endl; |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
50 } |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
51 |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
52 ~mesh(void) {} |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
53 |
173
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
54 bool |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
55 is_defined (void) const |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
56 { return true; } |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
57 |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
58 const dolfin::Mesh & get_msh (void) const |
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
59 { return *pmsh; } |
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
60 |
253
5e9b5bbdc56b
Support both DOLFIN 1.3.0 and 1.4.0
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
173
diff
changeset
|
61 const SHARED_PTR <const dolfin::Mesh> & |
173
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
62 get_pmsh (void) const |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
63 { return pmsh; } |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
64 |
173
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
65 octave_scalar_map |
9e944b0d0fc8
Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents:
151
diff
changeset
|
66 get_pet (void) const; |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
67 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
68 private: |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
69 |
253
5e9b5bbdc56b
Support both DOLFIN 1.3.0 and 1.4.0
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
173
diff
changeset
|
70 SHARED_PTR <const dolfin::Mesh> pmsh; |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
71 |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
72 DECLARE_OCTAVE_ALLOCATOR; |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
73 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA; |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
74 }; |
115
41614aa82191
Improved error messagging.
gedeone-octave <marcovass89@hotmail.it>
parents:
80
diff
changeset
|
75 |
80
16ccfaf1476a
The function DEFINE_OCTAVE_ALLOCATOR and DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA
gedeone-octave <marcovass89@hotmail.it>
parents:
44
diff
changeset
|
76 static bool mesh_type_loaded = false; |
16ccfaf1476a
The function DEFINE_OCTAVE_ALLOCATOR and DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA
gedeone-octave <marcovass89@hotmail.it>
parents:
44
diff
changeset
|
77 |
16ccfaf1476a
The function DEFINE_OCTAVE_ALLOCATOR and DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA
gedeone-octave <marcovass89@hotmail.it>
parents:
44
diff
changeset
|
78 DEFINE_OCTAVE_ALLOCATOR (mesh); |
16ccfaf1476a
The function DEFINE_OCTAVE_ALLOCATOR and DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA
gedeone-octave <marcovass89@hotmail.it>
parents:
44
diff
changeset
|
79 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (mesh, "mesh", "mesh"); |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
80 #endif |