changeset 155:22de20d78e27

Reduced use of post_install.m
author gedeone-octave <marcovass89@hotmail.it>
date Thu, 12 Sep 2013 14:11:38 +0200
parents 262c9d7bda1c
children 9681bf18bb95
files inst/generate_fs.m inst/generate_fun.m inst/generate_lhs.m inst/generate_makefile.m inst/generate_rhs.m inst/private/generate_fs.m inst/private/generate_fun.m inst/private/generate_lhs.m inst/private/generate_makefile.m inst/private/generate_rhs.m post_install.m src/Makefile.in src/save.cc
diffstat 13 files changed, 606 insertions(+), 592 deletions(-) [+]
line wrap: on
line diff
--- a/inst/generate_fs.m	Thu Sep 12 13:44:23 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
-##
-## 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 3 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/>.
-
-
-## -*- texinfo -*-
-## function for internal usage only
-## @end deftypefn
-function output = generate_fs (ufl_name)
-
-STRING ="\n\
-#include <fem-fenics/functionspace.h>\n\
-#include <fem-fenics/mesh.h>\n\
-#include ""@@UFL_NAME@@.h""\n\
-\n\
-DEFUN_DLD (@@UFL_NAME@@_FunctionSpace, args, , ""initialize a fs from a mesh declared with fem_init_mesh"")\n\
-{\n\
-  int nargin = args.length ();\n\
-  octave_value retval;\n\
-\n\
-  if (nargin < 1 || nargin > 1)\n\
-    print_usage ();\n\
-  else\n\
-    {\n\
-\n\
-      if (! mesh_type_loaded)\n\
-        {\n\
-          mesh::register_type ();\n\
-          mesh_type_loaded = true;\n\
-          mlock ();\n\
-        }\n\
-\n\
-      if (args(0).type_id () == mesh::static_type_id ())\n\
-        {\n\
-          const mesh & msho = static_cast<const mesh&> (args(0).get_rep ());\n\
-          const dolfin::Mesh & mshd = msho.get_msh ();\n\
-          boost::shared_ptr <const dolfin::FunctionSpace> g (new @@UFL_NAME@@::FunctionSpace (mshd));\n\
-\n\
-          if (! functionspace_type_loaded)\n\
-            {\n\
-              functionspace::register_type ();\n\
-              functionspace_type_loaded = true;\n\
-              mlock ();\n\
-            }\n\
-\n\
-          retval = new functionspace(g);\n\
-        }\n\
-    }\n\
-  return retval;\n\
-}";
-
-STRING =  strrep (STRING, "@@UFL_NAME@@", ufl_name);
-
-fid = fopen (sprintf ("%s_FunctionSpace.cc", ufl_name), 'w');
-if (fid >= 0)
-  fputs (fid, STRING);
-  output = fclose (fid);
-else
-  error ("cannot open file");
-  output = 1;
-endif
-
-endfunction
--- a/inst/generate_fun.m	Thu Sep 12 13:44:23 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
-##
-## 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 3 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/>.
-
-
-## -*- texinfo -*-
-## function for internal usage only
-## @end deftypefn
-function output = generate_fun (ufl_name)
-
-STRING ="\n\
-#include ""@@UFL_NAME@@.h""\n\
-#include <fem-fenics/mesh.h>\n\
-#include <fem-fenics/form.h>\n\
-#include <fem-fenics/coefficient.h>\n\
-#include <fem-fenics/function.h>\n\
-\n\
-DEFUN_DLD (@@UFL_NAME@@_Functional, args, , ""A = fem_rhs_@@UFL_NAME@@ (FUNCTIONAL SPACE, COEFF)"")\n\
-{\n\
-\n\
-  int nargin = args.length ();\n\
-  octave_value retval;\n\
-\n\
-  if (nargin < 1)\n\
-    print_usage ();\n\
-  else\n\
-    {\n\
-      if (! mesh_type_loaded)\n\
-        {\n\
-          mesh::register_type ();\n\
-          mesh_type_loaded = true;\n\
-          mlock ();\n\
-        }\n\
-      if (! form_type_loaded)\n\
-        {\n\
-          form::register_type ();\n\
-          form_type_loaded = true;\n\
-          mlock ();\n\
-        }\n\
-\n\
-      if (args(0).type_id () == mesh::static_type_id ())\n\
-        {\n\
-          const mesh & msho\n\
-            = static_cast<const mesh&> (args(0).get_rep ());\n\
-\n\
-          if (! error_state)\n\
-            {\n\
-              const dolfin::Mesh & mesh = msho.get_msh ();\n\
-              @@UFL_NAME@@::Functional M (mesh);\n\
-              std::size_t ncoef = M.num_coefficients (), nc = 0;\n\
-\n\
-              if (! coefficient_type_loaded)\n\
-                {\n\
-                  coefficient::register_type ();\n\
-                  coefficient_type_loaded = true;\n\
-                  mlock ();\n\
-                }\n\
-\n\
-              if (! function_type_loaded)\n\
-                {\n\
-                  function::register_type ();\n\
-                  function_type_loaded = true;\n\
-                  mlock ();\n\
-                }\n\
-\n\
-              for (std::size_t i = 1; i < nargin; ++i)\n\
-                {\n\
-                  if (args(i).type_id () == coefficient::static_type_id ())\n\
-                    {\n\
-                      const coefficient & cf\n\
-                        = static_cast <const coefficient&> (args(i).get_rep ());\n\
-\n\
-                      std::size_t n = M.coefficient_number (cf.get_str ());\n\
-                      const boost::shared_ptr<const expression> & pexp = cf.get_expr ();\n\
-                      M.set_coefficient (n, pexp);\n\
-                      ++nc;\n\
-                    }\n\
-\n\
-                  if (args(i).type_id () == function::static_type_id ())\n\
-                    {\n\
-                      const function & fun\n\
-                        = static_cast <const function&> (args(i).get_rep ());\n\
-\n\
-                      std::size_t n = M.coefficient_number (fun.get_str ());\n\
-                      const boost::shared_ptr<const dolfin::Function> & pfun = fun.get_pfun ();\n\
-                      M.set_coefficient (n, pfun);\n\
-                      ++nc;\n\
-                    }\n\
-                 }\n\
-\n\
-              if (nc != ncoef)\n\
-                error (""Wrong number of coefficient"");\n\
-              else\n\
-                {\n\
-                  retval = new form (M);\n\
-                }\n\
-            }\n\
-        }\n\
-    }\n\
-  return retval;\n\
-}";
-
-STRING =  strrep (STRING, "@@UFL_NAME@@", ufl_name);
-
-fid = fopen (sprintf ("%s_Functional.cc", ufl_name), 'w');
-if (fid >= 0)
-  fputs (fid, STRING);
-  output = fclose (fid);
-else
-  error ("cannot open file");
-  output = 1;
-endif
-
-endfunction
--- a/inst/generate_lhs.m	Thu Sep 12 13:44:23 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
-##
-## 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 3 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/>.
-
-
-## -*- texinfo -*-
-## function for internal usage only
-## @end deftypefn
-function output = generate_lhs (ufl_name)
-
-STRING ="\n\
-#include ""@@UFL_NAME@@.h""\n\
-#include <fem-fenics/form.h>\n\
-#include <fem-fenics/coefficient.h>\n\
-#include <fem-fenics/function.h>\n\
-#include <fem-fenics/functionspace.h>\n\
-\n\
-DEFUN_DLD (@@UFL_NAME@@_LinearForm, args, , "" b = fem_lhs_@@UFL_NAME@@ (FUNCTIONAL SPACE, COEFF)"")\n\
-{\n\
-  int nargin = args.length ();\n\
-  octave_value retval;\n\
-\n\
-  if (nargin < 1)\n\
-    print_usage ();\n\
-  else\n\
-    {\n\
-\n\
-      if (! functionspace_type_loaded)\n\
-        {\n\
-          functionspace::register_type ();\n\
-          functionspace_type_loaded = true;\n\
-          mlock ();\n\
-        }\n\
-      if (! form_type_loaded)\n\
-        {\n\
-          form::register_type ();\n\
-          form_type_loaded = true;\n\
-          mlock ();\n\
-        }\n\
-\n\
-      if (args(0).type_id () == functionspace::static_type_id ())\n\
-        {\n\
-          const functionspace & fspo\n\
-            = static_cast<const functionspace&> (args(0).get_rep ());\n\
-\n\
-          if (! error_state)\n\
-            {\n\
-              const dolfin::FunctionSpace & V = fspo.get_fsp ();\n\
-              @@UFL_NAME@@::LinearForm L (V);\n\
-              std::size_t ncoef = L.num_coefficients (), nc = 0;\n\
-\n\
-              if (! coefficient_type_loaded)\n\
-                {\n\
-                  coefficient::register_type ();\n\
-                  coefficient_type_loaded = true;\n\
-                  mlock ();\n\
-                }\n\
-\n\
-              if (! function_type_loaded)\n\
-                {\n\
-                  function::register_type ();\n\
-                  function_type_loaded = true;\n\
-                  mlock ();\n\
-                }\n\
-\n\
-              for (std::size_t i = 1; i < nargin; ++i)\n\
-                {\n\
-                  if (args(i).type_id () == coefficient::static_type_id ())\n\
-                    {\n\
-                      const coefficient & cf\n\
-                        = static_cast <const coefficient&> (args(i).get_rep ());\n\
-\n\
-                      std::size_t n = L.coefficient_number (cf.get_str ());\n\
-                      const boost::shared_ptr<const expression> & pexp = cf.get_expr ();\n\
-                      L.set_coefficient (n, pexp);\n\
-                      ++nc;\n\
-                    }\n\
-\n\
-                  if (args(i).type_id () == function::static_type_id ())\n\
-                    {\n\
-                      const function & fun\n\
-                        = static_cast <const function&> (args(i).get_rep ());\n\
-\n\
-                      std::size_t n = L.coefficient_number (fun.get_str ());\n\
-                      const boost::shared_ptr<const dolfin::Function> & pfun = fun.get_pfun ();\n\
-                      L.set_coefficient (n, pfun);\n\
-                      ++nc;\n\
-                    }\n\
-                 }\n\
-\n\
-              if (nc != ncoef)\n\
-                error (""Wrong number of coefficient"");\n\
-              else\n\
-                {\n\
-                  retval = new form (L);\n\
-                }\n\
-            }\n\
-        }\n\
-    }\n\
-  return retval;\n\
-}";
-
-STRING =  strrep (STRING, "@@UFL_NAME@@", ufl_name);
-
-fid = fopen (sprintf ("%s_LinearForm.cc", ufl_name), 'w');
-if (fid >= 0)
-  fputs (fid, STRING);
-  output = fclose (fid);
-else
-  error ("cannot open file");
-  output = 1;
-endif
-
-endfunction
--- a/inst/generate_makefile.m	Thu Sep 12 13:44:23 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
-##
-## 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 3 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/>.
-
-
-## -*- texinfo -*-
-## function for internal usage only
-## @end deftypefn
-function output = generate_makefile (ufl_name, path)
-
-STRING ="\n\
-DIR = @@PATH@@\n\
-CPPFLAGS=\n\
-LIBS= -ldolfin\n\
-MKOCTFILE = mkoctfile\n\
-FFC = ffc\n\
-\n\
-OCTFILES = @@UFL_NAME@@_FunctionSpace.oct @@UFL_NAME@@_BilinearForm.oct @@UFL_NAME@@_LinearForm.oct\n\
-\n\
-all : $(OCTFILES)\n\
-fs : @@UFL_NAME@@_FunctionSpace.oct\n\
-rhs : @@UFL_NAME@@_BilinearForm.oct\n\
-lhs : @@UFL_NAME@@_LinearForm.oct\n\
-fun : @@UFL_NAME@@_Functional.oct\n\
-\n\
-@@UFL_NAME@@_FunctionSpace.oct: @@UFL_NAME@@.h @@UFL_NAME@@_FunctionSpace.cc\n\
-	$(MKOCTFILE) @@UFL_NAME@@_FunctionSpace.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LIBS)\n\
-\n\
-@@UFL_NAME@@_BilinearForm.oct: @@UFL_NAME@@.h @@UFL_NAME@@_BilinearForm.cc\n\
-	$(MKOCTFILE) @@UFL_NAME@@_BilinearForm.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LIBS)\n\
-\n\
-@@UFL_NAME@@_LinearForm.oct: @@UFL_NAME@@.h @@UFL_NAME@@_LinearForm.cc\n\
-	$(MKOCTFILE) @@UFL_NAME@@_LinearForm.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBS)\n\
-\n\
-@@UFL_NAME@@_Functional.oct: @@UFL_NAME@@.h @@UFL_NAME@@_Functional.cc\n\
-	$(MKOCTFILE) @@UFL_NAME@@_Functional.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBS)\n\
-\n\
-@@UFL_NAME@@.h: @@UFL_NAME@@.ufl\n\
-	$(FFC) -l dolfin @@UFL_NAME@@.ufl\n\
-\n\
-.PHONY: clean\n\
-\n\
-clean:\n\
-	 rm -f @@UFL_NAME@@_FunctionSpace.o @@UFL_NAME@@_FunctionSpace.cc @@UFL_NAME@@.h\n\
-	 rm -f @@UFL_NAME@@_BilinearForm.o @@UFL_NAME@@_BilinearForm.cc\n\
-	 rm -f @@UFL_NAME@@_LinearForm.o @@UFL_NAME@@_LinearForm.cc\n\
-	 rm -f @@UFL_NAME@@_Functional.o @@UFL_NAME@@_Functional.cc\n\
-	 rm -f Makefile_@@UFL_NAME@@\n\
-";
-
-STRING =  strrep (STRING, "@@UFL_NAME@@", ufl_name);
-STRING =  strrep (STRING, "@@PATH@@", path);
-
-fid = fopen (sprintf ("Makefile_%s", ufl_name), 'w');
-if (fid >= 0)
-  fputs (fid, STRING);
-  output = fclose (fid);
-else
-  error ("cannot open file");
-  output = 1;
-endif
-
-endfunction
--- a/inst/generate_rhs.m	Thu Sep 12 13:44:23 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
-##
-## 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 3 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/>.
-
-
-## -*- texinfo -*-
-## function for internal usage only
-## @end deftypefn
-function output = generate_rhs (ufl_name)
-
-STRING ="\n\
-#include ""@@UFL_NAME@@.h""\n\
-#include <fem-fenics/form.h>\n\
-#include <fem-fenics/coefficient.h>\n\
-#include <fem-fenics/function.h>\n\
-#include <fem-fenics/functionspace.h>\n\
-\n\
-DEFUN_DLD (@@UFL_NAME@@_BilinearForm, args, , ""A = fem_rhs_@@UFL_NAME@@ (FUNCTIONAL SPACE, COEFF)"")\n\
-{\n\
-\n\
-  int nargin = args.length ();\n\
-  octave_value retval;\n\
-\n\
-  if (nargin < 1)\n\
-    print_usage ();\n\
-  else\n\
-    {\n\
-      if (! functionspace_type_loaded)\n\
-        {\n\
-          functionspace::register_type ();\n\
-          functionspace_type_loaded = true;\n\
-          mlock ();\n\
-        }\n\
-      if (! form_type_loaded)\n\
-        {\n\
-          form::register_type ();\n\
-          form_type_loaded = true;\n\
-          mlock ();\n\
-        }\n\
-\n\
-      if (args(0).type_id () == functionspace::static_type_id ())\n\
-        {\n\
-          const functionspace & fspo\n\
-            = static_cast<const functionspace&> (args(0).get_rep ());\n\
-\n\
-          if (! error_state)\n\
-            {\n\
-              const dolfin::FunctionSpace & V = fspo.get_fsp ();\n\
-              @@UFL_NAME@@::BilinearForm a (V, V);\n\
-              std::size_t ncoef = a.num_coefficients (), nc = 0;\n\
-\n\
-              if (! coefficient_type_loaded)\n\
-                {\n\
-                  coefficient::register_type ();\n\
-                  coefficient_type_loaded = true;\n\
-                  mlock ();\n\
-                }\n\
-\n\
-              if (! function_type_loaded)\n\
-                {\n\
-                  function::register_type ();\n\
-                  function_type_loaded = true;\n\
-                  mlock ();\n\
-                }\n\
-\n\
-              for (std::size_t i = 1; i < nargin; ++i)\n\
-                {\n\
-                  if (args(i).type_id () == coefficient::static_type_id ())\n\
-                    {\n\
-                      const coefficient & cf\n\
-                        = static_cast <const coefficient&> (args(i).get_rep ());\n\
-\n\
-                      std::size_t n = a.coefficient_number (cf.get_str ());\n\
-                      const boost::shared_ptr<const expression> & pexp = cf.get_expr ();\n\
-                      a.set_coefficient (n, pexp);\n\
-                      ++nc;\n\
-                    }\n\
-\n\
-                  if (args(i).type_id () == function::static_type_id ())\n\
-                    {\n\
-                      const function & fun\n\
-                        = static_cast <const function&> (args(i).get_rep ());\n\
-\n\
-                      std::size_t n = a.coefficient_number (fun.get_str ());\n\
-                      const boost::shared_ptr<const dolfin::Function> & pfun = fun.get_pfun ();\n\
-                      a.set_coefficient (n, pfun);\n\
-                      ++nc;\n\
-                    }\n\
-                 }\n\
-\n\
-              if (nc != ncoef)\n\
-                error (""Wrong number of coefficient"");\n\
-              else\n\
-                {\n\
-                  retval = new form (a);\n\
-                }\n\
-            }\n\
-        }\n\
-    }\n\
-  return retval;\n\
-}";
-
-STRING =  strrep (STRING, "@@UFL_NAME@@", ufl_name);
-
-fid = fopen (sprintf ("%s_BilinearForm.cc", ufl_name), 'w');
-if (fid >= 0)
-  fputs (fid, STRING);
-  output = fclose (fid);
-else
-  error ("cannot open file");
-  output = 1;
-endif
-
-endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inst/private/generate_fs.m	Thu Sep 12 14:11:38 2013 +0200
@@ -0,0 +1,74 @@
+## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
+##
+## 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 3 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/>.
+
+
+## -*- texinfo -*-
+## function for internal usage only
+## @end deftypefn
+function output = generate_fs (ufl_name)
+
+STRING ="\n\
+#include <fem-fenics/functionspace.h>\n\
+#include <fem-fenics/mesh.h>\n\
+#include ""@@UFL_NAME@@.h""\n\
+\n\
+DEFUN_DLD (@@UFL_NAME@@_FunctionSpace, args, , ""initialize a fs from a mesh declared with fem_init_mesh"")\n\
+{\n\
+  int nargin = args.length ();\n\
+  octave_value retval;\n\
+\n\
+  if (nargin < 1 || nargin > 1)\n\
+    print_usage ();\n\
+  else\n\
+    {\n\
+\n\
+      if (! mesh_type_loaded)\n\
+        {\n\
+          mesh::register_type ();\n\
+          mesh_type_loaded = true;\n\
+          mlock ();\n\
+        }\n\
+\n\
+      if (args(0).type_id () == mesh::static_type_id ())\n\
+        {\n\
+          const mesh & msho = static_cast<const mesh&> (args(0).get_rep ());\n\
+          const dolfin::Mesh & mshd = msho.get_msh ();\n\
+          boost::shared_ptr <const dolfin::FunctionSpace> g (new @@UFL_NAME@@::FunctionSpace (mshd));\n\
+\n\
+          if (! functionspace_type_loaded)\n\
+            {\n\
+              functionspace::register_type ();\n\
+              functionspace_type_loaded = true;\n\
+              mlock ();\n\
+            }\n\
+\n\
+          retval = new functionspace(g);\n\
+        }\n\
+    }\n\
+  return retval;\n\
+}";
+
+STRING =  strrep (STRING, "@@UFL_NAME@@", ufl_name);
+
+fid = fopen (sprintf ("%s_FunctionSpace.cc", ufl_name), 'w');
+if (fid >= 0)
+  fputs (fid, STRING);
+  output = fclose (fid);
+else
+  error ("cannot open file");
+  output = 1;
+endif
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inst/private/generate_fun.m	Thu Sep 12 14:11:38 2013 +0200
@@ -0,0 +1,125 @@
+## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
+##
+## 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 3 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/>.
+
+
+## -*- texinfo -*-
+## function for internal usage only
+## @end deftypefn
+function output = generate_fun (ufl_name)
+
+STRING ="\n\
+#include ""@@UFL_NAME@@.h""\n\
+#include <fem-fenics/mesh.h>\n\
+#include <fem-fenics/form.h>\n\
+#include <fem-fenics/coefficient.h>\n\
+#include <fem-fenics/function.h>\n\
+\n\
+DEFUN_DLD (@@UFL_NAME@@_Functional, args, , ""A = fem_rhs_@@UFL_NAME@@ (FUNCTIONAL SPACE, COEFF)"")\n\
+{\n\
+\n\
+  int nargin = args.length ();\n\
+  octave_value retval;\n\
+\n\
+  if (nargin < 1)\n\
+    print_usage ();\n\
+  else\n\
+    {\n\
+      if (! mesh_type_loaded)\n\
+        {\n\
+          mesh::register_type ();\n\
+          mesh_type_loaded = true;\n\
+          mlock ();\n\
+        }\n\
+      if (! form_type_loaded)\n\
+        {\n\
+          form::register_type ();\n\
+          form_type_loaded = true;\n\
+          mlock ();\n\
+        }\n\
+\n\
+      if (args(0).type_id () == mesh::static_type_id ())\n\
+        {\n\
+          const mesh & msho\n\
+            = static_cast<const mesh&> (args(0).get_rep ());\n\
+\n\
+          if (! error_state)\n\
+            {\n\
+              const dolfin::Mesh & mesh = msho.get_msh ();\n\
+              @@UFL_NAME@@::Functional M (mesh);\n\
+              std::size_t ncoef = M.num_coefficients (), nc = 0;\n\
+\n\
+              if (! coefficient_type_loaded)\n\
+                {\n\
+                  coefficient::register_type ();\n\
+                  coefficient_type_loaded = true;\n\
+                  mlock ();\n\
+                }\n\
+\n\
+              if (! function_type_loaded)\n\
+                {\n\
+                  function::register_type ();\n\
+                  function_type_loaded = true;\n\
+                  mlock ();\n\
+                }\n\
+\n\
+              for (std::size_t i = 1; i < nargin; ++i)\n\
+                {\n\
+                  if (args(i).type_id () == coefficient::static_type_id ())\n\
+                    {\n\
+                      const coefficient & cf\n\
+                        = static_cast <const coefficient&> (args(i).get_rep ());\n\
+\n\
+                      std::size_t n = M.coefficient_number (cf.get_str ());\n\
+                      const boost::shared_ptr<const expression> & pexp = cf.get_expr ();\n\
+                      M.set_coefficient (n, pexp);\n\
+                      ++nc;\n\
+                    }\n\
+\n\
+                  if (args(i).type_id () == function::static_type_id ())\n\
+                    {\n\
+                      const function & fun\n\
+                        = static_cast <const function&> (args(i).get_rep ());\n\
+\n\
+                      std::size_t n = M.coefficient_number (fun.get_str ());\n\
+                      const boost::shared_ptr<const dolfin::Function> & pfun = fun.get_pfun ();\n\
+                      M.set_coefficient (n, pfun);\n\
+                      ++nc;\n\
+                    }\n\
+                 }\n\
+\n\
+              if (nc != ncoef)\n\
+                error (""Wrong number of coefficient"");\n\
+              else\n\
+                {\n\
+                  retval = new form (M);\n\
+                }\n\
+            }\n\
+        }\n\
+    }\n\
+  return retval;\n\
+}";
+
+STRING =  strrep (STRING, "@@UFL_NAME@@", ufl_name);
+
+fid = fopen (sprintf ("%s_Functional.cc", ufl_name), 'w');
+if (fid >= 0)
+  fputs (fid, STRING);
+  output = fclose (fid);
+else
+  error ("cannot open file");
+  output = 1;
+endif
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inst/private/generate_lhs.m	Thu Sep 12 14:11:38 2013 +0200
@@ -0,0 +1,125 @@
+## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
+##
+## 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 3 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/>.
+
+
+## -*- texinfo -*-
+## function for internal usage only
+## @end deftypefn
+function output = generate_lhs (ufl_name)
+
+STRING ="\n\
+#include ""@@UFL_NAME@@.h""\n\
+#include <fem-fenics/form.h>\n\
+#include <fem-fenics/coefficient.h>\n\
+#include <fem-fenics/function.h>\n\
+#include <fem-fenics/functionspace.h>\n\
+\n\
+DEFUN_DLD (@@UFL_NAME@@_LinearForm, args, , "" b = fem_lhs_@@UFL_NAME@@ (FUNCTIONAL SPACE, COEFF)"")\n\
+{\n\
+  int nargin = args.length ();\n\
+  octave_value retval;\n\
+\n\
+  if (nargin < 1)\n\
+    print_usage ();\n\
+  else\n\
+    {\n\
+\n\
+      if (! functionspace_type_loaded)\n\
+        {\n\
+          functionspace::register_type ();\n\
+          functionspace_type_loaded = true;\n\
+          mlock ();\n\
+        }\n\
+      if (! form_type_loaded)\n\
+        {\n\
+          form::register_type ();\n\
+          form_type_loaded = true;\n\
+          mlock ();\n\
+        }\n\
+\n\
+      if (args(0).type_id () == functionspace::static_type_id ())\n\
+        {\n\
+          const functionspace & fspo\n\
+            = static_cast<const functionspace&> (args(0).get_rep ());\n\
+\n\
+          if (! error_state)\n\
+            {\n\
+              const dolfin::FunctionSpace & V = fspo.get_fsp ();\n\
+              @@UFL_NAME@@::LinearForm L (V);\n\
+              std::size_t ncoef = L.num_coefficients (), nc = 0;\n\
+\n\
+              if (! coefficient_type_loaded)\n\
+                {\n\
+                  coefficient::register_type ();\n\
+                  coefficient_type_loaded = true;\n\
+                  mlock ();\n\
+                }\n\
+\n\
+              if (! function_type_loaded)\n\
+                {\n\
+                  function::register_type ();\n\
+                  function_type_loaded = true;\n\
+                  mlock ();\n\
+                }\n\
+\n\
+              for (std::size_t i = 1; i < nargin; ++i)\n\
+                {\n\
+                  if (args(i).type_id () == coefficient::static_type_id ())\n\
+                    {\n\
+                      const coefficient & cf\n\
+                        = static_cast <const coefficient&> (args(i).get_rep ());\n\
+\n\
+                      std::size_t n = L.coefficient_number (cf.get_str ());\n\
+                      const boost::shared_ptr<const expression> & pexp = cf.get_expr ();\n\
+                      L.set_coefficient (n, pexp);\n\
+                      ++nc;\n\
+                    }\n\
+\n\
+                  if (args(i).type_id () == function::static_type_id ())\n\
+                    {\n\
+                      const function & fun\n\
+                        = static_cast <const function&> (args(i).get_rep ());\n\
+\n\
+                      std::size_t n = L.coefficient_number (fun.get_str ());\n\
+                      const boost::shared_ptr<const dolfin::Function> & pfun = fun.get_pfun ();\n\
+                      L.set_coefficient (n, pfun);\n\
+                      ++nc;\n\
+                    }\n\
+                 }\n\
+\n\
+              if (nc != ncoef)\n\
+                error (""Wrong number of coefficient"");\n\
+              else\n\
+                {\n\
+                  retval = new form (L);\n\
+                }\n\
+            }\n\
+        }\n\
+    }\n\
+  return retval;\n\
+}";
+
+STRING =  strrep (STRING, "@@UFL_NAME@@", ufl_name);
+
+fid = fopen (sprintf ("%s_LinearForm.cc", ufl_name), 'w');
+if (fid >= 0)
+  fputs (fid, STRING);
+  output = fclose (fid);
+else
+  error ("cannot open file");
+  output = 1;
+endif
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inst/private/generate_makefile.m	Thu Sep 12 14:11:38 2013 +0200
@@ -0,0 +1,74 @@
+## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
+##
+## 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 3 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/>.
+
+
+## -*- texinfo -*-
+## function for internal usage only
+## @end deftypefn
+function output = generate_makefile (ufl_name, path)
+
+STRING ="\n\
+DIR = @@PATH@@\n\
+CPPFLAGS=\n\
+LIBS= -ldolfin\n\
+MKOCTFILE = mkoctfile\n\
+FFC = ffc\n\
+\n\
+OCTFILES = @@UFL_NAME@@_FunctionSpace.oct @@UFL_NAME@@_BilinearForm.oct @@UFL_NAME@@_LinearForm.oct\n\
+\n\
+all : $(OCTFILES)\n\
+fs : @@UFL_NAME@@_FunctionSpace.oct\n\
+rhs : @@UFL_NAME@@_BilinearForm.oct\n\
+lhs : @@UFL_NAME@@_LinearForm.oct\n\
+fun : @@UFL_NAME@@_Functional.oct\n\
+\n\
+@@UFL_NAME@@_FunctionSpace.oct: @@UFL_NAME@@.h @@UFL_NAME@@_FunctionSpace.cc\n\
+	$(MKOCTFILE) @@UFL_NAME@@_FunctionSpace.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LIBS)\n\
+\n\
+@@UFL_NAME@@_BilinearForm.oct: @@UFL_NAME@@.h @@UFL_NAME@@_BilinearForm.cc\n\
+	$(MKOCTFILE) @@UFL_NAME@@_BilinearForm.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LIBS)\n\
+\n\
+@@UFL_NAME@@_LinearForm.oct: @@UFL_NAME@@.h @@UFL_NAME@@_LinearForm.cc\n\
+	$(MKOCTFILE) @@UFL_NAME@@_LinearForm.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBS)\n\
+\n\
+@@UFL_NAME@@_Functional.oct: @@UFL_NAME@@.h @@UFL_NAME@@_Functional.cc\n\
+	$(MKOCTFILE) @@UFL_NAME@@_Functional.cc -I$(DIR) -I. $(LDFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBS)\n\
+\n\
+@@UFL_NAME@@.h: @@UFL_NAME@@.ufl\n\
+	$(FFC) -l dolfin @@UFL_NAME@@.ufl\n\
+\n\
+.PHONY: clean\n\
+\n\
+clean:\n\
+	 rm -f @@UFL_NAME@@_FunctionSpace.o @@UFL_NAME@@_FunctionSpace.cc @@UFL_NAME@@.h\n\
+	 rm -f @@UFL_NAME@@_BilinearForm.o @@UFL_NAME@@_BilinearForm.cc\n\
+	 rm -f @@UFL_NAME@@_LinearForm.o @@UFL_NAME@@_LinearForm.cc\n\
+	 rm -f @@UFL_NAME@@_Functional.o @@UFL_NAME@@_Functional.cc\n\
+	 rm -f Makefile_@@UFL_NAME@@\n\
+";
+
+STRING =  strrep (STRING, "@@UFL_NAME@@", ufl_name);
+STRING =  strrep (STRING, "@@PATH@@", path);
+
+fid = fopen (sprintf ("Makefile_%s", ufl_name), 'w');
+if (fid >= 0)
+  fputs (fid, STRING);
+  output = fclose (fid);
+else
+  error ("cannot open file");
+  output = 1;
+endif
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inst/private/generate_rhs.m	Thu Sep 12 14:11:38 2013 +0200
@@ -0,0 +1,125 @@
+## Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
+##
+## 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 3 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/>.
+
+
+## -*- texinfo -*-
+## function for internal usage only
+## @end deftypefn
+function output = generate_rhs (ufl_name)
+
+STRING ="\n\
+#include ""@@UFL_NAME@@.h""\n\
+#include <fem-fenics/form.h>\n\
+#include <fem-fenics/coefficient.h>\n\
+#include <fem-fenics/function.h>\n\
+#include <fem-fenics/functionspace.h>\n\
+\n\
+DEFUN_DLD (@@UFL_NAME@@_BilinearForm, args, , ""A = fem_rhs_@@UFL_NAME@@ (FUNCTIONAL SPACE, COEFF)"")\n\
+{\n\
+\n\
+  int nargin = args.length ();\n\
+  octave_value retval;\n\
+\n\
+  if (nargin < 1)\n\
+    print_usage ();\n\
+  else\n\
+    {\n\
+      if (! functionspace_type_loaded)\n\
+        {\n\
+          functionspace::register_type ();\n\
+          functionspace_type_loaded = true;\n\
+          mlock ();\n\
+        }\n\
+      if (! form_type_loaded)\n\
+        {\n\
+          form::register_type ();\n\
+          form_type_loaded = true;\n\
+          mlock ();\n\
+        }\n\
+\n\
+      if (args(0).type_id () == functionspace::static_type_id ())\n\
+        {\n\
+          const functionspace & fspo\n\
+            = static_cast<const functionspace&> (args(0).get_rep ());\n\
+\n\
+          if (! error_state)\n\
+            {\n\
+              const dolfin::FunctionSpace & V = fspo.get_fsp ();\n\
+              @@UFL_NAME@@::BilinearForm a (V, V);\n\
+              std::size_t ncoef = a.num_coefficients (), nc = 0;\n\
+\n\
+              if (! coefficient_type_loaded)\n\
+                {\n\
+                  coefficient::register_type ();\n\
+                  coefficient_type_loaded = true;\n\
+                  mlock ();\n\
+                }\n\
+\n\
+              if (! function_type_loaded)\n\
+                {\n\
+                  function::register_type ();\n\
+                  function_type_loaded = true;\n\
+                  mlock ();\n\
+                }\n\
+\n\
+              for (std::size_t i = 1; i < nargin; ++i)\n\
+                {\n\
+                  if (args(i).type_id () == coefficient::static_type_id ())\n\
+                    {\n\
+                      const coefficient & cf\n\
+                        = static_cast <const coefficient&> (args(i).get_rep ());\n\
+\n\
+                      std::size_t n = a.coefficient_number (cf.get_str ());\n\
+                      const boost::shared_ptr<const expression> & pexp = cf.get_expr ();\n\
+                      a.set_coefficient (n, pexp);\n\
+                      ++nc;\n\
+                    }\n\
+\n\
+                  if (args(i).type_id () == function::static_type_id ())\n\
+                    {\n\
+                      const function & fun\n\
+                        = static_cast <const function&> (args(i).get_rep ());\n\
+\n\
+                      std::size_t n = a.coefficient_number (fun.get_str ());\n\
+                      const boost::shared_ptr<const dolfin::Function> & pfun = fun.get_pfun ();\n\
+                      a.set_coefficient (n, pfun);\n\
+                      ++nc;\n\
+                    }\n\
+                 }\n\
+\n\
+              if (nc != ncoef)\n\
+                error (""Wrong number of coefficient"");\n\
+              else\n\
+                {\n\
+                  retval = new form (a);\n\
+                }\n\
+            }\n\
+        }\n\
+    }\n\
+  return retval;\n\
+}";
+
+STRING =  strrep (STRING, "@@UFL_NAME@@", ufl_name);
+
+fid = fopen (sprintf ("%s_BilinearForm.cc", ufl_name), 'w');
+if (fid >= 0)
+  fputs (fid, STRING);
+  output = fclose (fid);
+else
+  error ("cannot open file");
+  output = 1;
+endif
+
+endfunction
--- a/post_install.m	Thu Sep 12 13:44:23 2013 +0200
+++ b/post_install.m	Thu Sep 12 14:11:38 2013 +0200
@@ -1,88 +1,88 @@
 
 function post_install (desc)
 
