12 #include "libmesh/mesh_base.h" 19 "Snap refined nodes on a given boundary or block to a given geometry.");
20 params.
addParam<std::vector<BoundaryName>>(
21 "boundary", {},
"List of boundaries whose nodes are snapped to a given geometry");
22 params.
addParam<std::vector<SubdomainName>>(
23 "block", {},
"List of blocks whose nodes are snapped to a given geometry");
29 _mesh(_subproblem.
mesh()),
30 _boundary_ids(_mesh.
getBoundaryIDs(getParam<
std::vector<BoundaryName>>(
"boundary"))),
59 for (
auto & node_id : node_ids)
61 auto & node =
mesh.node_ref(node_id);
68 MeshBase::node_iterator node =
mesh.active_nodes_begin();
69 MeshBase::node_iterator node_end =
mesh.active_nodes_end();
70 for (; node != node_end; ++node)
75 if (node_blocks.count(subdomain_id))
GeometryBase(const InputParameters ¶meters)
virtual void initialize() final
Called before execute() is ever called so that data can be cleared.
virtual void execute() final
Execute method.
const std::vector< BoundaryID > _boundary_ids
List of boundaries (or node sets) that will be snapped to a geometry.
static InputParameters validParams()
const std::set< SubdomainID > & getNodeBlockIds(const Node &node) const
Return list of blocks to which the given node belongs.
std::vector< subdomain_id_type > getSubdomainIDs(const libMesh::MeshBase &mesh, const std::vector< SubdomainName > &subdomain_name)
Get the associated subdomainIDs for the subdomain names that are passed in.
static InputParameters validParams()
const std::vector< SubdomainID > _subdomain_ids
List of blocks (likely lower D blocks) that will be snapped to a geometry.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
const std::vector< dof_id_type > & getNodeList(boundary_id_type nodeset_id) const
Return a writable reference to a vector of node IDs that belong to nodeset_id.
virtual void finalize() final
Finalize.
std::vector< BoundaryID > getBoundaryIDs(const libMesh::MeshBase &mesh, const std::vector< BoundaryName > &boundary_name, bool generate_unknown, const std::set< BoundaryID > &mesh_boundary_ids)
Gets the boundary IDs with their names.
virtual void meshChanged() final
Called on this object when the mesh changes.
MooseMesh & _mesh
Reference to the current simulation mesh.
virtual void snapNode(Node &node)=0
Override this method in derived classes to implement a specific geometry.