15 #include "../config/config.hpp"
23 #include "../general/communication.hpp"
24 #include "../general/sort_pairs.hpp"
29 class FiniteElementSpace;
74 ParNCMesh(MPI_Comm comm, std::istream &input,
75 int version,
int &curved,
int &is_nc);
150 MFEM_ASSERT(entity >= 0 && entity < 3,
"");
151 MFEM_ASSERT(index >= 0,
"");
164 MFEM_ASSERT(entity >= 0 && entity < 3,
"");
165 MFEM_ASSERT(index >= 0,
"");
176 MFEM_ASSERT(
id >= 0,
"");
188 MFEM_ASSERT(entity == 2,
"");
195 case 1:
return index >=
NEdges;
196 default:
return index >=
NFaces;
229 template<
typename Type>
231 const Table &deref_table);
243 std::size_t
MemoryUsage(
bool with_base =
true)
const;
306 {
return index *
NRanks / total_elements; }
340 int local[2] = NULL );
363 void Dump(std::ostream &os)
const;
365 void Load(std::istream &is);
380 int GetInt(
int pos)
const;
432 template<
class ValueType,
bool RefTypes,
int Tag>
443 void Add(
int elem, ValueType val)
465 typedef std::map<int, NeighborRefinementMessage>
Map;
474 typedef std::map<int, NeighborDerefinementMessage>
Map;
484 typedef std::map<int, NeighborElementRankMessage>
Map;
495 typedef std::map<int, RebalanceMessage>
Map;
511 typedef std::map<int, RebalanceDofMessage>
Map;
564 #endif // MFEM_USE_MPI
566 #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
Return the 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
const NCList & GetSharedVertices()
GroupId GetSingletonGroup(int rank)
void GetFaceNeighbors(class ParMesh &pmesh)
Lists all edges/faces in the nonconforming mesh.
std::string RefPath() const
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 SetNCMesh(ParNCMesh *pncmesh_)
Set pointer to ParNCMesh (needed to encode the message).
void Add(int elem, ValueType val)
void SynchronizeDerefinementData(Array< Type > &elem_data, const Table &deref_table)
int GetInt(int pos) const
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)
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.
RebalanceDofMessage::Map send_rebalance_dofs
void FlagElements(const Array< int > &elements, char flag)
std::size_t GroupsMemoryUsage() const
void Decode(Array< int > &elements) const
void AddElementRank(int elem, int rank)
Array< DenseMatrix * > aux_pm_store
Stores modified point matrices created by GetFaceNeighbors.
GroupId GetEntityGroupId(int entity, int index)
virtual void GetFineToCoarsePartitioning(const Array< int > &derefs, Array< int > &new_ranks) const
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
int MyRank
used in parallel, or when loading a parallel file in serial
virtual void ElementSharesFace(int elem, int local, int face)
A class for non-conforming AMR. The class is not used directly by the user, rather it is an extension...
virtual void GetBoundaryClosure(const Array< int > &bdr_attr_is_ess, Array< int > &bdr_vertices, Array< int > &bdr_edges)
void Rebalance(const Array< int > *custom_partition=NULL)
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.
virtual void Refine(const Array< Refinement > &refinements)
void RecvRebalanceDofs(Array< int > &elements, Array< long > &dofs)
Receive element DOFs sent by SendRebalanceDofs().
Array< int > leaf_elements
finest elements, in Mesh ordering (+ ghosts)
int GetNGhostElements() const
Array< int > boundary_layer
list of type 3 elements
std::size_t MemoryUsage() const
Return total number of bytes allocated.
std::map< CommGroup, GroupId > GroupMap
friend class NeighborRowMessage
int index(int i, int j, int nx, int ny)
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.
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)
void MakeSharedTable(int ngroups, int ent, Array< int > &shared_local, Table &group_shared, Array< char > *entity_geom=NULL, char geom=0)
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)
std::size_t MemoryUsage() const
int GetNGhostVertices() const
bool CheckElementType(int elem, int type)
Class for parallel meshes.
GroupId GetGroupId(const CommGroup &group)
void SetNCMesh(NCMesh *ncmesh_)
Variable-length MPI message containing unspecific binary data.
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
ParNCMesh(MPI_Comm comm, const NCMesh &ncmesh, int *part=NULL)
Construct by partitioning a serial NCMesh.
Array< GroupId > entity_conf_group[3]