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