-  private = fullfile (desc.dir, "private");
+  private = fullfile (desc.dir, "include/fem-fenics/");
   [status, msg] = mkdir (private);
   if (status != 1)
-    error ("couldn't create private directory: %s", msg);
+    error ("couldn't create include/fem-fenics/ directory: %s", msg);
   endif
   [status, msg, msgid] = movefile ('./src/*.h', private, 'f');
   if (status != 1)
     error ("couldn't copy file: %s", msg);
   endif
 
-  status = movefile  ('./inst/generate_lhs.m', private, 'f');
-  status += movefile ('./inst/generate_rhs.m', private, 'f');
-  status += movefile ('./inst/generate_fs.m', private, 'f');
-  status += movefile ('./inst/generate_fun.m', private, 'f');
-  status += movefile ('./inst/generate_makefile.m', private, 'f');
-  if (status != 5)
-    error ("couldn't copy file: %s", msg);
-  endif
+#  status = movefile  ('./inst/generate_lhs.m', private, 'f');
+#  status += movefile ('./inst/generate_rhs.m', private, 'f');
+#  status += movefile ('./inst/generate_fs.m', private, 'f');
+#  status += movefile ('./inst/generate_fun.m', private, 'f');
+#  status += movefile ('./inst/generate_makefile.m', private, 'f');
+#  if (status != 5)
+#    error ("couldn't copy file: %s", msg);
+#  endif
 
