On Tue, Nov 1, 2011 at 4:13 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im">On Tue, Nov 1, 2011 at 10:06, Alexander Grayver <span dir="ltr"><<a href="mailto:agrayver@gfz-potsdam.de" target="_blank">agrayver@gfz-potsdam.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#ffffff" text="#000000">Thanks Jed, looks easy. I've read about this parameter in
documentation, but it wasn't obvious how to use it. <br>
May be it's worth to mention it shortly in "2.4.4 Accessing the
Vector Entries for DMDA Vectors" or somewhere else.<br></div></blockquote><div><br></div></div><div>I'll add a note. The most common approach is to declare a struct</div><div><br></div><div><div>typedef struct {</div>
<div> PetscScalar u,v,omega,temp;</div><div>} Field;</div></div><div><br></div><div>and then access as x[j][i].omega, etc. An example:</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex50.c.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex50.c.html</a></div>
</div>
</blockquote></div><br>Or you can use<div><br></div><div> <a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DM/DMDAVecGetArrayDOF.html">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DM/DMDAVecGetArrayDOF.html</a></div>
<div><br></div><div>and access it as x[j][i][0-3].</div><div><br></div><div> Matt<br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>
</div>