www.mooseframework.org
MeshGenerator.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 template <>
17 {
19 
20  params.registerBase("MeshGenerator");
21  return params;
22 }
23 
25  : MooseObject(parameters),
26  Restartable(this, "MeshGenerators"),
27  _mesh(_app.actionWarehouse().mesh())
28 {
29 }
30 
31 std::unique_ptr<MeshBase> &
32 MeshGenerator::getMesh(const std::string & input_mesh_generator_parameter_name)
33 {
34  if (isParamValid(input_mesh_generator_parameter_name))
35  {
36  auto name = getParam<MeshGeneratorName>(input_mesh_generator_parameter_name);
37 
38  _depends_on.push_back(name);
39 
41  }
42  else
43  return _null_mesh;
44 }
45 
46 std::unique_ptr<MeshBase> &
47 MeshGenerator::getMeshByName(const MeshGeneratorName & input_mesh_generator)
48 {
49  _depends_on.push_back(input_mesh_generator);
50  return _app.getMeshGeneratorOutput(input_mesh_generator);
51 }
A class for creating restricted objects.
Definition: Restartable.h:29
std::unique_ptr< MeshBase > & getMeshGeneratorOutput(const std::string &name)
Get a refernce to a pointer that will be the output of the MeshGenerator named name.
Definition: MooseApp.C:1464
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::unique_ptr< MeshBase > _null_mesh
A nullptr to use for when inputs aren&#39;t specified.
Definition: MeshGenerator.h:79
MeshGenerator(const InputParameters &parameters)
Constructor.
Definition: MeshGenerator.C:24
std::unique_ptr< MeshBase > & getMeshByName(const MeshGeneratorName &input_mesh_generator_parameter_name)
Takes the name of another MeshGenerator directly.
Definition: MeshGenerator.C:47
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System...
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:42
std::unique_ptr< MeshBase > & getMesh(const std::string &input_mesh_generator_parameter_name)
Takes the name of a MeshGeneratorName parameter and then gets a pointer to the Mesh that MeshGenerato...
Definition: MeshGenerator.C:32
InputParameters validParams< MooseObject >()
Definition: MooseObject.C:25
MooseApp & _app
The MooseApp this object is associated with.
Definition: MooseObject.h:177
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:59
InputParameters validParams< MeshGenerator >()
Definition: MeshGenerator.C:16
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition: MooseObject.h:89
std::vector< std::string > _depends_on
A list of generators that are required to run before this generator may run.
Definition: MeshGenerator.h:76