petsc4py.PETSc.DMPlex#

class petsc4py.PETSc.DMPlex#

Bases: DM

Encapsulate an unstructured mesh.

DMPlex encapsulates both topology and geometry. It is capable of parallel refinement and coarsening (using Pragmatic or ParMmg) and parallel redistribution for load balancing.

Methods Summary

computeCellGeometryFVM(cell)

Compute the volume for a given cell.

computeGradientClementInterpolant(locX, locC)

Return the L2 projection of the cellwise gradient of a function onto P1.

constructGhostCells([labelName])

Construct ghost cells which connect to every boundary face.

coordinatesLoad(viewer, sfxc)

Load coordinates into this DMPlex object.

coordinatesView(viewer)

Save DMPlex coordinates into a file.

create([comm])

Create a DMPlex object, which encapsulates an unstructured mesh.

createBoxMesh(faces[, lower, upper, ...])

Create a mesh on the tensor product of intervals.

createBoxSurfaceMesh(faces[, lower, upper, ...])

Create a mesh on the surface of a box mesh using tensor cells.

createCGNS(cgid[, interpolate, comm])

Create a DMPlex mesh from a CGNS file.

createCGNSFromFile(filename[, interpolate, comm])

"Create a DMPlex mesh from a CGNS file.

createClosureIndex(sec)

Calculate an index for sec for the closure operation.

createCoarsePointIS()

Create an IS covering the coarse DMPlex chart with the fine points as data.

createCohesiveSubmesh(hasLagrange, value)

Extract the hypersurface defined by one face of the cohesive cells.

createColoring([depth, distance])

Return the coloring of the connectivity graph of entities in the DMPlex.

createColoringLabel([depth, distance, ...])

Return the coloring of a labeled subset of the entities in the DMPlex.

createCoordinateSpace(degree, localized, project)

Create a finite element space for the coordinates.

createExodus(exoid[, interpolate, comm])

Create a DMPlex mesh from an ExodusII file ID.

createExodusFromFile(filename[, ...])

Create a DMPlex mesh from an ExodusII file.

createFromCellList(dim, cells, coords[, ...])

Create a DMPlex from a list of vertices for each cell on process 0.

createFromCellSectionParallel(dim, ...[, ...])

Create a DMPlex from arbitrary-sized cell-vertex relations across all ranks.

createFromFile(filename[, plexname, ...])

Create DMPlex from a file.

createGlobalToNaturalSF(section, sfMigration)

Create the SF for mapping Global Vec to the Natural Vec.

createGmsh(viewer[, interpolate, comm])

Create a DMPlex mesh from a Gmsh file viewer.

createNaturalVec()

Return a natural vector.

createPointNumbering()

Create a global numbering for all points.

createSection(numComp, numDof[, bcField, ...])

Create a Section based upon the DOF layout specification provided.

distribute([overlap])

Distribute the mesh and any associated sections.

distributeField(sf, sec, vec[, newsec, newvec])

Distribute field data with a given SF.

distributeGetDefault()

Return a flag indicating whether the DM should be distributed by default.

distributeOverlap([overlap])

Add partition overlap to a distributed non-overlapping DMPlex.

distributeSetDefault([flag])

Set flag indicating whether the DMPlex should be distributed by default.

distributionGetName()

Retrieve the name of the specific parallel distribution.

distributionSetName(name)

Set the name of the specific parallel distribution.

filter([label, value, ignoreHalo, ...])

Extract a subset of mesh cells defined by a label as a separate mesh.

generate(boundary[, name, interpolate])

Generate a mesh.

getAdjacency(p)

Return all points adjacent to the given point.

getAdjacencyUseAnchors()

Query whether adjacency in the mesh uses the point-to-point constraints.

getCellNumbering()

Return a global cell numbering for all cells on this process.

getCellType(p)

Return the polytope type of a given cell.

getCellTypeLabel()

Return the DMLabel recording the polytope type of each cell.

getChart()

Return the interval for all mesh points [pStart, pEnd).

getCone(p)

Return the points on the in-edges for this point in the DAG.

getConeOrientation(p)

Return the orientations on the in-edges for this point in the DAG.

getConeSize(p)

Return the number of in-edges for this point in the DAG.

getDepth()

Return the depth of the DAG representing this mesh.

getDepthStratum(svalue)

Return the bounds [start, end) for all points at a certain depth.

getFullJoin(points)

Return an array for the join of the set of points.

getHeightStratum(svalue)

Return the bounds [start, end) for all points at a certain height.

getJoin(points)

Return an array for the join of the set of points.

getMaxSizes()

Return the maximum number of in-edges and out-edges of the DAG.

getMeet(points)

Return an array for the meet of the set of points.

getMigrationSF()

Get the SF for migrating from a parent DM into this DM.

getMinRadius()

Return the minimum distance from any cell centroid to a face.

getOrdering(otype)

Calculate a reordering of the mesh.

getPartitioner()

Return the mesh partitioner.

getPlexCellCoordinates(cell)

Get coordinates for a cell, taking into account periodicity.

getPointDepth(point)

Return the depth of a given point.

getPointGlobal(point)

Return location of point data in global Vec.

getPointGlobalField(point, field)

Return location of point field data in global Vec.

getPointHeight(point)

Return the height of a given point.

getPointLocal(point)

Return location of point data in local Vec.

getPointLocalField(point, field)

Return location of point field data in local Vec.

getRefinementLimit()

Retrieve the maximum cell volume for refinement.

getRefinementUniform()

Retrieve the flag for uniform refinement.

getSaveTransform()

Return whether the DMPlex transform is saved.

getSubpointIS()

Return an IS covering the entire subdm chart.

getSubpointMap()

Return a DMLabel with point dimension as values.

getSupport(p)

Return the points on the out-edges for this point in the DAG.

getSupportSize(p)

Return the number of out-edges for this point in the DAG.

getTransform()

Return the transformation that produced this mesh.

getTransitiveClosure(p[, useCone])

Return the points and orientations on the transitive closure of this point.

getVecClosure(sec, vec, point)

Return an array of the values on the closure of a point.

getVertexNumbering()

Return a global vertex numbering for all vertices on this process.

globalToNaturalBegin(gv, nv)

Rearrange a Vec in the Global order to the natural order.

globalToNaturalEnd(gv, nv)

Rearrange a Vec in the Global order to the natural order.

globalVectorLoad(viewer, sectiondm, sf, vec)

Load on-disk vector data into a global vector.

globalVectorView(viewer, sectiondm, vec)

Save a global vector.

insertCone(p, conePos, conePoint)

DMPlexInsertCone - Insert a point into the in-edges for the point p in the DAG.

insertConeOrientation(p, conePos, ...)

Insert a point orientation for the in-edge for the point p in the DAG.

interpolate()

Convert to a mesh with all intermediate faces, edges, etc.

isDistributed()

Return the flag indicating if the mesh is distributed.

isSimplex()

Return the flag indicating if the first cell is a simplex.

labelCohesiveComplete(label, bdlabel, ...)

Add all other mesh pieces to complete the surface.

labelComplete(label[, useCone])

Add the transitive closure or the star of each point in the label.

labelsLoad(viewer, sfxc)

Load labels into this DMPlex object.

labelsView(viewer)

Save DMPlex labels into a file.

localVectorLoad(viewer, sectiondm, sf, vec)

Load on-disk vector data into a local vector.

localVectorView(viewer, sectiondm, vec)

Save a local vector.

markBoundaryFaces(label[, value])

Mark all faces on the boundary.

metricAverage2(metric1, metric2, metricAvg)

Compute and return the unweighted average of two metrics.

