1 #include <petsc/private/dmdaimpl.h> /*I "petscdmda.h" I*/ 2 #include <petsc/private/isimpl.h> 3 #include <petscsf.h> 4 5 /*@ 6 DMDASetPreallocationCenterDimension - Determine the topology used to determine adjacency 7 8 Input Parameters: 9 + dm - The DM object 10 - preallocCenterDim - The dimension of points which connect adjacent entries 11 12 Level: developer 13 14 Notes: 15 $ FEM: Two points p and q are adjacent if q \in closure(star(p)), preallocCenterDim = dim 16 $ FVM: Two points p and q are adjacent if q \in star(cone(p)), preallocCenterDim = dim-1 17 $ FVM++: Two points p and q are adjacent if q \in star(closure(p)), preallocCenterDim = 0 18 19 .seealso: `DMCreateMatrix()`, `DMDAPreallocateOperator()` 20 @*/ 21 PetscErrorCode DMDASetPreallocationCenterDimension(DM dm, PetscInt preallocCenterDim) { 22 DM_DA *mesh = (DM_DA *)dm->data; 23 24 PetscFunctionBegin; 25 PetscValidHeaderSpecificType(dm, DM_CLASSID, 1, DMDA); 26 mesh->preallocCenterDim = preallocCenterDim; 27 PetscFunctionReturn(0); 28 } 29 30 /*@ 31 DMDAGetPreallocationCenterDimension - Return the topology used to determine adjacency 32 33 Input Parameter: 34 . dm - The DM object 35 36 Output Parameter: 37 . preallocCenterDim - The dimension of points which connect adjacent entries 38 39 Level: developer 40 41 Notes: 42 $ FEM: Two points p and q are adjacent if q \in closure(star(p)), preallocCenterDim = dim 43 $ FVM: Two points p and q are adjacent if q \in star(cone(p)), preallocCenterDim = dim-1 44 $ FVM++: Two points p and q are adjacent if q \in star(closure(p)), preallocCenterDim = 0 45 46 .seealso: `DMCreateMatrix()`, `DMDAPreallocateOperator()`, `DMDASetPreallocationCenterDimension()` 47 @*/ 48 PetscErrorCode DMDAGetPreallocationCenterDimension(DM dm, PetscInt *preallocCenterDim) { 49 DM_DA *mesh = (DM_DA *)dm->data; 50 51 PetscFunctionBegin; 52 PetscValidHeaderSpecificType(dm, DM_CLASSID, 1, DMDA); 53 PetscValidIntPointer(preallocCenterDim, 2); 54 *preallocCenterDim = mesh->preallocCenterDim; 55 PetscFunctionReturn(0); 56 } 57