16 #include "libmesh/fe_base.h" 17 #include "libmesh/mesh_generation.h" 18 #include "libmesh/mesh.h" 19 #include "libmesh/string_to_enum.h" 20 #include "libmesh/quadrature_gauss.h" 21 #include "libmesh/point_locator_base.h" 22 #include "libmesh/distributed_mesh.h" 23 #include "libmesh/elem.h" 29 AllSideSetsByNormalsGenerator,
54 _boundary_to_normal_map(
59 std::unique_ptr<MeshBase>
62 std::unique_ptr<MeshBase>
mesh = std::move(
_input);
63 if (!
mesh->is_replicated())
64 mooseError(
"SideSetsFromAllNormalsGenerator is not implemented for distributed meshes");
74 for (
const auto & elem :
mesh->element_ptr_range())
75 for (
const auto side :
make_range(elem->n_sides()))
77 const std::vector<Point> & normals =
_fe_face->get_normals();
82 const std::map<BoundaryID, RealVectorValue>::value_type * item =
nullptr;
91 flood(elem, normals[0], item->first, *
mesh);
103 mesh->unset_is_prepared();
110 std::set<boundary_id_type>::iterator it;
std::map< BoundaryID, RealVectorValue > & _boundary_to_normal_map
Mesh meta data for holding the map from boundary IDs to the normals of the corresponding boundaries...
SideSetsFromAllNormalsGenerator(const InputParameters ¶meters)
std::unique_ptr< MeshBase > & _input
the mesh to add the sidesets to
std::set< boundary_id_type > _mesh_boundary_ids
A pointer to the Mesh's boundary set, this datastructure will be modified through this modifier...
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
boundary_id_type getNextBoundaryID()
static InputParameters validParams()
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
boundary_id_type BoundaryID
void flood(const Elem *elem, const Point &normal, const boundary_id_type &side_id, MeshBase &mesh)
This method implements a recursive flood routine to paint a sideset of mesh to neighboring faces give...
void finalize()
This method finalizes the object, setting names back in the boundary_info object and releasing memory...
static InputParameters validParams()
registerMooseObjectRenamed("MooseApp", AllSideSetsByNormalsGenerator, "06/30/2027 24:00", SideSetsFromAllNormalsGenerator)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
registerMooseObject("MooseApp", SideSetsFromAllNormalsGenerator)
std::map< boundary_id_type, std::set< const Elem * > > _visited
std::unique_ptr< libMesh::FEBase > _fe_face
void setup(MeshBase &mesh)
This method is used to construct the FE object so we can compute normals of faces.
bool normalsWithinTol(const Point &normal_1, const Point &normal_2, const Real tol)
Determines whether two normal vectors are within normal_tol of each other.
This class will add sidesets to the entire mesh based on unique normals.