>> I attached two extra (Petsc) matrices to an ImplicitSystem, assembled
>> one of them, and then tried to add them together using
>> PetscMatrix::add, but it didn't work because the sparsity patterns of
>> the two matrices weren't the same. This is because PetscMatrix::init()
>> doesn't generate a sparsity pattern from its dof_map, it simply sets
>> the appropriate number of rows, columns and non-zeros, so the matrix I
>> didn't touch actually had no sparsity pattern.
>> 
>> A simple fix was to change SAME_NONZERO_PATTERN in PetscMatrix::add to
>> DIFFERENT_NON_ZERO_PATTERN. But perhaps it would be more satisfactory
>> to loop over the dof_map in PetscMatrix::init() and set each entry in
>> the matrix sparsity pattern to zero explicitly (that would get the
>> Petsc to store the sparsity pattern, right? I should look that up...)

That should be OK in general, providing the preallocation is done properly
and setting the values individually does not incur huge dynamic memory
overhead...

I suppose, though, the simple fix may be the right one.  I think in general
we would like to be able to add matrices with different sparsity patterns,
right?

-Ben


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to