1e1589f56SBarry Smith /* 2e1589f56SBarry Smith Objects to manage the interactions between the mesh data structures and the algebraic objects 3e1589f56SBarry Smith */ 43c48a1e8SJed Brown #if !defined(__PETSCDM_H) 53c48a1e8SJed Brown #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; 15e1589f56SBarry Smith 16528c63e0SDave May #define DMLOCATEPOINT_POINT_NOT_FOUND -367 17528c63e0SDave May 1876bdecfbSBarry Smith /*J 198f6c3df8SBarry Smith DMType - String with the name of a PETSc DM 20e1589f56SBarry Smith 21e1589f56SBarry Smith Level: beginner 22e1589f56SBarry Smith 23e1589f56SBarry Smith .seealso: DMSetType(), DM 2476bdecfbSBarry Smith J*/ 2519fd82e9SBarry Smith typedef const char* DMType; 26e1589f56SBarry Smith #define DMDA "da" 27e1589f56SBarry Smith #define DMCOMPOSITE "composite" 28e1589f56SBarry Smith #define DMSLICED "sliced" 29fe1899a2SJed Brown #define DMSHELL "shell" 30ab7f58a0SBarry Smith #define DMPLEX "plex" 31b30b9b2eSMatthew G Knepley #define DMCARTESIAN "cartesian" 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" 40e1589f56SBarry Smith 41bff4a2f0SMatthew G. Knepley PETSC_EXTERN const char *const DMBoundaryTypes[]; 42140e18c1SBarry Smith PETSC_EXTERN PetscFunctionList DMList; 43014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreate(MPI_Comm,DM*); 4438221697SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMClone(DM,DM*); 4519fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode DMSetType(DM, DMType); 4619fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode DMGetType(DM, DMType *); 47bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode DMRegister(const char[],PetscErrorCode (*)(DM)); 48014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRegisterDestroy(void); 49e1589f56SBarry Smith 50014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMView(DM,PetscViewer); 51014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMLoad(DM,PetscViewer); 52014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMDestroy(DM*); 53014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateGlobalVector(DM,Vec*); 54014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateLocalVector(DM,Vec*); 55014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetLocalVector(DM,Vec *); 56014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRestoreLocalVector(DM,Vec *); 57014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetGlobalVector(DM,Vec *); 58014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRestoreGlobalVector(DM,Vec *); 59014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMClearGlobalVectors(DM); 6050eeb1caSToby Isaac PETSC_EXTERN PetscErrorCode DMClearLocalVectors(DM); 61e77ac854SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMHasNamedGlobalVector(DM,const char*,PetscBool*); 62014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetNamedGlobalVector(DM,const char*,Vec*); 63014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRestoreNamedGlobalVector(DM,const char*,Vec*); 64e77ac854SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMHasNamedLocalVector(DM,const char*,PetscBool*); 652348bcf4SPeter Brune PETSC_EXTERN PetscErrorCode DMGetNamedLocalVector(DM,const char*,Vec*); 662348bcf4SPeter Brune PETSC_EXTERN PetscErrorCode DMRestoreNamedLocalVector(DM,const char*,Vec*); 67014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetLocalToGlobalMapping(DM,ISLocalToGlobalMapping*); 68014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateFieldIS(DM,PetscInt*,char***,IS**); 69014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetBlockSize(DM,PetscInt*); 70b412c318SBarry Smith PETSC_EXTERN PetscErrorCode DMCreateColoring(DM,ISColoringType,ISColoring*); 71b412c318SBarry Smith PETSC_EXTERN PetscErrorCode DMCreateMatrix(DM,Mat*); 72014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetMatrixPreallocateOnly(DM,PetscBool); 73b06ff27eSHong Zhang PETSC_EXTERN PetscErrorCode DMSetMatrixStructureOnly(DM,PetscBool); 74014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateInterpolation(DM,DM,Mat*,Vec*); 753ad4599aSBarry Smith PETSC_EXTERN PetscErrorCode DMCreateRestriction(DM,DM,Mat*); 766dbf9973SLawrence Mitchell PETSC_EXTERN PetscErrorCode DMCreateInjection(DM,DM,Mat*); 77aa1993deSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMGetWorkArray(DM,PetscInt,PetscDataType,void*); 78aa1993deSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMRestoreWorkArray(DM,PetscInt,PetscDataType,void*); 79014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRefine(DM,MPI_Comm,DM*); 80014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCoarsen(DM,MPI_Comm,DM*); 81a8fb8f29SToby Isaac PETSC_EXTERN PetscErrorCode DMGetCoarseDM(DM,DM*); 82a8fb8f29SToby Isaac PETSC_EXTERN PetscErrorCode DMSetCoarseDM(DM,DM); 8388bdff64SToby Isaac PETSC_EXTERN PetscErrorCode DMGetFineDM(DM,DM*); 8488bdff64SToby Isaac PETSC_EXTERN PetscErrorCode DMSetFineDM(DM,DM); 85014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRefineHierarchy(DM,PetscInt,DM[]); 86014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCoarsenHierarchy(DM,PetscInt,DM[]); 87014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCoarsenHookAdd(DM,PetscErrorCode (*)(DM,DM,void*),PetscErrorCode (*)(DM,Mat,Vec,Mat,DM,void*),void*); 88014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRefineHookAdd(DM,PetscErrorCode (*)(DM,DM,void*),PetscErrorCode (*)(DM,Mat,DM,void*),void*); 89014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMRestrict(DM,Mat,Vec,Mat,DM); 90014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMInterpolate(DM,Mat,DM); 91014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetFromOptions(DM); 92685405a1SBarry Smith PETSC_STATIC_INLINE PetscErrorCode DMViewFromOptions(DM A,PetscObject obj,const char name[]) {return PetscObjectViewFromOptions((PetscObject)A,obj,name);} 93ca266f36SBarry Smith 94cd3c525cSToby Isaac typedef enum {DM_ADAPT_DETERMINE = PETSC_DETERMINE, DM_ADAPT_KEEP = 0, DM_ADAPT_REFINE, DM_ADAPT_COARSEN, DM_ADAPT_RESERVED_COUNT} DMAdaptFlag; 95a1b0c543SToby Isaac PETSC_EXTERN PetscErrorCode DMAdaptLabel(DM,DMLabel,DM*); 96*0d1cd5e0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMAdaptMetric(DM, Vec, DMLabel, DM *); 97df0b854cSToby Isaac 98014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetUp(DM); 99014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateInterpolationScale(DM,DM,Mat,Vec*); 100014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateAggregates(DM,DM,Mat*); 101baf369e7SPeter Brune PETSC_EXTERN PetscErrorCode DMGlobalToLocalHookAdd(DM,PetscErrorCode (*)(DM,Vec,InsertMode,Vec,void*),PetscErrorCode (*)(DM,Vec,InsertMode,Vec,void*),void*); 102d4d07f1eSToby Isaac PETSC_EXTERN PetscErrorCode DMLocalToGlobalHookAdd(DM,PetscErrorCode (*)(DM,Vec,InsertMode,Vec,void*),PetscErrorCode (*)(DM,Vec,InsertMode,Vec,void*),void*); 103014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGlobalToLocalBegin(DM,Vec,InsertMode,Vec); 104014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGlobalToLocalEnd(DM,Vec,InsertMode,Vec); 105014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMLocalToGlobalBegin(DM,Vec,InsertMode,Vec); 106014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMLocalToGlobalEnd(DM,Vec,InsertMode,Vec); 107d78e899eSRichard Tran Mills PETSC_EXTERN PetscErrorCode DMLocalToLocalBegin(DM,Vec,InsertMode,Vec); 108d78e899eSRichard Tran Mills PETSC_EXTERN PetscErrorCode DMLocalToLocalEnd(DM,Vec,InsertMode,Vec); 10919fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode DMConvert(DM,DMType,DM*); 110e1589f56SBarry Smith 111c73cfb54SMatthew G. Knepley /* Topology support */ 112c73cfb54SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetDimension(DM,PetscInt*); 113c73cfb54SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetDimension(DM,PetscInt); 114793f3fe5SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetDimPoints(DM,PetscInt,PetscInt*,PetscInt*); 1158e4ac7eaSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetUseNatural(DM,PetscBool*); 1168e4ac7eaSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetUseNatural(DM,PetscBool); 11746e270d4SMatthew G. Knepley 11846e270d4SMatthew G. Knepley /* Coordinate support */ 1196636e97aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMGetCoordinateDM(DM,DM*); 1201cfe2091SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetCoordinateDM(DM,DM); 12146e270d4SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetCoordinateDim(DM,PetscInt*); 12246e270d4SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetCoordinateDim(DM,PetscInt); 123e8abe2deSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetCoordinateSection(DM,PetscSection*); 12446e270d4SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetCoordinateSection(DM,PetscInt,PetscSection); 1256636e97aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMGetCoordinates(DM,Vec*); 1266636e97aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMSetCoordinates(DM,Vec); 1276636e97aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMGetCoordinatesLocal(DM,Vec*); 1286636e97aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMSetCoordinatesLocal(DM,Vec); 12962a38674SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMLocatePoints(DM,Vec,DMPointLocationType,PetscSF*); 1305dc8c3f7SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetPeriodicity(DM,const PetscReal**,const PetscReal**,const DMBoundaryType**); 1315dc8c3f7SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetPeriodicity(DM,const PetscReal[],const PetscReal[],const DMBoundaryType[]); 132e907e85cSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMLocalizeCoordinate(DM, const PetscScalar[], PetscBool, PetscScalar[]); 1332e17dfb7SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMLocalizeCoordinates(DM); 13436447a5eSToby Isaac PETSC_EXTERN PetscErrorCode DMGetCoordinatesLocalized(DM,PetscBool*); 1353c73bf98SDave May PETSC_EXTERN PetscErrorCode DMGetNeighbors(DM,PetscInt*,const PetscMPIInt**); 1366636e97aSMatthew G Knepley 1375dbd56e3SPeter Brune /* block hook interface */ 138be081cd6SPeter Brune PETSC_EXTERN PetscErrorCode DMSubDomainHookAdd(DM,PetscErrorCode (*)(DM,DM,void*),PetscErrorCode (*)(DM,VecScatter,VecScatter,DM,void*),void*); 139be081cd6SPeter Brune PETSC_EXTERN PetscErrorCode DMSubDomainRestrict(DM,VecScatter,VecScatter,DM); 1405dbd56e3SPeter Brune 141014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetOptionsPrefix(DM,const char []); 14231697293SDave May PETSC_EXTERN PetscErrorCode DMAppendOptionsPrefix(DM,const char []); 14331697293SDave May PETSC_EXTERN PetscErrorCode DMGetOptionsPrefix(DM,const char*[]); 14419fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode DMSetVecType(DM,VecType); 145c0dedaeaSBarry Smith PETSC_EXTERN PetscErrorCode DMGetVecType(DM,VecType*); 14619fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode DMSetMatType(DM,MatType); 147c0dedaeaSBarry Smith PETSC_EXTERN PetscErrorCode DMGetMatType(DM,MatType*); 148014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetApplicationContext(DM,void*); 149014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetApplicationContextDestroy(DM,PetscErrorCode (*)(void**)); 150014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetApplicationContext(DM,void*); 151014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetVariableBounds(DM,PetscErrorCode (*)(DM,Vec,Vec)); 152014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMHasVariableBounds(DM,PetscBool *); 153b0ae01b7SPeter Brune PETSC_EXTERN PetscErrorCode DMHasColoring(DM,PetscBool *); 1543ad4599aSBarry Smith PETSC_EXTERN PetscErrorCode DMHasCreateRestriction(DM,PetscBool *); 155014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMComputeVariableBounds(DM,Vec,Vec); 15693d92d96SBarry Smith 15781d26defSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMCreateSubDM(DM, PetscInt, PetscInt[], IS *, DM *); 15816621825SDmitry Karpeev PETSC_EXTERN PetscErrorCode DMCreateFieldDecomposition(DM,PetscInt*,char***,IS**,DM**); 1598d4ac253SDmitry Karpeev PETSC_EXTERN PetscErrorCode DMCreateDomainDecomposition(DM,PetscInt*,char***,IS**,IS**,DM**); 160e30e807fSPeter Brune PETSC_EXTERN PetscErrorCode DMCreateDomainDecompositionScatters(DM,PetscInt,DM*,VecScatter**,VecScatter**,VecScatter**); 161e7c4fc90SDmitry Karpeev 162014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetRefineLevel(DM,PetscInt*); 163fef3a512SBarry Smith PETSC_EXTERN PetscErrorCode DMSetRefineLevel(DM,PetscInt); 164014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetCoarsenLevel(DM,PetscInt*); 165014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMFinalizePackage(void); 166e1589f56SBarry Smith 1675f1ad066SMatthew G Knepley PETSC_EXTERN PetscErrorCode VecGetDM(Vec, DM*); 1685f1ad066SMatthew G Knepley PETSC_EXTERN PetscErrorCode VecSetDM(Vec, DM); 169c688c046SMatthew G Knepley PETSC_EXTERN PetscErrorCode MatGetDM(Mat, DM*); 170c688c046SMatthew G Knepley PETSC_EXTERN PetscErrorCode MatSetDM(Mat, DM); 171531c7667SBarry Smith PETSC_EXTERN PetscErrorCode MatFDColoringUseDM(Mat,MatFDColoring); 1725f1ad066SMatthew G Knepley 173e1589f56SBarry Smith typedef struct NLF_DAAD* NLF; 174e1589f56SBarry Smith 175bc2bf880SBarry Smith #define DM_FILE_CLASSID 1211221 1767da65231SMatthew G Knepley 1777da65231SMatthew G Knepley /* FEM support */ 178014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMPrintCellVector(PetscInt, const char [], PetscInt, const PetscScalar []); 179014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMPrintCellMatrix(PetscInt, const char [], PetscInt, PetscInt, const PetscScalar []); 1806113b454SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMPrintLocalVec(DM, const char [], PetscReal, Vec); 1817da65231SMatthew G Knepley 182014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetDefaultSection(DM, PetscSection *); 183014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetDefaultSection(DM, PetscSection); 1849435951eSToby Isaac PETSC_EXTERN PetscErrorCode DMGetDefaultConstraints(DM, PetscSection *, Mat *); 1859435951eSToby Isaac PETSC_EXTERN PetscErrorCode DMSetDefaultConstraints(DM, PetscSection, Mat); 186014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetDefaultGlobalSection(DM, PetscSection *); 187eaf8d80aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMSetDefaultGlobalSection(DM, PetscSection); 188014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMGetDefaultSF(DM, PetscSF *); 189014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMSetDefaultSF(DM, PetscSF); 190014dd563SJed Brown PETSC_EXTERN PetscErrorCode DMCreateDefaultSF(DM, PetscSection, PetscSection); 191b21d0597SMatthew G Knepley PETSC_EXTERN PetscErrorCode DMGetPointSF(DM, PetscSF *); 192057b4bcdSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMSetPointSF(DM, PetscSF); 19388ed4aceSMatthew G Knepley 19414f150ffSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetOutputDM(DM, DM *); 195cdb7a50dSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetOutputSequenceNumber(DM, PetscInt *, PetscReal *); 196cdb7a50dSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetOutputSequenceNumber(DM, PetscInt, PetscReal); 197cdb7a50dSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMOutputSequenceLoad(DM, PetscViewer, const char *, PetscInt, PetscReal *); 19814f150ffSMatthew G. Knepley 1992764a2aaSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMGetDS(DM, PetscDS *); 2002764a2aaSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetDS(DM, PetscDS); 201af122d2aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMGetNumFields(DM, PetscInt *); 202af122d2aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMSetNumFields(DM, PetscInt); 203af122d2aSMatthew G Knepley PETSC_EXTERN PetscErrorCode DMGetField(DM, PetscInt, PetscObject *); 204decb47aaSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMSetField(DM, PetscInt, PetscObject); 205af122d2aSMatthew G Knepley 20646fa42a0SMatthew G. Knepley /*E 20746fa42a0SMatthew G. Knepley PetscUnit - The seven fundamental SI units 20846fa42a0SMatthew G. Knepley 20946fa42a0SMatthew G. Knepley Level: beginner 21046fa42a0SMatthew G. Knepley 21146fa42a0SMatthew G. Knepley .seealso: DMPlexGetScale(), DMPlexSetScale() 21246fa42a0SMatthew G. Knepley E*/ 21383e5549fSMatthew G Knepley typedef enum {PETSC_UNIT_LENGTH, PETSC_UNIT_MASS, PETSC_UNIT_TIME, PETSC_UNIT_CURRENT, PETSC_UNIT_TEMPERATURE, PETSC_UNIT_AMOUNT, PETSC_UNIT_LUMINOSITY, NUM_PETSC_UNITS} PetscUnit; 214e87bb0d3SMatthew G Knepley 215e87bb0d3SMatthew G Knepley struct _DMInterpolationInfo { 216e87bb0d3SMatthew G Knepley MPI_Comm comm; 217e87bb0d3SMatthew G Knepley PetscInt dim; /*1 The spatial dimension of points */ 218e87bb0d3SMatthew G Knepley PetscInt nInput; /* The number of input points */ 219e87bb0d3SMatthew G Knepley PetscReal *points; /* The input point coordinates */ 220e87bb0d3SMatthew G Knepley PetscInt *cells; /* The cell containing each point */ 221e87bb0d3SMatthew G Knepley PetscInt n; /* The number of local points */ 222e87bb0d3SMatthew G Knepley Vec coords; /* The point coordinates */ 223e87bb0d3SMatthew G Knepley PetscInt dof; /* The number of components to interpolate */ 224e87bb0d3SMatthew G Knepley }; 225e87bb0d3SMatthew G Knepley typedef struct _DMInterpolationInfo *DMInterpolationInfo; 226e87bb0d3SMatthew G Knepley 22794b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationCreate(MPI_Comm, DMInterpolationInfo *); 22894b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationSetDim(DMInterpolationInfo, PetscInt); 22994b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationGetDim(DMInterpolationInfo, PetscInt *); 23094b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationSetDof(DMInterpolationInfo, PetscInt); 23194b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationGetDof(DMInterpolationInfo, PetscInt *); 23294b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationAddPoints(DMInterpolationInfo, PetscInt, PetscReal[]); 23394b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationSetUp(DMInterpolationInfo, DM, PetscBool); 23494b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationGetCoordinates(DMInterpolationInfo, Vec *); 23594b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationGetVector(DMInterpolationInfo, Vec *); 23694b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationRestoreVector(DMInterpolationInfo, Vec *); 23794b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationEvaluate(DMInterpolationInfo, DM, Vec, Vec); 23894b4b8a8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMInterpolationDestroy(DMInterpolationInfo *); 239c58f1c22SToby Isaac 240c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMCreateLabel(DM, const char []); 241c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelValue(DM, const char[], PetscInt, PetscInt *); 242c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMSetLabelValue(DM, const char[], PetscInt, PetscInt); 243c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMClearLabelValue(DM, const char[], PetscInt, PetscInt); 244c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelSize(DM, const char[], PetscInt *); 245c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelIdIS(DM, const char[], IS *); 246c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetStratumSize(DM, const char [], PetscInt, PetscInt *); 247c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetStratumIS(DM, const char [], PetscInt, IS *); 2484de306b1SToby Isaac PETSC_EXTERN PetscErrorCode DMSetStratumIS(DM, const char [], PetscInt, IS); 249c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMClearLabelStratum(DM, const char[], PetscInt); 250c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelOutput(DM, const char[], PetscBool *); 251c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMSetLabelOutput(DM, const char[], PetscBool); 252c58f1c22SToby Isaac 253c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetNumLabels(DM, PetscInt *); 254c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelName(DM, PetscInt, const char **); 255c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMHasLabel(DM, const char [], PetscBool *); 256c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabel(DM, const char *, DMLabel *); 257c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMGetLabelByNum(DM, PetscInt, DMLabel *); 258c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMAddLabel(DM, DMLabel); 259c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMRemoveLabel(DM, const char [], DMLabel *); 260c58f1c22SToby Isaac PETSC_EXTERN PetscErrorCode DMCopyLabels(DM, DM); 261c58f1c22SToby Isaac 262f971fd6bSMatthew G. Knepley /*E 263f971fd6bSMatthew G. Knepley DMBoundaryConditionType - indicates what type of boundary condition is to be imposed 264f971fd6bSMatthew G. Knepley 265f971fd6bSMatthew G. Knepley Note: This flag indicates the type of function which will define the condition: 266f971fd6bSMatthew G. Knepley $ DM_BC_ESSENTIAL - A Dirichlet condition using a function of the coordinates 267f971fd6bSMatthew G. Knepley $ DM_BC_ESSENTIAL_FIELD - A Dirichlet condition using a function of the coordinates and auxiliary field data 268f971fd6bSMatthew G. Knepley $ DM_BC_NATURAL - A Neumann condition using a function of the coordinates 269f971fd6bSMatthew G. Knepley $ DM_BC_NATURAL_FIELD - A Dirichlet condition using a function of the coordinates and auxiliary field data 270f971fd6bSMatthew G. Knepley $ DM_BC_NATURAL_RIEMANN - A flux condition which determines the state in ghost cells 271f971fd6bSMatthew G. Knepley The user can check whether a boundary condition is essential using (type & DM_BC_ESSENTIAL), and similarly for 272f971fd6bSMatthew G. Knepley natural conditions (type & DM_BC_NATURAL) 273f971fd6bSMatthew G. Knepley 274f971fd6bSMatthew G. Knepley Level: beginner 275f971fd6bSMatthew G. Knepley 276f971fd6bSMatthew G. Knepley .seealso: DMAddBoundary(), DMGetBoundary() 277f971fd6bSMatthew G. Knepley E*/ 278f971fd6bSMatthew G. Knepley typedef enum {DM_BC_ESSENTIAL = 1, DM_BC_ESSENTIAL_FIELD = 5, DM_BC_NATURAL = 2, DM_BC_NATURAL_FIELD = 6, DM_BC_NATURAL_RIEMANN = 10} DMBoundaryConditionType; 279a30ec4eaSSatish Balay PETSC_EXTERN PetscErrorCode DMAddBoundary(DM, DMBoundaryConditionType, const char[], const char[], PetscInt, PetscInt, const PetscInt *, void (*)(void), PetscInt, const PetscInt *, void *); 280a6ba4734SToby Isaac PETSC_EXTERN PetscErrorCode DMGetNumBoundary(DM, PetscInt *); 281a30ec4eaSSatish Balay PETSC_EXTERN PetscErrorCode DMGetBoundary(DM, PetscInt, DMBoundaryConditionType *, const char **, const char **, PetscInt *, PetscInt *, const PetscInt **, void (**)(void), PetscInt *, const PetscInt **, void **); 282a6ba4734SToby Isaac PETSC_EXTERN PetscErrorCode DMIsBoundaryPoint(DM, PetscInt, PetscBool *); 283a6ba4734SToby Isaac PETSC_EXTERN PetscErrorCode DMCopyBoundary(DM, DM); 2844d6f44ffSToby Isaac 2850709b2feSToby Isaac PETSC_EXTERN PetscErrorCode DMProjectFunction(DM,PetscReal,PetscErrorCode(**)(PetscInt,PetscReal,const PetscReal[],PetscInt,PetscScalar *,void *),void**,InsertMode,Vec); 2860709b2feSToby Isaac PETSC_EXTERN PetscErrorCode DMProjectFunctionLocal(DM,PetscReal,PetscErrorCode(**)(PetscInt,PetscReal,const PetscReal[],PetscInt,PetscScalar *,void *),void**,InsertMode,Vec); 2870709b2feSToby Isaac PETSC_EXTERN PetscErrorCode DMProjectFunctionLabelLocal(DM,PetscReal,DMLabel,PetscInt,const PetscInt[],PetscErrorCode(**)(PetscInt,PetscReal,const PetscReal[],PetscInt,PetscScalar *,void *),void **,InsertMode,Vec); 288191494d9SMatthew 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); 289191494d9SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMProjectFieldLabelLocal(DM,PetscReal,DMLabel,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); 2900709b2feSToby Isaac PETSC_EXTERN PetscErrorCode DMComputeL2Diff(DM,PetscReal,PetscErrorCode(**)(PetscInt,PetscReal,const PetscReal[],PetscInt,PetscScalar *,void *),void **,Vec,PetscReal *); 291b698f381SToby Isaac PETSC_EXTERN PetscErrorCode DMComputeL2GradientDiff(DM, PetscReal, PetscErrorCode (**)(PetscInt, PetscReal, const PetscReal [], const PetscReal [], PetscInt, PetscScalar *, void *), void **, Vec, const PetscReal [], PetscReal *); 2921189c1efSToby Isaac PETSC_EXTERN PetscErrorCode DMComputeL2FieldDiff(DM,PetscReal,PetscErrorCode(**)(PetscInt,PetscReal,const PetscReal[],PetscInt,PetscScalar *,void *),void **,Vec,PetscReal *); 293e1589f56SBarry Smith #endif 294