On Mon, Jun 30, 2008 at 01:48:33PM +0200, Martin Sandve Alnæs wrote: > 2008/6/30 Kent-Andre Mardal <[EMAIL PROTECTED]>: > > On Sat, 2008-06-28 at 20:55 +0200, Johan Hake wrote: > >> Hello! > >> > >> I tried to compile an advection diffusion form using Streamline Upwind > >> Petrow > >> Galerkin stabilazing method, similar to the one introduced in DOLFIN 0.6.4. > >> Using 3 dimensional and first degree Lagrange elements, FFC/g++ chokes when > >> the produced code is compiling. It wont finish compile... Is this a known > >> problem and a limitation of FFC/g++? > >> > >> In PyCC I use DOLFIN to assemble the same system matrix, but instead of > >> using > >> one form for the whole system I split the form into at least 4 different > >> forms. These compiles smoothly and after I have assembled the matrices I > >> just > >> add them together. > >> > >> This approach is not possible using the present DOLFIN linear algebra > >> interface, as sum of matrices is not supported. Is this something we want > >> for > >> the future? > >> > >> Johan > > > > If the matrices come from the same dof_map one "should" be able to add > > to matrices together (and if not I guess you > > would not add them toghether). The problem is that the matrices > > themselves do not know what their created from. > > > > However, one could write a function > > > > matrix_add(mesh, dof_map, A, B, C); > > > > That does the trick in terms of the tabulate_dofs funcition in dof_map > > and the get, add functions in GenericMatrix. > > > > Kent > > Note that if the matrices have optimized sparsity patterns, > i.e. all zeros have been removed after the assembly, > having the same dof_map is not enough to say they can be added. > > If we later add the previously discussed feature with equation specific > local sparsity patterns to UFC and the Assembler, we may even > assemble directly into such equation-specific matrices.
I think we should be able to add matrices together without needing to refer to a dof_map. The matrix does not know the dof_map that generated it but, it should be able to generate its sparsity pattern. Then we can extract the sparsity patterns for A and B, generate a new sparsity pattern, initialize the new matrix and then insert the values. -- Anders
signature.asc
Description: Digital signature
_______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
