https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MeshGenerator.C
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#include "MeshGenerator.h"
11#include "MooseMesh.h"
12#include "MooseApp.h"
13
14#include "Exodus.h"
15#include "Nemesis.h"
16
17#include "libmesh/exodusII_io.h"
18#include "libmesh/nemesis_io.h"
19
20const std::string MeshGenerator::data_only_param = "_data_only";
21
24{
26
27 params.addParam<bool>("show_info",
28 false,
29 "Whether or not to show mesh info after generating the mesh "
30 "(bounding box, element types, sidesets, nodesets, subdomains, etc)");
31 params.addParam<std::string>(
32 "save_with_name",
33 std::string(),
34 "Keep the mesh from this mesh generator in memory with the name specified");
35
36 params.addParam<bool>(
37 "output", false, "Whether or not to output the mesh file after generating the mesh");
38 params.addParam<bool>("nemesis",
39 false,
40 "Whether or not to output the mesh file in the nemesis"
41 "format (only if output = true)");
42
43 params.addParamNamesToGroup("show_info output nemesis", "Debugging");
44 params.addParamNamesToGroup("save_with_name", "Advanced");
45 params.registerBase("MeshGenerator");
46
47 params.addPrivateParam<bool>("_has_generate_data", false);
48 params.addPrivateParam<bool>("_has_generate_csg", false);
49 params.addPrivateParam<MooseMesh *>("_moose_mesh", nullptr);
50 params.addPrivateParam<bool>(data_only_param, false);
51 // Controls are not created early enough
52 params.suppressParameter<std::vector<std::string>>("control_tags");
53
54 return params;
55}
56
58 : MooseObject(parameters),
60 _mesh(getParam<MooseMesh *>("_moose_mesh") ? getParam<MooseMesh *>("_moose_mesh")
61 : _app.actionWarehouse().mesh().get()),
62 _save_with_name(getParam<std::string>("save_with_name")),
63 _data_only(getParam<bool>(data_only_param))
64{
65 const auto & system = _app.getMeshGeneratorSystem();
66 if (isDataOnly())
67 {
68 // Skip the requirement for generateData() if we are generating CSG object
70 system.dataDrivenError(*this, "does not support data-driven generation");
71 if (hasSaveMesh())
72 system.dataDrivenError(*this, "has 'save_with_name' set");
73 }
74 if (_save_with_name == system.mainMeshGeneratorName())
76 "save_with_name", "The user-defined mesh name: '", _save_with_name, "' is a reserved name");
77 if (getParam<bool>("nemesis") && !getParam<bool>("output"))
78 paramError("nemesis", "Should only be set to true if 'output=true'");
79}
80
81void
83{
84 params.set<bool>("_has_generate_data") = true;
85}
86
87bool
89{
90 return params.get<bool>("_has_generate_data");
91}
92
93void
95{
96 params.set<bool>("_has_generate_csg") = true;
97}
98
99bool
101{
102 return params.get<bool>("_has_generate_csg");
103}
104
105const MeshGeneratorName *
106MeshGenerator::getMeshGeneratorNameFromParam(const std::string & param_name,
107 const bool allow_invalid) const
108{
109 const auto valid_param = isParamValid(param_name);
110 if (!allow_invalid)
111 {
112 if (!valid_param)
113 mooseError("Failed to get a parameter with the name \"",
114 param_name,
115 "\" when getting a MeshGenerator.",
116 "\n\nKnown parameters:\n",
117 _pars);
118 if (!_pars.isType<MeshGeneratorName>(param_name))
119 paramError(param_name,
120 "Parameter of type \"",
121 _pars.type(param_name),
122 "\" is not an expected type for getting a MeshGenerator (should be of type "
123 "\"MeshGeneratorName\")");
124 }
125 else if (!valid_param)
126 return nullptr;
127
128 const auto & name = getParam<MeshGeneratorName>(param_name);
129 checkGetMesh(name, param_name);
130
131 return &name;
132}
133
134const std::vector<MeshGeneratorName> &
135MeshGenerator::getMeshGeneratorNamesFromParam(const std::string & param_name) const
136{
137 if (!isParamValid(param_name))
138 mooseError("Failed to get a parameter with the name \"",
139 param_name,
140 "\" when getting MeshGenerators.",
141 "\n\nKnown parameters:\n",
142 _pars);
143 if (!_pars.isType<std::vector<MeshGeneratorName>>(param_name))
144 paramError(param_name,
145 "Parameter of type \"",
146 _pars.type(param_name),
147 "\" is not an expected type for getting MeshGenerators (should be of type "
148 "\"std::vector<MeshGeneratorName>\")");
149
150 const auto & names = getParam<std::vector<MeshGeneratorName>>(param_name);
151 for (const auto & name : names)
152 checkGetMesh(name, param_name);
153
154 return names;
155}
156
157void
158MeshGenerator::checkGetMesh(const MeshGeneratorName & mesh_generator_name,
159 const std::string & param_name) const
160{
161 mooseAssert(!mesh_generator_name.empty(), "Empty name");
162 const auto & mg_sys = _app.getMeshGeneratorSystem();
164 mooseError("Cannot get a mesh outside of construction");
165 if (!mg_sys.hasMeshGenerator(mesh_generator_name) && !isNullMeshName(mesh_generator_name))
166 {
167 std::stringstream error;
168 error << "The requested MeshGenerator with name '" << mesh_generator_name << "' ";
169 if (mg_sys.hasMeshGeneratorParams(mesh_generator_name))
170 error << "was found, but has not been constructed yet.\n\nThis can occur when your "
171 "dependencies are not properly defined and we cannot infer the proper construction "
172 "order of your MeshGenerators.\n\nThe most likely case is a sub generator whose "
173 "input(s) are not declared as a sub dependency in the generator creating them.";
174 else
175 error << "was not found.\nMesh generators that can be found: "
176 << Moose::stringify(mg_sys.getMeshGeneratorNames());
177
178 if (param_name.size())
179 paramError(param_name, error.str());
180 else
181 mooseError(error.str());
182 }
183
184#ifdef MOOSE_MFEM_ENABLED
185 if (mg_sys.hasMeshGenerator(mesh_generator_name))
186 {
187 const auto is_mfem = [](const InputParameters & pars)
188 {
189 const auto * const flag = pars.queryParam<bool>("_mfem_mesh_generator");
190 return flag && *flag;
191 };
192 const auto & parent = mg_sys.getMeshGenerator(mesh_generator_name);
193 const bool parent_is_mfem = is_mfem(parent.parameters());
194 const bool this_is_mfem = is_mfem(parameters());
195 if (parent_is_mfem != this_is_mfem)
196 {
197 const auto & mfem_name = parent_is_mfem ? mesh_generator_name : name();
198 const auto & mfem_type = parent_is_mfem ? parent.type() : type();
199 const auto & libmesh_name = parent_is_mfem ? name() : mesh_generator_name;
200 const auto & libmesh_type = parent_is_mfem ? type() : parent.type();
201 const std::string msg = "Cannot chain MFEM-native mesh generator '" + mfem_name +
202 "' of type '" + mfem_type + "' with libMesh-native mesh generator '" +
203 libmesh_name + "' of type '" + libmesh_type +
204 "'. MFEM and libMesh mesh generators cannot be mixed within the "
205 "same generator chain.";
206 if (param_name.size())
207 paramError(param_name, msg);
208 else
209 mooseError(msg);
210 }
211 }
212#endif
213}
214
215std::unique_ptr<MeshBase> &
216MeshGenerator::getMesh(const std::string & param_name, const bool allow_invalid /* = false */)
217{
218 const MeshGeneratorName * name = getMeshGeneratorNameFromParam(param_name, allow_invalid);
219 if (!name)
220 return _null_mesh;
221 return getMeshByName(*name);
222}
223
224std::vector<std::unique_ptr<MeshBase> *>
225MeshGenerator::getMeshes(const std::string & param_name)
226{
228}
229
230std::unique_ptr<MeshBase> &
231MeshGenerator::getMeshByName(const MeshGeneratorName & mesh_generator_name)
232{
233 checkGetMesh(mesh_generator_name, "");
234 if (isNullMeshName(mesh_generator_name))
235 return _null_mesh;
236
237 _requested_mesh_generators.insert(mesh_generator_name);
238 auto & mesh = _app.getMeshGeneratorSystem().getMeshGeneratorOutput(mesh_generator_name);
239 _requested_meshes.emplace_back(mesh_generator_name, &mesh);
240 return mesh;
241}
242
243std::vector<std::unique_ptr<MeshBase> *>
244MeshGenerator::getMeshesByName(const std::vector<MeshGeneratorName> & mesh_generator_names)
245{
246 std::vector<std::unique_ptr<MeshBase> *> meshes;
247 for (const auto & name : mesh_generator_names)
248 meshes.push_back(&getMeshByName(name));
249 return meshes;
250}
251
252std::unique_ptr<CSG::CSGBase> &
253MeshGenerator::getCSGBase(const std::string & param_name)
254{
255 const MeshGeneratorName * name = getMeshGeneratorNameFromParam(param_name, false);
256 if (!name)
257 return _null_csg_base;
258 return getCSGBaseByName(*name);
259}
260
261std::unique_ptr<CSG::CSGBase> &
262MeshGenerator::getCSGBaseByName(const MeshGeneratorName & mesh_generator_name)
263{
264 checkGetMesh(mesh_generator_name, "");
265 if (isNullMeshName(mesh_generator_name))
266 return _null_csg_base;
267
268 auto & csg_base = _app.getMeshGeneratorSystem().getCSGBaseGeneratorOutput(mesh_generator_name);
269 _requested_csg_bases.emplace_back(mesh_generator_name, &csg_base);
270 return csg_base;
271}
272
273std::vector<std::unique_ptr<CSG::CSGBase> *>
274MeshGenerator::getCSGBases(const std::string & param_name)
275{
277}
278
279std::vector<std::unique_ptr<CSG::CSGBase> *>
280MeshGenerator::getCSGBasesByName(const std::vector<MeshGeneratorName> & mesh_generator_names)
281{
282 std::vector<std::unique_ptr<CSG::CSGBase> *> csg_bases;
283 for (const auto & name : mesh_generator_names)
284 csg_bases.push_back(&getCSGBaseByName(name));
285 return csg_bases;
286}
287
288void
289MeshGenerator::declareMeshForSub(const std::string & param_name)
290{
292}
293
294void
295MeshGenerator::declareMeshesForSub(const std::string & param_name)
296{
298}
299
300void
301MeshGenerator::declareMeshForSubByName(const MeshGeneratorName & mesh_generator_name)
302{
303 checkGetMesh(mesh_generator_name, "");
304 if (isNullMeshName(mesh_generator_name))
305 return;
306
307 _requested_mesh_generators_for_sub.insert(mesh_generator_name);
308}
309
310void
312 const std::vector<MeshGeneratorName> & mesh_generator_names)
313{
314 for (const auto & name : mesh_generator_names)
316}
317
318std::unique_ptr<MeshBase>
320{
321 mooseAssert(_mesh, "Need a MooseMesh object");
323}
324
325std::unique_ptr<ReplicatedMesh>
327{
328 mooseAssert(_mesh, "Need a MooseMesh object");
329 return _mesh->buildTypedMesh<ReplicatedMesh>(dim);
330}
331
332std::unique_ptr<DistributedMesh>
334{
335 mooseAssert(_mesh, "Need a MooseMesh object");
336 return _mesh->buildTypedMesh<DistributedMesh>(dim);
337}
338
339std::unique_ptr<MeshBase>
341{
342 libmesh_parallel_only(comm());
343 mooseAssert(comm().verify(type() + name()), "Inconsistent execution ordering");
344
345 if (hasGenerateData())
346 generateData();
347
348 if (isDataOnly())
349 return nullptr;
350
351 auto mesh = generate();
352 if (!mesh)
353 mooseError("A mesh was not generated by this generator (it was nullptr).");
354
355 for (const auto & [requested_name, requested_mesh] : _requested_meshes)
356 if (*requested_mesh)
358 "The mesh from input ",
359 _app.getMeshGenerator(requested_name).type(),
360 " '",
361 _app.getMeshGenerator(requested_name).name(),
362 "' was not moved.\n\nThe MeshGenerator system requires that the memory from all input "
363 "meshes\nare managed by the requesting MeshGenerator during the generate phase.\n\nThis "
364 "is achieved with a std::move() operation within the generate() method.");
365
366 if (getParam<bool>("show_info"))
367 {
368 if (!mesh->is_prepared())
369 mesh->prepare_for_use();
370
371 const auto mesh_info = mesh->get_info(/* verbosity = */ 2);
372
373 // We will prefix all information with "type() 'name()':" because this could potentially
374 // output a ton of information and looks a bit better with a prefix
375 std::stringstream oss;
376 const auto split = MooseUtils::split(mesh_info, "\n");
377 if (split.size())
378 for (std::size_t i = 0; i < split.size() - 1; ++i) // ignore the last line break
379 oss << COLOR_CYAN << "" << type() << " '" << name() << "': " << COLOR_DEFAULT << split[i]
380 << std::endl;
381 _console << oss.str() << std::flush;
382 }
383
384 // output the current mesh block to file
385 if (hasOutput())
386 {
387 if (!mesh->is_prepared())
388 mesh->prepare_for_use();
389
390 if (!getParam<bool>("nemesis"))
391 {
393
394 if (mesh->mesh_dimension() == 1)
395 exio.write_as_dimension(3);
396
397 // Avoid truncating names
398 exio.set_max_name_length(80);
399
400 // Default to non-HDF5 output for wider compatibility
401 exio.set_hdf5_writing(false);
402
403 exio.write(name() + "_in.e");
404 }
405 else
406 {
407 libMesh::Nemesis_IO nemesis_io(*mesh);
408
409 // Default to non-HDF5 output for wider compatibility
410 nemesis_io.set_hdf5_writing(false);
411
412 nemesis_io.write(name() + "_in.e");
413 }
414 }
415
416 return mesh;
417}
418
419std::unique_ptr<CSG::CSGBase>
421{
422 mooseAssert(isDataOnly(), "Trying to use csg-only mode while not in data-driven mode");
423 auto csg_obj = generateCSG();
424 mooseAssert(csg_obj, "Null CSG object");
425 for (const auto & [requested_name, requested_csg] : _requested_csg_bases)
426 if (*requested_csg)
428 "The CSGBase object from input ",
429 _app.getMeshGenerator(requested_name).type(),
430 " '",
431 _app.getMeshGenerator(requested_name).name(),
432 "' was not moved.\n\nThe MeshGenerator system requires that the memory from all input "
433 "meshes\nare managed by the requesting MeshGenerator during the generate phase.\n\nThis "
434 "is achieved with a std::move() operation within the generateCSG() method.");
435
436 return csg_obj;
437}
438
439void
440MeshGenerator::addMeshSubgenerator(const std::string & type,
441 const std::string & name,
442 InputParameters params)
443{
445 mooseError("Can only call addMeshSubgenerator() during MeshGenerator construction");
446
447 // In case the user forgot it
449
450 // Set this to be data-only if this generator is data only
451 params.set<bool>(data_only_param) = isDataOnly();
452
453 _app.addMeshGenerator(type, name, params);
454 _sub_mesh_generators.insert(&std::as_const(_app).getMeshGenerator(name));
455}
456
458MeshGenerator::setMeshPropertyHelper(const std::string & data_name)
459{
461}
462
463void
465{
466 mooseAssert(_app.constructingMeshGenerators(), "Should only be called at construction");
467 _parent_mesh_generators.insert(&mg);
468}
469
470void
472{
473 mooseAssert(_app.constructingMeshGenerators(), "Should only be called at construction");
474 _child_mesh_generators.insert(&mg);
475}
476
477bool
478MeshGenerator::isParentMeshGenerator(const MeshGeneratorName & name,
479 const bool direct /* = true */) const
480{
481 return std::find_if(getParentMeshGenerators().begin(),
483 [&name, &direct](const auto & mg)
484 {
485 return mg->name() == name ||
486 (!direct && mg->isParentMeshGenerator(name, /* direct = */ false));
487 }) != getParentMeshGenerators().end();
488}
489
490bool
491MeshGenerator::isChildMeshGenerator(const MeshGeneratorName & name,
492 const bool direct /* = true */) const
493{
494 return std::find_if(getChildMeshGenerators().begin(),
496 [&name, &direct](const auto & mg)
497 {
498 return mg->name() == name ||
499 (!direct && mg->isChildMeshGenerator(name, /* direct = */ false));
500 }) != getChildMeshGenerators().end();
501}
502
503void
504MeshGenerator::declareNullMeshName(const MeshGeneratorName & name)
505{
506 mooseAssert(_app.constructingMeshGenerators(), "Should only be called at construction");
507 mooseAssert(!_null_mesh_names.count(name), "Already declared");
508 _null_mesh_names.insert(name);
509}
510
511bool
513{
514 return _save_with_name.size();
515}
516
517bool
519{
520 return getParam<bool>("output");
521}
522
523const std::string &
528
529void
531{
532 mooseAssert(!hasGenerateData(), "Inconsistent flag");
533 mooseError("This MeshGenerator does not have a generateData() implementation.");
534}
535
536[[nodiscard]] std::unique_ptr<CSG::CSGBase>
538{
539 mooseAssert(!hasGenerateCSG(), "Inconsistent flag");
540 mooseError("This MeshGenerator does not have a generateCSG() implementation.");
541}
unsigned int dim
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn't required or valid in the derived class...
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addPrivateParam(const std::string &name, const T &value)
These method add a parameter to the InputParameters object which can be retrieved like any other para...
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
std::string type(const std::string &name) const
Prints the type of the requested parameter by name.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
bool isType(const std::string &name) const
std::unique_ptr< libMesh::MeshBase > & getMeshGeneratorOutput(const MeshGeneratorName &name)
Get a reference to a pointer that will be the output of the MeshGenerator named name.
std::unique_ptr< CSG::CSGBase > & getCSGBaseGeneratorOutput(const MeshGeneratorName &name)
Returns the output CSGBase object associated with a particular mesh generator name.
void dataDrivenError(const MeshGenerator &generator, const std::string &message) const
Reports an error with the context of the data driven parameter, coming from the generator generator w...
Class that is used as a parameter to add[Parent/Child]() that allows only MeshGeneratorSystem methods...
MeshGenerators are objects that can modify or add to an existing mesh.
virtual std::unique_ptr< MeshBase > generate()=0
Generate / modify the mesh.
void declareMeshForSub(const std::string &param_name)
Declares that a MeshGenerator referenced in the InputParameters is to be used as a dependency of a su...
std::set< const MeshGenerator *, Comparator > _child_mesh_generators
The MeshGenerators that are children to this MeshGenerator.
const std::string & getSavedMeshName() const
Return the name of the saved mesh.
std::vector< std::unique_ptr< MeshBase > * > getMeshes(const std::string &param_name)
Like getMesh(), but for multiple generators.
bool hasSaveMesh() const
Return whether or not to save the current mesh.
virtual std::unique_ptr< CSG::CSGBase > generateCSG()
Generate the CSG representation of the mesh (or meshing operation) created by this mesh generator.
std::set< MeshGeneratorName > _requested_mesh_generators
The names of the MeshGenerators that were requested in the getMesh methods.
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 > & getMesh(const std::string &param_name, const bool allow_invalid=false)
Takes the name of a MeshGeneratorName parameter and then gets a pointer to the Mesh that MeshGenerato...
std::vector< std::unique_ptr< CSG::CSGBase > * > getCSGBasesByName(const std::vector< MeshGeneratorName > &mesh_generator_names)
Like getCSGBaseByName(), but for multiple generators.
std::unique_ptr< MeshBase > _null_mesh
A nullptr to use for when inputs aren't specified.
std::unique_ptr< MeshBase > & getMeshByName(const MeshGeneratorName &mesh_generator_name)
Like getMesh(), but takes the name of another MeshGenerator directly.
const std::string & _save_with_name
A user-defined name to save the mesh.
std::set< MeshGeneratorName > _requested_mesh_generators_for_sub
The names of the MeshGenerators that were requested in the declareMeshForSub methods.
MooseMesh *const _mesh
Pointer to the owning mesh.
bool hasGenerateCSG() const
std::unique_ptr< CSG::CSGBase > generateInternalCSG()
Internal generation method for CSG object generation.
std::unique_ptr< MeshBase > generateInternal()
Internal generation method - this is what is actually called within MooseApp to execute the MeshGener...
static void setHasGenerateCSG(InputParameters &params)
Sets that a mesh generator has a generateCSG() implementation.
const std::vector< MeshGeneratorName > & getMeshGeneratorNamesFromParam(const std::string &param_name) const
Helper for getting a std::vector<MeshGeneratorName> parameter.
bool isParentMeshGenerator(const MeshGeneratorName &name, const bool direct=true) const
std::unique_ptr< DistributedMesh > buildDistributedMesh(unsigned int dim=libMesh::invalid_uint)
Build a distributed mesh that has correct remote element removal behavior and geometric ghosting func...
std::unique_ptr< ReplicatedMesh > buildReplicatedMesh(unsigned int dim=libMesh::invalid_uint)
Build a replicated mesh.
std::vector< std::pair< std::string, std::unique_ptr< CSG::CSGBase > * > > _requested_csg_bases
The CSGBase objects that were requested by this MeshGenerator; used to verify that any input meshes t...
std::vector< std::unique_ptr< CSG::CSGBase > * > getCSGBases(const std::string &param_name)
Like getCSGBase(), but for multiple generators.
static InputParameters validParams()
std::set< const MeshGenerator *, Comparator > _sub_mesh_generators
The sub MeshGenerators constructed by this MeshGenerator.
static const std::string data_only_param
The name of the private parameter for setting data only.
MeshGenerator(const InputParameters &parameters)
std::unique_ptr< CSG::CSGBase > & getCSGBase(const std::string &param_name)
Takes the name of a MeshGeneratorName parameter and then gets a pointer to the CSGBase object that Me...
bool isNullMeshName(const MeshGeneratorName &name) const
const std::set< const MeshGenerator *, Comparator > & getChildMeshGenerators() const
Gets the MeshGenerators that are children to this MeshGenerator.
const std::set< const MeshGenerator *, Comparator > & getParentMeshGenerators() const
Gets the MeshGenerators that are parents to this MeshGenerator.
RestartableDataValue & setMeshPropertyHelper(const std::string &data_name)
Helper for getting a writable reference to a mesh property, used in declareMeshProperty and setMeshPr...
std::vector< std::unique_ptr< MeshBase > * > getMeshesByName(const std::vector< MeshGeneratorName > &mesh_generator_names)
Like getMeshByName(), but for multiple generators.
std::unique_ptr< CSG::CSGBase > & getCSGBaseByName(const MeshGeneratorName &mesh_generator_name)
Like getCSGBase(), but takes the name of another MeshGenerator directly.
std::unique_ptr< MeshBase > buildMeshBaseObject(unsigned int dim=libMesh::invalid_uint)
Build a MeshBase object whose underlying type will be determined by the Mesh input file block.
const MeshGeneratorName * getMeshGeneratorNameFromParam(const std::string &param_name, const bool allow_invalid) const
Helper for getting a MeshGeneratorName parameter.
void declareMeshesForSub(const std::string &param_name)
Like declareMeshForSub(), but for multiple generators.
static void setHasGenerateData(InputParameters &params)
Sets that a mesh generator has a generateData() implementation.
std::vector< std::pair< std::string, std::unique_ptr< MeshBase > * > > _requested_meshes
The meshes that were requested by this MeshGenerator; used to verify that any input meshes that are r...
void declareMeshesForSubByName(const std::vector< MeshGeneratorName > &mesh_generator_names)
Like declareMeshForSubByName(), but for multiple generators.
void declareMeshForSubByName(const MeshGeneratorName &mesh_generator_name)
Like declareMeshForSub(), but takes the name of another MeshGenerator directly.
bool isDataOnly() const
std::unique_ptr< CSG::CSGBase > _null_csg_base
A nullptr to use for when inputs aren't specified.
std::set< std::string > _null_mesh_names
The declared "null" mesh names that will not represent a mesh in input; see declareNullMeshName()
bool isChildMeshGenerator(const MeshGeneratorName &name, const bool direct=true) const
std::set< const MeshGenerator *, Comparator > _parent_mesh_generators
The MeshGenerators that are parents to this MeshGenerator.
bool hasGenerateData() const
void declareNullMeshName(const MeshGeneratorName &name)
Registers the name name as a "null" mesh, which is a MeshGenerator used in InputParameters that will ...
void checkGetMesh(const MeshGeneratorName &mesh_generator_name, const std::string &param_name) const
Helper for performing error checking in the getMesh methods.
void addChildMeshGenerator(const MeshGenerator &mg, const AddParentChildKey)
Adds the MeshGenerator mg as a child.
bool hasOutput() const
void addParentMeshGenerator(const MeshGenerator &mg, const AddParentChildKey)
Adds the MeshGenerator mg as a parent.
virtual void generateData()
Generate the mesh data.
The Interface used to retrieve mesh meta data (attributes) set by the MeshGenerator system.
static std::string meshPropertyName(const std::string &data_name, const std::string &prefix)
Base class for MOOSE-based applications.
Definition MooseApp.h:110
void addMeshGenerator(const std::string &type, const std::string &name, const InputParameters &params)
Add a mesh generator that will act on the meshes in the system.
Definition MooseApp.h:902
virtual bool constructingMeshGenerators() const
Whether this app is constructing mesh generators.
Definition MooseApp.C:3500
RestartableDataValue & getRestartableMetaData(const std::string &name, const RestartableDataMapName &metaname, THREAD_ID tid)
Definition MooseApp.C:2517
const MeshGenerator & getMeshGenerator(const std::string &name) const
Definition MooseApp.h:920
MeshGeneratorSystem & getMeshGeneratorSystem()
Gets the system that manages the MeshGenerators.
Definition MooseApp.h:886
static const RestartableDataMapName MESH_META_DATA
Definition MooseApp.h:136
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
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:457
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition MooseBase.h:271
const InputParameters & _pars
The object's parameters.
Definition MooseBase.h:384
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition MooseBase.h:199
static const std::string app_param
The name of the parameter that contains the MooseApp.
Definition MooseBase.h:59
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
std::unique_ptr< T > buildTypedMesh(unsigned int dim=libMesh::invalid_uint)
Shortcut method to construct a unique pointer to a libMesh mesh instance.
Definition MooseMesh.h:2264
std::unique_ptr< MeshBase > buildMeshBaseObject(unsigned int dim=libMesh::invalid_uint)
Method to construct a libMesh::MeshBase object that is normally set and used by the MooseMesh object ...
Definition MooseMesh.C:2918
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
static InputParameters validParams()
Definition MooseObject.C:25
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375
Abstract definition of a RestartableData value.
void set_max_name_length(unsigned int max_length)
virtual void write(const std::string &fname) override
void set_hdf5_writing(bool write_hdf5)
void write_as_dimension(unsigned dim)
void set_hdf5_writing(bool write_hdf5)
virtual void write(const std::string &base_filename) override
const Parallel::Communicator & comm() const
MeshBase & mesh
std::vector< std::string > split(const std::string &str, const std::string &delimiter, std::size_t max_count)
std::string stringify(const T &t)
conversion to string
Definition Conversion.h:64