-  func = fullfile (desc.dir, "@function");
-  [status, msg] = mkdir (func);
-  if (status != 1)
-    error ("couldn't create @function directory: %s", msg);
-  endif
+#  func = fullfile (desc.dir, "@function");
+#  [status, msg] = mkdir (func);
+#  if (status != 1)
+#    error ("couldn't create @function directory: %s", msg);
+#  endif
 
-  mesh = fullfile (desc.dir, "@mesh");
-  [status, msg] = mkdir (mesh);
-  if (status != 1)
-    error ("couldn't create @function directory: %s", msg);
-  endif
+#  mesh = fullfile (desc.dir, "@mesh");
+#  [status, msg] = mkdir (mesh);
+#  if (status != 1)
+#    error ("couldn't create @function directory: %s", msg);
+#  endif
 
-  [status, msg, msgid] = movefile ('./src/feval.oct', func, 'f');
-  if (status != 1)
-    error ("couldn't copy file: %s", msg);
-  endif
+#  [status, msg, msgid] = movefile ('./src/feval.oct', func, 'f');
+#  if (status != 1)
+#    error ("couldn't copy file: %s", msg);
+#  endif
 
-  [status, msg, msgid] = movefile ('./src/save.oct', func, 'f');
-  if (status != 1)
-    error ("couldn't copy file: %s", msg);
-  endif
+#  [status, msg, msgid] = movefile ('./src/save.oct', func, 'f');
+#  if (status != 1)
+#    error ("couldn't copy file: %s", msg);
+#  endif
 
