Actual source code: dapreallocate.c

  1: #include <petsc/private/dmdaimpl.h>
  2: #include <petsc/private/isimpl.h>
  3: #include <petscsf.h>

  5: /*@
  6:   DMDASetPreallocationCenterDimension - Determine the topology used to determine adjacency

  8:   Input Parameters:
  9: + dm - The `DMDA` object
 10: - preallocCenterDim - The dimension of points which connect adjacent entries

 12:   Level: developer

 14:   Notes:
 15: .vb
 16:      FEM:   Two points p and q are adjacent if q \in closure(star(p)), preallocCenterDim = dim
 17:      FVM:   Two points p and q are adjacent if q \in star(cone(p)),    preallocCenterDim = dim-1
 18:      FVM++: Two points p and q are adjacent if q \in star(closure(p)), preallocCenterDim = 0
 19: .ve

 21: .seealso: `DM`, `DMDA`, `DMCreateMatrix()`, `DMDAPreallocateOperator()`
 22: @*/
 23: PetscErrorCode DMDASetPreallocationCenterDimension(DM dm, PetscInt preallocCenterDim)
 24: {
 25:   DM_DA *mesh = (DM_DA *)dm->data;

 28:   mesh->preallocCenterDim = preallocCenterDim;
 29:   return 0;
 30: }

 32: /*@
 33:   DMDAGetPreallocationCenterDimension - Return the topology used to determine adjacency

 35:   Input Parameter:
 36: . dm - The `DMDA` object

 38:   Output Parameter:
 39: . preallocCenterDim - The dimension of points which connect adjacent entries

 41:   Level: developer

 43:   Notes:
 44: .vb
 45:      FEM:   Two points p and q are adjacent if q \in closure(star(p)), preallocCenterDim = dim
 46:      FVM:   Two points p and q are adjacent if q \in star(cone(p)),    preallocCenterDim = dim-1
 47:      FVM++: Two points p and q are adjacent if q \in star(closure(p)), preallocCenterDim = 0
 48: .ve

 50: .seealso: `DM`, `DMDA`, `DMCreateMatrix()`, `DMDAPreallocateOperator()`, `DMDASetPreallocationCenterDimension()`
 51: @*/
 52: PetscErrorCode DMDAGetPreallocationCenterDimension(DM dm, PetscInt *preallocCenterDim)
 53: {
 54:   DM_DA *mesh = (DM_DA *)dm->data;

 58:   *preallocCenterDim = mesh->preallocCenterDim;
 59:   return 0;
 60: }