Mercurial > fem-fenics-eugenio
diff src/plot_mesh.cc @ 253:5e9b5bbdc56b
Support both DOLFIN 1.3.0 and 1.4.0
* src/dolfin_compat.h: use a macro to set the correct shared_ptr (std or boost)
author | Eugenio Gianniti <eugenio.gianniti@mail.polimi.it> |
---|---|
date | Tue, 29 Jul 2014 18:05:56 +0200 |
parents | 66071811eef8 |
children |
line wrap: on
line diff
--- a/src/plot_mesh.cc Tue Jul 29 17:11:59 2014 +0200 +++ b/src/plot_mesh.cc Tue Jul 29 18:05:56 2014 +0200 @@ -19,6 +19,7 @@ #include "mesh.h" #include "Plot_2d.h" #include "Plot_3d.h" +#include "dolfin_compat.h" DEFUN_DLD (plot, args, , "-*- texinfo -*-\n\ @deftypefn {Function File} \ @@ -52,7 +53,7 @@ { if (!error_state) { - const boost::shared_ptr<const dolfin::Mesh> + const SHARED_PTR <const dolfin::Mesh> & mshd = msho.get_pmsh (); dolfin::plot (*mshd); dolfin::interactive (); @@ -67,18 +68,18 @@ if (!error_state) { const dolfin::Mesh & mshd = msho.get_msh (); - boost::shared_ptr <const dolfin::FunctionSpace> V; + SHARED_PTR <const dolfin::FunctionSpace> V; uint D = mshd.topology ().dim (); if (D == 2) { - boost::shared_ptr <const dolfin::FunctionSpace> + SHARED_PTR <const dolfin::FunctionSpace> Vt (new Plot_2d::FunctionSpace (mshd)); V = Vt; } else if(D == 3) { - boost::shared_ptr <const dolfin::FunctionSpace> + SHARED_PTR <const dolfin::FunctionSpace> Vt (new Plot_3d::FunctionSpace (mshd)); V = Vt; } @@ -92,14 +93,18 @@ and the size of the vector must agree"); else { +#ifdef LATEST_DOLFIN + dolfin::Vector du (MPI_COMM_WORLD, myu.length ()); +#else dolfin::Vector du(myu.length ()); +#endif for (std::size_t i = 0; i < myu.length (); ++i) du.setitem (i, myu(i)); - boost::shared_ptr<dolfin::Vector> + SHARED_PTR <dolfin::Vector> uu (new dolfin::Vector(du)); - boost::shared_ptr <const dolfin::Function> + SHARED_PTR <const dolfin::Function> u (new dolfin::Function(V, uu)); dolfin::plot (*u);