MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::SubMeshUtils Namespace Reference

Classes

struct  UniqueIndexGenerator
 Convenience object to create unique indices. More...
 

Functions

template<typename ElementT >
bool ElementHasAttribute (const ElementT &el, const Array< int > &attributes)
 
std::tuple< Array< int >, Array< int > > AddElementsToMesh (const Mesh &parent, Mesh &mesh, const Array< int > &attributes, bool from_boundary=false)
 Given a Mesh parent and another Mesh mesh using the list of attributes in attributes, this function adds matching elements with those attributes from parent to mesh.
 
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.
 
Array< int > BuildFaceMap (const Mesh &parent, const Mesh &mesh, const Array< int > &parent_element_ids)
 Given two meshes that have a parent to SubMesh relationship create a face map, using a SubMesh to parent Mesh element id map.
 
template<typename SubMeshT >
void AddBoundaryElements (SubMeshT &mesh, const std::unordered_map< int, int > &lface_to_boundary_attribute={})
 Add boundary elements to the SubMesh.
 
template void AddBoundaryElements (SubMesh &mesh, const std::unordered_map< int, int > &)
 
template void AddBoundaryElements (ParSubMesh &mesh, const std::unordered_map< int, int > &)
 
template<typename NCSubMeshT >
void ConstructFaceTree (NCSubMeshT &submesh, const Array< int > &attributes)
 Construct a nonconformal mesh (serial or parallel) for a surface submesh, from an existing nonconformal volume mesh (serial or parallel).
 
template void ConstructFaceTree (NCSubMesh &submesh, const Array< int > &attributes)
 
template void ConstructFaceTree (ParNCSubMesh &submesh, const Array< int > &attributes)
 
template<typename NCSubMeshT >
void ConstructVolumeTree (NCSubMeshT &submesh, const Array< int > &attributes)
 Construct a nonconformal mesh (serial or parallel) for a volume submesh, from an existing nonconformal volume mesh (serial or parallel).
 
template void ConstructVolumeTree (NCSubMesh &submesh, const Array< int > &attributes)
 
template void ConstructVolumeTree (ParNCSubMesh &submesh, const Array< int > &attributes)
 
template<class T >
auto GetRootParent (const T &m) -> decltype(std::declval< T >().GetParent())
 Identify the root parent of a given SubMesh.
 
template<typename T >
bool HasAttribute (const T &el, const Array< int > &attributes)
 Helper for checking if an object's attributes match a list.
 
MFEM_DEPRECATED bool ElementHasAttribute (const Element &el, const Array< int > &attributes)
 Forwarding dispatch to HasAttribute for backwards compatibility.
 
template<typename T1 , typename T2 , typename T3 >
void Permute (const Array< int > &indices, T1 &t1, T2 &t2, T3 &t3)
 Apply permutation to a container type.
 
template<typename T1 , typename T2 , typename T3 >
void Permute (Array< int > &&indices, T1 &t1, T2 &t2, T3 &t3)
 Apply permutation to a container type.
 

Function Documentation

◆ AddBoundaryElements() [1/3]

template void mfem::SubMeshUtils::AddBoundaryElements ( ParSubMesh & mesh,
const std::unordered_map< int, int > &  )

◆ AddBoundaryElements() [2/3]

template void mfem::SubMeshUtils::AddBoundaryElements ( SubMesh & mesh,
const std::unordered_map< int, int > &  )

◆ AddBoundaryElements() [3/3]

template<typename SubMeshT >
void mfem::SubMeshUtils::AddBoundaryElements ( SubMeshT & mesh,
const std::unordered_map< int, int > & lface_to_boundary_attribute = {} )

Add boundary elements to the SubMesh.

An attempt to call this function for anything other than SubMesh or ParSubMesh will result in a linker error as the template is only explicitly instantiated for those types.

Parameters
meshThe SubMesh to add boundary elements to.
lface_to_boundary_attributeMap from local faces in the submesh to boundary attributes. Only necessary for interior boundary attributes of volume submeshes, where the face owning the attribute might be on a neighboring rank.
Template Parameters
SubMeshTThe SubMesh type, options SubMesh and ParSubMesh.

Definition at line 257 of file submesh_utils.cpp.

◆ AddElementsToMesh()

std::tuple< Array< int >, Array< int > > mfem::SubMeshUtils::AddElementsToMesh ( const Mesh & parent,
Mesh & mesh,
const Array< int > & attributes,
bool from_boundary = false )

Given a Mesh parent and another Mesh mesh using the list of attributes in attributes, this function adds matching elements with those attributes from parent to mesh.

It also returns a tuple containing first the parent vertex ids (mapping from mesh vertex ids (index of the array), to the parent vertex ids) and second the parent element ids (mapping from submesh element ids (index of the array), to the parent element ids)

Note
Works with ParMesh.
Parameters
parentThe Mesh where the elements are "extracted" from.
meshThe Mesh where the elements are extracted to.
attributesThe attributes of the desired elements.
from_boundaryIndication if the desired elements come from the boundary of the parent.

Definition at line 54 of file submesh_utils.cpp.

◆ BuildFaceMap()

Array< int > mfem::SubMeshUtils::BuildFaceMap ( const Mesh & parent,
const Mesh & mesh,
const Array< int > & parent_element_ids )

Given two meshes that have a parent to SubMesh relationship create a face map, using a SubMesh to parent Mesh element id map.

