On Tue, 19 Jan 2010 13:57:06 -0500, "(Rebecca) Xuefei YUAN" <xy2102 at
columbia.edu> wrote:
> Quoting Jed Brown <jed at 59A2.org>:
> If I want to do it like your way, how could I handle the different dof
> in the call
> if (!eda) {
> // create eda based on the layout of da
^^^^
This is where your
DACreate2D(...,sizeof(FieldOther)/sizeof(PetscScalar),...,&eda) goes.
> PetscObjectCompose((PetscObject)da,"ExtraDA",eda);
> DADestroy(eda); // give away ownership
> Why eda is destroyed before I can use it in DAGetArray?
DADestroy(eda) could also be written
PetscObjectDereference((PetscObject)eda). When you compose eda with
dmmg->dm, it increases the reference count. The DADestroy(eda) just
decreases the reference count so that it will properly be destroyed
inside DMMGDestroy() at end of your program. So it's just giving away
ownership.
> Is that mean PetscReal and PetscScalar are the same if it is not
> complex, however, for a better compatible reason, should I change all
> my PetscReal to PetscScalar?
Yes, PetscScalar is for all "solution-like" variables, PetscReal is
mostly used for parameters (length scales, Reynold's number, material
constants) and norms.
Jed