[petsc-dev] Promote MatShellSetOperation() and MatShellSetContext() to Mat

Dmitry Karpeev karpeev at mcs.anl.gov
Mon Jun 6 06:44:18 CDT 2011


A related matter: should there be a way to reset the MatSetValuesLocal method?
The setting of local values frequently depends on factors other than
the type of the matrix.
The default implementation depends only on the class (Mat) rather than
the type (e.g., MATMPIAIJ)
of the matrix.

Dmitry.

On Mon, Jun 6, 2011 at 6:25 AM, Jed Brown <jed at 59a2.org> wrote:
> We already semi-sanction using MatShellSetOperation() to provide different
> implementations for matrices that are not of type MATSHELL. An example of
> this is having a matrix-free way to apply the action of a MatNest in one
> pass over the mesh.
> The problem is that one can't call MatShellGetContext() if given a matrix of
> a type that is not MATSHELL. MatShellSetContext() is just silently ignored
> and then NULL is returned by MatShellGetContext().
> Should we promote these functions to Mat, as in MatSetOperation(),
> MatSetContext(), and MatGetContext()?
> The alternative is for the user to make their application context a
> PetscObject so that it can be composed. I've done this quite a lot, but I
> don't think it should be necessary.
> Also, this looks like a minor naming inconsistency:
> PCShellSetContext
> DMSetContext
> MatShellSetContext
> KSPSetApplicationContext
> SNESSetApplicationContext
> TSSetApplicationContext



More information about the petsc-dev mailing list