https://mooseframework.inl.gov
RevolveGenerator.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
12 
18 {
19 public:
21 
23 
24  std::unique_ptr<MeshBase> generate() override;
25 
26 protected:
28  std::unique_ptr<MeshBase> & _input;
29 
31  const Point & _axis_point;
32 
34  const Point & _axis_direction;
35 
37  const std::vector<Real> _revolving_angles;
38 
40  const std::vector<std::vector<subdomain_id_type>> & _subdomain_swaps;
41 
43  const std::vector<std::vector<boundary_id_type>> & _boundary_swaps;
44 
46  const std::vector<std::string> & _elem_integer_names_to_swap;
47  std::vector<unsigned int> _elem_integer_indices_to_swap;
48 
50  const std::vector<std::vector<std::vector<dof_id_type>>> & _elem_integers_swaps;
51 
53  const bool & _clockwise;
54 
56  const std::vector<unsigned int> & _nums_azimuthal_intervals;
57 
59  const bool _preserve_volumes;
60 
63 
66 
69 
71  std::vector<std::unordered_map<subdomain_id_type, subdomain_id_type>> _subdomain_swap_pairs;
72 
74  std::vector<std::unordered_map<boundary_id_type, boundary_id_type>> _boundary_swap_pairs;
75 
77  std::vector<std::unordered_map<dof_id_type, dof_id_type>> _elem_integers_swap_pairs;
78 
81 
83  std::vector<Real> _unit_angles;
84 
87 
90 
99  std::pair<Real, Point> getRotationCenterAndRadius(const Point & p_ext,
100  const Point & p_axis,
101  const Point & dir_axis) const;
102 
112  std::vector<Point>
113  rotationVectors(const Point & p_axis, const Point & dir_axis, const Point & p_input) const;
114 
122  std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>>
123  onAxisNodesIdentifier(const Elem & elem, const std::vector<dof_id_type> & nodes_on_axis) const;
124 
129  void nodeModification(Node & node);
130 
145  void createQUADfromEDGE(const ElemType quad_elem_type,
146  const Elem * elem,
147  const std::unique_ptr<MeshBase> & mesh,
148  std::unique_ptr<Elem> & new_elem,
149  const int current_layer,
150  const unsigned int orig_nodes,
151  const unsigned int total_num_azimuthal_intervals,
152  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
153  bool & is_flipped) const;
154 
172  void createTRIfromEDGE(
173  const std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>> & nodes_cates,
174  const ElemType tri_elem_type,
175  const Elem * elem,
176  const std::unique_ptr<MeshBase> & mesh,
177  std::unique_ptr<Elem> & new_elem,
178  const int current_layer,
179  const unsigned int orig_nodes,
180  const unsigned int total_num_azimuthal_intervals,
181  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
182  dof_id_type & axis_node_case,
183  bool & is_flipped) const;
184 
199  void createPRISMfromTRI(const ElemType prism_elem_type,
200  const Elem * elem,
201  const std::unique_ptr<MeshBase> & mesh,
202  std::unique_ptr<Elem> & new_elem,
203  const int current_layer,
204  const unsigned int orig_nodes,
205  const unsigned int total_num_azimuthal_intervals,
206  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
207  bool & is_flipped) const;
208 
227  const std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>> & nodes_cates,
228  const ElemType pyramid_elem_type,
229  const Elem * elem,
230  const std::unique_ptr<MeshBase> & mesh,
231  std::unique_ptr<Elem> & new_elem,
232  const int current_layer,
233  const unsigned int orig_nodes,
234  const unsigned int total_num_azimuthal_intervals,
235  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
236  dof_id_type & axis_node_case,
237  bool & is_flipped) const;
238 
256  void createTETfromTRI(
257  const std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>> & nodes_cates,
258  const ElemType tet_elem_type,
259  const Elem * elem,
260  const std::unique_ptr<MeshBase> & mesh,
261  std::unique_ptr<Elem> & new_elem,
262  const int current_layer,
263  const unsigned int orig_nodes,
264  const unsigned int total_num_azimuthal_intervals,
265  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
266  dof_id_type & axis_node_case,
267  bool & is_flipped) const;
268 
283  void createHEXfromQUAD(const ElemType hex_elem_type,
284  const Elem * elem,
285  const std::unique_ptr<MeshBase> & mesh,
286  std::unique_ptr<Elem> & new_elem,
287  const int current_layer,
288  const unsigned int orig_nodes,
289  const unsigned int total_num_azimuthal_intervals,
290  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
291  bool & is_flipped) const;
292 
310  void createPRISMfromQUAD(
311  const std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>> & nodes_cates,
312  const ElemType prism_elem_type,
313  const Elem * elem,
314  const std::unique_ptr<MeshBase> & mesh,
315  std::unique_ptr<Elem> & new_elem,
316  const int current_layer,
317  const unsigned int orig_nodes,
318  const unsigned int total_num_azimuthal_intervals,
319  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
320  dof_id_type & axis_node_case,
321  bool & is_flipped) const;
322 
346  const std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>> & nodes_cates,
347  const ElemType pyramid_elem_type,
348  const ElemType prism_elem_type,
349  const Elem * elem,
350  const std::unique_ptr<MeshBase> & mesh,
351  std::unique_ptr<Elem> & new_elem,
352  std::unique_ptr<Elem> & new_elem_1,
353  const int current_layer,
354  const unsigned int orig_nodes,
355  const unsigned int total_num_azimuthal_intervals,
356  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
357  dof_id_type & axis_node_case,
358  bool & is_flipped,
359  bool & is_flipped_additional) const;
360 };
void createPRISMfromQUAD(const std::pair< std::vector< dof_id_type >, std::vector< dof_id_type >> &nodes_cates, const ElemType prism_elem_type, const Elem *elem, const std::unique_ptr< MeshBase > &mesh, std::unique_ptr< Elem > &new_elem, const int current_layer, const unsigned int orig_nodes, const unsigned int total_num_azimuthal_intervals, std::vector< std::pair< dof_id_type, dof_id_type >> &side_pairs, dof_id_type &axis_node_case, bool &is_flipped) const
Create a new PRISM element from an existing QUAD element by revolving it.
This RevolveGenerator object is designed to revolve a 1D mesh into 2D, or a 2D mesh into 3D based on ...
std::pair< Real, Point > getRotationCenterAndRadius(const Point &p_ext, const Point &p_axis, const Point &dir_axis) const
Get the rotation center and radius of the circular rotation based on the rotation axis and the extern...
ElemType
const bool _preserve_volumes
Volume preserving function is optional.
bool _has_start_boundary
Whether a starting boundary is specified.
boundary_id_type _start_boundary
Boundary ID of the starting boundary.
void nodeModification(Node &node)
Modify the position of a node to account for radius correction.
static InputParameters validParams()
boundary_id_type _end_boundary
Boundary ID of the ending boundary.
const Point & _axis_direction
A direction vector of the axis of revolution.
std::pair< std::vector< dof_id_type >, std::vector< dof_id_type > > onAxisNodesIdentifier(const Elem &elem, const std::vector< dof_id_type > &nodes_on_axis) const
Categorize the nodes of an element into two groups: nodes on the axis and nodes off the axis...
void createTETfromTRI(const std::pair< std::vector< dof_id_type >, std::vector< dof_id_type >> &nodes_cates, const ElemType tet_elem_type, const Elem *elem, const std::unique_ptr< MeshBase > &mesh, std::unique_ptr< Elem > &new_elem, const int current_layer, const unsigned int orig_nodes, const unsigned int total_num_azimuthal_intervals, std::vector< std::pair< dof_id_type, dof_id_type >> &side_pairs, dof_id_type &axis_node_case, bool &is_flipped) const
Create a new TET element from an existing TRI element by revolving it.
const InputParameters & parameters() const
void createPYRAMIDPRISMfromQUAD(const std::pair< std::vector< dof_id_type >, std::vector< dof_id_type >> &nodes_cates, const ElemType pyramid_elem_type, const ElemType prism_elem_type, const Elem *elem, const std::unique_ptr< MeshBase > &mesh, std::unique_ptr< Elem > &new_elem, std::unique_ptr< Elem > &new_elem_1, const int current_layer, const unsigned int orig_nodes, const unsigned int total_num_azimuthal_intervals, std::vector< std::pair< dof_id_type, dof_id_type >> &side_pairs, dof_id_type &axis_node_case, bool &is_flipped, bool &is_flipped_additional) const
Create a new PYRAMID element and a new PRISM element from an existing QUAD element by revolving it...
std::unique_ptr< MeshBase > & _input
Lower dimensional mesh from another generator.
const std::vector< std::string > & _elem_integer_names_to_swap
Names and indices of extra element integers to swap.
const std::vector< unsigned int > & _nums_azimuthal_intervals
Numbers of azimuthal mesh intervals in each azimuthal section.
RevolveGenerator(const InputParameters &parameters)
const std::vector< std::vector< std::vector< dof_id_type > > > & _elem_integers_swaps
Extra element integers to swap out for each elevation and each element integer name.
void createPYRAMIDfromTRI(const std::pair< std::vector< dof_id_type >, std::vector< dof_id_type >> &nodes_cates, const ElemType pyramid_elem_type, const Elem *elem, const std::unique_ptr< MeshBase > &mesh, std::unique_ptr< Elem > &new_elem, const int current_layer, const unsigned int orig_nodes, const unsigned int total_num_azimuthal_intervals, std::vector< std::pair< dof_id_type, dof_id_type >> &side_pairs, dof_id_type &axis_node_case, bool &is_flipped) const
Create a new PYRAMID element from an existing TRI element by revolving it.
bool _has_end_boundary
Whether an ending boundary is specified.
bool _full_circle_revolving
Whether to revolve for a full circle or not.
int8_t boundary_id_type
const std::vector< std::vector< subdomain_id_type > > & _subdomain_swaps
Subdomains to swap out for each azimuthal section.
const std::vector< Real > _revolving_angles
Angles of revolution delineating each azimuthal section.
const bool & _clockwise
Revolving direction.
std::vector< std::unordered_map< boundary_id_type, boundary_id_type > > _boundary_swap_pairs
Easier to work with version of _boundary_swaps.
const Point & _axis_point
A point of the axis of revolution.
std::vector< Real > _unit_angles
Unit angles of all azimuthal sections of revolution.
std::unique_ptr< MeshBase > generate() override
std::vector< std::unordered_map< subdomain_id_type, subdomain_id_type > > _subdomain_swap_pairs
Easier to work with version of _sudomain_swaps.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void createQUADfromEDGE(const ElemType quad_elem_type, const Elem *elem, const std::unique_ptr< MeshBase > &mesh, std::unique_ptr< Elem > &new_elem, const int current_layer, const unsigned int orig_nodes, const unsigned int total_num_azimuthal_intervals, std::vector< std::pair< dof_id_type, dof_id_type >> &side_pairs, bool &is_flipped) const
Create a new QUAD element from an existing EDGE element by revolving it.
const std::vector< std::vector< boundary_id_type > > & _boundary_swaps
Boundaries to swap out for each elevation.
A base class that contains common members for Reactor module mesh generators.
Real _radius_correction_factor
Radius correction factor.
std::vector< unsigned int > _elem_integer_indices_to_swap
void createHEXfromQUAD(const ElemType hex_elem_type, const Elem *elem, const std::unique_ptr< MeshBase > &mesh, std::unique_ptr< Elem > &new_elem, const int current_layer, const unsigned int orig_nodes, const unsigned int total_num_azimuthal_intervals, std::vector< std::pair< dof_id_type, dof_id_type >> &side_pairs, bool &is_flipped) const
Create a new HEX element from an existing QUAD element by revolving it.
std::vector< Point > rotationVectors(const Point &p_axis, const Point &dir_axis, const Point &p_input) const
Calculate the transform matrix between the rotation coordinate system and the original coordinate sys...
void createPRISMfromTRI(const ElemType prism_elem_type, const Elem *elem, const std::unique_ptr< MeshBase > &mesh, std::unique_ptr< Elem > &new_elem, const int current_layer, const unsigned int orig_nodes, const unsigned int total_num_azimuthal_intervals, std::vector< std::pair< dof_id_type, dof_id_type >> &side_pairs, bool &is_flipped) const
Create a new PRISM element from an existing TRI element by revolving it.
std::vector< std::unordered_map< dof_id_type, dof_id_type > > _elem_integers_swap_pairs
Easier to work with version of _elem_integers_swaps.
void createTRIfromEDGE(const std::pair< std::vector< dof_id_type >, std::vector< dof_id_type >> &nodes_cates, const ElemType tri_elem_type, const Elem *elem, const std::unique_ptr< MeshBase > &mesh, std::unique_ptr< Elem > &new_elem, const int current_layer, const unsigned int orig_nodes, const unsigned int total_num_azimuthal_intervals, std::vector< std::pair< dof_id_type, dof_id_type >> &side_pairs, dof_id_type &axis_node_case, bool &is_flipped) const
Create a new TRI element from an existing EDGE element by revolving it.
uint8_t dof_id_type