metricAverage3(metric1, metric2, metric3, ...)

Compute and return the unweighted average of three metrics.

metricCreate([field])

Create a Riemannian metric field.

metricCreateIsotropic(indicator[, field])

Construct an isotropic metric from an error indicator.

metricCreateUniform(alpha[, field])

Construct a uniform isotropic metric.

metricDeterminantCreate([field])

Create the determinant field for a Riemannian metric.

metricEnforceSPD(metric, ometric, determinant)

Enforce symmetric positive-definiteness of a metric.

metricGetGradationFactor()

Return the metric gradation factor.

metricGetHausdorffNumber()

Return the metric Hausdorff number.

metricGetMaximumAnisotropy()

Return the maximum tolerated metric anisotropy.

metricGetMaximumMagnitude()

Return the maximum tolerated metric magnitude.

metricGetMinimumMagnitude()

Return the minimum tolerated metric magnitude.

metricGetNormalizationOrder()

Return the order p for L-p normalization.

metricGetNumIterations()

Return the number of parallel adaptation iterations.

metricGetTargetComplexity()

Return the target metric complexity.

metricGetVerbosity()

Return the verbosity of the mesh adaptation package.

metricIntersection2(metric1, metric2, metricInt)

Compute and return the intersection of two metrics.

metricIntersection3(metric1, metric2, ...)

Compute the intersection of three metrics.

metricIsIsotropic()

Return the flag indicating whether the metric is isotropic or not.

metricIsUniform()

Return the flag indicating whether the metric is uniform or not.

metricNoInsertion()

Return the flag indicating whether node insertion and deletion are turned off.

metricNoMovement()

Return the flag indicating whether node movement is turned off.

metricNoSurf()

Return the flag indicating whether surface modification is turned off.

metricNoSwapping()

Return the flag indicating whether facet swapping is turned off.

metricNormalize(metric, ometric, determinant)

Apply L-p normalization to a metric.

metricRestrictAnisotropyFirst()

Return true if anisotropy is restricted before normalization.

metricSetFromOptions()

Configure the object from the options database.

metricSetGradationFactor(beta)

Set the metric gradation factor.

metricSetHausdorffNumber(hausd)

Set the metric Hausdorff number.

metricSetIsotropic([isotropic])

Record whether the metric is isotropic or not.

metricSetMaximumAnisotropy(a_max)

Set the maximum tolerated metric anisotropy.

metricSetMaximumMagnitude(h_max)

Set the maximum tolerated metric magnitude.

metricSetMinimumMagnitude(h_min)

Set the minimum tolerated metric magnitude.

metricSetNoInsertion([noInsert])

Set the flag indicating whether node insertion should be turned off.

metricSetNoMovement([noMove])

Set the flag indicating whether node movement should be turned off.

metricSetNoSurf([noSurf])

Set the flag indicating whether surface modification should be turned off.

metricSetNoSwapping([noSwap])

Set the flag indicating whether facet swapping should be turned off.

metricSetNormalizationOrder(p)

Set the order p for L-p normalization.

metricSetNumIterations(numIter)

Set the number of parallel adaptation iterations.

metricSetRestrictAnisotropyFirst([...])

Record whether anisotropy is be restricted before normalization or after.

metricSetTargetComplexity(targetComplexity)

Set the target metric complexity.

metricSetUniform([uniform])

Record whether the metric is uniform or not.

metricSetVerbosity(verbosity)

Set the verbosity of the mesh adaptation package.

migrateGlobalToNaturalSF(dmOld, ...)

Create the SF for mapping Global Vec to the Natural Vec in the new DM.

naturalToGlobalBegin(nv, gv)

Rearrange a Vec in the natural order to the Global order.

naturalToGlobalEnd(nv, gv)

Rearrange a Vec in the natural order to the Global order.

orient()

Give a consistent orientation to the input mesh.

orientLabel(label)

Give a consistent orientation to the hypersurface marked by a label.

orientPoint(p, o)

Act with the given orientation on this mesh point.

permute(perm)

Reorder the mesh according to the input permutation.

rebalanceSharedPoints([entityDepth, ...])

Redistribute shared points in order to achieve better balancing.

reorderGetDefault()

Return flag indicating whether the DMPlex should be reordered by default.

reorderSetDefault(flag)

Set flag indicating whether the DM should be reordered by default.

sectionLoad(viewer, sectiondm, sfxc)

Load section into a DM.

sectionView(viewer, sectiondm)

Save a section associated with a DMPlex.

setAdjacencyUseAnchors([useAnchors])

Define adjacency in the mesh using the point-to-point constraints.

setCellType(p, ctype)

Set the polytope type of a given cell.

setChart(pStart, pEnd)

Set the interval for all mesh points [pStart, pEnd).

setCone(p, cone[, orientation])

Set the points on the in-edges for this point in the DAG.

setConeOrientation(p, orientation)

Set the orientations on the in-edges for this point in the DAG.

setConeSize(p, size)

Set the number of in-edges for this point in the DAG.

setMatClosure(sec, gsec, mat, point, values)

Set an array of the values on the closure of point.

setMigrationSF(sf)

Set the SF for migrating from a parent DM into this DM.

setPartitioner(part)

Set the mesh partitioner.

setRefinementLimit(refinementLimit)

Set the maximum cell volume for refinement.

setRefinementUniform([refinementUniform])

Set the flag for uniform refinement.

setSaveTransform([save])

Set whether to save the DMPlex transform.

setSupport(p, supp)

Set the points on the out-edges for this point in the DAG.

setSupportSize(p, size)

Set the number of out-edges for this point in the DAG.

setTetGenOptions(opts)

Set the options used for the Tetgen mesh generator.

setTriangleOptions(opts)

Set the options used for the Triangle mesh generator.

setVecClosure(sec, vec, point, values[, addv])

Set an array of the values on the closure of point.

stratify()

Calculate the strata of DAG.

symmetrize()

Create support (out-edge) information from cone (in-edge) information.

topologyLoad(viewer)

Load a topology into this DMPlex object.

topologyView(viewer)

Save a DMPlex topology into a file.

uninterpolate()

Convert to a mesh with only cells and vertices.

vecGetClosure(sec, vec, p)

Return an array of values on the closure of p.

Methods Documentation

computeCellGeometryFVM(cell)#

Compute the volume for a given cell.

Not collective.

Parameters:

cell (int) – The cell.

Returns:

  • volume (float) – The cell volume.

  • centroid (ArrayReal) – The cell centroid.

  • normal (ArrayReal) – The cell normal, if appropriate.

Return type:

tuple[float, ArrayReal, ArrayReal]

Source code at petsc4py/PETSc/DMPlex.pyx:2554

computeGradientClementInterpolant(locX, locC)#

Return the L2 projection of the cellwise gradient of a function onto P1.

Collective.

Parameters:
  • locX (Vec) – The coefficient vector of the function.

  • locC (Vec) – The output Vec which holds the Clement interpolant of the gradient.

Return type:

Vec

Source code at petsc4py/PETSc/DMPlex.pyx:3488

constructGhostCells(labelName=None)#

Construct ghost cells which connect to every boundary face.

Collective.

Parameters:

labelName (str | None) – The name of the label specifying the boundary faces. Defaults to "Face Sets".

Returns:

numGhostCells – The number of ghost cells added to the DMPlex.

Return type:

int

Source code at petsc4py/PETSc/DMPlex.pyx:2586

coordinatesLoad(viewer, sfxc)#

Load coordinates into this DMPlex object.

Collective.

Parameters:
Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3661

coordinatesView(viewer)#

Save DMPlex coordinates into a file.

