xref: /petsc/include/petscdm.h (revision da9060c4ebf05b549ae65df4db64c7bee7b2b8a9)
1e1589f56SBarry Smith /*
2e1589f56SBarry Smith       Objects to manage the interactions between the mesh data structures and the algebraic objects
3e1589f56SBarry Smith */
426bd1501SBarry Smith #if !defined(PETSCDM_H)
526bd1501SBarry Smith #define PETSCDM_H
62c8e378dSBarry Smith #include <petscmat.h>
71e25c274SJed Brown #include <petscdmtypes.h>
8decb47aaSMatthew G. Knepley #include <petscfetypes.h>
92764a2aaSMatthew G. Knepley #include <petscdstypes.h>
10c58f1c22SToby Isaac #include <petscdmlabel.h>
11e1589f56SBarry Smith 
12607a6623SBarry Smith PETSC_EXTERN PetscErrorCode DMInitializePackage(void);
13e1589f56SBarry Smith 
14014dd563SJed Brown PETSC_EXTERN PetscClassId DM_CLASSID;
15d67d17b1SMatthew G. Knepley PETSC_EXTERN PetscClassId DMLABEL_CLASSID;
16e1589f56SBarry Smith 
17528c63e0SDave May #define DMLOCATEPOINT_POINT_NOT_FOUND -367
18528c63e0SDave May 
1976bdecfbSBarry Smith /*J
208f6c3df8SBarry Smith     DMType - String with the name of a PETSc DM
21e1589f56SBarry Smith 
22e1589f56SBarry Smith    Level: beginner
23e1589f56SBarry Smith 
24e1589f56SBarry Smith .seealso: DMSetType(), DM
2576bdecfbSBarry Smith J*/
2619fd82e9SBarry Smith typedef const char* DMType;
27e1589f56SBarry Smith #define DMDA        "da"
28e1589f56SBarry Smith #define DMCOMPOSITE "composite"
29e1589f56SBarry Smith #define DMSLICED    "sliced"
30fe1899a2SJed Brown #define DMSHELL     "shell"
31ab7f58a0SBarry Smith #define DMPLEX      "plex"
328ac4e037SJed Brown #define DMREDUNDANT "redundant"
333a19ef87SMatthew G Knepley #define DMPATCH     "patch"
341d72bce8STim Tautges #define DMMOAB      "moab"
355f2c45f1SShri Abhyankar #define DMNETWORK   "network"
36ef51cf95SToby Isaac #define DMFOREST    "forest"
37db4d5e8cSToby Isaac #define DMP4EST     "p4est"
38db4d5e8cSToby Isaac #define DMP8EST     "p8est"
392fd35b1fSDave May #define DMSWARM     "swarm"
40d852a638SPatrick Sanan #define DMPRODUCT   "product"
41a3101111SPatrick Sanan #define DMSTAG      "stag"
42e1589f56SBarry Smith 
43bff4a2f0SMatthew G. Knepley PETSC_EXTERN const char *const DMBoundaryTypes[];
4440967b3bSMatthew G. Knepley PETSC_EXTERN const char *const DMBoundaryConditionTypes[];
45140e18c1SBarry Smith PETSC_EXTERN PetscFunctionList DMList;
46014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreate(MPI_Comm,DM*);
4738221697SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMClone(DM,DM*);
4819fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode DMSetType(DM, DMType);
4919fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode DMGetType(DM, DMType *);
50bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode DMRegister(const char[],PetscErrorCode (*)(DM));
51014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRegisterDestroy(void);
52e1589f56SBarry Smith 
53014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMView(DM,PetscViewer);
54014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMLoad(DM,PetscViewer);
55014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMDestroy(DM*);
56014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateGlobalVector(DM,Vec*);
57014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateLocalVector(DM,Vec*);
58014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetLocalVector(DM,Vec *);
59014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRestoreLocalVector(DM,Vec *);
60014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetGlobalVector(DM,Vec *);
61014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRestoreGlobalVector(DM,Vec *);
62014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMClearGlobalVectors(DM);
6350eeb1caSToby Isaac PETSC_EXTERN PetscErrorCode DMClearLocalVectors(DM);
64e77ac854SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMHasNamedGlobalVector(DM,const char*,PetscBool*);
65014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetNamedGlobalVector(DM,const char*,Vec*);
66014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRestoreNamedGlobalVector(DM,const char*,Vec*);
67e77ac854SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMHasNamedLocalVector(DM,const char*,PetscBool*);
682348bcf4SPeter Brune PETSC_EXTERN PetscErrorCode DMGetNamedLocalVector(DM,const char*,Vec*);
692348bcf4SPeter Brune PETSC_EXTERN PetscErrorCode DMRestoreNamedLocalVector(DM,const char*,Vec*);
70014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetLocalToGlobalMapping(DM,ISLocalToGlobalMapping*);
71014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateFieldIS(DM,PetscInt*,char***,IS**);
72014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetBlockSize(DM,PetscInt*);
73b412c318SBarry Smith PETSC_EXTERN PetscErrorCode DMCreateColoring(DM,ISColoringType,ISColoring*);
74b412c318SBarry Smith PETSC_EXTERN PetscErrorCode DMCreateMatrix(DM,Mat*);
75014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetMatrixPreallocateOnly(DM,PetscBool);
76b06ff27eSHong Zhang PETSC_EXTERN PetscErrorCode DMSetMatrixStructureOnly(DM,PetscBool);
77014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateInterpolation(DM,DM,Mat*,Vec*);
783ad4599aSBarry Smith PETSC_EXTERN PetscErrorCode DMCreateRestriction(DM,DM,Mat*);
796dbf9973SLawrence Mitchell PETSC_EXTERN PetscErrorCode DMCreateInjection(DM,DM,Mat*);
80bd041c0cSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMCreateMassMatrix(DM,DM,Mat*);
8169291d52SBarry Smith PETSC_EXTERN PetscErrorCode DMGetWorkArray(DM,PetscInt,MPI_Datatype,void*);
8269291d52SBarry Smith PETSC_EXTERN PetscErrorCode DMRestoreWorkArray(DM,PetscInt,MPI_Datatype,void*);
83014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRefine(DM,MPI_Comm,DM*);
84014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCoarsen(DM,MPI_Comm,DM*);
85a8fb8f29SToby Isaac PETSC_EXTERN PetscErrorCode DMGetCoarseDM(DM,DM*);
86a8fb8f29SToby Isaac PETSC_EXTERN PetscErrorCode DMSetCoarseDM(DM,DM);
8788bdff64SToby Isaac PETSC_EXTERN PetscErrorCode DMGetFineDM(DM,DM*);
8888bdff64SToby Isaac PETSC_EXTERN PetscErrorCode DMSetFineDM(DM,DM);
89014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRefineHierarchy(DM,PetscInt,DM[]);
90014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCoarsenHierarchy(DM,PetscInt,DM[]);
91014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCoarsenHookAdd(DM,PetscErrorCode (*)(DM,DM,void*),PetscErrorCode (*)(DM,Mat,Vec,Mat,DM,void*),void*);
92dc822a44SJed Brown PETSC_EXTERN PetscErrorCode DMCoarsenHookRemove(DM,PetscErrorCode (*)(DM,DM,void*),PetscErrorCode (*)(DM,Mat,Vec,Mat,DM,void*),void*);
93014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRefineHookAdd(DM,PetscErrorCode (*)(DM,DM,void*),PetscErrorCode (*)(DM,Mat,DM,void*),void*);
943d8e3701SJed Brown PETSC_EXTERN PetscErrorCode DMRefineHookRemove(DM,PetscErrorCode (*)(DM,DM,void*),PetscErrorCode (*)(DM,Mat,DM,void*),void*);
95014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRestrict(DM,Mat,Vec,Mat,DM);
96014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMInterpolate(DM,Mat,DM);
97014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetFromOptions(DM);
98fe2efc57SMark PETSC_EXTERN PetscErrorCode DMViewFromOptions(DM,PetscObject,const char[]);
99ca266f36SBarry Smith 
100a1b0c543SToby Isaac PETSC_EXTERN PetscErrorCode DMAdaptLabel(DM,DMLabel,DM*);
1010d1cd5e0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMAdaptMetric(DM, Vec, DMLabel, DM *);
102df0b854cSToby Isaac 
103014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetUp(DM);
104014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateInterpolationScale(DM,DM,Mat,Vec*);
10597779f9aSLisandro Dalcin PETSC_EXTERN PETSC_DEPRECATED_FUNCTION("Use DMDACreateAggregates() or DMCreateRestriction() (since version 3.12)") PetscErrorCode DMCreateAggregates(DM,DM,Mat*);
106baf369e7SPeter Brune PETSC_EXTERN PetscErrorCode DMGlobalToLocalHookAdd(DM,PetscErrorCode (*)(DM,Vec,InsertMode,Vec,void*),PetscErrorCode (*)(DM,Vec,InsertMode,Vec,void*),void*);
107d4d07f1eSToby Isaac PETSC_EXTERN PetscErrorCode DMLocalToGlobalHookAdd(DM,PetscErrorCode (*)(DM,Vec,InsertMode,Vec,void*),PetscErrorCode (*)(DM,Vec,InsertMode,Vec,void*),void*);
10801729b5cSPatrick Sanan PETSC_EXTERN PetscErrorCode DMGlobalToLocal(DM,Vec,InsertMode,Vec);
109014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGlobalToLocalBegin(DM,Vec,InsertMode,Vec);
110014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGlobalToLocalEnd(DM,Vec,InsertMode,Vec);
11101729b5cSPatrick Sanan PETSC_EXTERN PetscErrorCode DMLocalToGlobal(DM,Vec,InsertMode,Vec);
112014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMLocalToGlobalBegin(DM,Vec,InsertMode,Vec);
113014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMLocalToGlobalEnd(DM,Vec,InsertMode,Vec);
114d78e899eSRichard Tran Mills PETSC_EXTERN PetscErrorCode DMLocalToLocalBegin(DM,Vec,InsertMode,Vec);
115d78e899eSRichard Tran Mills PETSC_EXTERN PetscErrorCode DMLocalToLocalEnd(DM,Vec,InsertMode,Vec);
11619fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode DMConvert(DM,DMType,DM*);
117e1589f56SBarry Smith 
118c73cfb54SMatthew G. Knepley /* Topology support */
119c73cfb54SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetDimension(DM,PetscInt*);
120c73cfb54SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetDimension(DM,PetscInt);
121793f3fe5SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetDimPoints(DM,PetscInt,PetscInt*,PetscInt*);
1228e4ac7eaSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetUseNatural(DM,PetscBool*);
1238e4ac7eaSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetUseNatural(DM,PetscBool);
12446e270d4SMatthew G. Knepley 
12546e270d4SMatthew G. Knepley /* Coordinate support */
1266636e97aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMGetCoordinateDM(DM,DM*);
1271cfe2091SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetCoordinateDM(DM,DM);
12846e270d4SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetCoordinateDim(DM,PetscInt*);
12946e270d4SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetCoordinateDim(DM,PetscInt);
130e8abe2deSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetCoordinateSection(DM,PetscSection*);
13146e270d4SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetCoordinateSection(DM,PetscInt,PetscSection);
1326636e97aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMGetCoordinates(DM,Vec*);
1336636e97aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMSetCoordinates(DM,Vec);
1346636e97aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMGetCoordinatesLocal(DM,Vec*);
13581e9a530SVaclav Hapla PETSC_EXTERN PetscErrorCode DMGetCoordinatesLocalSetUp(DM);
13681e9a530SVaclav Hapla PETSC_EXTERN PetscErrorCode DMGetCoordinatesLocalNoncollective(DM,Vec*);
1372db98f8dSVaclav Hapla PETSC_EXTERN PetscErrorCode DMGetCoordinatesLocalTuple(DM,IS,PetscSection*,Vec*);
1386636e97aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMSetCoordinatesLocal(DM,Vec);
13962a38674SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMLocatePoints(DM,Vec,DMPointLocationType,PetscSF*);
14090b157c4SStefano Zampini PETSC_EXTERN PetscErrorCode DMGetPeriodicity(DM,PetscBool*,const PetscReal**,const PetscReal**,const DMBoundaryType**);
14190b157c4SStefano Zampini PETSC_EXTERN PetscErrorCode DMSetPeriodicity(DM,PetscBool,const PetscReal[],const PetscReal[],const DMBoundaryType[]);
142e907e85cSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMLocalizeCoordinate(DM, const PetscScalar[], PetscBool, PetscScalar[]);
1432e17dfb7SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMLocalizeCoordinates(DM);
14436447a5eSToby Isaac PETSC_EXTERN PetscErrorCode DMGetCoordinatesLocalized(DM,PetscBool*);
1458f700142SStefano Zampini PETSC_EXTERN PetscErrorCode DMGetCoordinatesLocalizedLocal(DM,PetscBool*);
1463c73bf98SDave May PETSC_EXTERN PetscErrorCode DMGetNeighbors(DM,PetscInt*,const PetscMPIInt**);
147f19dbd58SToby Isaac PETSC_EXTERN PetscErrorCode DMGetCoordinateField(DM,DMField*);
148f19dbd58SToby Isaac PETSC_EXTERN PetscErrorCode DMSetCoordinateField(DM,DMField);
149b2e4378dSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetBoundingBox(DM,PetscReal[],PetscReal[]);
150b2e4378dSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetLocalBoundingBox(DM,PetscReal[],PetscReal[]);
151d864a3eaSLisandro Dalcin PETSC_EXTERN PetscErrorCode DMProjectCoordinates(DM,PetscFE);
1526636e97aSMatthew G Knepley 
1535dbd56e3SPeter Brune /* block hook interface */
154be081cd6SPeter Brune PETSC_EXTERN PetscErrorCode DMSubDomainHookAdd(DM,PetscErrorCode (*)(DM,DM,void*),PetscErrorCode (*)(DM,VecScatter,VecScatter,DM,void*),void*);
155b3a6b972SJed Brown PETSC_EXTERN PetscErrorCode DMSubDomainHookRemove(DM,PetscErrorCode (*)(DM,DM,void*),PetscErrorCode (*)(DM,VecScatter,VecScatter,DM,void*),void*);
156be081cd6SPeter Brune PETSC_EXTERN PetscErrorCode DMSubDomainRestrict(DM,VecScatter,VecScatter,DM);
1575dbd56e3SPeter Brune 
158014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetOptionsPrefix(DM,const char []);
15931697293SDave May PETSC_EXTERN PetscErrorCode DMAppendOptionsPrefix(DM,const char []);
16031697293SDave May PETSC_EXTERN PetscErrorCode DMGetOptionsPrefix(DM,const char*[]);
16119fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode DMSetVecType(DM,VecType);
162c0dedaeaSBarry Smith PETSC_EXTERN PetscErrorCode DMGetVecType(DM,VecType*);
16319fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode DMSetMatType(DM,MatType);
164c0dedaeaSBarry Smith PETSC_EXTERN PetscErrorCode DMGetMatType(DM,MatType*);
1658f1509bcSBarry Smith PETSC_EXTERN PetscErrorCode DMSetISColoringType(DM,ISColoringType);
1668f1509bcSBarry Smith PETSC_EXTERN PetscErrorCode DMGetISColoringType(DM,ISColoringType*);
167014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetApplicationContext(DM,void*);
168014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetApplicationContextDestroy(DM,PetscErrorCode (*)(void**));
169014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetApplicationContext(DM,void*);
170014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetVariableBounds(DM,PetscErrorCode (*)(DM,Vec,Vec));
171014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMHasVariableBounds(DM,PetscBool *);
172b0ae01b7SPeter Brune PETSC_EXTERN PetscErrorCode DMHasColoring(DM,PetscBool *);
1733ad4599aSBarry Smith PETSC_EXTERN PetscErrorCode DMHasCreateRestriction(DM,PetscBool *);
174a7058e45SLawrence Mitchell PETSC_EXTERN PetscErrorCode DMHasCreateInjection(DM,PetscBool *);
175014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMComputeVariableBounds(DM,Vec,Vec);
17693d92d96SBarry Smith 
17737bc7515SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMCreateSubDM(DM, PetscInt, const PetscInt[], IS *, DM *);
1782adcc780SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMCreateSuperDM(DM[], PetscInt, IS **, DM *);
179792b654fSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMCreateSectionSubDM(DM,PetscInt,const PetscInt[],IS*,DM*);
180792b654fSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMCreateSectionSuperDM(DM[],PetscInt,IS**,DM*);
18116621825SDmitry Karpeev PETSC_EXTERN PetscErrorCode DMCreateFieldDecomposition(DM,PetscInt*,char***,IS**,DM**);
1828d4ac253SDmitry Karpeev PETSC_EXTERN PetscErrorCode DMCreateDomainDecomposition(DM,PetscInt*,char***,IS**,IS**,DM**);
183e30e807fSPeter Brune PETSC_EXTERN PetscErrorCode DMCreateDomainDecompositionScatters(DM,PetscInt,DM*,VecScatter**,VecScatter**,VecScatter**);
184e7c4fc90SDmitry Karpeev 
185014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetRefineLevel(DM,PetscInt*);
186fef3a512SBarry Smith PETSC_EXTERN PetscErrorCode DMSetRefineLevel(DM,PetscInt);
187014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetCoarsenLevel(DM,PetscInt*);
1889a64c4a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetCoarsenLevel(DM,PetscInt);
189014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMFinalizePackage(void);
190e1589f56SBarry Smith 
1915f1ad066SMatthew G Knepley PETSC_EXTERN PetscErrorCode VecGetDM(Vec, DM*);
1925f1ad066SMatthew G Knepley PETSC_EXTERN PetscErrorCode VecSetDM(Vec, DM);
193c688c046SMatthew G Knepley PETSC_EXTERN PetscErrorCode MatGetDM(Mat, DM*);
194c688c046SMatthew G Knepley PETSC_EXTERN PetscErrorCode MatSetDM(Mat, DM);
195531c7667SBarry Smith PETSC_EXTERN PetscErrorCode MatFDColoringUseDM(Mat,MatFDColoring);
1965f1ad066SMatthew G Knepley 
197e1589f56SBarry Smith typedef struct NLF_DAAD* NLF;
198e1589f56SBarry Smith 
199bc2bf880SBarry Smith #define DM_FILE_CLASSID 1211221
2007da65231SMatthew G Knepley 
2017da65231SMatthew G Knepley /* FEM support */
202014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMPrintCellVector(PetscInt, const char [], PetscInt, const PetscScalar []);
203014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMPrintCellMatrix(PetscInt, const char [], PetscInt, PetscInt, const PetscScalar []);
2046113b454SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMPrintLocalVec(DM, const char [], PetscReal, Vec);
2057da65231SMatthew G Knepley 
2068cda7954SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetNullSpaceConstructor(DM, PetscInt, PetscErrorCode (*)(DM, PetscInt, PetscInt, MatNullSpace *));
2078cda7954SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetNullSpaceConstructor(DM, PetscInt, PetscErrorCode (**)(DM, PetscInt, PetscInt, MatNullSpace *));
2088cda7954SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetNearNullSpaceConstructor(DM, PetscInt, PetscErrorCode (*)(DM, PetscInt, PetscInt, MatNullSpace *));
2098cda7954SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetNearNullSpaceConstructor(DM, PetscInt, PetscErrorCode (**)(DM, PetscInt, PetscInt, MatNullSpace *));
210f9d4088aSMatthew G. Knepley 
211061576a5SJed Brown PETSC_EXTERN PetscErrorCode DMGetSection(DM, PetscSection *); /* Use DMGetLocalSection() in new code (since v3.12) */
212061576a5SJed Brown PETSC_EXTERN PetscErrorCode DMSetSection(DM, PetscSection);   /* Use DMSetLocalSection() in new code (since v3.12) */
213061576a5SJed Brown PETSC_EXTERN PetscErrorCode DMGetLocalSection(DM, PetscSection *);
214061576a5SJed Brown PETSC_EXTERN PetscErrorCode DMSetLocalSection(DM, PetscSection);
215e87a4003SBarry Smith PETSC_EXTERN PetscErrorCode DMGetGlobalSection(DM, PetscSection *);
216e87a4003SBarry Smith PETSC_EXTERN PetscErrorCode DMSetGlobalSection(DM, PetscSection);
2176f0eb057SJed Brown PETSC_STATIC_INLINE PETSC_DEPRECATED_FUNCTION("Use DMGetSection() (since v3.9)") PetscErrorCode DMGetDefaultSection(DM dm, PetscSection *s) {return DMGetSection(dm,s);}
2186f0eb057SJed Brown PETSC_STATIC_INLINE PETSC_DEPRECATED_FUNCTION("Use DMSetSection() (since v3.9)") PetscErrorCode DMSetDefaultSection(DM dm, PetscSection s) {return DMSetSection(dm,s);}
2196f0eb057SJed Brown PETSC_STATIC_INLINE PETSC_DEPRECATED_FUNCTION("Use DMGetGlobalSection() (since v3.9)") PetscErrorCode DMGetDefaultGlobalSection(DM dm, PetscSection *s) {return DMGetGlobalSection(dm,s);}
2206f0eb057SJed Brown PETSC_STATIC_INLINE PETSC_DEPRECATED_FUNCTION("Use DMSetGlobalSection() (since v3.9)") PetscErrorCode DMSetDefaultGlobalSection(DM dm, PetscSection s) {return DMSetGlobalSection(dm,s);}
221e87a4003SBarry Smith 
2221bb6d2a8SBarry Smith PETSC_EXTERN PetscErrorCode DMGetSectionSF(DM, PetscSF*);
2231bb6d2a8SBarry Smith PETSC_EXTERN PetscErrorCode DMSetSectionSF(DM, PetscSF);
2241bb6d2a8SBarry Smith PETSC_EXTERN PetscErrorCode DMCreateSectionSF(DM, PetscSection, PetscSection);
2251bb6d2a8SBarry Smith PETSC_STATIC_INLINE PETSC_DEPRECATED_FUNCTION("Use DMGetSectionSF() (since v3.12)") PetscErrorCode DMGetDefaultSF(DM dm, PetscSF *s) {return DMGetSectionSF(dm,s);}
2261bb6d2a8SBarry Smith PETSC_STATIC_INLINE PETSC_DEPRECATED_FUNCTION("Use DMSetSectionSF() (since v3.12)") PetscErrorCode DMSetDefaultSF(DM dm, PetscSF s) {return DMSetSectionSF(dm,s);}
2271bb6d2a8SBarry Smith PETSC_STATIC_INLINE PETSC_DEPRECATED_FUNCTION("Use DMCreateSectionSF() (since v3.12)") PetscErrorCode DMCreateDefaultSF(DM dm, PetscSection l, PetscSection g) {return DMCreateSectionSF(dm,l,g);}
2281bb6d2a8SBarry Smith PETSC_EXTERN PetscErrorCode DMGetPointSF(DM, PetscSF *);
2291bb6d2a8SBarry Smith PETSC_EXTERN PetscErrorCode DMSetPointSF(DM, PetscSF);
2301bb6d2a8SBarry Smith 
2311bb6d2a8SBarry Smith 
2321bb6d2a8SBarry Smith PETSC_EXTERN PetscErrorCode DMGetDefaultConstraints(DM, PetscSection *, Mat *);
2331bb6d2a8SBarry Smith PETSC_EXTERN PetscErrorCode DMSetDefaultConstraints(DM, PetscSection, Mat);
234e87a4003SBarry Smith 
23514f150ffSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetOutputDM(DM, DM *);
236cdb7a50dSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetOutputSequenceNumber(DM, PetscInt *, PetscReal *);
237cdb7a50dSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetOutputSequenceNumber(DM, PetscInt, PetscReal);
238cdb7a50dSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMOutputSequenceLoad(DM, PetscViewer, const char *, PetscInt, PetscReal *);
23914f150ffSMatthew G. Knepley 
240af122d2aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMGetNumFields(DM, PetscInt *);
241af122d2aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMSetNumFields(DM, PetscInt);
24244a7f3ddSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetField(DM, PetscInt, DMLabel *, PetscObject *);
24344a7f3ddSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetField(DM, PetscInt, DMLabel, PetscObject);
24444a7f3ddSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMAddField(DM, DMLabel, PetscObject);
24544a7f3ddSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMClearFields(DM);
246e5e52638SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMCopyFields(DM, DM);
24734aa8a36SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetAdjacency(DM, PetscInt, PetscBool *, PetscBool *);
24834aa8a36SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetAdjacency(DM, PetscInt, PetscBool, PetscBool);
249b0441da4SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetBasicAdjacency(DM, PetscBool *, PetscBool *);
250b0441da4SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetBasicAdjacency(DM, PetscBool, PetscBool);
251e5e52638SMatthew G. Knepley 
252e5e52638SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetNumDS(DM, PetscInt *);
253e5e52638SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetDS(DM, PetscDS *);
254e5e52638SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetCellDS(DM, PetscInt, PetscDS *);
255b3cf3223SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetRegionDS(DM, DMLabel, IS *, PetscDS *);
256b3cf3223SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetRegionDS(DM, DMLabel, IS, PetscDS);
257b3cf3223SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetRegionNumDS(DM, PetscInt, DMLabel *, IS *, PetscDS *);
258083401c6SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetRegionNumDS(DM, PetscInt, DMLabel, IS, PetscDS);
2591d3af9e0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMFindRegionNum(DM, PetscDS, PetscInt *);
260e5e52638SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMCreateDS(DM);
261e5e52638SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMClearDS(DM);
262e5e52638SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMCopyDS(DM, DM);
263e5e52638SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMCopyDisc(DM, DM);
264f2cacb80SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMComputeExactSolution(DM, PetscReal, Vec, Vec);
265af122d2aSMatthew G Knepley 
2664267b1a3SMatthew G. Knepley /*MC
2674267b1a3SMatthew G. Knepley   DMInterpolationInfo - Structure for holding information about interpolation on a mesh
2684267b1a3SMatthew G. Knepley 
2694267b1a3SMatthew G. Knepley   Level: intermediate
2704267b1a3SMatthew G. Knepley 
2714267b1a3SMatthew G. Knepley   Synopsis:
2724267b1a3SMatthew G. Knepley     comm   - The communicator
2734267b1a3SMatthew G. Knepley     dim    - The spatial dimension of points
2744267b1a3SMatthew G. Knepley     nInput - The number of input points
2754267b1a3SMatthew G. Knepley     points - The input point coordinates
2764267b1a3SMatthew G. Knepley     cells  - The cell containing each point
2774267b1a3SMatthew G. Knepley     n      - The number of local points
2784267b1a3SMatthew G. Knepley     coords - The point coordinates
2794267b1a3SMatthew G. Knepley     dof    - The number of components to interpolate
2804267b1a3SMatthew G. Knepley 
2814267b1a3SMatthew G. Knepley .seealso: DMInterpolationCreate(), DMInterpolationEvaluate(), DMInterpolationAddPoints()
2824267b1a3SMatthew G. Knepley M*/
283e87bb0d3SMatthew G Knepley struct _DMInterpolationInfo {
284e87bb0d3SMatthew G Knepley   MPI_Comm   comm;
285e87bb0d3SMatthew G Knepley   PetscInt   dim;    /*1 The spatial dimension of points */
286e87bb0d3SMatthew G Knepley   PetscInt   nInput; /* The number of input points */
287e87bb0d3SMatthew G Knepley   PetscReal *points; /* The input point coordinates */
288e87bb0d3SMatthew G Knepley   PetscInt  *cells;  /* The cell containing each point */
289e87bb0d3SMatthew G Knepley   PetscInt   n;      /* The number of local points */
290e87bb0d3SMatthew G Knepley   Vec        coords; /* The point coordinates */
291e87bb0d3SMatthew G Knepley   PetscInt   dof;    /* The number of components to interpolate */
292e87bb0d3SMatthew G Knepley };
293e87bb0d3SMatthew G Knepley typedef struct _DMInterpolationInfo *DMInterpolationInfo;
294e87bb0d3SMatthew G Knepley 
29594b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationCreate(MPI_Comm, DMInterpolationInfo *);
29694b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationSetDim(DMInterpolationInfo, PetscInt);
29794b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationGetDim(DMInterpolationInfo, PetscInt *);
29894b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationSetDof(DMInterpolationInfo, PetscInt);
29994b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationGetDof(DMInterpolationInfo, PetscInt *);
30094b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationAddPoints(DMInterpolationInfo, PetscInt, PetscReal[]);
30194b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationSetUp(DMInterpolationInfo, DM, PetscBool);
30294b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationGetCoordinates(DMInterpolationInfo, Vec *);
30394b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationGetVector(DMInterpolationInfo, Vec *);
30494b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationRestoreVector(DMInterpolationInfo, Vec *);
30594b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationEvaluate(DMInterpolationInfo, DM, Vec, Vec);
30694b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationDestroy(DMInterpolationInfo *);
307c58f1c22SToby Isaac 
308c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMCreateLabel(DM, const char []);
309c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelValue(DM, const char[], PetscInt, PetscInt *);
310c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMSetLabelValue(DM, const char[], PetscInt, PetscInt);
311c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMClearLabelValue(DM, const char[], PetscInt, PetscInt);
312c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelSize(DM, const char[], PetscInt *);
313c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelIdIS(DM, const char[], IS *);
314c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetStratumSize(DM, const char [], PetscInt, PetscInt *);
315c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetStratumIS(DM, const char [], PetscInt, IS *);
3164de306b1SToby Isaac PETSC_EXTERN PetscErrorCode DMSetStratumIS(DM, const char [], PetscInt, IS);
317c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMClearLabelStratum(DM, const char[], PetscInt);
318c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelOutput(DM, const char[], PetscBool *);
319c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMSetLabelOutput(DM, const char[], PetscBool);
320c58f1c22SToby Isaac 
321c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetNumLabels(DM, PetscInt *);
322c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelName(DM, PetscInt, const char **);
323c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMHasLabel(DM, const char [], PetscBool *);
324c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabel(DM, const char *, DMLabel *);
325c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelByNum(DM, PetscInt, DMLabel *);
326c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMAddLabel(DM, DMLabel);
327c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMRemoveLabel(DM, const char [], DMLabel *);
328306894acSVaclav Hapla PETSC_EXTERN PetscErrorCode DMRemoveLabelBySelf(DM, DMLabel *, PetscBool);
3295d80c0bfSVaclav Hapla PETSC_EXTERN PetscErrorCode DMCopyLabels(DM, DM, PetscCopyMode, PetscBool);
330c58f1c22SToby Isaac 
33156cf3b9cSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMAddBoundary(DM, DMBoundaryConditionType, const char[], const char[], PetscInt, PetscInt, const PetscInt *, void (*)(void), void (*)(void), PetscInt, const PetscInt *, void *);
332a6ba4734SToby Isaac PETSC_EXTERN PetscErrorCode DMGetNumBoundary(DM, PetscInt *);
33356cf3b9cSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetBoundary(DM, PetscInt, DMBoundaryConditionType *, const char **, const char **, PetscInt *, PetscInt *, const PetscInt **, void (**)(void), void (**)(void), PetscInt *, const PetscInt **, void **);
334a6ba4734SToby Isaac PETSC_EXTERN PetscErrorCode DMIsBoundaryPoint(DM, PetscInt, PetscBool *);
335a6ba4734SToby Isaac PETSC_EXTERN PetscErrorCode DMCopyBoundary(DM, DM);
3364d6f44ffSToby Isaac 
3370709b2feSToby Isaac PETSC_EXTERN PetscErrorCode DMProjectFunction(DM,PetscReal,PetscErrorCode(**)(PetscInt,PetscReal,const PetscReal[],PetscInt,PetscScalar *,void *),void**,InsertMode,Vec);
3380709b2feSToby Isaac PETSC_EXTERN PetscErrorCode DMProjectFunctionLocal(DM,PetscReal,PetscErrorCode(**)(PetscInt,PetscReal,const PetscReal[],PetscInt,PetscScalar *,void *),void**,InsertMode,Vec);
3392c53366bSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMProjectFunctionLabel(DM, PetscReal, DMLabel, PetscInt, const PetscInt[], PetscInt, const PetscInt[], PetscErrorCode (**)(PetscInt, PetscReal, const PetscReal [], PetscInt, PetscScalar *, void *), void **, InsertMode, Vec);
3401c531cf8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMProjectFunctionLabelLocal(DM,PetscReal,DMLabel,PetscInt,const PetscInt[],PetscInt,const PetscInt[],PetscErrorCode(**)(PetscInt,PetscReal,const PetscReal[],PetscInt,PetscScalar *,void *),void **,InsertMode,Vec);
341191494d9SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMProjectFieldLocal(DM,PetscReal,Vec,void (**)(PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[],const PetscScalar[],const PetscScalar[],const PetscInt[],const PetscInt[],const PetscScalar[],const PetscScalar[],const PetscScalar[],PetscReal,const PetscReal[],PetscInt,const PetscScalar[],PetscScalar[]),InsertMode,Vec);
3421c531cf8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMProjectFieldLabelLocal(DM,PetscReal,DMLabel,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Vec,void (**)(PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[],const PetscScalar[],const PetscScalar[],const PetscInt[],const PetscInt[],const PetscScalar[],const PetscScalar[],const PetscScalar[],PetscReal,const PetscReal[],PetscInt,const PetscScalar[],PetscScalar[]),InsertMode,Vec);
343ece3a9fcSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMProjectBdFieldLabelLocal(DM,PetscReal,DMLabel,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Vec,void (**)(PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[],const PetscScalar[],const PetscScalar[],const PetscInt[],const PetscInt[],const PetscScalar[],const PetscScalar[],const PetscScalar[],PetscReal,const PetscReal[],const PetscReal[],PetscInt,const PetscScalar[],PetscScalar[]),InsertMode,Vec);
3440709b2feSToby Isaac PETSC_EXTERN PetscErrorCode DMComputeL2Diff(DM,PetscReal,PetscErrorCode(**)(PetscInt,PetscReal,const PetscReal[],PetscInt,PetscScalar *,void *),void **,Vec,PetscReal *);
345b698f381SToby Isaac PETSC_EXTERN PetscErrorCode DMComputeL2GradientDiff(DM, PetscReal, PetscErrorCode (**)(PetscInt, PetscReal, const PetscReal [], const PetscReal [], PetscInt, PetscScalar *, void *), void **, Vec, const PetscReal [], PetscReal *);
3461189c1efSToby Isaac PETSC_EXTERN PetscErrorCode DMComputeL2FieldDiff(DM,PetscReal,PetscErrorCode(**)(PetscInt,PetscReal,const PetscReal[],PetscInt,PetscScalar *,void *),void **,Vec,PetscReal *);
347ca3d3a14SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMHasBasisTransform(DM,PetscBool*);
348ca3d3a14SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMCopyTransform(DM, DM);
3498320bc6fSPatrick Sanan 
3508320bc6fSPatrick Sanan PETSC_EXTERN PetscErrorCode DMGetCompatibility(DM,DM,PetscBool*,PetscBool*);
351c0f0dcc3SMatthew G. Knepley 
352c0f0dcc3SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMMonitorSet(DM, PetscErrorCode (*)(DM, void *), void *, PetscErrorCode (*)(void**));
353c0f0dcc3SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMMonitorCancel(DM);
354c0f0dcc3SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMMonitorSetFromOptions(DM, const char[], const char[], const char[], PetscErrorCode (*)(DM, void *), PetscErrorCode (*)(DM, PetscViewerAndFormat *), PetscBool *);
355c0f0dcc3SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMMonitor(DM);
356c0f0dcc3SMatthew G. Knepley 
357412e9a14SMatthew G. Knepley PETSC_STATIC_INLINE PetscInt DMPolytopeTypeGetDim(DMPolytopeType ct) {
358412e9a14SMatthew G. Knepley   switch (ct) {
359412e9a14SMatthew G. Knepley     case DM_POLYTOPE_POINT:
360412e9a14SMatthew G. Knepley       return 0;
361412e9a14SMatthew G. Knepley     case DM_POLYTOPE_SEGMENT:
362412e9a14SMatthew G. Knepley     case DM_POLYTOPE_POINT_PRISM_TENSOR:
363412e9a14SMatthew G. Knepley       return 1;
364412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TRIANGLE:
365412e9a14SMatthew G. Knepley     case DM_POLYTOPE_QUADRILATERAL:
366412e9a14SMatthew G. Knepley     case DM_POLYTOPE_SEG_PRISM_TENSOR:
367412e9a14SMatthew G. Knepley       return 2;
368412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TETRAHEDRON:
369412e9a14SMatthew G. Knepley     case DM_POLYTOPE_HEXAHEDRON:
370412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TRI_PRISM:
371412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TRI_PRISM_TENSOR:
372412e9a14SMatthew G. Knepley     case DM_POLYTOPE_QUAD_PRISM_TENSOR:
373*da9060c4SMatthew G. Knepley     case DM_POLYTOPE_PYRAMID:
374412e9a14SMatthew G. Knepley       return 3;
375412e9a14SMatthew G. Knepley     default: return -1;
376412e9a14SMatthew G. Knepley   }
377412e9a14SMatthew G. Knepley }
378412e9a14SMatthew G. Knepley 
379412e9a14SMatthew G. Knepley PETSC_STATIC_INLINE PetscInt DMPolytopeTypeGetConeSize(DMPolytopeType ct)
380412e9a14SMatthew G. Knepley {
381412e9a14SMatthew G. Knepley   switch (ct) {
382412e9a14SMatthew G. Knepley     case DM_POLYTOPE_POINT:              return 0;
383412e9a14SMatthew G. Knepley     case DM_POLYTOPE_SEGMENT:            return 2;
384412e9a14SMatthew G. Knepley     case DM_POLYTOPE_POINT_PRISM_TENSOR: return 2;
385412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TRIANGLE:           return 3;
386412e9a14SMatthew G. Knepley     case DM_POLYTOPE_QUADRILATERAL:      return 4;
387412e9a14SMatthew G. Knepley     case DM_POLYTOPE_SEG_PRISM_TENSOR:   return 4;
388412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TETRAHEDRON:        return 4;
389412e9a14SMatthew G. Knepley     case DM_POLYTOPE_HEXAHEDRON:         return 6;
390412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TRI_PRISM:          return 5;
391412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TRI_PRISM_TENSOR:   return 5;
392412e9a14SMatthew G. Knepley     case DM_POLYTOPE_QUAD_PRISM_TENSOR:  return 6;
393*da9060c4SMatthew G. Knepley     case DM_POLYTOPE_PYRAMID:            return 5;
394412e9a14SMatthew G. Knepley     default: return -1;
395412e9a14SMatthew G. Knepley   }
396412e9a14SMatthew G. Knepley }
397412e9a14SMatthew G. Knepley 
398412e9a14SMatthew G. Knepley PETSC_STATIC_INLINE PetscInt DMPolytopeTypeGetNumVertices(DMPolytopeType ct)
399412e9a14SMatthew G. Knepley {
400412e9a14SMatthew G. Knepley   switch (ct) {
401412e9a14SMatthew G. Knepley     case DM_POLYTOPE_POINT:              return 1;
402412e9a14SMatthew G. Knepley     case DM_POLYTOPE_SEGMENT:            return 2;
403412e9a14SMatthew G. Knepley     case DM_POLYTOPE_POINT_PRISM_TENSOR: return 2;
404412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TRIANGLE:           return 3;
405412e9a14SMatthew G. Knepley     case DM_POLYTOPE_QUADRILATERAL:      return 4;
406412e9a14SMatthew G. Knepley     case DM_POLYTOPE_SEG_PRISM_TENSOR:   return 4;
407412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TETRAHEDRON:        return 4;
408412e9a14SMatthew G. Knepley     case DM_POLYTOPE_HEXAHEDRON:         return 8;
409412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TRI_PRISM:          return 6;
410412e9a14SMatthew G. Knepley     case DM_POLYTOPE_TRI_PRISM_TENSOR:   return 6;
411412e9a14SMatthew G. Knepley     case DM_POLYTOPE_QUAD_PRISM_TENSOR:  return 8;
412*da9060c4SMatthew G. Knepley     case DM_POLYTOPE_PYRAMID:            return 5;
413412e9a14SMatthew G. Knepley     default: return -1;
414412e9a14SMatthew G. Knepley   }
415412e9a14SMatthew G. Knepley }
416412e9a14SMatthew G. Knepley 
417e1589f56SBarry Smith #endif
418