MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::ParNCMesh Class Reference

A parallel extension of the NCMesh class. More...

#include <pncmesh.hpp>

Inheritance diagram for mfem::ParNCMesh:
[legend]
Collaboration diagram for mfem::ParNCMesh:
[legend]

Classes

class  ElementSet
 
class  ElementValueMessage
 
class  NeighborDerefinementMessage
 
class  NeighborElementRankMessage
 
class  NeighborRefinementMessage
 
class  RebalanceDofMessage
 
class  RebalanceMessage
 

Public Types

using GroupId = short
 
using CommGroup = std::vector<int>
 
- Public Types inherited from mfem::NCMesh
typedef std::int64_t RefCoord
 

Public Member Functions

 ParNCMesh (MPI_Comm comm, const NCMesh &ncmesh, int *part=NULL)
 Construct by partitioning a serial NCMesh.
 
 ParNCMesh (MPI_Comm comm, std::istream &input, int version, int &curved, int &is_nc)
 
 ParNCMesh (const ParNCMesh &other)
 Deep copy of another instance.
 
virtual ~ParNCMesh ()
 
void Refine (const Array< Refinement > &refinements) override
 
void LimitNCLevel (int max_nc_level) override
 Parallel version of NCMesh::LimitNCLevel.
 
void CheckDerefinementNCLevel (const Table &deref_table, Array< int > &level_ok, int max_nc_level) override
 
void Derefine (const Array< int > &derefs) override
 
void GetFineToCoarsePartitioning (const Array< int > &derefs, Array< int > &new_ranks) const
 
void Rebalance (const Array< int > *custom_partition=NULL)
 
int GetNElements () const
 
int GetNGhostVertices () const
 
int GetNGhostEdges () const
 
int GetNGhostFaces () const
 
int GetNGhostElements () const override
 
const NCListGetSharedVertices ()
 
const NCListGetSharedEdges ()
 
const NCListGetSharedFaces ()
 
const NCListGetSharedList (int entity)
 Helper to get shared vertices/edges/faces ('entity' == 0/1/2 resp.).
 
int GetFaceOrientation (int index) const
 Return (shared) face orientation relative to its owner element.
 
GroupId GetEntityOwnerId (int entity, int index)
 Return vertex/edge/face ('entity' == 0/1/2, resp.) owner.
 
GroupId GetEntityGroupId (int entity, int index)
 
const CommGroupGetGroup (GroupId id) const
 Return a list of ranks contained in the group of the given ID.
 
bool GroupContains (GroupId id, int rank) const
 Return true if group 'id' contains the given rank.
 
bool IsGhost (int entity, int index) const
 Return true if the specified vertex/edge/face is a ghost.
 
int ElementRank (int index) const
 
int GetMyRank () const
 
void SendRebalanceDofs (int old_ndofs, const Table &old_element_dofs, long old_global_offset, FiniteElementSpace *space)
 Use the communication pattern from last Rebalance() to send element DOFs.
 
void RecvRebalanceDofs (Array< int > &elements, Array< long > &dofs)
 Receive element DOFs sent by SendRebalanceDofs().
 
const Array< int > & GetRebalanceOldIndex () const
 
const Array< int > & GetDerefineOldRanks () const
 
template<typename Type >
void SynchronizeDerefinementData (Array< Type > &elem_data, const Table &deref_table)
 
void GetBoundaryClosure (const Array< int > &bdr_attr_is_ess, Array< int > &bdr_vertices, Array< int > &bdr_edges, Array< int > &bdr_faces) override
 
void Trim () override
 Save memory by releasing all non-essential and cached data.
 
std::size_t MemoryUsage (bool with_base=true) const
 Return total number of bytes allocated.
 
int PrintMemoryDetail (bool with_base=true) const
 
void GetDebugMesh (Mesh &debug_mesh) const
 
- Public Member Functions inherited from mfem::NCMesh
 NCMesh (const Mesh *mesh)
 
 NCMesh (std::istream &input, int version, int &curved, int &is_nc)
 
 NCMesh (const NCMesh &other)
 Deep copy of another instance.
 
NCMeshoperator= (NCMesh &)=delete
 Copy assignment not supported.
 
virtual ~NCMesh ()
 
int Dimension () const
 Return the dimension of the NCMesh.
 
int SpaceDimension () const
 Return the space dimension of the NCMesh.
 
int GetNVertices () const
 Return the number of vertices in the NCMesh.
 
int GetNEdges () const
 Return the number of edges in the NCMesh.
 
int GetNFaces () const
 Return the number of (2D) faces in the NCMesh.
 
const TableGetDerefinementTable ()
 
const NCListGetFaceList ()
 Return the current list of conforming and nonconforming faces.
 
const NCListGetEdgeList ()
 Return the current list of conforming and nonconforming edges.
 
const NCListGetVertexList ()
 
const NCListGetNCList (int entity)
 Return vertex/edge/face list (entity = 0/1/2, respectively).
 
void MarkCoarseLevel ()
 
const CoarseFineTransformationsGetRefinementTransforms () const
 
const CoarseFineTransformationsGetDerefinementTransforms () const
 
void ClearTransforms ()
 Free all internal data created by the above three functions.
 
void GetEdgeVertices (const MeshId &edge_id, int vert_index[2], bool oriented=true) const
 Return Mesh vertex indices of an edge identified by 'edge_id'.
 
int GetEdgeNCOrientation (const MeshId &edge_id) const
 
int GetFaceVerticesEdges (const MeshId &face_id, int vert_index[4], int edge_index[4], int edge_orientation[4]) const
 
int GetEdgeMaster (int v1, int v2) const
 
Geometry::Type GetElementGeometry (int index) const
 Return element geometry type. index is the Mesh element number.
 
Geometry::Type GetFaceGeometry (int index) const
 Return face geometry type. index is the Mesh face number.
 
int GetNumRootElements ()
 Return the number of root elements.
 
int GetElementDepth (int i) const
 Return the distance of leaf 'i' from the root.
 
int GetElementSizeReduction (int i) const
 