-  new_name = fullfile (func, 'plot.oct');
-  [status, msg, msgid] = movefile ('./src/plot_func.oct', new_name, 'f');
-  if (status != 1)
-    error ("couldn't copy file: %s", msg);
-  endif
+#  new_name = fullfile (func, 'plot.oct');
+#  [status, msg, msgid] = movefile ('./src/plot_func.oct', new_name, 'f');
+#  if (status != 1)
+#    error ("couldn't copy file: %s", msg);
+#  endif
 
-  new_name = fullfile (mesh, 'plot.oct');
-  [status, msg, msgid] = movefile ('./src/plot_mesh.oct', new_name, 'f');
-  if (status != 1)
-    error ("couldn't copy file: %s", msg);
-  endif
+#  new_name = fullfile (mesh, 'plot.oct');
+#  [status, msg, msgid] = movefile ('./src/plot_mesh.oct', new_name, 'f');
+#  if (status != 1)
+#    error ("couldn't copy file: %s", msg);
+#  endif
 
-  file = cstrcat (desc.archprefix, filesep, octave_config_info ("canonical_host_type"),
-                  "-", octave_config_info ("api_version"), filesep, "feval.oct");
-  [err, msg] = unlink (file);
+#  file = cstrcat (desc.archprefix, filesep, octave_config_info ("canonical_host_type"),
+#                  "-", octave_config_info ("api_version"), filesep, "feval.oct");
+#  [err, msg] = unlink (file);
 
