102918637SMatthew G. Knepley static char help[] = "Mesh Orientation Tutorial\n\n"; 202918637SMatthew G. Knepley 302918637SMatthew G. Knepley #include <petscdmplex.h> 402918637SMatthew G. Knepley #include <petscdmplextransform.h> 502918637SMatthew G. Knepley 602918637SMatthew G. Knepley typedef struct { 702918637SMatthew G. Knepley PetscBool genArr; /* Generate all possible cell arrangements */ 802918637SMatthew G. Knepley PetscBool refArr; /* Refine all possible cell arrangements */ 902918637SMatthew G. Knepley PetscBool printTable; /* Print the CAyley table */ 1002918637SMatthew G. Knepley PetscInt orntBounds[2]; /* Bounds for the orientation check */ 1102918637SMatthew G. Knepley PetscInt numOrnt; /* Number of specific orientations specified, or -1 for all orientations */ 1202918637SMatthew G. Knepley PetscInt ornts[48]; /* Specific orientations if specified */ 1302918637SMatthew G. Knepley PetscInt initOrnt; /* Initial orientation for starting mesh */ 1402918637SMatthew G. Knepley } AppCtx; 1502918637SMatthew G. Knepley 1602918637SMatthew G. Knepley static PetscErrorCode ProcessOptions(MPI_Comm comm, AppCtx *options) 1702918637SMatthew G. Knepley { 1802918637SMatthew G. Knepley PetscInt n = 2; 1902918637SMatthew G. Knepley PetscBool flg; 2002918637SMatthew G. Knepley 2102918637SMatthew G. Knepley PetscFunctionBeginUser; 2202918637SMatthew G. Knepley options->genArr = PETSC_FALSE; 2302918637SMatthew G. Knepley options->refArr = PETSC_FALSE; 2402918637SMatthew G. Knepley options->printTable = PETSC_FALSE; 2502918637SMatthew G. Knepley options->orntBounds[0] = PETSC_MIN_INT; 2602918637SMatthew G. Knepley options->orntBounds[1] = PETSC_MAX_INT; 2702918637SMatthew G. Knepley options->numOrnt = -1; 2802918637SMatthew G. Knepley options->initOrnt = 0; 2902918637SMatthew G. Knepley 30d0609cedSBarry Smith PetscOptionsBegin(comm, "", "Mesh Orientation Tutorials Options", "DMPLEX"); 319566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-gen_arrangements", "Flag for generating all arrangements of the cell", "ex11.c", options->genArr, &options->genArr, NULL)); 329566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-ref_arrangements", "Flag for refining all arrangements of the cell", "ex11.c", options->refArr, &options->refArr, NULL)); 339566063dSJacob Faibussowitsch PetscCall(PetscOptionsBool("-print_table", "Print the Cayley table", "ex11.c", options->printTable, &options->printTable, NULL)); 349566063dSJacob Faibussowitsch PetscCall(PetscOptionsIntArray("-ornt_bounds", "Bounds for orientation checks", "ex11.c", options->orntBounds, &n, NULL)); 3502918637SMatthew G. Knepley n = 48; 369566063dSJacob Faibussowitsch PetscCall(PetscOptionsIntArray("-ornts", "Specific orientations for checks", "ex11.c", options->ornts, &n, &flg)); 3702918637SMatthew G. Knepley if (flg) { 3802918637SMatthew G. Knepley options->numOrnt = n; 399566063dSJacob Faibussowitsch PetscCall(PetscSortInt(n, options->ornts)); 4002918637SMatthew G. Knepley } 419566063dSJacob Faibussowitsch PetscCall(PetscOptionsInt("-init_ornt", "Initial orientation for starting mesh", "ex11.c", options->initOrnt, &options->initOrnt, NULL)); 42d0609cedSBarry Smith PetscOptionsEnd(); 4302918637SMatthew G. Knepley PetscFunctionReturn(0); 4402918637SMatthew G. Knepley } 4502918637SMatthew G. Knepley 4602918637SMatthew G. Knepley static PetscBool ignoreOrnt(AppCtx *user, PetscInt o) 4702918637SMatthew G. Knepley { 4802918637SMatthew G. Knepley PetscInt loc; 4902918637SMatthew G. Knepley PetscErrorCode ierr; 5002918637SMatthew G. Knepley 5102918637SMatthew G. Knepley if (user->numOrnt < 0) return PETSC_FALSE; 5202918637SMatthew G. Knepley ierr = PetscFindInt(o, user->numOrnt, user->ornts, &loc); 5302918637SMatthew G. Knepley if (loc < 0 || ierr) return PETSC_TRUE; 5402918637SMatthew G. Knepley return PETSC_FALSE; 5502918637SMatthew G. Knepley } 5602918637SMatthew G. Knepley 5702918637SMatthew G. Knepley static PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *user, DM *dm) 5802918637SMatthew G. Knepley { 5902918637SMatthew G. Knepley PetscFunctionBeginUser; 609566063dSJacob Faibussowitsch PetscCall(DMCreate(comm, dm)); 619566063dSJacob Faibussowitsch PetscCall(DMSetType(*dm, DMPLEX)); 629566063dSJacob Faibussowitsch PetscCall(DMSetFromOptions(*dm)); 639566063dSJacob Faibussowitsch PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view")); 6402918637SMatthew G. Knepley PetscFunctionReturn(0); 6502918637SMatthew G. Knepley } 6602918637SMatthew G. Knepley 6702918637SMatthew G. Knepley static PetscErrorCode CheckCellVertices(DM dm, PetscInt cell, PetscInt o) 6802918637SMatthew G. Knepley { 6902918637SMatthew G. Knepley DMPolytopeType ct; 7002918637SMatthew G. Knepley const PetscInt *arrVerts; 7102918637SMatthew G. Knepley PetscInt *closure = NULL; 7202918637SMatthew G. Knepley PetscInt Ncl, cl, Nv, vStart, vEnd, v; 7302918637SMatthew G. Knepley MPI_Comm comm; 7402918637SMatthew G. Knepley 7502918637SMatthew G. Knepley PetscFunctionBeginUser; 769566063dSJacob Faibussowitsch PetscCall(PetscObjectGetComm((PetscObject) dm, &comm)); 779566063dSJacob Faibussowitsch PetscCall(DMPlexGetCellType(dm, cell, &ct)); 789566063dSJacob Faibussowitsch PetscCall(DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd)); 799566063dSJacob Faibussowitsch PetscCall(DMPlexGetTransitiveClosure(dm, cell, PETSC_TRUE, &Ncl, &closure)); 8002918637SMatthew G. Knepley for (cl = 0, Nv = 0; cl < Ncl*2; cl += 2) { 8102918637SMatthew G. Knepley const PetscInt vertex = closure[cl]; 8202918637SMatthew G. Knepley 8302918637SMatthew G. Knepley if (vertex < vStart || vertex >= vEnd) continue; 8402918637SMatthew G. Knepley closure[Nv++] = vertex; 8502918637SMatthew G. Knepley } 8663a3b9bcSJacob Faibussowitsch PetscCheck(Nv == DMPolytopeTypeGetNumVertices(ct),comm, PETSC_ERR_ARG_WRONG, "Cell %" PetscInt_FMT " has %" PetscInt_FMT " vertices != %" PetscInt_FMT " vertices in a %s", cell, Nv, DMPolytopeTypeGetNumVertices(ct), DMPolytopeTypes[ct]); 8702918637SMatthew G. Knepley arrVerts = DMPolytopeTypeGetVertexArrangment(ct, o); 8802918637SMatthew G. Knepley for (v = 0; v < Nv; ++v) { 8963a3b9bcSJacob Faibussowitsch PetscCheck(closure[v] == arrVerts[v]+vStart,comm, PETSC_ERR_ARG_WRONG, "Cell %" PetscInt_FMT " vertex[%" PetscInt_FMT "]: %" PetscInt_FMT " should be %" PetscInt_FMT " for arrangement %" PetscInt_FMT, cell, v, closure[v], arrVerts[v]+vStart, o); 9002918637SMatthew G. Knepley } 919566063dSJacob Faibussowitsch PetscCall(DMPlexRestoreTransitiveClosure(dm, cell, PETSC_TRUE, &Ncl, &closure)); 9202918637SMatthew G. Knepley PetscFunctionReturn(0); 9302918637SMatthew G. Knepley } 9402918637SMatthew G. Knepley 9502918637SMatthew G. Knepley /* Transform cell with group operation o */ 9602918637SMatthew G. Knepley static PetscErrorCode ReorientCell(DM dm, PetscInt cell, PetscInt o, PetscBool swapCoords) 9702918637SMatthew G. Knepley { 9802918637SMatthew G. Knepley DM cdm; 9902918637SMatthew G. Knepley Vec coordinates; 10002918637SMatthew G. Knepley PetscScalar *coords, *ccoords = NULL; 10102918637SMatthew G. Knepley PetscInt *closure = NULL; 10202918637SMatthew G. Knepley PetscInt cdim, d, Nc, Ncl, cl, vStart, vEnd, Nv; 10302918637SMatthew G. Knepley 10402918637SMatthew G. Knepley PetscFunctionBegin; 10502918637SMatthew G. Knepley /* Change vertex coordinates so that it plots as we expect */ 1069566063dSJacob Faibussowitsch PetscCall(DMGetCoordinateDM(dm, &cdm)); 1079566063dSJacob Faibussowitsch PetscCall(DMGetCoordinateDim(dm, &cdim)); 1089566063dSJacob Faibussowitsch PetscCall(DMGetCoordinatesLocal(dm, &coordinates)); 1099566063dSJacob Faibussowitsch PetscCall(DMPlexVecGetClosure(cdm, NULL, coordinates, cell, &Nc, &ccoords)); 11002918637SMatthew G. Knepley /* Reorient cone */ 1119566063dSJacob Faibussowitsch PetscCall(DMPlexOrientPoint(dm, cell, o)); 11202918637SMatthew G. Knepley /* Finish resetting coordinates */ 11302918637SMatthew G. Knepley if (swapCoords) { 1149566063dSJacob Faibussowitsch PetscCall(DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd)); 1159566063dSJacob Faibussowitsch PetscCall(VecGetArrayWrite(coordinates, &coords)); 1169566063dSJacob Faibussowitsch PetscCall(DMPlexGetTransitiveClosure(dm, cell, PETSC_TRUE, &Ncl, &closure)); 11702918637SMatthew G. Knepley for (cl = 0, Nv = 0; cl < Ncl*2; cl += 2) { 11802918637SMatthew G. Knepley const PetscInt vertex = closure[cl]; 11902918637SMatthew G. Knepley PetscScalar *vcoords; 12002918637SMatthew G. Knepley 12102918637SMatthew G. Knepley if (vertex < vStart || vertex >= vEnd) continue; 1229566063dSJacob Faibussowitsch PetscCall(DMPlexPointLocalRef(cdm, vertex, coords, &vcoords)); 12302918637SMatthew G. Knepley for (d = 0; d < cdim; ++d) vcoords[d] = ccoords[Nv*cdim + d]; 12402918637SMatthew G. Knepley ++Nv; 12502918637SMatthew G. Knepley } 1269566063dSJacob Faibussowitsch PetscCall(DMPlexRestoreTransitiveClosure(dm, cell, PETSC_TRUE, &Ncl, &closure)); 1279566063dSJacob Faibussowitsch PetscCall(VecRestoreArrayWrite(coordinates, &coords)); 12802918637SMatthew G. Knepley } 1299566063dSJacob Faibussowitsch PetscCall(DMPlexVecRestoreClosure(cdm, NULL, coordinates, cell, &Nc, &ccoords)); 13002918637SMatthew G. Knepley PetscFunctionReturn(0); 13102918637SMatthew G. Knepley } 13202918637SMatthew G. Knepley 13302918637SMatthew G. Knepley static PetscErrorCode GenerateArrangments(DM dm, AppCtx *user) 13402918637SMatthew G. Knepley { 13502918637SMatthew G. Knepley DM odm; 13602918637SMatthew G. Knepley DMPolytopeType ct; 13702918637SMatthew G. Knepley PetscInt No, o; 13802918637SMatthew G. Knepley const char *name; 13902918637SMatthew G. Knepley 14002918637SMatthew G. Knepley PetscFunctionBeginUser; 14102918637SMatthew G. Knepley if (!user->genArr) PetscFunctionReturn(0); 1429566063dSJacob Faibussowitsch PetscCall(PetscObjectGetName((PetscObject) dm, &name)); 1439566063dSJacob Faibussowitsch PetscCall(DMPlexGetCellType(dm, 0, &ct)); 14402918637SMatthew G. Knepley No = DMPolytopeTypeGetNumArrangments(ct)/2; 14502918637SMatthew G. Knepley for (o = PetscMax(-No, user->orntBounds[0]); o < PetscMin(No, user->orntBounds[1]); ++o) { 14602918637SMatthew G. Knepley if (ignoreOrnt(user, o)) continue; 1479566063dSJacob Faibussowitsch PetscCall(CreateMesh(PetscObjectComm((PetscObject) dm), user, &odm)); 1489566063dSJacob Faibussowitsch PetscCall(ReorientCell(odm, 0, o, PETSC_TRUE)); 14963a3b9bcSJacob Faibussowitsch PetscCall(PetscPrintf(PetscObjectComm((PetscObject) dm), "%s orientation %" PetscInt_FMT "\n", name, o)); 1509566063dSJacob Faibussowitsch PetscCall(DMViewFromOptions(odm, NULL, "-gen_dm_view")); 1519566063dSJacob Faibussowitsch PetscCall(CheckCellVertices(odm, 0, o)); 1529566063dSJacob Faibussowitsch PetscCall(DMDestroy(&odm)); 15302918637SMatthew G. Knepley } 15402918637SMatthew G. Knepley PetscFunctionReturn(0); 15502918637SMatthew G. Knepley } 15602918637SMatthew G. Knepley 15702918637SMatthew G. Knepley static PetscErrorCode VerifyCayleyTable(DM dm, AppCtx *user) 15802918637SMatthew G. Knepley { 15902918637SMatthew G. Knepley DM dm1, dm2; 16002918637SMatthew G. Knepley DMPolytopeType ct; 16102918637SMatthew G. Knepley const PetscInt *refcone, *cone; 16202918637SMatthew G. Knepley PetscInt No, o1, o2, o3, o4; 16302918637SMatthew G. Knepley PetscBool equal; 16402918637SMatthew G. Knepley const char *name; 16502918637SMatthew G. Knepley 16602918637SMatthew G. Knepley PetscFunctionBeginUser; 16702918637SMatthew G. Knepley if (!user->genArr) PetscFunctionReturn(0); 1689566063dSJacob Faibussowitsch PetscCall(PetscObjectGetName((PetscObject) dm, &name)); 1699566063dSJacob Faibussowitsch PetscCall(DMPlexGetCellType(dm, 0, &ct)); 1709566063dSJacob Faibussowitsch PetscCall(DMPlexGetCone(dm, 0, &refcone)); 17102918637SMatthew G. Knepley No = DMPolytopeTypeGetNumArrangments(ct)/2; 1729566063dSJacob Faibussowitsch if (user->printTable) PetscCall(PetscPrintf(PETSC_COMM_SELF, "Cayley Table for %s\n", DMPolytopeTypes[ct])); 17302918637SMatthew G. Knepley for (o1 = PetscMax(-No, user->orntBounds[0]); o1 < PetscMin(No, user->orntBounds[1]); ++o1) { 17402918637SMatthew G. Knepley for (o2 = PetscMax(-No, user->orntBounds[0]); o2 < PetscMin(No, user->orntBounds[1]); ++o2) { 1759566063dSJacob Faibussowitsch PetscCall(CreateMesh(PetscObjectComm((PetscObject) dm), user, &dm1)); 1769566063dSJacob Faibussowitsch PetscCall(DMPlexOrientPoint(dm1, 0, o2)); 1779566063dSJacob Faibussowitsch PetscCall(DMPlexCheckFaces(dm1, 0)); 1789566063dSJacob Faibussowitsch PetscCall(DMPlexOrientPoint(dm1, 0, o1)); 1799566063dSJacob Faibussowitsch PetscCall(DMPlexCheckFaces(dm1, 0)); 1805f80ce2aSJacob Faibussowitsch o3 = DMPolytopeTypeComposeOrientation(ct, o1, o2); 18102918637SMatthew G. Knepley /* First verification */ 1829566063dSJacob Faibussowitsch PetscCall(CreateMesh(PetscObjectComm((PetscObject) dm), user, &dm2)); 1839566063dSJacob Faibussowitsch PetscCall(DMPlexOrientPoint(dm2, 0, o3)); 1849566063dSJacob Faibussowitsch PetscCall(DMPlexCheckFaces(dm2, 0)); 1859566063dSJacob Faibussowitsch PetscCall(DMPlexEqual(dm1, dm2, &equal)); 18602918637SMatthew G. Knepley if (!equal) { 1879566063dSJacob Faibussowitsch PetscCall(DMViewFromOptions(dm1, NULL, "-error_dm_view")); 1889566063dSJacob Faibussowitsch PetscCall(DMViewFromOptions(dm2, NULL, "-error_dm_view")); 18963a3b9bcSJacob Faibussowitsch SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Cayley table error for %s: %" PetscInt_FMT " * %" PetscInt_FMT " != %" PetscInt_FMT, DMPolytopeTypes[ct], o1, o2, o3); 19002918637SMatthew G. Knepley } 19102918637SMatthew G. Knepley /* Second verification */ 1929566063dSJacob Faibussowitsch PetscCall(DMPlexGetCone(dm1, 0, &cone)); 1939566063dSJacob Faibussowitsch PetscCall(DMPolytopeGetOrientation(ct, refcone, cone, &o4)); 19463a3b9bcSJacob Faibussowitsch if (user->printTable) PetscCall(PetscPrintf(PETSC_COMM_SELF, "%" PetscInt_FMT ", ", o4)); 19563a3b9bcSJacob Faibussowitsch PetscCheck(o3 == o4,PETSC_COMM_SELF, PETSC_ERR_PLIB, "Cayley table error for %s: %" PetscInt_FMT " * %" PetscInt_FMT " = %" PetscInt_FMT " != %" PetscInt_FMT, DMPolytopeTypes[ct], o1, o2, o3, o4); 1969566063dSJacob Faibussowitsch PetscCall(DMDestroy(&dm1)); 1979566063dSJacob Faibussowitsch PetscCall(DMDestroy(&dm2)); 19802918637SMatthew G. Knepley } 1999566063dSJacob Faibussowitsch if (user->printTable) PetscCall(PetscPrintf(PETSC_COMM_SELF, "\n")); 20002918637SMatthew G. Knepley } 20102918637SMatthew G. Knepley PetscFunctionReturn(0); 20202918637SMatthew G. Knepley } 20302918637SMatthew G. Knepley 20402918637SMatthew G. Knepley static PetscErrorCode VerifyInverse(DM dm, AppCtx *user) 20502918637SMatthew G. Knepley { 20602918637SMatthew G. Knepley DM dm1, dm2; 20702918637SMatthew G. Knepley DMPolytopeType ct; 20802918637SMatthew G. Knepley const PetscInt *refcone, *cone; 20902918637SMatthew G. Knepley PetscInt No, o, oi, o2; 21002918637SMatthew G. Knepley PetscBool equal; 21102918637SMatthew G. Knepley const char *name; 21202918637SMatthew G. Knepley 21302918637SMatthew G. Knepley PetscFunctionBeginUser; 21402918637SMatthew G. Knepley if (!user->genArr) PetscFunctionReturn(0); 2159566063dSJacob Faibussowitsch PetscCall(PetscObjectGetName((PetscObject) dm, &name)); 2169566063dSJacob Faibussowitsch PetscCall(DMPlexGetCellType(dm, 0, &ct)); 2179566063dSJacob Faibussowitsch PetscCall(DMPlexGetCone(dm, 0, &refcone)); 21802918637SMatthew G. Knepley No = DMPolytopeTypeGetNumArrangments(ct)/2; 2199566063dSJacob Faibussowitsch if (user->printTable) PetscCall(PetscPrintf(PETSC_COMM_SELF, "Inverse table for %s\n", DMPolytopeTypes[ct])); 22002918637SMatthew G. Knepley for (o = PetscMax(-No, user->orntBounds[0]); o < PetscMin(No, user->orntBounds[1]); ++o) { 22102918637SMatthew G. Knepley if (ignoreOrnt(user, o)) continue; 2225f80ce2aSJacob Faibussowitsch oi = DMPolytopeTypeComposeOrientationInv(ct, 0, o); 2239566063dSJacob Faibussowitsch PetscCall(CreateMesh(PetscObjectComm((PetscObject) dm), user, &dm1)); 2249566063dSJacob Faibussowitsch PetscCall(DMPlexOrientPoint(dm1, 0, o)); 2259566063dSJacob Faibussowitsch PetscCall(DMPlexCheckFaces(dm1, 0)); 2269566063dSJacob Faibussowitsch PetscCall(DMPlexOrientPoint(dm1, 0, oi)); 2279566063dSJacob Faibussowitsch PetscCall(DMPlexCheckFaces(dm1, 0)); 22802918637SMatthew G. Knepley /* First verification */ 2299566063dSJacob Faibussowitsch PetscCall(CreateMesh(PetscObjectComm((PetscObject) dm), user, &dm2)); 2309566063dSJacob Faibussowitsch PetscCall(DMPlexEqual(dm1, dm2, &equal)); 23102918637SMatthew G. Knepley if (!equal) { 2329566063dSJacob Faibussowitsch PetscCall(DMViewFromOptions(dm1, NULL, "-error_dm_view")); 2339566063dSJacob Faibussowitsch PetscCall(DMViewFromOptions(dm2, NULL, "-error_dm_view")); 23463a3b9bcSJacob Faibussowitsch SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Inverse error for %s: %" PetscInt_FMT " * %" PetscInt_FMT " != 0", DMPolytopeTypes[ct], o, oi); 23502918637SMatthew G. Knepley } 23602918637SMatthew G. Knepley /* Second verification */ 2379566063dSJacob Faibussowitsch PetscCall(DMPlexGetCone(dm1, 0, &cone)); 2389566063dSJacob Faibussowitsch PetscCall(DMPolytopeGetOrientation(ct, refcone, cone, &o2)); 23963a3b9bcSJacob Faibussowitsch if (user->printTable) PetscCall(PetscPrintf(PETSC_COMM_SELF, "%" PetscInt_FMT ", ", oi)); 24063a3b9bcSJacob Faibussowitsch PetscCheck(o2 == 0,PETSC_COMM_SELF, PETSC_ERR_PLIB, "Inverse error for %s: %" PetscInt_FMT " * %" PetscInt_FMT " = %" PetscInt_FMT " != 0", DMPolytopeTypes[ct], o, oi, o2); 2419566063dSJacob Faibussowitsch PetscCall(DMDestroy(&dm1)); 2429566063dSJacob Faibussowitsch PetscCall(DMDestroy(&dm2)); 24302918637SMatthew G. Knepley } 2449566063dSJacob Faibussowitsch if (user->printTable) PetscCall(PetscPrintf(PETSC_COMM_SELF, "\n")); 24502918637SMatthew G. Knepley PetscFunctionReturn(0); 24602918637SMatthew G. Knepley } 24702918637SMatthew G. Knepley 24802918637SMatthew G. Knepley /* Suppose that point p has the same arrangement as o from canonical, compare the subcells to canonical subcells */ 24902918637SMatthew G. Knepley static PetscErrorCode CheckSubcells(DM dm, DM odm, PetscInt p, PetscInt o, AppCtx *user) 25002918637SMatthew G. Knepley { 25102918637SMatthew G. Knepley DMPlexTransform tr, otr; 25202918637SMatthew G. Knepley DMPolytopeType ct; 25302918637SMatthew G. Knepley DMPolytopeType *rct; 25402918637SMatthew G. Knepley const PetscInt *cone, *ornt, *ocone, *oornt; 25502918637SMatthew G. Knepley PetscInt *rsize, *rcone, *rornt; 25602918637SMatthew G. Knepley PetscInt Nct, n, oi, debug = 0; 25702918637SMatthew G. Knepley 25802918637SMatthew G. Knepley PetscFunctionBeginUser; 2599566063dSJacob Faibussowitsch PetscCall(DMPlexTransformCreate(PetscObjectComm((PetscObject) dm), &tr)); 2609566063dSJacob Faibussowitsch PetscCall(DMPlexTransformSetDM(tr, dm)); 2619566063dSJacob Faibussowitsch PetscCall(DMPlexTransformSetFromOptions(tr)); 2629566063dSJacob Faibussowitsch PetscCall(DMPlexTransformSetUp(tr)); 26302918637SMatthew G. Knepley 2649566063dSJacob Faibussowitsch PetscCall(DMPlexTransformCreate(PetscObjectComm((PetscObject) odm), &otr)); 2659566063dSJacob Faibussowitsch PetscCall(DMPlexTransformSetDM(otr, odm)); 2669566063dSJacob Faibussowitsch PetscCall(DMPlexTransformSetFromOptions(otr)); 2679566063dSJacob Faibussowitsch PetscCall(DMPlexTransformSetUp(otr)); 26802918637SMatthew G. Knepley 2699566063dSJacob Faibussowitsch PetscCall(DMPlexGetCellType(dm, p, &ct)); 2709566063dSJacob Faibussowitsch PetscCall(DMPlexGetCone(dm, p, &cone)); 2719566063dSJacob Faibussowitsch PetscCall(DMPlexGetConeOrientation(dm, p, &ornt)); 2729566063dSJacob Faibussowitsch PetscCall(DMPlexGetCone(odm, p, &ocone)); 2739566063dSJacob Faibussowitsch PetscCall(DMPlexGetConeOrientation(odm, p, &oornt)); 2745f80ce2aSJacob Faibussowitsch oi = DMPolytopeTypeComposeOrientationInv(ct, 0, o); 27563a3b9bcSJacob Faibussowitsch if (user->printTable) PetscCall(PetscPrintf(PETSC_COMM_SELF, "Orientation %" PetscInt_FMT "\n", oi)); 27602918637SMatthew G. Knepley 2779566063dSJacob Faibussowitsch PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); 27802918637SMatthew G. Knepley for (n = 0; n < Nct; ++n) { 27902918637SMatthew G. Knepley DMPolytopeType ctNew = rct[n]; 28002918637SMatthew G. Knepley PetscInt r, ro; 28102918637SMatthew G. Knepley 2829566063dSJacob Faibussowitsch if (debug) PetscCall(PetscPrintf(PETSC_COMM_SELF, " Checking type %s\n", DMPolytopeTypes[ctNew])); 28302918637SMatthew G. Knepley for (r = 0; r < rsize[n]; ++r) { 28402918637SMatthew G. Knepley const PetscInt *qcone, *qornt, *oqcone, *oqornt; 28502918637SMatthew G. Knepley PetscInt pNew, opNew, oo, pr, fo; 28602918637SMatthew G. Knepley PetscBool restore = PETSC_TRUE; 28702918637SMatthew G. Knepley 2889566063dSJacob Faibussowitsch PetscCall(DMPlexTransformGetTargetPoint(tr, ct, ctNew, p, r, &pNew)); 2899566063dSJacob Faibussowitsch PetscCall(DMPlexTransformGetCone(tr, pNew, &qcone, &qornt)); 29002918637SMatthew G. Knepley if (debug) { 29102918637SMatthew G. Knepley PetscInt c; 29202918637SMatthew G. Knepley 29363a3b9bcSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_SELF, " Checking replica %" PetscInt_FMT " (%" PetscInt_FMT ")\n Original Cone", r, pNew)); 29463a3b9bcSJacob Faibussowitsch for (c = 0; c < DMPolytopeTypeGetConeSize(ctNew); ++c) PetscCall(PetscPrintf(PETSC_COMM_SELF, " %" PetscInt_FMT " (%" PetscInt_FMT ")", qcone[c], qornt[c])); 2959566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_SELF, "\n")); 29602918637SMatthew G. Knepley } 29702918637SMatthew G. Knepley for (ro = 0; ro < rsize[n]; ++ro) { 29802918637SMatthew G. Knepley PetscBool found; 29902918637SMatthew G. Knepley 3009566063dSJacob Faibussowitsch PetscCall(DMPlexTransformGetTargetPoint(otr, ct, ctNew, p, ro, &opNew)); 3019566063dSJacob Faibussowitsch PetscCall(DMPlexTransformGetConeOriented(otr, opNew, o, &oqcone, &oqornt)); 3029566063dSJacob Faibussowitsch PetscCall(DMPolytopeMatchOrientation(ctNew, oqcone, qcone, &oo, &found)); 30302918637SMatthew G. Knepley if (found) break; 3049566063dSJacob Faibussowitsch PetscCall(DMPlexTransformRestoreCone(otr, pNew, &oqcone, &oqornt)); 30502918637SMatthew G. Knepley } 30602918637SMatthew G. Knepley if (debug) { 30702918637SMatthew G. Knepley PetscInt c; 30802918637SMatthew G. Knepley 30963a3b9bcSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_SELF, " Checking transform replica %" PetscInt_FMT " (%" PetscInt_FMT ") (%" PetscInt_FMT ")\n Transform Cone", ro, opNew, o)); 31063a3b9bcSJacob Faibussowitsch for (c = 0; c < DMPolytopeTypeGetConeSize(ctNew); ++c) PetscCall(PetscPrintf(PETSC_COMM_SELF, " %" PetscInt_FMT " (%" PetscInt_FMT ")", oqcone[c], oqornt[c])); 3119566063dSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_SELF, "\n")); 31263a3b9bcSJacob Faibussowitsch PetscCall(PetscPrintf(PETSC_COMM_SELF, " Matched %" PetscInt_FMT "\n", oo)); 31302918637SMatthew G. Knepley } 31402918637SMatthew G. Knepley if (ro == rsize[n]) { 31502918637SMatthew G. Knepley /* The tetrahedron has 3 pairs of opposing edges, and any pair can be connected by the interior segment */ 31602918637SMatthew G. Knepley if (ct == DM_POLYTOPE_TETRAHEDRON) { 31702918637SMatthew G. Knepley /* The segment in a tetrahedron does not map into itself under the group action */ 31802918637SMatthew G. Knepley if (ctNew == DM_POLYTOPE_SEGMENT) {restore = PETSC_FALSE; ro = r; oo = 0;} 31902918637SMatthew G. Knepley /* The last four interior faces do not map into themselves under the group action */ 32002918637SMatthew G. Knepley if (r > 3 && ctNew == DM_POLYTOPE_TRIANGLE) {restore = PETSC_FALSE; ro = r; oo = 0;} 32102918637SMatthew G. Knepley /* The last four interior faces do not map into themselves under the group action */ 32202918637SMatthew G. Knepley if (r > 3 && ctNew == DM_POLYTOPE_TETRAHEDRON) {restore = PETSC_FALSE; ro = r; oo = 0;} 32302918637SMatthew G. Knepley } 32463a3b9bcSJacob Faibussowitsch PetscCheck(!restore,PETSC_COMM_SELF, PETSC_ERR_PLIB, "Unable to find matching %s %" PetscInt_FMT " orientation for cell orientation %" PetscInt_FMT, DMPolytopeTypes[ctNew], r, o); 32502918637SMatthew G. Knepley } 32663a3b9bcSJacob Faibussowitsch if (user->printTable) PetscCall(PetscPrintf(PETSC_COMM_SELF, "%" PetscInt_FMT ", %" PetscInt_FMT ", ", ro, oo)); 3279566063dSJacob Faibussowitsch PetscCall(DMPlexTransformGetSubcellOrientation(tr, ct, p, oi, ctNew, r, 0, &pr, &fo)); 32802918637SMatthew G. Knepley if (!user->printTable) { 32963a3b9bcSJacob Faibussowitsch PetscCheck(pr == ro,PETSC_COMM_SELF, PETSC_ERR_PLIB, "Choose wrong replica %" PetscInt_FMT " != %" PetscInt_FMT, pr, ro); 33063a3b9bcSJacob Faibussowitsch PetscCheck(fo == oo,PETSC_COMM_SELF, PETSC_ERR_PLIB, "Choose wrong orientation %" PetscInt_FMT " != %" PetscInt_FMT, fo, oo); 33102918637SMatthew G. Knepley } 3329566063dSJacob Faibussowitsch PetscCall(DMPlexTransformRestoreCone(tr, pNew, &qcone, &qornt)); 3339566063dSJacob Faibussowitsch if (restore) PetscCall(DMPlexTransformRestoreCone(otr, pNew, &oqcone, &oqornt)); 33402918637SMatthew G. Knepley } 3359566063dSJacob Faibussowitsch if (user->printTable) PetscCall(PetscPrintf(PETSC_COMM_SELF, "\n")); 33602918637SMatthew G. Knepley } 3379566063dSJacob Faibussowitsch PetscCall(DMPlexTransformDestroy(&tr)); 3389566063dSJacob Faibussowitsch PetscCall(DMPlexTransformDestroy(&otr)); 33902918637SMatthew G. Knepley PetscFunctionReturn(0); 34002918637SMatthew G. Knepley } 34102918637SMatthew G. Knepley 34202918637SMatthew G. Knepley static PetscErrorCode RefineArrangments(DM dm, AppCtx *user) 34302918637SMatthew G. Knepley { 34402918637SMatthew G. Knepley DM odm, rdm; 34502918637SMatthew G. Knepley DMPolytopeType ct; 34602918637SMatthew G. Knepley PetscInt No, o; 34702918637SMatthew G. Knepley const char *name; 34802918637SMatthew G. Knepley 34902918637SMatthew G. Knepley PetscFunctionBeginUser; 35002918637SMatthew G. Knepley if (!user->refArr) PetscFunctionReturn(0); 3519566063dSJacob Faibussowitsch PetscCall(PetscObjectGetName((PetscObject) dm, &name)); 3529566063dSJacob Faibussowitsch PetscCall(DMPlexGetCellType(dm, 0, &ct)); 35302918637SMatthew G. Knepley No = DMPolytopeTypeGetNumArrangments(ct)/2; 35402918637SMatthew G. Knepley for (o = PetscMax(-No, user->orntBounds[0]); o < PetscMin(No, user->orntBounds[1]); ++o) { 35502918637SMatthew G. Knepley if (ignoreOrnt(user, o)) continue; 3569566063dSJacob Faibussowitsch PetscCall(CreateMesh(PetscObjectComm((PetscObject) dm), user, &odm)); 3579566063dSJacob Faibussowitsch if (user->initOrnt) PetscCall(ReorientCell(odm, 0, user->initOrnt, PETSC_FALSE)); 3589566063dSJacob Faibussowitsch PetscCall(ReorientCell(odm, 0, o, PETSC_TRUE)); 3599566063dSJacob Faibussowitsch PetscCall(DMViewFromOptions(odm, NULL, "-orig_dm_view")); 3609566063dSJacob Faibussowitsch PetscCall(DMRefine(odm, MPI_COMM_NULL, &rdm)); 3619566063dSJacob Faibussowitsch PetscCall(DMSetFromOptions(rdm)); 36263a3b9bcSJacob Faibussowitsch PetscCall(PetscPrintf(PetscObjectComm((PetscObject) dm), "%s orientation %" PetscInt_FMT "\n", name, o)); 3639566063dSJacob Faibussowitsch PetscCall(DMViewFromOptions(rdm, NULL, "-ref_dm_view")); 3649566063dSJacob Faibussowitsch PetscCall(CheckSubcells(dm, odm, 0, o, user)); 3659566063dSJacob Faibussowitsch PetscCall(DMDestroy(&odm)); 3669566063dSJacob Faibussowitsch PetscCall(DMDestroy(&rdm)); 36702918637SMatthew G. Knepley } 36802918637SMatthew G. Knepley PetscFunctionReturn(0); 36902918637SMatthew G. Knepley } 37002918637SMatthew G. Knepley 37102918637SMatthew G. Knepley int main(int argc, char **argv) 37202918637SMatthew G. Knepley { 37302918637SMatthew G. Knepley DM dm; 37402918637SMatthew G. Knepley AppCtx user; 37502918637SMatthew G. Knepley 376*327415f7SBarry Smith PetscFunctionBeginUser; 3779566063dSJacob Faibussowitsch PetscCall(PetscInitialize(&argc, &argv, NULL, help)); 3789566063dSJacob Faibussowitsch PetscCall(ProcessOptions(PETSC_COMM_WORLD, &user)); 3799566063dSJacob Faibussowitsch PetscCall(CreateMesh(PETSC_COMM_WORLD, &user, &dm)); 38002918637SMatthew G. Knepley if (user.initOrnt) { 3819566063dSJacob Faibussowitsch PetscCall(ReorientCell(dm, 0, user.initOrnt, PETSC_FALSE)); 3829566063dSJacob Faibussowitsch PetscCall(DMViewFromOptions(dm, NULL, "-ornt_dm_view")); 38302918637SMatthew G. Knepley } 3849566063dSJacob Faibussowitsch PetscCall(GenerateArrangments(dm, &user)); 3859566063dSJacob Faibussowitsch PetscCall(VerifyCayleyTable(dm, &user)); 3869566063dSJacob Faibussowitsch PetscCall(VerifyInverse(dm, &user)); 3879566063dSJacob Faibussowitsch PetscCall(RefineArrangments(dm, &user)); 3889566063dSJacob Faibussowitsch PetscCall(DMDestroy(&dm)); 3899566063dSJacob Faibussowitsch PetscCall(PetscFinalize()); 390b122ec5aSJacob Faibussowitsch return 0; 39102918637SMatthew G. Knepley } 39202918637SMatthew G. Knepley 39302918637SMatthew G. Knepley /*TEST 39402918637SMatthew G. Knepley 395a01d01faSMatthew G. Knepley testset: 396a01d01faSMatthew G. Knepley args: -dm_coord_space 0 -dm_plex_reference_cell_domain -gen_arrangements \ 397a01d01faSMatthew G. Knepley -gen_dm_view ::ascii_latex -dm_plex_view_tikzscale 0.5 398a01d01faSMatthew G. Knepley 39902918637SMatthew G. Knepley test: 40002918637SMatthew G. Knepley suffix: segment 401a01d01faSMatthew G. Knepley args: -dm_plex_cell segment \ 402a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0 -dm_plex_view_colors_depth 1,0 40302918637SMatthew G. Knepley 40402918637SMatthew G. Knepley test: 40502918637SMatthew G. Knepley suffix: triangle 406a01d01faSMatthew G. Knepley args: -dm_plex_cell triangle \ 407a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 40802918637SMatthew G. Knepley 40902918637SMatthew G. Knepley test: 41002918637SMatthew G. Knepley suffix: quadrilateral 411a01d01faSMatthew G. Knepley args: -dm_plex_cell quadrilateral \ 412a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 41302918637SMatthew G. Knepley 41402918637SMatthew G. Knepley test: 41502918637SMatthew G. Knepley suffix: tensor_segment 416a01d01faSMatthew G. Knepley args: -dm_plex_cell tensor_quad \ 417a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 41802918637SMatthew G. Knepley 41902918637SMatthew G. Knepley test: 42002918637SMatthew G. Knepley suffix: tetrahedron 421a01d01faSMatthew G. Knepley args: -dm_plex_cell tetrahedron \ 422a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 42302918637SMatthew G. Knepley 42402918637SMatthew G. Knepley test: 42502918637SMatthew G. Knepley suffix: hexahedron 426a01d01faSMatthew G. Knepley args: -dm_plex_cell hexahedron \ 427a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 -dm_plex_view_tikzscale 0.3 42802918637SMatthew G. Knepley 42902918637SMatthew G. Knepley test: 43002918637SMatthew G. Knepley suffix: triangular_prism 431a01d01faSMatthew G. Knepley args: -dm_plex_cell triangular_prism \ 432a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 43302918637SMatthew G. Knepley 43402918637SMatthew G. Knepley test: 43502918637SMatthew G. Knepley suffix: tensor_triangular_prism 436a01d01faSMatthew G. Knepley args: -dm_plex_cell tensor_triangular_prism \ 437a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 43802918637SMatthew G. Knepley 43902918637SMatthew G. Knepley test: 44002918637SMatthew G. Knepley suffix: tensor_quadrilateral_prism 441a01d01faSMatthew G. Knepley args: -dm_plex_cell tensor_quadrilateral_prism \ 442a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 44302918637SMatthew G. Knepley 44402918637SMatthew G. Knepley test: 44502918637SMatthew G. Knepley suffix: pyramid 446a01d01faSMatthew G. Knepley args: -dm_plex_cell pyramid \ 447a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 448a01d01faSMatthew G. Knepley 449a01d01faSMatthew G. Knepley testset: 450a01d01faSMatthew G. Knepley args: -dm_coord_space 0 -dm_plex_reference_cell_domain -ref_arrangements -dm_plex_check_all \ 451a01d01faSMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_tikzscale 1.0 45202918637SMatthew G. Knepley 45302918637SMatthew G. Knepley test: 45402918637SMatthew G. Knepley suffix: ref_segment 455a01d01faSMatthew G. Knepley args: -dm_plex_cell segment \ 456a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0 -dm_plex_view_colors_depth 1,0 45702918637SMatthew G. Knepley 45802918637SMatthew G. Knepley test: 45902918637SMatthew G. Knepley suffix: ref_triangle 460a01d01faSMatthew G. Knepley args: -dm_plex_cell triangle \ 461a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 46202918637SMatthew G. Knepley 46302918637SMatthew G. Knepley test: 46402918637SMatthew G. Knepley suffix: ref_quadrilateral 465a01d01faSMatthew G. Knepley args: -dm_plex_cell quadrilateral \ 466a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 46702918637SMatthew G. Knepley 46802918637SMatthew G. Knepley test: 46902918637SMatthew G. Knepley suffix: ref_tensor_segment 470a01d01faSMatthew G. Knepley args: -dm_plex_cell tensor_quad \ 471a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 47202918637SMatthew G. Knepley 47302918637SMatthew G. Knepley test: 47402918637SMatthew G. Knepley suffix: ref_tetrahedron 475a01d01faSMatthew G. Knepley args: -dm_plex_cell tetrahedron \ 476a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 47702918637SMatthew G. Knepley 47802918637SMatthew G. Knepley test: 47902918637SMatthew G. Knepley suffix: ref_hexahedron 480a01d01faSMatthew G. Knepley args: -dm_plex_cell hexahedron \ 481a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 48202918637SMatthew G. Knepley 48302918637SMatthew G. Knepley test: 48402918637SMatthew G. Knepley suffix: ref_triangular_prism 485a01d01faSMatthew G. Knepley args: -dm_plex_cell triangular_prism \ 486a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 48702918637SMatthew G. Knepley 48802918637SMatthew G. Knepley test: 48902918637SMatthew G. Knepley suffix: ref_tensor_triangular_prism 490a01d01faSMatthew G. Knepley args: -dm_plex_cell tensor_triangular_prism \ 491a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 49202918637SMatthew G. Knepley 49302918637SMatthew G. Knepley test: 49402918637SMatthew G. Knepley suffix: ref_tensor_quadrilateral_prism 495a01d01faSMatthew G. Knepley args: -dm_plex_cell tensor_quadrilateral_prism \ 496a01d01faSMatthew G. Knepley -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 49702918637SMatthew G. Knepley 49802918637SMatthew G. Knepley # ToBox should recreate the coordinate space since the cell shape changes 49902918637SMatthew G. Knepley testset: 50002918637SMatthew G. Knepley args: -dm_coord_space 0 -dm_plex_transform_type refine_tobox -ref_arrangements -dm_plex_check_all 50102918637SMatthew G. Knepley 50202918637SMatthew G. Knepley test: 50302918637SMatthew G. Knepley suffix: tobox_triangle 50402918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangle \ 50502918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 50602918637SMatthew G. Knepley 50702918637SMatthew G. Knepley test: 50802918637SMatthew G. Knepley suffix: tobox_tensor_segment 50902918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell tensor_quad \ 51002918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 51102918637SMatthew G. Knepley 51202918637SMatthew G. Knepley test: 51302918637SMatthew G. Knepley suffix: tobox_tetrahedron 51402918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell tetrahedron \ 51502918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 -dm_plex_view_tikzscale 1.0 51602918637SMatthew G. Knepley 51702918637SMatthew G. Knepley test: 51802918637SMatthew G. Knepley suffix: tobox_triangular_prism 51902918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangular_prism \ 52002918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 -dm_plex_view_tikzscale 1.0 52102918637SMatthew G. Knepley 52202918637SMatthew G. Knepley test: 52302918637SMatthew G. Knepley suffix: tobox_tensor_triangular_prism 52402918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell tensor_triangular_prism \ 52502918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 -dm_plex_view_tikzscale 1.0 52602918637SMatthew G. Knepley 52702918637SMatthew G. Knepley test: 52802918637SMatthew G. Knepley suffix: tobox_tensor_quadrilateral_prism 52902918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell tensor_quadrilateral_prism \ 53002918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 -dm_plex_view_tikzscale 1.0 53102918637SMatthew G. Knepley 53202918637SMatthew G. Knepley testset: 53302918637SMatthew G. Knepley args: -dm_coord_space 0 -dm_plex_transform_type refine_alfeld -ref_arrangements -dm_plex_check_all 53402918637SMatthew G. Knepley 53502918637SMatthew G. Knepley test: 53602918637SMatthew G. Knepley suffix: alfeld_triangle 53702918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangle \ 53802918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 53902918637SMatthew G. Knepley 54002918637SMatthew G. Knepley test: 54102918637SMatthew G. Knepley suffix: alfeld_tetrahedron 54202918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell tetrahedron \ 54302918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 -dm_plex_view_tikzscale 1.0 54402918637SMatthew G. Knepley 54502918637SMatthew G. Knepley testset: 54602918637SMatthew G. Knepley args: -dm_plex_transform_type refine_sbr -ref_arrangements -dm_plex_check_all 54702918637SMatthew G. Knepley 54802918637SMatthew G. Knepley # This splits edge 1 of the triangle, and reflects about the added edge 54902918637SMatthew G. Knepley test: 55002918637SMatthew G. Knepley suffix: sbr_triangle_0 55102918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangle -dm_plex_transform_sbr_ref_cell 5 -ornts -2,0 \ 55202918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 55302918637SMatthew G. Knepley 55402918637SMatthew G. Knepley # This splits edge 0 of the triangle, and reflects about the added edge 55502918637SMatthew G. Knepley test: 55602918637SMatthew G. Knepley suffix: sbr_triangle_1 55702918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangle -dm_plex_transform_sbr_ref_cell 5 -init_ornt 1 -ornts -3,0 \ 55802918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 55902918637SMatthew G. Knepley 56002918637SMatthew G. Knepley # This splits edge 2 of the triangle, and reflects about the added edge 56102918637SMatthew G. Knepley test: 56202918637SMatthew G. Knepley suffix: sbr_triangle_2 56302918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangle -dm_plex_transform_sbr_ref_cell 5 -init_ornt 2 -ornts -1,0 \ 56402918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 56502918637SMatthew G. Knepley 56602918637SMatthew G. Knepley # This splits edges 1 and 2 of the triangle 56702918637SMatthew G. Knepley test: 56802918637SMatthew G. Knepley suffix: sbr_triangle_3 56902918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangle -dm_plex_transform_sbr_ref_cell 5,6 -ornts 0 \ 57002918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 57102918637SMatthew G. Knepley 57202918637SMatthew G. Knepley # This splits edges 1 and 0 of the triangle 57302918637SMatthew G. Knepley test: 57402918637SMatthew G. Knepley suffix: sbr_triangle_4 57502918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangle -dm_plex_transform_sbr_ref_cell 4,5 -ornts 0 \ 57602918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 57702918637SMatthew G. Knepley 57802918637SMatthew G. Knepley # This splits edges 0 and 1 of the triangle 57902918637SMatthew G. Knepley test: 58002918637SMatthew G. Knepley suffix: sbr_triangle_5 58102918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangle -dm_plex_transform_sbr_ref_cell 5,6 -init_ornt 1 -ornts 0 \ 58202918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 58302918637SMatthew G. Knepley 58402918637SMatthew G. Knepley # This splits edges 0 and 2 of the triangle 58502918637SMatthew G. Knepley test: 58602918637SMatthew G. Knepley suffix: sbr_triangle_6 58702918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangle -dm_plex_transform_sbr_ref_cell 4,5 -init_ornt 1 -ornts 0 \ 58802918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 58902918637SMatthew G. Knepley 59002918637SMatthew G. Knepley # This splits edges 2 and 0 of the triangle 59102918637SMatthew G. Knepley test: 59202918637SMatthew G. Knepley suffix: sbr_triangle_7 59302918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangle -dm_plex_transform_sbr_ref_cell 5,6 -init_ornt 2 -ornts 0 \ 59402918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 59502918637SMatthew G. Knepley 59602918637SMatthew G. Knepley # This splits edges 2 and 1 of the triangle 59702918637SMatthew G. Knepley test: 59802918637SMatthew G. Knepley suffix: sbr_triangle_8 59902918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell triangle -dm_plex_transform_sbr_ref_cell 4,5 -init_ornt 2 -ornts 0 \ 60002918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 60102918637SMatthew G. Knepley 60202918637SMatthew G. Knepley testset: 60302918637SMatthew G. Knepley args: -dm_plex_transform_type refine_boundary_layer -dm_plex_transform_bl_splits 2 -ref_arrangements -dm_plex_check_all 60402918637SMatthew G. Knepley 60502918637SMatthew G. Knepley test: 60602918637SMatthew G. Knepley suffix: bl_tensor_segment 60702918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell tensor_quad \ 60802918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,1,0 -dm_plex_view_colors_depth 1,1,0 -dm_plex_view_tikzscale 1.0 60902918637SMatthew G. Knepley 61002918637SMatthew G. Knepley # The subcell check is broken because at orientation 3, the internal triangles do not get properly permuted for the check 61102918637SMatthew G. Knepley test: 61202918637SMatthew G. Knepley suffix: bl_tensor_triangular_prism 61302918637SMatthew G. Knepley requires: TODO 61402918637SMatthew G. Knepley args: -dm_plex_reference_cell_domain -dm_plex_cell tensor_triangular_prism \ 61502918637SMatthew G. Knepley -ref_dm_view ::ascii_latex -dm_plex_view_numbers_depth 1,0,0,0 -dm_plex_view_colors_depth 1,0,0,0 -dm_plex_view_tikzscale 1.0 61602918637SMatthew G. Knepley 61702918637SMatthew G. Knepley TEST*/ 618