void GetElementFacesAttributes (int i, Array< int > &faces, Array< int > &fattr) const
 Return the faces and face attributes of leaf element 'i'.
 
void Print (std::ostream &out, const std::string &comments="") const
 
bool IsLegacyLoaded () const
 I/O: Return true if the mesh was loaded from the legacy v1.1 format.
 
void LegacyToNewVertexOrdering (Array< int > &order) const
 I/O: Return a map from old (v1.1) vertex indices to new vertex indices.
 
long MemoryUsage () const
 Return total number of bytes allocated.
 
int PrintMemoryDetail () const
 
void DebugLeafOrder (std::ostream &out) const
 
void DebugDump (std::ostream &out) const
 

Protected Types

using GroupList = std::vector<CommGroup>
 
using GroupMap = std::map<CommGroup, GroupId>
 
- Protected Types inherited from mfem::NCMesh
typedef std::map< std::string, int > RefPathMap
 

Protected Member Functions

void GetConformingSharedStructures (class ParMesh &pmesh)
 
void GetFaceNeighbors (class ParMesh &pmesh)
 
void Update () override
 
int Partition (long index, long total_elements) const
 Return the processor number for a global element number.
 
int InitialPartition (int index) const
 Helper to get the partitioning when the serial mesh gets split initially.
 
long PartitionFirstIndex (int rank, long total_elements) const
 Return the global index of the first element owned by processor 'rank'.
 
void BuildFaceList () override
 
void BuildEdgeList () override
 
void BuildVertexList () override
 
void ElementSharesFace (int elem, int local, int face) override
 
void ElementSharesEdge (int elem, int local, int enode) override
 
void ElementSharesVertex (int elem, int local, int vnode) override
 
GroupId GetGroupId (const CommGroup &group)
 
GroupId GetSingletonGroup (int rank)
 
void InitOwners (int num, Array< GroupId > &entity_owner)
 
void MakeSharedList (const NCList &list, NCList &shared)
 
void AddConnections (int entity, int index, const Array< int > &ranks)
 
void CalculatePMatrixGroups ()
 
void CreateGroups (int nentities, Array< Connection > &index_rank, Array< GroupId > &entity_group)
 
void CalcFaceOrientations ()
 
void UpdateLayers ()
 
void MakeSharedTable (int ngroups, int ent, Array< int > &shared_local, Table &group_shared, Array< char > *entity_geom=NULL, char geom=0)
 
void AdjustMeshIds (Array< MeshId > ids[], int rank)
 
void ChangeVertexMeshIdElement (NCMesh::MeshId &id, int elem)
 
void ChangeEdgeMeshIdElement (NCMesh::MeshId &id, int elem)
 
void ChangeRemainingMeshIds (Array< MeshId > &ids, int pos, const Array< Pair< int, int > > &find)
 
void EncodeMeshIds (std::ostream &os, Array< MeshId > ids[])
 
void DecodeMeshIds (std::istream &is, Array< MeshId > ids[])
 
void EncodeGroups (std::ostream &os, const Array< GroupId > &ids)
 
void DecodeGroups (std::istream &is, Array< GroupId > &ids)
 
bool CheckElementType (int elem, int type)
 
void ElementNeighborProcessors (int elem, Array< int > &ranks)
 
void NeighborProcessors (Array< int > &neighbors)
 
void Prune ()
 
bool PruneTree (int elem)
 Internal. Recursive part of Prune().
 
void RedistributeElements (Array< int > &new_ranks, int target_elements, bool record_comm)
 
void ClearAuxPM ()
 
std::size_t GroupsMemoryUsage () const
 
- Protected Member Functions inherited from mfem::NCMesh
void GetMeshComponents (Mesh &mesh) const
 Fill Mesh::{vertices,elements,boundary} for the current finest level.
 
void OnMeshUpdated (Mesh *mesh)
 
void MakeTopologyOnly ()
 
void UpdateLeafElements ()
 Update the leaf elements indices in leaf_elements.
 
void UpdateVertices ()
 This method assigns indices to vertices (Node::vert_index) that will be seen by the Mesh class and the rest of MFEM.
 
void CollectLeafElements (int elem, int state, Array< int > &ghosts, int &counter)
 
void InitRootState (int root_count)
 
void InitGeomFlags ()
 
bool HavePrisms () const
 Return true if the mesh contains prism elements.
 
bool HavePyramids () const
 Return true if the mesh contains pyramid elements.
 
bool HaveTets () const
 Return true if the mesh contains tetrahedral elements.
 
bool IsGhost (const Element &el) const
 Return true if the Element el is a ghost element.
 
void RefineElement (int elem, char ref_type)
 
void DerefineElement (int elem)
 Derefine the element elem, does nothing on leaf elements.
 
int AddElement (const Element &el)
 
void FreeElement (int id)
 
int NewHexahedron (int n0, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int attr, int fattr0, int fattr1, int fattr2, int fattr3, int fattr4, int fattr5)
 
int NewWedge (int n0, int n1, int n2, int n3, int n4, int n5, int attr, int fattr0, int fattr1, int fattr2, int fattr3, int fattr4)
 
int NewTetrahedron (int n0, int n1, int n2, int n3, int attr, int fattr0, int fattr1, int fattr2, int fattr3)
 
int NewPyramid (int n0, int n1, int n2, int n3, int n4, int attr, int fattr0, int fattr1, int fattr2, int fattr3, int fattr4)
 
int NewQuadrilateral (int n0, int n1, int n2, int n3, int attr, int eattr0, int eattr1, int eattr2, int eattr3)
 
int NewTriangle (int n0, int n1, int n2, int attr, int eattr0, int eattr1, int eattr2)
 
int NewSegment (int n0, int n1, int attr, int vattr1, int vattr2)
 
mfem::ElementNewMeshElement (int geom) const
 
int QuadFaceSplitType (int n1, int n2, int n3, int n4, int mid[5]=NULL) const
 Given a quad face defined by four vertices, establish which edges of this face have been split, and if so optionally return the mid points of those edges.
 
bool TriFaceSplit (int n1, int n2, int n3, int mid[3]=NULL) const
 Given a tri face defined by three vertices, establish whether the edges that make up this face have been split, and if so optionally return the midpoints.
 
