https://mooseframework.inl.gov
NodeSetsGeneratorBase.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "MeshGenerator.h"
13 
14 /*
15  * Base class for mesh generators that add nodesets to the mesh
16  */
18 {
19 public:
21 
23 
24 protected:
30  void setup(MeshBase & mesh);
31 
38  bool nodeOnMeshExteriorBoundary(const Node * node,
39  const std::vector<dof_id_type> & node_elems,
40  const MeshBase & mesh) const;
41 
48  bool nodeElementsInIncludedSubdomains(const std::vector<dof_id_type> node_elems,
49  const MeshBase & mesh) const;
50 
56  bool nodeInIncludedNodesets(const std::vector<BoundaryID> & node_nodesets) const;
57 
63  bool nodeInExcludedNodesets(const std::vector<BoundaryID> & node_nodesets) const;
64 
72  bool nodeSatisfiesRequirements(const Node * node,
73  const std::vector<BoundaryID> & node_nodesets,
74  const std::vector<dof_id_type> & node_elems,
75  const MeshBase & mesh) const;
76 
78  std::unique_ptr<MeshBase> & _input;
79 
81  std::vector<BoundaryName> _nodeset_names;
82 
84  const bool _replace;
85 
88 
91 
94 
96  std::vector<boundary_id_type> _included_nodeset_ids;
97 
99  std::vector<boundary_id_type> _excluded_nodeset_ids;
100 
102  std::vector<subdomain_id_type> _included_subdomain_ids;
103 
106 
108  // Build the node to element map, which is usually provided by a MooseMesh but here we have a
109  // MeshBase.
110  std::unordered_map<dof_id_type, std::vector<dof_id_type>> _node_to_elem_map;
111 };
const bool _check_excluded_nodesets
whether to check nodeset ids against the excluded nodeset list when adding nodes or not ...
const bool _check_included_subdomains
whether to check subdomain ids of the element that included this node
bool nodeSatisfiesRequirements(const Node *node, const std::vector< BoundaryID > &node_nodesets, const std::vector< dof_id_type > &node_elems, const MeshBase &mesh) const
Determines whether the given node satisfies the user-specified constraints.
MeshBase & mesh
const bool _check_included_nodesets
whether to check nodeset ids against the included nodeset list when adding nodes or not ...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
bool nodeInExcludedNodesets(const std::vector< BoundaryID > &node_nodesets) const
Determines whether the given node of an element belongs to any nodesets in the excluded_nodesets para...
std::vector< BoundaryName > _nodeset_names
The list of new nodeset names.
bool nodeInIncludedNodesets(const std::vector< BoundaryID > &node_nodesets) const
Determines whether the given node belongs to any nodesets in the included_nodesets parameter...
bool nodeOnMeshExteriorBoundary(const Node *node, const std::vector< dof_id_type > &node_elems, const MeshBase &mesh) const
Determines whether the node is on the exterior of the mesh.
std::vector< boundary_id_type > _excluded_nodeset_ids
A list of nodeset ids that the node must not be a part of, extracted from the excluded_nodesets param...
std::unique_ptr< MeshBase > & _input
the mesh to add the nodesets to
const bool _replace
Whether or not to remove the old nodesets (all of them, if any) when adding nodesets.
const bool _include_only_external_nodes
Whether to only include external node when considering nodes to add to the nodeset.
std::unordered_map< dof_id_type, std::vector< dof_id_type > > _node_to_elem_map
A map from nodes (ids) to local elements (ids) which comprise the node.
void setup(MeshBase &mesh)
This method prepares a few attributes which are commonly needed for nodeset generation such as a map ...
const InputParameters & parameters() const
Get the parameters of the object.
NodeSetsGeneratorBase(const InputParameters &parameters)
static InputParameters validParams()
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:32
std::vector< boundary_id_type > _included_nodeset_ids
A list of nodeset ids that the node has to be part of, extracted from the included_nodesets parameter...
bool nodeElementsInIncludedSubdomains(const std::vector< dof_id_type > node_elems, const MeshBase &mesh) const
Determines whether any neighbor element of the node has a subdomain id in the given subdomain_id_list...
std::vector< subdomain_id_type > _included_subdomain_ids
A list of included subdomain ids that the node has to be part of, extracted from the included_subdoma...