plex.c (8f3ed387c6c890f052e3e5bae76cca0a2df6753b) plex.c (e91c04dfc8a52dee1965211bb1cc8e5bf775178f)
1#include <petsc/private/dmpleximpl.h> /*I "petscdmplex.h" I*/
2#include <petsc/private/dmlabelimpl.h>
3#include <petsc/private/isimpl.h>
4#include <petsc/private/vecimpl.h>
5#include <petsc/private/glvisvecimpl.h>
6#include <petscsf.h>
7#include <petscds.h>
8#include <petscdraw.h>

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

9012 [1] 1 5
9013 [1] 2 6
9014 ```
9015
9016.seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellNumbering()`
9017@*/
9018PetscErrorCode DMPlexCreatePointNumbering(DM dm, IS *globalPointNumbers)
9019{
1#include <petsc/private/dmpleximpl.h> /*I "petscdmplex.h" I*/
2#include <petsc/private/dmlabelimpl.h>
3#include <petsc/private/isimpl.h>
4#include <petsc/private/vecimpl.h>
5#include <petsc/private/glvisvecimpl.h>
6#include <petscsf.h>
7#include <petscds.h>
8#include <petscdraw.h>

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

9012 [1] 1 5
9013 [1] 2 6
9014 ```
9015
9016.seealso: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexGetCellNumbering()`
9017@*/
9018PetscErrorCode DMPlexCreatePointNumbering(DM dm, IS *globalPointNumbers)
9019{
9020 IS nums[4];
9021 PetscInt depths[4], gdepths[4], starts[4];
9022 PetscInt depth, d, shift = 0;
9023 PetscBool empty = PETSC_FALSE;
9024 PetscMPIInt idepth;
9020 IS nums[4];
9021 PetscInt depths[4], gdepths[4], starts[4];
9022 PetscInt depth, d, shift = 0;
9023 PetscBool empty = PETSC_FALSE;
9025
9026 PetscFunctionBegin;
9027 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
9028 PetscCall(DMPlexGetDepth(dm, &depth));
9029 // For unstratified meshes use dim instead of depth
9030 if (depth < 0) PetscCall(DMGetDimension(dm, &depth));
9031 // If any stratum is empty, we must mark all empty
9032 for (d = 0; d <= depth; ++d) {

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

9037 if (!(starts[d] - end)) empty = PETSC_TRUE;
9038 }
9039 if (empty)
9040 for (d = 0; d <= depth; ++d) {
9041 depths[d] = -1;
9042 starts[d] = -1;
9043 }
9044 else PetscCall(PetscSortIntWithArray(depth + 1, starts, depths));
9024
9025 PetscFunctionBegin;
9026 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
9027 PetscCall(DMPlexGetDepth(dm, &depth));
9028 // For unstratified meshes use dim instead of depth
9029 if (depth < 0) PetscCall(DMGetDimension(dm, &depth));
9030 // If any stratum is empty, we must mark all empty
9031 for (d = 0; d <= depth; ++d) {

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

9036 if (!(starts[d] - end)) empty = PETSC_TRUE;
9037 }
9038 if (empty)
9039 for (d = 0; d <= depth; ++d) {
9040 depths[d] = -1;
9041 starts[d] = -1;
9042 }
9043 else PetscCall(PetscSortIntWithArray(depth + 1, starts, depths));
9045 PetscCall(PetscMPIIntCast(depth + 1, &idepth));
9046 PetscCallMPI(MPIU_Allreduce(depths, gdepths, idepth, MPIU_INT, MPI_MAX, PetscObjectComm((PetscObject)dm)));
9044 PetscCallMPI(MPIU_Allreduce(depths, gdepths, depth + 1, MPIU_INT, MPI_MAX, PetscObjectComm((PetscObject)dm)));
9047 for (d = 0; d <= depth; ++d) PetscCheck(starts[d] < 0 || depths[d] == gdepths[d], PETSC_COMM_SELF, PETSC_ERR_PLIB, "Expected depth %" PetscInt_FMT ", found %" PetscInt_FMT, depths[d], gdepths[d]);
9048 // Note here that 'shift' is collective, so that the numbering is stratified by depth
9049 for (d = 0; d <= depth; ++d) {
9050 PetscInt pStart, pEnd, gsize;
9051
9052 PetscCall(DMPlexGetDepthStratum(dm, gdepths[d], &pStart, &pEnd));
9053 PetscCall(DMPlexCreateNumbering_Plex(dm, pStart, pEnd, shift, &gsize, dm->sf, &nums[d]));
9054 shift += gsize;

--- 1784 unchanged lines hidden ---
9045 for (d = 0; d <= depth; ++d) PetscCheck(starts[d] < 0 || depths[d] == gdepths[d], PETSC_COMM_SELF, PETSC_ERR_PLIB, "Expected depth %" PetscInt_FMT ", found %" PetscInt_FMT, depths[d], gdepths[d]);
9046 // Note here that 'shift' is collective, so that the numbering is stratified by depth
9047 for (d = 0; d <= depth; ++d) {
9048 PetscInt pStart, pEnd, gsize;
9049
9050 PetscCall(DMPlexGetDepthStratum(dm, gdepths[d], &pStart, &pEnd));
9051 PetscCall(DMPlexCreateNumbering_Plex(dm, pStart, pEnd, shift, &gsize, dm->sf, &nums[d]));
9052 shift += gsize;

--- 1784 unchanged lines hidden ---