Mercurial > fem-fenics-eugenio
diff 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 |
line wrap: on
line diff
--- a/src/functionspace.h Thu Jul 11 18:00:26 2013 +0200 +++ b/src/functionspace.h Thu Jul 11 18:24:15 2013 +0200 @@ -18,57 +18,40 @@ #ifndef _FUNCTIONSPACE_OCTAVE_ #define _FUNCTIONSPACE_OCTAVE_ +#include <memory> +#include <vector> #include <dolfin.h> #include <octave/oct.h> -class functionspace : public dolfin::FunctionSpace, public octave_base_value +class functionspace : public octave_base_value { public: - // Constructors + functionspace () : octave_base_value (), fsp () { } - /* - Default constructor: it is necessary because it is requested by - DEFINE_OCTAVE_ALLOCATOR and DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA . - dolfin::FunctionSpace doesn't provide a default constructor, and thus - we add as private members __msh, __elm, __dfm, which are needed only for - creating our own default constructor functionspace() - for dolfin::FunctionSpace() we use the protected constructor of the class - which needs only a dolfin::Mesh - */ + functionspace (boost::shared_ptr <const dolfin::FunctionSpace> _fsp) : + octave_base_value (), fsp( _fsp) { } - functionspace () : - dolfin::FunctionSpace (__msh), octave_base_value (), fsp (__msh, __elm, __dfm) - {} - + void print (std::ostream& os, bool pr_as_read_syntax = false) const + { os << "Functional Space : " << (*fsp).str(true) << std::endl; } - functionspace (const dolfin::FunctionSpace & _fsp) - : octave_base_value (), fsp (_fsp), dolfin::FunctionSpace (_fsp) {} - - //a method for printing - void print (std::ostream& os, bool pr_as_read_syntax = false) const - { os << "fsp : " << fsp.str(true) << std::endl; } - - //destructor - ~functionspace(void) { }; + ~functionspace(void) { std::cout << "delete fsp "<< std::endl; } bool is_defined (void) const { return true; } - //get the information from the private member const dolfin::FunctionSpace & get_fsp (void) const - { return fsp; } + { return (*fsp); } - // set the value of the private member void set_fsp (dolfin::FunctionSpace & _fsp) - { fsp = _fsp; } + { + dolfin::FunctionSpace * p = new dolfin::FunctionSpace (_fsp); + fsp = boost::shared_ptr<const dolfin::FunctionSpace> (p); + } private: - dolfin::FunctionSpace fsp; - boost::shared_ptr<const dolfin::Mesh> __msh; - boost::shared_ptr<dolfin::FiniteElement> __elm; - boost::shared_ptr<dolfin::GenericDofMap> __dfm; + boost::shared_ptr <const dolfin::FunctionSpace> fsp; DECLARE_OCTAVE_ALLOCATOR; DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;