Mercurial > fem-fenics-eugenio
changeset 11:6f11638bfbac
New function which return a mesh in the (p, e, t) format
author | gedeone-octave <marco.vassallo@outlook.com> |
---|---|
date | Sat, 06 Jul 2013 00:31:00 +0200 |
parents | 277b60c6618a |
children | b7c74c0bdabd |
files | src/fem_get_mesh.cc |
diffstat | 1 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fem_get_mesh.cc Sat Jul 06 00:31:00 2013 +0200 @@ -0,0 +1,40 @@ +/* + 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, , "return a mesh in the (p, e, t) from a mesh declared with fem_init_mesh") +{ + int nargin = args.length (); + octave_value retval; + + if (nargin < 1 || nargin > 1) + print_usage (); + else + { + 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 \n\ +maybe the mesh type has not been loaded, try fem_init_env()"); + + } + return retval; +}