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.<div>
<br></div><div>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().</div>
<div><br></div><div>Should we promote these functions to Mat, as in MatSetOperation(), MatSetContext(), and MatGetContext()?</div><div><br></div><div>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.</div>
<div><br></div><div>Also, this looks like a minor naming inconsistency:</div><div><br></div><div>PCShellSetContext</div><div>DMSetContext</div><div>MatShellSetContext</div><div><br></div><div>KSPSetApplicationContext</div>
<div>SNESSetApplicationContext</div><div>TSSetApplicationContext</div>