Lines Matching refs:dm

52 PetscErrorCode DMCreate(MPI_Comm comm, DM *dm)  in DMCreate()  argument
58 PetscAssertPointer(dm, 2); in DMCreate()
96 *dm = v; in DMCreate()
124 PetscErrorCode DMClone(DM dm, DM *newdm) in DMClone() argument
134 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMClone()
136 PetscCall(DMCreate(PetscObjectComm((PetscObject)dm), newdm)); in DMClone()
137 PetscCall(DMCopyLabels(dm, *newdm, PETSC_COPY_VALUES, PETSC_TRUE, DM_COPY_LABELS_FAIL)); in DMClone()
138 (*newdm)->leveldown = dm->leveldown; in DMClone()
139 (*newdm)->levelup = dm->levelup; in DMClone()
140 (*newdm)->prealloc_only = dm->prealloc_only; in DMClone()
141 (*newdm)->prealloc_skip = dm->prealloc_skip; in DMClone()
143 PetscCall(PetscStrallocpy(dm->vectype, (char **)&(*newdm)->vectype)); in DMClone()
145 PetscCall(PetscStrallocpy(dm->mattype, (char **)&(*newdm)->mattype)); in DMClone()
146 PetscCall(DMGetDimension(dm, &dim)); in DMClone()
148 PetscTryTypeMethod(dm, clone, newdm); in DMClone()
149 (*newdm)->setupcalled = dm->setupcalled; in DMClone()
150 PetscCall(DMGetPointSF(dm, &sf)); in DMClone()
152 PetscCall(DMGetApplicationContext(dm, &ctx)); in DMClone()
154 PetscCall(DMReorderSectionGetDefault(dm, &flg)); in DMClone()
156 PetscCall(DMReorderSectionGetType(dm, &otype)); in DMClone()
159 if (dm->coordinates[i].dm) { in DMClone()
164 PetscCall(DMGetLocalSection(dm->coordinates[i].dm, &cs)); in DMClone()
166 …scCallMPI(MPIU_Allreduce(&pEnd, &pEndMax, 1, MPIU_INT, MPI_MAX, PetscObjectComm((PetscObject)dm))); in DMClone()
168 PetscCall(DMClone(dm->coordinates[i].dm, &ncdm)); in DMClone()
169 PetscCall(DMCopyDisc(dm->coordinates[i].dm, ncdm)); in DMClone()
171 if (dm->coordinates[i].dm->periodic.setup) { in DMClone()
172 ncdm->periodic.setup = dm->coordinates[i].dm->periodic.setup; in DMClone()
181 PetscCall(DMGetCoordinateDim(dm, &cdim)); in DMClone()
183 PetscCall(DMGetCoordinatesLocal(dm, &coords)); in DMClone()
187 PetscCall(DMGetCoordinates(dm, &coords)); in DMClone()
190 PetscCall(DMGetCellCoordinatesLocal(dm, &coords)); in DMClone()
194 PetscCall(DMGetCellCoordinates(dm, &coords)); in DMClone()
200 PetscCall(DMGetPeriodicity(dm, &maxCell, &Lstart, &L)); in DMClone()
206 PetscCall(DMGetAdjacency(dm, PETSC_DEFAULT, &useCone, &useClosure)); in DMClone()
229 PetscErrorCode DMSetVecType(DM dm, VecType ctype) in DMSetVecType() argument
234 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetVecType()
236 tmp = (char *)dm->vectype; in DMSetVecType()
237 PetscCall(PetscStrallocpy(ctype, (char **)&dm->vectype)); in DMSetVecType()
283 PetscErrorCode VecGetDM(Vec v, DM *dm) in VecGetDM() argument
287 PetscAssertPointer(dm, 2); in VecGetDM()
288 PetscCall(PetscObjectQuery((PetscObject)v, "__PETSc_dm", (PetscObject *)dm)); in VecGetDM()
310 PetscErrorCode VecSetDM(Vec v, DM dm) in VecSetDM() argument
314 if (dm) PetscValidHeaderSpecific(dm, DM_CLASSID, 2); in VecSetDM()
315 PetscCall(PetscObjectCompose((PetscObject)v, "__PETSc_dm", (PetscObject)dm)); in VecSetDM()
336 PetscErrorCode DMSetISColoringType(DM dm, ISColoringType ctype) in DMSetISColoringType() argument
339 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetISColoringType()
340 dm->coloringtype = ctype; in DMSetISColoringType()
363 PetscErrorCode DMGetISColoringType(DM dm, ISColoringType *ctype) in DMGetISColoringType() argument
366 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetISColoringType()
367 *ctype = dm->coloringtype; in DMGetISColoringType()
387 PetscErrorCode DMSetMatType(DM dm, MatType ctype) in DMSetMatType() argument
392 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetMatType()
394 tmp = (char *)dm->mattype; in DMSetMatType()
395 PetscCall(PetscStrallocpy(ctype, (char **)&dm->mattype)); in DMSetMatType()
415 PetscErrorCode DMGetMatType(DM dm, MatType *ctype) in DMGetMatType() argument
418 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetMatType()
419 *ctype = dm->mattype; in DMGetMatType()
444 PetscErrorCode MatGetDM(Mat A, DM *dm) in MatGetDM() argument
448 PetscAssertPointer(dm, 2); in MatGetDM()
449 PetscCall(PetscObjectQuery((PetscObject)A, "__PETSc_dm", (PetscObject *)dm)); in MatGetDM()
473 PetscErrorCode MatSetDM(Mat A, DM dm) in MatSetDM() argument
477 if (dm) PetscValidHeaderSpecific(dm, DM_CLASSID, 2); in MatSetDM()
478 PetscCall(PetscObjectCompose((PetscObject)A, "__PETSc_dm", (PetscObject)dm)); in MatSetDM()
499 PetscErrorCode DMSetOptionsPrefix(DM dm, const char prefix[]) in DMSetOptionsPrefix() argument
502 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetOptionsPrefix()
503 PetscCall(PetscObjectSetOptionsPrefix((PetscObject)dm, prefix)); in DMSetOptionsPrefix()
504 if (dm->sf) PetscCall(PetscObjectSetOptionsPrefix((PetscObject)dm->sf, prefix)); in DMSetOptionsPrefix()
505 if (dm->sectionSF) PetscCall(PetscObjectSetOptionsPrefix((PetscObject)dm->sectionSF, prefix)); in DMSetOptionsPrefix()
528 PetscErrorCode DMAppendOptionsPrefix(DM dm, const char prefix[]) in DMAppendOptionsPrefix() argument
531 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMAppendOptionsPrefix()
532 PetscCall(PetscObjectAppendOptionsPrefix((PetscObject)dm, prefix)); in DMAppendOptionsPrefix()
552 PetscErrorCode DMGetOptionsPrefix(DM dm, const char *prefix[]) in DMGetOptionsPrefix() argument
555 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetOptionsPrefix()
556 PetscCall(PetscObjectGetOptionsPrefix((PetscObject)dm, prefix)); in DMGetOptionsPrefix()
560 static PetscErrorCode DMCountNonCyclicReferences_Internal(DM dm, PetscBool recurseCoarse, PetscBool… in DMCountNonCyclicReferences_Internal() argument
562 PetscInt refct = ((PetscObject)dm)->refct; in DMCountNonCyclicReferences_Internal()
566 if (dm->coarseMesh && dm->coarseMesh->fineMesh == dm) { in DMCountNonCyclicReferences_Internal()
571 …PetscCall(DMCountNonCyclicReferences_Internal(dm->coarseMesh, PETSC_TRUE, PETSC_FALSE, &coarseCoun… in DMCountNonCyclicReferences_Internal()
575 if (dm->fineMesh && dm->fineMesh->coarseMesh == dm) { in DMCountNonCyclicReferences_Internal()
580 … PetscCall(DMCountNonCyclicReferences_Internal(dm->fineMesh, PETSC_FALSE, PETSC_TRUE, &fineCount)); in DMCountNonCyclicReferences_Internal()
589 PetscErrorCode DMCountNonCyclicReferences(PetscObject dm, PetscInt *ncrefct) in DMCountNonCyclicReferences() argument
592 PetscCall(DMCountNonCyclicReferences_Internal((DM)dm, PETSC_TRUE, PETSC_TRUE, ncrefct)); in DMCountNonCyclicReferences()
596 PetscErrorCode DMDestroyLabelLinkList_Internal(DM dm) in DMDestroyLabelLinkList_Internal() argument
598 DMLabelLink next = dm->labels; in DMDestroyLabelLinkList_Internal()
605 if (next->label == dm->depthLabel) dm->depthLabel = NULL; in DMDestroyLabelLinkList_Internal()
606 if (next->label == dm->celltypeLabel) dm->celltypeLabel = NULL; in DMDestroyLabelLinkList_Internal()
611 dm->labels = NULL; in DMDestroyLabelLinkList_Internal()
619 PetscCall(DMDestroy(&c->dm)); in DMDestroyCoordinates_Private()
638 PetscErrorCode DMDestroy(DM *dm) in DMDestroy() argument
643 if (!*dm) PetscFunctionReturn(PETSC_SUCCESS); in DMDestroy()
644 PetscValidHeaderSpecific(*dm, DM_CLASSID, 1); in DMDestroy()
647 PetscCall(DMCountNonCyclicReferences_Internal(*dm, PETSC_TRUE, PETSC_TRUE, &cnt)); in DMDestroy()
648 --((PetscObject)*dm)->refct; in DMDestroy()
650 *dm = NULL; in DMDestroy()
653 if (((PetscObject)*dm)->refct < 0) PetscFunctionReturn(PETSC_SUCCESS); in DMDestroy()
654 ((PetscObject)*dm)->refct = 0; in DMDestroy()
656 PetscCall(DMClearGlobalVectors(*dm)); in DMDestroy()
657 PetscCall(DMClearLocalVectors(*dm)); in DMDestroy()
658 PetscCall(DMClearNamedGlobalVectors(*dm)); in DMDestroy()
659 PetscCall(DMClearNamedLocalVectors(*dm)); in DMDestroy()
664 for (link = (*dm)->coarsenhook; link; link = next) { in DMDestroy()
668 (*dm)->coarsenhook = NULL; in DMDestroy()
672 for (link = (*dm)->refinehook; link; link = next) { in DMDestroy()
676 (*dm)->refinehook = NULL; in DMDestroy()
680 for (link = (*dm)->subdomainhook; link; link = next) { in DMDestroy()
684 (*dm)->subdomainhook = NULL; in DMDestroy()
688 for (link = (*dm)->gtolhook; link; link = next) { in DMDestroy()
692 (*dm)->gtolhook = NULL; in DMDestroy()
696 for (link = (*dm)->ltoghook; link; link = next) { in DMDestroy()
700 (*dm)->ltoghook = NULL; in DMDestroy()
705 …PetscCheck(!(*dm)->workout, PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "Work array still checked o… in DMDestroy()
706 for (link = (*dm)->workin; link; link = next) { in DMDestroy()
711 (*dm)->workin = NULL; in DMDestroy()
714 PetscCall(DMDestroyLabelLinkList_Internal(*dm)); in DMDestroy()
716 PetscCall(DMClearFields(*dm)); in DMDestroy()
719 DMBoundary next = (*dm)->boundary; in DMDestroy()
728 PetscCall(PetscObjectDestroy(&(*dm)->dmksp)); in DMDestroy()
729 PetscCall(PetscObjectDestroy(&(*dm)->dmsnes)); in DMDestroy()
730 PetscCall(PetscObjectDestroy(&(*dm)->dmts)); in DMDestroy()
732 if ((*dm)->ctx && (*dm)->ctxdestroy) PetscCall((*(*dm)->ctxdestroy)(&(*dm)->ctx)); in DMDestroy()
733 PetscCall(MatFDColoringDestroy(&(*dm)->fd)); in DMDestroy()
734 PetscCall(ISLocalToGlobalMappingDestroy(&(*dm)->ltogmap)); in DMDestroy()
735 PetscCall(PetscFree((*dm)->vectype)); in DMDestroy()
736 PetscCall(PetscFree((*dm)->mattype)); in DMDestroy()
738 PetscCall(PetscSectionDestroy(&(*dm)->localSection)); in DMDestroy()
739 PetscCall(PetscSectionDestroy(&(*dm)->globalSection)); in DMDestroy()
740 PetscCall(PetscFree((*dm)->reorderSectionType)); in DMDestroy()
741 PetscCall(PetscLayoutDestroy(&(*dm)->map)); in DMDestroy()
742 PetscCall(PetscSectionDestroy(&(*dm)->defaultConstraint.section)); in DMDestroy()
743 PetscCall(MatDestroy(&(*dm)->defaultConstraint.mat)); in DMDestroy()
744 PetscCall(PetscSFDestroy(&(*dm)->sf)); in DMDestroy()
745 PetscCall(PetscSFDestroy(&(*dm)->sectionSF)); in DMDestroy()
746 if ((*dm)->sfNatural) PetscCall(PetscSFDestroy(&(*dm)->sfNatural)); in DMDestroy()
747 PetscCall(PetscObjectDereference((PetscObject)(*dm)->sfMigration)); in DMDestroy()
748 PetscCall(DMClearAuxiliaryVec(*dm)); in DMDestroy()
749 PetscCall(PetscHMapAuxDestroy(&(*dm)->auxData)); in DMDestroy()
750 …if ((*dm)->coarseMesh && (*dm)->coarseMesh->fineMesh == *dm) PetscCall(DMSetFineDM((*dm)->coarseMe… in DMDestroy()
752 PetscCall(DMDestroy(&(*dm)->coarseMesh)); in DMDestroy()
753 …if ((*dm)->fineMesh && (*dm)->fineMesh->coarseMesh == *dm) PetscCall(DMSetCoarseDM((*dm)->fineMesh… in DMDestroy()
754 PetscCall(DMDestroy(&(*dm)->fineMesh)); in DMDestroy()
755 PetscCall(PetscFree((*dm)->Lstart)); in DMDestroy()
756 PetscCall(PetscFree((*dm)->L)); in DMDestroy()
757 PetscCall(PetscFree((*dm)->maxCell)); in DMDestroy()
758 PetscCall(PetscFree2((*dm)->nullspaceConstructors, (*dm)->nearnullspaceConstructors)); in DMDestroy()
759 PetscCall(DMDestroyCoordinates_Private(&(*dm)->coordinates[0])); in DMDestroy()
760 PetscCall(DMDestroyCoordinates_Private(&(*dm)->coordinates[1])); in DMDestroy()
761 if ((*dm)->transformDestroy) PetscCall((*(*dm)->transformDestroy)(*dm, (*dm)->transformCtx)); in DMDestroy()
762 PetscCall(DMDestroy(&(*dm)->transformDM)); in DMDestroy()
763 PetscCall(VecDestroy(&(*dm)->transform)); in DMDestroy()
764 for (PetscInt i = 0; i < (*dm)->periodic.num_affines; i++) { in DMDestroy()
765 PetscCall(VecScatterDestroy(&(*dm)->periodic.affine_to_local[i])); in DMDestroy()
766 PetscCall(VecDestroy(&(*dm)->periodic.affine[i])); in DMDestroy()
768 …if ((*dm)->periodic.num_affines > 0) PetscCall(PetscFree2((*dm)->periodic.affine_to_local, (*dm)->… in DMDestroy()
770 PetscCall(DMClearDS(*dm)); in DMDestroy()
771 PetscCall(DMDestroy(&(*dm)->dmBC)); in DMDestroy()
773 PetscCall(PetscObjectSAWsViewOff((PetscObject)*dm)); in DMDestroy()
775 PetscTryTypeMethod(*dm, destroy); in DMDestroy()
776 PetscCall(DMMonitorCancel(*dm)); in DMDestroy()
777 PetscCall(DMCeedDestroy(&(*dm)->dmceed)); in DMDestroy()
779 PetscCallCEED(CeedElemRestrictionDestroy(&(*dm)->ceedERestrict)); in DMDestroy()
780 PetscCallCEED(CeedDestroy(&(*dm)->ceed)); in DMDestroy()
783 PetscCall(PetscHeaderDestroy(dm)); in DMDestroy()
802 PetscErrorCode DMSetUp(DM dm) in DMSetUp() argument
805 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetUp()
806 if (dm->setupcalled) PetscFunctionReturn(PETSC_SUCCESS); in DMSetUp()
807 PetscTryTypeMethod(dm, setup); in DMSetUp()
808 dm->setupcalled = PETSC_TRUE; in DMSetUp()
886 PetscErrorCode DMSetFromOptions(DM dm) in DMSetFromOptions() argument
892 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetFromOptions()
893 dm->setfromoptionscalled = PETSC_TRUE; in DMSetFromOptions()
894 if (dm->sf) PetscCall(PetscSFSetFromOptions(dm->sf)); in DMSetFromOptions()
895 if (dm->sectionSF) PetscCall(PetscSFSetFromOptions(dm->sectionSF)); in DMSetFromOptions()
896 if (dm->coordinates[0].dm) PetscCall(DMSetFromOptions(dm->coordinates[0].dm)); in DMSetFromOptions()
897 PetscObjectOptionsBegin((PetscObject)dm); in DMSetFromOptions()
898 …x, but do not set column indices", "DMSetMatrixPreallocateOnly", dm->prealloc_only, &dm->prealloc_… in DMSetFromOptions()
899 …ec_type", "Vector type used for created vectors", "DMSetVecType", VecList, dm->vectype, typeName, … in DMSetFromOptions()
900 if (flg) PetscCall(DMSetVecType(dm, typeName)); in DMSetFromOptions()
901 …, "Matrix type used for created matrices", "DMSetMatType", MatList, dm->mattype ? dm->mattype : ty… in DMSetFromOptions()
902 if (flg) PetscCall(DMSetMatType(dm, typeName)); in DMSetFromOptions()
903 …locking", "DMSetBlockingType", DMBlockingTypes, (PetscEnum)dm->blocking_type, (PetscEnum *)&dm->bl… in DMSetFromOptions()
904 …obian", "DMSetISColoringType", ISColoringTypes, (PetscEnum)dm->coloringtype, (PetscEnum *)&dm->col… in DMSetFromOptions()
905 …entries) below which the Vec is bound to the CPU", "VecBindToCPU", dm->bind_below, &dm->bind_below… in DMSetFromOptions()
906 …nore the local section permutation on output", "DMGetOutputDM", dm->ignorePermOutput, &dm->ignoreP… in DMSetFromOptions()
907 PetscTryTypeMethod(dm, setfromoptions, PetscOptionsObject); in DMSetFromOptions()
909 PetscCall(PetscObjectProcessOptionsHandlers((PetscObject)dm, PetscOptionsObject)); in DMSetFromOptions()
931 PetscErrorCode DMViewFromOptions(DM dm, PeOp PetscObject obj, const char name[]) in DMViewFromOptions() argument
934 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMViewFromOptions()
935 PetscCall(PetscObjectViewFromOptions((PetscObject)dm, obj, name)); in DMViewFromOptions()
978 PetscErrorCode DMView(DM dm, PetscViewer v) in DMView() argument
985 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMView()
986 if (!v) PetscCall(PetscViewerASCIIGetStdout(PetscObjectComm((PetscObject)dm), &v)); in DMView()
1000 PetscCallMPI(MPI_Comm_size(PetscObjectComm((PetscObject)dm), &size)); in DMView()
1002 PetscCall(PetscObjectPrintClassNamePrefixType((PetscObject)dm, v)); in DMView()
1009 PetscCall(PetscStrncpy(type, ((PetscObject)dm)->type_name, sizeof(type))); in DMView()
1012 PetscTryTypeMethod(dm, view, v); in DMView()
1034 PetscErrorCode DMCreateGlobalVector(DM dm, Vec *vec) in DMCreateGlobalVector() argument
1037 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateGlobalVector()
1039 PetscUseTypeMethod(dm, createglobalvector, vec); in DMCreateGlobalVector()
1044 … PETSC_ERR_PLIB, "DM type '%s' did not attach the DM to the vector", ((PetscObject)dm)->type_name); in DMCreateGlobalVector()
1068 PetscErrorCode DMCreateLocalVector(DM dm, Vec *vec) in DMCreateLocalVector() argument
1071 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateLocalVector()
1073 PetscUseTypeMethod(dm, createlocalvector, vec); in DMCreateLocalVector()
1078 …, PETSC_ERR_LIB, "DM type '%s' did not attach the DM to the vector", ((PetscObject)dm)->type_name); in DMCreateLocalVector()
1107 PetscErrorCode DMGetLocalToGlobalMapping(DM dm, ISLocalToGlobalMapping *ltog) in DMGetLocalToGlobalMapping() argument
1112 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetLocalToGlobalMapping()
1114 if (!dm->ltogmap) { in DMGetLocalToGlobalMapping()
1117 PetscCall(DMGetLocalSection(dm, &section)); in DMGetLocalToGlobalMapping()
1123 PetscCall(DMGetGlobalSection(dm, &sectionGlobal)); in DMGetLocalToGlobalMapping()
1151 PetscCall(PetscGlobalMinMaxInt(PetscObjectComm((PetscObject)dm), bsLocal, bsMinMax)); in DMGetLocalToGlobalMapping()
1166 …LocalToGlobalMappingCreate(PetscObjectComm((PetscObject)dm), bs, n, ltog, PETSC_OWN_POINTER, &dm->… in DMGetLocalToGlobalMapping()
1167 } else PetscUseTypeMethod(dm, getlocaltoglobalmapping); in DMGetLocalToGlobalMapping()
1169 *ltog = dm->ltogmap; in DMGetLocalToGlobalMapping()
1194 PetscErrorCode DMGetBlockSize(DM dm, PetscInt *bs) in DMGetBlockSize() argument
1197 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetBlockSize()
1199 …PetscCheck(dm->bs >= 1, PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "DM does not have enough inform… in DMGetBlockSize()
1200 *bs = dm->bs; in DMGetBlockSize()
1421 PetscErrorCode DMCreateMassMatrixLumped(DM dm, Vec *llm, Vec *lm) in DMCreateMassMatrixLumped() argument
1424 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateMassMatrixLumped()
1427 if (llm || lm) PetscUseTypeMethod(dm, createmassmatrixlumped, llm, lm); in DMCreateMassMatrixLumped()
1486 PetscErrorCode DMCreateColoring(DM dm, ISColoringType ctype, ISColoring *coloring) in DMCreateColoring() argument
1489 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateColoring()
1491 PetscUseTypeMethod(dm, getcoloring, ctype, coloring); in DMCreateColoring()
1526 PetscErrorCode DMCreateMatrix(DM dm, Mat *mat) in DMCreateMatrix() argument
1529 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateMatrix()
1533 PetscUseTypeMethod(dm, creatematrix, mat); in DMCreateMatrix()
1538 … PETSC_ERR_PLIB, "DM type '%s' did not attach the DM to the matrix", ((PetscObject)dm)->type_name); in DMCreateMatrix()
1541 if (dm->Nf) { in DMCreateMatrix()
1545 PetscCall(DMGetNumFields(dm, &Nf)); in DMCreateMatrix()
1547 if (dm->nullspaceConstructors && dm->nullspaceConstructors[f]) { in DMCreateMatrix()
1548 PetscCall((*dm->nullspaceConstructors[f])(dm, f, f, &nullSpace)); in DMCreateMatrix()
1555 if (dm->nearnullspaceConstructors && dm->nearnullspaceConstructors[f]) { in DMCreateMatrix()
1556 PetscCall((*dm->nearnullspaceConstructors[f])(dm, f, f, &nullSpace)); in DMCreateMatrix()
1585 PetscErrorCode DMSetMatrixPreallocateSkip(DM dm, PetscBool skip) in DMSetMatrixPreallocateSkip() argument
1588 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetMatrixPreallocateSkip()
1589 dm->prealloc_skip = skip; in DMSetMatrixPreallocateSkip()
1610 PetscErrorCode DMSetMatrixPreallocateOnly(DM dm, PetscBool only) in DMSetMatrixPreallocateOnly() argument
1613 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetMatrixPreallocateOnly()
1614 dm->prealloc_only = only; in DMSetMatrixPreallocateOnly()
1632 PetscErrorCode DMSetMatrixStructureOnly(DM dm, PetscBool only) in DMSetMatrixStructureOnly() argument
1635 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetMatrixStructureOnly()
1636 dm->structure_only = only; in DMSetMatrixStructureOnly()
1656 PetscErrorCode DMSetBlockingType(DM dm, DMBlockingType btype) in DMSetBlockingType() argument
1659 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetBlockingType()
1660 dm->blocking_type = btype; in DMSetBlockingType()
1679 PetscErrorCode DMGetBlockingType(DM dm, DMBlockingType *btype) in DMGetBlockingType() argument
1682 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetBlockingType()
1684 *btype = dm->blocking_type; in DMGetBlockingType()
1710 PetscErrorCode DMGetWorkArray(DM dm, PetscInt count, MPI_Datatype dtype, void *mem) in DMGetWorkArray() argument
1716 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetWorkArray()
1722 if (dm->workin) { in DMGetWorkArray()
1723 link = dm->workin; in DMGetWorkArray()
1724 dm->workin = dm->workin->next; in DMGetWorkArray()
1745 link->next = dm->workout; in DMGetWorkArray()
1746 dm->workout = link; in DMGetWorkArray()
1771 PetscErrorCode DMRestoreWorkArray(DM dm, PetscInt count, MPI_Datatype dtype, void *mem) in DMRestoreWorkArray() argument
1780 for (p = &dm->workout; (link = *p); p = &link->next) { in DMRestoreWorkArray()
1783 link->next = dm->workin; in DMRestoreWorkArray()
1784 dm->workin = link; in DMRestoreWorkArray()
1813 PetscErrorCode DMSetNullSpaceConstructor(DM dm, PetscInt field, PetscErrorCode (*nullsp)(DM dm, Pet… in DMSetNullSpaceConstructor() argument
1816 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetNullSpaceConstructor()
1817 …eld < dm->Nf, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cannot handle %" PetscI… in DMSetNullSpaceConstructor()
1818 …PetscCheck(dm->nullspaceConstructors, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Must… in DMSetNullSpaceConstructor()
1819 dm->nullspaceConstructors[field] = nullsp; in DMSetNullSpaceConstructor()
1845 PetscErrorCode DMGetNullSpaceConstructor(DM dm, PetscInt field, PetscErrorCode (**nullsp)(DM dm, Pe… in DMGetNullSpaceConstructor() argument
1848 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetNullSpaceConstructor()
1850 …eld < dm->Nf, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cannot handle %" PetscI… in DMGetNullSpaceConstructor()
1851 …PetscCheck(dm->nullspaceConstructors, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Must… in DMGetNullSpaceConstructor()
1852 *nullsp = dm->nullspaceConstructors[field]; in DMGetNullSpaceConstructor()
1877 PetscErrorCode DMSetNearNullSpaceConstructor(DM dm, PetscInt field, PetscErrorCode (*nullsp)(DM dm,… in DMSetNearNullSpaceConstructor() argument
1880 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetNearNullSpaceConstructor()
1881 …eld < dm->Nf, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cannot handle %" PetscI… in DMSetNearNullSpaceConstructor()
1882 …PetscCheck(dm->nearnullspaceConstructors, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "… in DMSetNearNullSpaceConstructor()
1883 dm->nearnullspaceConstructors[field] = nullsp; in DMSetNearNullSpaceConstructor()
1910 PetscErrorCode DMGetNearNullSpaceConstructor(DM dm, PetscInt field, PetscErrorCode (**nullsp)(DM dm in DMGetNearNullSpaceConstructor() argument
1913 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetNearNullSpaceConstructor()
1915 …eld < dm->Nf, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cannot handle %" PetscI… in DMGetNearNullSpaceConstructor()
1916 …PetscCheck(dm->nearnullspaceConstructors, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "… in DMGetNearNullSpaceConstructor()
1917 *nullsp = dm->nearnullspaceConstructors[field]; in DMGetNearNullSpaceConstructor()
1948 PetscErrorCode DMCreateFieldIS(DM dm, PetscInt *numFields, char ***fieldNames, IS *fields[]) in DMCreateFieldIS() argument
1953 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateFieldIS()
1966 PetscCall(DMGetLocalSection(dm, &section)); in DMCreateFieldIS()
1971 PetscCall(DMGetGlobalSection(dm, &sectionGlobal)); in DMCreateFieldIS()
2032 …PetscCall(ISCreateGeneral(PetscObjectComm((PetscObject)dm), fieldSizes[f], fieldIndices[f], PETSC_… in DMCreateFieldIS()
2035 … PetscCallMPI(MPIU_Allreduce(in, out, 2, MPIU_INT, MPI_MAX, PetscObjectComm((PetscObject)dm))); in DMCreateFieldIS()
2041 } else PetscTryTypeMethod(dm, createfieldis, numFields, fieldNames, fields); in DMCreateFieldIS()
2092 PetscErrorCode DMCreateFieldDecomposition(DM dm, PetscInt *len, char ***namelist, IS *islist[], DM … in DMCreateFieldDecomposition() argument
2095 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateFieldDecomposition()
2117 …PetscCheck(dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Decomposi… in DMCreateFieldDecomposition()
2118 if (!dm->ops->createfielddecomposition) { in DMCreateFieldDecomposition()
2122 PetscCall(DMGetLocalSection(dm, &section)); in DMCreateFieldDecomposition()
2124 if (section && numFields && dm->ops->createsubdm) { in DMCreateFieldDecomposition()
2132 … PetscCall(DMCreateSubDM(dm, 1, &f, islist ? &(*islist)[f] : NULL, dmlist ? &(*dmlist)[f] : NULL)); in DMCreateFieldDecomposition()
2139 PetscCall(DMCreateFieldIS(dm, len, namelist, islist)); in DMCreateFieldDecomposition()
2143 } else PetscUseTypeMethod(dm, createfielddecomposition, len, namelist, islist, dmlist); in DMCreateFieldDecomposition()
2169 PetscErrorCode DMCreateSubDM(DM dm, PetscInt numFields, const PetscInt fields[], IS *is, DM *subdm) in DMCreateSubDM() argument
2172 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateSubDM()
2176 PetscUseTypeMethod(dm, createsubdm, numFields, fields, is, subdm); in DMCreateSubDM()
2211 DM dm = dms[0]; in DMCreateSuperDM() local
2212 …tscCheck(dm->ops->createsuperdm, PetscObjectComm((PetscObject)dm), PETSC_ERR_SUP, "No method creat… in DMCreateSuperDM()
2213 PetscCall((*dm->ops->createsuperdm)(dms, n, is, superdm)); in DMCreateSuperDM()
2255 PetscErrorCode DMCreateDomainDecomposition(DM dm, PetscInt *n, char ***namelist, IS *innerislist[],… in DMCreateDomainDecomposition() argument
2261 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateDomainDecomposition()
2287 …PetscCheck(dm->setupcalled, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Decomposi… in DMCreateDomainDecomposition()
2288 if (dm->ops->createdomaindecomposition) { in DMCreateDomainDecomposition()
2289 … PetscUseTypeMethod(dm, createdomaindecomposition, &l, namelist, innerislist, outerislist, dmlist); in DMCreateDomainDecomposition()
2293 for (link = dm->subdomainhook; link; link = link->next) { in DMCreateDomainDecomposition()
2294 if (link->ddhook) PetscCall((*link->ddhook)(dm, (*dmlist)[i], link->ctx)); in DMCreateDomainDecomposition()
2296 if (dm->ctx) (*dmlist)[i]->ctx = dm->ctx; in DMCreateDomainDecomposition()
2334 PetscErrorCode DMCreateDomainDecompositionScatters(DM dm, PetscInt n, DM *subdms, VecScatter *iscat… in DMCreateDomainDecompositionScatters() argument
2337 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateDomainDecompositionScatters()
2339 PetscUseTypeMethod(dm, createddscatters, n, subdms, iscat, oscat, gscat); in DMCreateDomainDecompositionScatters()
2366 PetscErrorCode DMRefine(DM dm, MPI_Comm comm, DM *dmf) in DMRefine() argument
2371 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMRefine()
2372 PetscCall(PetscLogEventBegin(DM_Refine, dm, 0, 0, 0)); in DMRefine()
2373 PetscUseTypeMethod(dm, refine, comm, dmf); in DMRefine()
2375 (*dmf)->ops->creatematrix = dm->ops->creatematrix; in DMRefine()
2377 PetscCall(PetscObjectCopyFortranFunctionPointers((PetscObject)dm, (PetscObject)*dmf)); in DMRefine()
2379 (*dmf)->ctx = dm->ctx; in DMRefine()
2380 (*dmf)->leveldown = dm->leveldown; in DMRefine()
2381 (*dmf)->levelup = dm->levelup + 1; in DMRefine()
2383 PetscCall(DMSetMatType(*dmf, dm->mattype)); in DMRefine()
2384 for (link = dm->refinehook; link; link = link->next) { in DMRefine()
2385 if (link->refinehook) PetscCall((*link->refinehook)(dm, *dmf, link->ctx)); in DMRefine()
2388 PetscCall(PetscLogEventEnd(DM_Refine, dm, 0, 0, 0)); in DMRefine()
2575 PetscErrorCode DMGetRefineLevel(DM dm, PetscInt *level) in DMGetRefineLevel() argument
2578 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetRefineLevel()
2579 *level = dm->levelup; in DMGetRefineLevel()
2601 PetscErrorCode DMSetRefineLevel(DM dm, PetscInt level) in DMSetRefineLevel() argument
2604 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetRefineLevel()
2605 dm->levelup = level; in DMSetRefineLevel()
2628 PetscErrorCode DMExtrude(DM dm, PetscInt layers, DM *dme) in DMExtrude() argument
2631 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMExtrude()
2632 PetscUseTypeMethod(dm, extrude, layers, dme); in DMExtrude()
2634 (*dme)->ops->creatematrix = dm->ops->creatematrix; in DMExtrude()
2635 PetscCall(PetscObjectCopyFortranFunctionPointers((PetscObject)dm, (PetscObject)*dme)); in DMExtrude()
2636 (*dme)->ctx = dm->ctx; in DMExtrude()
2637 PetscCall(DMSetMatType(*dme, dm->mattype)); in DMExtrude()
2642 PetscErrorCode DMGetBasisTransformDM_Internal(DM dm, DM *tdm) in DMGetBasisTransformDM_Internal() argument
2645 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetBasisTransformDM_Internal()
2647 *tdm = dm->transformDM; in DMGetBasisTransformDM_Internal()
2651 PetscErrorCode DMGetBasisTransformVec_Internal(DM dm, Vec *tv) in DMGetBasisTransformVec_Internal() argument
2654 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetBasisTransformVec_Internal()
2656 *tv = dm->transform; in DMGetBasisTransformVec_Internal()
2673 PetscErrorCode DMHasBasisTransform(DM dm, PetscBool *flg) in DMHasBasisTransform() argument
2678 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMHasBasisTransform()
2680 PetscCall(DMGetBasisTransformVec_Internal(dm, &tv)); in DMHasBasisTransform()
2685 PetscErrorCode DMConstructBasisTransform_Internal(DM dm) in DMConstructBasisTransform_Internal() argument
2692 PetscCall(DMGetCoordinateDim(dm, &cdim)); in DMConstructBasisTransform_Internal()
2693 PetscCall(DMGetLocalSection(dm, &s)); in DMConstructBasisTransform_Internal()
2696 PetscCall(DMClone(dm, &dm->transformDM)); in DMConstructBasisTransform_Internal()
2697 PetscCall(DMGetLocalSection(dm->transformDM, &ts)); in DMConstructBasisTransform_Internal()
2712 PetscCall(DMCreateLocalVector(dm->transformDM, &dm->transform)); in DMConstructBasisTransform_Internal()
2713 PetscCall(VecGetArray(dm->transform, &ta)); in DMConstructBasisTransform_Internal()
2723 PetscCall((*dm->transformGetMatrix)(dm, x, PETSC_TRUE, &A, dm->transformCtx)); in DMConstructBasisTransform_Internal()
2724 PetscCall(DMPlexPointLocalFieldRef(dm->transformDM, p, f, ta, (void *)&tva)); in DMConstructBasisTransform_Internal()
2729 PetscCall(VecRestoreArray(dm->transform, &ta)); in DMConstructBasisTransform_Internal()
2733 PetscErrorCode DMCopyTransform(DM dm, DM newdm) in DMCopyTransform() argument
2736 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCopyTransform()
2738 newdm->transformCtx = dm->transformCtx; in DMCopyTransform()
2739 newdm->transformSetUp = dm->transformSetUp; in DMCopyTransform()
2741 newdm->transformGetMatrix = dm->transformGetMatrix; in DMCopyTransform()
2778 …ToLocalHookAdd(DM dm, PetscErrorCode (*beginhook)(DM dm, Vec g, InsertMode mode, Vec l, PetscCtx c… in DMGlobalToLocalHookAdd() argument
2783 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGlobalToLocalHookAdd()
2784 …for (p = &dm->gtolhook; *p; p = &(*p)->next) { } /* Scan to the end of the current list of hooks */ in DMGlobalToLocalHookAdd()
2794 static PetscErrorCode DMGlobalToLocalHook_Constraints(DM dm, Vec g, InsertMode mode, Vec l, PetscCt… in DMGlobalToLocalHook_Constraints() argument
2804 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGlobalToLocalHook_Constraints()
2805 PetscCall(DMGetDefaultConstraints(dm, &cSec, &cMat, &cBias)); in DMGlobalToLocalHook_Constraints()
2811 PetscCall(DMGetLocalSection(dm, &section)); in DMGlobalToLocalHook_Constraints()
2852 PetscErrorCode DMGlobalToLocal(DM dm, Vec g, InsertMode mode, Vec l) in DMGlobalToLocal() argument
2855 PetscCall(DMGlobalToLocalBegin(dm, g, mode, l)); in DMGlobalToLocal()
2856 PetscCall(DMGlobalToLocalEnd(dm, g, mode, l)); in DMGlobalToLocal()
2884 PetscErrorCode DMGlobalToLocalBegin(DM dm, Vec g, InsertMode mode, Vec l) in DMGlobalToLocalBegin() argument
2890 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGlobalToLocalBegin()
2891 for (link = dm->gtolhook; link; link = link->next) { in DMGlobalToLocalBegin()
2892 if (link->beginhook) PetscCall((*link->beginhook)(dm, g, mode, l, link->ctx)); in DMGlobalToLocalBegin()
2894 PetscCall(DMGetSectionSF(dm, &sf)); in DMGlobalToLocalBegin()
2900 …PetscCheck(mode != ADD_VALUES, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invali… in DMGlobalToLocalBegin()
2907 …PetscUseTypeMethod(dm, globaltolocalbegin, g, mode == INSERT_ALL_VALUES ? INSERT_VALUES : (mode ==… in DMGlobalToLocalBegin()
2930 PetscErrorCode DMGlobalToLocalEnd(DM dm, Vec g, InsertMode mode, Vec l) in DMGlobalToLocalEnd() argument
2940 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGlobalToLocalEnd()
2941 PetscCall(DMGetSectionSF(dm, &sf)); in DMGlobalToLocalEnd()
2942 PetscCall(DMHasBasisTransform(dm, &transform)); in DMGlobalToLocalEnd()
2944 …PetscCheck(mode != ADD_VALUES, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invali… in DMGlobalToLocalEnd()
2951 if (transform) PetscCall(DMPlexGlobalToLocalBasis(dm, l)); in DMGlobalToLocalEnd()
2953 …PetscUseTypeMethod(dm, globaltolocalend, g, mode == INSERT_ALL_VALUES ? INSERT_VALUES : (mode == A… in DMGlobalToLocalEnd()
2955 PetscCall(DMGlobalToLocalHook_Constraints(dm, g, mode, l, NULL)); in DMGlobalToLocalEnd()
2956 for (link = dm->gtolhook; link; link = link->next) { in DMGlobalToLocalEnd()
2957 if (link->endhook) PetscCall((*link->endhook)(dm, g, mode, l, link->ctx)); in DMGlobalToLocalEnd()
2991 PetscErrorCode DMLocalToGlobalHookAdd(DM dm, PetscErrorCode (*beginhook)(DM global, Vec l, InsertMo… in DMLocalToGlobalHookAdd() argument
2996 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMLocalToGlobalHookAdd()
2997 …for (p = &dm->ltoghook; *p; p = &(*p)->next) { } /* Scan to the end of the current list of hooks */ in DMLocalToGlobalHookAdd()
3007 static PetscErrorCode DMLocalToGlobalHook_Constraints(DM dm, Vec l, InsertMode mode, Vec g, PetscCt… in DMLocalToGlobalHook_Constraints() argument
3012 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMLocalToGlobalHook_Constraints()
3020 PetscCall(DMGetDefaultConstraints(dm, &cSec, &cMat, NULL)); in DMLocalToGlobalHook_Constraints()
3025 PetscCall(DMGetLocalSection(dm, &section)); in DMLocalToGlobalHook_Constraints()
3070 PetscErrorCode DMLocalToGlobal(DM dm, Vec l, InsertMode mode, Vec g) in DMLocalToGlobal() argument
3073 PetscCall(DMLocalToGlobalBegin(dm, l, mode, g)); in DMLocalToGlobal()
3074 PetscCall(DMLocalToGlobalEnd(dm, l, mode, g)); in DMLocalToGlobal()
3104 PetscErrorCode DMLocalToGlobalBegin(DM dm, Vec l, InsertMode mode, Vec g) in DMLocalToGlobalBegin() argument
3116 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMLocalToGlobalBegin()
3117 for (link = dm->ltoghook; link; link = link->next) { in DMLocalToGlobalBegin()
3118 if (link->beginhook) PetscCall((*link->beginhook)(dm, l, mode, g, link->ctx)); in DMLocalToGlobalBegin()
3120 PetscCall(DMLocalToGlobalHook_Constraints(dm, l, mode, g, NULL)); in DMLocalToGlobalBegin()
3121 PetscCall(DMGetSectionSF(dm, &sf)); in DMLocalToGlobalBegin()
3122 PetscCall(DMGetLocalSection(dm, &s)); in DMLocalToGlobalBegin()
3135 …SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invalid insertion mode %d", m… in DMLocalToGlobalBegin()
3138 PetscCall(DMHasBasisTransform(dm, &transform)); in DMLocalToGlobalBegin()
3140 PetscCall(DMGetNamedLocalVector(dm, "__petsc_dm_transform_local_copy", &tmpl)); in DMLocalToGlobalBegin()
3142 PetscCall(DMPlexLocalToGlobalBasis(dm, tmpl)); in DMLocalToGlobalBegin()
3161 PetscCall(DMGetGlobalSection(dm, &gs)); in DMLocalToGlobalBegin()
3202 PetscCall(DMRestoreNamedLocalVector(dm, "__petsc_dm_transform_local_copy", &tmpl)); in DMLocalToGlobalBegin()
3209 …PetscUseTypeMethod(dm, localtoglobalbegin, l, mode == INSERT_ALL_VALUES ? INSERT_VALUES : (mode ==… in DMLocalToGlobalBegin()
3232 PetscErrorCode DMLocalToGlobalEnd(DM dm, Vec l, InsertMode mode, Vec g) in DMLocalToGlobalEnd() argument
3240 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMLocalToGlobalEnd()
3241 PetscCall(DMGetSectionSF(dm, &sf)); in DMLocalToGlobalEnd()
3242 PetscCall(DMGetLocalSection(dm, &s)); in DMLocalToGlobalEnd()
3253 …SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invalid insertion mode %d", m… in DMLocalToGlobalEnd()
3260 PetscCall(DMHasBasisTransform(dm, &transform)); in DMLocalToGlobalEnd()
3262 PetscCall(DMGetNamedLocalVector(dm, "__petsc_dm_transform_local_copy", &tmpl)); in DMLocalToGlobalEnd()
3271 PetscCall(DMRestoreNamedLocalVector(dm, "__petsc_dm_transform_local_copy", &tmpl)); in DMLocalToGlobalEnd()
3278 …PetscUseTypeMethod(dm, localtoglobalend, l, mode == INSERT_ALL_VALUES ? INSERT_VALUES : (mode == A… in DMLocalToGlobalEnd()
3280 for (link = dm->ltoghook; link; link = link->next) { in DMLocalToGlobalEnd()
3281 if (link->endhook) PetscCall((*link->endhook)(dm, g, mode, l, link->ctx)); in DMLocalToGlobalEnd()
3308 PetscErrorCode DMLocalToLocalBegin(DM dm, Vec g, InsertMode mode, Vec l) in DMLocalToLocalBegin() argument
3311 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMLocalToLocalBegin()
3314 …PetscUseTypeMethod(dm, localtolocalbegin, g, mode == INSERT_ALL_VALUES ? INSERT_VALUES : (mode == … in DMLocalToLocalBegin()
3336 PetscErrorCode DMLocalToLocalEnd(DM dm, Vec g, InsertMode mode, Vec l) in DMLocalToLocalEnd() argument
3339 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMLocalToLocalEnd()
3342 …PetscUseTypeMethod(dm, localtolocalend, g, mode == INSERT_ALL_VALUES ? INSERT_VALUES : (mode == AD… in DMLocalToLocalEnd()
3363 PetscErrorCode DMCoarsen(DM dm, MPI_Comm comm, DM *dmc) in DMCoarsen() argument
3368 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCoarsen()
3369 PetscCall(PetscLogEventBegin(DM_Coarsen, dm, 0, 0, 0)); in DMCoarsen()
3370 PetscUseTypeMethod(dm, coarsen, comm, dmc); in DMCoarsen()
3372 …(*dmc)->bind_below = dm->bind_below; /* Propagate this from parent DM; otherwise -dm_bind_below wi… in DMCoarsen()
3373 PetscCall(DMSetCoarseDM(dm, *dmc)); in DMCoarsen()
3374 (*dmc)->ops->creatematrix = dm->ops->creatematrix; in DMCoarsen()
3375 PetscCall(PetscObjectCopyFortranFunctionPointers((PetscObject)dm, (PetscObject)*dmc)); in DMCoarsen()
3376 (*dmc)->ctx = dm->ctx; in DMCoarsen()
3377 (*dmc)->levelup = dm->levelup; in DMCoarsen()
3378 (*dmc)->leveldown = dm->leveldown + 1; in DMCoarsen()
3379 PetscCall(DMSetMatType(*dmc, dm->mattype)); in DMCoarsen()
3380 for (link = dm->coarsenhook; link; link = link->next) { in DMCoarsen()
3381 if (link->coarsenhook) PetscCall((*link->coarsenhook)(dm, *dmc, link->ctx)); in DMCoarsen()
3384 PetscCall(PetscLogEventEnd(DM_Coarsen, dm, 0, 0, 0)); in DMCoarsen()
3645 PetscErrorCode DMGetCoarsenLevel(DM dm, PetscInt *level) in DMGetCoarsenLevel() argument
3648 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetCoarsenLevel()
3650 *level = dm->leveldown; in DMGetCoarsenLevel()
3670 PetscErrorCode DMSetCoarsenLevel(DM dm, PetscInt level) in DMSetCoarsenLevel() argument
3673 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetCoarsenLevel()
3674 dm->leveldown = level; in DMSetCoarsenLevel()
3694 PetscErrorCode DMRefineHierarchy(DM dm, PetscInt nlevels, DM dmf[]) in DMRefineHierarchy() argument
3697 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMRefineHierarchy()
3698 …PetscCheck(nlevels >= 0, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "nlevels cann… in DMRefineHierarchy()
3701 if (dm->ops->refine && !dm->ops->refinehierarchy) { in DMRefineHierarchy()
3704 PetscCall(DMRefine(dm, PetscObjectComm((PetscObject)dm), &dmf[0])); in DMRefineHierarchy()
3705 …for (i = 1; i < nlevels; i++) PetscCall(DMRefine(dmf[i - 1], PetscObjectComm((PetscObject)dm), &dm… in DMRefineHierarchy()
3706 } else PetscUseTypeMethod(dm, refinehierarchy, nlevels, dmf); in DMRefineHierarchy()
3726 PetscErrorCode DMCoarsenHierarchy(DM dm, PetscInt nlevels, DM dmc[]) in DMCoarsenHierarchy() argument
3729 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCoarsenHierarchy()
3730 …PetscCheck(nlevels >= 0, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "nlevels cann… in DMCoarsenHierarchy()
3733 if (dm->ops->coarsen && !dm->ops->coarsenhierarchy) { in DMCoarsenHierarchy()
3736 PetscCall(DMCoarsen(dm, PetscObjectComm((PetscObject)dm), &dmc[0])); in DMCoarsenHierarchy()
3737 …for (i = 1; i < nlevels; i++) PetscCall(DMCoarsen(dmc[i - 1], PetscObjectComm((PetscObject)dm), &d… in DMCoarsenHierarchy()
3738 } else PetscUseTypeMethod(dm, coarsenhierarchy, nlevels, dmc); in DMCoarsenHierarchy()
3756 PetscErrorCode DMSetApplicationContextDestroy(DM dm, PetscCtxDestroyFn *destroy) in DMSetApplicationContextDestroy() argument
3759 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetApplicationContextDestroy()
3760 dm->ctxdestroy = destroy; in DMSetApplicationContextDestroy()
3788 PetscErrorCode DMSetApplicationContext(DM dm, PetscCtx ctx) in DMSetApplicationContext() argument
3791 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetApplicationContext()
3792 dm->ctx = ctx; in DMSetApplicationContext()
3834 PetscErrorCode DMGetApplicationContext(DM dm, PetscCtxRt ctx) in DMGetApplicationContext() argument
3837 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetApplicationContext()
3838 *(void **)ctx = dm->ctx; in DMGetApplicationContext()
3859 PetscErrorCode DMSetVariableBounds(DM dm, PetscErrorCode (*f)(DM, Vec, Vec)) in DMSetVariableBounds() argument
3862 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetVariableBounds()
3863 dm->ops->computevariablebounds = f; in DMSetVariableBounds()
3882 PetscErrorCode DMHasVariableBounds(DM dm, PetscBool *flg) in DMHasVariableBounds() argument
3885 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMHasVariableBounds()
3887 *flg = (dm->ops->computevariablebounds) ? PETSC_TRUE : PETSC_FALSE; in DMHasVariableBounds()
3910 PetscErrorCode DMComputeVariableBounds(DM dm, Vec xl, Vec xu) in DMComputeVariableBounds() argument
3913 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMComputeVariableBounds()
3916 PetscUseTypeMethod(dm, computevariablebounds, xl, xu); in DMComputeVariableBounds()
3935 PetscErrorCode DMHasColoring(DM dm, PetscBool *flg) in DMHasColoring() argument
3938 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMHasColoring()
3940 *flg = (dm->ops->getcoloring) ? PETSC_TRUE : PETSC_FALSE; in DMHasColoring()
3959 PetscErrorCode DMHasCreateRestriction(DM dm, PetscBool *flg) in DMHasCreateRestriction() argument
3962 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMHasCreateRestriction()
3964 *flg = (dm->ops->createrestriction) ? PETSC_TRUE : PETSC_FALSE; in DMHasCreateRestriction()
3983 PetscErrorCode DMHasCreateInjection(DM dm, PetscBool *flg) in DMHasCreateInjection() argument
3986 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMHasCreateInjection()
3988 if (dm->ops->hascreateinjection) PetscUseTypeMethod(dm, hascreateinjection, flg); in DMHasCreateInjection()
3989 else *flg = (dm->ops->createinjection) ? PETSC_TRUE : PETSC_FALSE; in DMHasCreateInjection()
4015 PetscErrorCode DMSetType(DM dm, DMType method) in DMSetType() argument
4021 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetType()
4022 PetscCall(PetscObjectTypeCompare((PetscObject)dm, method, &match)); in DMSetType()
4027 …PetscCheck(r, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_UNKNOWN_TYPE, "Unknown DM type: %s",… in DMSetType()
4029 PetscTryTypeMethod(dm, destroy); in DMSetType()
4030 PetscCall(PetscMemzero(dm->ops, sizeof(*dm->ops))); in DMSetType()
4031 PetscCall(PetscObjectChangeTypeName((PetscObject)dm, method)); in DMSetType()
4032 PetscCall((*r)(dm)); in DMSetType()
4051 PetscErrorCode DMGetType(DM dm, DMType *type) in DMGetType() argument
4054 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetType()
4057 *type = ((PetscObject)dm)->type_name; in DMGetType()
4082 PetscErrorCode DMConvert(DM dm, DMType newtype, DM *M) in DMConvert() argument
4089 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMConvert()
4090 PetscValidType(dm, 1); in DMConvert()
4092 PetscCall(PetscObjectTypeCompare((PetscObject)dm, newtype, &sametype)); in DMConvert()
4095 *M = dm; in DMConvert()
4096 PetscCall(PetscObjectReference((PetscObject)dm)); in DMConvert()
4112 PetscCall(PetscStrlcat(convname, ((PetscObject)dm)->type_name, sizeof(convname))); in DMConvert()
4116 PetscCall(PetscObjectQueryFunction((PetscObject)dm, convname, &conv)); in DMConvert()
4120 PetscCall(DMCreate(PetscObjectComm((PetscObject)dm), &B)); in DMConvert()
4123 PetscCall(PetscStrlcat(convname, ((PetscObject)dm)->type_name, sizeof(convname))); in DMConvert()
4140 if (dm->ops->convert) conv = dm->ops->convert; in DMConvert()
4145 …RQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_SUP, "No conversion possible between DM types %s an… in DMConvert()
4148 PetscCall(PetscLogEventBegin(DM_Convert, dm, 0, 0, 0)); in DMConvert()
4149 PetscCall((*conv)(dm, newtype, M)); in DMConvert()
4154 PetscCall(DMGetPeriodicity(dm, &maxCell, &Lstart, &L)); in DMConvert()
4156 (*M)->prealloc_only = dm->prealloc_only; in DMConvert()
4158 PetscCall(PetscStrallocpy(dm->vectype, (char **)&(*M)->vectype)); in DMConvert()
4160 PetscCall(PetscStrallocpy(dm->mattype, (char **)&(*M)->mattype)); in DMConvert()
4162 PetscCall(PetscLogEventEnd(DM_Convert, dm, 0, 0, 0)); in DMConvert()
4302 PetscErrorCode DMPrintLocalVec(DM dm, const char name[], PetscReal tol, Vec X) in DMPrintLocalVec() argument
4310 PetscCallMPI(MPI_Comm_size(PetscObjectComm((PetscObject)dm), &size)); in DMPrintLocalVec()
4314 PetscCall(PetscPrintf(PetscObjectComm((PetscObject)dm), "%s:\n", name)); in DMPrintLocalVec()
4319 …PetscCall(VecCreateMPIWithArray(PetscObjectComm((PetscObject)dm), bs, localSize, PETSC_DETERMINE, … in DMPrintLocalVec()
4323 PetscCall(VecView(xglob, PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)dm)))); in DMPrintLocalVec()
4351 PetscErrorCode DMGetLocalSection(DM dm, PetscSection *section) in DMGetLocalSection() argument
4354 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetLocalSection()
4356 if (!dm->localSection && dm->ops->createlocalsection) { in DMGetLocalSection()
4359 if (dm->setfromoptionscalled) { in DMGetLocalSection()
4360 PetscObject obj = (PetscObject)dm; in DMGetLocalSection()
4367 for (d = 0; d < dm->Nds; ++d) { in DMGetLocalSection()
4368 PetscCall(PetscDSSetFromOptions(dm->probs[d].ds)); in DMGetLocalSection()
4369 if (flg) PetscCall(PetscDSView(dm->probs[d].ds, viewer)); in DMGetLocalSection()
4377 PetscUseTypeMethod(dm, createlocalsection); in DMGetLocalSection()
4378 …if (dm->localSection) PetscCall(PetscObjectViewFromOptions((PetscObject)dm->localSection, NULL, "-… in DMGetLocalSection()
4380 *section = dm->localSection; in DMGetLocalSection()
4398 PetscErrorCode DMSetLocalSection(DM dm, PetscSection section) in DMSetLocalSection() argument
4404 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetLocalSection()
4407 PetscCall(PetscSectionDestroy(&dm->localSection)); in DMSetLocalSection()
4408 dm->localSection = section; in DMSetLocalSection()
4409 if (section) PetscCall(PetscSectionGetNumFields(dm->localSection, &numFields)); in DMSetLocalSection()
4411 PetscCall(DMSetNumFields(dm, numFields)); in DMSetLocalSection()
4416 PetscCall(PetscSectionGetFieldName(dm->localSection, f, &name)); in DMSetLocalSection()
4417 PetscCall(DMGetField(dm, f, NULL, &disc)); in DMSetLocalSection()
4423 PetscCall(PetscSectionDestroy(&dm->globalSection)); in DMSetLocalSection()
4424 PetscCall(PetscSFDestroy(&dm->sectionSF)); in DMSetLocalSection()
4425 PetscCall(PetscSFCreate(PetscObjectComm((PetscObject)dm), &dm->sectionSF)); in DMSetLocalSection()
4428 PetscCall(DMClearGlobalVectors(dm)); in DMSetLocalSection()
4429 PetscCall(DMClearLocalVectors(dm)); in DMSetLocalSection()
4430 PetscCall(DMClearNamedGlobalVectors(dm)); in DMSetLocalSection()
4431 PetscCall(DMClearNamedLocalVectors(dm)); in DMSetLocalSection()
4449 PetscErrorCode DMCreateSectionPermutation(DM dm, IS *perm, PetscBT *blockStarts) in DMCreateSectionPermutation() argument
4454 PetscTryTypeMethod(dm, createsectionpermutation, perm, blockStarts); in DMCreateSectionPermutation()
4478 PetscErrorCode DMGetDefaultConstraints(DM dm, PetscSection *section, Mat *mat, Vec *bias) in DMGetDefaultConstraints() argument
4481 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetDefaultConstraints()
4482 …if (!dm->defaultConstraint.section && !dm->defaultConstraint.mat && dm->ops->createdefaultconstrai… in DMGetDefaultConstraints()
4483 if (section) *section = dm->defaultConstraint.section; in DMGetDefaultConstraints()
4484 if (mat) *mat = dm->defaultConstraint.mat; in DMGetDefaultConstraints()
4485 if (bias) *bias = dm->defaultConstraint.bias; in DMGetDefaultConstraints()
4511 PetscErrorCode DMSetDefaultConstraints(DM dm, PetscSection section, Mat mat, Vec bias) in DMSetDefaultConstraints() argument
4516 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetDefaultConstraints()
4533 PetscCall(PetscSectionDestroy(&dm->defaultConstraint.section)); in DMSetDefaultConstraints()
4534 dm->defaultConstraint.section = section; in DMSetDefaultConstraints()
4536 PetscCall(MatDestroy(&dm->defaultConstraint.mat)); in DMSetDefaultConstraints()
4537 dm->defaultConstraint.mat = mat; in DMSetDefaultConstraints()
4539 PetscCall(VecDestroy(&dm->defaultConstraint.bias)); in DMSetDefaultConstraints()
4540 dm->defaultConstraint.bias = bias; in DMSetDefaultConstraints()
4557 static PetscErrorCode DMDefaultSectionCheckConsistency_Internal(DM dm, PetscSection localSection, P… in DMDefaultSectionCheckConsistency_Internal() argument
4567 PetscCall(PetscObjectGetComm((PetscObject)dm, &comm)); in DMDefaultSectionCheckConsistency_Internal()
4568 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMDefaultSectionCheckConsistency_Internal()
4615 PetscCall(DMView(dm, NULL)); in DMDefaultSectionCheckConsistency_Internal()
4622 PetscErrorCode DMGetIsoperiodicPointSF_Internal(DM dm, PetscSF *sf) in DMGetIsoperiodicPointSF_Internal() argument
4627 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetIsoperiodicPointSF_Internal()
4629 PetscCall(PetscObjectQueryFunction((PetscObject)dm, "DMGetIsoperiodicPointSF_C", &f)); in DMGetIsoperiodicPointSF_Internal()
4630 if (f) PetscCall(f(dm, sf)); in DMGetIsoperiodicPointSF_Internal()
4631 else *sf = dm->sf; in DMGetIsoperiodicPointSF_Internal()
4653 PetscErrorCode DMGetGlobalSection(DM dm, PetscSection *section) in DMGetGlobalSection() argument
4656 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetGlobalSection()
4658 if (!dm->globalSection) { in DMGetGlobalSection()
4662 PetscCall(DMGetLocalSection(dm, &s)); in DMGetGlobalSection()
4663 …PetscCheck(s, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "DM must have a default … in DMGetGlobalSection()
4664 …PetscCheck(dm->sf, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "DM must have a poi… in DMGetGlobalSection()
4665 PetscCall(DMGetIsoperiodicPointSF_Internal(dm, &sf)); in DMGetGlobalSection()
4666 …PetscCall(PetscSectionCreateGlobalSection(s, sf, PETSC_TRUE, PETSC_FALSE, PETSC_FALSE, &dm->global… in DMGetGlobalSection()
4667 PetscCall(PetscLayoutDestroy(&dm->map)); in DMGetGlobalSection()
4668 …PetscCall(PetscSectionGetValueLayout(PetscObjectComm((PetscObject)dm), dm->globalSection, &dm->map… in DMGetGlobalSection()
4669 PetscCall(PetscSectionViewFromOptions(dm->globalSection, NULL, "-global_section_view")); in DMGetGlobalSection()
4671 *section = dm->globalSection; in DMGetGlobalSection()
4689 PetscErrorCode DMSetGlobalSection(DM dm, PetscSection section) in DMSetGlobalSection() argument
4692 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetGlobalSection()
4695 PetscCall(PetscSectionDestroy(&dm->globalSection)); in DMSetGlobalSection()
4696 dm->globalSection = section; in DMSetGlobalSection()
4698 if (section) PetscCall(DMDefaultSectionCheckConsistency_Internal(dm, dm->localSection, section)); in DMSetGlobalSection()
4701 PetscCall(PetscSFDestroy(&dm->sectionSF)); in DMSetGlobalSection()
4702 PetscCall(PetscSFCreate(PetscObjectComm((PetscObject)dm), &dm->sectionSF)); in DMSetGlobalSection()
4703 PetscCall(DMClearGlobalVectors(dm)); in DMSetGlobalSection()
4704 PetscCall(DMClearNamedGlobalVectors(dm)); in DMSetGlobalSection()
4725 PetscErrorCode DMGetSectionSF(DM dm, PetscSF *sf) in DMGetSectionSF() argument
4730 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetSectionSF()
4732 if (!dm->sectionSF) PetscCall(PetscSFCreate(PetscObjectComm((PetscObject)dm), &dm->sectionSF)); in DMGetSectionSF()
4733 PetscCall(PetscSFGetGraph(dm->sectionSF, &nroots, NULL, NULL, NULL)); in DMGetSectionSF()
4737 PetscCall(DMGetLocalSection(dm, &section)); in DMGetSectionSF()
4739 PetscCall(DMGetGlobalSection(dm, &gSection)); in DMGetSectionSF()
4740 PetscCall(DMCreateSectionSF(dm, section, gSection)); in DMGetSectionSF()
4746 *sf = dm->sectionSF; in DMGetSectionSF()
4764 PetscErrorCode DMSetSectionSF(DM dm, PetscSF sf) in DMSetSectionSF() argument
4767 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetSectionSF()
4770 PetscCall(PetscSFDestroy(&dm->sectionSF)); in DMSetSectionSF()
4771 dm->sectionSF = sf; in DMSetSectionSF()
4797 PetscErrorCode DMCreateSectionSF(DM dm, PetscSection localSection, PetscSection globalSection) in DMCreateSectionSF() argument
4800 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateSectionSF()
4801 PetscCall(PetscSFSetGraphSection(dm->sectionSF, localSection, globalSection)); in DMCreateSectionSF()
4823 PetscErrorCode DMGetPointSF(DM dm, PetscSF *sf) in DMGetPointSF() argument
4826 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetPointSF()
4828 *sf = dm->sf; in DMGetPointSF()
4845 PetscErrorCode DMSetPointSF(DM dm, PetscSF sf) in DMSetPointSF() argument
4848 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetPointSF()
4851 PetscCall(PetscSFDestroy(&dm->sf)); in DMSetPointSF()
4852 dm->sf = sf; in DMSetPointSF()
4872 PetscErrorCode DMGetNaturalSF(DM dm, PetscSF *sf) in DMGetNaturalSF() argument
4875 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetNaturalSF()
4877 *sf = dm->sfNatural; in DMGetNaturalSF()
4892 PetscErrorCode DMSetNaturalSF(DM dm, PetscSF sf) in DMSetNaturalSF() argument
4895 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetNaturalSF()
4898 PetscCall(PetscSFDestroy(&dm->sfNatural)); in DMSetNaturalSF()
4899 dm->sfNatural = sf; in DMSetNaturalSF()
4903 static PetscErrorCode DMSetDefaultAdjacency_Private(DM dm, PetscInt f, PetscObject disc) in DMSetDefaultAdjacency_Private() argument
4910 PetscCall(DMSetAdjacency(dm, f, PETSC_FALSE, PETSC_TRUE)); in DMSetDefaultAdjacency_Private()
4912 PetscCall(DMSetAdjacency(dm, f, PETSC_TRUE, PETSC_FALSE)); in DMSetDefaultAdjacency_Private()
4914 PetscCall(DMSetAdjacency(dm, f, PETSC_FALSE, PETSC_TRUE)); in DMSetDefaultAdjacency_Private()
4919 static PetscErrorCode DMFieldEnlarge_Static(DM dm, PetscInt NfNew) in DMFieldEnlarge_Static() argument
4922 PetscInt Nf = dm->Nf, f; in DMFieldEnlarge_Static()
4927 for (f = 0; f < Nf; ++f) tmpr[f] = dm->fields[f]; in DMFieldEnlarge_Static()
4933 PetscCall(PetscFree(dm->fields)); in DMFieldEnlarge_Static()
4934 dm->Nf = NfNew; in DMFieldEnlarge_Static()
4935 dm->fields = tmpr; in DMFieldEnlarge_Static()
4951 PetscErrorCode DMClearFields(DM dm) in DMClearFields() argument
4956 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMClearFields()
4957 if (!dm->fields) PetscFunctionReturn(PETSC_SUCCESS); // DMDA does not use fields field in DM in DMClearFields()
4958 for (f = 0; f < dm->Nf; ++f) { in DMClearFields()
4959 PetscCall(PetscObjectDestroy(&dm->fields[f].disc)); in DMClearFields()
4960 PetscCall(DMLabelDestroy(&dm->fields[f].label)); in DMClearFields()
4962 PetscCall(PetscFree(dm->fields)); in DMClearFields()
4963 dm->fields = NULL; in DMClearFields()
4964 dm->Nf = 0; in DMClearFields()
4983 PetscErrorCode DMGetNumFields(DM dm, PetscInt *numFields) in DMGetNumFields() argument
4986 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetNumFields()
4988 *numFields = dm->Nf; in DMGetNumFields()
5005 PetscErrorCode DMSetNumFields(DM dm, PetscInt numFields) in DMSetNumFields() argument
5010 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetNumFields()
5011 PetscCall(DMGetNumFields(dm, &Nf)); in DMSetNumFields()
5015 PetscCall(PetscContainerCreate(PetscObjectComm((PetscObject)dm), &obj)); in DMSetNumFields()
5016 PetscCall(DMAddField(dm, NULL, (PetscObject)obj)); in DMSetNumFields()
5039 PetscErrorCode DMGetField(DM dm, PetscInt f, DMLabel *label, PetscObject *disc) in DMGetField() argument
5042 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetField()
5044 …>= 0) && (f < dm->Nf), PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Field number %" PetscInt_FMT " … in DMGetField()
5045 if (!dm->fields) { in DMGetField()
5049 if (label) *label = dm->fields[f].label; in DMGetField()
5050 if (disc) *disc = dm->fields[f].disc; in DMGetField()
5056 PetscErrorCode DMSetField_Internal(DM dm, PetscInt f, DMLabel label, PetscObject disc) in DMSetField_Internal() argument
5059 PetscCall(DMFieldEnlarge_Static(dm, f + 1)); in DMSetField_Internal()
5060 PetscCall(DMLabelDestroy(&dm->fields[f].label)); in DMSetField_Internal()
5061 PetscCall(PetscObjectDestroy(&dm->fields[f].disc)); in DMSetField_Internal()
5062 dm->fields[f].label = label; in DMSetField_Internal()
5063 dm->fields[f].disc = disc; in DMSetField_Internal()
5085 PetscErrorCode DMSetField(DM dm, PetscInt f, DMLabel label, PetscObject disc) in DMSetField() argument
5088 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetField()
5092 PetscCall(DMSetField_Internal(dm, f, label, disc)); in DMSetField()
5093 PetscCall(DMSetDefaultAdjacency_Private(dm, f, disc)); in DMSetField()
5094 PetscCall(DMClearDS(dm)); in DMSetField()
5123 PetscErrorCode DMAddField(DM dm, DMLabel label, PetscObject disc) in DMAddField() argument
5125 PetscInt Nf = dm->Nf; in DMAddField()
5128 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMAddField()
5131 PetscCall(DMFieldEnlarge_Static(dm, Nf + 1)); in DMAddField()
5132 dm->fields[Nf].label = label; in DMAddField()
5133 dm->fields[Nf].disc = disc; in DMAddField()
5136 PetscCall(DMSetDefaultAdjacency_Private(dm, Nf, disc)); in DMAddField()
5137 PetscCall(DMClearDS(dm)); in DMAddField()
5155 PetscErrorCode DMSetFieldAvoidTensor(DM dm, PetscInt f, PetscBool avoidTensor) in DMSetFieldAvoidTensor() argument
5158 … && (f < dm->Nf), PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Field %" PetscInt_F… in DMSetFieldAvoidTensor()
5159 dm->fields[f].avoidTensor = avoidTensor; in DMSetFieldAvoidTensor()
5179 PetscErrorCode DMGetFieldAvoidTensor(DM dm, PetscInt f, PetscBool *avoidTensor) in DMGetFieldAvoidTensor() argument
5182 … && (f < dm->Nf), PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Field %" PetscInt_F… in DMGetFieldAvoidTensor()
5183 *avoidTensor = dm->fields[f].avoidTensor; in DMGetFieldAvoidTensor()
5204 PetscErrorCode DMCopyFields(DM dm, PetscInt minDegree, PetscInt maxDegree, DM newdm) in DMCopyFields() argument
5209 if (dm == newdm) PetscFunctionReturn(PETSC_SUCCESS); in DMCopyFields()
5210 PetscCall(DMGetNumFields(dm, &Nf)); in DMCopyFields()
5218 PetscCall(DMGetField(dm, f, &label, &field)); in DMCopyFields()
5229 PetscCall(DMGetAdjacency(dm, f, &useCone, &useClosure)); in DMCopyFields()
5233 if (dm->nullspaceConstructors) { in DMCopyFields()
5265 PetscErrorCode DMGetAdjacency(DM dm, PetscInt f, PetscBool *useCone, PetscBool *useClosure) in DMGetAdjacency() argument
5268 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetAdjacency()
5272 if (useCone) *useCone = dm->adjacency[0]; in DMGetAdjacency()
5273 if (useClosure) *useClosure = dm->adjacency[1]; in DMGetAdjacency()
5277 PetscCall(DMGetNumFields(dm, &Nf)); in DMGetAdjacency()
5279 if (useCone) *useCone = dm->fields[f].adjacency[0]; in DMGetAdjacency()
5280 if (useClosure) *useClosure = dm->fields[f].adjacency[1]; in DMGetAdjacency()
5308 PetscErrorCode DMSetAdjacency(DM dm, PetscInt f, PetscBool useCone, PetscBool useClosure) in DMSetAdjacency() argument
5311 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetAdjacency()
5313 dm->adjacency[0] = useCone; in DMSetAdjacency()
5314 dm->adjacency[1] = useClosure; in DMSetAdjacency()
5318 PetscCall(DMGetNumFields(dm, &Nf)); in DMSetAdjacency()
5320 dm->fields[f].adjacency[0] = useCone; in DMSetAdjacency()
5321 dm->fields[f].adjacency[1] = useClosure; in DMSetAdjacency()
5349 PetscErrorCode DMGetBasicAdjacency(DM dm, PetscBool *useCone, PetscBool *useClosure) in DMGetBasicAdjacency() argument
5354 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetBasicAdjacency()
5357 PetscCall(DMGetNumFields(dm, &Nf)); in DMGetBasicAdjacency()
5359 PetscCall(DMGetAdjacency(dm, PETSC_DEFAULT, useCone, useClosure)); in DMGetBasicAdjacency()
5361 PetscCall(DMGetAdjacency(dm, 0, useCone, useClosure)); in DMGetBasicAdjacency()
5387 PetscErrorCode DMSetBasicAdjacency(DM dm, PetscBool useCone, PetscBool useClosure) in DMSetBasicAdjacency() argument
5392 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetBasicAdjacency()
5393 PetscCall(DMGetNumFields(dm, &Nf)); in DMSetBasicAdjacency()
5395 PetscCall(DMSetAdjacency(dm, PETSC_DEFAULT, useCone, useClosure)); in DMSetBasicAdjacency()
5397 PetscCall(DMSetAdjacency(dm, 0, useCone, useClosure)); in DMSetBasicAdjacency()
5402 PetscErrorCode DMCompleteBCLabels_Internal(DM dm) in DMCompleteBCLabels_Internal() argument
5414 PetscCall(PetscObjectGetComm((PetscObject)dm, &comm)); in DMCompleteBCLabels_Internal()
5417 PetscCall(DMGetNumDS(dm, &Nds)); in DMCompleteBCLabels_Internal()
5422 PetscCall(DMGetRegionNumDS(dm, s, NULL, NULL, &dsBC, NULL)); in DMCompleteBCLabels_Internal()
5432 PetscCall(DMGetRegionNumDS(dm, s, NULL, NULL, &dsBC, NULL)); in DMCompleteBCLabels_Internal()
5441 PetscCall(DMGetField(dm, field, NULL, &obj)); in DMCompleteBCLabels_Internal()
5475 PetscCall(DMGetLabel(dm, &recvNames[l * gmaxLen], &glabels[gl])); in DMCompleteBCLabels_Internal()
5479 PetscCall(DMConvert(dm, DMPLEX, &plex)); in DMCompleteBCLabels_Internal()
5490 static PetscErrorCode DMDSEnlarge_Static(DM dm, PetscInt NdsNew) in DMDSEnlarge_Static() argument
5493 PetscInt Nds = dm->Nds, s; in DMDSEnlarge_Static()
5498 for (s = 0; s < Nds; ++s) tmpd[s] = dm->probs[s]; in DMDSEnlarge_Static()
5504 PetscCall(PetscFree(dm->probs)); in DMDSEnlarge_Static()
5505 dm->Nds = NdsNew; in DMDSEnlarge_Static()
5506 dm->probs = tmpd; in DMDSEnlarge_Static()
5525 PetscErrorCode DMGetNumDS(DM dm, PetscInt *Nds) in DMGetNumDS() argument
5528 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetNumDS()
5530 *Nds = dm->Nds; in DMGetNumDS()
5546 PetscErrorCode DMClearDS(DM dm) in DMClearDS() argument
5551 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMClearDS()
5552 for (s = 0; s < dm->Nds; ++s) { in DMClearDS()
5553 PetscCall(PetscDSDestroy(&dm->probs[s].ds)); in DMClearDS()
5554 PetscCall(PetscDSDestroy(&dm->probs[s].dsIn)); in DMClearDS()
5555 PetscCall(DMLabelDestroy(&dm->probs[s].label)); in DMClearDS()
5556 PetscCall(ISDestroy(&dm->probs[s].fields)); in DMClearDS()
5558 PetscCall(PetscFree(dm->probs)); in DMClearDS()
5559 dm->probs = NULL; in DMClearDS()
5560 dm->Nds = 0; in DMClearDS()
5582 PetscErrorCode DMGetDS(DM dm, PetscDS *ds) in DMGetDS() argument
5585 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetDS()
5587 …PetscCheck(dm->Nds > 0, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Need to call … in DMGetDS()
5588 *ds = dm->probs[0].ds; in DMGetDS()
5609 PetscErrorCode DMGetCellDS(DM dm, PetscInt point, PetscDS *ds, PetscDS *dsIn) in DMGetCellDS() argument
5615 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetCellDS()
5621 for (s = 0; s < dm->Nds; ++s) { in DMGetCellDS()
5624 if (!dm->probs[s].label) { in DMGetCellDS()
5625 dsDef = dm->probs[s].ds; in DMGetCellDS()
5627 PetscCall(DMLabelGetValue(dm->probs[s].label, point, &val)); in DMGetCellDS()
5629 if (ds) *ds = dm->probs[s].ds; in DMGetCellDS()
5630 if (dsIn) *dsIn = dm->probs[s].dsIn; in DMGetCellDS()
5662 PetscErrorCode DMGetRegionDS(DM dm, DMLabel label, IS *fields, PetscDS *ds, PetscDS *dsIn) in DMGetRegionDS() argument
5664 PetscInt Nds = dm->Nds, s; in DMGetRegionDS()
5667 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetRegionDS()
5682 if (dm->probs[s].label == label || !dm->probs[s].label) { in DMGetRegionDS()
5683 if (fields) *fields = dm->probs[s].fields; in DMGetRegionDS()
5684 if (ds) *ds = dm->probs[s].ds; in DMGetRegionDS()
5685 if (dsIn) *dsIn = dm->probs[s].dsIn; in DMGetRegionDS()
5686 if (dm->probs[s].label) PetscFunctionReturn(PETSC_SUCCESS); in DMGetRegionDS()
5712 PetscErrorCode DMSetRegionDS(DM dm, DMLabel label, IS fields, PetscDS ds, PetscDS dsIn) in DMSetRegionDS() argument
5714 PetscInt Nds = dm->Nds, s; in DMSetRegionDS()
5717 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetRegionDS()
5723 if (dm->probs[s].label == label) { in DMSetRegionDS()
5724 PetscCall(PetscDSDestroy(&dm->probs[s].ds)); in DMSetRegionDS()
5725 PetscCall(PetscDSDestroy(&dm->probs[s].dsIn)); in DMSetRegionDS()
5726 dm->probs[s].ds = ds; in DMSetRegionDS()
5727 dm->probs[s].dsIn = dsIn; in DMSetRegionDS()
5731 PetscCall(DMDSEnlarge_Static(dm, Nds + 1)); in DMSetRegionDS()
5738 for (s = Nds - 1; s >= 0; --s) dm->probs[s + 1] = dm->probs[s]; in DMSetRegionDS()
5741 dm->probs[Nds].label = label; in DMSetRegionDS()
5742 dm->probs[Nds].fields = fields; in DMSetRegionDS()
5743 dm->probs[Nds].ds = ds; in DMSetRegionDS()
5744 dm->probs[Nds].dsIn = dsIn; in DMSetRegionDS()
5767 PetscErrorCode DMGetRegionNumDS(DM dm, PetscInt num, DMLabel *label, IS *fields, PetscDS *ds, Petsc… in DMGetRegionNumDS() argument
5772 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetRegionNumDS()
5773 PetscCall(DMGetNumDS(dm, &Nds)); in DMGetRegionNumDS()
5777 *label = dm->probs[num].label; in DMGetRegionNumDS()
5781 *fields = dm->probs[num].fields; in DMGetRegionNumDS()
5785 *ds = dm->probs[num].ds; in DMGetRegionNumDS()
5789 *dsIn = dm->probs[num].dsIn; in DMGetRegionNumDS()
5811 PetscErrorCode DMSetRegionNumDS(DM dm, PetscInt num, DMLabel label, IS fields, PetscDS ds, PetscDS … in DMSetRegionNumDS() argument
5816 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetRegionNumDS()
5818 PetscCall(DMGetNumDS(dm, &Nds)); in DMSetRegionNumDS()
5821 PetscCall(DMLabelDestroy(&dm->probs[num].label)); in DMSetRegionNumDS()
5822 dm->probs[num].label = label; in DMSetRegionNumDS()
5826 PetscCall(ISDestroy(&dm->probs[num].fields)); in DMSetRegionNumDS()
5827 dm->probs[num].fields = fields; in DMSetRegionNumDS()
5832 PetscCall(PetscDSDestroy(&dm->probs[num].ds)); in DMSetRegionNumDS()
5833 dm->probs[num].ds = ds; in DMSetRegionNumDS()
5838 PetscCall(PetscDSDestroy(&dm->probs[num].dsIn)); in DMSetRegionNumDS()
5839 dm->probs[num].dsIn = dsIn; in DMSetRegionNumDS()
5860 PetscErrorCode DMFindRegionNum(DM dm, PetscDS ds, PetscInt *num) in DMFindRegionNum() argument
5865 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMFindRegionNum()
5868 PetscCall(DMGetNumDS(dm, &Nds)); in DMFindRegionNum()
5870 if (ds == dm->probs[n].ds) break; in DMFindRegionNum()
5897 PetscErrorCode DMCreateFEDefault(DM dm, PetscInt Nc, const char prefix[], PetscInt qorder, PetscFE … in DMCreateFEDefault() argument
5903 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateFEDefault()
5904 PetscValidLogicalCollectiveInt(dm, Nc, 2); in DMCreateFEDefault()
5906 PetscValidLogicalCollectiveInt(dm, qorder, 4); in DMCreateFEDefault()
5908 PetscCall(DMGetDimension(dm, &dim)); in DMCreateFEDefault()
5909 PetscCall(DMPlexGetHeightStratum(dm, 0, &cStart, NULL)); in DMCreateFEDefault()
5910 PetscCall(DMPlexGetCellType(dm, cStart, &ct)); in DMCreateFEDefault()
5933 PetscErrorCode DMCreateDS(DM dm) in DMCreateDS() argument
5938 PetscInt dE, Nf = dm->Nf, f, s, Nl, l, Ndef, k; in DMCreateDS()
5942 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateDS()
5943 if (!dm->fields) PetscFunctionReturn(PETSC_SUCCESS); in DMCreateDS()
5944 PetscCall(PetscObjectGetComm((PetscObject)dm, &comm)); in DMCreateDS()
5945 PetscCall(DMGetCoordinateDim(dm, &dE)); in DMCreateDS()
5947 PetscCall(PetscFree2(dm->nullspaceConstructors, dm->nearnullspaceConstructors)); in DMCreateDS()
5948 PetscCall(PetscCalloc2(Nf, &dm->nullspaceConstructors, Nf, &dm->nearnullspaceConstructors)); in DMCreateDS()
5954 DMLabel label = dm->fields[f].label; in DMCreateDS()
5962 PetscCall(PetscObjectGetClassId(dm->fields[f].disc, &id)); in DMCreateDS()
5966 PetscCall(DMGetCeed(dm, &ceed)); in DMCreateDS()
5967 PetscCall(PetscFESetCeed((PetscFE)dm->fields[f].disc, ceed)); in DMCreateDS()
5981 PetscCall(DMGetRegionDS(dm, NULL, NULL, &dsDef, NULL)); in DMCreateDS()
5987 if (!dm->fields[f].label) ++nf; in DMCreateDS()
5991 if (!dm->fields[f].label) fld[nf++] = f; in DMCreateDS()
5998 PetscCall(DMSetRegionDS(dm, NULL, fields, dsDef, NULL)); in DMCreateDS()
6002 PetscCall(DMGetRegionDS(dm, NULL, NULL, &dsDef, NULL)); in DMCreateDS()
6013 PetscCall(DMConvert(dm, DMPLEX, &plex)); in DMCreateDS()
6039 if (!dm->fields[f].label) fields[nf++] = f; in DMCreateDS()
6046 PetscCall(DMSetRegionDS(dm, cellLabel, fieldIS, dsDef, NULL)); in DMCreateDS()
6065 if (label == dm->fields[f].label || !dm->fields[f].label) ++nf; in DMCreateDS()
6068 if (label == dm->fields[f].label || !dm->fields[f].label) fld[nf++] = f; in DMCreateDS()
6081 PetscCall(DMPlexGetCellType(dm, lStart, &ct)); in DMCreateDS()
6099 if (label == dm->fields[f].label || !dm->fields[f].label) { in DMCreateDS()
6100 if (label == dm->fields[f].label) { in DMCreateDS()
6112 PetscCall(DMSetRegionDS(dm, label, fields, ds, dsIn)); in DMCreateDS()
6119 for (s = 0; s < dm->Nds; ++s) { in DMCreateDS()
6120 PetscDS ds = dm->probs[s].ds; in DMCreateDS()
6121 PetscDS dsIn = dm->probs[s].dsIn; in DMCreateDS()
6122 IS fields = dm->probs[s].fields; in DMCreateDS()
6132 PetscObject disc = dm->fields[fld[f]].disc; in DMCreateDS()
6160 PetscCall(PetscOptionsGetInt(NULL, ((PetscObject)dm)->prefix, "-dm_ds_jet_degree", &k, &flg)); in DMCreateDS()
6162 for (s = 0; s < dm->Nds; ++s) { in DMCreateDS()
6163 PetscDS ds = dm->probs[s].ds; in DMCreateDS()
6164 PetscDS dsIn = dm->probs[s].dsIn; in DMCreateDS()
6176 for (s = 0; s < dm->Nds; ++s) { in DMCreateDS()
6177 if (dm->setfromoptionscalled) { in DMCreateDS()
6178 PetscCall(PetscDSSetFromOptions(dm->probs[s].ds)); in DMCreateDS()
6179 if (dm->probs[s].dsIn) PetscCall(PetscDSSetFromOptions(dm->probs[s].dsIn)); in DMCreateDS()
6181 PetscCall(PetscDSSetUp(dm->probs[s].ds)); in DMCreateDS()
6182 if (dm->probs[s].dsIn) PetscCall(PetscDSSetUp(dm->probs[s].dsIn)); in DMCreateDS()
6199 PetscErrorCode DMUseTensorOrder(DM dm, PetscBool tensor) in DMUseTensorOrder() argument
6205 PetscCall(PetscObjectTypeCompare((PetscObject)dm, DMPLEX, &isPlex)); in DMUseTensorOrder()
6206 PetscCall(DMGetNumFields(dm, &Nf)); in DMUseTensorOrder()
6211 PetscCall(DMGetField(dm, f, NULL, &obj)); in DMUseTensorOrder()
6223 if (reorder && isPlex) PetscCall(DMPlexSetClosurePermutationTensor(dm, PETSC_DETERMINE, NULL)); in DMUseTensorOrder()
6227 PetscCall(DMGetLocalSection(dm, &s)); in DMUseTensorOrder()
6253 PetscErrorCode DMComputeExactSolution(DM dm, PetscReal time, Vec u, Vec u_t) in DMComputeExactSolution() argument
6261 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMComputeExactSolution()
6264 PetscCall(DMGetLocalVector(dm, &locu)); in DMComputeExactSolution()
6269 PetscCall(DMGetLocalVector(dm, &locu_t)); in DMComputeExactSolution()
6272 PetscCall(DMGetNumFields(dm, &Nf)); in DMComputeExactSolution()
6274 PetscCall(DMGetNumDS(dm, &Nds)); in DMComputeExactSolution()
6282 PetscCall(DMGetRegionNumDS(dm, s, &label, &fieldIS, &ds, NULL)); in DMComputeExactSolution()
6289 …if (label) PetscCall(DMProjectFunctionLabelLocal(dm, time, label, 1, &id, 0, NULL, exacts, ectxs, … in DMComputeExactSolution()
6290 else PetscCall(DMProjectFunctionLocal(dm, time, exacts, ectxs, INSERT_ALL_VALUES, locu)); in DMComputeExactSolution()
6296 …if (label) PetscCall(DMProjectFunctionLabelLocal(dm, time, label, 1, &id, 0, NULL, exacts, ectxs, … in DMComputeExactSolution()
6297 else PetscCall(DMProjectFunctionLocal(dm, time, exacts, ectxs, INSERT_ALL_VALUES, locu_t)); in DMComputeExactSolution()
6311 PetscCall(DMLocalToGlobalBegin(dm, locu, INSERT_ALL_VALUES, u)); in DMComputeExactSolution()
6312 PetscCall(DMLocalToGlobalEnd(dm, locu, INSERT_ALL_VALUES, u)); in DMComputeExactSolution()
6313 PetscCall(DMRestoreLocalVector(dm, &locu)); in DMComputeExactSolution()
6316 PetscCall(DMLocalToGlobalBegin(dm, locu_t, INSERT_ALL_VALUES, u_t)); in DMComputeExactSolution()
6317 PetscCall(DMLocalToGlobalEnd(dm, locu_t, INSERT_ALL_VALUES, u_t)); in DMComputeExactSolution()
6318 PetscCall(DMRestoreLocalVector(dm, &locu_t)); in DMComputeExactSolution()
6323 static PetscErrorCode DMTransferDS_Internal(DM dm, DMLabel label, IS fields, PetscInt minDegree, Pe… in DMTransferDS_Internal() argument
6329 PetscCall(PetscDSCopy(ds, minDegree, maxDegree, dm, dsNew)); in DMTransferDS_Internal()
6332 PetscCall(PetscDSCopy(dsIn, minDegree, maxDegree, dm, dsInNew)); in DMTransferDS_Internal()
6334 PetscCall(DMSetRegionDS(dm, label, fields, dsNew, dsInNew)); in DMTransferDS_Internal()
6357 PetscErrorCode DMCopyDS(DM dm, PetscInt minDegree, PetscInt maxDegree, DM newdm) in DMCopyDS() argument
6362 if (dm == newdm) PetscFunctionReturn(PETSC_SUCCESS); in DMCopyDS()
6363 PetscCall(DMGetNumDS(dm, &Nds)); in DMCopyDS()
6371 PetscCall(DMGetRegionNumDS(dm, s, &label, &fields, &ds, &dsIn)); in DMCopyDS()
6408 PetscErrorCode DMCopyDisc(DM dm, DM newdm) in DMCopyDisc() argument
6411 PetscCall(DMCopyFields(dm, PETSC_DETERMINE, PETSC_DETERMINE, newdm)); in DMCopyDisc()
6412 PetscCall(DMCopyDS(dm, PETSC_DETERMINE, PETSC_DETERMINE, newdm)); in DMCopyDisc()
6431 PetscErrorCode DMGetDimension(DM dm, PetscInt *dim) in DMGetDimension() argument
6434 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetDimension()
6436 *dim = dm->dim; in DMGetDimension()
6453 PetscErrorCode DMSetDimension(DM dm, PetscInt dim) in DMSetDimension() argument
6459 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetDimension()
6460 PetscValidLogicalCollectiveInt(dm, dim, 2); in DMSetDimension()
6461 dm->dim = dim; in DMSetDimension()
6462 if (dm->dim >= 0) { in DMSetDimension()
6463 PetscCall(DMGetNumDS(dm, &Nds)); in DMSetDimension()
6465 PetscCall(DMGetRegionNumDS(dm, n, NULL, NULL, &ds, NULL)); in DMSetDimension()
6494 PetscErrorCode DMGetDimPoints(DM dm, PetscInt dim, PetscInt *pStart, PetscInt *pEnd) in DMGetDimPoints() argument
6499 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetDimPoints()
6500 PetscCall(DMGetDimension(dm, &d)); in DMGetDimPoints()
6501 …PetscCheck((dim >= 0) && (dim <= d), PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "… in DMGetDimPoints()
6502 PetscUseTypeMethod(dm, getdimpoints, dim, pStart, pEnd); in DMGetDimPoints()
6526 PetscErrorCode DMGetOutputDM(DM dm, DM *odm) in DMGetOutputDM() argument
6534 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetOutputDM()
6536 PetscCall(DMGetLocalSection(dm, &section)); in DMGetOutputDM()
6539 PetscCall(DMPlexGetIsoperiodicFaceSF(dm, &num_face_sfs, NULL)); in DMGetOutputDM()
6541 …CallMPI(MPIU_Allreduce(&newDM, &gnewDM, 1, MPI_C_BOOL, MPI_LOR, PetscObjectComm((PetscObject)dm))); in DMGetOutputDM()
6543 *odm = dm; in DMGetOutputDM()
6546 if (!dm->dmBC) { in DMGetOutputDM()
6549 PetscBool usePerm = dm->ignorePermOutput ? PETSC_FALSE : PETSC_TRUE; in DMGetOutputDM()
6551 PetscCall(DMClone(dm, &dm->dmBC)); in DMGetOutputDM()
6552 PetscCall(DMCopyDisc(dm, dm->dmBC)); in DMGetOutputDM()
6554 PetscCall(DMSetLocalSection(dm->dmBC, newSection)); in DMGetOutputDM()
6556 PetscCall(DMGetNaturalSF(dm, &sfNatural)); in DMGetOutputDM()
6557 PetscCall(DMSetNaturalSF(dm->dmBC, sfNatural)); in DMGetOutputDM()
6558 PetscCall(DMGetPointSF(dm->dmBC, &sf)); in DMGetOutputDM()
6560 PetscCall(DMSetGlobalSection(dm->dmBC, gsection)); in DMGetOutputDM()
6563 *odm = dm->dmBC; in DMGetOutputDM()
6589 PetscErrorCode DMGetOutputSequenceNumber(DM dm, PetscInt *num, PetscReal *val) in DMGetOutputSequenceNumber() argument
6592 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetOutputSequenceNumber()
6595 *num = dm->outputSequenceNum; in DMGetOutputSequenceNumber()
6599 *val = dm->outputSequenceVal; in DMGetOutputSequenceNumber()
6620 PetscErrorCode DMSetOutputSequenceNumber(DM dm, PetscInt num, PetscReal val) in DMSetOutputSequenceNumber() argument
6623 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetOutputSequenceNumber()
6624 dm->outputSequenceNum = num; in DMSetOutputSequenceNumber()
6625 dm->outputSequenceVal = val; in DMSetOutputSequenceNumber()
6652 PetscErrorCode DMOutputSequenceLoad(DM dm, PetscViewer viewer, const char name[], PetscInt num, Pet… in DMOutputSequenceLoad() argument
6657 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMOutputSequenceLoad()
6666 PetscCall(DMSequenceLoad_HDF5_Internal(dm, name, num, &value, viewer)); in DMOutputSequenceLoad()
6694 PetscErrorCode DMGetOutputSequenceLength(DM dm, PetscViewer viewer, const char name[], PetscInt *le… in DMGetOutputSequenceLength() argument
6699 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetOutputSequenceLength()
6706 PetscCall(DMSequenceGetLength_HDF5_Internal(dm, name, len, viewer)); in DMGetOutputSequenceLength()
6726 PetscErrorCode DMGetUseNatural(DM dm, PetscBool *useNatural) in DMGetUseNatural() argument
6729 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetUseNatural()
6731 *useNatural = dm->useNatural; in DMGetUseNatural()
6751 PetscErrorCode DMSetUseNatural(DM dm, PetscBool useNatural) in DMSetUseNatural() argument
6754 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetUseNatural()
6755 PetscValidLogicalCollectiveBool(dm, useNatural, 2); in DMSetUseNatural()
6756 dm->useNatural = useNatural; in DMSetUseNatural()
6773 PetscErrorCode DMCreateLabel(DM dm, const char name[]) in DMCreateLabel() argument
6779 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateLabel()
6781 PetscCall(DMHasLabel(dm, name, &flg)); in DMCreateLabel()
6784 PetscCall(DMAddLabel(dm, label)); in DMCreateLabel()
6804 PetscErrorCode DMCreateLabelAtIndex(DM dm, PetscInt l, const char name[]) in DMCreateLabelAtIndex() argument
6813 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCreateLabelAtIndex()
6815 PetscCall(DMHasLabel(dm, name, &flg)); in DMCreateLabelAtIndex()
6818 PetscCall(DMAddLabel(dm, label)); in DMCreateLabelAtIndex()
6821 PetscCall(DMGetNumLabels(dm, &Nl)); in DMCreateLabelAtIndex()
6823 for (m = 0, orig = dm->labels; m < Nl; ++m, prev = orig, orig = orig->next) { in DMCreateLabelAtIndex()
6829 if (!m) dm->labels = orig->next; in DMCreateLabelAtIndex()
6832 orig->next = dm->labels; in DMCreateLabelAtIndex()
6833 dm->labels = orig; in DMCreateLabelAtIndex()
6835 for (m = 0, prev = dm->labels; m < l - 1; ++m, prev = prev->next); in DMCreateLabelAtIndex()
6859 PetscErrorCode DMGetLabelValue(DM dm, const char name[], PetscInt point, PetscInt *value) in DMGetLabelValue() argument
6864 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetLabelValue()
6866 PetscCall(DMGetLabel(dm, name, &label)); in DMGetLabelValue()
6889 PetscErrorCode DMSetLabelValue(DM dm, const char name[], PetscInt point, PetscInt value) in DMSetLabelValue() argument
6894 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetLabelValue()
6896 PetscCall(DMGetLabel(dm, name, &label)); in DMSetLabelValue()
6898 PetscCall(DMCreateLabel(dm, name)); in DMSetLabelValue()
6899 PetscCall(DMGetLabel(dm, name, &label)); in DMSetLabelValue()
6920 PetscErrorCode DMClearLabelValue(DM dm, const char name[], PetscInt point, PetscInt value) in DMClearLabelValue() argument
6925 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMClearLabelValue()
6927 PetscCall(DMGetLabel(dm, name, &label)); in DMClearLabelValue()
6952 PetscErrorCode DMGetLabelSize(DM dm, const char name[], PetscInt *size) in DMGetLabelSize() argument
6957 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetLabelSize()
6960 PetscCall(DMGetLabel(dm, name, &label)); in DMGetLabelSize()
6983 PetscErrorCode DMGetLabelIdIS(DM dm, const char name[], IS *ids) in DMGetLabelIdIS() argument
6988 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetLabelIdIS()
6991 PetscCall(DMGetLabel(dm, name, &label)); in DMGetLabelIdIS()
7019 PetscErrorCode DMGetStratumSize(DM dm, const char name[], PetscInt value, PetscInt *size) in DMGetStratumSize() argument
7024 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetStratumSize()
7027 PetscCall(DMGetLabel(dm, name, &label)); in DMGetStratumSize()
7051 PetscErrorCode DMGetStratumIS(DM dm, const char name[], PetscInt value, IS *points) in DMGetStratumIS() argument
7056 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetStratumIS()
7059 PetscCall(DMGetLabel(dm, name, &label)); in DMGetStratumIS()
7081 PetscErrorCode DMSetStratumIS(DM dm, const char name[], PetscInt value, IS points) in DMSetStratumIS() argument
7086 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetStratumIS()
7089 PetscCall(DMGetLabel(dm, name, &label)); in DMSetStratumIS()
7111 PetscErrorCode DMClearLabelStratum(DM dm, const char name[], PetscInt value) in DMClearLabelStratum() argument
7116 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMClearLabelStratum()
7118 PetscCall(DMGetLabel(dm, name, &label)); in DMClearLabelStratum()
7139 PetscErrorCode DMGetNumLabels(DM dm, PetscInt *numLabels) in DMGetNumLabels() argument
7141 DMLabelLink next = dm->labels; in DMGetNumLabels()
7145 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetNumLabels()
7174 PetscErrorCode DMGetLabelName(DM dm, PetscInt n, const char *name[]) in DMGetLabelName() argument
7176 DMLabelLink next = dm->labels; in DMGetLabelName()
7180 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetLabelName()
7209 PetscErrorCode DMHasLabel(DM dm, const char name[], PetscBool *hasLabel) in DMHasLabel() argument
7211 DMLabelLink next = dm->labels; in DMHasLabel()
7215 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMHasLabel()
7253 PetscErrorCode DMGetLabel(DM dm, const char name[], DMLabel *label) in DMGetLabel() argument
7255 DMLabelLink next = dm->labels; in DMGetLabel()
7260 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetLabel()
7292 PetscErrorCode DMGetLabelByNum(DM dm, PetscInt n, DMLabel *label) in DMGetLabelByNum() argument
7294 DMLabelLink next = dm->labels; in DMGetLabelByNum()
7298 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetLabelByNum()
7324 PetscErrorCode DMAddLabel(DM dm, DMLabel label) in DMAddLabel() argument
7332 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMAddLabel()
7334 PetscCall(DMHasLabel(dm, lname, &hasLabel)); in DMAddLabel()
7339 for (p = &dm->labels; (l = *p); p = &l->next) { } in DMAddLabel()
7343 if (flg) dm->depthLabel = label; in DMAddLabel()
7345 if (flg) dm->celltypeLabel = label; in DMAddLabel()
7371 PetscErrorCode DMSetLabel(DM dm, DMLabel label) in DMSetLabel() argument
7373 DMLabelLink next = dm->labels; in DMSetLabel()
7378 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetLabel()
7387 if (flg) dm->depthLabel = label; in DMSetLabel()
7389 if (flg) dm->celltypeLabel = label; in DMSetLabel()
7416 PetscErrorCode DMRemoveLabel(DM dm, const char name[], DMLabel *label) in DMRemoveLabel() argument
7423 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMRemoveLabel()
7429 for (pnext = &dm->labels; (link = *pnext); pnext = &link->next) { in DMRemoveLabel()
7435 if (hasLabel) dm->depthLabel = NULL; in DMRemoveLabel()
7437 if (hasLabel) dm->celltypeLabel = NULL; in DMRemoveLabel()
7466 PetscErrorCode DMRemoveLabelBySelf(DM dm, DMLabel *label, PetscBool failNotFound) in DMRemoveLabelBySelf() argument
7472 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMRemoveLabelBySelf()
7476 PetscValidLogicalCollectiveBool(dm, failNotFound, 3); in DMRemoveLabelBySelf()
7477 for (pnext = &dm->labels; (link = *pnext); pnext = &link->next) { in DMRemoveLabelBySelf()
7481 if (*label == dm->depthLabel) dm->depthLabel = NULL; in DMRemoveLabelBySelf()
7482 if (*label == dm->celltypeLabel) dm->celltypeLabel = NULL; in DMRemoveLabelBySelf()
7489 …PetscCheck(hasLabel || !failNotFound, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Give… in DMRemoveLabelBySelf()
7509 PetscErrorCode DMGetLabelOutput(DM dm, const char name[], PetscBool *output) in DMGetLabelOutput() argument
7511 DMLabelLink next = dm->labels; in DMGetLabelOutput()
7515 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetLabelOutput()
7546 PetscErrorCode DMSetLabelOutput(DM dm, const char name[], PetscBool output) in DMSetLabelOutput() argument
7548 DMLabelLink next = dm->labels; in DMSetLabelOutput()
7552 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetLabelOutput()
7736 PetscErrorCode DMSetLabelValue_Fast(DM dm, DMLabel *label, const char name[], PetscInt point, Petsc… in DMSetLabelValue_Fast() argument
7741 PetscCall(DMCreateLabel(dm, name)); in DMSetLabelValue_Fast()
7742 PetscCall(DMGetLabel(dm, name, label)); in DMSetLabelValue_Fast()
7756 PetscErrorCode DMUniversalLabelCreate(DM dm, DMUniversalLabel *universal) in DMUniversalLabelCreate() argument
7765 PetscCall(DMGetNumLabels(dm, &Nl)); in DMUniversalLabelCreate()
7772 PetscCall(DMGetLabelName(dm, l, &name)); in DMUniversalLabelCreate()
7786 PetscCall(DMGetLabelName(dm, l, &name)); in DMUniversalLabelCreate()
7787 PetscCall(DMGetLabelByNum(dm, l, &label)); in DMUniversalLabelCreate()
7814 PetscCall(DMGetLabelByNum(dm, l, &label)); in DMUniversalLabelCreate()
7824 PetscCall(DMPlexGetChart(dm, &pStart, &pEnd)); in DMUniversalLabelCreate()
7834 PetscCall(DMGetLabelByNum(dm, l, &label)); in DMUniversalLabelCreate()
7877 PetscErrorCode DMUniversalLabelCreateLabels(DMUniversalLabel ul, PetscBool preserveOrder, DM dm) in DMUniversalLabelCreateLabels() argument
7882 PetscValidHeaderSpecific(dm, DM_CLASSID, 3); in DMUniversalLabelCreateLabels()
7884 if (preserveOrder) PetscCall(DMCreateLabelAtIndex(dm, ul->indices[l], ul->names[l])); in DMUniversalLabelCreateLabels()
7885 else PetscCall(DMCreateLabel(dm, ul->names[l])); in DMUniversalLabelCreateLabels()
7892 PetscCall(DMGetLabelName(dm, ul->indices[l], &name)); in DMUniversalLabelCreateLabels()
7894 …PetscCheck(match, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Label %" PetscInt_FMT " … in DMUniversalLabelCreateLabels()
7900 PetscErrorCode DMUniversalLabelSetLabelValue(DMUniversalLabel ul, DM dm, PetscBool useIndex, PetscI… in DMUniversalLabelSetLabelValue() argument
7910 if (useIndex) PetscCall(DMGetLabelByNum(dm, ul->indices[l], &label)); in DMUniversalLabelSetLabelValue()
7911 else PetscCall(DMGetLabel(dm, ul->names[l], &label)); in DMUniversalLabelSetLabelValue()
7933 PetscErrorCode DMGetCoarseDM(DM dm, DM *cdm) in DMGetCoarseDM() argument
7936 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetCoarseDM()
7938 *cdm = dm->coarseMesh; in DMGetCoarseDM()
7956 PetscErrorCode DMSetCoarseDM(DM dm, DM cdm) in DMSetCoarseDM() argument
7959 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetCoarseDM()
7961 if (dm == cdm) cdm = NULL; in DMSetCoarseDM()
7963 PetscCall(DMDestroy(&dm->coarseMesh)); in DMSetCoarseDM()
7964 dm->coarseMesh = cdm; in DMSetCoarseDM()
7981 PetscErrorCode DMGetFineDM(DM dm, DM *fdm) in DMGetFineDM() argument
7984 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetFineDM()
7986 *fdm = dm->fineMesh; in DMGetFineDM()
8004 PetscErrorCode DMSetFineDM(DM dm, DM fdm) in DMSetFineDM() argument
8007 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetFineDM()
8009 if (dm == fdm) fdm = NULL; in DMSetFineDM()
8011 PetscCall(DMDestroy(&dm->fineMesh)); in DMSetFineDM()
8012 dm->fineMesh = fdm; in DMSetFineDM()
8080 PetscErrorCode DMAddBoundary(DM dm, DMBoundaryConditionType type, const char name[], DMLabel label,… in DMAddBoundary() argument
8085 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMAddBoundary()
8086 PetscValidLogicalCollectiveEnum(dm, type, 2); in DMAddBoundary()
8088 PetscValidLogicalCollectiveInt(dm, Nv, 5); in DMAddBoundary()
8089 PetscValidLogicalCollectiveInt(dm, field, 7); in DMAddBoundary()
8090 PetscValidLogicalCollectiveInt(dm, Nc, 8); in DMAddBoundary()
8091 …PetscCheck(!dm->localSection, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Cannot … in DMAddBoundary()
8092 PetscCall(DMGetDS(dm, &ds)); in DMAddBoundary()
8098 PetscCall(DMGetField(dm, field, NULL, &obj)); in DMAddBoundary()
8103 PetscCall(DMConvert(dm, DMPLEX, &plex)); in DMAddBoundary()
8113 static PetscErrorCode DMPopulateBoundary(DM dm) in DMPopulateBoundary() argument
8120 PetscCall(DMGetDS(dm, &ds)); in DMPopulateBoundary()
8122 if (dm->boundary) { in DMPopulateBoundary()
8123 DMBoundary next = dm->boundary; in DMPopulateBoundary()
8134 dm->boundary = NULL; in DMPopulateBoundary()
8137 lastnext = &dm->boundary; in DMPopulateBoundary()
8153 PetscErrorCode DMIsBoundaryPoint(DM dm, PetscInt point, PetscBool *isBd) in DMIsBoundaryPoint() argument
8158 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMIsBoundaryPoint()
8161 PetscCall(DMPopulateBoundary(dm)); in DMIsBoundaryPoint()
8162 b = dm->boundary; in DMIsBoundaryPoint()
8191 PetscErrorCode DMHasBound(DM dm, PetscBool *hasBound) in DMHasBound() argument
8198 PetscCall(DMGetDS(dm, &ds)); in DMHasBound()
8209 PetscCall(PetscDSUpdateBoundaryLabels(ds, dm)); in DMHasBound()
8260 PetscErrorCode DMProjectFunction(DM dm, PetscReal time, PetscErrorCode (**funcs)(PetscInt dim, Pets… in DMProjectFunction() argument
8265 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMProjectFunction()
8266 PetscCall(PetscLogEventBegin(DM_ProjectFunction, dm, X, 0, 0)); in DMProjectFunction()
8267 PetscCall(DMGetLocalVector(dm, &localX)); in DMProjectFunction()
8269 PetscCall(DMProjectFunctionLocal(dm, time, funcs, ctxs, mode, localX)); in DMProjectFunction()
8270 PetscCall(DMLocalToGlobalBegin(dm, localX, mode, X)); in DMProjectFunction()
8271 PetscCall(DMLocalToGlobalEnd(dm, localX, mode, X)); in DMProjectFunction()
8272 PetscCall(DMRestoreLocalVector(dm, &localX)); in DMProjectFunction()
8273 PetscCall(PetscLogEventEnd(DM_ProjectFunction, dm, X, 0, 0)); in DMProjectFunction()
8309 PetscErrorCode DMProjectFunctionLocal(DM dm, PetscReal time, PetscErrorCode (**funcs)(PetscInt dim,… in DMProjectFunctionLocal() argument
8312 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMProjectFunctionLocal()
8314 PetscUseTypeMethod(dm, projectfunctionlocal, time, funcs, ctxs, mode, localX); in DMProjectFunctionLocal()
8355 PetscErrorCode DMProjectFunctionLabel(DM dm, PetscReal time, DMLabel label, PetscInt numIds, const … in DMProjectFunctionLabel() argument
8360 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMProjectFunctionLabel()
8361 PetscCall(DMGetLocalVector(dm, &localX)); in DMProjectFunctionLabel()
8363 …PetscCall(DMProjectFunctionLabelLocal(dm, time, label, numIds, ids, Nc, comps, funcs, ctxs, mode, … in DMProjectFunctionLabel()
8364 PetscCall(DMLocalToGlobalBegin(dm, localX, mode, X)); in DMProjectFunctionLabel()
8365 PetscCall(DMLocalToGlobalEnd(dm, localX, mode, X)); in DMProjectFunctionLabel()
8366 PetscCall(DMRestoreLocalVector(dm, &localX)); in DMProjectFunctionLabel()
8407 PetscErrorCode DMProjectFunctionLabelLocal(DM dm, PetscReal time, DMLabel label, PetscInt numIds, c… in DMProjectFunctionLabelLocal() argument
8410 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMProjectFunctionLabelLocal()
8412 …PetscUseTypeMethod(dm, projectfunctionlabellocal, time, label, numIds, ids, Nc, comps, funcs, ctxs… in DMProjectFunctionLabelLocal()
8467 PetscErrorCode DMProjectFieldLocal(DM dm, PetscReal time, Vec localU, void (**funcs)(PetscInt dim, … in DMProjectFieldLocal() argument
8470 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMProjectFieldLocal()
8473 PetscUseTypeMethod(dm, projectfieldlocal, time, localU, funcs, mode, localX); in DMProjectFieldLocal()
8532 PetscErrorCode DMProjectFieldLabelLocal(DM dm, PetscReal time, DMLabel label, PetscInt numIds, cons… in DMProjectFieldLabelLocal() argument
8535 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMProjectFieldLabelLocal()
8538 …PetscUseTypeMethod(dm, projectfieldlabellocal, time, label, numIds, ids, Nc, comps, localU, funcs,… in DMProjectFieldLabelLocal()
8597 PetscErrorCode DMProjectFieldLabel(DM dm, PetscReal time, DMLabel label, PetscInt numIds, const Pet… in DMProjectFieldLabel() argument
8603 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMProjectFieldLabel()
8606 PetscCall(DMGetLocalVector(dm, &localX)); in DMProjectFieldLabel()
8610 …PetscCall(DMProjectFieldLabelLocal(dm, time, label, numIds, ids, Nc, comps, localU, funcs, mode, l… in DMProjectFieldLabel()
8611 PetscCall(DMLocalToGlobalBegin(dm, localX, mode, X)); in DMProjectFieldLabel()
8612 PetscCall(DMLocalToGlobalEnd(dm, localX, mode, X)); in DMProjectFieldLabel()
8613 PetscCall(DMRestoreLocalVector(dm, &localX)); in DMProjectFieldLabel()
8674 PetscErrorCode DMProjectBdFieldLabelLocal(DM dm, PetscReal time, DMLabel label, PetscInt numIds, co… in DMProjectBdFieldLabelLocal() argument
8677 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMProjectBdFieldLabelLocal()
8680 …PetscUseTypeMethod(dm, projectbdfieldlabellocal, time, label, numIds, ids, Nc, comps, localU, func… in DMProjectBdFieldLabelLocal()
8708 PetscErrorCode DMComputeL2Diff(DM dm, PetscReal time, PetscErrorCode (**funcs)(PetscInt, PetscReal,… in DMComputeL2Diff() argument
8711 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMComputeL2Diff()
8713 PetscUseTypeMethod(dm, computel2diff, time, funcs, ctxs, X, diff); in DMComputeL2Diff()
8742 PetscErrorCode DMComputeL2GradientDiff(DM dm, PetscReal time, PetscErrorCode (**funcs)(PetscInt, Pe… in DMComputeL2GradientDiff() argument
8745 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMComputeL2GradientDiff()
8747 PetscUseTypeMethod(dm, computel2gradientdiff, time, funcs, ctxs, X, n, diff); in DMComputeL2GradientDiff()
8775 PetscErrorCode DMComputeL2FieldDiff(DM dm, PetscReal time, PetscErrorCode (**funcs)(PetscInt, Petsc… in DMComputeL2FieldDiff() argument
8778 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMComputeL2FieldDiff()
8780 PetscUseTypeMethod(dm, computel2fielddiff, time, funcs, ctxs, X, diff); in DMComputeL2FieldDiff()
8803 PetscErrorCode DMGetNeighbors(DM dm, PetscInt *nranks, const PetscMPIInt *ranks[]) in DMGetNeighbors() argument
8806 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetNeighbors()
8807 PetscUseTypeMethod(dm, getneighbors, nranks, ranks); in DMGetNeighbors()
8822 DM dm; in MatFDColoringApply_AIJDM() local
8823 PetscCall(MatGetDM(J, &dm)); in MatFDColoringApply_AIJDM()
8824 …PetscCheck(dm, PetscObjectComm((PetscObject)J), PETSC_ERR_ARG_INCOMP, "IS_COLORING_LOCAL requires … in MatFDColoringApply_AIJDM()
8825 PetscCall(DMGetLocalVector(dm, &x1local)); in MatFDColoringApply_AIJDM()
8826 PetscCall(DMGlobalToLocalBegin(dm, x1, INSERT_VALUES, x1local)); in MatFDColoringApply_AIJDM()
8827 PetscCall(DMGlobalToLocalEnd(dm, x1, INSERT_VALUES, x1local)); in MatFDColoringApply_AIJDM()
8832 DM dm; in MatFDColoringApply_AIJDM() local
8833 PetscCall(MatGetDM(J, &dm)); in MatFDColoringApply_AIJDM()
8834 PetscCall(DMRestoreLocalVector(dm, &x1)); in MatFDColoringApply_AIJDM()
9015 PetscErrorCode DMMonitorSet(DM dm, PetscErrorCode (*f)(DM, void *), void *mctx, PetscCtxDestroyFn *… in DMMonitorSet() argument
9018 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMMonitorSet()
9019 for (PetscInt m = 0; m < dm->numbermonitors; ++m) { in DMMonitorSet()
9022 …onitordestroy, (PetscErrorCode (*)(void))(PetscVoidFn *)dm->monitor[m], dm->monitorcontext[m], dm-… in DMMonitorSet()
9025 …PetscCheck(dm->numbermonitors < MAXDMMONITORS, PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Too man… in DMMonitorSet()
9026 dm->monitor[dm->numbermonitors] = f; in DMMonitorSet()
9027 dm->monitordestroy[dm->numbermonitors] = monitordestroy; in DMMonitorSet()
9028 dm->monitorcontext[dm->numbermonitors++] = mctx; in DMMonitorSet()
9052 PetscErrorCode DMMonitorCancel(DM dm) in DMMonitorCancel() argument
9057 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMMonitorCancel()
9058 for (m = 0; m < dm->numbermonitors; ++m) { in DMMonitorCancel()
9059 if (dm->monitordestroy[m]) PetscCall((*dm->monitordestroy[m])(&dm->monitorcontext[m])); in DMMonitorCancel()
9061 dm->numbermonitors = 0; in DMMonitorCancel()
9091 PetscErrorCode DMMonitorSetFromOptions(DM dm, const char name[], const char help[], const char manu… in DMMonitorSetFromOptions() argument
9097 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMMonitorSetFromOptions()
9098 …tscOptionsCreateViewer(PetscObjectComm((PetscObject)dm), ((PetscObject)dm)->options, ((PetscObject… in DMMonitorSetFromOptions()
9104 if (monitorsetup) PetscCall((*monitorsetup)(dm, vf)); in DMMonitorSetFromOptions()
9105 PetscCall(DMMonitorSet(dm, monitor, vf, (PetscCtxDestroyFn *)PetscViewerAndFormatDestroy)); in DMMonitorSetFromOptions()
9127 PetscErrorCode DMMonitor(DM dm) in DMMonitor() argument
9132 if (!dm) PetscFunctionReturn(PETSC_SUCCESS); in DMMonitor()
9133 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMMonitor()
9134 for (m = 0; m < dm->numbermonitors; ++m) PetscCall((*dm->monitor[m])(dm, dm->monitorcontext[m])); in DMMonitor()
9161 PetscErrorCode DMComputeError(DM dm, Vec sol, PetscReal errors[], Vec *errorVec) in DMComputeError() argument
9169 PetscCall(DMGetNumFields(dm, &Nf)); in DMComputeError()
9171 PetscCall(DMGetNumDS(dm, &Nds)); in DMComputeError()
9179 PetscCall(DMGetRegionNumDS(dm, s, &label, &fieldIS, &ds, NULL)); in DMComputeError()
9188 …for (f = 0; f < Nf; ++f) PetscCheck(exactSol[f], PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_W… in DMComputeError()
9189 PetscCall(DMGetOutputSequenceNumber(dm, NULL, &time)); in DMComputeError()
9190 if (errors) PetscCall(DMComputeL2FieldDiff(dm, time, exactSol, ctxs, sol, errors)); in DMComputeError()
9197 PetscCall(DMClone(dm, &edm)); in DMComputeError()
9199 PetscCall(DMPlexGetHeightStratum(dm, 0, &cStart, NULL)); in DMComputeError()
9200 PetscCall(DMPlexGetCellType(dm, cStart, &ct)); in DMComputeError()
9202 PetscCall(DMGetNumFields(dm, &Nf)); in DMComputeError()
9208 PetscCall(DMGetField(dm, f, NULL, (PetscObject *)&fe)); in DMComputeError()
9221 PetscCall(DMPlexComputeL2DiffVec(dm, time, exactSol, ctxs, sol, *errorVec)); in DMComputeError()
9243 PetscErrorCode DMGetNumAuxiliaryVec(DM dm, PetscInt *numAux) in DMGetNumAuxiliaryVec() argument
9246 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetNumAuxiliaryVec()
9247 PetscCall(PetscHMapAuxGetSize(dm->auxData, numAux)); in DMGetNumAuxiliaryVec()
9272 PetscErrorCode DMGetAuxiliaryVec(DM dm, DMLabel label, PetscInt value, PetscInt part, Vec *aux) in DMGetAuxiliaryVec() argument
9278 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetAuxiliaryVec()
9283 PetscCall(PetscHMapAuxHas(dm->auxData, key, &has)); in DMGetAuxiliaryVec()
9284 if (has) PetscCall(PetscHMapAuxGet(dm->auxData, key, aux)); in DMGetAuxiliaryVec()
9285 else PetscCall(PetscHMapAuxGet(dm->auxData, wild, aux)); in DMGetAuxiliaryVec()
9305 PetscErrorCode DMSetAuxiliaryVec(DM dm, DMLabel label, PetscInt value, PetscInt part, Vec aux) in DMSetAuxiliaryVec() argument
9311 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMSetAuxiliaryVec()
9316 PetscCall(PetscHMapAuxGet(dm->auxData, key, &old)); in DMSetAuxiliaryVec()
9318 if (!aux) PetscCall(PetscHMapAuxDel(dm->auxData, key)); in DMSetAuxiliaryVec()
9319 else PetscCall(PetscHMapAuxSet(dm->auxData, key, aux)); in DMSetAuxiliaryVec()
9344 PetscErrorCode DMGetAuxiliaryLabels(DM dm, DMLabel labels[], PetscInt values[], PetscInt parts[]) in DMGetAuxiliaryLabels() argument
9350 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMGetAuxiliaryLabels()
9354 PetscCall(DMGetNumAuxiliaryVec(dm, &n)); in DMGetAuxiliaryLabels()
9356 PetscCall(PetscHMapAuxGetKeys(dm->auxData, &off, keys)); in DMGetAuxiliaryLabels()
9384 PetscErrorCode DMCopyAuxiliaryVec(DM dm, DM dmNew) in DMCopyAuxiliaryVec() argument
9387 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMCopyAuxiliaryVec()
9389 if (dm == dmNew) PetscFunctionReturn(PETSC_SUCCESS); in DMCopyAuxiliaryVec()
9393 PetscCall(PetscHMapAuxDuplicate(dm->auxData, &dmNew->auxData)); in DMCopyAuxiliaryVec()
9419 PetscErrorCode DMClearAuxiliaryVec(DM dm) in DMClearAuxiliaryVec() argument
9425 PetscCall(PetscHMapAuxGetSize(dm->auxData, &n)); in DMClearAuxiliaryVec()
9427 PetscCall(PetscHMapAuxGetVals(dm->auxData, &off, auxData)); in DMClearAuxiliaryVec()
9430 PetscCall(PetscHMapAuxDestroy(&dm->auxData)); in DMClearAuxiliaryVec()
9431 PetscCall(PetscHMapAuxCreate(&dm->auxData)); in DMClearAuxiliaryVec()
9670 PetscErrorCode DMReorderSectionSetDefault(DM dm, DMReorderDefaultFlag reorder) in DMReorderSectionSetDefault() argument
9673 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMReorderSectionSetDefault()
9674 PetscTryMethod(dm, "DMReorderSectionSetDefault_C", (DM, DMReorderDefaultFlag), (dm, reorder)); in DMReorderSectionSetDefault()
9693 PetscErrorCode DMReorderSectionGetDefault(DM dm, DMReorderDefaultFlag *reorder) in DMReorderSectionGetDefault() argument
9696 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMReorderSectionGetDefault()
9699 PetscTryMethod(dm, "DMReorderSectionGetDefault_C", (DM, DMReorderDefaultFlag *), (dm, reorder)); in DMReorderSectionGetDefault()
9716 PetscErrorCode DMReorderSectionSetType(DM dm, MatOrderingType reorder) in DMReorderSectionSetType() argument
9719 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMReorderSectionSetType()
9720 PetscTryMethod(dm, "DMReorderSectionSetType_C", (DM, MatOrderingType), (dm, reorder)); in DMReorderSectionSetType()
9739 PetscErrorCode DMReorderSectionGetType(DM dm, MatOrderingType *reorder) in DMReorderSectionGetType() argument
9742 PetscValidHeaderSpecific(dm, DM_CLASSID, 1); in DMReorderSectionGetType()
9745 PetscTryMethod(dm, "DMReorderSectionGetType_C", (DM, MatOrderingType *), (dm, reorder)); in DMReorderSectionGetType()