On Tue, Nov 1, 2011 at 4:13 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> On Tue, Nov 1, 2011 at 10:06, Alexander Grayver <agrayver at > gfz-potsdam.de>wrote: > >> Thanks Jed, looks easy. I've read about this parameter in documentation, >> but it wasn't obvious how to use it. >> May be it's worth to mention it shortly in "2.4.4 Accessing the Vector >> Entries for DMDA Vectors" or somewhere else. >> > > I'll add a note. The most common approach is to declare a struct > > typedef struct { > PetscScalar u,v,omega,temp; > } Field; > > and then access as x[j][i].omega, etc. An example: > > > http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex50.c.html > Or you can use http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DM/DMDAVecGetArrayDOF.html and access it as x[j][i][0-3]. Matt -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111101/301528de/attachment.htm>