12#ifndef MFEM_SUBMESH_UTILS
13#define MFEM_SUBMESH_UTILS
16#include <unordered_map>
34 std::unordered_map<int, int>
idx;
43 int Get(
int i,
bool &new_index);
67 bool from_boundary =
false);
111 auto parent = m.GetParent();
114 const T* next =
dynamic_cast<const T*
>(parent);
115 if (next ==
nullptr) {
return parent; }
116 else { parent = next->GetParent(); }
132template <
typename SubMeshT>
134 const std::unordered_map<int,int> &lface_to_boundary_attribute = {});
145template<
typename NCSubMeshT>
157template <
typename NCSubMeshT>
172 for (
int a = 0;
a < attributes.
Size();
a++)
174 if (el.GetAttribute() == attributes[
a])
207template <
typename T1,
typename T2,
typename T3>
226template <
typename T1,
typename T2,
typename T3>
251 for (
int i = 0; i < indices.Size(); i++)
254 while (i != indices[current])
256 auto next = indices[current];
257 std::swap(t1[current], t1[next]);
258 std::swap(t2[current], t2[next]);
259 std::swap(t3[current], t3[next]);
260 indices[current] = current;
263 indices[current] = current;
int Size() const
Return the logical size of the array.
Abstract data type element.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
From
Indicator from which part of the parent Mesh the SubMesh is created.
std::tuple< Array< int >, Array< int > > AddElementsToMesh(const Mesh &parent, Mesh &mesh, const Array< int > &attributes, bool from_boundary)
Given a Mesh parent and another Mesh mesh using the list of attributes in attributes,...
void ConstructFaceTree(NCSubMeshT &submesh, const Array< int > &attributes)
Construct a nonconformal mesh (serial or parallel) for a surface submesh, from an existing nonconform...
void BuildVdofToVdofMap(const FiniteElementSpace &subfes, const FiniteElementSpace &parentfes, const SubMesh::From &from, const Array< int > &parent_element_ids, Array< int > &vdof_to_vdof_map)
Build the vdof to vdof mapping between two FiniteElementSpace objects.
bool HasAttribute(const T &el, const Array< int > &attributes)
Helper for checking if an object's attributes match a list.
bool ElementHasAttribute(const ElementT &el, const Array< int > &attributes)
void Permute(const Array< int > &indices, T1 &t1, T2 &t2, T3 &t3)
Apply permutation to a container type.
void ConstructVolumeTree(NCSubMeshT &submesh, const Array< int > &attributes)
Construct a nonconformal mesh (serial or parallel) for a volume submesh, from an existing nonconforma...
auto GetRootParent(const T &m) -> decltype(std::declval< T >().GetParent())
Identify the root parent of a given SubMesh.
Array< int > BuildFaceMap(const Mesh &pm, const Mesh &sm, const Array< int > &parent_element_ids)
Given two meshes that have a parent to SubMesh relationship create a face map, using a SubMesh to par...
void AddBoundaryElements(SubMeshT &mesh, const std::unordered_map< int, int > &lface_to_boundary_attribute)
Add boundary elements to the SubMesh.
Convenience object to create unique indices.
std::unordered_map< int, int > idx
int Get(int i, bool &new_index)
Returns the unique index from an index set.