https://mooseframework.inl.gov
TransfiniteMeshGenerator.h
Go to the documentation of this file.
1 
2 //* This file is part of the MOOSE framework
3 //* https://mooseframework.inl.gov
4 //*
5 //* All rights reserved, see COPYRIGHT for full restrictions
6 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
7 //*
8 //* Licensed under LGPL 2.1, please see LICENSE for details
9 //* https://www.gnu.org/licenses/lgpl-2.1.html
10 
11 #pragma once
12 
13 #include "MeshGenerator.h"
14 #include "FunctionParserUtils.h"
15 // #include "FunctionInterface.h"
16 #include "libmesh/parsed_function.h"
17 #include <vector>
18 
23 {
24 public:
26 
28 
29  std::unique_ptr<MeshBase> generate() override;
30 
31 protected:
32  // The corners of the domain
33  const std::vector<Point> & _corners;
34  const unsigned int _nx;
35  const unsigned int _ny;
36 
37  // We allow different types
42 
43  // So far the intention is to read in paramters a strings and
44  // typecast them after parsing and checking the edge type
45  const std::string _bottom_parameter;
46  const std::string _top_parameter;
47  const std::string _left_parameter;
48  const std::string _right_parameter;
49 
50  const Real _bias_x;
51  const Real _bias_y;
52 
55 
56  // This is the main routine for constructing edges according to the user input
57  std::vector<Point> getEdge(const Point & P1,
58  const Point & P2,
59  const unsigned int np,
60  const MooseEnum & type,
61  const std::string & parameter,
62  const Point & outward,
63  const std::vector<Real> & param_vec);
64 
65  std::vector<Point> getParsedEdge(const std::string & parameter,
66  const std::vector<Real> & param_vec);
67 
68  std::vector<Point> getCircarcEdge(const Point & P1,
69  const Point & P2,
70  const std::string & parameter,
71  const Point & outward,
72  const std::vector<Real> & param_vec);
73 
74  std::vector<Point> getDiscreteEdge(const unsigned int np, const std::string & parameter);
75 
76  std::vector<Point>
77  getLineEdge(const Point & P1, const Point & P2, const std::vector<Real> & param_vec);
78 
79  // The following 3 routines are needed for generating arc circles given the user input
80  // The input is expected to be the distance from a stright line at the middle of an edge
81  Real computeRadius(const Point & P1, const Point & P2, const Point & P3) const;
82 
83  // To identify the origin of a circle that passes through 3 points we need to solve a system of
84  // 3 equations. The system is solved separately and this routine implements its solution.
85  Point computeOrigin(const Point & P1, const Point & P2, const Point & P3) const;
86 
87  // Given two points and a distance from a straight line at the middle of the edge, we have two
88  // possible solutions for the origin of the circle. This routine chooses the midpoint given
89  // the orientation of the edge specified by the outward vector. The user provides the orientation
90  // using a sign convention on the "dist" parameter, with positive for inward and negative for
91  // outward. The outward vector is precalculated and used in the routine to choose the correct
92  // midpoint.
93  Point
94  computeMidPoint(const Point & P1, const Point & P2, const Real dist, const Point & outward) const;
95 
96  // The following routine is necessary for the parametrization of opposite edges
97  // To assure we have the same parameterization on opposite edges we need to map it to
98  // a reference interval, i.e. [0, 1], and refer back and forth as needed.
99  // This routine maps a point x\in[a, b] to the corresponding point in the interval [c, d].
100 
101  Real getMapInterval(const Real xab, const Real a, const Real b, const Real c, const Real d) const;
102 
103  std::vector<Real>
104  getPointsDistribution(const Real edge_length, const unsigned int np, const Real bias) const;
105 
107 };
Real getMapInterval(const Real xab, const Real a, const Real b, const Real c, const Real d) const
const std::vector< Point > & _corners
std::shared_ptr< SymFunction > SymFunctionPtr
Shorthand for an smart pointer to an autodiff function parser object.
SymFunctionPtr _parsed_func
function parser object describing the combinatorial geometry
std::vector< Point > getCircarcEdge(const Point &P1, const Point &P2, const std::string &parameter, const Point &outward, const std::vector< Real > &param_vec)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
Point computeMidPoint(const Point &P1, const Point &P2, const Real dist, const Point &outward) const
std::vector< Point > getParsedEdge(const std::string &parameter, const std::vector< Real > &param_vec)
std::vector< Point > getDiscreteEdge(const unsigned int np, const std::string &parameter)
std::vector< Point > getEdge(const Point &P1, const Point &P2, const unsigned int np, const MooseEnum &type, const std::string &parameter, const Point &outward, const std::vector< Real > &param_vec)
TransfiniteMeshGenerator(const InputParameters &parameters)
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:51
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
Point computeOrigin(const Point &P1, const Point &P2, const Point &P3) const
usingFunctionParserUtilsMembers(false)
std::vector< Point > getLineEdge(const Point &P1, const Point &P2, const std::vector< Real > &param_vec)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< Real > getPointsDistribution(const Real edge_length, const unsigned int np, const Real bias) const
Real computeRadius(const Point &P1, const Point &P2, const Point &P3) const
const InputParameters & parameters() const
Get the parameters of the object.
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:32
Generates an quadrilateral given all the parameters.