[petsc-users] Passing DMMG struct.

Jed Brown jed at 59A2.org
Mon Nov 22 18:02:03 CST 2010


On Tue, Nov 23, 2010 at 00:27, Sean Farley <sean at mcs.anl.gov> wrote:

> 2) Change your function declaration back to what you had:
>
> PetscErrorCode ComputeRho(DMMG dmmg, Vec rho)
> {...}
>
> and then pass the object to your function as so:
>
> ComputeRho(*dmmg, b);
>
> Do you need your dmmg to be a pointer in your 'main' function? It looks
> like your declaration could just be:
>

DMMG is simultaneously an array representing a full hierarchy and the
individual levels in the hierarchy.  If you have

  DMMG *dmmg;

then dmmg[0] (same as *dmmg) represents the coarsest level.  If your
function only works on one level, then you should just pass in a DMMG (not a
DMMG*).  If your function only needs the dmmg->dm field, then just make your
function use a DA, then make that the argument of your function and call it
as

DMMG *dmmg;
// dmmg is initialized somehow ...
MyFunc(DMMGGetDA(dmmg),bvec);

This passes in the DA on the finest level.

DMMG is a weird beast.  Once its functionality has been migrated to SNES and
KSP (underway in petsc-dev), it will be removed.

Jed

Jed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101123/011bf4a5/attachment.htm>


More information about the petsc-users mailing list