DMPlexReorderCellListByCurve#

Reorder a distributed cell list along a space-filling curve, so that each process owns a spatially compact set of cells

Synopsis#

#include "petscdmplex.h"   
PetscErrorCode DMPlexReorderCellListByCurve(MPI_Comm comm, DMPlexCurveType curvetype, PetscInt numCells, PetscInt numCorners, const PetscInt cells[], PetscInt spaceDim, PetscInt numVertices, PetscInt NVertices, const PetscReal coords[], PetscSF *migrationSF, PetscInt *newNumCells, PetscInt *newCells[])

Collective

Input Parameters#

  • comm - The communicator

  • curvetype - The space-filling curve, for example DMPLEXCURVEMORTON

  • numCells - The number of cells owned by this process

  • numCorners - The number of vertices for each cell

  • cells - The global vertex numbers for each cell, an array of numCells*numCorners values

  • spaceDim - The spatial dimension of the coordinates, at most 3

  • numVertices - The number of vertices owned by this process

  • NVertices - The global number of vertices, or PETSC_DECIDE

  • coords - The coordinates of the owned vertices, an array of numVertices*spaceDim values

Output Parameters#

  • migrationSF - PetscSF whose roots are the input cells and whose leaves are the reordered cells

  • newNumCells - The number of cells owned by this process after the reorder

  • newCells - The reordered cell connectivity, an array of newNumCells*numCorners values, which the caller must free

Notes#

Call this before DMPlexCreateFromCellListParallelPetsc() to reduce the cost of parallel interpolation. The vertex distribution stays unchanged, because the interpolation cost follows the cell distribution.

Use migrationSF with PetscSFBcastBegin() and PetscSFBcastEnd() to migrate per-cell data, such as region tags, into the new order.

The cells are equidistributed: every process receives the same number of cells, up to one cell.

This routine gathers the coordinates of every cell corner in order to compute cell centroids. It therefore holds numCellsnumCornersspaceDim reals at once, and it gathers a corner shared by several cells once per cell. If the centroids are already available, or that buffer is too large, call DMPlexReorderCellListByCurveFromCentroids() instead.

curvetype, numCorners, spaceDim, and NVertices must hold the same value on every process.

See Also#

DMPlex: Unstructured Grids, DMPLEX, DMPlexReorderCellListByCurveFromCentroids(), DMPlexCreateFromCellListParallelPetsc(), PetscSF

Level#

advanced

Location#

src/dm/impls/plex/plexsfc.c

Examples#

src/dm/impls/plex/tests/ex106.c


Index of all DMPlex routines
Table of Contents for all manual pages
Index of all manual pages