-  file = cstrcat (desc.archprefix, filesep, octave_config_info ("canonical_host_type"),
-                  "-", octave_config_info ("api_version"), filesep, "save.oct");
-  [err, msg] = unlink (file);
+#  file = cstrcat (desc.archprefix, filesep, octave_config_info ("canonical_host_type"),
+#                  "-", octave_config_info ("api_version"), filesep, "save.oct");
+#  [err, msg] = unlink (file);
 
-  file = cstrcat (desc.archprefix, filesep, octave_config_info ("canonical_host_type"),
-                  "-", octave_config_info ("api_version"), filesep, "plot_mesh.oct");
-  [err, msg] = unlink (file);
+#  file = cstrcat (desc.archprefix, filesep, octave_config_info ("canonical_host_type"),
+#                  "-", octave_config_info ("api_version"), filesep, "plot_mesh.oct");
+#  [err, msg] = unlink (file);
 
-  file = cstrcat (desc.archprefix, filesep, octave_config_info ("canonical_host_type"),
-                  "-", octave_config_info ("api_version"), filesep, "plot_func.oct");
-  [err, msg] = unlink (file);
+#  file = cstrcat (desc.archprefix, filesep, octave_config_info ("canonical_host_type"),
+#                  "-", octave_config_info ("api_version"), filesep, "plot_func.oct");
+#  [err, msg] = unlink (file);
 
