Thank you. 

________________________________________
From: Jed Brown [[email protected]]
Sent: Saturday, June 21, 2014 11:28 AM
To: Sun, Hui; [email protected]
Subject: Re: [petsc-users] Vec Set DM and Mat Set DM

"Sun, Hui" <[email protected]> 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().

Reply via email to