Collective.

Parameters:

viewer (Viewer) – The Viewer for saving.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3528

create(comm=None)#

Create a DMPlex object, which encapsulates an unstructured mesh.

Collective.

Parameters:

comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Self

Source code at petsc4py/PETSc/DMPlex.pyx:14

createBoxMesh(faces, lower=(0, 0, 0), upper=(1, 1, 1), simplex=True, periodic=False, interpolate=True, localizationHeight=0, sparseLocalize=True, comm=None)#

Create a mesh on the tensor product of intervals.

Collective.

Parameters:
  • faces (Sequence[int]) – Number of faces per dimension. The sequence length sets the dimension.

  • lower (Sequence[float]) – The lower left corner, with at least one entry per dimension.

  • upper (Sequence[float]) – The upper right corner, with at least one entry per dimension.

  • simplex (bool | None) – True for simplices, False for tensor cells.

  • periodic (Sequence | str | int | bool | None) – The boundary type for the X, Y, Z direction, or None for DM.BoundaryType.NONE.

  • interpolate (bool | None) – Flag to create intermediate mesh entities (edges, faces).

  • localizationHeight (int | None) – Flag to localize edges and faces in addition to cells; only significant for periodic meshes.

  • sparseLocalize (bool | None) – Flag to localize coordinates only for cells near the periodic boundary; only significant for periodic meshes.

  • comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Self

Source code at petsc4py/PETSc/DMPlex.pyx:167

createBoxSurfaceMesh(faces, lower=(0, 0, 0), upper=(1, 1, 1), interpolate=True, comm=None)#

Create a mesh on the surface of a box mesh using tensor cells.

Collective.

Parameters:
  • faces (Sequence[int]) – Number of faces per dimension. The sequence length sets the dimension.

  • lower (Sequence[float]) – The lower left corner, with at least one entry per dimension.

  • upper (Sequence[float]) – The upper right corner, with at least one entry per dimension.

  • interpolate (bool | None) – Flag to create intermediate mesh pieces (edges, faces).

  • comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Self

Source code at petsc4py/PETSc/DMPlex.pyx:227

createCGNS(cgid, interpolate=True, comm=None)#

Create a DMPlex mesh from a CGNS file.

Collective.

Parameters:
  • cgid (int) – The CG id associated with a file and obtained using cg_open.

  • interpolate (bool | None) – Create faces and edges in the mesh.

  • comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Self

Source code at petsc4py/PETSc/DMPlex.pyx:305

createCGNSFromFile(filename, interpolate=True, comm=None)#

“Create a DMPlex mesh from a CGNS file.

Collective.

Parameters:
  • filename (str) – The name of the CGNS file.

  • interpolate (bool | None) – Create faces and edges in the mesh.

  • comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Self

Source code at petsc4py/PETSc/DMPlex.pyx:333

createClosureIndex(sec)#

Calculate an index for sec for the closure operation.

Not collective.

Parameters:

sec (Section | None) – The Section describing the layout in the local vector, or None to use the default section.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2277

createCoarsePointIS()#

Create an IS covering the coarse DMPlex chart with the fine points as data.

Collective.

Returns:

fpointIS – The IS of all the fine points which exist in the original coarse mesh.

Return type:

IS

Source code at petsc4py/PETSc/DMPlex.pyx:2058

createCohesiveSubmesh(hasLagrange, value)#

Extract the hypersurface defined by one face of the cohesive cells.

Collective.

Parameters:
  • hasLagrange (bool) – Flag indicating whether the mesh has Lagrange dofs in the cohesive cells.

  • value (int) – A label value.

Return type:

DMPlex

Source code at petsc4py/PETSc/DMPlex.pyx:480

createColoring(depth=0, distance=1)#

Return the coloring of the connectivity graph of entities in the DMPlex.

Collective.

Parameters:
  • depth (int) – The entity dimension of nodes in the connectivity graph.

  • distance (int) – How far through the mesh an entity reaches, in applications of the adjacency: 1 for a star, 2 for the closure of that star.

Return type:

list

Source code at petsc4py/PETSc/DMPlex.pyx:503

createColoringLabel(depth=0, distance=1, label=None, value=0)#

Return the coloring of a labeled subset of the entities in the DMPlex.

Collective.

Parameters:
  • depth (int) – The entity dimension of nodes in the connectivity graph.

  • distance (int) – How far through the mesh an entity reaches, in applications of the adjacency: 1 for a star, 2 for the closure of that star.

  • label (DMLabel | None) – Selects the entities to color, None to color the whole stratum.

  • value (int) – The label value selecting the entities to color.

Return type:

list

Notes

The entities are colored as the subgraph they induce, so two of them get different colors exactly when one lies within distance of the other, regardless of how many unselected entities lie between them. Two entities of one color therefore carry patches of that reach which share no mesh point.

Source code at petsc4py/PETSc/DMPlex.pyx:523

createCoordinateSpace(degree, localized, project)#

Create a finite element space for the coordinates.

Collective.

Parameters:
  • degree (int) – The degree of the finite element.

  • localized (bool) – Flag to create a localized (DG) coordinate space.

  • project (bool) – Flag to project current coordinates into the space.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:456

createExodus(exoid, interpolate=True, comm=None)#

Create a DMPlex mesh from an ExodusII file ID.

Collective.

Parameters:
  • exoid (int) – The ExodusII id associated with a file obtained using ex_open.

  • interpolate (bool | None) – Create faces and edges in the mesh,

  • comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Self

Source code at petsc4py/PETSc/DMPlex.pyx:391

createExodusFromFile(filename, interpolate=True, comm=None)#

Create a DMPlex mesh from an ExodusII file.

Collective.

Parameters:
  • filename (str) – The name of the ExodusII file.

  • interpolate (bool | None) – Create faces and edges in the mesh.

  • comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Self

Source code at petsc4py/PETSc/DMPlex.pyx:362

createFromCellList(dim, cells, coords, interpolate=True, comm=None)#

Create a DMPlex from a list of vertices for each cell on process 0.

Collective.

Parameters:
  • dim (int) – The topological dimension of the mesh.

  • cells (Sequence[Sequence[int]]) – An array of number of cells times number of vertices on each cell.

  • coords (Sequence[Sequence[float]]) – An array of number of vertices times spatial dimension for coordinates.

  • interpolate (bool | None) – Flag to interpolate the mesh.

  • comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Self

Source code at petsc4py/PETSc/DMPlex.pyx:35

createFromCellSectionParallel(dim, cellSection, cells, coords, comm=None, NVertices=None, interpolate=True)#

Create a DMPlex from arbitrary-sized cell-vertex relations across all ranks.

Collective.

Compared to DMPlex.createFromCellList, this allows for cells with different number of vertices and for the creation operation to be done in parallel.

Parameters:
  • dim (int) – The topological dimension of the mesh.

  • cellSection (Section) – The Section giving the number of vertices for each cell (layout of cells).

  • cells (Sequence[int]) – An array of vertex ids, indexed by cellSection.

  • coords (Sequence[Sequence[float]]) – The coordinates of the vertices owned by this process, with shape (number of owned vertices, spatial dimension). Ranks own consecutive, non-overlapping blocks of the global vertex numbering, in rank order.

  • comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

  • NVertices (int | None) – The global number of vertices, or DECIDE or None, default None

  • interpolate (bool | None) – Flag to interpolate the mesh, default True.

Returns:

  • dm (DMPlex) – DMPlex built from input.

  • vertexSF (SF) – SF describing map from vertices in coords to DMPlex vertex owners

  • vertexAdj (ArrayInt) – Array of unique vertex IDs in cells