-  file = cstrcat (desc.archprefix, filesep, "generate_lhs.m");
-  [err, msg] = unlink (file);
+#  file = cstrcat (desc.archprefix, filesep, "generate_lhs.m");
+#  [err, msg] = unlink (file);
 
-  file = cstrcat (desc.archprefix, filesep, "generate_rhs.m");
-  [err, msg] = unlink (file);
+#  file = cstrcat (desc.archprefix, filesep, "generate_rhs.m");
+#  [err, msg] = unlink (file);
 
-  file = cstrcat (desc.archprefix, filesep, "generate_fun.m");
-  [err, msg] = unlink (file);
+#  file = cstrcat (desc.archprefix, filesep, "generate_fun.m");
+#  [err, msg] = unlink (file);
 
-  file = cstrcat (desc.archprefix, filesep, "generate_fs.m");
-  [err, msg] = unlink (file);
+#  file = cstrcat (desc.archprefix, filesep, "generate_fs.m");
+#  [err, msg] = unlink (file);
 
-  file = cstrcat (desc.archprefix, filesep, "generate_makefile.m");
-  [err, msg] = unlink (file);
+#  file = cstrcat (desc.archprefix, filesep, "generate_makefile.m");
+#  [err, msg] = unlink (file);
 
 endfunction
