plexsection.c (942d34d015d97e642391562984a785096884f5d1) plexsection.c (d02c7345ebed081476ce6bcdfd784b34c024d6ef)
1#include <petsc/private/dmpleximpl.h> /*I "petscdmplex.h" I*/
2
3/* Set the number of dof on each point and separate by fields */
4static PetscErrorCode DMPlexCreateSectionFields(DM dm, const PetscInt numComp[], PetscSection *section)
5{
6 DMLabel depthLabel;
7 PetscInt depth, Nf, f, pStart, pEnd;
8 PetscBool *isFE;

--- 437 unchanged lines hidden (view full) ---

446 PetscCall(PetscSectionViewFromOptions(*section, NULL, "-section_view"));
447 PetscFunctionReturn(PETSC_SUCCESS);
448}
449
450PetscErrorCode DMCreateLocalSection_Plex(DM dm)
451{
452 PetscSection section;
453 DMLabel *labels;
1#include <petsc/private/dmpleximpl.h> /*I "petscdmplex.h" I*/
2
3/* Set the number of dof on each point and separate by fields */
4static PetscErrorCode DMPlexCreateSectionFields(DM dm, const PetscInt numComp[], PetscSection *section)
5{
6 DMLabel depthLabel;
7 PetscInt depth, Nf, f, pStart, pEnd;
8 PetscBool *isFE;

--- 437 unchanged lines hidden (view full) ---

446 PetscCall(PetscSectionViewFromOptions(*section, NULL, "-section_view"));
447 PetscFunctionReturn(PETSC_SUCCESS);
448}
449
450PetscErrorCode DMCreateLocalSection_Plex(DM dm)
451{
452 PetscSection section;
453 DMLabel *labels;
454 IS *bcPoints, *bcComps;
454 IS *bcPoints, *bcComps, permIS;
455 PetscBT blockStarts;
455 PetscBool *isFE;
456 PetscInt *bcFields, *numComp, *numDof;
457 PetscInt depth, dim, numBC = 0, Nf, Nds, s, bc = 0, f;
458 PetscInt cStart, cEnd, cEndInterior;
459
460 PetscFunctionBegin;
461 PetscCall(DMGetNumFields(dm, &Nf));
462 PetscCall(DMGetDimension(dm, &dim));

--- 142 unchanged lines hidden (view full) ---

605 numDof[f * (dim + 1) + dim] = numComp[f];
606 }
607 }
608 PetscCall(DMPlexGetDepth(dm, &depth));
609 for (f = 0; f < Nf; ++f) {
610 PetscInt d;
611 for (d = 1; d < dim; ++d) PetscCheck(numDof[f * (dim + 1) + d] <= 0 || depth >= dim, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Mesh must be interpolated when unknowns are specified on edges or faces.");
612 }
456 PetscBool *isFE;
457 PetscInt *bcFields, *numComp, *numDof;
458 PetscInt depth, dim, numBC = 0, Nf, Nds, s, bc = 0, f;
459 PetscInt cStart, cEnd, cEndInterior;
460
461 PetscFunctionBegin;
462 PetscCall(DMGetNumFields(dm, &Nf));
463 PetscCall(DMGetDimension(dm, &dim));

--- 142 unchanged lines hidden (view full) ---

606 numDof[f * (dim + 1) + dim] = numComp[f];
607 }
608 }
609 PetscCall(DMPlexGetDepth(dm, &depth));
610 for (f = 0; f < Nf; ++f) {
611 PetscInt d;
612 for (d = 1; d < dim; ++d) PetscCheck(numDof[f * (dim + 1) + d] <= 0 || depth >= dim, PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Mesh must be interpolated when unknowns are specified on edges or faces.");
613 }
613 PetscCall(DMPlexCreateSection(dm, labels, numComp, numDof, numBC, bcFields, bcComps, bcPoints, NULL, &section));
614 PetscCall(DMPlexCreateSectionPermutation_Internal(dm, &permIS, &blockStarts));
615 PetscCall(DMPlexCreateSection(dm, labels, numComp, numDof, numBC, bcFields, bcComps, bcPoints, permIS, &section));
616 section->blockStarts = blockStarts;
617 PetscCall(ISDestroy(&permIS));
614 for (f = 0; f < Nf; ++f) {
615 PetscFE fe;
616 const char *name;
617
618 PetscCall(DMGetField(dm, f, NULL, (PetscObject *)&fe));
619 if (!((PetscObject)fe)->name) continue;
620 PetscCall(PetscObjectGetName((PetscObject)fe, &name));
621 PetscCall(PetscSectionSetFieldName(section, f, name));

--- 22 unchanged lines hidden ---
618 for (f = 0; f < Nf; ++f) {
619 PetscFE fe;
620 const char *name;
621
622 PetscCall(DMGetField(dm, f, NULL, (PetscObject *)&fe));
623 if (!((PetscObject)fe)->name) continue;
624 PetscCall(PetscObjectGetName((PetscObject)fe, &name));
625 PetscCall(PetscSectionSetFieldName(section, f, name));

--- 22 unchanged lines hidden ---