libMesh
|
This class implements a generalization of the MeshTools::build_nodes_to_elem_map() function, but rather than being a standalone function taking a std::unordered_map argument, we define a class with APIs for both building the underlying map data structure and querying its contents. More...
#include <sides_to_elem_map.h>
Classes | |
struct | HashFunction |
Public Types | |
typedef std::vector< const Elem * >::const_iterator | ElemIter |
Typedef for the iterator type returned by the SidesToeElemMap::get_connected_elems() function. More... | |
Public Member Functions | |
SidesToElemMap () | |
Default constructor/destructor. More... | |
~SidesToElemMap () | |
std::pair< ElemIter, ElemIter > | get_connected_elems (const Elem *elem, unsigned int side) const |
Return an iterator pair defining the range of Elems connected to "side" of "elem". More... | |
Static Public Member Functions | |
static SidesToElemMap | build (const MeshBase &mesh) |
Static build function. More... | |
Private Types | |
typedef std::vector< dof_id_type > | Key |
Convenient typedefs for working with std::unordered_map. More... | |
typedef std::vector< const Elem * > | Value |
Private Member Functions | |
void | get_sorted_vertex_ids (const Elem *elem, unsigned int side, std::vector< dof_id_type > &sorted_vertex_ids) const |
Construct a sorted list of vertex ids for the input (elem, side) pair. More... | |
Private Attributes | |
std::unordered_map< Key, Value, HashFunction, HashFunction > | _sides_to_elem_map |
Map from (sorted list of side vertex ids) -> (Elems touching that side) A "side" is uniquely defined by the sorted list of its vertex ids, so this is a good choice to use as a key. More... | |
This class implements a generalization of the MeshTools::build_nodes_to_elem_map() function, but rather than being a standalone function taking a std::unordered_map argument, we define a class with APIs for both building the underlying map data structure and querying its contents.
This way, we avoid issues with hash collisions resulting from the Elem::low_order_key() function (which could occur with as few as 100k sides when using a 32-bit dof_id_type) in addition to being able to control exactly how the user will interact with the class.
Definition at line 53 of file sides_to_elem_map.h.
typedef std::vector<const Elem *>::const_iterator libMesh::MeshTools::SidesToElemMap::ElemIter |
Typedef for the iterator type returned by the SidesToeElemMap::get_connected_elems() function.
Definition at line 73 of file sides_to_elem_map.h.
|
private |
Convenient typedefs for working with std::unordered_map.
Definition at line 90 of file sides_to_elem_map.h.
|
private |
Definition at line 91 of file sides_to_elem_map.h.
|
default |
Default constructor/destructor.
|
default |
|
static |
Static build function.
Most users will simply call this function to construct the SidesToElemMap object for their Mesh.
Definition at line 37 of file sides_to_elem_map.C.
References _sides_to_elem_map, get_sorted_vertex_ids(), libMesh::invalid_uint, and mesh.
Referenced by NonManifoldTestPartitioner::_do_partition(), libMesh::NonManifoldGhostingFunctor::mesh_reinit(), and NonManifoldGhostingFunctorTest::verify_send_list_entries_helper().
std::pair< SidesToElemMap::ElemIter, SidesToElemMap::ElemIter > libMesh::MeshTools::SidesToElemMap::get_connected_elems | ( | const Elem * | elem, |
unsigned int | side | ||
) | const |
Return an iterator pair defining the range of Elems connected to "side" of "elem".
The returned list of Elems will also include "elem" itself. Throws an error if the requested (elem, side) combination is not found in the map (this should not happen because every side in the map should be attached to at least one Elem).
Definition at line 86 of file sides_to_elem_map.C.
References _sides_to_elem_map, and get_sorted_vertex_ids().
Referenced by NonManifoldTestPartitioner::_do_partition(), libMesh::NonManifoldGhostingFunctor::operator()(), and NonManifoldGhostingFunctorTest::verify_send_list_entries_helper().
|
private |
Construct a sorted list of vertex ids for the input (elem, side) pair.
This is needed in a couple different places, so it makes sense to factor it out. The output array is passed as a reference to facilitate reuse over reallocation.
Definition at line 96 of file sides_to_elem_map.C.
References libMesh::Elem::is_vertex(), libMesh::Elem::node_id(), and libMesh::Elem::nodes_on_side().
Referenced by build(), and get_connected_elems().
|
private |
Map from (sorted list of side vertex ids) -> (Elems touching that side) A "side" is uniquely defined by the sorted list of its vertex ids, so this is a good choice to use as a key.
Definition at line 125 of file sides_to_elem_map.h.
Referenced by build(), and get_connected_elems().