--- a/src/Makefile.in	Thu Sep 12 13:44:23 2013 +0200
+++ b/src/Makefile.in	Thu Sep 12 14:11:38 2013 +0200
@@ -66,14 +66,23 @@
 assemble_system.o: assemble_system.cc form.h boundarycondition.h
 	$(MKOCTFILE) $(CPPFLAGS) -c assemble_system.cc $(LDFLAGS) -o $@ -I.
 
-save.oct: save.o
-	$(MKOCTFILE) $(CPPFLAGS) -s save.o -o $@ $(LDFLAGS) $(LIBS)
+save.oct: save.o mkfunction
+	$(MKOCTFILE) $(CPPFLAGS) -s save.o -o ./@function/save.oct $(LDFLAGS) $(LIBS)
 
 save.o: save.cc 
 	$(MKOCTFILE) $(CPPFLAGS) -c save.cc $(LDFLAGS) -o $@ -I.
 
-plot_mesh.oct: plot_mesh.cc Plot_2d.h mesh.h Plot_3d.h
-	$(MKOCTFILE) $(CPPFLAGS) -I. plot_mesh.cc $(LDFLAGS) $(LIBS)
+mkfunction:
+	 mkdir @function
+
+mkmesh:
+	 mkdir @mesh
+
+plot_mesh.oct: plot_mesh.o mkmesh
+	$(MKOCTFILE) $(CPPFLAGS) -s plot_mesh.o -o ./@mesh/plot.oct $(LDFLAGS) $(LIBS)
+
+plot_mesh.o: plot_mesh.cc Plot_2d.h mesh.h Plot_3d.h
+	$(MKOCTFILE) $(CPPFLAGS) -c plot_mesh.cc $(LDFLAGS) -o $@ -I.
 
 Plot_2d.h: Plot_2d.ufl
 	$(FFC) -l dolfin Plot_2d.ufl
