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
11 
13 
19 {
20 public:
22 
24 
25  std::unique_ptr<MeshBase> generate() override;
26 
27 protected:
29  std::unique_ptr<MeshBase> & _input;
30 
32  const Point & _axis_point;
33 
35  const Point & _axis_direction;
36 
38  const std::vector<Real> _revolving_angles;
39 
41  const std::vector<std::vector<subdomain_id_type>> & _subdomain_swaps;
42 
44  const std::vector<std::vector<boundary_id_type>> & _boundary_swaps;
45 
47  const std::vector<std::string> & _elem_integer_names_to_swap;
48  std::vector<unsigned int> _elem_integer_indices_to_swap;
49 
51  const std::vector<std::vector<std::vector<dof_id_type>>> & _elem_integers_swaps;
52 
54  const bool & _clockwise;
55 
57  const std::vector<unsigned int> & _nums_azimuthal_intervals;
58 
60  const bool _preserve_volumes;
61 
64 
67 
70 
72  std::vector<std::unordered_map<subdomain_id_type, subdomain_id_type>> _subdomain_swap_pairs;
73 
75  std::vector<std::unordered_map<boundary_id_type, boundary_id_type>> _boundary_swap_pairs;
76 
78  std::vector<std::unordered_map<dof_id_type, dof_id_type>> _elem_integers_swap_pairs;
79 
82 
84  std::vector<Real> _unit_angles;
85 
88 
91 
100  std::pair<Real, Point> getRotationCenterAndRadius(const Point & p_ext,
101  const Point & p_axis,
102  const Point & dir_axis) const;
103 
113  std::vector<Point>
114  rotationVectors(const Point & p_axis, const Point & dir_axis, const Point & p_input) const;
115 
123  std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>>
124  onAxisNodesIdentifier(const Elem & elem, const std::vector<dof_id_type> & nodes_on_axis) const;
125 
130  void nodeModification(Node & node);
131 
146  void createQUADfromEDGE(const ElemType quad_elem_type,
147  const Elem * elem,
148  const std::unique_ptr<MeshBase> & mesh,
149  std::unique_ptr<Elem> & new_elem,
150  const int current_layer,
151  const unsigned int orig_nodes,
152  const unsigned int total_num_azimuthal_intervals,
153  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
154  bool & is_flipped) const;
155 
173  void createTRIfromEDGE(
174  const std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>> & nodes_cates,
175  const ElemType tri_elem_type,
176  const Elem * elem,
177  const std::unique_ptr<MeshBase> & mesh,
178  std::unique_ptr<Elem> & new_elem,
179  const int current_layer,
180  const unsigned int orig_nodes,
181  const unsigned int total_num_azimuthal_intervals,
182  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
183  dof_id_type & axis_node_case,
184  bool & is_flipped) const;
185 
200  void createPRISMfromTRI(const ElemType prism_elem_type,
201  const Elem * elem,
202  const std::unique_ptr<MeshBase> & mesh,
203  std::unique_ptr<Elem> & new_elem,
204  const int current_layer,
205  const unsigned int orig_nodes,
206  const unsigned int total_num_azimuthal_intervals,
207  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
208  bool & is_flipped) const;
209 
228  const std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>> & nodes_cates,
229  const ElemType pyramid_elem_type,
230  const Elem * elem,
231  const std::unique_ptr<MeshBase> & mesh,
232  std::unique_ptr<Elem> & new_elem,
233  const int current_layer,
234  const unsigned int orig_nodes,
235  const unsigned int total_num_azimuthal_intervals,
236  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
237  dof_id_type & axis_node_case,
238  bool & is_flipped) const;
239 
257  void createTETfromTRI(
258  const std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>> & nodes_cates,
259  const ElemType tet_elem_type,
260  const Elem * elem,
261  const std::unique_ptr<MeshBase> & mesh,
262  std::unique_ptr<Elem> & new_elem,
263  const int current_layer,
264  const unsigned int orig_nodes,
265  const unsigned int total_num_azimuthal_intervals,
266  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
267  dof_id_type & axis_node_case,
268  bool & is_flipped) const;
269 
284  void createHEXfromQUAD(const ElemType hex_elem_type,
285  const Elem * elem,
286  const std::unique_ptr<MeshBase> & mesh,
287  std::unique_ptr<Elem> & new_elem,
288  const int current_layer,
289  const unsigned int orig_nodes,
290  const unsigned int total_num_azimuthal_intervals,
291  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
292  bool & is_flipped) const;
293 
311  void createPRISMfromQUAD(
312  const std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>> & nodes_cates,
313  const ElemType prism_elem_type,
314  const Elem * elem,
315  const std::unique_ptr<MeshBase> & mesh,
316  std::unique_ptr<Elem> & new_elem,
317  const int current_layer,
318  const unsigned int orig_nodes,
319  const unsigned int total_num_azimuthal_intervals,
320  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
321  dof_id_type & axis_node_case,
322  bool & is_flipped) const;
323 
347  const std::pair<std::vector<dof_id_type>, std::vector<dof_id_type>> & nodes_cates,
348  const ElemType pyramid_elem_type,
349  const ElemType prism_elem_type,
350  const Elem * elem,
351  const std::unique_ptr<MeshBase> & mesh,
352  std::unique_ptr<Elem> & new_elem,
353  std::unique_ptr<Elem> & new_elem_1,
354  const int current_layer,
355  const unsigned int orig_nodes,
356  const unsigned int total_num_azimuthal_intervals,
357  std::vector<std::pair<dof_id_type, dof_id_type>> & side_pairs,
358  dof_id_type & axis_node_case,
359  bool & is_flipped,
360  bool & is_flipped_additional) const;
361 };
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