← Back to team overview

dolfin team mailing list archive

Assembler ambiguities

 

I've hit some bugs in the assembler classes because we have way to
many default arguments, and these cannot be uniquely resolved. For
example, consider the two functions:

    static void assemble(GenericMatrix& A,
                         GenericVector& b,
                         const Form& a,
                         const Form& L,
                         const std::vector<const DirichletBC*> bcs,
                         bool reset_sparsity=true,
                         bool add_values=false,
                         bool finalize_tensor=true,
                         bool keep_diagonal=false);

    /// Assemble system (A, b) and apply Dirichlet boundary conditions
    static void assemble(GenericMatrix& A,
                         GenericVector& b,
                         const Form& a,
                         const Form& L,
                         const std::vector<const DirichletBC*> bcs,
                         const MeshFunction<uint>* cell_domains,
                         const MeshFunction<uint>* exterior_facet_domains,
                         const MeshFunction<uint>* interior_facet_domains,
                         const GenericVector* x0,
                         bool reset_sparsity=true,
                         bool add_values=false,
                         bool finalize_tensor=true,
                         bool keep_diagonal=false);

Note that the last has 8 optional arguments!

If one calls

  assemble(A, b, a, L,  bcs, 0, 0, 0);

then either function could be called. I hit a bug in a non-contrived
case of passing integration subdomains to the assembler.

I propose that we remove all but the simplest assemble free functions,
and require the construction of an Assembler object for complicated
cases. This would greatly simplify cases like repeated assembly and
assembly of the RHS on when preserving symmetry.

Garth