15 #include "../config/config.hpp"
23 #include "../general/communication.hpp"
24 #include "../general/sort_pairs.hpp"
29 class FiniteElementSpace;
135 MFEM_ASSERT(entity >= 0 && entity < 3,
"");
136 MFEM_ASSERT(index >= 0,
"");
149 MFEM_ASSERT(entity >= 0 && entity < 3,
"");
150 MFEM_ASSERT(index >= 0,
"");
161 MFEM_ASSERT(
id >= 0,
"");
174 case 1:
return index >=
NEdges;
175 default:
return index >=
NFaces;
208 template<
typename Type>
210 const Table &deref_table);
295 {
return index *
NRanks / total_elements; }
333 int local[2] = NULL );
339 Table &group_shared);
355 void Dump(std::ostream &os)
const;
357 void Load(std::istream &is);
372 int GetInt(
int pos)
const;
419 template<
class ValueType,
bool RefTypes,
int Tag>
430 void Add(
int elem, ValueType val)
452 typedef std::map<int, NeighborRefinementMessage>
Map;
461 typedef std::map<int, NeighborDerefinementMessage>
Map;
471 typedef std::map<int, NeighborElementRankMessage>
Map;
482 typedef std::map<int, RebalanceMessage>
Map;
498 typedef std::map<int, RebalanceDofMessage>
Map;
550 #endif // MFEM_USE_MPI
552 #endif // MFEM_PNCMESH
void SetNCMesh(NCMesh *ncmesh)
int Partition(long index, long total_elements) const
Return the processor number for a global element number.
ElementSet(NCMesh *ncmesh=NULL, bool include_ref_types=false)
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 DecodeMeshIds(std::istream &is, Array< MeshId > ids[])
Array< char > element_type
int Size() const
Logical size of the array.
std::vector< ValueType > values
long PartitionFirstIndex(int rank, long total_elements) const
Return the global index of the first element owned by processor 'rank'.
void GetConformingSharedStructures(class ParMesh &pmesh)
virtual void Trim()
Save memory by releasing all non-essential and cached data.
std::vector< int > CommGroup
void CalcFaceOrientations()
const CommGroup & GetGroup(GroupId id) const
Return a list of ranks contained in the group of the given ID.
void MakeSharedList(const NCList &list, NCList &shared)
Array< char > face_orient
std::vector< int > elem_ids
void ChangeRemainingMeshIds(Array< MeshId > &ids, int pos, const Array< Pair< int, int > > &find)
virtual void BuildFaceList()
void Dump(std::ostream &os) const
virtual int GetNumGhostVertices() const
const NCList & GetSharedVertices()
GroupId GetSingletonGroup(int rank)
void GetFaceNeighbors(class ParMesh &pmesh)
Lists all edges/faces in the nonconforming mesh.
void SetNCMesh(ParNCMesh *pncmesh)
Set pointer to ParNCMesh (needed to encode the message).
std::map< int, NeighborElementRankMessage > Map
const NCMesh * GetNCMesh() const
virtual void ElementSharesVertex(int elem, int local, int vnode)
std::vector< int > elements
std::vector< CommGroup > GroupList
void Load(std::istream &is)
void Add(int elem, ValueType val)
void SynchronizeDerefinementData(Array< Type > &elem_data, const Table &deref_table)
int GetInt(int pos) const
virtual void OnMeshUpdated(Mesh *mesh)
virtual void Derefine(const Array< int > &derefs)
void SetElements(const Array< int > &elems, NCMesh *ncmesh)
bool operator<(const Pair< A, B > &p, const Pair< A, B > &q)
Comparison operator for class Pair, based on the first element only.
void ChangeEdgeMeshIdElement(NCMesh::MeshId &id, int elem)
bool GroupContains(GroupId id, int rank) const
Return true if group 'id' contains the given rank.
int PrintMemoryDetail() const
void EncodeTree(int elem)
virtual void AssignLeafIndices()
const NCList & GetSharedEdges()
const NCList & GetFaceList()
Return the current list of conforming and nonconforming faces.
const NCList & GetSharedList(int entity)
Helper to get shared vertices/edges/faces ('entity' == 0/1/2 resp.).
A parallel extension of the NCMesh class.
virtual int GetNumGhostElements() const
RebalanceDofMessage::Map send_rebalance_dofs
void FlagElements(const Array< int > &elements, char flag)
void Decode(Array< int > &elements) const
void AddElementRank(int elem, int rank)
virtual bool IsGhost(const Element &el) const
Geometry::Type GetGhostFaceGeometry(int ghost_face_id) const
Array< DenseMatrix * > aux_pm_store
Stores modified point matrices created by GetFaceNeighbors.
GroupId GetEntityGroupId(int entity, int index)
void RedistributeElements(Array< int > &new_ranks, int target_elements, bool record_comm)
void ElementNeighborProcessors(int elem, Array< int > &ranks)
int GetNGhostEdges() const
void CreateGroups(int nentities, Array< Connection > &index_rank, Array< GroupId > &entity_group)
Array< int > old_index_or_rank
RebalanceDofMessage::Map recv_rebalance_dofs
int InitialPartition(int index) const
Helper to get the partitioning when the serial mesh gets split initially.
void AddRefinement(int elem, char ref_type)
Identifies a vertex/edge/face in both Mesh and NCMesh.
std::map< int, NeighborRefinementMessage > Map
virtual void ElementSharesFace(int elem, int local, int face)
A class for non-conforming AMR on higher-order hexahedral, quadrilateral or triangular meshes...
virtual void GetBoundaryClosure(const Array< int > &bdr_attr_is_ess, Array< int > &bdr_vertices, Array< int > &bdr_edges)
void DecodeGroups(std::istream &is, Array< GroupId > &ids)
void AdjustMeshIds(Array< MeshId > ids[], int rank)
virtual void ElementSharesEdge(int elem, int local, int enode)
int GetNGhostFaces() const
Array< int > tmp_neighbors
std::map< int, RebalanceDofMessage > Map
std::map< int, NeighborDerefinementMessage > Map
const Array< int > & GetRebalanceOldIndex() const
bool operator==(const Array< T > &LHS, const Array< T > &RHS)
Array< Connection > entity_index_rank[3]
virtual void BuildEdgeList()
Array< GroupId > entity_owner[3]
void Encode(const Array< int > &elements)
Array< char > tmp_shared_flag
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
void GetDebugMesh(Mesh &debug_mesh) const
const NCList & GetVertexList()
int ElementRank(int index) const
bool PruneTree(int elem)
Internal. Recursive part of Prune().
GroupId GetEntityOwnerId(int entity, int index)
Return vertex/edge/face ('entity' == 0/1/2, resp.) owner.
void SetNCMesh(NCMesh *ncmesh)
virtual void Refine(const Array< Refinement > &refinements)
static bool compare_ranks_indices(const Element *a, const Element *b)
void RecvRebalanceDofs(Array< int > &elements, Array< long > &dofs)
Receive element DOFs sent by SendRebalanceDofs().
Array< int > leaf_elements
int GetNGhostElements() const
Array< int > boundary_layer
list of type 3 elements
std::map< CommGroup, GroupId > GroupMap
friend class NeighborRowMessage
void AddElementRank(int elem, int rank)
bool IsGhost(int entity, int index) const
Return true if the specified vertex/edge/face is a ghost.
void InitOwners(int num, Array< GroupId > &entity_owner)
void ChangeVertexMeshIdElement(NCMesh::MeshId &id, int elem)
void DecodeTree(int elem, int &pos, Array< int > &elements) const
void EncodeGroups(std::ostream &os, const Array< GroupId > &ids)
virtual void BuildVertexList()
void CalculatePMatrixGroups()
Array< int > entity_elem_local[3]
int GetFaceOrientation(int index) const
Return (shared) face orientation relative to its owner element.
Array< int > leaf_glob_order
BlockArray< Element > elements
virtual void CheckDerefinementNCLevel(const Table &deref_table, Array< int > &level_ok, int max_nc_level)
Array< int > ghost_layer
list of elements whose 'element_type' == 2.
void EncodeMeshIds(std::ostream &os, Array< MeshId > ids[])
void AddConnections(int entity, int index, const Array< int > &ranks)
long MemoryUsage() const
Return total number of bytes allocated.
const NCList & GetSharedFaces()
void AddDerefinement(int elem, int rank)
std::map< int, RebalanceMessage > Map
static int get_face_orientation(Face &face, Element &e1, Element &e2, int local[2]=NULL)
const NCList & GetEdgeList()
Return the current list of conforming and nonconforming edges.
Array< GroupId > entity_pmat_group[3]
void NeighborProcessors(Array< int > &neighbors)
long GroupsMemoryUsage() const
int GetNGhostVertices() const
bool CheckElementType(int elem, int type)
virtual void UpdateVertices()
update Vertex::index and vertex_nodeId
Class for parallel meshes.
GroupId GetGroupId(const CommGroup &group)
Variable-length MPI message containing unspecific binary data.
int rank
processor number (ParNCMesh), -1 if undefined/unknown
virtual void LimitNCLevel(int max_nc_level)
Parallel version of NCMesh::LimitNCLevel.
Array< unsigned char > data
encoded refinement (sub-)trees
const Array< int > & GetDerefineOldRanks() const
void MakeSharedTable(int ngroups, int ent, Array< int > &shared_local, Table &group_shared)
ParNCMesh(MPI_Comm comm, const NCMesh &ncmesh, int *part=NULL)
Array< GroupId > entity_conf_group[3]