Return type:

tuple[Self, SF, ArrayInt]

Source code at petsc4py/PETSc/DMPlex.pyx:84

createFromFile(filename, plexname='unnamed', interpolate=True, comm=None)#

Create DMPlex from a file.

Collective.

Parameters:
  • filename (str) – A file name.

  • plexname (str | None) – The name of the resulting DMPlex, also used for intra-datafile lookup by some formats.

  • interpolate (bool | None) – Flag to create intermediate mesh pieces (edges, faces).

  • comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Self

Source code at petsc4py/PETSc/DMPlex.pyx:271

createGlobalToNaturalSF(section, sfMigration)#

Create the SF for mapping Global Vec to the Natural Vec.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3877

Parameters:
Return type:

SF

createGmsh(viewer, interpolate=True, comm=None)#

Create a DMPlex mesh from a Gmsh file viewer.

Collective.

Parameters:
Return type:

Self

Notes

-dm_plex_gmsh_hybrid forces triangular prisms to use tensor order.

-dm_plex_gmsh_periodic allows for reading Gmsh periodic section.

-dm_plex_gmsh_highorder allows for generating high-order coordinates.

-dm_plex_gmsh_project projects high-order coordinates to a different space, use the prefix -dm_plex_gmsh_project_ to define the space.

-dm_plex_gmsh_use_regions generates labels with region names.

-dm_plex_gmsh_mark_vertices adds vertices to generated labels.

-dm_plex_gmsh_multiple_tags allows multiple tags for default labels.

-dm_plex_gmsh_spacedim <d> embedding space dimension.

Source code at petsc4py/PETSc/DMPlex.pyx:418

createNaturalVec()#

Return a natural vector.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3788

Return type:

Vec

createPointNumbering()#

Create a global numbering for all points.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:1143

Return type:

IS

createSection(numComp, numDof, bcField=None, bcComps=None, bcPoints=None, perm=None)#

Create a Section based upon the DOF layout specification provided.

Not collective.

Parameters:
  • numComp (Sequence[int]) – An array of size numFields holding the number of components per field.

  • numDof (Sequence[int]) – An array of size numFields*(dim+1) holding the number of DOFs per field on a mesh piece of dimension dim.

  • bcField (Sequence[int] | None) – An array of size numBC giving the field number for each boundary condition, where numBC is the number of boundary conditions.

  • bcComps (Sequence[IS] | None) – An array of size numBC giving an IS holding the field components to which each boundary condition applies.

  • bcPoints (Sequence[IS] | None) – An array of size numBC giving an IS holding the DMPlex points to which each boundary condition applies.

  • perm (IS | None) – Permutation of the chart.

Return type:

Section

Source code at petsc4py/PETSc/DMPlex.pyx:2078

distribute(overlap=0)#

Distribute the mesh and any associated sections.

Collective.

Parameters:

overlap (int | None) – The overlap of partitions.

Returns:

sf – The SF used for point distribution, or None if not distributed.

Return type:

SF or None

Source code at petsc4py/PETSc/DMPlex.pyx:1799

distributeField(sf, sec, vec, newsec=None, newvec=None)#

Distribute field data with a given SF.

Collective.

Parameters:
  • sf (SF) – The SF describing the communication pattern.

  • sec (Section) – The Section for existing data layout.

  • vec (Vec) – The existing data in a local vector.

  • newsec (Section | None) – The Section describing the new data layout.

  • newvec (Vec | None) – The new data in a local vector.

Returns:

  • newSection (Section) – The Section describing the new data layout.

  • newVec (Vec) – The new data in a local vector.

Return type:

tuple[Section, Vec]

Source code at petsc4py/PETSc/DMPlex.pyx:1999

distributeGetDefault()#

Return a flag indicating whether the DM should be distributed by default.

Not collective.

Returns:

dist – Flag indicating whether the DMPlex should be distributed by default.

Return type:

bool

Source code at petsc4py/PETSc/DMPlex.pyx:1888

distributeOverlap(overlap=0)#

Add partition overlap to a distributed non-overlapping DMPlex.

Collective.

Parameters:

overlap (int | None) – The overlap of partitions (the same on all ranks).

Returns:

sf – The SF used for point distribution, or None if the mesh was not distributed, in which case the DMPlex is left unchanged.

Return type:

SF or None

Source code at petsc4py/PETSc/DMPlex.pyx:1827

distributeSetDefault(flag=True)#

Set flag indicating whether the DMPlex should be distributed by default.

Logically collective.

Parameters:

flag (bool) – Flag indicating whether the DMPlex should be distributed by default.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1908

distributionGetName()#

Retrieve the name of the specific parallel distribution.

Not collective.

Returns:

name – The name of the specific parallel distribution.

Return type:

str

Source code at petsc4py/PETSc/DMPlex.pyx:1949

distributionSetName(name)#

Set the name of the specific parallel distribution.

Logically collective.

Parameters:

name (str) – The name of the specific parallel distribution.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1928

filter(label=None, value=None, ignoreHalo=False, sanitizeSubMesh=False, comm=None)#

Extract a subset of mesh cells defined by a label as a separate mesh.

Collective.

Parameters:
  • label (DMLabel | None) – label marking cells to be contained in the new mesh

  • value (int | None) – label value to use

  • ignoreHalo (bool) – Flag indicating if labeled points that are in the halo are ignored

  • sanitizeSubMesh (bool) – Flag indicating if a subpoint is forced to be owned by a rank that owns a subcell that contains that point in its closure

  • comm (Comm | None) – The communicator you want the mesh on

Return type:

tuple[DMPlex, SF]

See also

DM, DMPlex, DMPlexFilter

Source code at petsc4py/PETSc/DMPlex.pyx:578

generate(boundary, name=None, interpolate=True)#

Generate a mesh.

Not collective.

Parameters:
  • boundary (DMPlex) – The DMPlex boundary object.

  • name (str | None) – The mesh generation package name.

  • interpolate (bool | None) – Flag to create intermediate mesh elements.

Return type:

Self

Source code at petsc4py/PETSc/DMPlex.pyx:1509

getAdjacency(p)#

Return all points adjacent to the given point.

Not collective.

Parameters:

p (int) – The point.

Return type:

ArrayInt

Source code at petsc4py/PETSc/DMPlex.pyx:1705

getAdjacencyUseAnchors()#

Query whether adjacency in the mesh uses the point-to-point constraints.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:1690

Return type:

bool

getCellNumbering()#

Return a global cell numbering for all cells on this process.

Collective the first time it is called.

Source code at petsc4py/PETSc/DMPlex.pyx:1113

Return type:

IS

getCellType(p)#

Return the polytope type of a given cell.

Not collective.

Parameters:

p (int) – The cell.

Return type:

PolytopeType

Source code at petsc4py/PETSc/DMPlex.pyx:887

getCellTypeLabel()#

Return the DMLabel recording the polytope type of each cell.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:908

Return type:

DMLabel

getChart()#

Return the interval for all mesh points [pStart, pEnd).

Not collective.

Returns:

  • pStart (int) – The first mesh point.

  • pEnd (int) – The upper bound for mesh points.

Return type:

tuple[int, int]

Source code at petsc4py/PETSc/DMPlex.pyx:620

getCone(p)#

Return the points on the in-edges for this point in the DAG.

Not collective.

Parameters:

p (int) – The point, which must lie in the chart set with DMPlex.setChart.

Return type:

ArrayInt

Source code at petsc4py/PETSc/DMPlex.pyx:705

getConeOrientation(p)#

Return the orientations on the in-edges for this point in the DAG.

Not collective.

Parameters:

