diff src/meshfunction.h @ 258:ab35a8b0deef

Support storage of mesh markers via meshfunction
author Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
date Fri, 01 Aug 2014 18:59:18 +0200
parents
children 598c5e9e0a9e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/meshfunction.h	Fri Aug 01 18:59:18 2014 +0200
@@ -0,0 +1,60 @@
+/*
+ Copyright (C) 2014 Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _MESHFUNCTION_OCTAVE_
+#define _MESHFUNCTION_OCTAVE_
+
+#include <dolfin.h>
+#include <octave/oct.h>
+#include "dolfin_compat.h"
+
+class meshfunction : public octave_base_value
+{
+  public:
+
+  meshfunction (void)
+    : octave_base_value () {}
+
+  meshfunction (dolfin::MeshFunction <std::size_t> const & _mf)
+    : octave_base_value (), pmf (new dolfin::MeshFunction <std::size_t> (_mf)) {}
+
+  bool
+  is_defined (void) const
+    { return true; }
+
+  dolfin::MeshFunction <std::size_t> const &
+  get_mf (void) const
+    { return *pmf; }
+
+  SHARED_PTR <dolfin::MeshFunction <std::size_t> const> const &
+  get_pmf (void) const
+    { return pmf; }
+
+  private:
+
+  SHARED_PTR <dolfin::MeshFunction <std::size_t> const> pmf;
+
+  DECLARE_OCTAVE_ALLOCATOR;
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;
+};
+
+static bool meshfunction_type_loaded = false;
+
+DEFINE_OCTAVE_ALLOCATOR (meshfunction);
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (meshfunction, "meshfunction", "meshfunction");
+
+#endif