https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMMeshGeneratorMesh.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#ifdef MOOSE_MFEM_ENABLED
11
13#include "MFEMMeshCarrier.h"
14#include "libmesh/mesh_generation.h"
15
17
20{
22
23 // Mark this as a mesh-generator-based mesh so SetupMeshAction routes the
24 // pipeline output to us via setMeshBase() before buildMesh() is called.
25 params.set<bool>("_mesh_generator_mesh") = true;
26
28 "Mesh type for building an mfem::ParMesh from a chain of MFEMMeshGenerator objects.");
29
30 return params;
31}
32
34 : MFEMMesh(parameters)
35{
36}
37
38std::unique_ptr<MooseMesh>
43
44mfem::Mesh
46{
47 if (!hasMeshBase())
48 mooseError("MFEMMeshGeneratorMesh: the mesh base has not been set. "
49 "Ensure MFEM mesh generators are present in the input file.");
50
51 auto * carrier = dynamic_cast<MFEMMeshCarrier *>(&getMesh());
52 if (!carrier)
53 mooseError("MFEMMeshGeneratorMesh requires the final mesh generator to produce an MFEM mesh. "
54 "If you are using libMesh generators, use MeshGeneratorMesh instead.");
55
56 return std::move(*carrier->releaseMFEMMesh());
57}
58
59#endif
registerMooseObject("MooseApp", MFEMMeshGeneratorMesh)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
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 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...
MooseMesh subclass that consumes the MeshGenerator pipeline to build an mfem::ParMesh.
mfem::Mesh buildSerialMFEMMesh() override
Build and return the serial mfem::Mesh for this object.
MFEMMeshGeneratorMesh(const InputParameters &parameters)
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.
static InputParameters validParams()
Abstract MooseMesh base for all MFEM-backed mesh types (MFEMFileMesh, MFEMMeshGeneratorMesh).
Definition MFEMMesh.h:24
static InputParameters validParams()
Definition MFEMMesh.C:19
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
Definition MooseApp.h:407
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition MooseMesh.C:3559
bool hasMeshBase() const
Whether mesh base object was constructed or not.
Definition MooseMesh.h:1240
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375