changeset 57:7e588d5cd07e

Maint: source files of functions which are created on the fly moved to the obsolete folder.
author gedeone-octave <marco.vassallo@outlook.com>
date Thu, 25 Jul 2013 12:17:57 +0200
parents 4868e535fc8a
children 389967a7f307
files obsolete/Laplace.ufl obsolete/fem_fs.cc obsolete/fem_lhs.cc obsolete/fem_rhs.cc src/Laplace.ufl src/fem_fs.cc src/fem_lhs.cc src/fem_rhs.cc
diffstat 8 files changed, 369 insertions(+), 369 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/obsolete/Laplace.ufl	Thu Jul 25 12:17:57 2013 +0200
@@ -0,0 +1,36 @@
+# Copyright (C) 2005-2009 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2005
+# Last changed: 2011-03-08
+#
+# The bilinear form a(u, v) and linear form L(v) for
+# Poisson's equation.
+#
+# Compile this form with FFC: ffc -l dolfin Poisson.ufl.
+
+
+element = FiniteElement("Lagrange", triangle, 1)
+# element = FiniteElement("Lagrange", tetrahedron, 2)
+
+u = TrialFunction(element)
+v = TestFunction(element)
+f = Coefficient(element)
+g = Coefficient(element)
+
+a = inner(grad(u), grad(v))*dx
+L = f*v*dx + g*v*ds
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/obsolete/fem_fs.cc	Thu Jul 25 12:17:57 2013 +0200
@@ -0,0 +1,57 @@
+/*
+ Copyright (C) 2013 Marco Vassallo
+
+ 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 2 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/>.
+*/
+
+
+#include "functionspace.h"
+#include "mesh.h"
+#include "Laplace.h"
+
+DEFUN_DLD (fem_fs, args, , "initialize a fs from a mesh declared with fem_init_mesh")
+{
+  int nargin = args.length ();
+  octave_value retval;
+
+  if (nargin < 1 || nargin > 1)
+    print_usage ();
+  else
+    {
+
+      if (! mesh_type_loaded)
+        {
+          mesh::register_type ();
+          mesh_type_loaded = true;
+          mlock ();
+        }
+
+      if (args(0).type_id () == mesh::static_type_id ())
+        {
+          const mesh & msho = static_cast<const mesh&> (args(0).get_rep ());
+          const dolfin::Mesh & mshd = msho.get_msh ();
+          boost::shared_ptr <const dolfin::FunctionSpace> g (new Laplace::FunctionSpace (mshd));
+
+          if (! functionspace_type_loaded)
+            {
+              functionspace::register_type ();
+              functionspace_type_loaded = true;
+              mlock ();
+            }
+
+          retval = new functionspace(g);
+        }
+    }
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/obsolete/fem_lhs.cc	Thu Jul 25 12:17:57 2013 +0200
@@ -0,0 +1,130 @@
+/*
+ Copyright (C) 2013 Marco Vassallo
+
+ 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 2 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/>.
+*/
+
+#include "Laplace.h"
+#include <dolfin.h>
+#include "functionspace.h"
+#include "boundarycondition.h"
+#include "coefficient.h"
+
+DEFUN_DLD (fem_lhs, args, , "-*- texinfo -*-\n\
+@deftypefn {Function File} {[@var{bc}]} = \
+fem_rhs (@var{Functional Space}, @var{Coefficient}, \
+@var{Boundary Condition}) \n\
+The input parameters are\n\
+@itemize @bullet \n\
+@item @var{Functional Space} is the fem-fenics functional space where\
+the bilinear form is defined\n\
+@item @var{Boundary Condition} contains the value of the essential bc that\
+we want to apply to the Bilinear Form\n\
+@item @var{Coefficient} is a variable of type coefficient which contains\
+the value of the coefficient for the bilinear form\n\
+@end itemize\n\
+The output @var{A} is a sparse matrix which represents the bilinear form\n\
+@seealso{fem_init_mesh, fem_fs}\n\
+@end deftypefn")
+{
+
+  int nargin = args.length ();
+  octave_value retval;
+
+  if (nargin < 1)
+    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 ());
+
+          if (! error_state)
+            {
+              const dolfin::FunctionSpace V = fspo.get_fsp ();
+              Laplace::LinearForm L (V);
+              std::size_t ncoef = L.num_coefficients (), nc = 0;
+
+              if (! coefficient_type_loaded)
+                {
+                  coefficient::register_type ();
+                  coefficient_type_loaded = true;
+                  mlock ();
+                }
+              for (std::size_t i = 1; i < nargin; ++i)
+                {
+                  if (args(i).type_id () == coefficient::static_type_id ())
+                    {
+                      const coefficient & cf
+                        = static_cast <const coefficient&> (args(i).get_rep ());
+
+                      std::size_t n = L.coefficient_number (cf.get_str ());
+                      const boost::shared_ptr<const expression> & pexp = cf.get_expr ();
+                      L.set_coefficient (n, pexp);
+                      ++nc;
+                    }
+                 }
+
+              if (nc != ncoef)
+                error ("Wrong number of coefficient");
+              else
+                {
+
+                  dolfin::Vector b;
+                  dolfin::assemble (b, L);
+
+                  if (! boundarycondition_type_loaded)
+                    {
+                      boundarycondition::register_type ();
+                      boundarycondition_type_loaded = true;
+                      mlock ();
+                    }
+                  for (std::size_t i = 1; i < nargin; ++i)
+                    {
+                      if (args(i).type_id () == boundarycondition::static_type_id ())
+                        {
+                          const boundarycondition & bc 
+                            = static_cast<const boundarycondition&> (args(i).get_rep ());
+
+                          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(b);
+                        }
+                    }
+
+                  dim_vector dims;
+                  dims.resize (2);
+                  dims(0) = b.size ();
+                  dims(1) = 1;
+                  Array<double> myb (dims);
+
+                  for (std::size_t i = 0; i < b.size (); ++i)
+                    myb(i) = b[i];
+
+                  retval = myb;
+                }
+            }
+        }
+    }
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/obsolete/fem_rhs.cc	Thu Jul 25 12:17:57 2013 +0200
@@ -0,0 +1,146 @@
+/*
+ Copyright (C) 2013 Marco Vassallo
+
+ 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 2 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/>.
+*/
+
+#include "Laplace.h"
+#include <dolfin.h>
+#include "functionspace.h"
+#include "boundarycondition.h"
+#include "coefficient.h"
+
+DEFUN_DLD (fem_rhs, args, , "-*- texinfo -*-\n\
+@deftypefn {Function File} {[@var{bc}]} = \
+fem_rhs (@var{Functional Space}, @var{Coefficient}, \
+@var{Boundary Condition}) \n\
+The input parameters are\n\
+@itemize @bullet \n\
+@item @var{Functional Space} is the fem-fenics functional space where\
+the bilinear form is defined\n\
+@item @var{Boundary Condition} contains the value of the essential bc that\
+we want to apply to the Bilinear Form\n\
+@item @var{Coefficient} is a variable of type coefficient which contains\
+the value of the coefficient for the bilinear form\n\
+@end itemize\n\
+The output @var{A} is a sparse matrix which represents the bilinear form\n\
+@seealso{fem_init_mesh, fem_fs}\n\
+@end deftypefn")
+{
+
+  int nargin = args.length ();
+  octave_value retval;
+
+  if (nargin < 1)
+    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 ());
+
+          if (! error_state)
+            {
+              const dolfin::FunctionSpace V = fspo.get_fsp ();
+              Laplace::BilinearForm a (V, V);
+              std::size_t ncoef = a.num_coefficients (), nc = 0;
+
+              if (! coefficient_type_loaded)
+                {
+                  coefficient::register_type ();
+                  coefficient_type_loaded = true;
+                  mlock ();
+                }
+
+              for (std::size_t i = 1; i < nargin; ++i)
+                {
+                  if (args(i).type_id () == coefficient::static_type_id ())
+                    {
+                      const coefficient & cf
+                        = static_cast <const coefficient&> (args(i).get_rep ());
+
+                      std::size_t n = a.coefficient_number (cf.get_str ());
+                      const boost::shared_ptr<const expression> & pexp = cf.get_expr ();
+                      a.set_coefficient (n, pexp);
+                      ++nc;
+                    }
+                 }
+
+              if (nc != ncoef)
+                error ("Wrong number of coefficient");
+              else
+                {
+
+                  dolfin::Matrix A;
+                  dolfin::assemble (A, a);
+
+                  if (! boundarycondition_type_loaded)
+                    {
+                      boundarycondition::register_type ();
+                      boundarycondition_type_loaded = true;
+                      mlock ();
+                    }
+
+                  for (std::size_t i = 1; i < nargin; ++i)
+                    {
+                      if (args(i).type_id () == boundarycondition::static_type_id ())
+                        {
+                          const boundarycondition & bc 
+                            = static_cast<const boundarycondition&> (args(i).get_rep ());
+
+                          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);
+                        }
+                    }
+
+                  int nr = A.size (0), nc = A.size (1);
+                  // nz shoud be estimated in a better way
+                  int nz = nr * nc;
+                  SparseMatrix sm (nr, nc, nz);
+
+                  int ii = 0;
+                  sm.cidx (0) = 0;
+                  for (int j = 0; j < nc; ++j)
+                   {
+                     for (int i = 0; i < nr; i++)
+                       {
+                         double tmp = A(i, j);
+                         if (tmp != 0.)
+                           {
+                             sm.data(ii) = tmp;
+                             sm.ridx(ii) = i;
+                             ii++;
+                           }
+                       }
+                     sm.cidx(j+1) = ii;
+                  }
+                  sm.maybe_compress ();
+
+                  retval = sm;
+
+                }
+            }
+        }
+    }
+  return retval;
+}
--- a/src/Laplace.ufl	Thu Jul 25 12:14:38 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-# Copyright (C) 2005-2009 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN 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 Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2011-03-08
-#
-# The bilinear form a(u, v) and linear form L(v) for
-# Poisson's equation.
-#
-# Compile this form with FFC: ffc -l dolfin Poisson.ufl.
-
-
-element = FiniteElement("Lagrange", triangle, 1)
-# element = FiniteElement("Lagrange", tetrahedron, 2)
-
-u = TrialFunction(element)
-v = TestFunction(element)
-f = Coefficient(element)
-g = Coefficient(element)
-
-a = inner(grad(u), grad(v))*dx
-L = f*v*dx + g*v*ds
--- a/src/fem_fs.cc	Thu Jul 25 12:14:38 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- Copyright (C) 2013 Marco Vassallo
-
- 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 2 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/>.
-*/
-
-
-#include "functionspace.h"
-#include "mesh.h"
-#include "Laplace.h"
-
-DEFUN_DLD (fem_fs, args, , "initialize a fs from a mesh declared with fem_init_mesh")
-{
-  int nargin = args.length ();
-  octave_value retval;
-
-  if (nargin < 1 || nargin > 1)
-    print_usage ();
-  else
-    {
-
-      if (! mesh_type_loaded)
-        {
-          mesh::register_type ();
-          mesh_type_loaded = true;
-          mlock ();
-        }
-
-      if (args(0).type_id () == mesh::static_type_id ())
-        {
-          const mesh & msho = static_cast<const mesh&> (args(0).get_rep ());
-          const dolfin::Mesh & mshd = msho.get_msh ();
-          boost::shared_ptr <const dolfin::FunctionSpace> g (new Laplace::FunctionSpace (mshd));
-
-          if (! functionspace_type_loaded)
-            {
-              functionspace::register_type ();
-              functionspace_type_loaded = true;
-              mlock ();
-            }
-
-          retval = new functionspace(g);
-        }
-    }
-  return retval;
-}
--- a/src/fem_lhs.cc	Thu Jul 25 12:14:38 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
- Copyright (C) 2013 Marco Vassallo
-
- 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 2 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/>.
-*/
-
-#include "Laplace.h"
-#include <dolfin.h>
-#include "functionspace.h"
-#include "boundarycondition.h"
-#include "coefficient.h"
-
-DEFUN_DLD (fem_lhs, args, , "-*- texinfo -*-\n\
-@deftypefn {Function File} {[@var{bc}]} = \
-fem_rhs (@var{Functional Space}, @var{Coefficient}, \
-@var{Boundary Condition}) \n\
-The input parameters are\n\
-@itemize @bullet \n\
-@item @var{Functional Space} is the fem-fenics functional space where\
-the bilinear form is defined\n\
-@item @var{Boundary Condition} contains the value of the essential bc that\
-we want to apply to the Bilinear Form\n\
-@item @var{Coefficient} is a variable of type coefficient which contains\
-the value of the coefficient for the bilinear form\n\
-@end itemize\n\
-The output @var{A} is a sparse matrix which represents the bilinear form\n\
-@seealso{fem_init_mesh, fem_fs}\n\
-@end deftypefn")
-{
-
-  int nargin = args.length ();
-  octave_value retval;
-
-  if (nargin < 1)
-    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 ());
-
-          if (! error_state)
-            {
-              const dolfin::FunctionSpace V = fspo.get_fsp ();
-              Laplace::LinearForm L (V);
-              std::size_t ncoef = L.num_coefficients (), nc = 0;
-
-              if (! coefficient_type_loaded)
-                {
-                  coefficient::register_type ();
-                  coefficient_type_loaded = true;
-                  mlock ();
-                }
-              for (std::size_t i = 1; i < nargin; ++i)
-                {
-                  if (args(i).type_id () == coefficient::static_type_id ())
-                    {
-                      const coefficient & cf
-                        = static_cast <const coefficient&> (args(i).get_rep ());
-
-                      std::size_t n = L.coefficient_number (cf.get_str ());
-                      const boost::shared_ptr<const expression> & pexp = cf.get_expr ();
-                      L.set_coefficient (n, pexp);
-                      ++nc;
-                    }
-                 }
-
-              if (nc != ncoef)
-                error ("Wrong number of coefficient");
-              else
-                {
-
-                  dolfin::Vector b;
-                  dolfin::assemble (b, L);
-
-                  if (! boundarycondition_type_loaded)
-                    {
-                      boundarycondition::register_type ();
-                      boundarycondition_type_loaded = true;
-                      mlock ();
-                    }
-                  for (std::size_t i = 1; i < nargin; ++i)
-                    {
-                      if (args(i).type_id () == boundarycondition::static_type_id ())
-                        {
-                          const boundarycondition & bc 
-                            = static_cast<const boundarycondition&> (args(i).get_rep ());
-
-                          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(b);
-                        }
-                    }
-
-                  dim_vector dims;
-                  dims.resize (2);
-                  dims(0) = b.size ();
-                  dims(1) = 1;
-                  Array<double> myb (dims);
-
-                  for (std::size_t i = 0; i < b.size (); ++i)
-                    myb(i) = b[i];
-
-                  retval = myb;
-                }
-            }
-        }
-    }
-  return retval;
-}
--- a/src/fem_rhs.cc	Thu Jul 25 12:14:38 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
- Copyright (C) 2013 Marco Vassallo
-
- 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 2 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/>.
-*/
-
-#include "Laplace.h"
-#include <dolfin.h>
-#include "functionspace.h"
-#include "boundarycondition.h"
-#include "coefficient.h"
-
-DEFUN_DLD (fem_rhs, args, , "-*- texinfo -*-\n\
-@deftypefn {Function File} {[@var{bc}]} = \
-fem_rhs (@var{Functional Space}, @var{Coefficient}, \
-@var{Boundary Condition}) \n\
-The input parameters are\n\
-@itemize @bullet \n\
-@item @var{Functional Space} is the fem-fenics functional space where\
-the bilinear form is defined\n\
-@item @var{Boundary Condition} contains the value of the essential bc that\
-we want to apply to the Bilinear Form\n\
-@item @var{Coefficient} is a variable of type coefficient which contains\
-the value of the coefficient for the bilinear form\n\
-@end itemize\n\
-The output @var{A} is a sparse matrix which represents the bilinear form\n\
-@seealso{fem_init_mesh, fem_fs}\n\
-@end deftypefn")
-{
-
-  int nargin = args.length ();
-  octave_value retval;
-
-  if (nargin < 1)
-    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 ());
-
-          if (! error_state)
-            {
-              const dolfin::FunctionSpace V = fspo.get_fsp ();
-              Laplace::BilinearForm a (V, V);
-              std::size_t ncoef = a.num_coefficients (), nc = 0;
-
-              if (! coefficient_type_loaded)
-                {
-                  coefficient::register_type ();
-                  coefficient_type_loaded = true;
-                  mlock ();
-                }
-
-              for (std::size_t i = 1; i < nargin; ++i)
-                {
-                  if (args(i).type_id () == coefficient::static_type_id ())
-                    {
-                      const coefficient & cf
-                        = static_cast <const coefficient&> (args(i).get_rep ());
-
-                      std::size_t n = a.coefficient_number (cf.get_str ());
-                      const boost::shared_ptr<const expression> & pexp = cf.get_expr ();
-                      a.set_coefficient (n, pexp);
-                      ++nc;
-                    }
-                 }
-
-              if (nc != ncoef)
-                error ("Wrong number of coefficient");
-              else
-                {
-
-                  dolfin::Matrix A;
-                  dolfin::assemble (A, a);
-
-                  if (! boundarycondition_type_loaded)
-                    {
-                      boundarycondition::register_type ();
-                      boundarycondition_type_loaded = true;
-                      mlock ();
-                    }
-
-                  for (std::size_t i = 1; i < nargin; ++i)
-                    {
-                      if (args(i).type_id () == boundarycondition::static_type_id ())
-                        {
-                          const boundarycondition & bc 
-                            = static_cast<const boundarycondition&> (args(i).get_rep ());
-
-                          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);
-                        }
-                    }
-
-                  int nr = A.size (0), nc = A.size (1);
-                  // nz shoud be estimated in a better way
-                  int nz = nr * nc;
-                  SparseMatrix sm (nr, nc, nz);
-
-                  int ii = 0;
-                  sm.cidx (0) = 0;
-                  for (int j = 0; j < nc; ++j)
-                   {
-                     for (int i = 0; i < nr; i++)
-                       {
-                         double tmp = A(i, j);
-                         if (tmp != 0.)
-                           {
-                             sm.data(ii) = tmp;
-                             sm.ridx(ii) = i;
-                             ii++;
-                           }
-                       }
-                     sm.cidx(j+1) = ii;
-                  }
-                  sm.maybe_compress ();
-
-                  retval = sm;
-
-                }
-            }
-        }
-    }
-  return retval;
-}