1c9aa14a7SToby Isaac /* 268d54884SBarry Smith DMFOREST, for parallel, hierarchically refined, distributed mesh problems. 3c9aa14a7SToby Isaac */ 4*26bd1501SBarry Smith #if !defined(PETSCDMFOREST_H) 5*26bd1501SBarry Smith #define PETSCDMFOREST_H 6c9aa14a7SToby Isaac 7c9aa14a7SToby Isaac #include <petscdm.h> 8c9aa14a7SToby Isaac 9c9aa14a7SToby Isaac /*J 1068d54884SBarry Smith DMForestTopology - String with the name of a PETSc DMFOREST base mesh topology. The topology is a string (e.g. 1168d54884SBarry Smith "cube", "shell") and can be interpreted by subtypes of DMFOREST) to construct the base DM of a forest during 1268d54884SBarry Smith DMSetUp(). 13c9aa14a7SToby Isaac 14c9aa14a7SToby Isaac Level: beginner 15c9aa14a7SToby Isaac 1668d54884SBarry Smith .seealso: DMForestSetTopology(), DMForestGetTopology(), DMFOREST 17c9aa14a7SToby Isaac J*/ 18c9aa14a7SToby Isaac typedef const char* DMForestTopology; 19c9aa14a7SToby Isaac 20bb2ed840SToby Isaac /* Just a name for the shape of the domain */ 21c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetTopology(DM, DMForestTopology); 22c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetTopology(DM, DMForestTopology *); 23c9aa14a7SToby Isaac 24c9aa14a7SToby Isaac /* this is the coarsest possible forest: can be any DM which we can 25bb2ed840SToby Isaac * convert to a DMForest (right now: plex) */ 26c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetBaseDM(DM, DM); 27c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetBaseDM(DM, DM *); 2899478f86SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetBaseCoordinateMapping(DM, PetscErrorCode(*)(DM,PetscInt,PetscInt,const PetscReal[],PetscReal[],void*),void*); 2999478f86SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetBaseCoordinateMapping(DM, PetscErrorCode(**)(DM,PetscInt,PetscInt,const PetscReal[],PetscReal[],void*),void*); 30c9aa14a7SToby Isaac 31ba936b91SToby Isaac /* this is the forest from which we adapt */ 32ba936b91SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetAdaptivityForest(DM, DM); 33ba936b91SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetAdaptivityForest(DM, DM *); 34c9aa14a7SToby Isaac 35a1b0c543SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetAdaptivityPurpose(DM, DMAdaptFlag); 36a1b0c543SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetAdaptivityPurpose(DM, DMAdaptFlag*); 3726d9498aSToby Isaac 38c9aa14a7SToby Isaac /* what we consider adjacent, for the purposes of cell grading, overlap, etc. */ 39c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetAdjacencyDimension(DM, PetscInt); 40c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetAdjacencyDimension(DM, PetscInt *); 41c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetAdjacencyCodimension(DM, PetscInt); 42c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetAdjacencyCodimension(DM, PetscInt *); 43c9aa14a7SToby Isaac 44c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetPartitionOverlap(DM, PetscInt); 45c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetPartitionOverlap(DM, PetscInt *); 46c9aa14a7SToby Isaac 47c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetMinimumRefinement(DM, PetscInt); 48c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetMinimumRefinement(DM, PetscInt *); 49c9aa14a7SToby Isaac 50c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetMaximumRefinement(DM, PetscInt); 51c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetMaximumRefinement(DM, PetscInt *); 52c9aa14a7SToby Isaac 5356ba9f64SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetInitialRefinement(DM, PetscInt); 5456ba9f64SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetInitialRefinement(DM, PetscInt *); 5556ba9f64SToby Isaac 563616b93eSToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetCellChart(DM, PetscInt *, PetscInt *); 57c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetCellSF(DM, PetscSF *); 58c9aa14a7SToby Isaac 59c9aa14a7SToby Isaac 60c9aa14a7SToby Isaac /* flag each cell with an adaptivity count: should match the cell section */ 61a1b0c543SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetAdaptivityLabel(DM, DMLabel); 62a1b0c543SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetAdaptivityLabel(DM, DMLabel*); 63c9aa14a7SToby Isaac 64c9aa14a7SToby Isaac /*J 65c9aa14a7SToby Isaac DMForestAdaptivityStrategy - String with the name of a PETSc DMForest adaptivity strategy 66c9aa14a7SToby Isaac 67c9aa14a7SToby Isaac Level: intermediate 68c9aa14a7SToby Isaac 69c9aa14a7SToby Isaac .seealso: DMForestSetType(), DMForest 70c9aa14a7SToby Isaac J*/ 71c9aa14a7SToby Isaac typedef const char* DMForestAdaptivityStrategy; 72c9aa14a7SToby Isaac #define DMFORESTADAPTALL "all" 73c9aa14a7SToby Isaac #define DMFORESTADAPTANY "any" 74c9aa14a7SToby Isaac 75c9aa14a7SToby Isaac /* how to combine: -flags from multiple processes, 76c9aa14a7SToby Isaac * -coarsen flags from multiple children 77c9aa14a7SToby Isaac */ 783616b93eSToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetAdaptivityStrategy(DM, DMForestAdaptivityStrategy); 793616b93eSToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetAdaptivityStrategy(DM, DMForestAdaptivityStrategy *); 80c9aa14a7SToby Isaac 81bf9b5d84SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetComputeAdaptivitySF(DM, PetscBool); 82bf9b5d84SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetComputeAdaptivitySF(DM, PetscBool *); 83bf9b5d84SToby Isaac 84bf9b5d84SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetAdaptivitySF(DM, PetscSF *, PetscSF *); 85bf9b5d84SToby Isaac 862a133e43SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetAdaptivitySuccess(DM, PetscBool *); 872a133e43SToby Isaac 880eb7e1eaSToby Isaac PETSC_EXTERN PetscErrorCode DMForestTransferVec(DM, Vec, DM, Vec, PetscBool, PetscReal); 89ac34a06fSStefano Zampini PETSC_EXTERN PetscErrorCode DMForestTransferVecFromBase(DM, Vec, Vec); 9080b27e07SToby Isaac 91c9aa14a7SToby Isaac /* for a quadtree/octree mesh, this is the x:1 condition: 1 indicates a uniform mesh, 92c9aa14a7SToby Isaac * 2 indicates typical 2:1, 93c9aa14a7SToby Isaac */ 94c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetGradeFactor(DM, PetscInt); 95c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetGradeFactor(DM, PetscInt *); 96c9aa14a7SToby Isaac 97c9aa14a7SToby Isaac /* weights for repartitioning */ 98c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetCellWeights(DM, PetscReal[], PetscCopyMode); 99c7eeac06SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetCellWeights(DM, PetscReal *[]); 100c9aa14a7SToby Isaac 101c9aa14a7SToby Isaac /* weight multiplier for refinement level: useful for sub-cycling time steps */ 102c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetCellWeightFactor(DM, PetscReal); 103c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetCellWeightFactor(DM, PetscReal *); 104c9aa14a7SToby Isaac 105c9aa14a7SToby Isaac /* this process's capacity when redistributing the cells */ 1063616b93eSToby Isaac PETSC_EXTERN PetscErrorCode DMForestSetWeightCapacity(DM, PetscReal); 1073616b93eSToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetWeightCapacity(DM, PetscReal *); 108c9aa14a7SToby Isaac 109c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetFineProjector(DM,Mat *); 110c9aa14a7SToby Isaac PETSC_EXTERN PetscErrorCode DMForestGetCoarseRestrictor(DM,Mat *); 111c9aa14a7SToby Isaac 112a0452a8eSToby Isaac /* miscellaneous */ 11320e8089bSToby Isaac PETSC_EXTERN PetscErrorCode DMForestTemplate(DM,MPI_Comm,DM*); 114a0452a8eSToby Isaac 11527d4645fSToby Isaac /* type management */ 11627d4645fSToby Isaac PETSC_EXTERN PetscErrorCode DMForestRegisterType(DMType); 11727d4645fSToby Isaac PETSC_EXTERN PetscErrorCode DMIsForest(DM,PetscBool*); 11827d4645fSToby Isaac 119a0452a8eSToby Isaac /* p4est */ 120a0452a8eSToby Isaac PETSC_EXTERN PetscErrorCode DMP4estGetPartitionForCoarsening(DM,PetscBool *); 121a0452a8eSToby Isaac PETSC_EXTERN PetscErrorCode DMP4estSetPartitionForCoarsening(DM,PetscBool); 122a0452a8eSToby Isaac PETSC_EXTERN PetscErrorCode DMP8estGetPartitionForCoarsening(DM,PetscBool *); 123a0452a8eSToby Isaac PETSC_EXTERN PetscErrorCode DMP8estSetPartitionForCoarsening(DM,PetscBool); 124a0452a8eSToby Isaac 125c9aa14a7SToby Isaac #endif 126