p (int) – The point, which must lie in the chart set with DMPlex.setChart.

Return type:

ArrayInt

Source code at petsc4py/PETSc/DMPlex.pyx:813

getConeSize(p)#

Return the number of in-edges for this point in the DAG.

Not collective.

Parameters:

p (int) – The point, which must lie in the chart set with DMPlex.setChart.

Return type:

int

Source code at petsc4py/PETSc/DMPlex.pyx:662

getDepth()#

Return the depth of the DAG representing this mesh.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:1157

Return type:

int

getDepthStratum(svalue)#

Return the bounds [start, end) for all points at a certain depth.

Not collective.

Parameters:

svalue (int) – The requested depth.

Returns:

  • pStart (int) – The first stratum point.

  • pEnd (int) – The upper bound for stratum points.

Return type:

tuple[int, int]

Source code at petsc4py/PETSc/DMPlex.pyx:1172

getFullJoin(points)#

Return an array for the join of the set of points.

Not collective.

Parameters:

points (Sequence[int]) – The input points.

Return type:

ArrayInt

Source code at petsc4py/PETSc/DMPlex.pyx:1320

getHeightStratum(svalue)#

Return the bounds [start, end) for all points at a certain height.

Not collective.

Parameters:

svalue (int) – The requested height.

Returns:

  • pStart (int) – The first stratum point.

  • pEnd (int) – The upper bound for stratum points.

Return type:

tuple[int, int]

Source code at petsc4py/PETSc/DMPlex.pyx:1199

getJoin(points)#

Return an array for the join of the set of points.

Not collective.

Parameters:

points (Sequence[int]) – The input points.

Return type:

ArrayInt

Source code at petsc4py/PETSc/DMPlex.pyx:1294

getMaxSizes()#

Return the maximum number of in-edges and out-edges of the DAG.

Not collective.

Returns:

  • maxConeSize (int) – The maximum number of in-edges.

  • maxSupportSize (int) – The maximum number of out-edges.

Return type:

tuple[int, int]

Source code at petsc4py/PETSc/DMPlex.pyx:1016

getMeet(points)#

Return an array for the meet of the set of points.

Not collective.

Parameters:

points (Sequence[int]) – The input points.

Return type:

ArrayInt

Source code at petsc4py/PETSc/DMPlex.pyx:1268

getMigrationSF()#

Get the SF for migrating from a parent DM into this DM.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3862

Return type:

SF

getMinRadius()#

Return the minimum distance from any cell centroid to a face.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2044

Return type:

float

getOrdering(otype)#

Calculate a reordering of the mesh.

Collective.

Parameters:

otype (OrderingType) – Type of reordering, see Mat.OrderingType.

Returns:

perm – The point permutation.

Return type:

IS

Source code at petsc4py/PETSc/DMPlex.pyx:2429

getPartitioner()#

Return the mesh partitioner.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:1748

Return type:

Partitioner

getPlexCellCoordinates(cell)#

Get coordinates for a cell, taking into account periodicity.

Not collective.

Parameters:

cell (int) – The cell.

Returns:

  • isDG (bool) – Flag for discontinuous coordinates.

  • coords (ArrayScalar) – The cell coordinates.

Return type:

tuple[bool, ArrayScalar]

Source code at petsc4py/PETSc/DMPlex.pyx:2516

getPointDepth(point)#

Return the depth of a given point.

Not collective.

Parameters:

point (int) – The point.

Return type:

int

Source code at petsc4py/PETSc/DMPlex.pyx:1226

getPointGlobal(point)#

Return location of point data in global Vec.

Not collective.

Parameters:

point (int) – The topological point.

Returns:

  • start (int) – Start of point data; returns -(globalStart+1) if point is not owned.

  • end (int) – End of point data; returns -(globalEnd+1) if point is not owned.

Return type:

tuple[int, int]

Source code at petsc4py/PETSc/DMPlex.pyx:2218

getPointGlobalField(point, field)#

Return location of point field data in global Vec.

Not collective.

Parameters:
  • point (int) – The topological point.

  • field (int) – The field number.

Returns:

  • start (int) – Start of point data; returns -(globalStart+1) if point is not owned.

  • end (int) – End of point data; returns -(globalEnd+1) if point is not owned.

Return type:

tuple[int, int]

Source code at petsc4py/PETSc/DMPlex.pyx:2246

getPointHeight(point)#

Return the height of a given point.

Not collective.

Parameters:

point (int) – The point.

Return type:

int

Source code at petsc4py/PETSc/DMPlex.pyx:1247

getPointLocal(point)#

Return location of point data in local Vec.

Not collective.

Parameters:

point (int) – The topological point.

Returns:

  • start (int) – Start of point data.

  • end (int) – End of point data.

Return type:

tuple[int, int]

Source code at petsc4py/PETSc/DMPlex.pyx:2159

getPointLocalField(point, field)#

Return location of point field data in local Vec.

Not collective.

Parameters:
  • point (int) – The topological point.

  • field (int) – The field number.

Returns:

  • start (int) – Start of point data.

  • end (int) – End of point data.

Return type:

tuple[int, int]

Source code at petsc4py/PETSc/DMPlex.pyx:2187

getRefinementLimit()#

Retrieve the maximum cell volume for refinement.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2413

Return type:

float

getRefinementUniform()#

Retrieve the flag for uniform refinement.

Not collective.

Returns:

refinementUniform – The flag for uniform refinement.

Return type:

bool

Source code at petsc4py/PETSc/DMPlex.pyx:2372

getSaveTransform()#

Return whether the DMPlex transform is saved.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2337

Return type:

bool

getSubpointIS()#

Return an IS covering the entire subdm chart.

Not collective.

Returns:

iset – The IS containing subdm’s parent’s points.

Return type:

IS

Source code at petsc4py/PETSc/DMPlex.pyx:2615

getSubpointMap()#

Return a DMLabel with point dimension as values.

Not collective.

Returns:

label – The DMLabel whose values are subdm’s point dimensions.

Return type:

DMLabel

Source code at petsc4py/PETSc/DMPlex.pyx:2635

getSupport(p)#

Return the points on the out-edges for this point in the DAG.

Not collective.

Parameters:

p (int) – The point, which must lie in the chart set with DMPlex.setChart.

Return type:

ArrayInt

Source code at petsc4py/PETSc/DMPlex.pyx:967

getSupportSize(p)#

Return the number of out-edges for this point in the DAG.

Not collective.

Parameters:

p (int) – The point, which must lie in the chart set with DMPlex.setChart.

Return type:

int

Source code at petsc4py/PETSc/DMPlex.pyx:924

getTransform()#

Return the transformation that produced this mesh.

Not collective.

Notes

The transform is saved only when setSaveTransform is called before refinement. The saved transform does not keep a reference to the source DMPlex; the caller must retain that mesh separately.

Source code at petsc4py/PETSc/DMPlex.pyx:2351

Return type:

DMPlexTransform

getTransitiveClosure(p, useCone=True)#

Return the points and orientations on the transitive closure of this point.

Not collective.

Parameters:
  • p (int) – The mesh point.

  • useCone (bool | None) – True for the closure, otherwise return the star.

Returns:

  • points (ArrayInt) – The points.

  • orientations (ArrayInt) – The orientations.

Return type:

tuple[ArrayInt, ArrayInt]

Source code at petsc4py/PETSc/DMPlex.pyx:1346

getVecClosure(sec, vec, point)#

Return an array of the values on the closure of a point.

Not collective.

Parameters:
  • sec (Section | None) – The Section describing the layout in vec or None to use the default section.

  • vec (Vec) – The local vector.

  • point (int) – The point in the DMPlex.

