5#include "libmesh/elem.h"
6#include "libmesh/boundary_info.h"
7#include "libmesh/elem_side_builder.h"
15 _crack_boundary_lower(crack_boundary_lower),
16 _crack_boundary_upper(crack_boundary_upper),
36 std::map<std::pair<const Elem *, unsigned char>,
Point> lower;
37 std::map<std::pair<const Elem *, unsigned char>,
Point> upper;
40 std::unique_ptr<const Elem> side_elem;
42 for (
const auto & elem :
_mesh.active_element_ptr_range())
43 for (
auto side : elem->side_index_range())
44 if (elem->neighbor_ptr(side) ==
nullptr)
48 elem->build_side_ptr(side_elem, side);
50 lower[std::make_pair(elem, side)] = side_elem->vertex_average();
55 elem->build_side_ptr(side_elem, side);
57 upper[std::make_pair(elem, side)] = side_elem->vertex_average();
78 for (
const auto & [lower_key, lower_val] : lower)
81 Real min_distance = std::numeric_limits<Real>::max();
83 for (
const auto & [upper_key, upper_val] : upper)
95 const Elem * elem = lower_key.first;
113 for (
const auto & upper_pr : upper)
115 const Elem * neighbor = upper_pr.first.first;
118 ElementMap::const_iterator utl_it =
126void AugmentSparsityOnInterface::operator()
136 for (
const auto & elem :
as_range(range_begin, range_end))
138 if (elem->processor_id() != p)
139 coupled_elements.emplace(elem, null_mat);
141 for (
auto side : elem->side_index_range())
142 if (elem->neighbor_ptr(side) ==
nullptr)
144 ElementSideMap::const_iterator ltu_it =
145 _lower_to_upper.find(std::make_pair(elem, side));
146 if (ltu_it != _lower_to_upper.end())
148 const Elem * neighbor = ltu_it->second;
150 coupled_elements.emplace(neighbor, null_mat);
154 ElementMap::const_iterator utl_it =
155 _upper_to_lower.find(elem);
156 if (utl_it != _upper_to_lower.end())
158 const Elem * neighbor = utl_it->second;
160 coupled_elements.emplace(neighbor, null_mat);
std::map< std::pair< const Elem *, unsigned char >, const Elem * > ElementSideMap
ElementSideMap _lower_to_upper
A map from (lower element ID, side ID) to matching upper element ID.
const ElementSideMap & get_lower_to_upper() const
boundary_id_type _crack_boundary_upper
boundary_id_type _crack_boundary_lower
Boundary IDs for the lower and upper faces of the "crack" in the mesh.
bool _initialized
Make sure we've been initialized before use.
ElementMap _upper_to_lower
The inverse (ignoring sides) of the above map.
AugmentSparsityOnInterface(MeshBase &mesh, boundary_id_type crack_boundary_lower, boundary_id_type crack_boundary_upper)
Constructor.
MeshBase & _mesh
The Mesh we're calculating on.
virtual void mesh_reinit() override
Rebuild the cached _lower_to_upper map whenever our Mesh has changed.
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
This class defines a coupling matrix.
processor_id_type processor_id() const
This is the base class from which all geometric element types are derived.
std::map< const Elem *, const CouplingMatrix *, CompareDofObjectsByPIDAndThenID > map_type
What elements do we care about and what variables do we care about on each element?
This is the MeshBase class.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
processor_id_type processor_id() const
A Point defines a location in LIBMESH_DIM dimensional Real space.
The libMesh namespace provides an interface to certain functionality in the library.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
uint8_t processor_id_type
The definition of the const_element_iterator struct.
Real distance(const Point &p)