view src/fem_plot.cc @ 47:fe29ca22b1ec

Functions which plot and save a function object. * fem_plot: plot an object of type function, using dolfin * fem_save: save an object of type function, in the .pvd format * Makefile: compile also these new functions
author gedeone-octave <marco.vassallo@outlook.com>
date Mon, 22 Jul 2013 14:58:35 +0200
parents
children c73bca616ca7
line wrap: on
line source

#include <dolfin.h>
#include "function.h"

DEFUN_DLD (fem_plot, args, , "fem_plot: functionspace V, vector u")
{

  int nargin = args.length ();
  octave_value retval;
  
  if (nargin < 1 || nargin > 1)
    print_usage ();
  else
    {
      if (! function_type_loaded)
        {
          function::register_type ();
          function_type_loaded = true;
          mlock ();
        }
      if (args(0).type_id () == function::static_type_id ())
        {
          const function & uo =
            static_cast<const function&> (args(0).get_rep ());

          if (!error_state)
            {
              const boost::shared_ptr<const dolfin::Function> & u = uo.get_pfun ();
              dolfin::plot (*u);
              dolfin::interactive ();
              retval = 0;
            }
        }
    }
  return retval;
}