DMDAGetElements#

Gets an array containing the indices (in local indexing) of all the local elements

Synopsis#

#include "petscdmda.h"   
PetscErrorCode DMDAGetElements(DM dm, PetscInt *nel, PetscInt *nen, const PetscInt *e[])

Not Collective

Input Parameter#

  • dm - the DMDA object

Output Parameters#

  • nel - number of local elements

  • nen - number of nodes in each element (for example in one dimension it is 2, in two dimensions it is 3 (for DMDA_ELEMENT_P1) and 4 (for DMDA_ELEMENT_Q1)

  • e - the local indices of the elements’ vertices, of length nel * nen

Notes#

Call DMDARestoreElements() once you have finished accessing the elements.

Each process uniquely owns a subset of the elements. That is no element is owned by two or more processes.

If on each process you integrate over its owned elements and use ADD_VALUES in Vec/MatSetValuesLocal() then you’ll obtain the correct result.

Fortran Note#

Use

   PetscScalar, pointer :: e(:)

to declare the element array

See Also#

DMDA - Creating vectors for structured grids, DM, DMDA, DMDAElementType, DMDASetElementType(), VecSetValuesLocal(), MatSetValuesLocal(), DMGlobalToLocalBegin(), DMLocalToGlobalBegin(), DMDARestoreElements(), DMDA_ELEMENT_P1, DMDA_ELEMENT_Q1, DMDAGetElementsSizes(), DMDAGetElementsCorners()

Level#

intermediate

Location#

src/dm/impls/da/dagetelem.c

Examples#

src/dm/tutorials/ex11f90.F90
src/ksp/ksp/tutorials/ex71.c
src/ksp/ksp/tutorials/ex70.c
src/dm/tutorials/ex5.c

Implementations#

DMDAGetElements_1D() in src/dm/impls/da/dagetelem.c
DMDAGetElements_2D() in src/dm/impls/da/dagetelem.c
DMDAGetElements_3D() in src/dm/impls/da/dagetelem.c


Index of all DMDA routines
Table of Contents for all manual pages
Index of all manual pages