Lines Matching refs:tr
160 PetscErrorCode DMPlexTransformCreate(MPI_Comm comm, DMPlexTransform *tr) in DMPlexTransformCreate() argument
165 PetscAssertPointer(tr, 2); in DMPlexTransformCreate()
166 *tr = NULL; in DMPlexTransformCreate()
172 *tr = t; in DMPlexTransformCreate()
192 PetscErrorCode DMPlexTransformSetType(DMPlexTransform tr, DMPlexTransformType method) in DMPlexTransformSetType() argument
198 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformSetType()
199 PetscCall(PetscObjectTypeCompare((PetscObject)tr, method, &match)); in DMPlexTransformSetType()
204 …PetscCheck(r, PetscObjectComm((PetscObject)tr), PETSC_ERR_ARG_UNKNOWN_TYPE, "Unknown DMPlexTransfo… in DMPlexTransformSetType()
206 PetscTryTypeMethod(tr, destroy); in DMPlexTransformSetType()
207 PetscCall(PetscMemzero(tr->ops, sizeof(*tr->ops))); in DMPlexTransformSetType()
208 PetscCall(PetscObjectChangeTypeName((PetscObject)tr, method)); in DMPlexTransformSetType()
209 PetscCall((*r)(tr)); in DMPlexTransformSetType()
228 PetscErrorCode DMPlexTransformGetType(DMPlexTransform tr, DMPlexTransformType *type) in DMPlexTransformGetType() argument
231 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetType()
234 *type = ((PetscObject)tr)->type_name; in DMPlexTransformGetType()
238 static PetscErrorCode DMPlexTransformView_Ascii(DMPlexTransform tr, PetscViewer v) in DMPlexTransformView_Ascii() argument
250 if (tr->trType) PetscCall(DMLabelView(tr->trType, v)); in DMPlexTransformView_Ascii()
254 …for (f = 0; f <= cols; ++f) PetscCall(PetscViewerASCIIPrintf(v, " %14" PetscInt_FMT, tr->ctStart[f… in DMPlexTransformView_Ascii()
259 …for (f = 0; f <= cols; ++f) PetscCall(PetscViewerASCIIPrintf(v, " %14" PetscInt_FMT, tr->ctStartNe… in DMPlexTransformView_Ascii()
262 if (tr->trType) { in DMPlexTransformView_Ascii()
263 PetscCall(DMLabelGetNumValues(tr->trType, &Nrt)); in DMPlexTransformView_Ascii()
264 PetscCall(DMLabelGetValueIS(tr->trType, &trIS)); in DMPlexTransformView_Ascii()
273 …for (g = 0; g < cols; ++g) PetscCall(PetscViewerASCIIPrintf(v, " %14" PetscInt_FMT, tr->offset[f *… in DMPlexTransformView_Ascii()
276 if (tr->trType) { in DMPlexTransformView_Ascii()
297 PetscErrorCode DMPlexTransformView(DMPlexTransform tr, PetscViewer v) in DMPlexTransformView() argument
302 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformView()
303 if (!v) PetscCall(PetscViewerASCIIGetStdout(PetscObjectComm((PetscObject)tr), &v)); in DMPlexTransformView()
305 PetscCheckSameComm(tr, 1, v, 2); in DMPlexTransformView()
307 PetscCall(PetscObjectPrintClassNamePrefixType((PetscObject)tr, v)); in DMPlexTransformView()
309 if (isascii) PetscCall(DMPlexTransformView_Ascii(tr, v)); in DMPlexTransformView()
310 PetscTryTypeMethod(tr, view, v); in DMPlexTransformView()
333 PetscErrorCode DMPlexTransformSetFromOptions(DMPlexTransform tr) in DMPlexTransformSetFromOptions() argument
340 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformSetFromOptions()
341 PetscObjectOptionsBegin((PetscObject)tr); in DMPlexTransformSetFromOptions()
343 if (flg) PetscCall(DMPlexTransformSetType(tr, typeName)); in DMPlexTransformSetFromOptions()
344 else if (!((PetscObject)tr)->type_name) PetscCall(DMPlexTransformSetType(tr, defName)); in DMPlexTransformSetFromOptions()
345 …rata", "Only label points of the same stratum as the producing point", "", tr->labelMatchStrata, &… in DMPlexTransformSetFromOptions()
346 if (flg) PetscCall(DMPlexTransformSetMatchStrata(tr, match)); in DMPlexTransformSetFromOptions()
347 …or the label value to be multiplied by the replica number", "", tr->labelReplicaInc, &tr->labelRep… in DMPlexTransformSetFromOptions()
355 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformSetFromOptions()
369 PetscCall(DMPlexTransformSetActive(tr, newlabel)); in DMPlexTransformSetFromOptions()
372 PetscCall(DMPlexTransformSetActive(tr, label)); in DMPlexTransformSetFromOptions()
375 PetscTryTypeMethod(tr, setfromoptions, PetscOptionsObject); in DMPlexTransformSetFromOptions()
377 PetscCall(PetscObjectProcessOptionsHandlers((PetscObject)tr, PetscOptionsObject)); in DMPlexTransformSetFromOptions()
394 PetscErrorCode DMPlexTransformDestroy(DMPlexTransform *tr) in DMPlexTransformDestroy() argument
399 if (!*tr) PetscFunctionReturn(PETSC_SUCCESS); in DMPlexTransformDestroy()
400 PetscValidHeaderSpecific(*tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformDestroy()
401 if (--((PetscObject)*tr)->refct > 0) { in DMPlexTransformDestroy()
402 *tr = NULL; in DMPlexTransformDestroy()
406 PetscTryTypeMethod(*tr, destroy); in DMPlexTransformDestroy()
407 PetscCall(DMDestroy(&(*tr)->dm)); in DMPlexTransformDestroy()
408 PetscCall(DMLabelDestroy(&(*tr)->active)); in DMPlexTransformDestroy()
409 PetscCall(DMLabelDestroy(&(*tr)->trType)); in DMPlexTransformDestroy()
410 PetscCall(PetscFree2((*tr)->ctOrderOld, (*tr)->ctOrderInvOld)); in DMPlexTransformDestroy()
411 PetscCall(PetscFree2((*tr)->ctOrderNew, (*tr)->ctOrderInvNew)); in DMPlexTransformDestroy()
412 PetscCall(PetscFree2((*tr)->ctStart, (*tr)->ctStartNew)); in DMPlexTransformDestroy()
413 PetscCall(PetscFree((*tr)->offset)); in DMPlexTransformDestroy()
414 PetscCall(PetscFree2((*tr)->depthStart, (*tr)->depthEnd)); in DMPlexTransformDestroy()
416 PetscCall(PetscFEDestroy(&(*tr)->coordFE[c])); in DMPlexTransformDestroy()
417 PetscCall(PetscFEGeomDestroy(&(*tr)->refGeom[c])); in DMPlexTransformDestroy()
419 if ((*tr)->trVerts) { in DMPlexTransformDestroy()
425 …PetscCall(DMPlexTransformCellTransform(*tr, (DMPolytopeType)c, 0, NULL, &Nct, &rct, &rsize, &rcone… in DMPlexTransformDestroy()
428 for (r = 0; r < rsize[n]; ++r) PetscCall(PetscFree((*tr)->trSubVerts[c][rct[n]][r])); in DMPlexTransformDestroy()
429 PetscCall(PetscFree((*tr)->trSubVerts[c][rct[n]])); in DMPlexTransformDestroy()
432 PetscCall(PetscFree((*tr)->trSubVerts[c])); in DMPlexTransformDestroy()
433 PetscCall(PetscFree((*tr)->trVerts[c])); in DMPlexTransformDestroy()
436 PetscCall(PetscFree3((*tr)->trNv, (*tr)->trVerts, (*tr)->trSubVerts)); in DMPlexTransformDestroy()
437 PetscCall(PetscFree2((*tr)->coordFE, (*tr)->refGeom)); in DMPlexTransformDestroy()
439 PetscCall(PetscHeaderDestroy(tr)); in DMPlexTransformDestroy()
443 static PetscErrorCode DMPlexTransformCreateOffset_Internal(DMPlexTransform tr, PetscInt ctOrderOld[… in DMPlexTransformCreateOffset_Internal() argument
445 DMLabel trType = tr->trType; in DMPlexTransformCreateOffset_Internal()
455 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformCreateOffset_Internal()
499 … PetscCall(DMPlexTransformCellTransform(tr, sct, q, &qrt, &Nct, &rct, &rsize, &cone, &ornt)); in DMPlexTransformCreateOffset_Internal()
539 …PetscCall(DMPlexTransformCellTransform(tr, ict, PETSC_DETERMINE, NULL, &Nct, &rct, &rsize, &cone, … in DMPlexTransformCreateOffset_Internal()
566 PetscErrorCode DMPlexTransformSetUp(DMPlexTransform tr) in DMPlexTransformSetUp() argument
573 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformSetUp()
574 if (tr->setupcalled) PetscFunctionReturn(PETSC_SUCCESS); in DMPlexTransformSetUp()
575 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformSetUp()
576 PetscCall(PetscLogEventBegin(DMPLEXTRANSFORM_SetUp, tr, dm, 0, 0)); in DMPlexTransformSetUp()
577 PetscTryTypeMethod(tr, setup); in DMPlexTransformSetUp()
608 …lexCreateCellTypeOrder_Internal(dm, DMPolytopeTypeGetDim(ctCell), &tr->ctOrderOld, &tr->ctOrderInv… in DMPlexTransformSetUp()
617 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &cone, &ornt)); in DMPlexTransformSetUp()
620 PetscCall(DMPlexCreateCellTypeOrder_Internal(NULL, celldim, &tr->ctOrderNew, &tr->ctOrderInvNew)); in DMPlexTransformSetUp()
622 if (!tr->ctStart) { in DMPlexTransformSetUp()
636 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &cone, &ornt)); in DMPlexTransformSetUp()
640 const PetscInt cto = tr->ctOrderOld[c]; in DMPlexTransformSetUp()
641 const PetscInt cton = tr->ctOrderOld[c + 1]; in DMPlexTransformSetUp()
642 const PetscInt ctn = tr->ctOrderNew[c]; in DMPlexTransformSetUp()
643 const PetscInt ctnn = tr->ctOrderNew[c + 1]; in DMPlexTransformSetUp()
649 tr->ctStart = ctS; in DMPlexTransformSetUp()
650 tr->ctStartNew = ctSN; in DMPlexTransformSetUp()
652 PetscCall(DMPlexTransformCreateOffset_Internal(tr, tr->ctOrderOld, tr->ctStart, &tr->offset)); in DMPlexTransformSetUp()
654 tr->depth = -1; in DMPlexTransformSetUp()
656 …f (tr->ctStartNew[tr->ctOrderNew[c + 1]] > tr->ctStartNew[tr->ctOrderNew[c]]) tr->depth = PetscMax… in DMPlexTransformSetUp()
657 PetscCall(PetscMalloc2(tr->depth + 1, &tr->depthStart, tr->depth + 1, &tr->depthEnd)); in DMPlexTransformSetUp()
658 for (PetscInt d = 0; d <= tr->depth; ++d) { in DMPlexTransformSetUp()
659 tr->depthStart[d] = PETSC_INT_MAX; in DMPlexTransformSetUp()
660 tr->depthEnd[d] = -1; in DMPlexTransformSetUp()
663 const PetscInt dep = DMPolytopeTypeGetDim((DMPolytopeType)tr->ctOrderNew[c]); in DMPlexTransformSetUp()
665 if (tr->ctStartNew[tr->ctOrderNew[c + 1]] <= tr->ctStartNew[tr->ctOrderNew[c]]) continue; in DMPlexTransformSetUp()
666 tr->depthStart[dep] = PetscMin(tr->depthStart[dep], tr->ctStartNew[tr->ctOrderNew[c]]); in DMPlexTransformSetUp()
667 tr->depthEnd[dep] = PetscMax(tr->depthEnd[dep], tr->ctStartNew[tr->ctOrderNew[c + 1]]); in DMPlexTransformSetUp()
669 tr->setupcalled = PETSC_TRUE; in DMPlexTransformSetUp()
670 PetscCall(PetscLogEventEnd(DMPLEXTRANSFORM_SetUp, tr, dm, 0, 0)); in DMPlexTransformSetUp()
687 PetscErrorCode DMPlexTransformGetDM(DMPlexTransform tr, DM *dm) in DMPlexTransformGetDM() argument
690 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetDM()
692 *dm = tr->dm; in DMPlexTransformGetDM()
710 PetscErrorCode DMPlexTransformSetDM(DMPlexTransform tr, DM dm) in DMPlexTransformSetDM() argument
713 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformSetDM()
716 PetscCall(DMDestroy(&tr->dm)); in DMPlexTransformSetDM()
717 tr->dm = dm; in DMPlexTransformSetDM()
734 PetscErrorCode DMPlexTransformGetActive(DMPlexTransform tr, DMLabel *active) in DMPlexTransformGetActive() argument
737 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetActive()
739 *active = tr->active; in DMPlexTransformGetActive()
757 PetscErrorCode DMPlexTransformSetActive(DMPlexTransform tr, DMLabel active) in DMPlexTransformSetActive() argument
760 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformSetActive()
763 PetscCall(DMLabelDestroy(&tr->active)); in DMPlexTransformSetActive()
764 tr->active = active; in DMPlexTransformSetActive()
781 PetscErrorCode DMPlexTransformGetTransformTypes(DMPlexTransform tr, DMLabel *trType) in DMPlexTransformGetTransformTypes() argument
784 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetTransformTypes()
786 *trType = tr->trType; in DMPlexTransformGetTransformTypes()
801 PetscErrorCode DMPlexTransformSetTransformTypes(DMPlexTransform tr, DMLabel trType) in DMPlexTransformSetTransformTypes() argument
804 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformSetTransformTypes()
807 PetscCall(DMLabelDestroy(&tr->trType)); in DMPlexTransformSetTransformTypes()
808 tr->trType = trType; in DMPlexTransformSetTransformTypes()
812 static PetscErrorCode DMPlexTransformGetCoordinateFE(DMPlexTransform tr, DMPolytopeType ct, PetscFE… in DMPlexTransformGetCoordinateFE() argument
815 if (!tr->coordFE[ct]) { in DMPlexTransformGetCoordinateFE()
819 PetscCall(DMGetCoordinateDim(tr->dm, &cdim)); in DMPlexTransformGetCoordinateFE()
820 …PetscCall(PetscFECreateLagrangeByCell(PETSC_COMM_SELF, dim, cdim, ct, 1, PETSC_DETERMINE, &tr->coo… in DMPlexTransformGetCoordinateFE()
830 PetscCall(DMPlexTransformGetCellVertices(tr, ct, &Nq, &Xq)); in DMPlexTransformGetCoordinateFE()
837 PetscCall(PetscFESetQuadrature(tr->coordFE[ct], quad)); in DMPlexTransformGetCoordinateFE()
839 PetscCall(PetscFEGetDualSpace(tr->coordFE[ct], &dsp)); in DMPlexTransformGetCoordinateFE()
841 PetscCall(PetscFEGeomCreate(quad, 1, cdim, PETSC_FEGEOM_BASIC, &tr->refGeom[ct])); in DMPlexTransformGetCoordinateFE()
842 cg = tr->refGeom[ct]; in DMPlexTransformGetCoordinateFE()
847 *fe = tr->coordFE[ct]; in DMPlexTransformGetCoordinateFE()
851 PetscErrorCode DMPlexTransformSetDimensions_Internal(DMPlexTransform tr, DM dm, DM tdm) in DMPlexTransformSetDimensions_Internal() argument
877 PetscErrorCode DMPlexTransformSetDimensions(DMPlexTransform tr, DM dm, DM trdm) in DMPlexTransformSetDimensions() argument
880 PetscUseTypeMethod(tr, setdimensions, dm, trdm); in DMPlexTransformSetDimensions()
884 PetscErrorCode DMPlexTransformGetChart(DMPlexTransform tr, PetscInt *pStart, PetscInt *pEnd) in DMPlexTransformGetChart() argument
888 if (pEnd) *pEnd = tr->ctStartNew[tr->ctOrderNew[DM_NUM_POLYTOPES]]; in DMPlexTransformGetChart()
892 PetscErrorCode DMPlexTransformGetCellType(DMPlexTransform tr, PetscInt cell, DMPolytopeType *cellty… in DMPlexTransformGetCellType() argument
897 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetCellType()
901 …PetscInt ctSN = tr->ctStartNew[ctNew], ctEN = tr->ctStartNew[tr->ctOrderNew[tr->ctOrderInvNew[ctNe… in DMPlexTransformGetCellType()
910 PetscErrorCode DMPlexTransformGetCellTypeStratum(DMPlexTransform tr, DMPolytopeType celltype, Petsc… in DMPlexTransformGetCellTypeStratum() argument
913 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetCellTypeStratum()
914 if (start) *start = tr->ctStartNew[celltype]; in DMPlexTransformGetCellTypeStratum()
915 if (end) *end = tr->ctStartNew[tr->ctOrderNew[tr->ctOrderInvNew[celltype] + 1]]; in DMPlexTransformGetCellTypeStratum()
919 PetscErrorCode DMPlexTransformGetDepth(DMPlexTransform tr, PetscInt *depth) in DMPlexTransformGetDepth() argument
922 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetDepth()
923 *depth = tr->depth; in DMPlexTransformGetDepth()
927 PetscErrorCode DMPlexTransformGetDepthStratum(DMPlexTransform tr, PetscInt depth, PetscInt *start, … in DMPlexTransformGetDepthStratum() argument
930 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetDepthStratum()
931 if (start) *start = tr->depthStart[depth]; in DMPlexTransformGetDepthStratum()
932 if (end) *end = tr->depthEnd[depth]; in DMPlexTransformGetDepthStratum()
951 PetscErrorCode DMPlexTransformGetMatchStrata(DMPlexTransform tr, PetscBool *match) in DMPlexTransformGetMatchStrata() argument
954 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetMatchStrata()
956 *match = tr->labelMatchStrata; in DMPlexTransformGetMatchStrata()
973 PetscErrorCode DMPlexTransformSetMatchStrata(DMPlexTransform tr, PetscBool match) in DMPlexTransformSetMatchStrata() argument
976 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformSetMatchStrata()
977 tr->labelMatchStrata = match; in DMPlexTransformSetMatchStrata()
1000 PetscErrorCode DMPlexTransformGetTargetPoint(DMPlexTransform tr, DMPolytopeType ct, DMPolytopeType … in DMPlexTransformGetTargetPoint() argument
1005 DMLabel trType = tr->trType; in DMPlexTransformGetTargetPoint()
1006 …PetscInt ctS = tr->ctStart[ct], ctE = tr->ctStart[tr->ctOrderOld[tr->ctOrderInvOld[ct] + 1]… in DMPlexTransformGetTargetPoint()
1007 …PetscInt ctSN = tr->ctStartNew[ctNew], ctEN = tr->ctStartNew[tr->ctOrderNew[tr->ctOrderInvN… in DMPlexTransformGetTargetPoint()
1012 PetscCall(DMPlexTransformCellTransform(tr, ct, p, &rt, &Nct, &rct, &rsize, &cone, &ornt)); in DMPlexTransformGetTargetPoint()
1021 off = tr->offset[cind * DM_NUM_POLYTOPES + ctNew]; in DMPlexTransformGetTargetPoint()
1022 … type %s for transform %s", DMPolytopeTypes[ct], rt, p, DMPolytopeTypes[ctNew], tr->hdr.type_name); in DMPlexTransformGetTargetPoint()
1057 PetscErrorCode DMPlexTransformGetSourcePoint(DMPlexTransform tr, PetscInt pNew, DMPolytopeType *ct,… in DMPlexTransformGetSourcePoint() argument
1059 DMLabel trType = tr->trType; in DMPlexTransformGetSourcePoint()
1066 PetscCall(DMPlexTransformGetCellType(tr, pNew, &ctN)); in DMPlexTransformGetSourcePoint()
1073 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformGetSourcePoint()
1078 const PetscInt off = tr->offset[r * DM_NUM_POLYTOPES + ctN]; in DMPlexTransformGetSourcePoint()
1080 if (tr->ctStartNew[ctN] + off > pNew) continue; in DMPlexTransformGetSourcePoint()
1095 … PetscInt ctS = tr->ctStart[ctO], ctE = tr->ctStart[tr->ctOrderOld[tr->ctOrderInvOld[ctO] + 1]]; in DMPlexTransformGetSourcePoint()
1102 const PetscInt off = tr->offset[ctTmp * DM_NUM_POLYTOPES + ctN]; in DMPlexTransformGetSourcePoint()
1104 if (tr->ctStartNew[ctN] + off > pNew) continue; in DMPlexTransformGetSourcePoint()
1105 if (tr->ctStart[tr->ctOrderOld[tr->ctOrderInvOld[ctTmp] + 1]] <= tr->ctStart[ctTmp]) continue; in DMPlexTransformGetSourcePoint()
1115 ctS = tr->ctStart[ctO]; in DMPlexTransformGetSourcePoint()
1116 ctE = tr->ctStart[tr->ctOrderOld[tr->ctOrderInvOld[ctO] + 1]]; in DMPlexTransformGetSourcePoint()
1125 …PetscCall(DMPlexTransformCellTransform(tr, (DMPolytopeType)ctO, rtS, &rtTmp, &Nct, &rct, &rsize, &… in DMPlexTransformGetSourcePoint()
1129 PetscInt tmp = pNew - tr->ctStartNew[ctN] - offset, val, c; in DMPlexTransformGetSourcePoint()
1198 PetscErrorCode DMPlexTransformCellTransform(DMPlexTransform tr, DMPolytopeType source, PetscInt p, … in DMPlexTransformCellTransform() argument
1201 PetscUseTypeMethod(tr, celltransform, source, p, rt, Nt, target, size, cone, ornt); in DMPlexTransformCellTransform()
1205 PetscErrorCode DMPlexTransformGetSubcellOrientationIdentity(DMPlexTransform tr, DMPolytopeType sct,… in DMPlexTransformGetSubcellOrientationIdentity() argument
1214 PetscErrorCode DMPlexTransformCellTransformIdentity(DMPlexTransform tr, DMPolytopeType source, Pets… in DMPlexTransformCellTransformIdentity() argument
1381 PetscErrorCode DMPlexTransformGetSubcellOrientation(DMPlexTransform tr, DMPolytopeType sct, PetscIn… in DMPlexTransformGetSubcellOrientation() argument
1384 PetscUseTypeMethod(tr, getsubcellorientation, sct, sp, so, tct, r, o, rnew, onew); in DMPlexTransformGetSubcellOrientation()
1388 static PetscErrorCode DMPlexTransformSetConeSizes(DMPlexTransform tr, DM rdm) in DMPlexTransformSetConeSizes() argument
1394 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformSetConeSizes()
1395 PetscCall(PetscLogEventBegin(DMPLEXTRANSFORM_SetConeSizes, tr, dm, 0, 0)); in DMPlexTransformSetConeSizes()
1406 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in DMPlexTransformSetConeSizes()
1409 PetscCall(DMPlexTransformGetTargetPoint(tr, ct, rct[n], p, r, &pNew)); in DMPlexTransformSetConeSizes()
1423 PetscCall(PetscLogEventEnd(DMPLEXTRANSFORM_SetConeSizes, tr, dm, 0, 0)); in DMPlexTransformSetConeSizes()
1427 PetscErrorCode DMPlexTransformGetConeSize(DMPlexTransform tr, PetscInt q, PetscInt *coneSize) in DMPlexTransformGetConeSize() argument
1432 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetConeSize()
1434 PetscCall(DMPlexTransformGetCellType(tr, q, &ctNew)); in DMPlexTransformGetConeSize()
1440 static PetscErrorCode DMPlexTransformGetCone_Internal(DMPlexTransform tr, PetscInt p, PetscInt o, D… in DMPlexTransformGetCone_Internal() argument
1450 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformGetCone_Internal()
1455 PetscCall(DMPlexTransformGetSubcellOrientation(tr, ct, p, o, ctNew, cr, co, &nr, &no)); in DMPlexTransformGetCone_Internal()
1491 PetscCall(DMPlexTransformGetSubcellOrientation(tr, pct, pp, fn ? po : o, ft, pr, fo, &pr, &fo)); in DMPlexTransformGetCone_Internal()
1492 PetscCall(DMPlexTransformGetTargetPoint(tr, pct, ft, pp, pr, &coneNew[c])); in DMPlexTransformGetCone_Internal()
1526 static PetscErrorCode DMPlexTransformSetCones(DMPlexTransform tr, DM rdm) in DMPlexTransformSetCones() argument
1534 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformSetCones()
1535 PetscCall(PetscLogEventBegin(DMPLEXTRANSFORM_SetCones, tr, dm, 0, 0)); in DMPlexTransformSetCones()
1547 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in DMPlexTransformSetCones()
1552 PetscCall(DMPlexTransformGetTargetPoint(tr, ct, rct[n], p, r, &pNew)); in DMPlexTransformSetCones()
1553 …PetscCall(DMPlexTransformGetCone_Internal(tr, p, 0, ct, ctNew, rcone, &coff, rornt, &ooff, coneNew… in DMPlexTransformSetCones()
1564 PetscTryTypeMethod(tr, ordersupports, dm, rdm); in DMPlexTransformSetCones()
1565 PetscCall(PetscLogEventEnd(DMPLEXTRANSFORM_SetCones, tr, dm, 0, 0)); in DMPlexTransformSetCones()
1569 PetscErrorCode DMPlexTransformGetConeOriented(DMPlexTransform tr, PetscInt q, PetscInt po, const Pe… in DMPlexTransformGetConeOriented() argument
1578 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetConeOriented()
1582 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformGetConeOriented()
1585 PetscCall(DMPlexTransformGetSourcePoint(tr, q, &ct, &qct, &p, &r)); in DMPlexTransformGetConeOriented()
1586 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in DMPlexTransformGetConeOriented()
1604 …PetscCall(DMPlexTransformGetCone_Internal(tr, p, po, ct, qct, rcone, &coff, rornt, &ooff, qcone, q… in DMPlexTransformGetConeOriented()
1610 PetscErrorCode DMPlexTransformGetCone(DMPlexTransform tr, PetscInt q, const PetscInt *cone[], const… in DMPlexTransformGetCone() argument
1619 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformGetCone()
1623 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformGetCone()
1626 PetscCall(DMPlexTransformGetSourcePoint(tr, q, &ct, &qct, &p, &r)); in DMPlexTransformGetCone()
1627 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in DMPlexTransformGetCone()
1645 …PetscCall(DMPlexTransformGetCone_Internal(tr, p, 0, ct, qct, rcone, &coff, rornt, &ooff, qcone, qo… in DMPlexTransformGetCone()
1653 PetscErrorCode DMPlexTransformRestoreCone(DMPlexTransform tr, PetscInt q, const PetscInt *cone[], c… in DMPlexTransformRestoreCone() argument
1658 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformRestoreCone()
1659 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformRestoreCone()
1665 static PetscErrorCode DMPlexTransformCreateCellVertices_Internal(DMPlexTransform tr) in DMPlexTransformCreateCellVertices_Internal() argument
1670 …PetscCall(PetscCalloc3(DM_NUM_POLYTOPES, &tr->trNv, DM_NUM_POLYTOPES, &tr->trVerts, DM_NUM_POLYTOP… in DMPlexTransformCreateCellVertices_Internal()
1689 PetscCall(DMPlexTransformGetType(tr, &typeName)); in DMPlexTransformCreateCellVertices_Internal()
1696 tr->trNv[ct] = vEnd - vStart; in DMPlexTransformCreateCellVertices_Internal()
1699 …tr->trNv[ct] * trdim == Nc, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Cell type %s, transformed coordinate… in DMPlexTransformCreateCellVertices_Internal()
1700 PetscCall(PetscCalloc1(Nc, &tr->trVerts[ct])); in DMPlexTransformCreateCellVertices_Internal()
1702 PetscCall(PetscArraycpy(tr->trVerts[ct], coords, Nc)); in DMPlexTransformCreateCellVertices_Internal()
1705 PetscCall(PetscCalloc1(DM_NUM_POLYTOPES, &tr->trSubVerts[ct])); in DMPlexTransformCreateCellVertices_Internal()
1710 PetscCall(PetscCalloc1(rsize[n], &tr->trSubVerts[ct][rct[n]])); in DMPlexTransformCreateCellVertices_Internal()
1715 … PetscCall(PetscCalloc1(DMPolytopeTypeGetNumVertices(rct[n]), &tr->trSubVerts[ct][rct[n]][r])); in DMPlexTransformCreateCellVertices_Internal()
1721 if ((sv >= vStart) && (sv < vEnd)) tr->trSubVerts[ct][rct[n]][r][Nv++] = sv - vStart; in DMPlexTransformCreateCellVertices_Internal()
1732 …tscPrintf(PETSC_COMM_SELF, "%s: %" PetscInt_FMT " vertices\n", DMPolytopeTypes[ct], tr->trNv[ct])); in DMPlexTransformCreateCellVertices_Internal()
1733 for (v = 0; v < tr->trNv[ct]; ++v) { in DMPlexTransformCreateCellVertices_Internal()
1735 …; ++d) PetscCall(PetscPrintf(PETSC_COMM_SELF, "%g ", (double)PetscRealPart(tr->trVerts[ct][off++])… in DMPlexTransformCreateCellVertices_Internal()
1742 … %s subvertices %" PetscInt_FMT "\n", DMPolytopeTypes[ct], DMPolytopeTypes[rct[n]], tr->trNv[ct])); in DMPlexTransformCreateCellVertices_Internal()
1745 …rct[n]); ++v) PetscCall(PetscPrintf(PETSC_COMM_SELF, "%" PetscInt_FMT " ", tr->trSubVerts[ct][rct[… in DMPlexTransformCreateCellVertices_Internal()
1772 PetscErrorCode DMPlexTransformGetCellVertices(DMPlexTransform tr, DMPolytopeType ct, PetscInt *Nv, … in DMPlexTransformGetCellVertices() argument
1775 if (!tr->trNv) PetscCall(DMPlexTransformCreateCellVertices_Internal(tr)); in DMPlexTransformGetCellVertices()
1776 if (Nv) *Nv = tr->trNv[ct]; in DMPlexTransformGetCellVertices()
1777 if (trVerts) *trVerts = tr->trVerts[ct]; in DMPlexTransformGetCellVertices()
1797 PetscErrorCode DMPlexTransformGetSubcellVertices(DMPlexTransform tr, DMPolytopeType ct, DMPolytopeT… in DMPlexTransformGetSubcellVertices() argument
1800 if (!tr->trNv) PetscCall(DMPlexTransformCreateCellVertices_Internal(tr)); in DMPlexTransformGetSubcellVertices()
1801 …PetscCheck(tr->trSubVerts[ct][rct], PetscObjectComm((PetscObject)tr), PETSC_ERR_ARG_WRONG, "Cell t… in DMPlexTransformGetSubcellVertices()
1802 if (subVerts) *subVerts = tr->trSubVerts[ct][rct][r]; in DMPlexTransformGetSubcellVertices()
1807 PetscErrorCode DMPlexTransformMapCoordinatesBarycenter_Internal(DMPlexTransform tr, DMPolytopeType … in DMPlexTransformMapCoordinatesBarycenter_Internal() argument
1842 PetscErrorCode DMPlexTransformMapCoordinates(DMPlexTransform tr, DMPolytopeType pct, DMPolytopeType… in DMPlexTransformMapCoordinates() argument
1845 if (Nv) PetscUseTypeMethod(tr, mapcoordinates, pct, ct, p, r, Nv, dE, in, out); in DMPlexTransformMapCoordinates()
1868 static PetscErrorCode DMPlexTransformLabelProducedPoint_Private(DMPlexTransform tr, DMLabel label, … in DMPlexTransformLabelProducedPoint_Private() argument
1871 if (tr->labelMatchStrata && pct != ct) PetscFunctionReturn(PETSC_SUCCESS); in DMPlexTransformLabelProducedPoint_Private()
1872 PetscCall(DMLabelSetValue(label, p, val + tr->labelReplicaInc * r)); in DMPlexTransformLabelProducedPoint_Private()
1876 static PetscErrorCode RefineLabel_Internal(DMPlexTransform tr, DMLabel label, DMLabel labelNew) in RefineLabel_Internal() argument
1884 PetscCall(DMPlexTransformGetDM(tr, &dm)); in RefineLabel_Internal()
1909 … PetscCall(DMPlexTransformCellTransform(tr, ct, point, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in RefineLabel_Internal()
1912 PetscCall(DMPlexTransformGetTargetPoint(tr, ct, rct[n], point, r, &pNew)); in RefineLabel_Internal()
1913 …PetscCall(DMPlexTransformLabelProducedPoint_Private(tr, labelNew, point, ct, pNew, rct[n], r, valu… in RefineLabel_Internal()
1925 static PetscErrorCode DMPlexTransformCreateLabels(DMPlexTransform tr, DM rdm) in DMPlexTransformCreateLabels() argument
1931 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformCreateLabels()
1932 PetscCall(PetscLogEventBegin(DMPLEXTRANSFORM_CreateLabels, tr, dm, 0, 0)); in DMPlexTransformCreateLabels()
1947 PetscCall(RefineLabel_Internal(tr, label, labelNew)); in DMPlexTransformCreateLabels()
1949 PetscCall(PetscLogEventEnd(DMPLEXTRANSFORM_CreateLabels, tr, dm, 0, 0)); in DMPlexTransformCreateLabels()
1954 PetscErrorCode DMPlexTransformCreateDiscLabels(DMPlexTransform tr, DM rdm) in DMPlexTransformCreateDiscLabels() argument
1960 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformCreateDiscLabels()
1971 PetscCall(RefineLabel_Internal(tr, label, labelNew)); in DMPlexTransformCreateDiscLabels()
1984 PetscCall(RefineLabel_Internal(tr, label, labelNew)); in DMPlexTransformCreateDiscLabels()
1991 static PetscErrorCode DMPlexTransformCreateSF(DMPlexTransform tr, DM rdm) in DMPlexTransformCreateSF() argument
2009 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformCreateSF()
2010 PetscCall(PetscLogEventBegin(DMPLEXTRANSFORM_CreateSF, tr, dm, 0, 0)); in DMPlexTransformCreateSF()
2017 PetscCall(PetscLogEventEnd(DMPLEXTRANSFORM_CreateSF, tr, dm, 0, 0)); in DMPlexTransformCreateSF()
2028 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in DMPlexTransformCreateSF()
2044 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in DMPlexTransformCreateSF()
2065 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in DMPlexTransformCreateSF()
2068 PetscCall(DMPlexTransformGetTargetPoint(tr, ct, rct[n], p, r, &pNew)); in DMPlexTransformCreateSF()
2087 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in DMPlexTransformCreateSF()
2090 PetscCall(DMPlexTransformGetTargetPoint(tr, ct, rct[n], p, r, &pNew)); in DMPlexTransformCreateSF()
2125 PetscCall(PetscLogEventEnd(DMPLEXTRANSFORM_CreateSF, tr, dm, 0, 0)); in DMPlexTransformCreateSF()
2148 static PetscErrorCode DMPlexTransformMapLocalizedCoordinates(DMPlexTransform tr, DMPolytopeType ct,… in DMPlexTransformMapLocalizedCoordinates() argument
2154 PetscCall(DMPlexTransformGetCoordinateFE(tr, ct, &fe)); in DMPlexTransformMapLocalizedCoordinates()
2155 PetscCall(DMPlexTransformGetSubcellVertices(tr, ct, rct, r, &subcellV)); in DMPlexTransformMapLocalizedCoordinates()
2157 …peTypeGetNumVertices(rct); ++v) PetscCall(PetscFEInterpolate_Static(fe, x, tr->refGeom[ct], subcel… in DMPlexTransformMapLocalizedCoordinates()
2161 static PetscErrorCode DMPlexTransformSetCoordinates(DMPlexTransform tr, DM rdm) in DMPlexTransformSetCoordinates() argument
2175 PetscCall(DMPlexTransformGetDM(tr, &dm)); in DMPlexTransformSetCoordinates()
2176 PetscCall(PetscLogEventBegin(DMPLEXTRANSFORM_SetCoordinates, tr, dm, 0, 0)); in DMPlexTransformSetCoordinates()
2237 … PetscCall(DMPlexTransformCellTransform(tr, ct, c, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in DMPlexTransformSetCoordinates()
2245 PetscCall(DMPlexTransformGetTargetPoint(tr, ct, rct[n], c, r, &cNew)); in DMPlexTransformSetCoordinates()
2289 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in DMPlexTransformSetCoordinates()
2321 PetscCall(DMPlexTransformGetTargetPoint(tr, ct, rct[n], p, r, &vNew)); in DMPlexTransformSetCoordinates()
2323 PetscCall(DMPlexTransformMapCoordinates(tr, ct, rct[n], p, r, Nv, dEo, icoords, vcoords)); in DMPlexTransformSetCoordinates()
2362 PetscCall(DMPlexTransformCellTransform(tr, ct, p, NULL, &Nct, &rct, &rsize, &rcone, &rornt)); in DMPlexTransformSetCoordinates()
2378 PetscCall(DMPlexTransformGetTargetPoint(tr, ct, rct[n], p, r, &pNew)); in DMPlexTransformSetCoordinates()
2380 … PetscCall(DMPlexTransformMapLocalizedCoordinates(tr, ct, rct[n], r, pcoords, &coordsNew[offNew])); in DMPlexTransformSetCoordinates()
2391 PetscCall(PetscLogEventEnd(DMPLEXTRANSFORM_SetCoordinates, tr, dm, 0, 0)); in DMPlexTransformSetCoordinates()
2416 PetscErrorCode DMPlexTransformApply(DMPlexTransform tr, DM dm, DM *trdm) in DMPlexTransformApply() argument
2423 PetscValidHeaderSpecific(tr, DMPLEXTRANSFORM_CLASSID, 1); in DMPlexTransformApply()
2426 PetscCall(PetscLogEventBegin(DMPLEXTRANSFORM_Apply, tr, dm, 0, 0)); in DMPlexTransformApply()
2427 PetscCall(DMPlexTransformSetDM(tr, dm)); in DMPlexTransformApply()
2431 PetscCall(DMPlexTransformSetDimensions(tr, dm, rdm)); in DMPlexTransformApply()
2436 PetscCall(DMPlexTransformGetChart(tr, &pStart, &pEnd)); in DMPlexTransformApply()
2439 PetscCall(DMPlexTransformSetConeSizes(tr, rdm)); in DMPlexTransformApply()
2443 PetscCall(DMPlexTransformSetCones(tr, rdm)); in DMPlexTransformApply()
2445 PetscCall(DMPlexTransformCreateSF(tr, rdm)); in DMPlexTransformApply()
2447 PetscCall(DMPlexTransformCreateLabels(tr, rdm)); in DMPlexTransformApply()
2449 PetscCall(DMPlexTransformSetCoordinates(tr, rdm)); in DMPlexTransformApply()
2453 PetscCall(PetscLogEventEnd(DMPLEXTRANSFORM_Apply, tr, dm, 0, 0)); in DMPlexTransformApply()
2460 DMPlexTransform tr; in DMPlexTransformAdaptLabel() local
2466 PetscCall(DMPlexTransformCreate(PetscObjectComm((PetscObject)dm), &tr)); in DMPlexTransformAdaptLabel()
2467 PetscCall(PetscObjectSetName((PetscObject)tr, "Adapt Label Transform")); in DMPlexTransformAdaptLabel()
2469 PetscCall(PetscObjectSetOptionsPrefix((PetscObject)tr, prefix)); in DMPlexTransformAdaptLabel()
2470 PetscCall(DMPlexTransformSetDM(tr, dm)); in DMPlexTransformAdaptLabel()
2471 PetscCall(DMPlexTransformSetFromOptions(tr)); in DMPlexTransformAdaptLabel()
2472 if (adaptLabel) PetscCall(DMPlexTransformSetActive(tr, adaptLabel)); in DMPlexTransformAdaptLabel()
2473 PetscCall(DMPlexTransformSetUp(tr)); in DMPlexTransformAdaptLabel()
2474 PetscCall(PetscObjectViewFromOptions((PetscObject)tr, NULL, "-dm_plex_transform_view")); in DMPlexTransformAdaptLabel()
2475 PetscCall(DMPlexTransformApply(tr, dm, rdm)); in DMPlexTransformAdaptLabel()
2480 PetscCall(DMPlexTransformCreateDiscLabels(tr, *rdm)); in DMPlexTransformAdaptLabel()
2483 if (save) PetscCall(DMPlexSetTransform(*rdm, tr)); in DMPlexTransformAdaptLabel()
2484 PetscCall(DMPlexTransformDestroy(&tr)); in DMPlexTransformAdaptLabel()