[petsc-users] Question about DMDAGetElements

Mark Adams mfadams at lbl.gov
Mon Nov 19 15:57:25 CST 2018


You seem to be confusing the degree of the mesh and the "degree" of the
matrix and vector.

A matrix is always N x M (2D if you like), a vector is always N (or 1 x N,
or 1D if you like).

The mesh in a DM or DA can be 1, 2 or 3D.

On Mon, Nov 19, 2018 at 4:44 PM Sajid Ali via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> So, DMDA is used for sparse matrices arising from FD/FE and
> MatCreateMPIAIJ can be used for dense matrices (though it is strongly
> discouraged).
>
> My confusion stemmed from DMDAGetElements giving the element indices for
> the 1D mesh/vector of size N(when the DMDACreate1d is used). But these
> indices were then used as local indices to set the values for a 2D matrix
> (via MatSetValuesLocal ) created using the same DM (now we have NxN
> elements).
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20181119/bc302de9/attachment.html>


More information about the petsc-users mailing list