[petsc-users] DMDA questions

Jed Brown jed at jedbrown.org
Tue Feb 25 13:11:17 CST 2014


Xiangdong <epscodes at gmail.com> writes:

> Okay. The local vector is equal to the local portion of global vector +
> ghost values. Both of them use the same PETSc ordering.
>
> The reason I got confused before is I use VecView(vglobal,
> PETSC_VIEWER_STDOUT_WORLD) to view the global vector. In the output, it has
> process[0] 1 2 3 4 process[1] 5 6 7 8 .... They are actually not the values
> stored in processor 0 and 1. They are different from the values printed
> through VecGetArray.

VecView transforms to natural ordering for output.  If you want to see
the PETSc ordering, use

 PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD,PETSC_VIEWER_NATIVE);
 VecView(vglobal,PETSC_VIEWER_STDOUT_WORLD);
 PetscViewerPopFormat(PETSC_VIEWER_STDOUT_WORLD);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140225/db341742/attachment.pgp>


More information about the petsc-users mailing list