<div dir="ltr"><div>Matt,</div><div><br></div><div>Also, in case you are looking for an example of how it is done in PyClaw:</div><div><br></div><div><a href="https://github.com/clawpack/pyclaw/tree/master/apps/shallow/2d">https://github.com/clawpack/pyclaw/tree/master/apps/shallow/2d</a></div>
<div><br></div><div>Shallow-water is not one of the automatically verified examples, but we'll be happy to help you if you have any questions about the code.</div><div><br></div><div>A<br><br><div class="gmail_quote">
On Mon, Jul 4, 2011 at 10:48 PM, Matthew Emmett <span dir="ltr"><<a href="mailto:memmett@unc.edu">memmett@unc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hey Aaron,<br>
<br>
Thanks for the tip! I'll play around with the indexing and reshaping.<br>
<br>
Matt<br>
<div><div></div><div class="h5"><br>
On Mon, Jul 4, 2011 at 3:33 PM, Aron Ahmadia <<a href="mailto:aron.ahmadia@kaust.edu.sa">aron.ahmadia@kaust.edu.sa</a>> wrote:<br>
> Hi Matt!<br>
> We deal with this same issue in PyClaw/PetClaw, I think Amal could do a much<br>
> better job describing the approach (or copying a relevant section from her<br>
> Master's thesis) we take to avoid copying, but the idea is to follow the<br>
> native PETSc ordering with interleaved degrees-of-freedom to keep the most<br>
> compatibility with the other DA calls.<br>
> A<br>
> On Mon, Jul 4, 2011 at 10:19 PM, Matthew Emmett <<a href="mailto:memmett@unc.edu">memmett@unc.edu</a>> wrote:<br>
>><br>
>> On Mon, Jul 4, 2011 at 2:52 PM, Lisandro Dalcin <<a href="mailto:dalcinl@gmail.com">dalcinl@gmail.com</a>> wrote:<br>
>> > No, sorry... It has nothing to do with periodicity... It is actually a<br>
>> > C/Fortran ordering issue I need to fix...<br>
>><br>
>> Ah, I see. Thanks for looking into this so quickly. Let me know if<br>
>> there is anything I can do on my end to help. I will poke around the<br>
>> code for petsc4py, but you obviously know it better than I do.<br>
>><br>
>> > In Fortran 90, it seems you index a DA Vec array as A[dof,x,y,z]... ,<br>
>> > However, I think that for Python we should follow a more C-ish<br>
>> > indexing A[x,y,z,dof]. Or we could do it like PETSc in C, that is<br>
>> > A[z,y,x,dof] (wich is the transpose of the Fortran way) but it is<br>
>> > counter-intuitive to C (and likely Python) programmers ...<br>
>> ><br>
>> > What do others think about this?<br>
>><br>
>> I think A[x,y,z,dof] is probably the most intuitive for Python.<br>
>><br>
>> Matt<br>
><br>
><br>
</div></div></blockquote></div><br></div></div>