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

Jed Brown jed at jedbrown.org
Wed Apr 27 15:49:40 CDT 2016


Dave May <dave.mayhem23 at gmail.com> writes:
> 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?

You're just objecting to the function being named DMShellSetCreateMatrix
instead of DMSetCreateMatrix?

> 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.

The MatOperation enums are a bit of a maintenance burden and don't offer
any type checking.  We have them for Mat and Vec (sort of) because there
are so many methods.  We could add them for other objects, but would
give up type checking relative to the existing specialized functions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160427/592c45bf/attachment.pgp>


More information about the petsc-users mailing list