xref: /petsc/src/dm/impls/da/dapreallocate.c (revision 2971ee689451696b9a4f220d5834ed6a552b9fb6)
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:
9dce8aebaSBarry 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:
15dce8aebaSBarry Smith .vb
16dce8aebaSBarry Smith      FEM:   Two points p and q are adjacent if q \in closure(star(p)), preallocCenterDim = dim
17dce8aebaSBarry Smith      FVM:   Two points p and q are adjacent if q \in star(cone(p)),    preallocCenterDim = dim-1
18dce8aebaSBarry Smith      FVM++: Two points p and q are adjacent if q \in star(closure(p)), preallocCenterDim = 0
19dce8aebaSBarry Smith .ve
203d183407SMatthew G. Knepley 
21*12b4a537SBarry Smith .seealso: [](sec_struct), `DM`, `DMDA`, `DMCreateMatrix()`, `DMDAPreallocateOperator()`
223d183407SMatthew G. Knepley @*/
DMDASetPreallocationCenterDimension(DM dm,PetscInt preallocCenterDim)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;
303ba16761SJacob Faibussowitsch   PetscFunctionReturn(PETSC_SUCCESS);
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:
37dce8aebaSBarry 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:
45dce8aebaSBarry Smith .vb
46dce8aebaSBarry Smith      FEM:   Two points p and q are adjacent if q \in closure(star(p)), preallocCenterDim = dim
47dce8aebaSBarry Smith      FVM:   Two points p and q are adjacent if q \in star(cone(p)),    preallocCenterDim = dim-1
48dce8aebaSBarry Smith      FVM++: Two points p and q are adjacent if q \in star(closure(p)), preallocCenterDim = 0
49dce8aebaSBarry Smith .ve
503d183407SMatthew G. Knepley 
51*12b4a537SBarry Smith .seealso: [](sec_struct), `DM`, `DMDA`, `DMCreateMatrix()`, `DMDAPreallocateOperator()`, `DMDASetPreallocationCenterDimension()`
523d183407SMatthew G. Knepley @*/
DMDAGetPreallocationCenterDimension(DM dm,PetscInt * preallocCenterDim)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);
594f572ea9SToby Isaac   PetscAssertPointer(preallocCenterDim, 2);
603d183407SMatthew G. Knepley   *preallocCenterDim = mesh->preallocCenterDim;
613ba16761SJacob Faibussowitsch   PetscFunctionReturn(PETSC_SUCCESS);
623d183407SMatthew G. Knepley }
63