www.mooseframework.org
MeshGenerator.h
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 #pragma once
11 
12 #include "MooseObject.h"
13 #include "Restartable.h"
14 
15 // Included so mesh generators don't need to include this when constructing MeshBase objects
16 #include "MooseMesh.h"
17 
18 #include "libmesh/mesh_base.h"
19 
20 // Forward declarations
21 class MeshGenerator;
22 class MooseMesh;
23 
24 template <>
26 
30 class MeshGenerator : public MooseObject, public Restartable
31 {
32 public:
39 
43  virtual std::unique_ptr<MeshBase> generate() = 0;
44 
48  std::vector<std::string> & getDependencies() { return _depends_on; }
49 
50 protected:
59  std::unique_ptr<MeshBase> & getMesh(const std::string & input_mesh_generator_parameter_name);
60 
68  std::unique_ptr<MeshBase> &
69  getMeshByName(const MeshGeneratorName & input_mesh_generator_parameter_name);
70 
72  std::shared_ptr<MooseMesh> & _mesh;
73 
74 private:
76  std::vector<std::string> _depends_on;
77 
79  std::unique_ptr<MeshBase> _null_mesh = nullptr;
80 };
81 
A class for creating restricted objects.
Definition: Restartable.h:29
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
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
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
virtual std::unique_ptr< MeshBase > generate()=0
Generate / modify the mesh.
std::vector< std::string > & getDependencies()
Return the MeshGenerators that must run before this MeshGenerator.
Definition: MeshGenerator.h:48
std::shared_ptr< MooseMesh > & _mesh
References to the mesh and displaced mesh (currently in the ActionWarehouse)
Definition: MeshGenerator.h:72
InputParameters validParams< MeshGenerator >()
Definition: MeshGenerator.C:16
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:30
std::vector< std::string > _depends_on
A list of generators that are required to run before this generator may run.
Definition: MeshGenerator.h:76