xref: /petsc/src/dm/impls/da/dapreallocate.c (revision dce8aeba1c9b69b19f651c53d8a6b674bd7e9cbd)
1af0996ceSBarry Smith #include <petsc/private/dmdaimpl.h> /*I      "petscdmda.h"   I*/
2af0996ceSBarry Smith #include <petsc/private/isimpl.h>
33d183407SMatthew G. Knepley #include <petscsf.h>
43d183407SMatthew G. Knepley 
53d183407SMatthew G. Knepley /*@
63d183407SMatthew G. Knepley   DMDASetPreallocationCenterDimension - Determine the topology used to determine adjacency
73d183407SMatthew G. Knepley 
83d183407SMatthew G. Knepley   Input Parameters:
9*dce8aebaSBarry Smith + dm - The `DMDA` object
103d183407SMatthew G. Knepley - preallocCenterDim - The dimension of points which connect adjacent entries
113d183407SMatthew G. Knepley 
123d183407SMatthew G. Knepley   Level: developer
133d183407SMatthew G. Knepley 
143d183407SMatthew G. Knepley   Notes:
15*dce8aebaSBarry Smith .vb
16*dce8aebaSBarry Smith      FEM:   Two points p and q are adjacent if q \in closure(star(p)), preallocCenterDim = dim
17*dce8aebaSBarry Smith      FVM:   Two points p and q are adjacent if q \in star(cone(p)),    preallocCenterDim = dim-1
18*dce8aebaSBarry Smith      FVM++: Two points p and q are adjacent if q \in star(closure(p)), preallocCenterDim = 0
19*dce8aebaSBarry Smith .ve
203d183407SMatthew G. Knepley 
21*dce8aebaSBarry Smith .seealso: `DM`, `DMDA`, `DMCreateMatrix()`, `DMDAPreallocateOperator()`
223d183407SMatthew G. Knepley @*/
23d71ae5a4SJacob Faibussowitsch PetscErrorCode DMDASetPreallocationCenterDimension(DM dm, PetscInt preallocCenterDim)
24d71ae5a4SJacob Faibussowitsch {
253d183407SMatthew G. Knepley   DM_DA *mesh = (DM_DA *)dm->data;
263d183407SMatthew G. Knepley 
273d183407SMatthew G. Knepley   PetscFunctionBegin;
28a9a02de4SBarry Smith   PetscValidHeaderSpecificType(dm, DM_CLASSID, 1, DMDA);
293d183407SMatthew G. Knepley   mesh->preallocCenterDim = preallocCenterDim;
303d183407SMatthew G. Knepley   PetscFunctionReturn(0);
313d183407SMatthew G. Knepley }
323d183407SMatthew G. Knepley 
333d183407SMatthew G. Knepley /*@
343d183407SMatthew G. Knepley   DMDAGetPreallocationCenterDimension - Return the topology used to determine adjacency
353d183407SMatthew G. Knepley 
363d183407SMatthew G. Knepley   Input Parameter:
37*dce8aebaSBarry Smith . dm - The `DMDA` object
383d183407SMatthew G. Knepley 
393d183407SMatthew G. Knepley   Output Parameter:
403d183407SMatthew G. Knepley . preallocCenterDim - The dimension of points which connect adjacent entries
413d183407SMatthew G. Knepley 
423d183407SMatthew G. Knepley   Level: developer
433d183407SMatthew G. Knepley 
443d183407SMatthew G. Knepley   Notes:
45*dce8aebaSBarry Smith .vb
46*dce8aebaSBarry Smith      FEM:   Two points p and q are adjacent if q \in closure(star(p)), preallocCenterDim = dim
47*dce8aebaSBarry Smith      FVM:   Two points p and q are adjacent if q \in star(cone(p)),    preallocCenterDim = dim-1
48*dce8aebaSBarry Smith      FVM++: Two points p and q are adjacent if q \in star(closure(p)), preallocCenterDim = 0
49*dce8aebaSBarry Smith .ve
503d183407SMatthew G. Knepley 
51*dce8aebaSBarry Smith .seealso: `DM`, `DMDA`, `DMCreateMatrix()`, `DMDAPreallocateOperator()`, `DMDASetPreallocationCenterDimension()`
523d183407SMatthew G. Knepley @*/
53d71ae5a4SJacob Faibussowitsch PetscErrorCode DMDAGetPreallocationCenterDimension(DM dm, PetscInt *preallocCenterDim)
54d71ae5a4SJacob Faibussowitsch {
553d183407SMatthew G. Knepley   DM_DA *mesh = (DM_DA *)dm->data;
563d183407SMatthew G. Knepley 
573d183407SMatthew G. Knepley   PetscFunctionBegin;
58a9a02de4SBarry Smith   PetscValidHeaderSpecificType(dm, DM_CLASSID, 1, DMDA);
593d183407SMatthew G. Knepley   PetscValidIntPointer(preallocCenterDim, 2);
603d183407SMatthew G. Knepley   *preallocCenterDim = mesh->preallocCenterDim;
613d183407SMatthew G. Knepley   PetscFunctionReturn(0);
623d183407SMatthew G. Knepley }
63