Return type:

ArrayScalar

Source code at petsc4py/PETSc/DMPlex.pyx:1410

getVertexNumbering()#

Return a global vertex numbering for all vertices on this process.

Collective the first time it is called.

Source code at petsc4py/PETSc/DMPlex.pyx:1128

Return type:

IS

globalToNaturalBegin(gv, nv)#

Rearrange a Vec in the Global order to the natural order.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3826

Parameters:
Return type:

None

globalToNaturalEnd(gv, nv)#

Rearrange a Vec in the Global order to the natural order.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3838

Parameters:
Return type:

None

globalVectorLoad(viewer, sectiondm, sf, vec)#

Load on-disk vector data into a global vector.

Collective.

Parameters:
  • viewer (Viewer) – The Viewer that represents the on-disk vector data.

  • sectiondm (DM) – The DM that contains the global section on which vec is defined.

  • sf (SF) – The SF that migrates the on-disk vector data into vec.

  • vec (Vec) – The global vector to set values of.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3738

globalVectorView(viewer, sectiondm, vec)#

Save a global vector.

Collective.

Parameters:
  • viewer (Viewer) – The Viewer to save data with.

  • sectiondm (DM) – The DM containing the global section on which vec is defined; may be the same as this DMPlex object.

  • vec (Vec) – The global vector to be saved.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3585

insertCone(p, conePos, conePoint)#

DMPlexInsertCone - Insert a point into the in-edges for the point p in the DAG.

Not collective.

Parameters:
  • p (int) – The point, which must lie in the chart set with DMPlex.setChart.

  • conePos (int) – The local index in the cone where the point should be put.

  • conePoint (int) – The mesh point to insert.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:763

insertConeOrientation(p, conePos, coneOrientation)#

Insert a point orientation for the in-edge for the point p in the DAG.

Not collective.

Parameters:
  • p (int) – The point, which must lie in the chart set with DMPlex.setChart

  • conePos (int) – The local index in the cone where the point should be put.

  • coneOrientation (int) – The point orientation to insert.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:788

interpolate()#

Convert to a mesh with all intermediate faces, edges, etc.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:1969

Return type:

None

isDistributed()#

Return the flag indicating if the mesh is distributed.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:1859

Return type:

bool

isSimplex()#

Return the flag indicating if the first cell is a simplex.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:1873

Return type:

bool

labelCohesiveComplete(label, bdlabel, bdvalue, flip, subdm)#

Add all other mesh pieces to complete the surface.

Not collective.

Parameters:
  • label (DMLabel) – A DMLabel marking the surface.

  • bdlabel (DMLabel) – A DMLabel marking the vertices on the boundary which will not be duplicated.

  • bdvalue (int) – Value of DMLabel marking the vertices on the boundary.

  • flip (bool) – Flag to flip the submesh normal and replace points on the other side.

  • subdm (DMPlex) – The DMPlex associated with the label.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1638

labelComplete(label, useCone=True)#

Add the transitive closure or the star of each point in the label.

Not collective.

Parameters:
  • label (DMLabel) – A DMLabel marking the points.

  • useCone (bool) – True for the closure, otherwise return the star.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1615

labelsLoad(viewer, sfxc)#

Load labels into this DMPlex object.

Collective.

Parameters:
Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3681

labelsView(viewer)#

Save DMPlex labels into a file.

Collective.

Parameters:

viewer (Viewer) – The Viewer for saving.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3546

localVectorLoad(viewer, sectiondm, sf, vec)#

Load on-disk vector data into a local vector.

Collective.

Parameters:
  • viewer (Viewer) – The Viewer that represents the on-disk vector data.

  • sectiondm (DM) – The DM that contains the local section on which vec is defined.

  • sf (SF) – The SF that migrates the on-disk vector data into vec.

  • vec (Vec) – The local vector to set values of.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3763

localVectorView(viewer, sectiondm, vec)#

Save a local vector.

Collective.

Parameters:
  • viewer (Viewer) – The Viewer to save data with.

  • sectiondm (DM) – The DM that contains the local section on which vec is defined; may be the same as this DMPlex object.

  • vec (Vec) – The local vector to be saved.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3609

markBoundaryFaces(label, value=None)#

Mark all faces on the boundary.

Collective.

Parameters:
  • label (str) – The name of the label to create or update.

  • value (int | None) – The marker value, or DETERMINE or None to use some value in the closure (or 1 if none are found).

Returns:

boundary – The label containing the boundary faces.

Return type:

DMLabel

Source code at petsc4py/PETSc/DMPlex.pyx:1577

metricAverage2(metric1, metric2, metricAvg)#

Compute and return the unweighted average of two metrics.

Collective.

Parameters:
  • metric1 (Vec) – The first metric to be averaged.

  • metric2 (Vec) – The second metric to be averaged.

  • metricAvg (Vec) – The output averaged metric.

Return type:

Vec

Source code at petsc4py/PETSc/DMPlex.pyx:3396

metricAverage3(metric1, metric2, metric3, metricAvg)#

Compute and return the unweighted average of three metrics.

Collective.

Parameters:
  • metric1 (Vec) – The first metric to be averaged.

  • metric2 (Vec) – The second metric to be averaged.

  • metric3 (Vec) – The third metric to be averaged.

  • metricAvg (Vec) – The output averaged metric.

Return type:

Vec

Source code at petsc4py/PETSc/DMPlex.pyx:3418

metricCreate(field=0)#

Create a Riemannian metric field.

Collective.

Parameters:

field (int | None) – The field number to use.

Return type:

Vec

Source code at petsc4py/PETSc/DMPlex.pyx:3227

metricCreateIsotropic(indicator, field=0)#

Construct an isotropic metric from an error indicator.

Collective.

Parameters:
  • indicator (Vec) – The error indicator.

  • field (int | None) – The field number to use.

Return type:

Vec

Source code at petsc4py/PETSc/DMPlex.pyx:3272

metricCreateUniform(alpha, field=0)#

Construct a uniform isotropic metric.

Collective.

Parameters:
  • alpha (float) – Scaling parameter for the diagonal.

  • field (int | None) – The field number to use.

Return type:

Vec

Source code at petsc4py/PETSc/DMPlex.pyx:3248

metricDeterminantCreate(field=0)#

Create the determinant field for a Riemannian metric.

Collective.

Parameters:

field (int | None) – The field number to use.

Returns:

  • determinant (Vec) – The determinant field.

  • dmDet (DM) – The corresponding DM

Return type:

tuple[Vec, DM]

Source code at petsc4py/PETSc/DMPlex.pyx:3295

metricEnforceSPD(metric, ometric, determinant, restrictSizes=False, restrictAnisotropy=False)#

Enforce symmetric positive-definiteness of a metric.

Collective.

Parameters:
  • metric (Vec) – The metric.

  • ometric (Vec) – The output metric.

  • determinant (Vec) – The output determinant.

  • restrictSizes (bool | None) – Flag indicating whether maximum/minimum magnitudes should be enforced.

  • restrictAnisotropy (bool | None) – Flag indicating whether maximum anisotropy should be enforced.

Returns:

  • ometric (Vec) – The output metric.

  • determinant (Vec) – The output determinant.

Return type:

tuple[Vec, Vec]

Source code at petsc4py/PETSc/DMPlex.pyx:3324

metricGetGradationFactor()#

Return the metric gradation factor.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3178

Return type:

float

metricGetHausdorffNumber()#

Return the metric Hausdorff number.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3212

Return type:

float

metricGetMaximumAnisotropy()#

Return the maximum tolerated metric anisotropy.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3076