bool TriFaceIsMaster (int n1, int n2, int n3) const
 Determine if a Triangle face is a master face.
 
bool QuadFaceIsMaster (int n1, int n2, int n3, int n4) const
 Determine if a Quad face is a master face.
 
void ForceRefinement (int vn1, int vn2, int vn3, int vn4)
 
void FindEdgeElements (int vn1, int vn2, int vn3, int vn4, Array< MeshId > &prisms) const
 
void CheckAnisoPrism (int vn1, int vn2, int vn3, int vn4, const Refinement *refs, int nref)
 
void CheckAnisoFace (int vn1, int vn2, int vn3, int vn4, int mid12, int mid34, int level=0)
 
void CheckIsoFace (int vn1, int vn2, int vn3, int vn4, int en1, int en2, int en3, int en4, int midf)
 
void ReparentNode (int node, int new_p1, int new_p2)
 
int FindMidEdgeNode (int node1, int node2) const
 
int GetMidEdgeNode (int node1, int node2)
 
int GetMidFaceNode (int en1, int en2, int en3, int en4)
 
void ReferenceElement (int elem)
 
void UnreferenceElement (int elem, Array< int > &elemFaces)
 
FaceGetFace (Element &elem, int face_no)
 
void RegisterFaces (int elem, int *fattr=NULL)
 
void DeleteUnusedFaces (const Array< int > &elemFaces)
 
void CollectDerefinements (int elem, Array< Connection > &list)
 
int RetrieveNode (const Element &el, int index)
 Return el.node[index] correctly, even if the element is refined.
 
int FindNodeExt (const Element &el, int node, bool abort=true)
 Extended version of find_node: works if 'el' is refined.
 
int ReorderFacePointMat (int v0, int v1, int v2, int v3, int elem, const PointMatrix &pm, PointMatrix &reordered) const
 
void TraverseQuadFace (int vn0, int vn1, int vn2, int vn3, const PointMatrix &pm, int level, Face *eface[4], MatrixMap &matrix_map)
 
TriFaceTraverseResults TraverseTriFace (int vn0, int vn1, int vn2, const PointMatrix &pm, int level, MatrixMap &matrix_map)
 
void TraverseTetEdge (int vn0, int vn1, const Point &p0, const Point &p1, MatrixMap &matrix_map)
 
void TraverseEdge (int vn0, int vn1, real_t t0, real_t t1, int flags, int level, MatrixMap &matrix_map)
 
void FindSetNeighbors (const Array< char > &elem_set, Array< int > *neighbors, Array< char > *neighbor_set=NULL)
 
void FindNeighbors (int elem, Array< int > &neighbors, const Array< int > *search_set=NULL)
 
void NeighborExpand (const Array< int > &elems, Array< int > &expanded, const Array< int > *search_set=NULL)
 
void CollectEdgeVertices (int v0, int v1, Array< int > &indices)
 
void CollectTriFaceVertices (int v0, int v1, int v2, Array< int > &indices)
 
void CollectQuadFaceVertices (int v0, int v1, int v2, int v3, Array< int > &indices)
 
void BuildElementToVertexTable ()
 
void UpdateElementToVertexTable ()
 
int GetVertexRootCoord (int elem, RefCoord coord[3]) const
 
void CollectIncidentElements (int elem, const RefCoord coord[3], Array< int > &list) const
 
void FindVertexCousins (int elem, int local, Array< int > &cousins) const
 
void GetPointMatrix (Geometry::Type geom, const char *ref_path, DenseMatrix &matrix) const
 
void TraverseRefinements (int elem, int coarse_index, std::string &ref_path, RefPathMap &map) const
 
void InitDerefTransforms ()
 
void SetDerefMatrixCodes (int parent, Array< int > &fine_coarse)
 
const real_tCalcVertexPos (int node) const
 
int GetEdgeMaster (int node) const
 
void FindFaceNodes (int face, int node[4]) const
 
int EdgeSplitLevel (int vn1, int vn2) const
 Return the number of splits of this edge that have occurred in the NCMesh. If zero, this means the segment is not the master of any other segments.
 
int TriFaceSplitLevel (int vn1, int vn2, int vn3) const
 Return the number of splits of this triangle that have occurred in the NCMesh. If zero, this means the triangle is neither split, nor the master of a split face.
 
void QuadFaceSplitLevel (int vn1, int vn2, int vn3, int vn4, int &h_level, int &v_level) const
 Computes the number of horizontal and vertical splits of this quad that have occurred in the NCMesh. If zero, this means the quad is not the master of any other quad.
 
int QuadFaceSplitLevel (int vn1, int vn2, int vn3, int vn4) const
 Returns the total number of splits of this quad that have occurred in the NCMesh. If zero, this means the quad is not the master of any other quad.
 
void CountSplits (int elem, int splits[3]) const
 
void GetLimitRefinements (Array< Refinement > &refinements, int max_level)
 
int PrintVertexParents (std::ostream *out) const
 Print the "vertex_parents" section of the mesh file.
 
void LoadVertexParents (std::istream &input)
 Load the vertex parent hierarchy from a mesh file.
 
int PrintBoundary (std::ostream *out) const
 
void LoadBoundary (std::istream &input)
 Load the "boundary" section of the mesh file.
 
void PrintCoordinates (std::ostream &out) const
 Print the "coordinates" section of the mesh file.
 
void LoadCoordinates (std::istream &input)
 Load the "coordinates" section of the mesh file.
 
void InitRootElements ()
 Count root elements and initialize root_state.
 
int CountTopLevelNodes () const
 Return the index of the last top-level node plus one.
 
bool ZeroRootStates () const
 Return true if all root_states are zero.
 
void LoadCoarseElements (std::istream &input)
 Load the element refinement hierarchy from a legacy mesh file.
 
void CopyElements (int elem, const BlockArray< Element > &tmp_elements)
 
void LoadLegacyFormat (std::istream &input, int &curved, int &is_nc)
 Load the deprecated MFEM mesh v1.1 format for backward compatibility.
 