Parameters
parentThe parent Mesh.
meshThe Mesh to match its parents faces.
parent_element_idsThe Mesh element to parent element id map.

Definition at line 219 of file submesh_utils.cpp.

◆ BuildVdofToVdofMap()

void mfem::SubMeshUtils::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.

Given two FiniteElementSpace objects and the map parent_element_ids, which maps the element ids of the subfes to elements on the parentfes (or boundary elements depending on the type of transfer, volume or surface), create a vdof to vdof map.

This map is entirely serial and has no knowledge about parallel groups.

Parameters
[in]subfes
[in]parentfes
[in]from
[in]parent_element_ids
[out]vdof_to_vdof_map

Definition at line 93 of file submesh_utils.cpp.

◆ ConstructFaceTree() [1/3]

template void mfem::SubMeshUtils::ConstructFaceTree ( NCSubMesh & submesh,
const Array< int > & attributes )

◆ ConstructFaceTree() [2/3]

template<typename NCSubMeshT >
void mfem::SubMeshUtils::ConstructFaceTree ( NCSubMeshT & submesh,
const Array< int > & attributes )

Construct a nonconformal mesh (serial or parallel) for a surface submesh, from an existing nonconformal volume mesh (serial or parallel).

This function is only instantiated for NCSubMesh and ParNCSubMesh Attempting to use it with other classes will result in a linker error.

Template Parameters
NCSubMeshTThe NCSubMesh type
Parameters
[out]submeshThe surface submesh to be filled.
attributesThe set of attributes defining the submesh.

Definition at line 436 of file submesh_utils.cpp.

◆ ConstructFaceTree() [3/3]

template void mfem::SubMeshUtils::ConstructFaceTree ( ParNCSubMesh & submesh,
const Array< int > & attributes )

◆ ConstructVolumeTree() [1/3]

template void mfem::SubMeshUtils::ConstructVolumeTree ( NCSubMesh & submesh,
const Array< int > & attributes )

◆ ConstructVolumeTree() [2/3]

template<typename NCSubMeshT >
void mfem::SubMeshUtils::ConstructVolumeTree ( NCSubMeshT & submesh,
const Array< int > & attributes )

Construct a nonconformal mesh (serial or parallel) for a volume submesh, from an existing nonconformal volume mesh (serial or parallel).

This function is only instantiated for NCSubMesh and ParNCSubMesh Attempting to use it with other classes will result in a linker error.

Template Parameters
NCSubMeshTThe NCSubMesh type
Parameters
[out]submeshThe volume submesh to be filled from parent.
attributesThe set of attributes defining the submesh.

Definition at line 756 of file submesh_utils.cpp.

◆ ConstructVolumeTree() [3/3]

template void mfem::SubMeshUtils::ConstructVolumeTree ( ParNCSubMesh & submesh,
const Array< int > & attributes )

◆ ElementHasAttribute() [1/2]

MFEM_DEPRECATED bool mfem::SubMeshUtils::ElementHasAttribute ( const Element & el,
const Array< int > & attributes )
inline

Forwarding dispatch to HasAttribute for backwards compatibility.

Parameters
elInstance of T, requires method GetAttribute()
attributesSet of attributes to match against
Returns
true The attribute of el is contained within attributes
false

Definition at line 190 of file submesh_utils.hpp.

◆ ElementHasAttribute() [2/2]

template<typename ElementT >
bool mfem::SubMeshUtils::ElementHasAttribute ( const ElementT & el,
const Array< int > & attributes )

Definition at line 41 of file submesh_utils.cpp.

◆ GetRootParent()

template<class T >
auto mfem::SubMeshUtils::GetRootParent ( const T & m) -> decltype(std::declval<T>().GetParent())

Identify the root parent of a given SubMesh.

Template Parameters
TThe type of the input object which has to fulfill the SubMesh::GetParent() interface.

Definition at line 109 of file submesh_utils.hpp.

◆ HasAttribute()

template<typename T >
bool mfem::SubMeshUtils::HasAttribute ( const T & el,
const Array< int > & attributes )

Helper for checking if an object's attributes match a list.

Template Parameters
TObject Type
Parameters
elInstance of T, requires method GetAttribute()
attributesSet of attributes to match against
Returns
true The attribute of el is contained within attributes
false

Definition at line 170 of file submesh_utils.hpp.

◆ Permute() [1/2]

template<typename T1 , typename T2 , typename T3 >
void mfem::SubMeshUtils::Permute ( Array< int > && indices,
T1 & t1,
T2 & t2,
T3 & t3 )

Apply permutation to a container type.

Sorts the indices variable in the process, thereby destroying the permutation.

Template Parameters
T1Container type 1
T2Container type 2
T3Container type 3
Parameters
indicesSet of indices that define the permutation
t1First collection to be permuted
t2Second collection to be permuted
t3Third collection to be permuted

Definition at line 227 of file submesh_utils.hpp.

◆ Permute() [2/2]

template<typename T1 , typename T2 , typename T3 >
void mfem::SubMeshUtils::Permute ( const Array< int > & indices,
T1 & t1,
T2 & t2,
T3 & t3 )

Apply permutation to a container type.

Template Parameters
T1Container type 1
T2Container type 2
T3Container type 3
Parameters
indicesSet of indices that define the permutation
t1First collection to be permuted
t2Second collection to be permuted
t3Third collection to be permuted

Definition at line 208 of file submesh_utils.hpp.