[petsc-users] Question about DMDAGetElements

Jed Brown jed at jedbrown.org
Tue Nov 13 15:03:29 CST 2018


Sajid Ali <sajidsyed2021 at 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.


More information about the petsc-users mailing list