Static Protected Member Functions

static int get_face_orientation (const Face &face, const Element &e1, const Element &e2, int local[2]=NULL)
 
- Static Protected Member Functions inherited from mfem::NCMesh
static int find_node (const Element &el, int node)
 
static int find_element_edge (const Element &el, int vn0, int vn1, bool abort=true)
 
static int find_local_face (int geom, int a, int b, int c)
 
static const PointMatrixGetGeomIdentity (Geometry::Type geom)
 

Protected Attributes

MPI_Comm MyComm
 
int NRanks
 
GroupList groups
 
GroupMap group_id
 
Array< GroupIdentity_owner [3]
 
Array< GroupIdentity_pmat_group [3]
 
Array< GroupIdentity_conf_group [3]
 
Array< int > entity_elem_local [3]
 
NCList shared_vertices
 
NCList shared_edges
 
NCList shared_faces
 
Array< char > face_orient
 
Array< char > element_type
 
Array< int > ghost_layer
 list of elements whose 'element_type' == 2.
 
Array< int > boundary_layer
 list of type 3 elements
 
Array< int > tmp_owner
 
Array< char > tmp_shared_flag
 
Array< Connectionentity_index_rank [3]
 
Array< int > tmp_neighbors
 
RebalanceDofMessage::Map send_rebalance_dofs
 
RebalanceDofMessage::Map recv_rebalance_dofs
 
Array< int > old_index_or_rank
 
Array< DenseMatrix * > aux_pm_store
 Stores modified point matrices created by GetFaceNeighbors.
 
- Protected Attributes inherited from mfem::NCMesh
int Dim
 
int spaceDim
 dimensions of the elements and the vertex coordinates
 
int MyRank
 used in parallel, or when loading a parallel file in serial
 
bool Iso
 true if the mesh only contains isotropic refinements
 
int Geoms
 bit mask of element geometries present, see InitGeomFlags()
 
bool Legacy
 true if the mesh was loaded from the legacy v1.1 format
 
HashTable< Nodenodes
 
HashTable< Facefaces
 
BlockArray< Elementelements
 
Array< int > free_element_ids
 
Array< int > root_state
 
Array< real_tcoordinates
 
int NElements
 
int NVertices
 
int NEdges
 
int NFaces
 
int NGhostElements
 
int NGhostVertices
 
int NGhostEdges
 
int NGhostFaces
 
Array< int > leaf_elements
 finest elements, in Mesh ordering (+ ghosts)
 
Array< int > leaf_sfc_index
 natural tree ordering of leaf elements
 
Array< int > vertex_nodeId
 vertex-index to node-id map, see UpdateVertices
 
NCList face_list
 lazy-initialized list of faces, see GetFaceList
 
NCList edge_list
 lazy-initialized list of edges, see GetEdgeList
 
NCList vertex_list
 lazy-initialized list of vertices, see GetVertexList
 
Array< int > boundary_faces
 subset of all faces, set by BuildFaceList
 
Array< char > face_geom
 face geometry by face index, set by OnMeshUpdated
 
Table element_vertex
 leaf-element to vertex table, see FindSetNeighbors
 
Array< Refinementref_stack
 stack of scheduled refinements (temporary)
 
HashTable< Nodeshadow
 temporary storage for reparented nodes
 
Array< Triple< int, int, int > > reparents
 scheduled node reparents (tmp)
 
Table derefinements
 possible derefinements, see GetDerefinementTable
 
CoarseFineTransformations transforms
 storage for data returned by Get[De]RefinementTransforms()
 
Array< int > coarse_elements
 state of leaf_elements before Refine(), set by MarkCoarseLevel()
 
TmpVertextmp_vertex
 

Friends

class ParMesh
 
class NeighborRowMessage
 

Additional Inherited Members

- Static Public Member Functions inherited from mfem::NCMesh
static void GridSfcOrdering2D (int width, int height, Array< int > &coords)
 
static void GridSfcOrdering3D (int width, int height, int depth, Array< int > &coords)
 
- Static Protected Attributes inherited from mfem::NCMesh
static const int MaxElemNodes
 Number of nodes of an element can have.
 
static const int MaxElemEdges
 Number of edges of an element can have.
 
static const int MaxElemFaces
 Number of faces of an element can have.
 
static const int MaxElemChildren
 Number of children of an element can have.
 
static PointMatrix pm_seg_identity
 
static PointMatrix pm_tri_identity
 
static PointMatrix pm_quad_identity
 
static PointMatrix pm_tet_identity
 
static PointMatrix pm_prism_identity
 
static PointMatrix pm_pyramid_identity
 
static PointMatrix pm_hex_identity
 
static GeomInfo GI [Geometry::NumGeom]
 

Detailed Description

A parallel extension of the NCMesh class.

The basic idea (and assumption) is that all processors share the coarsest layer ("root elements"). This has the advantage that refinements can easily be exchanged between processors when rebalancing since individual elements can be uniquely identified by the index of the root element and a path in the refinement tree.

Each leaf element is owned by one of the processors (NCMesh::Element::rank). The underlying NCMesh stores not only elements for the current ('MyRank') processor, but also a minimal layer of adjacent "ghost" elements owned by other processors. The ghost layer is synchronized after refinement.

The ghost layer contains all vertex-, edge- and face-neighbors of the current processor's region. It is used to determine constraining relations and ownership of DOFs on the processor boundary. Ghost elements are never seen by the rest of MFEM as they are skipped when a Mesh is created from the NCMesh.

The processor that owns a vertex, edge or a face (and in turn its DOFs) is currently defined to be the one with the lowest rank in the group of processors that share the entity.

Vertices, edges and faces that are not owned by this ('MyRank') processor are ghosts, and are numbered after all real vertices/edges/faces, i.e., they have indices greater than NVertices, NEdges, NFaces, respectively.

A shared vertex/edge/face is identified in an interprocessor message by a pair of numbers. The first number specifies an element in an ElementSet (typically sent at the beginning of the message) that contains the v/e/f. The second number is the local index of the v/e/f in that element.

Definition at line 64 of file pncmesh.hpp.

