Mercurial > fem-fenics-eugenio
view src/fem_func.cc @ 48:c73bca616ca7
Add texinfo description for the DLD functions
author | gedeone-octave <marco.vassallo@outlook.com> |
---|---|
date | Mon, 22 Jul 2013 15:13:30 +0200 |
parents | a64e195d0611 |
children | a4ef215d1eed |
line wrap: on
line source
#include <dolfin.h> #include "functionspace.h" #include "function.h" DEFUN_DLD (fem_func, args, , "-*- texinfo -*-\n\ @deftypefn {Function File} {[@var{func}]} = \ fem_func (@var{Functional Space}, @var{Vector}\n\ The input parameters are\n\ @itemize @bullet \n\ @item @var{Functional Space} is the fem-fenics functional space where\ the vector is defined\n\ @item @var{Vector} contains the value of the coefficients\ for the basis functions of @var{Functional Space}\n\ The output @var{func} is an object which contain a representation of the\ function @var{Vector} which can be plotted or saved.\n\ @seealso{fem_plot, fem_save}\n\ @end deftypefn") { int nargin = args.length (); octave_value retval=0; if (nargin < 2 || nargin > 2) print_usage (); else { if (! functionspace_type_loaded) { functionspace::register_type (); functionspace_type_loaded = true; mlock (); } if (args(0).type_id () == functionspace::static_type_id ()) { const functionspace & fspo = static_cast<const functionspace&> (args(0).get_rep ()); Array <double> myu = args(1).array_value (); if (!error_state) { const boost::shared_ptr<const dolfin::FunctionSpace> & V = fspo.get_pfsp (); dolfin::Vector du(myu.length ()); for (std::size_t i = 0; i < myu.length (); ++i) du.setitem (i, myu(i)); boost::shared_ptr<dolfin::Vector> uu (new dolfin::Vector(du)); boost::shared_ptr <const dolfin::Function> u (new dolfin::Function(V, uu)); if (! function_type_loaded) { function::register_type (); function_type_loaded = true; mlock (); } retval = new function (u); } } } return retval; }