19#include <unordered_map>
25using namespace SubMeshUtils;
45 if (from == From::Domain)
49 else if (from == From::Boundary)
61 nodes.Reparent(i, submesh_p1, submesh_p2);
65 for (
int i = 0; i <
elements.Size(); i++)
82 MPI_Allreduce(MPI_IN_PLACE,
p, 2, MPI_INT, MPI_MIN, submesh.
GetComm());
83 MFEM_ASSERT(
p[0] == -
p[1],
"Ranks must agree on number of root elements: min "
84 <<
p[0] <<
" max " << -
p[1] <<
" local " <<
root_state.
Size() <<
" MyRank " <<
105 if (from == From::Domain)
109 submesh.parent_to_submesh_element_ids_ = -1;
110 for (
int i = 0; i < submesh.parent_element_ids_.
Size(); i++)
112 submesh.parent_element_ids_[i] =
114 submesh.parent_to_submesh_element_ids_[submesh.parent_element_ids_[i]] = i;
119 submesh.parent_to_submesh_element_ids_ = -1;
123 auto new_parent_to_submesh_element_ids = submesh.parent_to_submesh_element_ids_;
125 new_parent_element_ids.
Reserve(submesh.parent_element_ids_.
Size());
126 for (
int i = 0; i < submesh.parent_element_ids_.
Size(); i++)
128 new_parent_element_ids.
Append(
130 new_parent_to_submesh_element_ids[new_parent_element_ids[i]] = i;
133 MFEM_ASSERT(new_parent_element_ids.
Size() == submesh.parent_element_ids_.
Size(),
134 new_parent_element_ids.
Size() <<
' ' << submesh.parent_element_ids_.
Size());
136 for (
auto x : new_parent_element_ids)
138 MFEM_ASSERT(std::find(submesh.parent_element_ids_.
begin(),
139 submesh.parent_element_ids_.
end(), x)
140 != submesh.parent_element_ids_.
end(),
141 x <<
" not found in submesh.parent_element_ids_");
143 for (
auto x : submesh.parent_element_ids_)
145 MFEM_ASSERT(std::find(new_parent_element_ids.
begin(),
146 new_parent_element_ids.
end(), x)
147 != new_parent_element_ids.
end(), x <<
" not found in new_parent_element_ids_");
150 submesh.parent_element_ids_ = new_parent_element_ids;
151 submesh.parent_to_submesh_element_ids_ = new_parent_to_submesh_element_ids;
void Reserve(int capacity)
Ensures that the allocated size is at least the given size.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
T * end()
STL-like end. Returns pointer after the last element of the array.
T * begin()
STL-like begin. Returns pointer to the first element of the array.
Array< int > GetFaceToBdrElMap() const
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
BlockArray< Element > elements
Array< int > leaf_elements
finest elements, in Mesh ordering (+ ghosts)
const real_t * CalcVertexPos(int node) const
void InitRootState(int root_count)
friend class ParNCSubMesh
void InitRootElements()
Count root elements and initialize root_state.
bool Iso
true if the mesh only contains isotropic refinements
bool Legacy
true if the mesh was loaded from the legacy v1.1 format
Array< real_t > coordinates
int MyRank
used in parallel, or when loading a parallel file in serial
int spaceDim
dimensions of the elements and the vertex coordinates
void RegisterFaces(int elem, int *fattr=NULL)
A parallel extension of the NCMesh class.
Array< int > parent_node_ids_
Array< int > parent_element_ids_
std::unordered_map< int, int > parent_to_submesh_node_ids_
Mapping from parent NCMesh node ids to submesh NCMesh node ids.
Subdomain representation of a topological parent in another ParMesh.
const ParMesh * GetParent() const
Get the parent ParMesh object.
From
Indicator from which part of the parent Mesh the SubMesh is created.
void ConstructFaceTree(NCSubMeshT &submesh, const Array< int > &attributes)
Construct a nonconformal mesh (serial or parallel) for a surface submesh, from an existing nonconform...
void ConstructVolumeTree(NCSubMeshT &submesh, const Array< int > &attributes)
Construct a nonconformal mesh (serial or parallel) for a volume submesh, from an existing nonconforma...
real_t p(const Vector &x, real_t t)