Member Typedef Documentation

◆ CommGroup

using mfem::ParNCMesh::CommGroup = std::vector<int>

Definition at line 143 of file pncmesh.hpp.

◆ GroupId

using mfem::ParNCMesh::GroupId = short

Definition at line 142 of file pncmesh.hpp.

◆ GroupList

using mfem::ParNCMesh::GroupList = std::vector<CommGroup>
protected

Definition at line 267 of file pncmesh.hpp.

◆ GroupMap

using mfem::ParNCMesh::GroupMap = std::map<CommGroup, GroupId>
protected

Definition at line 268 of file pncmesh.hpp.

Constructor & Destructor Documentation

◆ ParNCMesh() [1/3]

mfem::ParNCMesh::ParNCMesh ( MPI_Comm comm,
const NCMesh & ncmesh,
int * part = NULL )

Construct by partitioning a serial NCMesh.

SFC partitioning is used by default. A user-specified partition can be passed in 'part', where part[i] is the desired MPI rank for element i.

Definition at line 31 of file pncmesh.cpp.

◆ ParNCMesh() [2/3]

mfem::ParNCMesh::ParNCMesh ( MPI_Comm comm,
std::istream & input,
int version,
int & curved,
int & is_nc )

Load from a stream, parallel version. See the serial NCMesh::NCMesh counterpart for a description of the parameters.

Definition at line 52 of file pncmesh.cpp.

◆ ParNCMesh() [3/3]

mfem::ParNCMesh::ParNCMesh ( const ParNCMesh & other)

Deep copy of another instance.

Definition at line 79 of file pncmesh.cpp.

◆ ~ParNCMesh()

mfem::ParNCMesh::~ParNCMesh ( )
virtual

Definition at line 88 of file pncmesh.cpp.

Member Function Documentation

◆ AddConnections()

void mfem::ParNCMesh::AddConnections ( int entity,
int index,
const Array< int > & ranks )
protected

Definition at line 462 of file pncmesh.cpp.

◆ AdjustMeshIds()

void mfem::ParNCMesh::AdjustMeshIds ( Array< MeshId > ids[],
int rank )
protected

Adjust some of the MeshIds before encoding for recipient 'rank', so that they only reference elements that exist in the recipient's ref. tree.

Definition at line 2472 of file pncmesh.cpp.

◆ BuildEdgeList()

void mfem::ParNCMesh::BuildEdgeList ( )
overrideprotectedvirtual

Reimplemented from mfem::NCMesh.

Definition at line 213 of file pncmesh.cpp.

◆ BuildFaceList()

void mfem::ParNCMesh::BuildFaceList ( )
overrideprotectedvirtual

Reimplemented from mfem::NCMesh.

Definition at line 146 of file pncmesh.cpp.

◆ BuildVertexList()

void mfem::ParNCMesh::BuildVertexList ( )
overrideprotectedvirtual

Reimplemented from mfem::NCMesh.

Definition at line 274 of file pncmesh.cpp.

◆ CalcFaceOrientations()

void mfem::ParNCMesh::CalcFaceOrientations ( )
protected

Definition at line 572 of file pncmesh.cpp.

◆ CalculatePMatrixGroups()

void mfem::ParNCMesh::CalculatePMatrixGroups ( )
protected

Definition at line 470 of file pncmesh.cpp.

◆ ChangeEdgeMeshIdElement()

void mfem::ParNCMesh::ChangeEdgeMeshIdElement ( NCMesh::MeshId & id,
int elem )
protected

Definition at line 2572 of file pncmesh.cpp.

◆ ChangeRemainingMeshIds()

void mfem::ParNCMesh::ChangeRemainingMeshIds ( Array< MeshId > & ids,
int pos,
const Array< Pair< int, int > > & find )
protected

Definition at line 2598 of file pncmesh.cpp.

◆ ChangeVertexMeshIdElement()

void mfem::ParNCMesh::ChangeVertexMeshIdElement ( NCMesh::MeshId & id,
int elem )
protected

Definition at line 2554 of file pncmesh.cpp.

◆ CheckDerefinementNCLevel()

void mfem::ParNCMesh::CheckDerefinementNCLevel ( const Table & deref_table,
Array< int > & level_ok,
int max_nc_level )
overridevirtual

Parallel version of NCMesh::CheckDerefinementNCLevel.

Reimplemented from mfem::NCMesh.

Definition at line 1822 of file pncmesh.cpp.

◆ CheckElementType()

bool mfem::ParNCMesh::CheckElementType ( int elem,
int type )
protected

Definition at line 701 of file pncmesh.cpp.

◆ ClearAuxPM()

void mfem::ParNCMesh::ClearAuxPM ( )
protected

Definition at line 1359 of file pncmesh.cpp.

◆ CreateGroups()

void mfem::ParNCMesh::CreateGroups ( int nentities,
Array< Connection > & index_rank,
Array< GroupId > & entity_group )
protected

Definition at line 432 of file pncmesh.cpp.

◆ DecodeGroups()

void mfem::ParNCMesh::DecodeGroups ( std::istream & is,
Array< GroupId > & ids )
protected

Definition at line 2752 of file pncmesh.cpp.

◆ DecodeMeshIds()

void mfem::ParNCMesh::DecodeMeshIds ( std::istream & is,
Array< MeshId > ids[] )
protected

Definition at line 2653 of file pncmesh.cpp.

◆ Derefine()

void mfem::ParNCMesh::Derefine ( const Array< int > & derefs)
overridevirtual

Parallel reimplementation of NCMesh::Derefine, keeps ghost layers in sync. The interface is identical.

Reimplemented from mfem::NCMesh.

Definition at line 1568 of file pncmesh.cpp.

◆ ElementNeighborProcessors()

void mfem::ParNCMesh::ElementNeighborProcessors ( int elem,
Array< int > & ranks )
protected

Return a list of processors that own elements in the immediate neighborhood of 'elem' (i.e., vertex, edge and face neighbors), and are not 'MyRank'.

Definition at line 718 of file pncmesh.cpp.

◆ ElementRank()

int mfem::ParNCMesh::ElementRank ( int index) const
inline