@@ -81,15 +90,20 @@
 Plot_3d.h: Plot_3d.ufl
 	$(FFC) -l dolfin Plot_3d.ufl
 
-plot_func.oct: plot_func.cc function.h
-	$(MKOCTFILE) $(CPPFLAGS) -I. plot_func.cc $(LDFLAGS) $(LIBS)
+plot_func.oct: plot_func.o mkfunction
+	$(MKOCTFILE) $(CPPFLAGS) -s plot_func.o -o ./@function/plot.oct $(LDFLAGS) $(LIBS)
+
+plot_func.o: plot_func.cc Plot_2d.h mesh.h Plot_3d.h
+	$(MKOCTFILE) $(CPPFLAGS) -c plot_func.cc $(LDFLAGS) -o $@ -I.
 
 SubSpace.oct: SubSpace.cc functionspace.h
 	$(MKOCTFILE) $(CPPFLAGS) -I. SubSpace.cc $(LDFLAGS) $(LIBS)
 
-feval.oct: feval.cc function.h
-	$(MKOCTFILE) $(CPPFLAGS) -I. feval.cc $(LDFLAGS) $(LIBS)
+feval.oct: feval.o mkfunction
+	$(MKOCTFILE) $(CPPFLAGS) -s feval.o -o ./@function/feval.oct $(LDFLAGS) $(LIBS)
 
+feval.o: feval.cc function.h
+	$(MKOCTFILE) $(CPPFLAGS) -c feval.cc $(LDFLAGS) -o $@ -I.
 
 clean:
 	-rm -f *.o core octave-core *.oct *~ *.xml
--- a/src/save.cc	Thu Sep 12 13:44:23 2013 +0200
+++ b/src/save.cc	Thu Sep 12 14:11:38 2013 +0200
@@ -13,7 +13,7 @@
 
  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 "function.h"
 
 DEFUN_DLD (save, args, , "-*- texinfo -*-\n\