[petsc-users] petsc4py DA with dof>1 confusion

Matthew Emmett memmett at unc.edu
Mon Jul 4 14:48:14 CDT 2011


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
>
>


More information about the petsc-users mailing list