← Back to team overview

dolfin team mailing list archive

Linear algebra cleanups

 

According to our discussion last week, I have now cleaned out most of
the templates from linear algebra and assembly. More cleanups will be
needed. This is a fairly big patch so we might expect some initial
glitches.

Here's a summary of the changes:

 - GenericMatrix and GenericVector are no longer templates.

   As we saw last week, the templating does not gain anything and
   removing the templates makes the code simpler.

 - Remove most of the templating from FEM.h and move code to FEM.cpp.

   Templating over matrix types is no longer needed. Only templates
   that remain are for iteration over the boundary. These templates
   can also be removed when the new mesh library is in place.

 - Add new classes SparseMatrix, SparseVector.

   These are the old Matrix, Vector (PETSc wrappers).

 - Make typedefs for Matrix and Vector, defaulting to SparseMatrix,
   SparseVector.

   This has some consequences. It is not possible to forward declare
   a typedef, so 'class Vector;' does not work, one must include
   Vector.h.

   Algorithms should try to operate on GenericFoo when possible and
   on SparseFoo/DenseFoo when necessary. In addition, one can operate
   directly through the shortcut Foo (Matrix, Vector), but that should be
   avoided at least in the linear algebra library. In other libraries
   it may be ok. I'm unsure about what policy to adopt but we'll
   figure something out.

 - Include all PETSc stuff in PETScManager.h.

   PETSc headers should never be included directly. Include
   PETScManager.h instead to avoid the bug when including petscerror.h
   before boost.

 - Remove A = 0.

   Use A.zero() instead. Might be readded later.

 - Lots of other minor things.

We should make sure that GenericMatrix and GenericVector stay pretty
clean, consistent and well structured. The structure should also
propagate to SparseMatrix, DenseMatrix and so on. Some more cleanups
are needed.

/Anders