https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MeshGeneratorMesh.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 "MeshGeneratorMesh.h"
11
12#include "MeshGeneratorSystem.h"
13#include "MooseApp.h"
14
15#include "libmesh/face_quad4.h"
16#include "libmesh/face_tri3.h"
17
18#ifdef MOOSE_MFEM_ENABLED
19#include "MFEMMeshCarrier.h"
20#endif
21
23
26{
28 params.set<bool>("_mesh_generator_mesh") = true;
29
30 params.addParam<std::string>("final_generator",
31 "The name of the mesh generator output to use for the final Mesh");
33 "Set to make all dependencies of this mesh generator run in data "
34 "driven mode, where a mesh is not generated");
35
36 params.addClassDescription("Mesh generated using mesh generators");
37 return params;
38}
39
41
42std::unique_ptr<MooseMesh>
44{
45 return _app.getFactory().copyConstruct(*this);
46}
47
48void
50{
51 if (!hasMeshBase())
52 mooseError("The mesh base has not been set");
53
54#ifdef MOOSE_MFEM_ENABLED
55 if (dynamic_cast<MFEMMeshCarrier *>(&getMesh()))
56 mooseError("MeshGeneratorMesh requires the final mesh generator to produce a libMesh mesh. "
57 "If you are using MFEM mesh generators, use MFEMMeshGeneratorMesh instead.");
58#endif
59}
registerMooseObject("MooseApp", MeshGeneratorMesh)
std::unique_ptr< T > copyConstruct(const T &object)
Copy constructs the object object.
Definition Factory.h:358
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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 addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
A thin libMesh::ReplicatedMesh subclass that carries an mfem::Mesh through the MeshGenerator pipeline...
Mesh generated from parameters.
virtual std::unique_ptr< MooseMesh > safeClone() const override
A safer version of the clone() method that hands back an allocated object wrapped in a smart pointer.
MeshGeneratorMesh(const InputParameters &parameters)
virtual void buildMesh() override
Must be overridden by child classes.
static InputParameters validParams()
static const std::string data_driven_generator_param
The name of the string parameter that sets the data driven generator.
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
Definition MooseApp.h:407
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
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition MooseMesh.C:3557
static InputParameters validParams()
Typical "Moose-style" constructor and copy constructor.
Definition MooseMesh.C:81
bool hasMeshBase() const
Whether mesh base object was constructed or not.
Definition MooseMesh.h:1244
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375