24 "The input MeshGenerator defining the outer boundary of the region to mesh with "
26 params.
addParam<std::vector<MeshGeneratorName>>(
27 "holes", std::vector<MeshGeneratorName>(),
"The MeshGenerators that define mesh holes.");
32 "Desired (maximum) triangle area of the triangulation the quadrilaterals are built from, or "
33 "0 to size the elements from the boundary alone.");
34 params.
addParam<
bool>(
"refine_boundary",
36 "Whether the triangulation may split the segments of the outer boundary "
37 "to reach 'desired_area'. Set to false to keep the boundary nodes of the "
38 "input, for example to stitch the mesh to a neighboring one.");
39 params.
addParam<std::vector<bool>>(
"refine_holes",
41 "Whether the triangulation may split the segments of each "
42 "hole boundary to reach 'desired_area', one entry per hole. "
43 "Set to false to keep the boundary nodes of that hole.");
45 params.
addParam<BoundaryName>(
"output_boundary",
46 "Boundary name to set on the new outer boundary.");
47 params.
addParam<std::vector<BoundaryName>>(
"hole_boundaries",
48 "Boundary names to set on the holes.");
49 params.
addParam<SubdomainName>(
"output_subdomain_name",
50 "Subdomain name to set on the new elements.");
55 "eta_min > 0 & eta_min <= 1",
56 "The quality score eta = 1 - (2 / pi) max_k |pi / 2 - alpha_k| of the quadrilateral, in "
57 "which alpha_k are its four internal angles, that a pair of adjacent triangles must reach "
58 "to be merged. A rectangle scores 1 and a non-convex quadrilateral 0.");
61 "Whether the triangles that could not be merged are eliminated so that the "
62 "mesh consists exclusively of quadrilaterals. When false, they are kept "
63 "and the mesh is quad-dominant.");
65 params.
addParam<std::vector<MeshGeneratorName>>(
66 "parsed_curve_generators",
67 std::vector<MeshGeneratorName>(),
68 "The ParsedCurveGenerators whose curves the boundaries named in 'snap_boundaries' are "
69 "snapped onto, one generator per entry of that parameter.");
70 params.
addParam<std::vector<BoundaryName>>(
72 std::vector<BoundaryName>(),
73 "The boundaries whose nodes are snapped onto the curves of 'parsed_curve_generators', one "
75 "per entry of that parameter. Use the names given in 'output_boundary' and "
76 "'hole_boundaries'.");
80 "Whether to finish the pipeline with a variational smoothing pass, which "
81 "relaxes the elements. The boundary nodes stay on the boundary but may "
82 "slide along it; set to false to keep them where the earlier steps placed "
85 params.
addParamNamesToGroup(
"boundary holes desired_area refine_boundary refine_holes",
"Region");
90 "Meshes a region bounded by input curves with quadrilaterals in one step, by chaining a "
91 "frontal Delaunay triangulation, the triangle-to-quadrilateral conversion, the snapping of "
92 "boundary nodes onto parametric curves, and an optional variational smoothing pass.");
101 const auto & parsed_curve_generators =
102 getParam<std::vector<MeshGeneratorName>>(
"parsed_curve_generators");
103 const auto & snap_boundaries = getParam<std::vector<BoundaryName>>(
"snap_boundaries");
104 if (parsed_curve_generators.size() != snap_boundaries.size())
107 "Need one entry per entry of 'parsed_curve_generators', because each boundary is snapped "
108 "onto the curve of the generator it is paired with.");
119 params.
set<MeshGeneratorName>(
"boundary") = getParam<MeshGeneratorName>(
"boundary");
120 params.set<std::vector<MeshGeneratorName>>(
"holes") =
121 getParam<std::vector<MeshGeneratorName>>(
"holes");
122 params.set<Real>(
"desired_area") = getParam<Real>(
"desired_area");
123 params.set<
bool>(
"refine_boundary") = getParam<bool>(
"refine_boundary");
124 params.set<std::vector<bool>>(
"refine_holes") =
getParam<std::vector<bool>>(
"refine_holes");
126 params.set<BoundaryName>(
"output_boundary") = getParam<BoundaryName>(
"output_boundary");
128 params.set<std::vector<BoundaryName>>(
"hole_boundaries") =
129 getParam<std::vector<BoundaryName>>(
"hole_boundaries");
131 params.set<SubdomainName>(
"output_subdomain_name") =
132 getParam<SubdomainName>(
"output_subdomain_name");
142 params.
set<MeshGeneratorName>(
"input") =
name() +
"_frontal";
143 params.set<Real>(
"eta_min") = getParam<Real>(
"eta_min");
144 params.set<
bool>(
"all_quad") = getParam<bool>(
"all_quad");
149 MeshGeneratorName previous =
name() +
"_to_quad";
150 for (
const auto snap_i : index_range(parsed_curve_generators))
154 params.
set<MeshGeneratorName>(
"input") = previous;
155 params.set<BoundaryName>(
"boundary") = snap_boundaries[snap_i];
156 params.set<MeshGeneratorName>(
"parsed_curve_generator") = parsed_curve_generators[snap_i];
158 previous =
name() +
"_snap_" + std::to_string(snap_i);
162 if (getParam<bool>(
"smooth"))
166 params.
set<MeshGeneratorName>(
"input") = previous;
169 params.set<
MooseEnum>(
"algorithm") =
"variational";
171 previous =
name() +
"_smooth";
178std::unique_ptr<MeshBase>
registerMooseObject("MooseApp", XYQuadrilateralMeshFromBoundaryCurve)
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
MeshGenerators are objects that can modify or add to an existing mesh.
void declareMeshForSub(const std::string ¶m_name)
Declares that a MeshGenerator referenced in the InputParameters is to be used as a dependency of a su...
void addMeshSubgenerator(const std::string &type, const std::string &name, Ts... extra_input_parameters)
Construct a "subgenerator", a different MeshGenerator subclass that will be added to the same MooseAp...
std::unique_ptr< MeshBase > & getMeshByName(const MeshGeneratorName &mesh_generator_name)
Like getMesh(), but takes the name of another MeshGenerator directly.
static InputParameters validParams()
void declareMeshesForSub(const std::string ¶m_name)
Like declareMeshForSub(), but for multiple generators.
void declareMeshesForSubByName(const std::vector< MeshGeneratorName > &mesh_generator_names)
Like declareMeshForSubByName(), but for multiple generators.
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
const std::string & name() const
Get the name of the class.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
MooseApp & _app
The MOOSE application this is associated with.
Meshes a region bounded by input curves with quadrilaterals in one step, by chaining the generators o...
XYQuadrilateralMeshFromBoundaryCurve(const InputParameters ¶meters)
static InputParameters validParams()
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
std::unique_ptr< MeshBase > * _build_mesh
Mesh of the final sub-generator of the chain, which is the mesh this generator produces.