[petsc-users] Vec Set DM and Mat Set DM

Jed Brown jed at jedbrown.org
Sat Jun 21 13:28:52 CDT 2014


"Sun, Hui" <hus003 at ucsd.edu> writes:

> I'm thinking about defining a distributed Vec using grid information. The usual way to do that is to call VecCreateMPI, or VecCreate and VecSetSizes. However, that does not necessarily distribute Vec according to the grid information, DM. I'm thinking of doing something like:
>
> ierr = DMDAGetInfo(da,0,&mx,&my,0,0,0,0,0,0,0,0,0,0);CHKERRQ(ierr);
>
> ierr = DMDAGetCorners(da,&xs,&ys,NULL,&xm,&ym,NULL);
>
>
> and then define the Vec according to (xs,ys,xm,ym). 

Use DMCreateGlobalVector() and DMCreateLocalVector().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140621/7cff04b4/attachment.pgp>


More information about the petsc-users mailing list