annotate src/functionspace.h @ 17:efec39fccff3

DLD function for Functional Space in Octave * fem_fs.cc: new DLD function which take as input a fem-fenics mesh and return a fem-fenics functionspace * functionspace.h: now uses boost::shared_ptr <const dolfin::FunctionSpace> instead of dolfin::FunctionSpace
author gedeone-octave <marco.vassallo@outlook.com>
date Thu, 11 Jul 2013 18:24:15 +0200
parents f329fc94b1a2
children fe2264f1e789
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
1 /*
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
2 Copyright (C) 2013 Marco Vassallo
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
3
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify it under
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
5 the terms of the GNU General Public License as published by the Free Software
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
6 Foundation; either version 2 of the License, or (at your option) any later
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
7 version.
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
8
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful, but WITHOUT
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
12 details.
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
13
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License along with
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
15 this program; if not, see <http://www.gnu.org/licenses/>.
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
16 */
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
17
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
18 #ifndef _FUNCTIONSPACE_OCTAVE_
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
19 #define _FUNCTIONSPACE_OCTAVE_
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
20
17
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
21 #include <memory>
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
22 #include <vector>
14
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
23 #include <dolfin.h>
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
24 #include <octave/oct.h>
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
25
17
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
26 class functionspace : public octave_base_value
14
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
27 {
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
28
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
29 public:
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
30
17
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
31 functionspace () : octave_base_value (), fsp () { }
14
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
32
17
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
33 functionspace (boost::shared_ptr <const dolfin::FunctionSpace> _fsp) :
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
34 octave_base_value (), fsp( _fsp) { }
14
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
35
17
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
36 void print (std::ostream& os, bool pr_as_read_syntax = false) const
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
37 { os << "Functional Space : " << (*fsp).str(true) << std::endl; }
14
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
38
17
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
39 ~functionspace(void) { std::cout << "delete fsp "<< std::endl; }
14
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
40
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
41 bool is_defined (void) const { return true; }
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
42
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
43 const dolfin::FunctionSpace & get_fsp (void) const
17
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
44 { return (*fsp); }
14
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
45
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
46 void set_fsp (dolfin::FunctionSpace & _fsp)
17
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
47 {
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
48 dolfin::FunctionSpace * p = new dolfin::FunctionSpace (_fsp);
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
49 fsp = boost::shared_ptr<const dolfin::FunctionSpace> (p);
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
50 }
14
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
51
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
52 private:
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
53
17
efec39fccff3 DLD function for Functional Space in Octave
gedeone-octave <marco.vassallo@outlook.com>
parents: 14
diff changeset
54 boost::shared_ptr <const dolfin::FunctionSpace> fsp;
14
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
55
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
56 DECLARE_OCTAVE_ALLOCATOR;
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
57 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
58
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
59 };
f329fc94b1a2 Wrapper Class for dolfin::FunctionSpace
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
60 #endif