[petsc-users] PETSc DM ex13f90

Åsmund Ervik asmund.ervik at ntnu.no
Mon May 2 13:23:23 CDT 2016


  
>
>Thanks a lot for such a lucid explanation. The note which you mentioned at the end is very important for me, as my code contains loops going from both 1 to N and 0 to N+1.
>

You're welcome.

Just to avoid any potential misunderstanding: the note at the end was if you have loops over your "real" (non-ghost) variables going from 0 to N-1, i.e. zero indexing as in C, where the first index of your "real" values is 0, ghost values are at -1 and below and at N and above. 

On the other hand, if you have some loops from 1 to N and some loops from 0 to N+1, it means you have some loops over just the "real" variables (1 to N) and some loops over "real" + ghost variables (0 to N+1). In this case, you do not need to change the code. Just set the stencil width to 1 (or to 2 if your "widest" loop goes from -1 to N+2, etc.).

(When I say "real", I don't mean as in real vs. complex numbers, but as in the grid point values that are not boundary conditions.)

Regards,
Åsmund


More information about the petsc-users mailing list