[petsc-users] Allocating memory for off-diagonal matrix blocks when using DMComposite

Dave May dave.mayhem23 at gmail.com
Tue Apr 26 17:18:11 CDT 2016


On 26 April 2016 at 23:58, Jed Brown <jed at jedbrown.org> wrote:

> Dave May <dave.mayhem23 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160427/d008fa13/attachment.html>


More information about the petsc-users mailing list