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 
57  bool nodeElementsInExcludedSubdomains(const std::vector<dof_id_type> node_elems,
58  const MeshBase & mesh) const;
59 
65  bool nodeInIncludedNodesets(const std::vector<BoundaryID> & node_nodesets) const;
66 
72  bool nodeInExcludedNodesets(const std::vector<BoundaryID> & node_nodesets) const;
73 
81  bool nodeSatisfiesRequirements(const Node * node,
82  const std::vector<BoundaryID> & node_nodesets,
83  const std::vector<dof_id_type> & node_elems,
84  const MeshBase & mesh) const;
85 
87  std::unique_ptr<MeshBase> & _input;
88 
90  std::vector<BoundaryName> _nodeset_names;
91 
93  const bool _replace;
94 
97 
100 
103 
106 
108  std::vector<boundary_id_type> _included_nodeset_ids;
109 
111  std::vector<boundary_id_type> _excluded_nodeset_ids;
112 
114  std::vector<subdomain_id_type> _included_subdomain_ids;
115 
117  std::vector<subdomain_id_type> _excluded_subdomain_ids;
118 
121 
123  // Build the node to element map, which is usually provided by a MooseMesh but here we have a
124  // MeshBase.
125  std::unordered_map<dof_id_type, std::vector<dof_id_type>> _node_to_elem_map;
126 };
const bool _check_excluded_nodesets
whether to check nodeset ids against the excluded nodeset list when adding nodes or not ...
const bool _check_excluded_subdomains
whether to check subdomain ids of the element that excluded this node
const bool _check_included_subdomains
whether to check subdomain ids of the element that included this node
std::vector< subdomain_id_type > _excluded_subdomain_ids
A list of included subdomain ids that the node must not be part of, extracted from the excluded_subdo...
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.
bool nodeElementsInExcludedSubdomains(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 excluded_subdomai...
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 included_subdomai...
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...