Lines Matching refs:s
37 PetscErrorCode PetscSectionCreate(MPI_Comm comm, PetscSection *s) in PetscSectionCreate() argument
40 PetscAssertPointer(s, 2); in PetscSectionCreate()
43 …PetscCall(PetscHeaderCreate(*s, PETSC_SECTION_CLASSID, "PetscSection", "Section", "IS", comm, Pets… in PetscSectionCreate()
44 (*s)->pStart = -1; in PetscSectionCreate()
45 (*s)->pEnd = -1; in PetscSectionCreate()
46 (*s)->perm = NULL; in PetscSectionCreate()
47 (*s)->pointMajor = PETSC_TRUE; in PetscSectionCreate()
48 (*s)->includesConstraints = PETSC_TRUE; in PetscSectionCreate()
49 (*s)->atlasDof = NULL; in PetscSectionCreate()
50 (*s)->atlasOff = NULL; in PetscSectionCreate()
51 (*s)->bc = NULL; in PetscSectionCreate()
52 (*s)->bcIndices = NULL; in PetscSectionCreate()
53 (*s)->setup = PETSC_FALSE; in PetscSectionCreate()
54 (*s)->numFields = 0; in PetscSectionCreate()
55 (*s)->fieldNames = NULL; in PetscSectionCreate()
56 (*s)->field = NULL; in PetscSectionCreate()
57 (*s)->useFieldOff = PETSC_FALSE; in PetscSectionCreate()
58 (*s)->compNames = NULL; in PetscSectionCreate()
59 (*s)->clObj = NULL; in PetscSectionCreate()
60 (*s)->clHash = NULL; in PetscSectionCreate()
61 (*s)->clSection = NULL; in PetscSectionCreate()
62 (*s)->clPoints = NULL; in PetscSectionCreate()
63 PetscCall(PetscSectionInvalidateMaxDof_Internal(*s)); in PetscSectionCreate()
218 PetscErrorCode PetscSectionSetFromOptions(PetscSection s) in PetscSectionSetFromOptions() argument
221 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetFromOptions()
222 PetscObjectOptionsBegin((PetscObject)s); in PetscSectionSetFromOptions()
223 …g, either point major or field major", "PetscSectionSetPointMajor", s->pointMajor, &s->pointMajor,… in PetscSectionSetFromOptions()
225 PetscCall(PetscObjectProcessOptionsHandlers((PetscObject)s, PetscOptionsObject)); in PetscSectionSetFromOptions()
227 PetscCall(PetscObjectViewFromOptions((PetscObject)s, NULL, "-petscsection_view")); in PetscSectionSetFromOptions()
350 PetscErrorCode PetscSectionGetNumFields(PetscSection s, PetscInt *numFields) in PetscSectionGetNumFields() argument
353 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetNumFields()
355 *numFields = s->numFields; in PetscSectionGetNumFields()
377 PetscErrorCode PetscSectionSetNumFields(PetscSection s, PetscInt numFields) in PetscSectionSetNumFields() argument
382 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetNumFields()
384 PetscCall(PetscSectionReset(s)); in PetscSectionSetNumFields()
386 s->numFields = numFields; in PetscSectionSetNumFields()
387 PetscCall(PetscMalloc1(s->numFields, &s->numFieldComponents)); in PetscSectionSetNumFields()
388 PetscCall(PetscMalloc1(s->numFields, &s->fieldNames)); in PetscSectionSetNumFields()
389 PetscCall(PetscMalloc1(s->numFields, &s->compNames)); in PetscSectionSetNumFields()
390 PetscCall(PetscMalloc1(s->numFields, &s->field)); in PetscSectionSetNumFields()
391 for (f = 0; f < s->numFields; ++f) { in PetscSectionSetNumFields()
394 s->numFieldComponents[f] = 1; in PetscSectionSetNumFields()
396 PetscCall(PetscSectionCreate(PetscObjectComm((PetscObject)s), &s->field[f])); in PetscSectionSetNumFields()
398 PetscCall(PetscStrallocpy(name, &s->fieldNames[f])); in PetscSectionSetNumFields()
400 PetscCall(PetscMalloc1(s->numFieldComponents[f], &s->compNames[f])); in PetscSectionSetNumFields()
401 PetscCall(PetscStrallocpy(name, &s->compNames[f][0])); in PetscSectionSetNumFields()
425 PetscErrorCode PetscSectionGetFieldName(PetscSection s, PetscInt field, const char *fieldName[]) in PetscSectionGetFieldName() argument
428 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetFieldName()
430 PetscSectionCheckValidField(field, s->numFields); in PetscSectionGetFieldName()
431 *fieldName = s->fieldNames[field]; in PetscSectionGetFieldName()
452 PetscErrorCode PetscSectionSetFieldName(PetscSection s, PetscInt field, const char fieldName[]) in PetscSectionSetFieldName() argument
455 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetFieldName()
457 PetscSectionCheckValidField(field, s->numFields); in PetscSectionSetFieldName()
458 PetscCall(PetscFree(s->fieldNames[field])); in PetscSectionSetFieldName()
459 PetscCall(PetscStrallocpy(fieldName, &s->fieldNames[field])); in PetscSectionSetFieldName()
487 PetscErrorCode PetscSectionGetComponentName(PetscSection s, PetscInt field, PetscInt comp, const ch… in PetscSectionGetComponentName() argument
490 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetComponentName()
492 PetscSectionCheckValidField(field, s->numFields); in PetscSectionGetComponentName()
493 PetscSectionCheckValidFieldComponent(comp, s->numFieldComponents[field]); in PetscSectionGetComponentName()
494 *compName = s->compNames[field][comp]; in PetscSectionGetComponentName()
520 PetscErrorCode PetscSectionSetComponentName(PetscSection s, PetscInt field, PetscInt comp, const ch… in PetscSectionSetComponentName() argument
523 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetComponentName()
525 PetscSectionCheckValidField(field, s->numFields); in PetscSectionSetComponentName()
526 PetscSectionCheckValidFieldComponent(comp, s->numFieldComponents[field]); in PetscSectionSetComponentName()
527 PetscCall(PetscFree(s->compNames[field][comp])); in PetscSectionSetComponentName()
528 PetscCall(PetscStrallocpy(compName, &s->compNames[field][comp])); in PetscSectionSetComponentName()
552 PetscErrorCode PetscSectionGetFieldComponents(PetscSection s, PetscInt field, PetscInt *numComp) in PetscSectionGetFieldComponents() argument
555 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetFieldComponents()
557 PetscSectionCheckValidField(field, s->numFields); in PetscSectionGetFieldComponents()
558 *numComp = s->numFieldComponents[field]; in PetscSectionGetFieldComponents()
588 PetscErrorCode PetscSectionSetFieldComponents(PetscSection s, PetscInt field, PetscInt numComp) in PetscSectionSetFieldComponents() argument
593 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetFieldComponents()
594 PetscSectionCheckValidField(field, s->numFields); in PetscSectionSetFieldComponents()
595 if (s->compNames) { in PetscSectionSetFieldComponents()
596 for (c = 0; c < s->numFieldComponents[field]; ++c) PetscCall(PetscFree(s->compNames[field][c])); in PetscSectionSetFieldComponents()
597 PetscCall(PetscFree(s->compNames[field])); in PetscSectionSetFieldComponents()
600 s->numFieldComponents[field] = numComp; in PetscSectionSetFieldComponents()
602 PetscCall(PetscMalloc1(numComp, &s->compNames[field])); in PetscSectionSetFieldComponents()
607 PetscCall(PetscStrallocpy(name, &s->compNames[field][c])); in PetscSectionSetFieldComponents()
633 PetscErrorCode PetscSectionGetChart(PetscSection s, PetscInt *pStart, PetscInt *pEnd) in PetscSectionGetChart() argument
636 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetChart()
637 if (pStart) *pStart = s->pStart; in PetscSectionGetChart()
638 if (pEnd) *pEnd = s->pEnd; in PetscSectionGetChart()
666 PetscErrorCode PetscSectionSetChart(PetscSection s, PetscInt pStart, PetscInt pEnd) in PetscSectionSetChart() argument
671 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetChart()
673 if (pStart == s->pStart && pEnd == s->pEnd) PetscFunctionReturn(PETSC_SUCCESS); in PetscSectionSetChart()
675 s->setup = PETSC_FALSE; in PetscSectionSetChart()
676 PetscCall(PetscSectionDestroy(&s->bc)); in PetscSectionSetChart()
677 PetscCall(PetscFree(s->bcIndices)); in PetscSectionSetChart()
678 PetscCall(PetscFree2(s->atlasDof, s->atlasOff)); in PetscSectionSetChart()
680 s->pStart = pStart; in PetscSectionSetChart()
681 s->pEnd = pEnd; in PetscSectionSetChart()
682 PetscCall(PetscMalloc2(pEnd - pStart, &s->atlasDof, pEnd - pStart, &s->atlasOff)); in PetscSectionSetChart()
683 PetscCall(PetscArrayzero(s->atlasDof, pEnd - pStart)); in PetscSectionSetChart()
684 for (f = 0; f < s->numFields; ++f) PetscCall(PetscSectionSetChart(s->field[f], pStart, pEnd)); in PetscSectionSetChart()
703 PetscErrorCode PetscSectionGetPermutation(PetscSection s, IS *perm) in PetscSectionGetPermutation() argument
706 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetPermutation()
709 *perm = s->perm; in PetscSectionGetPermutation()
734 PetscErrorCode PetscSectionSetPermutation(PetscSection s, IS perm) in PetscSectionSetPermutation() argument
737 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetPermutation()
739 …PetscCheck(!s->setup, PetscObjectComm((PetscObject)s), PETSC_ERR_ARG_WRONGSTATE, "Cannot set a per… in PetscSectionSetPermutation()
740 if (s->perm != perm) { in PetscSectionSetPermutation()
741 PetscCall(ISDestroy(&s->perm)); in PetscSectionSetPermutation()
743 s->perm = perm; in PetscSectionSetPermutation()
744 PetscCall(PetscObjectReference((PetscObject)s->perm)); in PetscSectionSetPermutation()
770 PetscErrorCode PetscSectionGetBlockStarts(PetscSection s, PetscBT *blockStarts) in PetscSectionGetBlockStarts() argument
773 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetBlockStarts()
776 *blockStarts = s->blockStarts; in PetscSectionGetBlockStarts()
799 PetscErrorCode PetscSectionSetBlockStarts(PetscSection s, PetscBT blockStarts) in PetscSectionSetBlockStarts() argument
802 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetBlockStarts()
803 if (s->blockStarts != blockStarts) { in PetscSectionSetBlockStarts()
804 PetscCall(PetscBTDestroy(&s->blockStarts)); in PetscSectionSetBlockStarts()
805 s->blockStarts = blockStarts; in PetscSectionSetBlockStarts()
825 PetscErrorCode PetscSectionGetPointMajor(PetscSection s, PetscBool *pm) in PetscSectionGetPointMajor() argument
828 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetPointMajor()
830 *pm = s->pointMajor; in PetscSectionGetPointMajor()
864 PetscErrorCode PetscSectionSetPointMajor(PetscSection s, PetscBool pm) in PetscSectionSetPointMajor() argument
867 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetPointMajor()
868 …PetscCheck(!s->setup, PetscObjectComm((PetscObject)s), PETSC_ERR_ARG_WRONGSTATE, "Cannot set the d… in PetscSectionSetPointMajor()
869 s->pointMajor = pm; in PetscSectionSetPointMajor()
889 PetscErrorCode PetscSectionGetIncludesConstraints(PetscSection s, PetscBool *includesConstraints) in PetscSectionGetIncludesConstraints() argument
892 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetIncludesConstraints()
894 *includesConstraints = s->includesConstraints; in PetscSectionGetIncludesConstraints()
911 PetscErrorCode PetscSectionSetIncludesConstraints(PetscSection s, PetscBool includesConstraints) in PetscSectionSetIncludesConstraints() argument
914 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetIncludesConstraints()
915 …PetscCheck(!s->setup, PetscObjectComm((PetscObject)s), PETSC_ERR_ARG_WRONGSTATE, "Cannot set inclu… in PetscSectionSetIncludesConstraints()
916 s->includesConstraints = includesConstraints; in PetscSectionSetIncludesConstraints()
941 PetscErrorCode PetscSectionGetDof(PetscSection s, PetscInt point, PetscInt *numDof) in PetscSectionGetDof() argument
944 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetDof()
946 …s->pStart && point < s->pEnd, PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Section point %" PetscIn… in PetscSectionGetDof()
947 *numDof = s->atlasDof[point - s->pStart]; in PetscSectionGetDof()
968 PetscErrorCode PetscSectionSetDof(PetscSection s, PetscInt point, PetscInt numDof) in PetscSectionSetDof() argument
971 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetDof()
972 …s->pStart && point < s->pEnd, PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Section point %" PetscIn… in PetscSectionSetDof()
973 s->atlasDof[point - s->pStart] = numDof; in PetscSectionSetDof()
974 PetscCall(PetscSectionInvalidateMaxDof_Internal(s)); in PetscSectionSetDof()
995 PetscErrorCode PetscSectionAddDof(PetscSection s, PetscInt point, PetscInt numDof) in PetscSectionAddDof() argument
998 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionAddDof()
999 …s->pStart && point < s->pEnd, PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Section point %" PetscIn… in PetscSectionAddDof()
1001 s->atlasDof[point - s->pStart] += numDof; in PetscSectionAddDof()
1002 PetscCall(PetscSectionInvalidateMaxDof_Internal(s)); in PetscSectionAddDof()
1023 PetscErrorCode PetscSectionGetFieldDof(PetscSection s, PetscInt point, PetscInt field, PetscInt *nu… in PetscSectionGetFieldDof() argument
1026 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetFieldDof()
1028 PetscSectionCheckValidField(field, s->numFields); in PetscSectionGetFieldDof()
1029 PetscCall(PetscSectionGetDof(s->field[field], point, numDof)); in PetscSectionGetFieldDof()
1059 PetscErrorCode PetscSectionSetFieldDof(PetscSection s, PetscInt point, PetscInt field, PetscInt num… in PetscSectionSetFieldDof() argument
1062 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetFieldDof()
1063 PetscSectionCheckValidField(field, s->numFields); in PetscSectionSetFieldDof()
1064 PetscCall(PetscSectionSetDof(s->field[field], point, numDof)); in PetscSectionSetFieldDof()
1094 PetscErrorCode PetscSectionAddFieldDof(PetscSection s, PetscInt point, PetscInt field, PetscInt num… in PetscSectionAddFieldDof() argument
1097 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionAddFieldDof()
1098 PetscSectionCheckValidField(field, s->numFields); in PetscSectionAddFieldDof()
1099 PetscCall(PetscSectionAddDof(s->field[field], point, numDof)); in PetscSectionAddFieldDof()
1119 PetscErrorCode PetscSectionGetConstraintDof(PetscSection s, PetscInt point, PetscInt *numDof) in PetscSectionGetConstraintDof() argument
1122 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetConstraintDof()
1124 if (s->bc) PetscCall(PetscSectionGetDof(s->bc, point, numDof)); in PetscSectionGetConstraintDof()
1143 PetscErrorCode PetscSectionSetConstraintDof(PetscSection s, PetscInt point, PetscInt numDof) in PetscSectionSetConstraintDof() argument
1146 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetConstraintDof()
1148 PetscCall(PetscSectionCheckConstraints_Private(s)); in PetscSectionSetConstraintDof()
1149 PetscCall(PetscSectionSetDof(s->bc, point, numDof)); in PetscSectionSetConstraintDof()
1168 PetscErrorCode PetscSectionAddConstraintDof(PetscSection s, PetscInt point, PetscInt numDof) in PetscSectionAddConstraintDof() argument
1171 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionAddConstraintDof()
1173 PetscCall(PetscSectionCheckConstraints_Private(s)); in PetscSectionAddConstraintDof()
1174 PetscCall(PetscSectionAddDof(s->bc, point, numDof)); in PetscSectionAddConstraintDof()
1196 PetscErrorCode PetscSectionGetFieldConstraintDof(PetscSection s, PetscInt point, PetscInt field, Pe… in PetscSectionGetFieldConstraintDof() argument
1199 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetFieldConstraintDof()
1201 PetscSectionCheckValidField(field, s->numFields); in PetscSectionGetFieldConstraintDof()
1202 PetscCall(PetscSectionGetConstraintDof(s->field[field], point, numDof)); in PetscSectionGetFieldConstraintDof()
1221 PetscErrorCode PetscSectionSetFieldConstraintDof(PetscSection s, PetscInt point, PetscInt field, Pe… in PetscSectionSetFieldConstraintDof() argument
1224 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetFieldConstraintDof()
1225 PetscSectionCheckValidField(field, s->numFields); in PetscSectionSetFieldConstraintDof()
1226 PetscCall(PetscSectionSetConstraintDof(s->field[field], point, numDof)); in PetscSectionSetFieldConstraintDof()
1245 PetscErrorCode PetscSectionAddFieldConstraintDof(PetscSection s, PetscInt point, PetscInt field, Pe… in PetscSectionAddFieldConstraintDof() argument
1248 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionAddFieldConstraintDof()
1249 PetscSectionCheckValidField(field, s->numFields); in PetscSectionAddFieldConstraintDof()
1250 PetscCall(PetscSectionAddConstraintDof(s->field[field], point, numDof)); in PetscSectionAddFieldConstraintDof()
1266 PetscErrorCode PetscSectionSetUpBC(PetscSection s) in PetscSectionSetUpBC() argument
1269 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetUpBC()
1270 if (s->bc) { in PetscSectionSetUpBC()
1271 const PetscInt last = (s->bc->pEnd - s->bc->pStart) - 1; in PetscSectionSetUpBC()
1273 PetscCall(PetscSectionSetUp(s->bc)); in PetscSectionSetUpBC()
1274 …if (last >= 0) PetscCall(PetscMalloc1(s->bc->atlasOff[last] + s->bc->atlasDof[last], &s->bcIndices… in PetscSectionSetUpBC()
1275 else s->bcIndices = NULL; in PetscSectionSetUpBC()
1297 PetscErrorCode PetscSectionSetUp(PetscSection s) in PetscSectionSetUp() argument
1304 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetUp()
1305 if (s->setup) PetscFunctionReturn(PETSC_SUCCESS); in PetscSectionSetUp()
1306 s->setup = PETSC_TRUE; in PetscSectionSetUp()
1309 …PetscCheck(s->includesConstraints, PETSC_COMM_SELF, PETSC_ERR_SUP, "PetscSectionSetUp is currently… in PetscSectionSetUp()
1310 if (s->perm) PetscCall(ISGetIndices(s->perm, &pind)); in PetscSectionSetUp()
1311 if (s->pointMajor) { in PetscSectionSetUp()
1313 for (PetscInt p = 0; p < s->pEnd - s->pStart; ++p) { in PetscSectionSetUp()
1317 PetscCall(PetscIntCast(offset, &s->atlasOff[q])); in PetscSectionSetUp()
1318 offset += s->atlasDof[q]; in PetscSectionSetUp()
1320 for (f = 0, foff = s->atlasOff[q]; f < s->numFields; ++f) { in PetscSectionSetUp()
1321 PetscSection sf = s->field[f]; in PetscSectionSetUp()
1329 for (f = 0; f < s->numFields; ++f) { in PetscSectionSetUp()
1330 PetscSection sf = s->field[f]; in PetscSectionSetUp()
1332 for (PetscInt p = 0; p < s->pEnd - s->pStart; ++p) { in PetscSectionSetUp()
1340 for (PetscInt p = 0; p < s->pEnd - s->pStart; ++p) s->atlasOff[p] = -1; in PetscSectionSetUp()
1342 if (s->perm) PetscCall(ISRestoreIndices(s->perm, &pind)); in PetscSectionSetUp()
1344 PetscCall(PetscSectionSetUpBC(s)); in PetscSectionSetUp()
1345 for (f = 0; f < s->numFields; ++f) PetscCall(PetscSectionSetUpBC(s->field[f])); in PetscSectionSetUp()
1379 PetscErrorCode PetscSectionGetMaxDof(PetscSection s, PetscInt *maxDof) in PetscSectionGetMaxDof() argument
1384 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetMaxDof()
1386 if (s->maxDof == PETSC_INT_MIN) { in PetscSectionGetMaxDof()
1387 s->maxDof = 0; in PetscSectionGetMaxDof()
1388 for (p = 0; p < s->pEnd - s->pStart; ++p) s->maxDof = PetscMax(s->maxDof, s->atlasDof[p]); in PetscSectionGetMaxDof()
1390 *maxDof = s->maxDof; in PetscSectionGetMaxDof()
1409 PetscErrorCode PetscSectionGetStorageSize(PetscSection s, PetscInt *size) in PetscSectionGetStorageSize() argument
1414 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetStorageSize()
1416 for (PetscInt p = 0; p < s->pEnd - s->pStart; ++p) n += s->atlasDof[p] > 0 ? s->atlasDof[p] : 0; in PetscSectionGetStorageSize()
1436 PetscErrorCode PetscSectionGetConstrainedStorageSize(PetscSection s, PetscInt *size) in PetscSectionGetConstrainedStorageSize() argument
1441 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetConstrainedStorageSize()
1443 for (PetscInt p = 0; p < s->pEnd - s->pStart; ++p) { in PetscSectionGetConstrainedStorageSize()
1444 const PetscInt cdof = s->bc ? s->bc->atlasDof[p] : 0; in PetscSectionGetConstrainedStorageSize()
1445 n += s->atlasDof[p] > 0 ? s->atlasDof[p] - cdof : 0; in PetscSectionGetConstrainedStorageSize()
1475 PetscErrorCode PetscSectionCreateGlobalSection(PetscSection s, PetscSF sf, PetscBool usePermutation… in PetscSectionCreateGlobalSection() argument
1485 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionCreateGlobalSection()
1487 PetscValidLogicalCollectiveBool(s, usePermutation, 3); in PetscSectionCreateGlobalSection()
1488 PetscValidLogicalCollectiveBool(s, includeConstraints, 4); in PetscSectionCreateGlobalSection()
1489 PetscValidLogicalCollectiveBool(s, localOffsets, 5); in PetscSectionCreateGlobalSection()
1491 PetscCheck(s->pointMajor, PETSC_COMM_SELF, PETSC_ERR_SUP, "No support for field major ordering"); in PetscSectionCreateGlobalSection()
1492 PetscCall(PetscSectionCreate(PetscObjectComm((PetscObject)s), &gs)); in PetscSectionCreateGlobalSection()
1493 PetscCall(PetscSectionGetNumFields(s, &numFields)); in PetscSectionCreateGlobalSection()
1495 PetscCall(PetscSectionGetChart(s, &pStart, &pEnd)); in PetscSectionCreateGlobalSection()
1510 PetscCall(PetscSectionGetDof(s, p, &dof)); in PetscSectionCreateGlobalSection()
1512 PetscCall(PetscSectionGetConstraintDof(s, p, &cdof)); in PetscSectionCreateGlobalSection()
1517 …if (gs->bcIndices) PetscCall(PetscArraycpy(gs->bcIndices, s->bcIndices, gs->bc->atlasOff[gs->bc->p… in PetscSectionCreateGlobalSection()
1525 PetscCall(PetscSectionGetDof(s, p, &dof)); in PetscSectionCreateGlobalSection()
1531 if (usePermutation && s->perm) PetscCall(ISGetIndices(s->perm, &pind)); in PetscSectionCreateGlobalSection()
1535 cdof = (!includeConstraints && s->bc) ? s->bc->atlasDof[q] : 0; in PetscSectionCreateGlobalSection()
1547 if (usePermutation && s->perm) PetscCall(ISRestoreIndices(s->perm, &pind)); in PetscSectionCreateGlobalSection()
1563 PetscCall(PetscSectionGetFieldComponents(s, f, &numComponents)); in PetscSectionCreateGlobalSection()
1565 PetscCall(PetscSectionGetFieldName(s, f, &name)); in PetscSectionCreateGlobalSection()
1571 PetscCall(PetscSectionGetFieldConstraintDof(s, p, f, &cdof)); in PetscSectionCreateGlobalSection()
1573 PetscCall(PetscSectionGetFieldDof(s, p, f, &dof)); in PetscSectionCreateGlobalSection()
1584 …if (gfs->bcIndices) PetscCall(PetscArraycpy(gfs->bcIndices, s->field[f]->bcIndices, gfs->bc->atlas… in PetscSectionCreateGlobalSection()
1621 PetscErrorCode PetscSectionCreateGlobalSectionCensored(PetscSection s, PetscSF sf, PetscBool includ… in PetscSectionCreateGlobalSectionCensored() argument
1629 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionCreateGlobalSectionCensored()
1632 PetscCall(PetscSectionCreate(PetscObjectComm((PetscObject)s), gsection)); in PetscSectionCreateGlobalSectionCensored()
1633 PetscCall(PetscSectionGetChart(s, &pStart, &pEnd)); in PetscSectionCreateGlobalSectionCensored()
1654 PetscCall(PetscSectionGetDof(s, p, &dof)); in PetscSectionCreateGlobalSectionCensored()
1656 PetscCall(PetscSectionGetConstraintDof(s, p, &cdof)); in PetscSectionCreateGlobalSectionCensored()
1671 if (s->perm) PetscCall(ISGetIndices(s->perm, &pind)); in PetscSectionCreateGlobalSectionCensored()
1675 cdof = (!includeConstraints && s->bc) ? s->bc->atlasDof[q] : 0; in PetscSectionCreateGlobalSectionCensored()
1679 PetscCallMPI(MPI_Scan(&off, &globalOff, 1, MPIU_INT, MPI_SUM, PetscObjectComm((PetscObject)s))); in PetscSectionCreateGlobalSectionCensored()
1685 if (s->perm) PetscCall(ISRestoreIndices(s->perm, &pind)); in PetscSectionCreateGlobalSectionCensored()
1735 PetscErrorCode PetscSectionGetPointLayout(MPI_Comm comm, PetscSection s, PetscLayout *layout) in PetscSectionGetPointLayout() argument
1740 PetscCall(PetscSectionGetChart(s, &pStart, &pEnd)); in PetscSectionGetPointLayout()
1744 PetscCall(PetscSectionGetDof(s, p, &dof)); in PetscSectionGetPointLayout()
1782 PetscErrorCode PetscSectionGetValueLayout(MPI_Comm comm, PetscSection s, PetscLayout *layout) in PetscSectionGetValueLayout() argument
1787 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 2); in PetscSectionGetValueLayout()
1789 PetscCall(PetscSectionGetChart(s, &pStart, &pEnd)); in PetscSectionGetValueLayout()
1793 PetscCall(PetscSectionGetDof(s, p, &dof)); in PetscSectionGetValueLayout()
1794 PetscCall(PetscSectionGetConstraintDof(s, p, &cdof)); in PetscSectionGetValueLayout()
1827 PetscErrorCode PetscSectionGetOffset(PetscSection s, PetscInt point, PetscInt *offset) in PetscSectionGetOffset() argument
1830 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetOffset()
1832 …s->pStart) && !(point >= s->pEnd), PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Section point %" Pe… in PetscSectionGetOffset()
1833 *offset = s->atlasOff[point - s->pStart]; in PetscSectionGetOffset()
1854 PetscErrorCode PetscSectionSetOffset(PetscSection s, PetscInt point, PetscInt offset) in PetscSectionSetOffset() argument
1857 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetOffset()
1858 …s->pStart) && !(point >= s->pEnd), PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Section point %" Pe… in PetscSectionSetOffset()
1859 s->atlasOff[point - s->pStart] = offset; in PetscSectionSetOffset()
1885 PetscErrorCode PetscSectionGetFieldOffset(PetscSection s, PetscInt point, PetscInt field, PetscInt … in PetscSectionGetFieldOffset() argument
1888 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetFieldOffset()
1890 PetscSectionCheckValidField(field, s->numFields); in PetscSectionGetFieldOffset()
1891 PetscCall(PetscSectionGetOffset(s->field[field], point, offset)); in PetscSectionGetFieldOffset()
1913 PetscErrorCode PetscSectionSetFieldOffset(PetscSection s, PetscInt point, PetscInt field, PetscInt … in PetscSectionSetFieldOffset() argument
1916 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetFieldOffset()
1917 PetscSectionCheckValidField(field, s->numFields); in PetscSectionSetFieldOffset()
1918 PetscCall(PetscSectionSetOffset(s->field[field], point, offset)); in PetscSectionSetFieldOffset()
1951 PetscErrorCode PetscSectionGetFieldPointOffset(PetscSection s, PetscInt point, PetscInt field, Pets… in PetscSectionGetFieldPointOffset() argument
1956 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetFieldPointOffset()
1958 PetscSectionCheckValidField(field, s->numFields); in PetscSectionGetFieldPointOffset()
1959 PetscCall(PetscSectionGetOffset(s, point, &off)); in PetscSectionGetFieldPointOffset()
1960 PetscCall(PetscSectionGetOffset(s->field[field], point, &foff)); in PetscSectionGetFieldPointOffset()
1981 PetscErrorCode PetscSectionGetOffsetRange(PetscSection s, PetscInt *start, PetscInt *end) in PetscSectionGetOffsetRange() argument
1986 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetOffsetRange()
1987 if (s->atlasOff) { in PetscSectionGetOffsetRange()
1988 os = s->atlasOff[0]; in PetscSectionGetOffsetRange()
1989 oe = s->atlasOff[0]; in PetscSectionGetOffsetRange()
1991 PetscCall(PetscSectionGetChart(s, &pStart, &pEnd)); in PetscSectionGetOffsetRange()
1993 PetscInt dof = s->atlasDof[p], off = s->atlasOff[p]; in PetscSectionGetOffsetRange()
2027 PetscErrorCode PetscSectionCreateSubsection(PetscSection s, PetscInt len, const PetscInt fields[], … in PetscSectionCreateSubsection() argument
2033 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionCreateSubsection()
2036 PetscCall(PetscSectionGetNumFields(s, &nF)); in PetscSectionCreateSubsection()
2037 …PetscCheck(len <= nF, PetscObjectComm((PetscObject)s), PETSC_ERR_ARG_WRONG, "Number of requested f… in PetscSectionCreateSubsection()
2038 PetscCall(PetscSectionCreate(PetscObjectComm((PetscObject)s), subs)); in PetscSectionCreateSubsection()
2045 PetscCall(PetscSectionGetFieldName(s, fields[f], &name)); in PetscSectionCreateSubsection()
2047 PetscCall(PetscSectionGetFieldComponents(s, fields[f], &numComp)); in PetscSectionCreateSubsection()
2049 for (c = 0; c < s->numFieldComponents[fields[f]]; ++c) { in PetscSectionCreateSubsection()
2050 PetscCall(PetscSectionGetComponentName(s, fields[f], c, &name)); in PetscSectionCreateSubsection()
2053 PetscCall(PetscSectionGetFieldSym(s, fields[f], &sym)); in PetscSectionCreateSubsection()
2056 PetscCall(PetscSectionGetChart(s, &pStart, &pEnd)); in PetscSectionCreateSubsection()
2062 PetscCall(PetscSectionGetFieldDof(s, p, fields[f], &fdof)); in PetscSectionCreateSubsection()
2064 PetscCall(PetscSectionGetFieldConstraintDof(s, p, fields[f], &cfdof)); in PetscSectionCreateSubsection()
2075 PetscCall(PetscSectionGetBlockStarts(s, &bst)); in PetscSectionCreateSubsection()
2095 PetscCall(PetscSectionGetFieldDof(s, p, fields[f], &fdof)); in PetscSectionCreateSubsection()
2096 PetscCall(PetscSectionGetFieldConstraintDof(s, p, fields[f], &cfdof)); in PetscSectionCreateSubsection()
2097 PetscCall(PetscSectionGetFieldConstraintIndices(s, p, fields[f], &oldIndices)); in PetscSectionCreateSubsection()
2133 PetscErrorCode PetscSectionCreateComponentSubsection(PetscSection s, PetscInt len, const PetscInt c… in PetscSectionCreateComponentSubsection() argument
2141 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionCreateComponentSubsection()
2144 PetscCall(PetscSectionGetNumFields(s, &Nf)); in PetscSectionCreateComponentSubsection()
2145 …PetscCheck(Nf == 1, PetscObjectComm((PetscObject)s), PETSC_ERR_ARG_WRONG, "This method can only ha… in PetscSectionCreateComponentSubsection()
2146 PetscCall(PetscSectionCreate(PetscObjectComm((PetscObject)s), subs)); in PetscSectionCreateComponentSubsection()
2148 PetscCall(PetscSectionGetFieldName(s, 0, &name)); in PetscSectionCreateComponentSubsection()
2151 PetscCall(PetscSectionGetFieldSym(s, 0, &sym)); in PetscSectionCreateComponentSubsection()
2154 PetscCall(PetscSectionGetComponentName(s, 0, comps[c], &name)); in PetscSectionCreateComponentSubsection()
2157 PetscCall(PetscSectionGetChart(s, &pStart, &pEnd)); in PetscSectionCreateComponentSubsection()
2162 PetscCall(PetscSectionGetDof(s, p, &dof)); in PetscSectionCreateComponentSubsection()
2164 PetscCall(PetscSectionGetFieldConstraintDof(s, p, 0, &cfdof)); in PetscSectionCreateComponentSubsection()
2165 PetscCall(PetscSectionGetConstraintDof(s, p, &cdof)); in PetscSectionCreateComponentSubsection()
2196 PetscErrorCode PetscSectionCreateSupersection(PetscSection s[], PetscInt len, PetscSection *supers) in PetscSectionCreateSupersection() argument
2205 PetscCall(PetscSectionGetNumFields(s[i], &nf)); in PetscSectionCreateSupersection()
2206 PetscCall(PetscSectionGetChart(s[i], &pStarti, &pEndi)); in PetscSectionCreateSupersection()
2211 PetscCall(PetscSectionCreate(PetscObjectComm((PetscObject)s[0]), supers)); in PetscSectionCreateSupersection()
2216 PetscCall(PetscSectionGetNumFields(s[i], &nf)); in PetscSectionCreateSupersection()
2221 PetscCall(PetscSectionGetFieldName(s[i], fi, &name)); in PetscSectionCreateSupersection()
2223 PetscCall(PetscSectionGetFieldComponents(s[i], fi, &numComp)); in PetscSectionCreateSupersection()
2225 for (ci = 0; ci < s[i]->numFieldComponents[fi]; ++ci) { in PetscSectionCreateSupersection()
2226 PetscCall(PetscSectionGetComponentName(s[i], fi, ci, &name)); in PetscSectionCreateSupersection()
2239 PetscCall(PetscSectionGetNumFields(s[i], &nf)); in PetscSectionCreateSupersection()
2240 PetscCall(PetscSectionGetChart(s[i], &pStarti, &pEndi)); in PetscSectionCreateSupersection()
2243 PetscCall(PetscSectionGetFieldDof(s[i], p, fi, &fdof)); in PetscSectionCreateSupersection()
2245 PetscCall(PetscSectionGetFieldConstraintDof(s[i], p, fi, &cfdof)); in PetscSectionCreateSupersection()
2271 PetscCall(PetscSectionGetNumFields(s[i], &nf)); in PetscSectionCreateSupersection()
2272 PetscCall(PetscSectionGetChart(s[i], &pStarti, &pEndi)); in PetscSectionCreateSupersection()
2275 PetscCall(PetscSectionGetFieldDof(s[i], p, fi, &fdof)); in PetscSectionCreateSupersection()
2276 PetscCall(PetscSectionGetFieldConstraintDof(s[i], p, fi, &cfdof)); in PetscSectionCreateSupersection()
2277 PetscCall(PetscSectionGetFieldConstraintIndices(s[i], p, fi, &oldIndices)); in PetscSectionCreateSupersection()
2283 PetscCall(PetscSectionGetDof(s[i], p, &dof)); in PetscSectionCreateSupersection()
2294 static PetscErrorCode PetscSectionCreateSubplexSection_Private(PetscSection s, IS subpointIS, Petsc… in PetscSectionCreateSubplexSection_Private() argument
2301 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionCreateSubplexSection_Private()
2304 PetscCall(PetscSectionGetNumFields(s, &numFields)); in PetscSectionCreateSubplexSection_Private()
2305 PetscCall(PetscSectionCreate(PetscObjectComm((PetscObject)s), subs)); in PetscSectionCreateSubplexSection_Private()
2311 PetscCall(PetscSectionGetFieldName(s, f, &name)); in PetscSectionCreateSubplexSection_Private()
2313 PetscCall(PetscSectionGetFieldComponents(s, f, &numComp)); in PetscSectionCreateSubplexSection_Private()
2315 for (c = 0; c < s->numFieldComponents[f]; ++c) { in PetscSectionCreateSubplexSection_Private()
2316 PetscCall(PetscSectionGetComponentName(s, f, c, &name)); in PetscSectionCreateSubplexSection_Private()
2325 PetscCall(PetscSectionGetChart(s, &pStart, &pEnd)); in PetscSectionCreateSubplexSection_Private()
2351 PetscCall(PetscSectionGetFieldDof(s, p, f, &fdof)); in PetscSectionCreateSubplexSection_Private()
2353 PetscCall(PetscSectionGetFieldConstraintDof(s, p, f, &cfdof)); in PetscSectionCreateSubplexSection_Private()
2356 PetscCall(PetscSectionGetDof(s, p, &dof)); in PetscSectionCreateSubplexSection_Private()
2358 PetscCall(PetscSectionGetConstraintDof(s, p, &cdof)); in PetscSectionCreateSubplexSection_Private()
2371 PetscCall(PetscSectionGetFieldOffset(s, p, f, &foff)); in PetscSectionCreateSubplexSection_Private()
2374 PetscCall(PetscSectionGetOffset(s, p, &off)); in PetscSectionCreateSubplexSection_Private()
2384 PetscCall(PetscSectionGetFieldConstraintIndices(s, points[subp - spStart], f, &indices)); in PetscSectionCreateSubplexSection_Private()
2387 PetscCall(PetscSectionGetConstraintIndices(s, points[subp - spStart], &indices)); in PetscSectionCreateSubplexSection_Private()
2420 PetscErrorCode PetscSectionCreateSubmeshSection(PetscSection s, IS subpointIS, PetscSection *subs) in PetscSectionCreateSubmeshSection() argument
2423 PetscCall(PetscSectionCreateSubplexSection_Private(s, subpointIS, PETSC_TRUE, subs)); in PetscSectionCreateSubmeshSection()
2452 PetscErrorCode PetscSectionCreateSubdomainSection(PetscSection s, IS subpointMap, PetscSection *sub… in PetscSectionCreateSubdomainSection() argument
2455 PetscCall(PetscSectionCreateSubplexSection_Private(s, subpointMap, PETSC_FALSE, subs)); in PetscSectionCreateSubdomainSection()
2459 static PetscErrorCode PetscSectionView_ASCII(PetscSection s, PetscViewer viewer) in PetscSectionView_ASCII() argument
2468 for (p = 0; p < s->pEnd - s->pStart; ++p) { in PetscSectionView_ASCII()
2469 if (s->bc && s->bc->atlasDof[p] > 0) { in PetscSectionView_ASCII()
2471 …2" PetscInt_FMT " offset %3" PetscInt_FMT " constrained", p + s->pStart, s->atlasDof[p], s->atlasO… in PetscSectionView_ASCII()
2472 if (s->bcIndices) { in PetscSectionView_ASCII()
2473 …for (b = 0; b < s->bc->atlasDof[p]; ++b) PetscCall(PetscViewerASCIISynchronizedPrintf(viewer, " %"… in PetscSectionView_ASCII()
2477 …T ") dof %2" PetscInt_FMT " offset %3" PetscInt_FMT "\n", p + s->pStart, s->atlasDof[p], s->atlasO… in PetscSectionView_ASCII()
2482 if (s->sym) { in PetscSectionView_ASCII()
2484 PetscCall(PetscSectionSymView(s->sym, viewer)); in PetscSectionView_ASCII()
2536 PetscErrorCode PetscSectionView(PetscSection s, PetscViewer viewer) in PetscSectionView() argument
2542 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionView()
2543 if (!viewer) PetscCall(PetscViewerASCIIGetStdout(PetscObjectComm((PetscObject)s), &viewer)); in PetscSectionView()
2548 PetscCall(PetscObjectPrintClassNamePrefixType((PetscObject)s, viewer)); in PetscSectionView()
2549 if (s->numFields) { in PetscSectionView()
2550 PetscCall(PetscViewerASCIIPrintf(viewer, "%" PetscInt_FMT " fields\n", s->numFields)); in PetscSectionView()
2551 for (f = 0; f < s->numFields; ++f) { in PetscSectionView()
2552 … %" PetscInt_FMT " \"%s\" with %" PetscInt_FMT " components\n", f, s->fieldNames[f], s->numFieldCo… in PetscSectionView()
2553 PetscCall(PetscSectionView_ASCII(s->field[f], viewer)); in PetscSectionView()
2556 PetscCall(PetscSectionView_ASCII(s, viewer)); in PetscSectionView()
2560 PetscCall(PetscSectionView_HDF5_Internal(s, viewer)); in PetscSectionView()
2562 …SETERRQ(PetscObjectComm((PetscObject)s), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease… in PetscSectionView()
2589 PetscErrorCode PetscSectionLoad(PetscSection s, PetscViewer viewer) in PetscSectionLoad() argument
2594 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionLoad()
2597 …PetscCheck(ishdf5, PetscObjectComm((PetscObject)s), PETSC_ERR_SUP, "Viewer type %s not yet support… in PetscSectionLoad()
2599 PetscCall(PetscSectionLoad_HDF5_Internal(s, viewer)); in PetscSectionLoad()
2602 …SETERRQ(PetscObjectComm((PetscObject)s), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease… in PetscSectionLoad()
2666 PetscErrorCode PetscSectionArrayView_ASCII_Internal(PetscSection s, void *array, PetscDataType data… in PetscSectionArrayView_ASCII_Internal() argument
2675 for (p = 0; p < s->pEnd - s->pStart; ++p) { in PetscSectionArrayView_ASCII_Internal()
2676 if (s->bc && (s->bc->atlasDof[p] > 0)) { in PetscSectionArrayView_ASCII_Internal()
2679 …nt_FMT ") dof %2" PetscInt_FMT " offset %3" PetscInt_FMT, p + s->pStart, s->atlasDof[p], s->atlasO… in PetscSectionArrayView_ASCII_Internal()
2680 …for (i = s->atlasOff[p]; i < s->atlasOff[p] + s->atlasDof[p]; ++i) PetscCall(PrintArrayElement(arr… in PetscSectionArrayView_ASCII_Internal()
2682 …for (b = 0; b < s->bc->atlasDof[p]; ++b) PetscCall(PetscViewerASCIISynchronizedPrintf(viewer, " %"… in PetscSectionArrayView_ASCII_Internal()
2685 …nt_FMT ") dof %2" PetscInt_FMT " offset %3" PetscInt_FMT, p + s->pStart, s->atlasDof[p], s->atlasO… in PetscSectionArrayView_ASCII_Internal()
2686 …for (i = s->atlasOff[p]; i < s->atlasOff[p] + s->atlasDof[p]; ++i) PetscCall(PrintArrayElement(arr… in PetscSectionArrayView_ASCII_Internal()
2710 PetscErrorCode PetscSectionArrayView(PetscSection s, void *array, PetscDataType data_type, PetscVie… in PetscSectionArrayView() argument
2716 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionArrayView()
2719 PetscCall(PetscSectionGetStorageSize(s, &size)); in PetscSectionArrayView()
2720 …PetscCheck(size == 0, PetscObjectComm((PetscObject)s), PETSC_ERR_ARG_SIZ, "NULL array passed, but … in PetscSectionArrayView()
2722 if (!viewer) PetscCall(PetscViewerASCIIGetStdout(PetscObjectComm((PetscObject)s), &viewer)); in PetscSectionArrayView()
2726 if (s->numFields) { in PetscSectionArrayView()
2727 … PetscCall(PetscViewerASCIIPrintf(viewer, "Array with %" PetscInt_FMT " fields\n", s->numFields)); in PetscSectionArrayView()
2728 for (f = 0; f < s->numFields; ++f) { in PetscSectionArrayView()
2729 …viewer, " field %" PetscInt_FMT " with %" PetscInt_FMT " components\n", f, s->numFieldComponents[… in PetscSectionArrayView()
2730 PetscCall(PetscSectionArrayView_ASCII_Internal(s->field[f], array, data_type, viewer)); in PetscSectionArrayView()
2733 PetscCall(PetscSectionArrayView_ASCII_Internal(s, array, data_type, viewer)); in PetscSectionArrayView()
2776 PetscErrorCode PetscSectionReset(PetscSection s) in PetscSectionReset() argument
2781 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionReset()
2782 for (f = 0; f < s->numFields; ++f) { in PetscSectionReset()
2783 PetscCall(PetscSectionDestroy(&s->field[f])); in PetscSectionReset()
2784 PetscCall(PetscFree(s->fieldNames[f])); in PetscSectionReset()
2785 for (c = 0; c < s->numFieldComponents[f]; ++c) PetscCall(PetscFree(s->compNames[f][c])); in PetscSectionReset()
2786 PetscCall(PetscFree(s->compNames[f])); in PetscSectionReset()
2788 PetscCall(PetscFree(s->numFieldComponents)); in PetscSectionReset()
2789 PetscCall(PetscFree(s->fieldNames)); in PetscSectionReset()
2790 PetscCall(PetscFree(s->compNames)); in PetscSectionReset()
2791 PetscCall(PetscFree(s->field)); in PetscSectionReset()
2792 PetscCall(PetscSectionDestroy(&s->bc)); in PetscSectionReset()
2793 PetscCall(PetscFree(s->bcIndices)); in PetscSectionReset()
2794 PetscCall(PetscFree2(s->atlasDof, s->atlasOff)); in PetscSectionReset()
2795 PetscCall(PetscSectionDestroy(&s->clSection)); in PetscSectionReset()
2796 PetscCall(ISDestroy(&s->clPoints)); in PetscSectionReset()
2797 PetscCall(ISDestroy(&s->perm)); in PetscSectionReset()
2798 PetscCall(PetscBTDestroy(&s->blockStarts)); in PetscSectionReset()
2799 PetscCall(PetscSectionResetClosurePermutation(s)); in PetscSectionReset()
2800 PetscCall(PetscSectionSymDestroy(&s->sym)); in PetscSectionReset()
2801 PetscCall(PetscSectionDestroy(&s->clSection)); in PetscSectionReset()
2802 PetscCall(ISDestroy(&s->clPoints)); in PetscSectionReset()
2803 PetscCall(PetscSectionInvalidateMaxDof_Internal(s)); in PetscSectionReset()
2804 s->pStart = -1; in PetscSectionReset()
2805 s->pEnd = -1; in PetscSectionReset()
2806 s->maxDof = 0; in PetscSectionReset()
2807 s->setup = PETSC_FALSE; in PetscSectionReset()
2808 s->numFields = 0; in PetscSectionReset()
2809 s->clObj = NULL; in PetscSectionReset()
2825 PetscErrorCode PetscSectionDestroy(PetscSection *s) in PetscSectionDestroy() argument
2828 if (!*s) PetscFunctionReturn(PETSC_SUCCESS); in PetscSectionDestroy()
2829 PetscValidHeaderSpecific(*s, PETSC_SECTION_CLASSID, 1); in PetscSectionDestroy()
2830 if (--((PetscObject)*s)->refct > 0) { in PetscSectionDestroy()
2831 *s = NULL; in PetscSectionDestroy()
2834 PetscCall(PetscSectionReset(*s)); in PetscSectionDestroy()
2835 PetscCall(PetscHeaderDestroy(s)); in PetscSectionDestroy()
2839 static PetscErrorCode VecIntGetValuesSection_Private(const PetscInt *baseArray, PetscSection s, Pet… in VecIntGetValuesSection_Private() argument
2841 const PetscInt p = point - s->pStart; in VecIntGetValuesSection_Private()
2844 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 2); in VecIntGetValuesSection_Private()
2845 *values = &baseArray[s->atlasOff[p]]; in VecIntGetValuesSection_Private()
2849 static PetscErrorCode VecIntSetValuesSection_Private(PetscInt *baseArray, PetscSection s, PetscInt … in VecIntSetValuesSection_Private() argument
2852 const PetscInt p = point - s->pStart; in VecIntSetValuesSection_Private()
2857 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 2); in VecIntSetValuesSection_Private()
2858 PetscCall(PetscSectionGetConstraintDof(s, p, &cDim)); in VecIntSetValuesSection_Private()
2859 array = &baseArray[s->atlasOff[p]]; in VecIntSetValuesSection_Private()
2862 const PetscInt dim = s->atlasDof[p]; in VecIntSetValuesSection_Private()
2874 for (field = 0; field < s->numFields; ++field) { in VecIntSetValuesSection_Private()
2875 const PetscInt dim = s->field[field]->atlasDof[p]; in VecIntSetValuesSection_Private()
2883 const PetscInt dim = s->atlasDof[p]; in VecIntSetValuesSection_Private()
2887 PetscCall(PetscSectionGetConstraintIndices(s, point, &cDof)); in VecIntSetValuesSection_Private()
2911 PetscCall(PetscSectionGetConstraintIndices(s, point, &cDof)); in VecIntSetValuesSection_Private()
2912 for (field = 0; field < s->numFields; ++field) { in VecIntSetValuesSection_Private()
2913 const PetscInt dim = s->field[field]->atlasDof[p]; /* PetscSectionGetFieldDof() */ in VecIntSetValuesSection_Private()
2914 … const PetscInt tDim = s->field[field]->bc->atlasDof[p]; /* PetscSectionGetFieldConstraintDof() */ in VecIntSetValuesSection_Private()
2948 PetscErrorCode PetscSectionHasConstraints(PetscSection s, PetscBool *hasConstraints) in PetscSectionHasConstraints() argument
2951 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionHasConstraints()
2953 *hasConstraints = s->bc ? PETSC_TRUE : PETSC_FALSE; in PetscSectionHasConstraints()
2976 PetscErrorCode PetscSectionGetConstraintIndices(PetscSection s, PetscInt point, const PetscInt *ind… in PetscSectionGetConstraintIndices() argument
2979 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetConstraintIndices()
2980 if (s->bc) PetscCall(VecIntGetValuesSection_Private(s->bcIndices, s->bc, point, indices)); in PetscSectionGetConstraintIndices()
2999 PetscErrorCode PetscSectionSetConstraintIndices(PetscSection s, PetscInt point, const PetscInt indi… in PetscSectionSetConstraintIndices() argument
3002 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetConstraintIndices()
3003 if (s->bc) { in PetscSectionSetConstraintIndices()
3004 const PetscInt dof = s->atlasDof[point]; in PetscSectionSetConstraintIndices()
3005 const PetscInt cdof = s->bc->atlasDof[point]; in PetscSectionSetConstraintIndices()
3010 PetscCall(VecIntSetValuesSection_Private(s->bcIndices, s->bc, point, indices, INSERT_VALUES)); in PetscSectionSetConstraintIndices()
3035 PetscErrorCode PetscSectionGetFieldConstraintIndices(PetscSection s, PetscInt point, PetscInt field… in PetscSectionGetFieldConstraintIndices() argument
3038 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetFieldConstraintIndices()
3040 PetscSectionCheckValidField(field, s->numFields); in PetscSectionGetFieldConstraintIndices()
3041 PetscCall(PetscSectionGetConstraintIndices(s->field[field], point, indices)); in PetscSectionGetFieldConstraintIndices()
3060 PetscErrorCode PetscSectionSetFieldConstraintIndices(PetscSection s, PetscInt point, PetscInt field… in PetscSectionSetFieldConstraintIndices() argument
3063 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetFieldConstraintIndices()
3064 PetscSectionCheckValidField(field, s->numFields); in PetscSectionSetFieldConstraintIndices()
3065 PetscCall(PetscSectionSetConstraintIndices(s->field[field], point, indices)); in PetscSectionSetFieldConstraintIndices()
3092 PetscSection s = section, sNew; in PetscSectionPermute() local
3100 PetscCall(PetscSectionCreate(PetscObjectComm((PetscObject)s), &sNew)); in PetscSectionPermute()
3101 PetscCall(PetscSectionGetNumFields(s, &numFields)); in PetscSectionPermute()
3107 PetscCall(PetscSectionGetFieldName(s, f, &name)); in PetscSectionPermute()
3109 PetscCall(PetscSectionGetFieldComponents(s, f, &numComp)); in PetscSectionPermute()
3111 for (c = 0; c < s->numFieldComponents[f]; ++c) { in PetscSectionPermute()
3112 PetscCall(PetscSectionGetComponentName(s, f, c, &name)); in PetscSectionPermute()
3118 PetscCall(PetscSectionGetChart(s, &pStart, &pEnd)); in PetscSectionPermute()
3124 PetscCall(PetscSectionGetDof(s, p, &dof)); in PetscSectionPermute()
3126 PetscCall(PetscSectionGetConstraintDof(s, p, &cdof)); in PetscSectionPermute()
3129 PetscCall(PetscSectionGetFieldDof(s, p, f, &dof)); in PetscSectionPermute()
3131 PetscCall(PetscSectionGetFieldConstraintDof(s, p, f, &cdof)); in PetscSectionPermute()
3140 PetscCall(PetscSectionGetConstraintDof(s, p, &cdof)); in PetscSectionPermute()
3142 PetscCall(PetscSectionGetConstraintIndices(s, p, &cind)); in PetscSectionPermute()
3146 PetscCall(PetscSectionGetFieldConstraintDof(s, p, f, &cdof)); in PetscSectionPermute()
3148 PetscCall(PetscSectionGetFieldConstraintIndices(s, p, f, &cind)); in PetscSectionPermute()
3405 PetscErrorCode PetscSectionGetField(PetscSection s, PetscInt field, PetscSection *subs) in PetscSectionGetField() argument
3408 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetField()
3410 PetscSectionCheckValidField(field, s->numFields); in PetscSectionGetField()
3411 *subs = s->field[field]; in PetscSectionGetField()
3964 PetscErrorCode PetscSectionGetUseFieldOffsets(PetscSection s, PetscBool *flg) in PetscSectionGetUseFieldOffsets() argument
3967 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionGetUseFieldOffsets()
3968 *flg = s->useFieldOff; in PetscSectionGetUseFieldOffsets()
3985 PetscErrorCode PetscSectionSetUseFieldOffsets(PetscSection s, PetscBool flg) in PetscSectionSetUseFieldOffsets() argument
3988 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1); in PetscSectionSetUseFieldOffsets()
3989 s->useFieldOff = flg; in PetscSectionSetUseFieldOffsets()
3997 PetscCall(PetscSectionGetStorageSize(s, &size)); \
4001 PetscCall(PetscSectionGetOffset(s, i, &o1)); \
4002 PetscCall(PetscSectionGetDof(s, i, &n)); \
4029 PetscSection s; in PetscSectionExtractDofsFromArray() local
4044 PetscCall(PetscSectionCreate(PETSC_COMM_SELF, &s)); in PetscSectionExtractDofsFromArray()
4045 PetscCall(PetscSectionSetChart(s, 0, npoints)); in PetscSectionExtractDofsFromArray()
4049 PetscCall(PetscSectionSetDof(s, i, n)); in PetscSectionExtractDofsFromArray()
4051 PetscCall(PetscSectionSetUp(s)); in PetscSectionExtractDofsFromArray()
4062 *newSection = s; in PetscSectionExtractDofsFromArray()
4064 PetscCall(PetscSectionDestroy(&s)); in PetscSectionExtractDofsFromArray()