changeset 142:ed03c46b70b2

Maint: move file which are not yet ready for the pkg to the obsolete location.
author gedeone-octave <marcovass89@hotmail.it>
date Mon, 09 Sep 2013 22:33:35 +0200
parents e53cf3389e03
children 9486cbdc0a2e
files obsolete/fem_get_mesh.cc obsolete/fem_init_env.cc src/fem_get_mesh.cc src/fem_init_env.cc
diffstat 4 files changed, 191 insertions(+), 191 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/obsolete/fem_get_mesh.cc	Mon Sep 09 22:33:35 2013 +0200
@@ -0,0 +1,135 @@
+/*
+ Copyright (C) 2013 Marco Vassallo
+
+ 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 2 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/>.
+*/
+
+#include "mesh.h"
+
+DEFUN_DLD (fem_get_mesh, args, ,"-*- texinfo -*-\n\
+@deftypefn {Function File} {[@var{mesh}]} = \
+fem_get_mesh (@var{fem_mesh}) \n\
+Return a (p, e, t) representation of @var{fem_mesh}\n\
+The @var{mesh_to_read} should be an object created with \
+fem_init_mesh().\n\
+The output @var{mesh} is a PDE-tool like structure\n\
+with matrix fields (p,e,t).\n\
+@seealso{fem_init_mesh}\n\
+@end deftypefn")
+{
+  int nargin = args.length ();
+  octave_value retval;
+
+  if (nargin < 1 || nargin > 1)
+    print_usage ();
+  else
+    {
+
+      if (! mesh_type_loaded)
+        {
+          mesh::register_type ();
+          mesh_type_loaded = true;
+          mlock ();
+        }
+
+      if (args(0).type_id () == mesh::static_type_id ())
+        {
+          const mesh & msh = static_cast<const mesh&> (args(0).get_rep ());
+          retval = octave_value (msh.get_pet ());
+        }
+      else
+        error ("fem_get_mesh: the argument is not a mesh type");
+    }
+  return retval;
+}
+
+octave_scalar_map
+mesh::get_pet () const
+{
+  const dolfin::Mesh & msh (*pmsh);
+  //p matrix
+  uint D = msh.topology ().dim ();
+  std::size_t num_v = msh.num_vertices ();
+  Matrix p (D, num_v);
+  std::copy (msh.coordinates ().begin (),
+             msh.coordinates ().end (),
+             p.fortran_vec ());
+
+  // e has 7 rows in 2d, 10 rows in 3d
+  msh.init (D - 1, D);
+  std::size_t num_f = msh.num_facets ();
+  dim_vector dims;
+  dims.resize (2);
+  dims(0) = D == 2 ? 7 : 10;
+  dims(1) = num_f;
+  Array<octave_idx_type> e (dims, 0);
+  octave_idx_type *evec = e.fortran_vec ();
+  uint D2 = D * D;
+  octave_idx_type l = 0, m = 0;
+
+  dolfin::MeshFunction <std::size_t> facet_domains;
+  if (! msh.domains ().is_empty ())
+      if (msh.domains ().num_marked (D-1) != 0)
+        facet_domains = * (msh.domains ().facet_domains ());
+
+  for (dolfin::FacetIterator f (msh); ! f.end (); ++f)
+    {
+      if ((*f).exterior () == true)
+        {
+          l = 0;
+          for (dolfin::VertexIterator v (*f); ! v.end (); ++v, ++l)
+            e.xelem (l, m) = (*v).index () + 1;
+
+          if (! facet_domains.empty ())
+            e.xelem (D2, m) = facet_domains[*f];
+
+          ++m;
+        }
+    }
+
+  dims(1) = m;
+  e.resize (dims);
+
+  for (octave_idx_type j = e.rows () - 2;
+       j < e.numel () - 2; j += e.rows ())
+    evec[j] = 1;
+
+  // t matrix
+  dims(0) = D + 2;
+  dims(1) = msh.num_cells ();
+  Array<octave_idx_type> t (dims, 1);
+  std::vector<unsigned int> my_cells = msh.cells ();
+  std::size_t n = 0;
+
+  dolfin::MeshFunction<std::size_t> cell_domains;
+  if (! msh.domains ().is_empty ())
+      if (msh.domains ().num_marked (D) != 0)
+        cell_domains = * (msh.domains ().cell_domains ());
+
+  for (octave_idx_type j = 0; j < t.cols (); ++j)
+    {
+      for (octave_idx_type i = 0; i < D + 1; ++i, ++n)
+        t.xelem (i, j) += my_cells[n];
+
+       if (! cell_domains.empty ())
+         t.xelem (D + 1, j) = cell_domains[j];
+    }
+
+  octave_scalar_map a;
+  a.setfield ("p", p);
+  a.setfield ("e", e);
+  a.setfield ("t", t);
+  return a;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/obsolete/fem_init_env.cc	Mon Sep 09 22:33:35 2013 +0200
@@ -0,0 +1,56 @@
+/*
+ Copyright (C) 2013 Marco Vassallo
+
+ 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 2 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/>.
+*/
+
+
+#include "mesh.h"
+#include "functionspace.h"
+#include "boundarycondition.h"
+#include "coefficient.h"
+#include "function.h"
+
+DEFUN_DLD (fem_init_env, args, , "-*- texinfo -*-\n\
+@deftypefn {Function File} {[]} = \
+fem_init_env ( ) \n\
+Initialize the environment for fem-fenics\n\
+@end deftypefn")
+{
+  int nargin = args.length ();
+  octave_value retval;
+
+  if (nargin < 0 || nargin > 0)
+    print_usage ();
+  else
+    {
+      mesh::register_type ();
+      mesh_type_loaded = true;
+      std::cout << "mesh_type_loaded" << std::endl;
+      functionspace::register_type ();
+      functionspace_type_loaded = true;
+      std::cout << "functionspace_type_loaded" << std::endl;
+      boundarycondition::register_type ();
+      boundarycondition_type_loaded = true;
+      std::cout << "boundarycondition_type_loaded" << std::endl;
+      coefficient::register_type ();
+      coefficient_type_loaded = true;
+      std::cout << "coefficient_type_loaded" << std::endl;
+      function::register_type ();
+      function_type_loaded = true;
+      std::cout << "function_type_loaded" << std::endl;
+      mlock ();
+    }
+  return retval;
+}
--- a/src/fem_get_mesh.cc	Mon Sep 09 22:31:57 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
- Copyright (C) 2013 Marco Vassallo
-
- 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 2 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/>.
-*/
-
-#include "mesh.h"
-
-DEFUN_DLD (fem_get_mesh, args, ,"-*- texinfo -*-\n\
-@deftypefn {Function File} {[@var{mesh}]} = \
-fem_get_mesh (@var{fem_mesh}) \n\
-Return a (p, e, t) representation of @var{fem_mesh}\n\
-The @var{mesh_to_read} should be an object created with \
-fem_init_mesh().\n\
-The output @var{mesh} is a PDE-tool like structure\n\
-with matrix fields (p,e,t).\n\
-@seealso{fem_init_mesh}\n\
-@end deftypefn")
-{
-  int nargin = args.length ();
-  octave_value retval;
-
-  if (nargin < 1 || nargin > 1)
-    print_usage ();
-  else
-    {
-
-      if (! mesh_type_loaded)
-        {
-          mesh::register_type ();
-          mesh_type_loaded = true;
-          mlock ();
-        }
-
-      if (args(0).type_id () == mesh::static_type_id ())
-        {
-          const mesh & msh = static_cast<const mesh&> (args(0).get_rep ());
-          retval = octave_value (msh.get_pet ());
-        }
-      else
-        error ("fem_get_mesh: the argument is not a mesh type");
-    }
-  return retval;
-}
-
-octave_scalar_map
-mesh::get_pet () const
-{
-  const dolfin::Mesh & msh (*pmsh);
-  //p matrix
-  uint D = msh.topology ().dim ();
-  std::size_t num_v = msh.num_vertices ();
-  Matrix p (D, num_v);
-  std::copy (msh.coordinates ().begin (),
-             msh.coordinates ().end (),
-             p.fortran_vec ());
-
-  // e has 7 rows in 2d, 10 rows in 3d
-  msh.init (D - 1, D);
-  std::size_t num_f = msh.num_facets ();
-  dim_vector dims;
-  dims.resize (2);
-  dims(0) = D == 2 ? 7 : 10;
-  dims(1) = num_f;
-  Array<octave_idx_type> e (dims, 0);
-  octave_idx_type *evec = e.fortran_vec ();
-  uint D2 = D * D;
-  octave_idx_type l = 0, m = 0;
-
-  dolfin::MeshFunction <std::size_t> facet_domains;
-  if (! msh.domains ().is_empty ())
-      if (msh.domains ().num_marked (D-1) != 0)
-        facet_domains = * (msh.domains ().facet_domains ());
-
-  for (dolfin::FacetIterator f (msh); ! f.end (); ++f)
-    {
-      if ((*f).exterior () == true)
-        {
-          l = 0;
-          for (dolfin::VertexIterator v (*f); ! v.end (); ++v, ++l)
-            e.xelem (l, m) = (*v).index () + 1;
-
-          if (! facet_domains.empty ())
-            e.xelem (D2, m) = facet_domains[*f];
-
-          ++m;
-        }
-    }
-
-  dims(1) = m;
-  e.resize (dims);
-
-  for (octave_idx_type j = e.rows () - 2;
-       j < e.numel () - 2; j += e.rows ())
-    evec[j] = 1;
-
-  // t matrix
-  dims(0) = D + 2;
-  dims(1) = msh.num_cells ();
-  Array<octave_idx_type> t (dims, 1);
-  std::vector<unsigned int> my_cells = msh.cells ();
-  std::size_t n = 0;
-
-  dolfin::MeshFunction<std::size_t> cell_domains;
-  if (! msh.domains ().is_empty ())
-      if (msh.domains ().num_marked (D) != 0)
-        cell_domains = * (msh.domains ().cell_domains ());
-
-  for (octave_idx_type j = 0; j < t.cols (); ++j)
-    {
-      for (octave_idx_type i = 0; i < D + 1; ++i, ++n)
-        t.xelem (i, j) += my_cells[n];
-
-       if (! cell_domains.empty ())
-         t.xelem (D + 1, j) = cell_domains[j];
-    }
-
-  octave_scalar_map a;
-  a.setfield ("p", p);
-  a.setfield ("e", e);
-  a.setfield ("t", t);
-  return a;
-
-}
--- a/src/fem_init_env.cc	Mon Sep 09 22:31:57 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- Copyright (C) 2013 Marco Vassallo
-
- 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 2 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/>.
-*/
-
-
-#include "mesh.h"
-#include "functionspace.h"
-#include "boundarycondition.h"
-#include "coefficient.h"
-#include "function.h"
-
-DEFUN_DLD (fem_init_env, args, , "-*- texinfo -*-\n\
-@deftypefn {Function File} {[]} = \
-fem_init_env ( ) \n\
-Initialize the environment for fem-fenics\n\
-@end deftypefn")
-{
-  int nargin = args.length ();
-  octave_value retval;
-
-  if (nargin < 0 || nargin > 0)
-    print_usage ();
-  else
-    {
-      mesh::register_type ();
-      mesh_type_loaded = true;
-      std::cout << "mesh_type_loaded" << std::endl;
-      functionspace::register_type ();
-      functionspace_type_loaded = true;
-      std::cout << "functionspace_type_loaded" << std::endl;
-      boundarycondition::register_type ();
-      boundarycondition_type_loaded = true;
-      std::cout << "boundarycondition_type_loaded" << std::endl;
-      coefficient::register_type ();
-      coefficient_type_loaded = true;
-      std::cout << "coefficient_type_loaded" << std::endl;
-      function::register_type ();
-      function_type_loaded = true;
-      std::cout << "function_type_loaded" << std::endl;
-      mlock ();
-    }
-  return retval;
-}