Returns owner processor for element 'index'. This is normally MyRank but for index >= NElements (i.e., for ghosts) it may be something else.

Definition at line 200 of file pncmesh.hpp.

◆ ElementSharesEdge()

void mfem::ParNCMesh::ElementSharesEdge ( int elem,
int local,
int enode )
overrideprotectedvirtual

Reimplemented from mfem::NCMesh.

Definition at line 188 of file pncmesh.cpp.

◆ ElementSharesFace()

void mfem::ParNCMesh::ElementSharesFace ( int elem,
int local,
int face )
overrideprotectedvirtual

Reimplemented from mfem::NCMesh.

Definition at line 123 of file pncmesh.cpp.

◆ ElementSharesVertex()

void mfem::ParNCMesh::ElementSharesVertex ( int elem,
int local,
int vnode )
overrideprotectedvirtual

Reimplemented from mfem::NCMesh.

Definition at line 251 of file pncmesh.cpp.

◆ EncodeGroups()

void mfem::ParNCMesh::EncodeGroups ( std::ostream & os,
const Array< GroupId > & ids )
protected

Definition at line 2710 of file pncmesh.cpp.

◆ EncodeMeshIds()

void mfem::ParNCMesh::EncodeMeshIds ( std::ostream & os,
Array< MeshId > ids[] )
protected

Definition at line 2610 of file pncmesh.cpp.

◆ get_face_orientation()

int mfem::ParNCMesh::get_face_orientation ( const Face & face,
const Element & e1,
const Element & e2,
int local[2] = NULL )
staticprotected

Definition at line 542 of file pncmesh.cpp.

◆ GetBoundaryClosure()

void mfem::ParNCMesh::GetBoundaryClosure ( const Array< int > & bdr_attr_is_ess,
Array< int > & bdr_vertices,
Array< int > & bdr_edges,
Array< int > & bdr_faces )
overridevirtual

Extension of NCMesh::GetBoundaryClosure. Filters out ghost vertices and ghost edges from 'bdr_vertices' and 'bdr_edges', and uncovers hidden internal boundary faces.

Reimplemented from mfem::NCMesh.

Definition at line 598 of file pncmesh.cpp.

◆ GetConformingSharedStructures()

void mfem::ParNCMesh::GetConformingSharedStructures ( class ParMesh & pmesh)
protected

For compatibility with conforming code in ParMesh and ParFESpace. Initializes shared structures in ParMesh: gtopo, shared_*, group_s*, s*_l*. The ParMesh then acts as a parallel mesh cut along the NC interfaces.

Definition at line 827 of file pncmesh.cpp.

◆ GetDebugMesh()

void mfem::ParNCMesh::GetDebugMesh ( Mesh & debug_mesh) const

Extract a debugging Mesh containing all leaf elements, including ghosts. The debug mesh will have element attributes set to element rank + 1.

Definition at line 2916 of file pncmesh.cpp.

◆ GetDerefineOldRanks()

const Array< int > & mfem::ParNCMesh::GetDerefineOldRanks ( ) const
inline

Get previous (pre-Derefine) fine element ranks. This complements the CoarseFineTransformations::embeddings array in parallel.

Definition at line 223 of file pncmesh.hpp.

◆ GetEntityGroupId()

GroupId mfem::ParNCMesh::GetEntityGroupId ( int entity,
int index )
inline

Return the P matrix communication group ID for a vertex/edge/face. The groups are calculated specifically to match the P matrix construction algorithm and its communication pattern.

Definition at line 160 of file pncmesh.hpp.

◆ GetEntityOwnerId()

GroupId mfem::ParNCMesh::GetEntityOwnerId ( int entity,
int index )
inline

Return vertex/edge/face ('entity' == 0/1/2, resp.) owner.

Definition at line 146 of file pncmesh.hpp.

◆ GetFaceNeighbors()

void mfem::ParNCMesh::GetFaceNeighbors ( class ParMesh & pmesh)
protected

Populate face neighbor members of ParMesh from the ghost layer, without communication.

Definition at line 928 of file pncmesh.cpp.

◆ GetFaceOrientation()

int mfem::ParNCMesh::GetFaceOrientation ( int index) const
inline

Return (shared) face orientation relative to its owner element.

Definition at line 137 of file pncmesh.hpp.

◆ GetFineToCoarsePartitioning()

void mfem::ParNCMesh::GetFineToCoarsePartitioning ( const Array< int > & derefs,
Array< int > & new_ranks ) const

Gets partitioning for the coarse mesh if the current fine mesh were to be derefined.

Definition at line 1537 of file pncmesh.cpp.

◆ GetGroup()

const CommGroup & mfem::ParNCMesh::GetGroup ( GroupId id) const
inline

Return a list of ranks contained in the group of the given ID.

Definition at line 172 of file pncmesh.hpp.

◆ GetGroupId()

ParNCMesh::GroupId mfem::ParNCMesh::GetGroupId ( const CommGroup & group)
protected

Definition at line 396 of file pncmesh.cpp.

◆ GetMyRank()

int mfem::ParNCMesh::GetMyRank ( ) const
inline

Definition at line 208 of file pncmesh.hpp.

◆ GetNElements()

int mfem::ParNCMesh::GetNElements ( ) const
inline

Definition at line 112 of file pncmesh.hpp.

◆ GetNGhostEdges()

int mfem::ParNCMesh::GetNGhostEdges ( ) const
inline

Definition at line 115 of file pncmesh.hpp.

◆ GetNGhostElements()

int mfem::ParNCMesh::GetNGhostElements ( ) const
inlineoverridevirtual

Reimplemented from mfem::NCMesh.

Definition at line 117 of file pncmesh.hpp.

◆ GetNGhostFaces()

int mfem::ParNCMesh::GetNGhostFaces ( ) const
inline

Definition at line 116 of file pncmesh.hpp.

◆ GetNGhostVertices()

int mfem::ParNCMesh::GetNGhostVertices ( ) const
inline

Definition at line 114 of file pncmesh.hpp.

◆ GetRebalanceOldIndex()

