changeset 173:9e944b0d0fc8

Some Formatting improvements (?)
author gedeone-octave <marcovass89@hotmail.it>
date Sat, 12 Oct 2013 16:06:00 +0100
parents 8ea37cfc7a14
children e85390ed620d
files src/DirichletBC.cc src/Expression.cc src/Function.cc src/Mesh.cc src/SubSpace.cc src/assemble_system.cc src/boundarycondition.h src/coefficient.h src/expression.h src/feval.cc src/form.h src/function.h src/functionspace.h src/mesh.h src/plot_func.cc src/plot_mesh.cc src/save.cc
diffstat 17 files changed, 305 insertions(+), 171 deletions(-) [+]
line wrap: on
line diff
--- a/src/DirichletBC.cc	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/DirichletBC.cc	Sat Oct 12 16:06:00 2013 +0100
@@ -19,16 +19,19 @@
 #include "functionspace.h"
 #include "expression.h"
 
-DEFUN_DLD (DirichletBC, args, , "-*- texinfo -*-\n\
+DEFUN_DLD (DirichletBC, args, ,
+"-*- texinfo -*-\n\
 @deftypefn {Function File} {[@var{bc}]} = \
-DirichletBC (@var{Functional Space}, @var{Boundary Label}, @var{Function handle}) \n\
+DirichletBC (@var{Functional Space}, @var{Boundary Label},\
+             @var{Function handle}) \n\
 The input parameters are\n\
 @itemize @bullet \n\
 @item @var{Functional Space} is a fem-fenics functional space where\
 we want to apply the BC\n\
 @item @var{Function handle} is a function handle which contains the expression\
 that we want to apply as BC. If we have a Vector field, we can just use a\n\
-vector of function handle: @var{Function handle} = ['@'(x, y) f1, '@'(x, y) f2, ...]\n\
+vector of function handle: \
+@var{Function handle} = ['@'(x, y) f1, '@'(x, y) f2, ...]\n\
 @item @var{Boundary} is an Array which contains the labels of the \
 sides where the BC is applied\n\
 @end itemize\n\
@@ -60,14 +63,16 @@
 
       if (args(0).type_id () == functionspace::static_type_id ())
         {
-          const functionspace & fspo = static_cast<const functionspace&> (args(0).get_rep ());
+          const functionspace & fspo = 
+            static_cast<const functionspace&> (args(0).get_rep ());
           octave_fcn_handle * fh = args(1).fcn_handle_value ();
           Array<octave_idx_type> side = args(2).array_value ();
 
 
           if (!error_state)
             {
-              const boost::shared_ptr <const dolfin::FunctionSpace> & V (fspo.get_pfsp ());
+              const boost::shared_ptr <const dolfin::FunctionSpace>
+                & V (fspo.get_pfsp ());
 
               octave_value_list b (3, 1);
               octave_value_list tmp = feval (fh->function_value (), b);
@@ -83,7 +88,8 @@
               boost::shared_ptr<const expression> f (pf);
               boundarycondition * pbc = new boundarycondition ();
 
-              for (octave_idx_type i = 0; i < side.length (); ++i)
+              for (octave_idx_type i = 0;
+                   i < side.length (); ++i)
                   pbc->add_bc (V, f, side(i));
               retval = octave_value (pbc);
             }
--- a/src/Expression.cc	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/Expression.cc	Sat Oct 12 16:06:00 2013 +0100
@@ -17,7 +17,8 @@
 
 #include "coefficient.h"
 
-DEFUN_DLD (Expression, args, , "-*- texinfo -*-\n\
+DEFUN_DLD (Expression, args, ,
+"-*- texinfo -*-\n\
 @deftypefn {Function File} {[@var{f}]} = \
 Expression (@var{name}, @var{Functio handle}\n\
 The input parameters are\n\
@@ -26,7 +27,8 @@
 @item @var{Functio handle} is a function handle which contains the expression\
 that we want to apply for our coefficient\n\
 @end itemize\n\
-The output @var{f} is an object which contains a representation of the function\n\
+The output @var{f} is an object which contains a representation \n\
+of the function\n\
 @seealso{Constant, Function}\n\
 @end deftypefn")
 {
--- a/src/Function.cc	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/Function.cc	Sat Oct 12 16:06:00 2013 +0100
@@ -77,18 +77,23 @@
 
           if (!error_state)
             {
-              const boost::shared_ptr<const dolfin::FunctionSpace> & V = fspo.get_pfsp ();
+              const boost::shared_ptr<const dolfin::FunctionSpace>
+                & V = fspo.get_pfsp ();
 
               if (V->dim () != myu.length ())
-                error ("The size of the functional space and of the vector must agree");
+                error("The size of the functional space \
+                       and of the vector must agree");
               else
                 {
                   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));
+                  boost::shared_ptr<dolfin::Vector> 
+                    uu (new dolfin::Vector(du));
+
+                  boost::shared_ptr <const dolfin::Function>
+                    u (new dolfin::Function(V, uu));
 
                   retval = new function (str, u);
                }
@@ -103,17 +108,21 @@
 
           if (!error_state)
             {
-              const boost::shared_ptr<const dolfin::Function> & f = fspo.get_pfun ();
+              const boost::shared_ptr<const dolfin::Function>
+                & f = fspo.get_pfun ();
 
               if (f->value_rank () < 1)
-                error ("Function: The function you provided isn't a vecotr field");
+                error ("Function: The function you provided\
+                        isn't a vecotr field");
               else
                 {
                   if (idx < 1 || idx > f->value_dimension (0))
                     error ("Function: index out of bounds");
                  else
                    {
-                      boost::shared_ptr <const dolfin::Function> u (new dolfin::Function((*f)[idx - 1]));
+                      boost::shared_ptr <const dolfin::Function>
+                        u (new dolfin::Function((*f)[idx - 1]));
+
                       retval = new function (str, u);
                    }
                 }
--- a/src/Mesh.cc	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/Mesh.cc	Sat Oct 12 16:06:00 2013 +0100
@@ -22,9 +22,10 @@
 Mesh (@var{mesh_in}) \n\
 The @var{mesh_in} should be either\n\
 @itemize @bullet \n\
-@item a string containing the name of the file where the mesh is stored in .xml file\
-If the file is not a .xml file you can try to use the command dolfin-convert\n\
-directly from the bash. \n\
+@item a string containing the name of the file where the mesh \n\
+is stored in .xml file\
+If the file is not a .xml file you can try to use the command\n\
+dolfin-convert directly from the terminal. \n\
 @item a a PDE-tool like structure with matrix fields (p,e,t)\n\
 @end itemize\n\
 The output @var{mesh_out} is a representation of the\n\
@@ -78,10 +79,10 @@
   return retval;
 }
 
-mesh::mesh (Array<double>& p, Array<octave_idx_type>& e,
+mesh::mesh (Array<double>& p,
+            Array<octave_idx_type>& e,
             Array<octave_idx_type>& t)
 {
-
   std::size_t D = p.rows ();
   if (D < 2 || D > 3)
     error ("Mesh constructor: only 2D or 3D meshes are supported");
@@ -96,22 +97,31 @@
       if (D == 2)
         {
           for (uint i = 0; i < p.cols (); ++i)
-            editor.add_vertex (i, p.xelem (0, i), p.xelem (1, i));
+            editor.add_vertex (i,
+                               p.xelem (0, i),
+                               p.xelem (1, i));
 
           for (uint i = 0; i < t.cols (); ++i)
-            editor.add_cell (i, t.xelem (0, i) - 1,
-                             t.xelem (1, i) - 1, t.xelem (2, i) - 1);
+            editor.add_cell (i,
+                             t.xelem (0, i) - 1,
+                             t.xelem (1, i) - 1,
+                             t.xelem (2, i) - 1);
         }
 
       if (D == 3)
         {
           for (uint i = 0; i < p.cols (); ++i)
-            editor.add_vertex (i, p.xelem (0, i),
-                               p.xelem (1, i), p.xelem (2, i));
+            editor.add_vertex (i,
+                               p.xelem (0, i),
+                               p.xelem (1, i),
+                               p.xelem (2, i));
 
           for (uint i = 0; i < t.cols (); ++i)
-            editor.add_cell (i, t.xelem (0, i) - 1, t.xelem (1, i) - 1,
-                             t.xelem (2, i) - 1, t.xelem (3, i) - 1);
+            editor.add_cell (i,
+                             t.xelem (0, i) - 1,
+                             t.xelem (1, i) - 1,
+                             t.xelem (2, i) - 1,
+                             t.xelem (3, i) - 1);
         }
 
       editor.close ();
--- a/src/SubSpace.cc	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/SubSpace.cc	Sat Oct 12 16:06:00 2013 +0100
@@ -58,7 +58,9 @@
 
               else
                 {
-                  boost::shared_ptr <const dolfin::FunctionSpace> g (new dolfin::SubSpace (V, idx - 1));
+                  boost::shared_ptr <const dolfin::FunctionSpace>
+                    g (new dolfin::SubSpace (V, idx - 1));
+
                   retval = new functionspace (g);
                 }
 
--- a/src/assemble_system.cc	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/assemble_system.cc	Sat Oct 12 16:06:00 2013 +0100
@@ -18,9 +18,11 @@
 #include "form.h"
 #include "boundarycondition.h"
 
-DEFUN_DLD (assemble_system, args, nargout, "-*- texinfo -*-\n\
+DEFUN_DLD (assemble_system, args, nargout,
+"-*- texinfo -*-\n\
 @deftypefn {Function File} {[@var{A}], [@var{b}], [@var{x}(Optional)]} = \
-assemble_system (@var{form a}, @var{form L}, @var{DirichletBC}(Optional), @var{...}) \n\
+assemble_system (@var{form a}, @var{form L}, @var{DirichletBC}(Optional), \
+                 @var{...}) \n\
 The input arguments are\n\
 @itemize @bullet\n\
 @item @var{form a} the bilinear form to assemble.\n\
@@ -34,9 +36,9 @@
 @item @var{A} is the Vector corresponding to the @var{form L}\n\
 @end itemize \n\
 If you need to apply boundary condition to a system for a nonlinear problem \n\
-then you should provide as 3rd argument the vector and you will receive it back\n\
-as the third output argument. For an example of this situation, you can look\n\
-the example HyperElasticity.m\n\
+then you should provide as 3rd argument the vector and you will receive it \n\
+back as the third output argument.\n\
+For an example of this situation, you can look the example HyperElasticity.m\n\
 @seealso{BilinearForm, LinearForm, ResidualForm, JacobianForm}\n\
 @end deftypefn")
 {
@@ -66,8 +68,10 @@
           if (args(0).type_id () == form::static_type_id ()
               && args(1).type_id () == form::static_type_id ())
             {
-              const form & frm1 = static_cast<const form&> (args(0).get_rep ());
-              const form & frm2 = static_cast<const form&> (args(1).get_rep ());
+              const form & frm1 =
+                static_cast<const form&> (args(0).get_rep ());
+              const form & frm2 =
+                static_cast<const form&> (args(1).get_rep ());
 
               if (! error_state)
                 {
@@ -86,13 +90,16 @@
 
                       for (std::size_t i = 2; i < nargin; ++i)
                         {
-                          if (args(i).type_id () == boundarycondition::static_type_id ())
+                          if (args(i).type_id () ==
+                              boundarycondition::static_type_id ())
                             {
                               const boundarycondition & bc
-                                = static_cast<const boundarycondition&> (args(i).get_rep ());
+                                = static_cast<const boundarycondition&> 
+                                (args(i).get_rep ());
 
-                              const std::vector<boost::shared_ptr <const dolfin::DirichletBC> > & pbc
-                                    = bc.get_bc ();
+                              const std::vector<boost::shared_ptr 
+                                                <const dolfin::DirichletBC> > 
+                              & pbc = bc.get_bc ();
 
                               for (std::size_t j = 0; j < pbc.size (); ++j)
                                 pbc[j]->apply(A, B);
@@ -101,8 +108,12 @@
                             error ("assemble_system: unknown argument type");
                         }
 
-//                    It provides an upper boung for the nnz elements
-                      boost::tuples::tuple<const std::size_t*, const std::size_t*, const double*, int> aa = A.data ();
+                      // Get capacity of the dolfin sparse matrix
+                      boost::tuples::tuple<const std::size_t*,
+                                           const std::size_t*,
+                                           const double*, int>
+                      aa = A.data ();
+
                       int nnz = aa.get<3> ();
                       std::size_t nr = A.size (0), nc = A.size (1);
                       std::vector<double> data_tmp;
@@ -110,7 +121,9 @@
 
                       dim_vector dims (nnz, 1);
                       octave_idx_type nz = 0, ii = 0;
-                      Array<octave_idx_type> ridx (dims, 0), cidx (dims, 0);
+                      Array<octave_idx_type> 
+                        ridx (dims, 0),
+                        cidx (dims, 0);
                       Array<double> data (dims, 0);
 
                       octave_idx_type* orow = ridx.fortran_vec ();
@@ -122,7 +135,8 @@
                          A.getrow (i, cidx_tmp, data_tmp);
                          nz += cidx_tmp.size ();
 
-                         for (octave_idx_type j = 0; j < cidx_tmp.size (); ++j)
+                         for (octave_idx_type j = 0;
+                              j < cidx_tmp.size (); ++j)
                            {
                              orow [ii + j] = i;
                              oc [ii + j] = cidx_tmp [j];
@@ -166,8 +180,10 @@
           if (args(0).type_id () == form::static_type_id ()
               && args(1).type_id () == form::static_type_id ())
             {
-              const form & frm1 = static_cast<const form&> (args(0).get_rep ());
-              const form & frm2 = static_cast<const form&> (args(1).get_rep ());
+              const form & frm1 =
+                static_cast<const form&> (args(0).get_rep ());
+              const form & frm2 =
+                static_cast<const form&> (args(1).get_rep ());
               const Array<double> myx = args(2).array_value ();
 
               if (! error_state)
@@ -191,23 +207,31 @@
 
                       for (std::size_t i = 3; i < nargin; ++i)
                         {
-                          if (args(i).type_id () == boundarycondition::static_type_id ())
+                          if (args(i).type_id () == 
+                              boundarycondition::static_type_id ())
                             {
                               const boundarycondition & bc
-                                = static_cast<const boundarycondition&> (args(i).get_rep ());
+                                = static_cast<const boundarycondition&> 
+                                  (args(i).get_rep ());
 
-                              const std::vector<boost::shared_ptr <const dolfin::DirichletBC> > & pbc
-                                = bc.get_bc ();
+                              const std::vector<boost::shared_ptr 
+                                               <const dolfin::DirichletBC> >
+                              & pbc = bc.get_bc ();
 
-                              for (std::size_t j = 0; j < pbc.size (); ++j)
+                              for (std::size_t j = 0;
+                                   j < pbc.size (); ++j)
                                 pbc[j]->apply(A, B, x);
+
                             }
                           else
                             error ("assemble_system: unknown argument type");
                         }
 
-//                    It provides an upper boung for the nnz elements
-                      boost::tuples::tuple<const std::size_t*, const std::size_t*, const double*, int> aa = A.data ();
+                      // Get capacity of the dolfin sparse matrix
+                      boost::tuples::tuple<const std::size_t*,
+                                           const std::size_t*,
+                                           const double*, int>
+                      aa = A.data ();
                       int nnz = aa.get<3> ();
                       std::size_t nr = A.size (0), nc = A.size (1);
                       std::vector<double> data_tmp;
@@ -215,7 +239,9 @@
 
                       dim_vector dims (nnz, 1);
                       octave_idx_type nz = 0, ii = 0;
-                      Array<octave_idx_type> ridx (dims, 0), cidx (dims, 0);
+                      Array<octave_idx_type>
+                        ridx (dims, 0),
+                        cidx (dims, 0);
                       Array<double> data (dims, 0);
 
                       octave_idx_type* orow = ridx.fortran_vec ();
@@ -227,7 +253,8 @@
                          A.getrow (i, cidx_tmp, data_tmp);
                          nz += cidx_tmp.size ();
 
-                         for (octave_idx_type j = 0; j < cidx_tmp.size (); ++j)
+                         for (octave_idx_type j = 0;
+                              j < cidx_tmp.size (); ++j)
                            {
                              orow [ii + j] = i;
                              oc [ii + j] = cidx_tmp [j];
--- a/src/boundarycondition.h	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/boundarycondition.h	Sat Oct 12 16:06:00 2013 +0100
@@ -28,9 +28,11 @@
 
  public:
 
-  boundarycondition () : octave_base_value () {}
+  boundarycondition () 
+    : octave_base_value () {}
 
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const
+  void
+  print (std::ostream& os, bool pr_as_read_syntax = false) const
   {
      for (std::size_t i = 0; i < bcu.size (); ++i)
        os << "Boundary condition : " << bcu[i]->str (true) << std::endl;
@@ -38,21 +40,29 @@
 
   ~boundarycondition (void) {}
 
-  bool is_defined (void) const { return true; }
+  bool
+  is_defined (void) const
+    { return true; }
 
-  const std::vector< boost::shared_ptr <const dolfin::DirichletBC> > & get_bc (void) const
-  { return bcu; }
+  const std::vector< boost::shared_ptr 
+                   <const dolfin::DirichletBC> > &
+  get_bc (void) const 
+    { return bcu; }
 
-  void add_bc (const boost::shared_ptr <const dolfin::FunctionSpace> & V,
-               boost::shared_ptr<const dolfin::GenericFunction> f, std::size_t n)
-  {
-    boost::shared_ptr<const dolfin::DirichletBC> p (new dolfin::DirichletBC (V, f, n));
-    bcu.push_back(p);
-  }
+  void
+  add_bc (const boost::shared_ptr<const dolfin::FunctionSpace> & V,
+          boost::shared_ptr<const dolfin::GenericFunction> f,
+          std::size_t n)
+    {
+      boost::shared_ptr<const dolfin::DirichletBC> 
+        p (new dolfin::DirichletBC (V, f, n));
+      bcu.push_back(p);
+    }
 
  private:
 
-  std::vector<boost::shared_ptr <const dolfin::DirichletBC> > bcu;
+  std::vector<boost::shared_ptr 
+             <const dolfin::DirichletBC> > bcu;
 
   DECLARE_OCTAVE_ALLOCATOR;
   DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;
@@ -62,5 +72,7 @@
 static bool boundarycondition_type_loaded = false;
 
 DEFINE_OCTAVE_ALLOCATOR (boundarycondition);
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (boundarycondition, "boundarycondition", "boundarycondition");
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (boundarycondition,
+                                   "boundarycondition",
+                                   "boundarycondition");
 #endif
--- a/src/coefficient.h	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/coefficient.h	Sat Oct 12 16:06:00 2013 +0100
@@ -24,28 +24,37 @@
 {
 
  public:
-  coefficient () : octave_base_value () {}
+  coefficient ()
+    : octave_base_value () {}
 
-  coefficient (std::string & _str, octave_fcn_handle & _f) :
-               str (_str), expr (new expression (_f)) { }
+  coefficient (std::string & _str,
+               octave_fcn_handle & _f)
+    : str (_str), expr (new expression (_f)) {}
 
-  coefficient (std::string & _str, octave_fcn_handle & _f, std::size_t _n) :
-               str (_str), expr (new expression (_f, _n)) { }
+  coefficient (std::string & _str,
+               octave_fcn_handle & _f,
+               std::size_t _n)
+    : str (_str), expr (new expression (_f, _n)) {}
 
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const
-  {
-    os << "Coefficient " << str << " : " <<  expr->str (true) << std::endl;
-  }
+  void
+  print (std::ostream& os, bool pr_as_read_syntax = false) const
+    {
+      os << "Coefficient " << str << " : " <<  expr->str (true) << std::endl;
+    }
 
-  ~coefficient (void) { }
+  ~coefficient (void) {}
 
-  bool is_defined (void) const { return true; }
+  bool
+  is_defined (void) const 
+    { return true; }
 
-  const boost::shared_ptr <const expression> & get_expr (void) const
-  { return expr; }
+  const boost::shared_ptr <const expression> & 
+  get_expr (void) const
+    { return expr; }
 
-  const std::string & get_str (void) const
-  { return str; }
+  const std::string &
+  get_str (void) const
+    { return str; }
 
  private:
 
@@ -59,6 +68,8 @@
 static bool coefficient_type_loaded = false;
 
 DEFINE_OCTAVE_ALLOCATOR (coefficient);
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (coefficient, "coefficient", "coefficient");
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (coefficient,
+                                     "coefficient",
+                                     "coefficient");
 
 #endif
--- a/src/expression.h	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/expression.h	Sat Oct 12 16:06:00 2013 +0100
@@ -30,29 +30,32 @@
 {
 
  public:
-  expression() : dolfin::Expression() {}
+  expression()
+    : dolfin::Expression() {}
 
-  expression (octave_fcn_handle & _f) :
-             dolfin::Expression (), f (new octave_fcn_handle (_f)) {}
+  expression (octave_fcn_handle & _f)
+    : dolfin::Expression (), f (new octave_fcn_handle (_f)) {}
 
-  expression (octave_fcn_handle & _f, std::size_t _n) :
-             dolfin::Expression (_n), f (new octave_fcn_handle (_f)) {}
+  expression (octave_fcn_handle & _f,
+              std::size_t _n)
+    : dolfin::Expression (_n), f (new octave_fcn_handle (_f)) {}
 
   ~expression (void) { delete f; }
 
+  void 
+  eval (dolfin::Array<double>& values,
+        const dolfin::Array<double>& x) const
+    {
+      octave_value_list b;
+      b.resize (x.size ());
+      for (std::size_t i = 0; i < x.size (); ++i)
+        b(i) = x[i];
+      octave_value_list tmp = feval (f->function_value (), b);
+      Array<double> res = tmp(0).array_value ();
 
-  void eval (dolfin::Array<double>& values, const dolfin::Array<double>& x) const
-  {
-    octave_value_list b;
-    b.resize (x.size ());
-    for (std::size_t i = 0; i < x.size (); ++i)
-      b(i) = x[i];
-    octave_value_list tmp = feval (f->function_value (), b);
-    Array<double> res = tmp(0).array_value ();
-
-    for (std::size_t i = 0; i < values.size (); ++i)
-      values[i] = res(i);
-  }
+      for (std::size_t i = 0; i < values.size (); ++i)
+        values[i] = res(i);
+    }
 
  private:
   octave_fcn_handle * f;
--- a/src/feval.cc	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/feval.cc	Sat Oct 12 16:06:00 2013 +0100
@@ -45,7 +45,8 @@
 
           if (!error_state)
             {
-              const boost::shared_ptr<const dolfin::Function> & f = fspo.get_pfun ();
+              const boost::shared_ptr<const dolfin::Function> 
+                & f = fspo.get_pfun ();
               dim_vector dims;
               dims.resize (2);
               dims(0) = 1;
--- a/src/form.h	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/form.h	Sat Oct 12 16:06:00 2013 +0100
@@ -28,27 +28,36 @@
 
  public:
 
-  form () : octave_base_value () { }
+  form ()
+    : octave_base_value () {}
 
-  form (const dolfin::Form _frm) :
-  octave_base_value (), frm (new dolfin::Form (_frm)) { }
+  form (const dolfin::Form _frm)
+    : octave_base_value (), frm (new dolfin::Form (_frm)) {}
 
-  form (boost::shared_ptr <const dolfin::Form> _frm) :
-  octave_base_value (), frm (_frm) { }
+  form (boost::shared_ptr <const dolfin::Form> _frm)
+    : octave_base_value (), frm (_frm) {}
 
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const
-  { os << "Form " << ": is a form of rank " << frm->rank ()
-       << " with " << frm->num_coefficients () << " coefficients" << std::endl; }
+  void
+  print (std::ostream& os, bool pr_as_read_syntax = false) const
+    {  
+       os << "Form " << ": is a form of rank " << frm->rank ()
+       << " with " << frm->num_coefficients () 
+       << " coefficients" << std::endl; 
+    }
 
-  ~form(void) { }
+  ~form(void) {}
 
-  bool is_defined (void) const { return true; }
+  bool
+  is_defined (void) const 
+    { return true; }
 
-  const dolfin::Form & get_form (void) const
-  { return (*frm); }
+  const dolfin::Form & 
+  get_form (void) const
+    { return (*frm); }
 
-  const boost::shared_ptr <const dolfin::Form> & get_pform (void) const
-  { return frm; }
+  const boost::shared_ptr <const dolfin::Form> & 
+  get_pform (void) const
+    { return frm; }
 
  private:
 
--- a/src/function.h	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/function.h	Sat Oct 12 16:06:00 2013 +0100
@@ -28,32 +28,42 @@
 
  public:
 
-  function () : octave_base_value (), fun () { }
+  function ()
+    : octave_base_value (), fun () {}
 
-  function (std::string & _str, boost::shared_ptr <const dolfin::Function> _fun) :
-  octave_base_value (), str(_str), fun (_fun) { }
+  function (std::string & _str, 
+            boost::shared_ptr <const dolfin::Function> _fun)
+    : octave_base_value (), str(_str), fun (_fun) {}
 
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const
-  { os << "Function " << str << ": " << fun->str (true) << std::endl; }
+  void 
+  print (std::ostream& os,
+         bool pr_as_read_syntax = false) const
+    { os << "Function " << str << ": " << fun->str (true) << std::endl; }
 
-  ~function(void) { }
+  ~function(void) {}
 
-  bool is_defined (void) const { return true; }
+  bool 
+  is_defined (void) const
+    { return true; }
 
-  const dolfin::Function & get_fun (void) const
-  { return (*fun); }
+  const dolfin::Function &
+  get_fun (void) const
+    { return (*fun); }
 
-  const boost::shared_ptr <const dolfin::Function> & get_pfun (void) const
-  { return fun; }
+  const boost::shared_ptr <const dolfin::Function> &
+  get_pfun (void) const
+    { return fun; }
 
-  void set_fun (dolfin::Function & _fun)
-  {
-    dolfin::Function * p = new dolfin::Function (_fun);
-    fun = boost::shared_ptr<const dolfin::Function> (p);
-  }
+  void 
+  set_fun (dolfin::Function & _fun)
+    {
+      dolfin::Function * p = new dolfin::Function (_fun);
+      fun = boost::shared_ptr<const dolfin::Function> (p);
+    }
 
-  const std::string & get_str (void) const
-  { return str; }
+  const std::string & 
+  get_str (void) const
+    { return str; }
 
  private:
 
--- a/src/functionspace.h	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/functionspace.h	Sat Oct 12 16:06:00 2013 +0100
@@ -28,29 +28,36 @@
 
  public:
 
-  functionspace () : octave_base_value (), fsp () { }
+  functionspace () 
+    : octave_base_value (), fsp () {}
 
-  functionspace (boost::shared_ptr <const dolfin::FunctionSpace> _fsp) :
-  octave_base_value (), fsp( _fsp) { }
+  functionspace (boost::shared_ptr <const dolfin::FunctionSpace> _fsp)
+    : octave_base_value (), fsp (_fsp) {}
 
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const
-  { os << "Functional Space : " << (*fsp).str(true) << std::endl; }
+  void
+  print (std::ostream& os, bool pr_as_read_syntax = false) const
+    { os << "Functional Space : " << (*fsp).str(true) << std::endl; }
 
   ~functionspace(void) {}
 
-  bool is_defined (void) const { return true; }
+  bool
+  is_defined (void) const 
+    { return true; }
 
-  const dolfin::FunctionSpace & get_fsp (void) const
-  { return (*fsp); }
+  const dolfin::FunctionSpace &
+  get_fsp (void) const
+    { return (*fsp); }
 
-  const boost::shared_ptr <const dolfin::FunctionSpace> & get_pfsp (void) const
-  { return fsp; }
+  const boost::shared_ptr <const dolfin::FunctionSpace> &
+  get_pfsp (void) const
+    { return fsp; }
 
-  void set_fsp (dolfin::FunctionSpace & _fsp)
-  {
-    dolfin::FunctionSpace * p = new dolfin::FunctionSpace (_fsp);
-    fsp = boost::shared_ptr<const dolfin::FunctionSpace> (p);
-  }
+  void
+  set_fsp (dolfin::FunctionSpace & _fsp)
+    {
+      dolfin::FunctionSpace * p = new dolfin::FunctionSpace (_fsp);
+      fsp = boost::shared_ptr<const dolfin::FunctionSpace> (p);
+    }
 
  private:
 
@@ -64,6 +71,8 @@
 static bool functionspace_type_loaded = false;
 
 DEFINE_OCTAVE_ALLOCATOR (functionspace);
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (functionspace, "functionspace", "functionspace");
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (functionspace,
+                                     "functionspace",
+                                     "functionspace");
 
 #endif
--- a/src/mesh.h	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/mesh.h	Sat Oct 12 16:06:00 2013 +0100
@@ -27,31 +27,42 @@
 
  public:
 
-  mesh () : octave_base_value () {}
+  mesh ()
+    : octave_base_value () {}
 
-  mesh (const dolfin::Mesh& _msh) :
-       octave_base_value (), pmsh (new dolfin::Mesh(_msh)) {}
+  mesh (const dolfin::Mesh& _msh)
+    : octave_base_value (), pmsh (new dolfin::Mesh(_msh)) {}
 
-  mesh (Array<double>& p, Array<octave_idx_type>& e, Array<octave_idx_type>& t);
+  mesh (Array<double>& p,
+        Array<octave_idx_type>& e,
+        Array<octave_idx_type>& t);
 
-  mesh (std::string _filename):
-       octave_base_value (), pmsh (new dolfin::Mesh(_filename)) {}
+  mesh (std::string _filename)
+    : octave_base_value (), pmsh (new dolfin::Mesh(_filename)) {}
 
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const
-  { os << "msh : " << pmsh ->label () << " with " << pmsh -> num_vertices ()
-       << " vertices " << std::endl; }
+  void
+  print (std::ostream& os, bool pr_as_read_syntax = false) const
+    { 
+      os << "msh : " << pmsh ->label ()
+      << " with " << pmsh -> num_vertices ()
+      << " vertices " << std::endl;
+    }
 
   ~mesh(void) {}
 
-  bool is_defined (void) const { return true; }
+  bool
+  is_defined (void) const 
+    { return true; }
 
   const dolfin::Mesh & get_msh (void) const
   { return *pmsh; }
 
-  const boost::shared_ptr<const dolfin::Mesh> & get_pmsh (void) const
-  { return pmsh; }
+  const boost::shared_ptr<const dolfin::Mesh> & 
+  get_pmsh (void) const
+    { return pmsh; }
 
-  octave_scalar_map get_pet (void) const;
+  octave_scalar_map 
+  get_pet (void) const;
 
  private:
 
@@ -59,7 +70,6 @@
 
   DECLARE_OCTAVE_ALLOCATOR;
   DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;
-
 };
 
 static bool mesh_type_loaded = false;
--- a/src/plot_func.cc	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/plot_func.cc	Sat Oct 12 16:06:00 2013 +0100
@@ -47,9 +47,12 @@
 
           if (!error_state)
             {
-              const boost::shared_ptr<const dolfin::Function> & u = uo.get_pfun ();
+              const boost::shared_ptr<const dolfin::Function>
+                & u = uo.get_pfun ();
+
               dolfin::plot (*u);
               dolfin::interactive ();
+
               retval = 0;
             }
         }
--- a/src/plot_mesh.cc	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/plot_mesh.cc	Sat Oct 12 16:06:00 2013 +0100
@@ -51,7 +51,8 @@
             {
               if (!error_state)
                 {
-                  const boost::shared_ptr<const dolfin::Mesh> & mshd = msho.get_pmsh ();
+                  const boost::shared_ptr<const dolfin::Mesh>
+                    & mshd = msho.get_pmsh ();
                   dolfin::plot (*mshd);
                   dolfin::interactive ();
                   retval = 0;
@@ -69,13 +70,15 @@
                   uint D = mshd.topology ().dim ();
                   if (D == 2)
                     {
-                      boost::shared_ptr <const dolfin::FunctionSpace> Vt (new Plot_2d::FunctionSpace (mshd));
+                      boost::shared_ptr <const dolfin::FunctionSpace>
+                        Vt (new Plot_2d::FunctionSpace (mshd));
                       V = Vt;
                     }
 
                   else if(D == 3)
                     {
-                      boost::shared_ptr <const dolfin::FunctionSpace> Vt (new Plot_3d::FunctionSpace (mshd));
+                      boost::shared_ptr <const dolfin::FunctionSpace>
+                        Vt (new Plot_3d::FunctionSpace (mshd));
                       V = Vt;
                     }
 
@@ -84,17 +87,23 @@
 
 
                   if (V->dim () != myu.length ())
-                    error ("Plot: The size of the functional space and of the vector must agree");
+                    error ("Plot: The size of the functional space\
+                            and the size of the vector must agree");
                   else
                     {
                       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));
+                      boost::shared_ptr<dolfin::Vector>
+                        uu (new dolfin::Vector(du));
+
+                      boost::shared_ptr <const dolfin::Function>
+                        u (new dolfin::Function(V, uu));
+
                       dolfin::plot (*u);
                       dolfin::interactive ();
+
                       retval = 0;
                     }
                 }
--- a/src/save.cc	Mon Oct 07 21:52:17 2013 +0200
+++ b/src/save.cc	Sat Oct 12 16:06:00 2013 +0100
@@ -50,7 +50,8 @@
 
           if (!error_state)
             {
-              const boost::shared_ptr<const dolfin::Function> & u = uo.get_pfun ();
+              const boost::shared_ptr<const dolfin::Function>
+                & u = uo.get_pfun ();
               str += ".pvd";
               dolfin::File file (str);
               file << (*u);