Lines Matching refs:dm
425 static PetscErrorCode CreateSimplex_2D(MPI_Comm comm, PetscInt testNum, DM *dm) in CreateSimplex_2D() argument
444 …PetscCall(DMPlexCreateFromDAG(*dm, 1, numPoints, coneSize, cones, coneOrientations, vertexCoords)); in CreateSimplex_2D()
445 …for (p = 0; p < 4; ++p) PetscCall(DMSetLabelValue(*dm, "marker", markerPoints[p * 2], markerPoints… in CreateSimplex_2D()
446 for (p = 0; p < 2; ++p) PetscCall(DMSetLabelValue(*dm, "fault", faultPoints[p], 1)); in CreateSimplex_2D()
447 PetscCall(DMSetLabelValue(*dm, "material", 0, 1)); in CreateSimplex_2D()
448 PetscCall(DMSetLabelValue(*dm, "material", 1, 2)); in CreateSimplex_2D()
459 …PetscCall(DMPlexCreateFromDAG(*dm, 1, numPoints, coneSize, cones, coneOrientations, vertexCoords)); in CreateSimplex_2D()
460 …for (p = 0; p < 3; ++p) PetscCall(DMSetLabelValue(*dm, "marker", markerPoints[p * 2], markerPoints… in CreateSimplex_2D()
461 for (p = 0; p < 3; ++p) PetscCall(DMSetLabelValue(*dm, "fault", faultPoints[p], 1)); in CreateSimplex_2D()
462 PetscCall(DMSetLabelValue(*dm, "material", 0, 1)); in CreateSimplex_2D()
463 PetscCall(DMSetLabelValue(*dm, "material", 3, 1)); in CreateSimplex_2D()
464 PetscCall(DMSetLabelValue(*dm, "material", 1, 2)); in CreateSimplex_2D()
465 PetscCall(DMSetLabelValue(*dm, "material", 2, 2)); in CreateSimplex_2D()
480 …PetscCall(DMPlexCreateFromDAG(*dm, 1, numPoints, coneSize, cones, coneOrientations, vertexCoords)); in CreateSimplex_2D()
481 PetscCall(DMSetLabelValue(*dm, "material", 0, 1)); in CreateSimplex_2D()
482 PetscCall(DMSetLabelValue(*dm, "material", 1, 1)); in CreateSimplex_2D()
483 PetscCall(DMSetLabelValue(*dm, "material", 2, 1)); in CreateSimplex_2D()
484 PetscCall(DMSetLabelValue(*dm, "material", 3, 2)); in CreateSimplex_2D()
485 PetscCall(DMSetLabelValue(*dm, "material", 4, 2)); in CreateSimplex_2D()
486 PetscCall(DMSetLabelValue(*dm, "material", 5, 2)); in CreateSimplex_2D()
487 …for (p = 0; p < 8; ++p) PetscCall(DMSetLabelValue(*dm, "marker", markerPoints[p * 2], markerPoints… in CreateSimplex_2D()
489 for (p = 0; p < 2; ++p) PetscCall(DMSetLabelValue(*dm, "fault", faultPoints[p], 1)); in CreateSimplex_2D()
491 for (p = 0; p < 2; ++p) PetscCall(DMSetLabelValue(*dm, "pfault", faultPoints[p], 1)); in CreateSimplex_2D()
502 …PetscCall(DMPlexCreateFromDAG(*dm, 1, numPoints, coneSize, cones, coneOrientations, vertexCoords)); in CreateSimplex_2D()
503 for (p = 0; p < 2; ++p) PetscCall(DMSetLabelValue(*dm, "fault", faultPoints[p], 1)); in CreateSimplex_2D()
504 for (p = 0; p < 1; ++p) PetscCall(DMSetLabelValue(*dm, "faultBd", faultBdPoints[p], 1)); in CreateSimplex_2D()
505 PetscCall(DMSetLabelValue(*dm, "material", 0, 0)); in CreateSimplex_2D()
506 PetscCall(DMSetLabelValue(*dm, "material", 2, 0)); in CreateSimplex_2D()
507 PetscCall(DMSetLabelValue(*dm, "material", 4, 0)); in CreateSimplex_2D()
508 PetscCall(DMSetLabelValue(*dm, "material", 1, 2)); in CreateSimplex_2D()
509 PetscCall(DMSetLabelValue(*dm, "material", 3, 2)); in CreateSimplex_2D()
510 PetscCall(DMSetLabelValue(*dm, "material", 5, 2)); in CreateSimplex_2D()
518 PetscCall(DMPlexCreateFromDAG(*dm, 1, numPoints, NULL, NULL, NULL, NULL)); in CreateSimplex_2D()
519 if (testNum == 3 || testNum == 4) PetscCall(DMCreateLabel(*dm, "pfault")); in CreateSimplex_2D()
520 else PetscCall(DMCreateLabel(*dm, "fault")); in CreateSimplex_2D()
522 PetscCall(DMPlexInterpolate(*dm, &idm)); in CreateSimplex_2D()
524 PetscCall(DMDestroy(dm)); in CreateSimplex_2D()
525 *dm = idm; in CreateSimplex_2D()
529 static PetscErrorCode CreateSimplex_3D(MPI_Comm comm, AppCtx *user, DM dm) in CreateSimplex_3D() argument
547 …PetscCall(DMPlexCreateFromDAG(dm, depth, numPoints, coneSize, cones, coneOrientations, vertexCoord… in CreateSimplex_3D()
548 …for (p = 0; p < 10; ++p) PetscCall(DMSetLabelValue(dm, "marker", markerPoints[p * 2], markerPoints… in CreateSimplex_3D()
549 for (p = 0; p < 3; ++p) PetscCall(DMSetLabelValue(dm, "fault", faultPoints[p], 1)); in CreateSimplex_3D()
550 PetscCall(DMSetLabelValue(dm, "material", 0, 1)); in CreateSimplex_3D()
551 PetscCall(DMSetLabelValue(dm, "material", 1, 2)); in CreateSimplex_3D()
564 …PetscCall(DMPlexCreateFromDAG(dm, depth, numPoints, coneSize, cones, coneOrientations, vertexCoord… in CreateSimplex_3D()
565 …for (p = 0; p < 7; ++p) PetscCall(DMSetLabelValue(dm, "marker", markerPoints[p * 2], markerPoints[… in CreateSimplex_3D()
566 for (p = 0; p < 4; ++p) PetscCall(DMSetLabelValue(dm, "fault", faultPoints[p], 1)); in CreateSimplex_3D()
567 PetscCall(DMSetLabelValue(dm, "material", 0, 1)); in CreateSimplex_3D()
568 PetscCall(DMSetLabelValue(dm, "material", 1, 2)); in CreateSimplex_3D()
576 PetscCall(DMPlexCreateFromDAG(dm, depth, numPoints, NULL, NULL, NULL, NULL)); in CreateSimplex_3D()
577 PetscCall(DMCreateLabel(dm, "fault")); in CreateSimplex_3D()
582 static PetscErrorCode CreateQuad_2D(MPI_Comm comm, PetscInt testNum, DM *dm) in CreateQuad_2D() argument
603 …PetscCall(DMPlexCreateFromDAG(*dm, 1, numPoints, coneSize, cones, coneOrientations, vertexCoords)); in CreateQuad_2D()
604 …for (p = 0; p < 6; ++p) PetscCall(DMSetLabelValue(*dm, "marker", markerPoints[p * 2], markerPoints… in CreateQuad_2D()
606 for (p = 0; p < 2; ++p) PetscCall(DMSetLabelValue(*dm, "fault", faultPoints[p], 1)); in CreateQuad_2D()
608 for (p = 0; p < 2; ++p) PetscCall(DMSetLabelValue(*dm, "pfault", faultPoints[p], 1)); in CreateQuad_2D()
609 PetscCall(DMSetLabelValue(*dm, "material", 0, 1)); in CreateQuad_2D()
610 PetscCall(DMSetLabelValue(*dm, "material", 1, 2)); in CreateQuad_2D()
621 …PetscCall(DMPlexCreateFromDAG(*dm, 1, numPoints, coneSize, cones, coneOrientations, vertexCoords)); in CreateQuad_2D()
622 for (p = 0; p < 4; ++p) PetscCall(DMSetLabelValue(*dm, "fault", faultPoints[p], 1)); in CreateQuad_2D()
623 for (p = 3; p < 4; ++p) PetscCall(DMSetLabelValue(*dm, "faultBd", faultPoints[p], 1)); in CreateQuad_2D()
624 for (p = 0; p < 2; ++p) PetscCall(DMSetLabelValue(*dm, "fault2", fault2Points[p], 1)); in CreateQuad_2D()
625 PetscCall(DMSetLabelValue(*dm, "material", 0, 1)); in CreateQuad_2D()
626 PetscCall(DMSetLabelValue(*dm, "material", 1, 1)); in CreateQuad_2D()
627 PetscCall(DMSetLabelValue(*dm, "material", 2, 1)); in CreateQuad_2D()
628 PetscCall(DMSetLabelValue(*dm, "material", 3, 1)); in CreateQuad_2D()
629 PetscCall(DMSetLabelValue(*dm, "material", 4, 1)); in CreateQuad_2D()
630 PetscCall(DMSetLabelValue(*dm, "material", 5, 2)); in CreateQuad_2D()
631 PetscCall(DMSetLabelValue(*dm, "material", 6, 2)); in CreateQuad_2D()
632 PetscCall(DMSetLabelValue(*dm, "material", 7, 2)); in CreateQuad_2D()
633 PetscCall(DMSetLabelValue(*dm, "material", 8, 2)); in CreateQuad_2D()
641 PetscCall(DMPlexCreateFromDAG(*dm, 1, numPoints, NULL, NULL, NULL, NULL)); in CreateQuad_2D()
642 if (testNum == 2 || testNum == 3) PetscCall(DMCreateLabel(*dm, "pfault")); in CreateQuad_2D()
643 else PetscCall(DMCreateLabel(*dm, "fault")); in CreateQuad_2D()
645 PetscCall(DMPlexInterpolate(*dm, &idm)); in CreateQuad_2D()
647 PetscCall(DMDestroy(dm)); in CreateQuad_2D()
648 *dm = idm; in CreateQuad_2D()
652 static PetscErrorCode CreateHex_3D(MPI_Comm comm, PetscInt testNum, DM *dm) in CreateHex_3D() argument
671 …PetscCall(DMPlexCreateFromDAG(*dm, 1, numPoints, coneSize, cones, coneOrientations, vertexCoords)); in CreateHex_3D()
672 PetscCall(DMPlexInterpolate(*dm, &idm)); in CreateHex_3D()
675 PetscCall(DMSetLabelValue(*dm, "material", 0, 1)); in CreateHex_3D()
676 PetscCall(DMSetLabelValue(*dm, "material", 1, 2)); in CreateHex_3D()
697 …PetscCall(DMPlexCreateFromDAG(*dm, 1, numPoints, coneSize, cones, coneOrientations, vertexCoords)); in CreateHex_3D()
698 PetscCall(DMPlexInterpolate(*dm, &idm)); in CreateHex_3D()
700 PetscCall(DMSetLabelValue(*dm, "material", 0, 1)); in CreateHex_3D()
701 PetscCall(DMSetLabelValue(*dm, "material", 1, 1)); in CreateHex_3D()
702 PetscCall(DMSetLabelValue(*dm, "material", 2, 1)); in CreateHex_3D()
703 PetscCall(DMSetLabelValue(*dm, "material", 3, 2)); in CreateHex_3D()
704 PetscCall(DMSetLabelValue(*dm, "material", 4, 2)); in CreateHex_3D()
705 PetscCall(DMSetLabelValue(*dm, "material", 5, 2)); in CreateHex_3D()
706 PetscCall(DMSetLabelValue(*dm, "material", 6, 2)); in CreateHex_3D()
718 …PetscCall(DMPlexCreateFromDAG(*dm, 1, numPoints, coneSize, cones, coneOrientations, vertexCoords)); in CreateHex_3D()
719 PetscCall(DMPlexInterpolate(*dm, &idm)); in CreateHex_3D()
721 PetscCall(DMSetLabelValue(*dm, "material", 0, 1)); in CreateHex_3D()
722 PetscCall(DMSetLabelValue(*dm, "material", 1, 1)); in CreateHex_3D()
723 PetscCall(DMSetLabelValue(*dm, "material", 2, 2)); in CreateHex_3D()
724 PetscCall(DMSetLabelValue(*dm, "material", 3, 2)); in CreateHex_3D()
732 PetscCall(DMPlexCreateFromDAG(*dm, depth, numPoints, NULL, NULL, NULL, NULL)); in CreateHex_3D()
733 PetscCall(DMPlexInterpolate(*dm, &idm)); in CreateHex_3D()
737 PetscCall(DMDestroy(dm)); in CreateHex_3D()
738 *dm = idm; in CreateHex_3D()
742 static PetscErrorCode CreateFaultLabel(DM dm) in CreateFaultLabel() argument
748 PetscCall(DMGetDimension(dm, &dim)); in CreateFaultLabel()
749 PetscCall(DMCreateLabel(dm, "cohesive")); in CreateFaultLabel()
750 PetscCall(DMGetLabel(dm, "cohesive", &label)); in CreateFaultLabel()
752 PetscCall(DMPlexGetSimplexOrBoxCells(dm, h, NULL, &pMax)); in CreateFaultLabel()
753 PetscCall(DMPlexGetHeightStratum(dm, h, &pStart, &pEnd)); in CreateFaultLabel()
762 static PetscErrorCode CreateDiscretization(DM dm, AppCtx *user) in CreateDiscretization() argument
769 PetscCall(DMGetDimension(dm, &dim)); in CreateDiscretization()
770 PetscCall(DMGetLabel(dm, "cohesive", &fault)); in CreateDiscretization()
775 PetscCall(DMAddField(dm, NULL, (PetscObject)fe)); in CreateDiscretization()
781 PetscCall(DMAddField(dm, fault, (PetscObject)fe)); in CreateDiscretization()
791 PetscCall(DMAddField(dm, fault, (PetscObject)fe)); in CreateDiscretization()
795 PetscCall(DMCreateDS(dm)); in CreateDiscretization()
799 static PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *user, DM *dm) in CreateMesh() argument
809 PetscCall(DMCreate(comm, dm)); in CreateMesh()
810 PetscCall(DMSetType(*dm, DMPLEX)); in CreateMesh()
811 PetscCall(DMSetDimension(*dm, dim)); in CreateMesh()
815 PetscCall(CreateSimplex_2D(comm, user->testNum, dm)); in CreateMesh()
817 PetscCall(CreateQuad_2D(comm, user->testNum, dm)); in CreateMesh()
822 PetscCall(CreateSimplex_3D(comm, user, *dm)); in CreateMesh()
824 PetscCall(CreateHex_3D(comm, user->testNum, dm)); in CreateMesh()
830 PetscCall(PetscObjectSetOptionsPrefix((PetscObject)*dm, "orig_")); in CreateMesh()
831 PetscCall(DMPlexDistributeSetDefault(*dm, PETSC_FALSE)); in CreateMesh()
832 PetscCall(DMSetFromOptions(*dm)); in CreateMesh()
833 PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view")); in CreateMesh()
834 PetscCall(DMHasLabel(*dm, "fault", &hasFault)); in CreateMesh()
839 PetscCall(DMGetLabel(*dm, "fault", &faultLabel)); in CreateMesh()
840 PetscCall(DMGetLabel(*dm, "faultBd", &faultBdLabel)); in CreateMesh()
841 …PetscCall(DMPlexCreateHybridMesh(*dm, faultLabel, faultBdLabel, 1, &hybridLabel, &splitLabel, &dmI… in CreateMesh()
848 PetscCall(DMDestroy(dm)); in CreateMesh()
849 *dm = dmHybrid; in CreateMesh()
851 PetscCall(DMHasLabel(*dm, "fault2", &hasFault2)); in CreateMesh()
856 PetscCall(PetscObjectSetOptionsPrefix((PetscObject)*dm, "faulted_")); in CreateMesh()
857 PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view_pre")); in CreateMesh()
858 PetscCall(DMPlexDistributeSetDefault(*dm, PETSC_FALSE)); in CreateMesh()
859 PetscCall(DMSetFromOptions(*dm)); in CreateMesh()
860 PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view")); in CreateMesh()
861 PetscCall(DMGetLabel(*dm, "fault2", &faultLabel)); in CreateMesh()
862 PetscCall(DMGetLabel(*dm, "fault2Bd", &faultBdLabel)); in CreateMesh()
863 …PetscCall(DMPlexCreateHybridMesh(*dm, faultLabel, faultBdLabel, 1, &hybridLabel, NULL, NULL, &dmHy… in CreateMesh()
866 PetscCall(DMDestroy(dm)); in CreateMesh()
867 *dm = dmHybrid; in CreateMesh()
974 PetscCall(DMPlexGetPartitioner(*dm, &part)); in CreateMesh()
979 PetscCall(DMGetLabel(*dm, "material", &matLabel)); in CreateMesh()
980 if (matLabel) PetscCall(DMPlexLabelComplete(*dm, matLabel)); in CreateMesh()
985 PetscCall(DMPlexDistribute(*dm, 0, NULL, &pdm)); in CreateMesh()
988 PetscCall(DMDestroy(dm)); in CreateMesh()
989 *dm = pdm; in CreateMesh()
992 PetscCall(DMHasLabel(*dm, "pfault", &hasParallelFault)); in CreateMesh()
997 PetscCall(DMGetLabel(*dm, "pfault", &faultLabel)); in CreateMesh()
998 PetscCall(DMGetLabel(*dm, "pfaultBd", &faultBdLabel)); in CreateMesh()
999 …PetscCall(DMPlexCreateHybridMesh(*dm, faultLabel, faultBdLabel, 1, &hybridLabel, NULL, &dmInterfac… in CreateMesh()
1005 PetscCallMPI(MPI_Comm_rank(PetscObjectComm((PetscObject)*dm), &rank)); in CreateMesh()
1013 PetscCall(DMDestroy(dm)); in CreateMesh()
1014 *dm = dmHybrid; in CreateMesh()
1016 PetscCall(PetscObjectSetName((PetscObject)*dm, "Hybrid Mesh")); in CreateMesh()
1017 PetscCall(CreateFaultLabel(*dm)); in CreateMesh()
1018 PetscCall(CreateDiscretization(*dm, user)); in CreateMesh()
1019 PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view_pre")); in CreateMesh()
1020 PetscCall(DMPlexDistributeSetDefault(*dm, PETSC_FALSE)); in CreateMesh()
1021 PetscCall(DMSetFromOptions(*dm)); in CreateMesh()
1022 PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view")); in CreateMesh()
1026 static PetscErrorCode TestMesh(DM dm, AppCtx *user) in TestMesh() argument
1029 PetscCall(DMPlexCheckSymmetry(dm)); in TestMesh()
1030 PetscCall(DMPlexCheckSkeleton(dm, 0)); in TestMesh()
1031 PetscCall(DMPlexCheckFaces(dm, 0)); in TestMesh()
1035 static PetscErrorCode TestDiscretization(DM dm, AppCtx *user) in TestDiscretization() argument
1040 PetscCall(DMGetLocalSection(dm, &s)); in TestDiscretization()
1127 static PetscErrorCode TestAssembly(DM dm, AppCtx *user) in TestAssembly() argument
1144 PetscCallMPI(MPI_Comm_rank(PetscObjectComm((PetscObject)dm), &rank)); in TestAssembly()
1145 PetscCall(DMGetDimension(dm, &dim)); in TestAssembly()
1146 PetscCall(DMPlexGetSimplexOrBoxCells(dm, 0, NULL, &cMax)); in TestAssembly()
1147 PetscCall(DMPlexGetHeightStratum(dm, 0, NULL, &cEnd)); in TestAssembly()
1149 PetscCall(DMGetLabel(dm, "cohesive", &fault)); in TestAssembly()
1150 PetscCall(DMGetLocalVector(dm, &locX)); in TestAssembly()
1152 PetscCall(DMGetLocalVector(dm, &locF)); in TestAssembly()
1154 PetscCall(DMCreateMatrix(dm, &J)); in TestAssembly()
1158 PetscCall(DMGetLabel(dm, "material", &material)); in TestAssembly()
1162 …PetscCall(DMProjectFunctionLabelLocal(dm, 0.0, material, 1, &id, PETSC_DETERMINE, NULL, initialGue… in TestAssembly()
1166 …PetscCall(DMProjectFunctionLabelLocal(dm, 0.0, material, 1, &id, PETSC_DETERMINE, NULL, initialGue… in TestAssembly()
1170 …PetscCall(DMProjectFunctionLabelLocal(dm, 0.0, fault, 1, &id, PETSC_DETERMINE, NULL, initialGuess,… in TestAssembly()
1174 PetscCall(DMPlexCreateCohesiveSubmesh(dm, PETSC_FALSE, NULL, 0, &dmFault)); in TestAssembly()
1203 PetscCall(DMGetCellDS(dm, cMax, &probh, NULL)); in TestAssembly()
1229 …PetscCall(DMPlexComputeResidualHybridByKey(dm, keys, cohesiveCells, 0.0, locX, NULL, 0.0, locF, us… in TestAssembly()
1232 …PetscCall(DMPlexComputeJacobianHybridByKey(dm, keys, cohesiveCells, 0.0, 0.0, locX, NULL, J, J, us… in TestAssembly()
1237 PetscCall(DMRestoreLocalVector(dm, &locX)); in TestAssembly()
1238 PetscCall(DMRestoreLocalVector(dm, &locF)); in TestAssembly()
1250 PetscCall(DMPlexGetCone(dm, cMax, &cone)); in TestAssembly()
1251 PetscCall(DMGetCellDS(dm, cMax, &ds, NULL)); in TestAssembly()
1263 DM dm; in main() local
1269 PetscCall(CreateMesh(PETSC_COMM_WORLD, &user, &dm)); in main()
1270 PetscCall(TestMesh(dm, &user)); in main()
1271 PetscCall(TestDiscretization(dm, &user)); in main()
1272 PetscCall(TestAssembly(dm, &user)); in main()
1273 PetscCall(DMDestroy(&dm)); in main()