Return type:

float

metricGetMaximumMagnitude()#

Return the maximum tolerated metric magnitude.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3042

Return type:

float

metricGetMinimumMagnitude()#

Return the minimum tolerated metric magnitude.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3008

Return type:

float

metricGetNormalizationOrder()#

Return the order p for L-p normalization.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3144

Return type:

float

metricGetNumIterations()#

Return the number of parallel adaptation iterations.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2974

Return type:

int

metricGetTargetComplexity()#

Return the target metric complexity.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3110

Return type:

float

metricGetVerbosity()#

Return the verbosity of the mesh adaptation package.

Not collective.

Returns:

verbosity – The verbosity, where -1 is silent and 10 is maximum.

Return type:

int

Source code at petsc4py/PETSc/DMPlex.pyx:2935

metricIntersection2(metric1, metric2, metricInt)#

Compute and return the intersection of two metrics.

Collective.

Parameters:
  • metric1 (Vec) – The first metric to be intersected.

  • metric2 (Vec) – The second metric to be intersected.

  • metricInt (Vec) – The output intersected metric.

Return type:

Vec

Source code at petsc4py/PETSc/DMPlex.pyx:3442

metricIntersection3(metric1, metric2, metric3, metricInt)#

Compute the intersection of three metrics.

Collective.

Parameters:
  • metric1 (Vec) – The first metric to be intersected.

  • metric2 (Vec) – The second metric to be intersected.

  • metric3 (Vec) – The third metric to be intersected.

  • metricInt (Vec) – The output intersected metric.

Return type:

Vec

Source code at petsc4py/PETSc/DMPlex.pyx:3464

metricIsIsotropic()#

Return the flag indicating whether the metric is isotropic or not.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2723

Return type:

bool

metricIsUniform()#

Return the flag indicating whether the metric is uniform or not.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2689

Return type:

bool

metricNoInsertion()#

Return the flag indicating whether node insertion and deletion are turned off.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2792

Return type:

bool

metricNoMovement()#

Return the flag indicating whether node movement is turned off.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2864

Return type:

bool

metricNoSurf()#

Return the flag indicating whether surface modification is turned off.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2900

Return type:

bool

metricNoSwapping()#

Return the flag indicating whether facet swapping is turned off.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2828

Return type:

bool

metricNormalize(metric, ometric, determinant, restrictSizes=True, restrictAnisotropy=True)#

Apply L-p normalization to a metric.

Collective.

Parameters:
  • metric (Vec) – The metric.

  • ometric (Vec) – The output metric.

  • determinant (Vec) – The output determinant.

  • restrictSizes (bool | None) – Flag indicating whether maximum/minimum magnitudes should be enforced.

  • restrictAnisotropy (bool | None) – Flag indicating whether maximum anisotropy should be enforced.

Returns:

  • ometric (Vec) – The output normalized metric.

  • determinant (Vec) – The output determinant.

Return type:

tuple[Vec, Vec]

Source code at petsc4py/PETSc/DMPlex.pyx:3360

metricRestrictAnisotropyFirst()#

Return true if anisotropy is restricted before normalization.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2757

Return type:

bool

metricSetFromOptions()#

Configure the object from the options database.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2657

Return type:

None

metricSetGradationFactor(beta)#

Set the metric gradation factor.

Logically collective.

Parameters:

beta (float) – The metric gradation factor.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3159

metricSetHausdorffNumber(hausd)#

Set the metric Hausdorff number.

Logically collective.

Parameters:

hausd (float) – The metric Hausdorff number.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3193

metricSetIsotropic(isotropic=True)#

Record whether the metric is isotropic or not.

Logically collective.

Parameters:

isotropic (bool) – Flag indicating whether the metric is isotropic or not.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2704

metricSetMaximumAnisotropy(a_max)#

Set the maximum tolerated metric anisotropy.

Logically collective.

Parameters:

a_max (float) – The maximum tolerated metric anisotropy.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3057

metricSetMaximumMagnitude(h_max)#

Set the maximum tolerated metric magnitude.

Logically collective.

Parameters:

h_max (float) – The maximum tolerated metric magnitude.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3023

metricSetMinimumMagnitude(h_min)#

Set the minimum tolerated metric magnitude.

Logically collective.

Parameters:

h_min (float) – The minimum tolerated metric magnitude.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2989

metricSetNoInsertion(noInsert=True)#

Set the flag indicating whether node insertion should be turned off.

Logically collective.

Parameters:

noInsert (bool) – Flag indicating whether node insertion and deletion should be turned off.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2772

metricSetNoMovement(noMove=True)#

Set the flag indicating whether node movement should be turned off.

Logically collective.

Parameters:

noMove (bool) – Flag indicating whether node movement should be turned off.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2844

metricSetNoSurf(noSurf=True)#

Set the flag indicating whether surface modification should be turned off.

Logically collective.

Parameters:

noSurf (bool) – Flag indicating whether surface modification should be turned off.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2880

metricSetNoSwapping(noSwap=True)#

Set the flag indicating whether facet swapping should be turned off.

Logically collective.

Parameters:

noSwap (bool) – Flag indicating whether facet swapping should be turned off.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2808

metricSetNormalizationOrder(p)#

Set the order p for L-p normalization.

Logically collective.

Parameters:

p (float) – The normalization order.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3125

metricSetNumIterations(numIter)#

Set the number of parallel adaptation iterations.

Logically collective.

Parameters:

numIter (int) – The number of parallel adaptation iterations.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2955

metricSetRestrictAnisotropyFirst(restrictAnisotropyFirst=True)#

Record whether anisotropy is be restricted before normalization or after.

Logically collective.

Parameters:

restrictAnisotropyFirst (bool) – Flag indicating if anisotropy is restricted before normalization or after.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2738

metricSetTargetComplexity(targetComplexity)#

Set the target metric complexity.

Logically collective.

Parameters:

targetComplexity (float) – The target metric complexity.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3091

metricSetUniform(uniform=True)#

Record whether the metric is uniform or not.

Logically collective.

Parameters:

uniform (bool) – Flag indicating whether the metric is uniform or not.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2670

metricSetVerbosity(verbosity)#

Set the verbosity of the mesh adaptation package.

Logically collective.

Parameters:

verbosity (int) – The verbosity, where -1 is silent and 10 is maximum.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2916

migrateGlobalToNaturalSF(dmOld, sfNaturalOld, sfMigration)#

Create the SF for mapping Global Vec to the Natural Vec in the new DM.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3891

Parameters:
  • dmOld (DM)

  • sfNaturalOld (SF)

  • sfMigration (SF)

Return type:

SF

naturalToGlobalBegin(nv, gv)#

Rearrange a Vec in the natural order to the Global order.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3802

Parameters:
Return type:

None

naturalToGlobalEnd(nv, gv)#

Rearrange a Vec in the natural order to the Global order.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3814

Parameters:
Return type:

None

orient()#

Give a consistent orientation to the input mesh.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:1084

Return type:

None

orientLabel(label)#

Give a consistent orientation to the hypersurface marked by a label.

Collective.

Parameters:

label (DMLabel) – The label marking the hypersurface.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1096

orientPoint(p, o)#

Act with the given orientation on this mesh point.

Not collective.

Parameters:
  • p (int) – The mesh point.

  • o (int) – The orientation.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1063

permute(perm)#

Reorder the mesh according to the input permutation.

Collective.

Parameters:

perm (IS) – The point permutation, perm[old point number] = new point number.

Returns:

pdm – The permuted DMPlex.

Return type:

DMPlex

Source code at petsc4py/PETSc/DMPlex.pyx:2457

