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

Sun, Hui hus003 at ucsd.edu
Sat Jun 21 13:58:19 CDT 2014


Thank you. 

________________________________________
From: Jed Brown [jed at jedbrown.org]
Sent: Saturday, June 21, 2014 11:28 AM
To: Sun, Hui; petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] Vec Set DM and Mat Set DM

"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().


More information about the petsc-users mailing list