Re: [petsc-users] In a 2D DMDA object, how to convert (i, j) to a global index?

2019-01-08 Thread Smith, Barry F. via petsc-users
Yes because the i,j are global indices into the entire array. > On Jan 8, 2019, at 4:59 PM, Fande Kong wrote: > > > > On Tue, Jan 8, 2019 at 3:40 PM Smith, Barry F. wrote: > > > > On Jan 8, 2019, at 4:35 PM, Jed Brown wrote: > > > > "Smith, Barry F. via petsc-users" writes: > > > >

Re: [petsc-users] In a 2D DMDA object, how to convert (i, j) to a global index?

2019-01-08 Thread Jed Brown via petsc-users
Fande Kong writes: > Thanks Barry and Jed, > > I think I understood now. > > One more question. We usually have a code pattern in some PETSc DMDA > examples as follows: > > DMDAVecGetArrayRead(da,localU,&uarray); > DMDAVecGetArray(da,F,&f); > > DMDAGetCorners(da,&xs,&ys,NULL,&xm,&ym,NULL); > > fo

Re: [petsc-users] In a 2D DMDA object, how to convert (i, j) to a global index?

2019-01-08 Thread Smith, Barry F. via petsc-users
> On Jan 8, 2019, at 4:35 PM, Jed Brown wrote: > > "Smith, Barry F. via petsc-users" writes: > >>> On Jan 8, 2019, at 4:11 PM, Fande Kong via petsc-users >>> wrote: >>> >>> Hi All, >>> >>> I was wondering how to convert a regular (2D DMDA) grid coordinate (i,j) to >>> a global index tha

Re: [petsc-users] In a 2D DMDA object, how to convert (i, j) to a global index?

2019-01-08 Thread Jed Brown via petsc-users
"Smith, Barry F. via petsc-users" writes: >> On Jan 8, 2019, at 4:11 PM, Fande Kong via petsc-users >> wrote: >> >> Hi All, >> >> I was wondering how to convert a regular (2D DMDA) grid coordinate (i,j) to >> a global index that is used for global matrices and vectors. Do we have any >> API

Re: [petsc-users] In a 2D DMDA object, how to convert (i, j) to a global index?

2019-01-08 Thread Smith, Barry F. via petsc-users
> On Jan 8, 2019, at 4:11 PM, Fande Kong via petsc-users > wrote: > > Hi All, > > I was wondering how to convert a regular (2D DMDA) grid coordinate (i,j) to a > global index that is used for global matrices and vectors. Do we have any API > on this? You can convert the global i,j to