rebalanceSharedPoints(entityDepth=0, useInitialGuess=True, parallel=True)#

Redistribute shared points in order to achieve better balancing.

Collective.

Parameters:
  • entityDepth (int | None) – Depth of the entity to balance (e.g., 0 -> balance vertices).

  • useInitialGuess (bool | None) – Whether to use the current distribution as initial guess.

  • parallel (bool | None) – Whether to use ParMETIS and do the partition in parallel or gather the graph onto a single process.

Returns:

success – Whether the graph partitioning was successful or not. Unsuccessful simply means no change to the partitioning.

Return type:

bool

Source code at petsc4py/PETSc/DMPlex.pyx:1765

reorderGetDefault()#

Return flag indicating whether the DMPlex should be reordered by default.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:2481

Return type:

ReorderDefaultFlag

reorderSetDefault(flag)#

Set flag indicating whether the DM should be reordered by default.

Logically collective.

Parameters:

flag (ReorderDefaultFlag) – Flag for reordering.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2495

sectionLoad(viewer, sectiondm, sfxc)#

Load section into a DM.

Collective.

Parameters:
  • viewer (Viewer) – The Viewer that represents the on-disk section (sectionA).

  • sectiondm (DM) – The DM into which the on-disk section (sectionA) is migrated.

  • sfxc (SF) – The SF returned by topologyLoad.

Returns:

  • gsf (SF) – The SF that migrates any on-disk Vec data associated with sectionA into a global Vec associated with the sectiondm’s global section (None if not needed).

  • lsf (SF) – The SF that migrates any on-disk Vec data associated with sectionA into a local Vec associated with the sectiondm’s local section (None if not needed).

Return type:

tuple[SF, SF]

Source code at petsc4py/PETSc/DMPlex.pyx:3701

sectionView(viewer, sectiondm)#

Save a section associated with a DMPlex.

Collective.

Parameters:
  • viewer (Viewer) – The Viewer for saving.

  • sectiondm (DM) – The DM that contains the section to be saved.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3564

setAdjacencyUseAnchors(useAnchors=True)#

Define adjacency in the mesh using the point-to-point constraints.

Logically collective.

Parameters:

useAnchors (bool) – Flag to use the constraints. If True, then constrained points are omitted from DMPlex.getAdjacency, and their anchor points appear in their place.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1669

setCellType(p, ctype)#

Set the polytope type of a given cell.

Not collective.

Parameters:
  • p (int) – The cell.

  • ctype (PolytopeType) – The polytope type of the cell.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:865

setChart(pStart, pEnd)#

Set the interval for all mesh points [pStart, pEnd).

Not collective.

Parameters:
  • pStart (int) – The first mesh point.

  • pEnd (int) – The upper bound for mesh points.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:641

setCone(p, cone, orientation=None)#

Set the points on the in-edges for this point in the DAG.

Not collective.

Parameters:
  • p (int) – The point, which must lie in the chart set with DMPlex.setChart.

  • cone (Sequence[int]) – An array of points which are on the in-edges for point p.

  • orientation (Sequence[int] | None) – An array of orientations, defaults to None.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:728

setConeOrientation(p, orientation)#

Set the orientations on the in-edges for this point in the DAG.

Not collective.

Parameters:
Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:836

setConeSize(p, size)#

Set the number of in-edges for this point in the DAG.

Not collective.

Parameters:
  • p (int) – The point, which must lie in the chart set with DMPlex.setChart.

  • size (int) – The cone size for point p.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:683

setMatClosure(sec, gsec, mat, point, values, addv=None)#

Set an array of the values on the closure of point.

Not collective.

Parameters:
  • sec (Section | None) – The section describing the layout in mat, or None to use the default section.

  • gsec (Section | None) – The section describing the layout in mat, or None to use the default global section.

  • mat (Mat) – The matrix.

  • point (int) – The point in the DMPlex.

  • values (Sequence[Scalar]) – The array of values.

  • addv (InsertModeSpec | None) – The insertion mode.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1472

setMigrationSF(sf)#

Set the SF for migrating from a parent DM into this DM.

Logically collective.

Source code at petsc4py/PETSc/DMPlex.pyx:3850

Parameters:

sf (SF)

Return type:

None

setPartitioner(part)#

Set the mesh partitioner.

Logically collective.

Parameters:

part (Partitioner) – The partitioner.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1730

setRefinementLimit(refinementLimit)#

Set the maximum cell volume for refinement.

Logically collective.

Parameters:

refinementLimit (float) – The maximum cell volume in the refined mesh.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2393

setRefinementUniform(refinementUniform=True)#

Set the flag for uniform refinement.

Logically collective.

Parameters:

refinementUniform (bool | None) – The flag for uniform refinement.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:2299

setSaveTransform(save=True)#

Set whether to save the DMPlex transform.

Logically collective.

Notes

The default is off. When on, the saved transform keeps the parent and child relation. Use getTransform to retrieve the transform.

Source code at petsc4py/PETSc/DMPlex.pyx:2319

Parameters:

save (bool)

Return type:

None

setSupport(p, supp)#

Set the points on the out-edges for this point in the DAG.

Not collective.

Parameters:
  • p (int) – The point, which must lie in the chart set with DMPlex.setChart.

  • supp (Sequence[int]) – An array of points which are on the out-edges for point p.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:990

setSupportSize(p, size)#

Set the number of out-edges for this point in the DAG.

Not collective.

Parameters:
  • p (int) – The point, which must lie in the chart set with DMPlex.setChart.

  • size (int) – The support size for point p.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:945

setTetGenOptions(opts)#

Set the options used for the Tetgen mesh generator.

Logically collective.

Parameters:

opts (str) – The command line options.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1557

setTriangleOptions(opts)#

Set the options used for the Triangle mesh generator.

Logically collective.

Parameters:

opts (str) – The command line options.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1537

setVecClosure(sec, vec, point, values, addv=None)#

Set an array of the values on the closure of point.

Not collective.

Parameters:
  • sec (Section | None) – The section describing the layout in vec, or None to use the default section.

  • vec (Vec) – The local vector.

  • point (int) – The point in the DMPlex.

  • values (Sequence[Scalar]) – The array of values.

  • addv (InsertModeSpec | None) – The insertion mode.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:1440

stratify()#

Calculate the strata of DAG.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:1051

Return type:

None

symmetrize()#

Create support (out-edge) information from cone (in-edge) information.

Not collective.

Source code at petsc4py/PETSc/DMPlex.pyx:1038

Return type:

None

topologyLoad(viewer)#

Load a topology into this DMPlex object.

Collective.

Parameters:

viewer (Viewer) – The Viewer for the saved topology

Returns:

sfxc – The SF that pushes points in [0, N) to the associated points in the loaded DMPlex, where N is the global number of points.

Return type:

SF

Source code at petsc4py/PETSc/DMPlex.pyx:3635

topologyView(viewer)#

Save a DMPlex topology into a file.

Collective.

Parameters:

viewer (Viewer) – The Viewer for saving.

Return type:

None

Source code at petsc4py/PETSc/DMPlex.pyx:3510

uninterpolate()#

Convert to a mesh with only cells and vertices.

Collective.

Source code at petsc4py/PETSc/DMPlex.pyx:1984

Return type:

None

vecGetClosure(sec, vec, p)#

Return an array of values on the closure of p.

Not collective.

Parameters:
  • sec (Section) – The section describing the layout in vec.

  • vec (Vec) – The local vector.

  • p (int) – The point in the DMPlex.

Return type:

ArrayScalar

Source code at petsc4py/PETSc/DMPlex.pyx:1382