const Array< int > & mfem::ParNCMesh::GetRebalanceOldIndex ( ) const
inline

Get previous indices (pre-Rebalance) of current elements. Index of -1 indicates that an element didn't exist in the mesh before.

Definition at line 219 of file pncmesh.hpp.

◆ GetSharedEdges()

const NCList & mfem::ParNCMesh::GetSharedEdges ( )
inline

Definition at line 122 of file pncmesh.hpp.

◆ GetSharedFaces()

const NCList & mfem::ParNCMesh::GetSharedFaces ( )
inline

Definition at line 123 of file pncmesh.hpp.

◆ GetSharedList()

const NCList & mfem::ParNCMesh::GetSharedList ( int entity)
inline

Helper to get shared vertices/edges/faces ('entity' == 0/1/2 resp.).

Definition at line 126 of file pncmesh.hpp.

◆ GetSharedVertices()

const NCList & mfem::ParNCMesh::GetSharedVertices ( )
inline

Definition at line 121 of file pncmesh.hpp.

◆ GetSingletonGroup()

ParNCMesh::GroupId mfem::ParNCMesh::GetSingletonGroup ( int rank)
protected

Definition at line 412 of file pncmesh.cpp.

◆ GroupContains()

bool mfem::ParNCMesh::GroupContains ( GroupId id,
int rank ) const

Return true if group 'id' contains the given rank.

Definition at line 421 of file pncmesh.cpp.

◆ GroupsMemoryUsage()

std::size_t mfem::ParNCMesh::GroupsMemoryUsage ( ) const
protected

Definition at line 2974 of file pncmesh.cpp.

◆ InitialPartition()

int mfem::ParNCMesh::InitialPartition ( int index) const
inlineprotected

Helper to get the partitioning when the serial mesh gets split initially.

Definition at line 306 of file pncmesh.hpp.

◆ InitOwners()

void mfem::ParNCMesh::InitOwners ( int num,
Array< GroupId > & entity_owner )
protected

Definition at line 306 of file pncmesh.cpp.

◆ IsGhost()

bool mfem::ParNCMesh::IsGhost ( int entity,
int index ) const
inline

Return true if the specified vertex/edge/face is a ghost.

Definition at line 182 of file pncmesh.hpp.

◆ LimitNCLevel()

void mfem::ParNCMesh::LimitNCLevel ( int max_nc_level)
overridevirtual

Parallel version of NCMesh::LimitNCLevel.

Reimplemented from mfem::NCMesh.

Definition at line 1519 of file pncmesh.cpp.

◆ MakeSharedList()

void mfem::ParNCMesh::MakeSharedList ( const NCList & list,
NCList & shared )
protected

Definition at line 316 of file pncmesh.cpp.

◆ MakeSharedTable()

void mfem::ParNCMesh::MakeSharedTable ( int ngroups,
int ent,
Array< int > & shared_local,
Table & group_shared,
Array< char > * entity_geom = NULL,
char geom = 0 )
protected

Definition at line 767 of file pncmesh.cpp.

◆ MemoryUsage()

std::size_t mfem::ParNCMesh::MemoryUsage ( bool with_base = true) const

Return total number of bytes allocated.

Definition at line 2997 of file pncmesh.cpp.

◆ NeighborProcessors()

void mfem::ParNCMesh::NeighborProcessors ( Array< int > & neighbors)
protected

Get a list of ranks that own elements in the neighborhood of our region. NOTE: MyRank is not included.

Definition at line 750 of file pncmesh.cpp.

◆ Partition()

int mfem::ParNCMesh::Partition ( long index,
long total_elements ) const
inlineprotected

Return the processor number for a global element number.

Definition at line 302 of file pncmesh.hpp.

◆ PartitionFirstIndex()

long mfem::ParNCMesh::PartitionFirstIndex ( int rank,
long total_elements ) const
inlineprotected

Return the global index of the first element owned by processor 'rank'.

Definition at line 310 of file pncmesh.hpp.

◆ PrintMemoryDetail()

int mfem::ParNCMesh::PrintMemoryDetail ( bool with_base = true) const

Definition at line 3023 of file pncmesh.cpp.

◆ Prune()

void mfem::ParNCMesh::Prune ( )
protected

Traverse the (local) refinement tree and determine which subtrees are no longer needed, i.e., their leaves are not owned by us nor are they our ghosts. These subtrees are then derefined.

Definition at line 1407 of file pncmesh.cpp.

◆ PruneTree()

bool mfem::ParNCMesh::PruneTree ( int elem)
protected

Internal. Recursive part of Prune().

Definition at line 1370 of file pncmesh.cpp.

◆ Rebalance()

void mfem::ParNCMesh::Rebalance ( const Array< int > * custom_partition = NULL)

Migrate leaf elements of the global refinement hierarchy (including ghost elements) so that each processor owns the same number of leaves (+-1). The default partitioning strategy is based on equal splitting of the space-filling sequence of leaf elements (custom_partition == NULL). Alternatively, a used-defined element-rank assignment array can be passed.

Definition at line 1880 of file pncmesh.cpp.

◆ RecvRebalanceDofs()

void mfem::ParNCMesh::RecvRebalanceDofs ( Array< int > & elements,
Array< long > & dofs )

Receive element DOFs sent by SendRebalanceDofs().

Definition at line 2251 of file pncmesh.cpp.

◆ RedistributeElements()

void mfem::ParNCMesh::RedistributeElements ( Array< int > & new_ranks,
int target_elements,
bool record_comm )
protected

Assign new Element::rank to leaf elements and send them to their new owners, keeping the ghost layer up to date. Used by Rebalance() and Derefine(). 'target_elements' is the number of elements this rank is supposed to own after the exchange. If this number is not known a priori, the parameter can be set to -1, but more expensive communication (synchronous sends and a barrier) will be used in that case.

Definition at line 1941 of file pncmesh.cpp.

◆ Refine()

void mfem::ParNCMesh::Refine ( const Array< Refinement > & refinements)
overridevirtual

An override of NCMesh::Refine, which is called eventually, after making sure that refinements that occur on the processor boundary are sent to the neighbor processors so they can keep their ghost layers up to date.

