On 26 April 2016 at 23:58, Jed Brown <j...@jedbrown.org> wrote: > Dave May <dave.mayhe...@gmail.com> writes: > > You are always free to over-ride the method > > dm->ops->creatematrix > > with your own custom code to create > > and preallocate the matrix. > > DMShellSetCreateMatrix() > > No need to include the private header. I know this isn't great. >
This always bugged me. I prefer to access the pointer as at least it's clear what I am doing and when reading the code later, I am not required to ask myself whether the DM is actually a shell or not. Why doesn't there exist a generic setter for each object which allows one to set a method for a particular operation? The implementation for Mat defines typedef enum { } MatOperation. Using this, we could have PetscErrorCode MatSetOperation(Mat mat,MatOperation op,zzzzz) If there was a similar typedef enum for all other objects, an XXXSetOperation() would be viable. Is there a good reason to not have such a setter in the library? Thanks, Dave