https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMFESpace.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
12#include "MFEMFESpace.h"
13#include "MFEMProblem.h"
14
17{
19 params.registerBase("MFEMFESpace");
20 params.registerSystemAttributeName("MFEMFESpace");
21 MooseEnum ordering("NODES VDIM", "VDIM");
22 params.addParam<MooseEnum>("ordering", ordering, "Ordering style to use for vector DoFs.");
23 params.addParam<int>("vdim", 1, "The number of degrees of freedom per basis function.");
24 params.addParam<std::string>("submesh",
25 "Submesh to define the FESpace on. Leave blank to use base mesh.");
26 return params;
27}
28
30 : MFEMObject(parameters),
31 _ordering(parameters.get<MooseEnum>("ordering")),
32 _pmesh(
33 parameters.isParamValid("submesh")
34 ? getMFEMProblem().getProblemData().submeshes.GetRef(getParam<std::string>("submesh"))
35 : const_cast<mfem::ParMesh &>(getMFEMProblem().mesh().getMFEMParMesh()))
36{
37}
38
39void
41{
42 _fec = std::shared_ptr<mfem::FiniteElementCollection>(
43 mfem::FiniteElementCollection::New(getFECName().c_str()));
44}
45
46void
48{
49 _fespace =
50 std::make_shared<mfem::ParFiniteElementSpace>(&_pmesh, getFEC().get(), getVDim(), _ordering);
51}
52
53#endif
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void registerSystemAttributeName(const std::string &value)
This method is used to define the MOOSE system name that is used by the TheWarehouse object for stori...
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 registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System.
std::shared_ptr< mfem::FiniteElementCollection > _fec
Stores the constructed fecollection.
Definition MFEMFESpace.h:74
std::shared_ptr< mfem::ParFiniteElementSpace > _fespace
Stores the constructed fespace.
Definition MFEMFESpace.h:79
virtual int getVDim() const =0
Get the number of degrees of freedom per basis function needed in this finite element space.
void buildFEC() const
Constructs the fec from the fec name.
Definition MFEMFESpace.C:40
mfem::ParMesh & _pmesh
Mesh FESpace is defined with respect to.
Definition MFEMFESpace.h:68
MFEMFESpace(const InputParameters &parameters)
Definition MFEMFESpace.C:29
static InputParameters validParams()
Definition MFEMFESpace.C:16
void buildFESpace() const
Constructs the fespace.
Definition MFEMFESpace.C:47
const int _ordering
Type of ordering of the vector dofs when _vdim > 1.
Definition MFEMFESpace.h:57
std::shared_ptr< mfem::FiniteElementCollection > getFEC() const
Returns a shared pointer to the constructed fec.
Definition MFEMFESpace.h:44
virtual std::string getFECName() const =0
Get the name of the desired FECollection.
Thin base for MFEM objects backed directly by MooseObject instead of UserObject.
Definition MFEMObject.h:30
static InputParameters validParams()
Declare the common parameters required by MFEM MooseObject-backed classes.
Definition MFEMObject.C:17
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
MeshBase & mesh