Reimplemented from mfem::NCMesh.

Definition at line 1441 of file pncmesh.cpp.

◆ SendRebalanceDofs()

void mfem::ParNCMesh::SendRebalanceDofs ( int old_ndofs,
const Table & old_element_dofs,
long old_global_offset,
FiniteElementSpace * space )

Use the communication pattern from last Rebalance() to send element DOFs.

Definition at line 2218 of file pncmesh.cpp.

◆ SynchronizeDerefinementData()

template<typename Type >
template void mfem::ParNCMesh::SynchronizeDerefinementData< float > ( Array< Type > & elem_data,
const Table & deref_table )

Exchange element data for derefinements that straddle processor boundaries. 'elem_data' is enlarged and filled with ghost values.

Definition at line 1740 of file pncmesh.cpp.

◆ Trim()

void mfem::ParNCMesh::Trim ( )
overridevirtual

Save memory by releasing all non-essential and cached data.

Reimplemented from mfem::NCMesh.

Definition at line 2933 of file pncmesh.cpp.

◆ Update()

void mfem::ParNCMesh::Update ( )
overrideprotectedvirtual

Apart from the primary data structure, which is the element/node/face hierarchy, there is secondary data that is derived from the primary data and needs to be updated when the primary data changes. Update() takes care of that and needs to be called after each refinement and derefinement.

Reimplemented from mfem::NCMesh.

Definition at line 93 of file pncmesh.cpp.

◆ UpdateLayers()

void mfem::ParNCMesh::UpdateLayers ( )
protected

Definition at line 663 of file pncmesh.cpp.

Friends And Related Symbol Documentation

◆ NeighborRowMessage

friend class NeighborRowMessage
friend

Definition at line 543 of file pncmesh.hpp.

◆ ParMesh

friend class ParMesh
friend

Definition at line 252 of file pncmesh.hpp.

Member Data Documentation

◆ aux_pm_store

Array<DenseMatrix*> mfem::ParNCMesh::aux_pm_store
protected

Stores modified point matrices created by GetFaceNeighbors.

Definition at line 538 of file pncmesh.hpp.

◆ boundary_layer

Array<int> mfem::ParNCMesh::boundary_layer
protected

list of type 3 elements

Definition at line 297 of file pncmesh.hpp.

◆ element_type

Array<char> mfem::ParNCMesh::element_type
protected

Type of each leaf element: 1 - our element (rank == MyRank), 3 - our element, and neighbor to the ghost layer, 2 - ghost layer element (existing element, but rank != MyRank), 0 - element beyond the ghost layer, may not be a real element. Note: indexed by Element::index. See also UpdateLayers().

Definition at line 294 of file pncmesh.hpp.

◆ entity_conf_group

Array<GroupId> mfem::ParNCMesh::entity_conf_group[3]
protected

Definition at line 279 of file pncmesh.hpp.

◆ entity_elem_local

Array<int> mfem::ParNCMesh::entity_elem_local[3]
protected

Definition at line 281 of file pncmesh.hpp.

◆ entity_index_rank

Array<Connection> mfem::ParNCMesh::entity_index_rank[3]
protected

Definition at line 326 of file pncmesh.hpp.

◆ entity_owner

Array<GroupId> mfem::ParNCMesh::entity_owner[3]
protected

Definition at line 274 of file pncmesh.hpp.

◆ entity_pmat_group

Array<GroupId> mfem::ParNCMesh::entity_pmat_group[3]
protected

Definition at line 276 of file pncmesh.hpp.

◆ face_orient

Array<char> mfem::ParNCMesh::face_orient
protected

Definition at line 286 of file pncmesh.hpp.

◆ ghost_layer

Array<int> mfem::ParNCMesh::ghost_layer
protected

list of elements whose 'element_type' == 2.

Definition at line 296 of file pncmesh.hpp.

◆ group_id

GroupMap mfem::ParNCMesh::group_id
protected

Definition at line 271 of file pncmesh.hpp.

◆ groups

GroupList mfem::ParNCMesh::groups
protected

Definition at line 270 of file pncmesh.hpp.

◆ MyComm

MPI_Comm mfem::ParNCMesh::MyComm
protected

Definition at line 264 of file pncmesh.hpp.

◆ NRanks

int mfem::ParNCMesh::NRanks
protected

Definition at line 265 of file pncmesh.hpp.

◆ old_index_or_rank

Array<int> mfem::ParNCMesh::old_index_or_rank
protected

After Rebalance, this array holds the old element indices, or -1 if an element didn't exist in the mesh previously. After Derefine, it holds the ranks of the old (potentially non-existent) fine elements.

Definition at line 535 of file pncmesh.hpp.

◆ recv_rebalance_dofs

RebalanceDofMessage::Map mfem::ParNCMesh::recv_rebalance_dofs
protected

Definition at line 530 of file pncmesh.hpp.

◆ send_rebalance_dofs

RebalanceDofMessage::Map mfem::ParNCMesh::send_rebalance_dofs
protected

Recorded communication pattern from last Rebalance. Used by Send/RecvRebalanceDofs to ship element DOFs.

Definition at line 529 of file pncmesh.hpp.

◆ shared_edges

NCList mfem::ParNCMesh::shared_edges
protected

Definition at line 284 of file pncmesh.hpp.

◆ shared_faces

NCList mfem::ParNCMesh::shared_faces
protected

Definition at line 284 of file pncmesh.hpp.

◆ shared_vertices

NCList mfem::ParNCMesh::shared_vertices
protected

Definition at line 284 of file pncmesh.hpp.

◆ tmp_neighbors

Array<int> mfem::ParNCMesh::tmp_neighbors
protected

Definition at line 406 of file pncmesh.hpp.

◆ tmp_owner

Array<int> mfem::ParNCMesh::tmp_owner
protected

Definition at line 324 of file pncmesh.hpp.

◆ tmp_shared_flag

Array<char> mfem::ParNCMesh::tmp_shared_flag
protected

Definition at line 325 of file pncmesh.hpp.


The documentation for this class was generated from the following files: