Lines Matching refs:dm

82 PetscErrorCode DMIsForest(DM dm, PetscBool *isForest)  in DMIsForest()  argument
89 PetscCall(PetscObjectTypeCompare((PetscObject)dm, link->name, &sameType)); in DMIsForest()
122 PetscErrorCode DMForestTemplate(DM dm, MPI_Comm comm, DM *tedm) in DMForestTemplate() argument
124 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestTemplate()
136 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestTemplate()
137 PetscCall(DMCreate(PetscObjectComm((PetscObject)dm), tedm)); in DMForestTemplate()
138 PetscCall(DMGetType(dm, &type)); in DMForestTemplate()
140 PetscCall(DMForestGetBaseDM(dm, &base)); in DMForestTemplate()
142 PetscCall(DMForestGetTopology(dm, &topology)); in DMForestTemplate()
144 PetscCall(DMForestGetAdjacencyDimension(dm, &dim)); in DMForestTemplate()
146 PetscCall(DMForestGetPartitionOverlap(dm, &overlap)); in DMForestTemplate()
148 PetscCall(DMForestGetMinimumRefinement(dm, &ref)); in DMForestTemplate()
150 PetscCall(DMForestGetMaximumRefinement(dm, &ref)); in DMForestTemplate()
152 PetscCall(DMForestGetAdaptivityStrategy(dm, &strat)); in DMForestTemplate()
154 PetscCall(DMForestGetGradeFactor(dm, &factor)); in DMForestTemplate()
156 PetscCall(DMForestGetBaseCoordinateMapping(dm, &map, &mapCtx)); in DMForestTemplate()
158 if (forest->ftemplate) PetscCall((*forest->ftemplate)(dm, *tedm)); in DMForestTemplate()
159 PetscCall(DMForestSetAdaptivityForest(*tedm, dm)); in DMForestTemplate()
160 PetscCall(DMCopyDisc(dm, *tedm)); in DMForestTemplate()
161 PetscCall(DMGetApplicationContext(dm, &ctx)); in DMForestTemplate()
166 PetscCall(DMGetPeriodicity(dm, &maxCell, &Lstart, &L)); in DMForestTemplate()
169 PetscCall(DMGetMatType(dm, &mtype)); in DMForestTemplate()
174 static PetscErrorCode DMInitialize_Forest(DM dm);
176 PetscErrorCode DMClone_Forest(DM dm, DM *newdm) in DMClone_Forest() argument
178 DM_Forest *forest = (DM_Forest *)dm->data; in DMClone_Forest()
184 PetscCall(PetscObjectGetType((PetscObject)dm, &type)); in DMClone_Forest()
190 static PetscErrorCode DMDestroy_Forest(DM dm) in DMDestroy_Forest() argument
192 DM_Forest *forest = (DM_Forest *)dm->data; in DMDestroy_Forest()
195 PetscCall(PetscObjectComposeFunction((PetscObject)dm, "DMConvert_plex_p4est_C", NULL)); in DMDestroy_Forest()
196 PetscCall(PetscObjectComposeFunction((PetscObject)dm, "DMConvert_p4est_plex_C", NULL)); in DMDestroy_Forest()
197 PetscCall(PetscObjectComposeFunction((PetscObject)dm, "DMConvert_plex_p8est_C", NULL)); in DMDestroy_Forest()
198 PetscCall(PetscObjectComposeFunction((PetscObject)dm, "DMConvert_p8est_plex_C", NULL)); in DMDestroy_Forest()
199 PetscCall(PetscObjectComposeFunction((PetscObject)dm, "DMSetUpGLVisViewer_C", NULL)); in DMDestroy_Forest()
200 PetscCall(PetscObjectComposeFunction((PetscObject)dm, "DMCreateNeumannOverlap_C", NULL)); in DMDestroy_Forest()
201 PetscCall(PetscObjectComposeFunction((PetscObject)dm, "DMPlexGetOverlap_C", NULL)); in DMDestroy_Forest()
202 PetscCall(PetscObjectComposeFunction((PetscObject)dm, "MatComputeNeumannOverlap_C", NULL)); in DMDestroy_Forest()
204 if (forest->destroy) PetscCall((*forest->destroy)(dm)); in DMDestroy_Forest()
232 PetscErrorCode DMForestSetTopology(DM dm, DMForestTopology topology) in DMForestSetTopology() argument
234 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetTopology()
237 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetTopology()
238 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetTopology()
259 PetscErrorCode DMForestGetTopology(DM dm, DMForestTopology *topology) in DMForestGetTopology() argument
261 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetTopology()
264 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetTopology()
291 PetscErrorCode DMForestSetBaseDM(DM dm, DM base) in DMForestSetBaseDM() argument
293 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetBaseDM()
297 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetBaseDM()
298 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetBaseDM()
307 PetscCall(DMSetDimension(dm, dim)); in DMForestSetBaseDM()
309 PetscCall(DMSetCoordinateDim(dm, dimEmbed)); in DMForestSetBaseDM()
311 PetscCall(DMSetPeriodicity(dm, maxCell, Lstart, L)); in DMForestSetBaseDM()
312 } else PetscCall(DMSetPeriodicity(dm, NULL, NULL, NULL)); in DMForestSetBaseDM()
338 PetscErrorCode DMForestGetBaseDM(DM dm, DM *base) in DMForestGetBaseDM() argument
340 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetBaseDM()
343 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetBaseDM()
349 PetscErrorCode DMForestSetBaseCoordinateMapping(DM dm, PetscErrorCode (*func)(DM, PetscInt, PetscIn… in DMForestSetBaseCoordinateMapping() argument
351 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetBaseCoordinateMapping()
354 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetBaseCoordinateMapping()
360 PetscErrorCode DMForestGetBaseCoordinateMapping(DM dm, PetscErrorCode (**func)(DM, PetscInt, PetscI… in DMForestGetBaseCoordinateMapping() argument
362 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetBaseCoordinateMapping()
365 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetBaseCoordinateMapping()
394 PetscErrorCode DMForestSetAdaptivityForest(DM dm, DM adapt) in DMForestSetAdaptivityForest() argument
401 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetAdaptivityForest()
403 PetscCall(DMIsForest(dm, &isForest)); in DMForestSetAdaptivityForest()
405 …PetscCheck(adapt == NULL || !dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRON… in DMForestSetAdaptivityForest()
406 forest = (DM_Forest *)dm->data; in DMForestSetAdaptivityForest()
407 PetscCall(DMForestGetAdaptivityForest(dm, &oldAdapt)); in DMForestSetAdaptivityForest()
413 if (forest->clearadaptivityforest) PetscCall((*forest->clearadaptivityforest)(dm)); in DMForestSetAdaptivityForest()
422 PetscCall(DMSetCoarseDM(dm, adapt)); in DMForestSetAdaptivityForest()
426 PetscCall(DMSetFineDM(dm, adapt)); in DMForestSetAdaptivityForest()
449 PetscErrorCode DMForestGetAdaptivityForest(DM dm, DM *adapt) in DMForestGetAdaptivityForest() argument
454 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetAdaptivityForest()
455 forest = (DM_Forest *)dm->data; in DMForestGetAdaptivityForest()
461 PetscCall(DMGetCoarseDM(dm, adapt)); in DMForestGetAdaptivityForest()
465 PetscCall(DMGetFineDM(dm, adapt)); in DMForestGetAdaptivityForest()
496 PetscErrorCode DMForestSetAdaptivityPurpose(DM dm, DMAdaptFlag purpose) in DMForestSetAdaptivityPurpose() argument
501 forest = (DM_Forest *)dm->data; in DMForestSetAdaptivityPurpose()
502 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetAdaptivityPurpose()
506 PetscCall(DMForestGetAdaptivityForest(dm, &adapt)); in DMForestSetAdaptivityPurpose()
508 PetscCall(DMForestSetAdaptivityForest(dm, NULL)); in DMForestSetAdaptivityPurpose()
512 PetscCall(DMForestSetAdaptivityForest(dm, adapt)); in DMForestSetAdaptivityPurpose()
543 PetscErrorCode DMForestGetAdaptivityPurpose(DM dm, DMAdaptFlag *purpose) in DMForestGetAdaptivityPurpose() argument
548 forest = (DM_Forest *)dm->data; in DMForestGetAdaptivityPurpose()
567 PetscErrorCode DMForestSetAdjacencyDimension(DM dm, PetscInt adjDim) in DMForestSetAdjacencyDimension() argument
570 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetAdjacencyDimension()
573 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetAdjacencyDimension()
574 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetAdjacencyDimension()
575 …PetscCheck(adjDim >= 0, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "adjacency dim… in DMForestSetAdjacencyDimension()
576 PetscCall(DMGetDimension(dm, &dim)); in DMForestSetAdjacencyDimension()
577 …PetscCheck(adjDim <= dim, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "adjacency d… in DMForestSetAdjacencyDimension()
596 PetscErrorCode DMForestSetAdjacencyCodimension(DM dm, PetscInt adjCodim) in DMForestSetAdjacencyCodimension() argument
601 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetAdjacencyCodimension()
602 PetscCall(DMGetDimension(dm, &dim)); in DMForestSetAdjacencyCodimension()
603 PetscCall(DMForestSetAdjacencyDimension(dm, dim - adjCodim)); in DMForestSetAdjacencyCodimension()
623 PetscErrorCode DMForestGetAdjacencyDimension(DM dm, PetscInt *adjDim) in DMForestGetAdjacencyDimension() argument
625 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetAdjacencyDimension()
628 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetAdjacencyDimension()
650 PetscErrorCode DMForestGetAdjacencyCodimension(DM dm, PetscInt *adjCodim) in DMForestGetAdjacencyCodimension() argument
652 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetAdjacencyCodimension()
656 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetAdjacencyCodimension()
658 PetscCall(DMGetDimension(dm, &dim)); in DMForestGetAdjacencyCodimension()
678 PetscErrorCode DMForestSetPartitionOverlap(DM dm, PetscInt overlap) in DMForestSetPartitionOverlap() argument
680 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetPartitionOverlap()
683 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetPartitionOverlap()
684 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetPartitionOverlap()
685 …PetscCheck(overlap >= 0, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "overlap cann… in DMForestSetPartitionOverlap()
706 PetscErrorCode DMForestGetPartitionOverlap(DM dm, PetscInt *overlap) in DMForestGetPartitionOverlap() argument
708 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetPartitionOverlap()
711 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetPartitionOverlap()
732 PetscErrorCode DMForestSetMinimumRefinement(DM dm, PetscInt minRefinement) in DMForestSetMinimumRefinement() argument
734 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetMinimumRefinement()
737 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetMinimumRefinement()
738 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetMinimumRefinement()
760 PetscErrorCode DMForestGetMinimumRefinement(DM dm, PetscInt *minRefinement) in DMForestGetMinimumRefinement() argument
762 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetMinimumRefinement()
765 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetMinimumRefinement()
785 PetscErrorCode DMForestSetInitialRefinement(DM dm, PetscInt initRefinement) in DMForestSetInitialRefinement() argument
787 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetInitialRefinement()
790 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetInitialRefinement()
791 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetInitialRefinement()
812 PetscErrorCode DMForestGetInitialRefinement(DM dm, PetscInt *initRefinement) in DMForestGetInitialRefinement() argument
814 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetInitialRefinement()
817 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetInitialRefinement()
838 PetscErrorCode DMForestSetMaximumRefinement(DM dm, PetscInt maxRefinement) in DMForestSetMaximumRefinement() argument
840 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetMaximumRefinement()
843 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetMaximumRefinement()
844 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetMaximumRefinement()
866 PetscErrorCode DMForestGetMaximumRefinement(DM dm, PetscInt *maxRefinement) in DMForestGetMaximumRefinement() argument
868 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetMaximumRefinement()
871 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetMaximumRefinement()
895 PetscErrorCode DMForestSetAdaptivityStrategy(DM dm, DMForestAdaptivityStrategy adaptStrategy) in DMForestSetAdaptivityStrategy() argument
897 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetAdaptivityStrategy()
900 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetAdaptivityStrategy()
927 PetscErrorCode DMForestGetAdaptivityStrategy(DM dm, DMForestAdaptivityStrategy *adaptStrategy) in DMForestGetAdaptivityStrategy() argument
929 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetAdaptivityStrategy()
932 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetAdaptivityStrategy()
959 PetscErrorCode DMForestGetAdaptivitySuccess(DM dm, PetscBool *success) in DMForestGetAdaptivitySuccess() argument
964 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetAdaptivitySuccess()
965 …PetscCheck(dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "DMSetUp()… in DMForestGetAdaptivitySuccess()
966 forest = (DM_Forest *)dm->data; in DMForestGetAdaptivitySuccess()
967 PetscCall(forest->getadaptivitysuccess(dm, success)); in DMForestGetAdaptivitySuccess()
988 PetscErrorCode DMForestSetComputeAdaptivitySF(DM dm, PetscBool computeSF) in DMForestSetComputeAdaptivitySF() argument
993 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetComputeAdaptivitySF()
994 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetComputeAdaptivitySF()
995 forest = (DM_Forest *)dm->data; in DMForestSetComputeAdaptivitySF()
1015 PetscErrorCode DMForestTransferVecFromBase(DM dm, Vec vecIn, Vec vecOut) in DMForestTransferVecFromBase() argument
1020 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestTransferVecFromBase()
1023 forest = (DM_Forest *)dm->data; in DMForestTransferVecFromBase()
1024 …PetscCheck(forest->transfervecfrombase, PetscObjectComm((PetscObject)dm), PETSC_ERR_SUP, "DMForest… in DMForestTransferVecFromBase()
1025 PetscCall(forest->transfervecfrombase(dm, vecIn, vecOut)); in DMForestTransferVecFromBase()
1046 PetscErrorCode DMForestGetComputeAdaptivitySF(DM dm, PetscBool *computeSF) in DMForestGetComputeAdaptivitySF() argument
1051 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetComputeAdaptivitySF()
1052 forest = (DM_Forest *)dm->data; in DMForestGetComputeAdaptivitySF()
1081 PetscErrorCode DMForestGetAdaptivitySF(DM dm, PeOp PetscSF *preCoarseToFine, PeOp PetscSF *coarseTo… in DMForestGetAdaptivitySF() argument
1086 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetAdaptivitySF()
1087 PetscCall(DMSetUp(dm)); in DMForestGetAdaptivitySF()
1088 forest = (DM_Forest *)dm->data; in DMForestGetAdaptivitySF()
1112 PetscErrorCode DMForestSetGradeFactor(DM dm, PetscInt grade) in DMForestSetGradeFactor() argument
1114 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetGradeFactor()
1117 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetGradeFactor()
1118 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetGradeFactor()
1140 PetscErrorCode DMForestGetGradeFactor(DM dm, PetscInt *grade) in DMForestGetGradeFactor() argument
1142 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetGradeFactor()
1145 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetGradeFactor()
1172 PetscErrorCode DMForestSetCellWeightFactor(DM dm, PetscReal weightsFactor) in DMForestSetCellWeightFactor() argument
1174 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetCellWeightFactor()
1177 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetCellWeightFactor()
1178 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetCellWeightFactor()
1206 PetscErrorCode DMForestGetCellWeightFactor(DM dm, PetscReal *weightsFactor) in DMForestGetCellWeightFactor() argument
1208 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetCellWeightFactor()
1211 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetCellWeightFactor()
1233 PetscErrorCode DMForestGetCellChart(DM dm, PetscInt *cStart, PetscInt *cEnd) in DMForestGetCellChart() argument
1235 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetCellChart()
1238 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetCellChart()
1241 …_DETERMINE)) && forest->createcellchart) PetscCall(forest->createcellchart(dm, &forest->cStart, &f… in DMForestGetCellChart()
1262 PetscErrorCode DMForestGetCellSF(DM dm, PetscSF *cellSF) in DMForestGetCellSF() argument
1264 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetCellSF()
1267 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetCellSF()
1269 …if ((!forest->cellSF) && forest->createcellsf) PetscCall(forest->createcellsf(dm, &forest->cellSF)… in DMForestGetCellSF()
1293 PetscErrorCode DMForestSetAdaptivityLabel(DM dm, DMLabel adaptLabel) in DMForestSetAdaptivityLabel() argument
1295 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetAdaptivityLabel()
1298 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetAdaptivityLabel()
1327 PetscErrorCode DMForestGetAdaptivityLabel(DM dm, DMLabel *adaptLabel) in DMForestGetAdaptivityLabel() argument
1329 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetAdaptivityLabel()
1332 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetAdaptivityLabel()
1352 PetscErrorCode DMForestSetCellWeights(DM dm, PetscReal weights[], PetscCopyMode copyMode) in DMForestSetCellWeights() argument
1354 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetCellWeights()
1358 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetCellWeights()
1359 PetscCall(DMForestGetCellChart(dm, &cStart, &cEnd)); in DMForestSetCellWeights()
1389 PetscErrorCode DMForestGetCellWeights(DM dm, PetscReal **weights) in DMForestGetCellWeights() argument
1391 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetCellWeights()
1394 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetCellWeights()
1419 PetscErrorCode DMForestSetWeightCapacity(DM dm, PetscReal capacity) in DMForestSetWeightCapacity() argument
1421 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestSetWeightCapacity()
1424 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestSetWeightCapacity()
1425 …PetscCheck(!dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot c… in DMForestSetWeightCapacity()
1426 …PetscCheck(capacity >= 0., PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cannot hav… in DMForestSetWeightCapacity()
1452 PetscErrorCode DMForestGetWeightCapacity(DM dm, PetscReal *capacity) in DMForestGetWeightCapacity() argument
1454 DM_Forest *forest = (DM_Forest *)dm->data; in DMForestGetWeightCapacity()
1457 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMForestGetWeightCapacity()
1463 PetscErrorCode DMSetFromOptions_Forest(DM dm, PetscOptionItems PetscOptionsObject) in DMSetFromOptions_Forest() argument
1475 PetscCall(DMForestGetTopology(dm, &oldTopo)); in DMSetFromOptions_Forest()
1481 …)flg2 + (PetscInt)flg3 + (PetscInt)flg4 <= 1, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_INCO… in DMSetFromOptions_Forest()
1483 PetscCall(DMForestSetTopology(dm, (DMForestTopology)stringBuffer)); in DMSetFromOptions_Forest()
1484 PetscCall(DMForestSetBaseDM(dm, NULL)); in DMSetFromOptions_Forest()
1485 PetscCall(DMForestSetAdaptivityForest(dm, NULL)); in DMSetFromOptions_Forest()
1490 PetscCall(DMCreate(PetscObjectComm((PetscObject)dm), &base)); in DMSetFromOptions_Forest()
1494 PetscCall(DMForestSetBaseDM(dm, base)); in DMSetFromOptions_Forest()
1496 PetscCall(DMForestSetTopology(dm, NULL)); in DMSetFromOptions_Forest()
1497 PetscCall(DMForestSetAdaptivityForest(dm, NULL)); in DMSetFromOptions_Forest()
1502 PetscCall(DMCreate(PetscObjectComm((PetscObject)dm), &coarse)); in DMSetFromOptions_Forest()
1506 PetscCall(DMForestSetAdaptivityForest(dm, coarse)); in DMSetFromOptions_Forest()
1508 PetscCall(DMForestSetTopology(dm, NULL)); in DMSetFromOptions_Forest()
1509 PetscCall(DMForestSetBaseDM(dm, NULL)); in DMSetFromOptions_Forest()
1514 PetscCall(DMCreate(PetscObjectComm((PetscObject)dm), &fine)); in DMSetFromOptions_Forest()
1518 PetscCall(DMForestSetAdaptivityForest(dm, fine)); in DMSetFromOptions_Forest()
1520 PetscCall(DMForestSetTopology(dm, NULL)); in DMSetFromOptions_Forest()
1521 PetscCall(DMForestSetBaseDM(dm, NULL)); in DMSetFromOptions_Forest()
1523 PetscCall(DMForestGetAdjacencyDimension(dm, &adjDim)); in DMSetFromOptions_Forest()
1526 PetscCall(DMForestSetAdjacencyDimension(dm, adjDim)); in DMSetFromOptions_Forest()
1528 PetscCall(DMForestGetAdjacencyCodimension(dm, &adjCodim)); in DMSetFromOptions_Forest()
1530 if (flg) PetscCall(DMForestSetAdjacencyCodimension(dm, adjCodim)); in DMSetFromOptions_Forest()
1532 PetscCall(DMForestGetPartitionOverlap(dm, &overlap)); in DMSetFromOptions_Forest()
1534 if (flg) PetscCall(DMForestSetPartitionOverlap(dm, overlap)); in DMSetFromOptions_Forest()
1538 PetscCall(DMForestSetMinimumRefinement(dm,minRefinement)); in DMSetFromOptions_Forest()
1539 PetscCall(DMForestSetInitialRefinement(dm,minRefinement)); in DMSetFromOptions_Forest()
1543 PetscCall(DMForestSetMinimumRefinement(dm,0)); in DMSetFromOptions_Forest()
1544 PetscCall(DMForestSetInitialRefinement(dm,initRefinement)); in DMSetFromOptions_Forest()
1547 PetscCall(DMForestGetMinimumRefinement(dm, &minRefinement)); in DMSetFromOptions_Forest()
1549 if (flg) PetscCall(DMForestSetMinimumRefinement(dm, minRefinement)); in DMSetFromOptions_Forest()
1550 PetscCall(DMForestGetInitialRefinement(dm, &initRefinement)); in DMSetFromOptions_Forest()
1552 if (flg) PetscCall(DMForestSetInitialRefinement(dm, initRefinement)); in DMSetFromOptions_Forest()
1553 PetscCall(DMForestGetMaximumRefinement(dm, &maxRefinement)); in DMSetFromOptions_Forest()
1555 if (flg) PetscCall(DMForestSetMaximumRefinement(dm, maxRefinement)); in DMSetFromOptions_Forest()
1556 PetscCall(DMForestGetAdaptivityStrategy(dm, &adaptStrategy)); in DMSetFromOptions_Forest()
1558 if (flg) PetscCall(DMForestSetAdaptivityStrategy(dm, (DMForestAdaptivityStrategy)stringBuffer)); in DMSetFromOptions_Forest()
1559 PetscCall(DMForestGetGradeFactor(dm, &grade)); in DMSetFromOptions_Forest()
1561 if (flg) PetscCall(DMForestSetGradeFactor(dm, grade)); in DMSetFromOptions_Forest()
1562 PetscCall(DMForestGetCellWeightFactor(dm, &weightsFactor)); in DMSetFromOptions_Forest()
1564 if (flg) PetscCall(DMForestSetCellWeightFactor(dm, weightsFactor)); in DMSetFromOptions_Forest()
1569 static PetscErrorCode DMCreateSubDM_Forest(DM dm, PetscInt numFields, const PetscInt fields[], IS *… in DMCreateSubDM_Forest() argument
1572 if (subdm) PetscCall(DMClone(dm, subdm)); in DMCreateSubDM_Forest()
1573 PetscCall(DMCreateSectionSubDM(dm, numFields, fields, NULL, NULL, is, subdm)); in DMCreateSubDM_Forest()
1577 static PetscErrorCode DMRefine_Forest(DM dm, MPI_Comm comm, DM *dmRefined) in DMRefine_Forest() argument
1583 PetscCall(DMGetFineDM(dm, &fineDM)); in DMRefine_Forest()
1589 PetscCall(DMForestTemplate(dm, comm, dmRefined)); in DMRefine_Forest()
1590 PetscCall(DMGetLabel(dm, "refine", &refine)); in DMRefine_Forest()
1600 static PetscErrorCode DMCoarsen_Forest(DM dm, MPI_Comm comm, DM *dmCoarsened) in DMCoarsen_Forest() argument
1608 MPI_Comm dmcomm = PetscObjectComm((PetscObject)dm); in DMCoarsen_Forest()
1613 PetscCall(DMGetCoarseDM(dm, &coarseDM)); in DMCoarsen_Forest()
1619 PetscCall(DMForestTemplate(dm, comm, dmCoarsened)); in DMCoarsen_Forest()
1621 PetscCall(DMGetLabel(dm, "coarsen", &coarsen)); in DMCoarsen_Forest()
1631 PetscErrorCode DMAdaptLabel_Forest(DM dm, PETSC_UNUSED Vec metric, DMLabel label, PETSC_UNUSED DMLa… in DMAdaptLabel_Forest() argument
1636 PetscCall(DMForestTemplate(dm, PetscObjectComm((PetscObject)dm), adaptedDM)); in DMAdaptLabel_Forest()
1647 static PetscErrorCode DMInitialize_Forest(DM dm) in DMInitialize_Forest() argument
1650 PetscCall(PetscMemzero(dm->ops, sizeof(*dm->ops))); in DMInitialize_Forest()
1652 dm->ops->clone = DMClone_Forest; in DMInitialize_Forest()
1653 dm->ops->setfromoptions = DMSetFromOptions_Forest; in DMInitialize_Forest()
1654 dm->ops->destroy = DMDestroy_Forest; in DMInitialize_Forest()
1655 dm->ops->createsubdm = DMCreateSubDM_Forest; in DMInitialize_Forest()
1656 dm->ops->refine = DMRefine_Forest; in DMInitialize_Forest()
1657 dm->ops->coarsen = DMCoarsen_Forest; in DMInitialize_Forest()
1679 PETSC_EXTERN PetscErrorCode DMCreate_Forest(DM dm) in DMCreate_Forest() argument
1684 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreate_Forest()
1686 dm->dim = 0; in DMCreate_Forest()
1687 dm->data = forest; in DMCreate_Forest()
1708 PetscCall(DMForestSetAdaptivityStrategy(dm, DMFORESTADAPTALL)); in DMCreate_Forest()
1709 PetscCall(DMInitialize_Forest(dm)); in DMCreate_Forest()