Mercurial > fem-fenics-eugenio
annotate src/mesh.h @ 16:448e01d4411f
Introduce the use of boost::shared_ptr for class members
* mesh.h: private memeber is now boost::shared_ptr<const dolfin::Mesh> instead
of dolfin::Mesh
The class now derives only from octave_base_value and no more from
dolfin::Mesh
* mesh.cc: the constructor now takes care of the boost::shared_ptr < >
* fem_get_mesh.cc, fem_init_mesh: now use boost::shared_ptr < >
author | gedeone-octave <marco.vassallo@outlook.com> |
---|---|
date | Thu, 11 Jul 2013 18:00:26 +0200 |
parents | b7c74c0bdabd |
children | fca8c3d75036 |
rev | line source |
---|---|
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
1 /* |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
2 Copyright (C) 2013 Marco Vassallo |
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 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
6 Foundation; either version 2 of the License, or (at your option) any later |
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> |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
24 |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
25 class mesh : public octave_base_value |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
26 { |
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 public: |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
29 |
12
b7c74c0bdabd
New functions which get a (p,e,t) matrix from a mesh object
gedeone-octave <marco.vassallo@outlook.com>
parents:
3
diff
changeset
|
30 mesh () : octave_base_value () {} |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
31 |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
32 mesh (const dolfin::Mesh& _msh) : |
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
33 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
|
34 |
12
b7c74c0bdabd
New functions which get a (p,e,t) matrix from a mesh object
gedeone-octave <marco.vassallo@outlook.com>
parents:
3
diff
changeset
|
35 mesh (Array<double>& p, Array<octave_idx_type>& e, Array<octave_idx_type>& t); |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
36 |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
37 mesh (std::string _filename): |
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
38 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
|
39 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
40 void print (std::ostream& os, bool pr_as_read_syntax = false) const |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
41 { os << "msh : " << pmsh ->label () << " with " << pmsh -> num_vertices () |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
42 << " vertices " << std::endl; } |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
43 |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
44 ~mesh(void) {} |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
45 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
46 bool is_defined (void) const { return true; } |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
47 |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
48 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
|
49 { return *pmsh; } |
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
50 |
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
51 const boost::shared_ptr<const dolfin::Mesh> & get_p_msh (void) const |
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
52 { return pmsh; } |
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
53 |
12
b7c74c0bdabd
New functions which get a (p,e,t) matrix from a mesh object
gedeone-octave <marco.vassallo@outlook.com>
parents:
3
diff
changeset
|
54 octave_scalar_map get_pet (void) const; |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
55 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
56 private: |
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 boost::shared_ptr<const dolfin::Mesh> pmsh; |
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
59 |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
60 DECLARE_OCTAVE_ALLOCATOR; |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
61 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA; |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
62 |
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
63 }; |
16
448e01d4411f
Introduce the use of boost::shared_ptr for class members
gedeone-octave <marco.vassallo@outlook.com>
parents:
12
diff
changeset
|
64 |
3
ce9b06cc45c7
New class for dealing with mesh
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
65 #endif |