21 "Owns a saved surface (boundary) mesh and the SurfaceElement wrappers built from it, "
22 "for use by point-containment and distance user objects.");
26 "The name of the surface mesh saved via the MeshGenerator's `save_with_name` parameter.");
29 "check_watertightness",
31 "Check if the mesh is watertight. If false, the mesh may not be suitable for In-Out tests.");
38 _bnd_mesh_name(getParam<
std::string>(
"surface_mesh")),
39 _check_watertightness(getParam<bool>(
"check_watertightness")),
40 _dim_embedding_mesh(_fe_problem.
mesh().dimension() )
54 _mesh->prepare_for_use();
56 if (!
_mesh->is_replicated())
59 "': the saved surface mesh is distributed. A serialized/replicated surface mesh is "
60 "required for point-containment queries.");
62 const auto expected_dim_embedding_mesh =
_mesh->mesh_dimension() + 1;
66 "': the background mesh dimension (",
68 ") does not match the surface mesh dimension + 1 (",
69 expected_dim_embedding_mesh,
75 mooseInfo(
"The mesh is watertight. It is suitable for In-Out tests.");
77 mooseInfo(
"The mesh is not watertight. It may not be suitable for In-Out tests.");
90 for (
const auto * elem :
_mesh->active_element_ptr_range())
91 for (
const auto s : make_range(elem->n_sides()))
92 if (!elem->neighbor_ptr(s))
101 mooseAssert(
_mesh,
"BoundaryMeshBuilder mesh is not available until initialSetup().");
114 mooseError(
"BoundaryMeshBuilder '",
name(),
"': buildDefaultSet() did not initialize _set.");
registerMooseObject("MooseApp", BoundaryMeshBuilder)
void mooseInfo(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Owns a saved boundary (surface) mesh and the SurfaceElementSet wrapping it.
BoundaryMeshBuilder(const InputParameters ¶meters)
static InputParameters validParams()
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
virtual void buildDefaultSet() const
Build the default (whole-mesh) SurfaceElementSet.
MeshBase & mesh() const
The owned boundary mesh.
std::unique_ptr< MeshBase > _mesh
The owned boundary mesh, kept alive so SurfaceElement pointers stay valid.
const unsigned int _dim_embedding_mesh
The dimension of the embedding (background) mesh.
const bool _check_watertightness
Whether to check watertightness of the mesh (informational only).
const SurfaceElementSet & surfaceElementSet() const
The whole-mesh SurfaceElementSet, built lazily on first call.
const std::string _bnd_mesh_name
The name of a mesh saved via a MeshGenerator's save_mesh_as parameter.
std::unique_ptr< SurfaceElementSet > _set
The whole-mesh SurfaceElementSet, lazily cached on first use.
bool checkWatertightness() const
Whether the boundary mesh is "closed" – i.e.
static InputParameters validParams()
std::unique_ptr< libMesh::MeshBase > getSavedMesh(const std::string &name)
Get the saved mesh by name.
MeshGeneratorSystem & getMeshGeneratorSystem()
Gets the system that manages the MeshGenerators.
const std::string & name() const
Get the name of the class.
MooseApp & _app
The MOOSE application this is associated with.
A group of surface elements wrapped for point-containment / distance queries.
static SurfaceElementSet fromMesh(const MeshBase &mesh)
Build a set from every active element of a surface mesh.