15#include "libmesh/string_to_enum.h"
22 const auto n =
mesh.n_active_elem();
26 for (
const auto * elem :
mesh.active_element_ptr_range())
40 for (
const auto * elem : elems)
49 mooseAssert(elem,
"Element must not be null");
54 mooseError(
"SurfaceElementSet: mixed element types are not supported (found ",
60 std::unique_ptr<SurfaceElement> surface_elem;
61 if (elem->type() == EDGE2)
62 surface_elem = std::make_unique<SurfaceEdge2>(elem);
63 else if (elem->type() == TRI3)
64 surface_elem = std::make_unique<SurfaceTri3>(elem);
66 mooseError(
"SurfaceElementSet: unsupported element type ",
68 ". Only EDGE2 (2D) and TRI3 (3D) surface elements are supported.");
72 const auto bbox = elem->loose_bounding_box();
78 _centroids.emplace_back(elem->vertex_average());
79 _elements.emplace_back(std::move(surface_elem));
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
A group of surface elements wrapped for point-containment / distance queries.
void addElement(const Elem *elem)
Validate, wrap, and append a single element, growing centroids and the AABB.
std::vector< std::unique_ptr< SurfaceElement > > _elements
static SurfaceElementSet fromElements(const std::vector< const Elem * > &elems)
Build a set from a caller-provided subset of surface elements.
static SurfaceElementSet fromMesh(const MeshBase &mesh)
Build a set from every active element of a surface mesh.
libMesh::BoundingBox _bounding_box
std::vector< Point > _centroids
void union_with(const Point &p)
std::string enum_to_string(const T e)