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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110606/df9369d4/attachment.html>
