> On Nov 13, 2018, at 3:03 PM, Jed Brown via petsc-users > <petsc-users@mcs.anl.gov> wrote: > > Sajid Ali <sajidsyed2...@u.northwestern.edu> writes: > >> I'm still confused and have the following questions : >> >> 1) Suppose as in the case above a DM object (created using DMCreate1D) is >> used to created a matrix A using DMCreateMatrix, how does one convert the >> indices obtained from DMDAGetElements to the row and column indices for the >> matrix A ? Is there a function telling me exactly which sub-matrix each >> rank is storing ? > > Submatrix? > >> 2) From the ex6.c example above, it looks like e corresponds to row index >> and nen is the number of columns and i is the column index (which runs from >> 0 to nel) when addressing the matrix elements via MatSetValuesLocal. Is >> this correct? > > Yes, that's how local indices are used. It's also referenced in the man > page. > >> 3) How would the indices obtained from DMDAGetElements correspond to the >> indices for a vector created using DMCreateGlobalVector ? > > They don't; you want a local vector. Similar to the MatSetValuesLocal() there is a VecSetValuesLocal() that can be used with a vector obtained with DMCreateGlobalVector() to assemble the load. Barry
Re: [petsc-users] Question about DMDAGetElements
Smith, Barry F. via petsc-users Tue, 13 Nov 2018 16:03:53 -0800
- [petsc-users] Question about DMDAGetElemen... Sajid Ali via petsc-users
- Re: [petsc-users] Question about DMDA... Jed Brown via petsc-users
- Re: [petsc-users] Question about ... Sajid Ali via petsc-users
- Re: [petsc-users] Question ab... Jed Brown via petsc-users
- Re: [petsc-users] Questio... Smith, Barry F. via petsc-users
- Re: [petsc-users] Qu... Sajid Ali via petsc-users
- Re: [petsc-users... Smith, Barry F. via petsc-users
- Re: [petsc-u... Sajid Ali via petsc-users
- Re: [petsc-u... Mark Adams via petsc-users
- Re: [petsc-u... Sajid Ali via petsc-users
- Re: [petsc-u... Mark Adams via petsc-users
- Re: [petsc-u... Sajid Ali via petsc-users