Matt, Also, in case you are looking for an example of how it is done in PyClaw:
https://github.com/clawpack/pyclaw/tree/master/apps/shallow/2d 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. A On Mon, Jul 4, 2011 at 10:48 PM, Matthew Emmett <memmett at unc.edu> wrote: > Hey Aaron, > > Thanks for the tip! I'll play around with the indexing and reshaping. > > Matt > > On Mon, Jul 4, 2011 at 3:33 PM, Aron Ahmadia <aron.ahmadia at kaust.edu.sa> > wrote: > > Hi Matt! > > We deal with this same issue in PyClaw/PetClaw, I think Amal could do a > much > > better job describing the approach (or copying a relevant section from > her > > Master's thesis) we take to avoid copying, but the idea is to follow the > > native PETSc ordering with interleaved degrees-of-freedom to keep the > most > > compatibility with the other DA calls. > > A > > On Mon, Jul 4, 2011 at 10:19 PM, Matthew Emmett <memmett at unc.edu> wrote: > >> > >> On Mon, Jul 4, 2011 at 2:52 PM, Lisandro Dalcin <dalcinl at gmail.com> > wrote: > >> > No, sorry... It has nothing to do with periodicity... It is actually a > >> > C/Fortran ordering issue I need to fix... > >> > >> Ah, I see. Thanks for looking into this so quickly. Let me know if > >> there is anything I can do on my end to help. I will poke around the > >> code for petsc4py, but you obviously know it better than I do. > >> > >> > In Fortran 90, it seems you index a DA Vec array as A[dof,x,y,z]... , > >> > However, I think that for Python we should follow a more C-ish > >> > indexing A[x,y,z,dof]. Or we could do it like PETSc in C, that is > >> > A[z,y,x,dof] (wich is the transpose of the Fortran way) but it is > >> > counter-intuitive to C (and likely Python) programmers ... > >> > > >> > What do others think about this? > >> > >> I think A[x,y,z,dof] is probably the most intuitive for Python. > >> > >> Matt > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110704/2979c1fc/attachment.htm>
