On Sun, Mar 18, 2012 at 18:24, Matthew Knepley <knepley@gmail.com> wrote:
In the alternate model, you call MatAssemblyBegin/End() when the matrix is marked as unassembled. Its easy to check this flag, so the user
will not be confused. Barry is correct that the flag reset is not collective, so that query would have to be.
We should think as though we are in a world where the query costs as much as the assembly itself because that is a better approximation of reality than the alternatives.
I do not think "fragile" is an accurate characterization because failure is immediate when trying to use a function that requires assembly, and it
also obvious what the fix is, to assemble the matrix.
It's not collective.
You might mean that the existing model is more intuitive. I disagree since it is currently impossible to do something simple like
chop out small values from a matrix.
MatGetArray()
Or you actually want to remove them from the nonzero pattern? In that case, you definitely have to assemble, which means there is a new partly-assembled state (locally consistent, but not globally).
The proposal is to augment the current model with MatGetRowWrite(). This would mean
not only adding to the interface, but writing all the code to put values back into the matrix if the row is a copy. I think it is more
intuitive to allow the user to SetValues() if the nonzero pattern is unchanged and no values need to be communicated.
MatSetValues() is a very permissive interface for modifying data in-place.