Go to the documentation of this file.
15 #include "libmesh/fe_base.h"
16 #include "libmesh/mesh_generation.h"
17 #include "libmesh/mesh.h"
18 #include "libmesh/string_to_enum.h"
19 #include "libmesh/quadrature_gauss.h"
20 #include "libmesh/point_locator_base.h"
21 #include "libmesh/elem.h"
50 mooseError(
"_mesh_ptr must be initialized before calling AddAllSideSetsByNormals::modify()!");
59 using map_type = std::map<BoundaryID, RealVectorValue>;
60 std::unique_ptr<map_type> boundary_map = libmesh_make_unique<map_type>();
67 for (
unsigned int side = 0; side < elem->n_sides(); ++side)
69 if (elem->neighbor_ptr(side))
73 const std::vector<Point> & normals =
_fe_face->get_normals();
77 const map_type::value_type * item =
nullptr;
78 for (
const auto & id_pair : *boundary_map)
79 if (
std::abs(1.0 - id_pair.second * normals[0]) < 1e-5)
86 flood(elem, normals[0], item->first);
90 (*boundary_map)[id] = normals[0];
91 flood(elem, normals[0],
id);
106 std::set<BoundaryID>::iterator it;
void setBoundaryToNormalMap(std::unique_ptr< std::map< BoundaryID, RealVectorValue >> boundary_map)
Sets the mapping between BoundaryID and normal vector Is called by AddAllSideSetsByNormals.
void finalize()
This method finalizes the object, setting names back in the boundary_info object and releasing memory...
This class will add sidesets to the entire mesh based on unique normals.
This class will add sidesets to the entire mesh based on unique normals.
void mooseError(Args &&... args) const
BoundaryID getNextBoundaryID()
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
void setup()
This method is used to construct the FE object so we can compute normals of faces.
std::set< BoundaryID > _mesh_boundary_ids
A pointer to the Mesh's boundary set, this datastructure will be modified through this modifier.
std::map< BoundaryID, std::set< const Elem * > > _visited
InputParameters validParams< AddSideSetsBase >()
AddAllSideSetsByNormals(const InputParameters ¶meters)
MooseMesh * _mesh_ptr
Pointer to the mesh.
void flood(const Elem *elem, Point normal, BoundaryID side_id)
This method implements a recursive flood routine to paint a sideset of mesh to neighboring faces give...
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
boundary_id_type BoundaryID
const std::set< BoundaryID > & meshBoundaryIds() const
Returns a read-only reference to the set of boundary IDs currently present in the Mesh.
InputParameters validParams< AddAllSideSetsByNormals >()
virtual void modify() override
Pure virtual modify function MUST be overridden by children classes.
std::unique_ptr< FEBase > _fe_face
registerMooseObjectReplaced("MooseApp", AddAllSideSetsByNormals, "11/30/2019 00:00", AllSideSetsByNormalsGenerator)
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
void setMeshBoundaryIDs(std::set< BoundaryID > boundary_IDs)
Sets the set of BoundaryIDs Is called by AddAllSideSetsByNormals.