Loading [MathJax]/extensions/tex2jax.js
Cardinal
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
NekMeshGenerator.h
Go to the documentation of this file.
1/********************************************************************/
2/* SOFTWARE COPYRIGHT NOTIFICATION */
3/* Cardinal */
4/* */
5/* (c) 2021 UChicago Argonne, LLC */
6/* ALL RIGHTS RESERVED */
7/* */
8/* Prepared by UChicago Argonne, LLC */
9/* Under Contract No. DE-AC02-06CH11357 */
10/* With the U. S. Department of Energy */
11/* */
12/* Prepared by Battelle Energy Alliance, LLC */
13/* Under Contract No. DE-AC07-05ID14517 */
14/* With the U. S. Department of Energy */
15/* */
16/* See LICENSE for full restrictions */
17/********************************************************************/
18
19#pragma once
20
21#include "MeshGenerator.h"
22
29class NekMeshGenerator : public MeshGenerator
30{
31public:
32 static InputParameters validParams();
33
34 NekMeshGenerator(const InputParameters & parameters);
35
36 std::unique_ptr<MeshBase> generate() override;
37
38
39 void initializeElemData(std::unique_ptr<MeshBase> & mesh);
40
45 void checkElementType(std::unique_ptr<MeshBase> & mesh);
46
52 virtual std::pair<unsigned int, unsigned int> pairedNodesAboutMidPoint(const unsigned int & node_id) const;
53
59 unsigned int getFaceNode(const unsigned int & primary_face) const;
60
66 virtual bool isCornerNode(const unsigned int & node) const;
67
71 void moveNodes(std::unique_ptr<MeshBase> & mesh, std::vector<Real> & polygon_layer_smoothing);
72
79 const Elem * getNextLayerElem(const Elem & elem, const unsigned int & touching_face,
80 unsigned int & next_touching_face) const;
81
88 unsigned int midPointNodeIndex(const unsigned int & face_id, const unsigned int & face_node) const;
89
96 unsigned int pairedFaceNode(const unsigned int & node_id, const unsigned int & face_id) const;
97
106 std::vector<Elem *> getBoundaryLayerElems(Elem * elem, const unsigned int & n_layers,
107 const unsigned int & primary_face) const;
108
117 void moveElem(Elem * elem, const unsigned int & boundary_index, const unsigned int & primary_face,
118 const std::vector<Real> & polygon_layer_smoothing);
119
126 bool isNearCorner(const Point & pt) const;
127
134 unsigned int getNodeIndex(const Elem * elem, const Point & pt) const;
135
142 Point getClosestOrigin(const unsigned int & index, const Point & pt) const;
143
149 void checkPointLength(const std::vector<std::vector<Real>> & points, std::string name) const;
150
157 void adjustMidPointNode(const unsigned int & node_id, Elem * elem) const;
158
165 BoundaryID getBoundaryID(const BoundaryName & name, const MeshBase & mesh) const;
166
173 Point projectPoint(const Point & origin, const Point & pt) const;
174
183 Point adjustPointToCircle(const unsigned int & node_id, Elem * elem, const Real & radius, const Point & origin) const;
184
185protected:
187 std::unique_ptr<MeshBase> & _input;
188
190 const MooseEnum & _geometry_type;
191
193 const MooseEnum & _axis;
194
196 const bool & _curve_corners;
197
213 const Real & _rotation_angle;
214
217
220
222 unsigned int _n_start_nodes;
223
225 unsigned int _n_end_nodes;
226
229
231 unsigned int _n_sides;
232
234 unsigned int _n_corner_nodes;
235
237 std::vector<BoundaryID> _moving_boundary;
238
240 std::vector<Real> _radius;
241
243 std::vector<std::vector<Real>> _origin;
244
246 std::vector<unsigned int> _layers;
247
250
252 std::vector<Point> _polygon_corners;
253
256
259
261 std::set<BoundaryID> _boundaries_to_rebuild;
262
264 std::map<BoundaryID, BoundaryName> _boundary_id_to_name;
265
267 std::vector<std::vector<unsigned int>> _side_ids;
268
270 std::vector<std::vector<unsigned int>> _corner_nodes;
271
273 std::vector<std::vector<std::pair<unsigned int, unsigned int>>> _across_pair;
274
276 std::vector<unsigned int> _across_face;
277
279 ElemType _etype;
280
282 std::vector<std::vector<unsigned int>> _side_nodes_map;
283
285 std::vector<std::vector<unsigned int>> _face_nodes_map;
286};
@ mesh
Definition CardinalEnums.h:257
Definition NekMeshGenerator.h:30
std::vector< std::vector< unsigned int > > _side_ids
For each face, the mid-side nodes to be adjusted.
Definition NekMeshGenerator.h:267
ElemType _etype
Element type in the original mesh.
Definition NekMeshGenerator.h:279
BoundaryID getBoundaryID(const BoundaryName &name, const MeshBase &mesh) const
Definition NekMeshGenerator.C:235
unsigned int _n_noncorner_boundaries
Number of boundaries to be moved that do not include the corners.
Definition NekMeshGenerator.h:258
std::vector< unsigned int > _across_face
For each face, the paired face "across" to the other side of the original elem type.
Definition NekMeshGenerator.h:276
unsigned int _n_sides
Number of sides per element (faces in 3-D, edges in 2-D)
Definition NekMeshGenerator.h:231
void checkPointLength(const std::vector< std::vector< Real > > &points, std::string name) const
Definition NekMeshGenerator.C:248
void adjustMidPointNode(const unsigned int &node_id, Elem *elem) const
Definition NekMeshGenerator.C:267
std::vector< std::vector< Real > > _origin
Origins of the circular surface(s)
Definition NekMeshGenerator.h:243
std::vector< std::vector< unsigned int > > _side_nodes_map
Side nodes map.
Definition NekMeshGenerator.h:282
unsigned int getNodeIndex(const Elem *elem, const Point &pt) const
Definition NekMeshGenerator.C:293
std::unique_ptr< MeshBase > generate() override
Definition NekMeshGenerator.C:693
std::vector< std::vector< unsigned int > > _corner_nodes
For each face, the corner node indices.
Definition NekMeshGenerator.h:270
virtual std::pair< unsigned int, unsigned int > pairedNodesAboutMidPoint(const unsigned int &node_id) const
Definition NekMeshGenerator.C:684
bool isNearCorner(const Point &pt) const
Definition NekMeshGenerator.C:283
void moveNodes(std::unique_ptr< MeshBase > &mesh, std::vector< Real > &polygon_layer_smoothing)
Definition NekMeshGenerator.C:480
Real _corner_radius
If curving corners, the radius of curvature of the corner.
Definition NekMeshGenerator.h:249
std::vector< std::vector< std::pair< unsigned int, unsigned int > > > _across_pair
For each face, the node pairing "across" that face to the other side of the original elem type.
Definition NekMeshGenerator.h:273
std::map< BoundaryID, BoundaryName > _boundary_id_to_name
Original boundary names and IDs.
Definition NekMeshGenerator.h:264
const bool & _retain_original_elem_type
Whether to skip the optional output conversion to Quad8 or Hex20 elements.
Definition NekMeshGenerator.h:216
void checkElementType(std::unique_ptr< MeshBase > &mesh)
Definition NekMeshGenerator.C:539
const Real & _rotation_angle
Definition NekMeshGenerator.h:213
std::vector< Real > _radius
Radii of the circular surface(s)
Definition NekMeshGenerator.h:240
Point projectPoint(const Point &origin, const Point &pt) const
Definition NekMeshGenerator.C:190
unsigned int getFaceNode(const unsigned int &primary_face) const
Definition NekMeshGenerator.C:533
Real _max_corner_distance
Maximum distance a point can be from a corner and still require movement to the curved corners.
Definition NekMeshGenerator.h:255
std::vector< Point > _polygon_corners
If curving corners, the corner coordinates of the polygon.
Definition NekMeshGenerator.h:252
void initializeElemData(std::unique_ptr< MeshBase > &mesh)
Definition NekMeshGenerator.C:564
Point getClosestOrigin(const unsigned int &index, const Point &pt) const
Definition NekMeshGenerator.C:303
static InputParameters validParams()
Definition NekMeshGenerator.C:37
std::unique_ptr< MeshBase > & _input
Mesh to modify.
Definition NekMeshGenerator.h:187
virtual bool isCornerNode(const unsigned int &node) const
Definition NekMeshGenerator.C:678
Point adjustPointToCircle(const unsigned int &node_id, Elem *elem, const Real &radius, const Point &origin) const
Definition NekMeshGenerator.C:201
const MooseEnum & _axis
Axis of the mesh about which to build the circular surface.
Definition NekMeshGenerator.h:193
std::vector< Elem * > getBoundaryLayerElems(Elem *elem, const unsigned int &n_layers, const unsigned int &primary_face) const
Definition NekMeshGenerator.C:389
unsigned int _n_corner_nodes
Number of corner nodes.
Definition NekMeshGenerator.h:234
const bool & _curve_corners
Whether to move corner nodes to fit curved radii of a regular polygon.
Definition NekMeshGenerator.h:196
std::set< BoundaryID > _boundaries_to_rebuild
Boundaries to rebuild in the new mesh.
Definition NekMeshGenerator.h:261
const Elem * getNextLayerElem(const Elem &elem, const unsigned int &touching_face, unsigned int &next_touching_face) const
Definition NekMeshGenerator.C:438
void moveElem(Elem *elem, const unsigned int &boundary_index, const unsigned int &primary_face, const std::vector< Real > &polygon_layer_smoothing)
Definition NekMeshGenerator.C:332
std::vector< std::vector< unsigned int > > _face_nodes_map
Face nodes map.
Definition NekMeshGenerator.h:285
unsigned int _n_start_nodes
Number of nodes per element in original mesh.
Definition NekMeshGenerator.h:222
std::vector< BoundaryID > _moving_boundary
Sideset IDs to move to fit the circular surface.
Definition NekMeshGenerator.h:237
unsigned int _n_end_nodes
Number of nodes per element in resulting mesh.
Definition NekMeshGenerator.h:225
const bool _has_moving_boundary
Whether sidesets will be moved to match circular surfaces.
Definition NekMeshGenerator.h:219
unsigned int _n_start_nodes_per_side
Number of nodes per side of the starting element.
Definition NekMeshGenerator.h:228
const MooseEnum & _geometry_type
Geometry type to curve boundaries to.
Definition NekMeshGenerator.h:190
unsigned int midPointNodeIndex(const unsigned int &face_id, const unsigned int &face_node) const
Definition NekMeshGenerator.C:429
unsigned int pairedFaceNode(const unsigned int &node_id, const unsigned int &face_id) const
Definition NekMeshGenerator.C:412
std::vector< unsigned int > _layers
Number of layers to sweep on each boundary.
Definition NekMeshGenerator.h:246