https://mooseframework.inl.gov
MFEMScalarFESpace.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 "MFEMScalarFESpace.h"
13 
15 
18 {
20  params.addClassDescription("Convenience class to construct scalar finite element spaces.");
21  MooseEnum fec_types("H1 L2", "H1");
22  params.addParam<MooseEnum>("fec_type", fec_types, "Specifies the family of FE shape functions.");
23  MooseEnum basis_types("GaussLegendre GaussLobatto Positive OpenUniform ClosedUniform "
24  "OpenHalfUniform Serendipity ClosedGL IntegratedGLL",
25  "GaussLobatto");
26  params.addParam<MooseEnum>(
27  "basis",
28  basis_types,
29  "Specifies the basis used for scalar elements. H1 spaces require a closed basis "
30  "(GaussLobatto Positive ClosedUniform Serendipity ClosedGL)");
31 
32  return params;
33 }
34 
36  : MFEMSimplifiedFESpace(parameters), _fec_type(getParam<MooseEnum>("fec_type"))
37 {
38 }
39 
40 std::string
42 {
43  std::string basis =
44  _fec_type == "L2"
45  ? "_T" + std::to_string(getParam<MooseEnum>("basis"))
46  : "@" + std::string({mfem::BasisType::GetChar(getParam<MooseEnum>("basis"))});
47 
48  // This is to get around an MFEM bug (to be removed in #31525)
49  basis = (basis == "@G" || basis == "_T0") ? "" : basis;
50 
51  return _fec_type + basis + "_" + std::to_string(getProblemDim()) + "D_P" +
52  std::to_string(_fec_order);
53 }
54 
55 int
57 {
58  return 1;
59 }
60 
61 #endif
registerMooseObject("MooseApp", MFEMScalarFESpace)
virtual int getVDim() const override
Get the number of degrees of freedom per basis function needed in this finite element space...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
MFEMScalarFESpace(const InputParameters &parameters)
const int _fec_order
Order of the basis functions in the finite element collection.
virtual std::string getFECName() const override
Get the name of the desired FECollection.
static InputParameters validParams()
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...
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...
const std::string _fec_type
Name of the family of finite element collections to use.
int getProblemDim() const
Returns the dimension of the problem (i.e., the highest dimension of the reference elements in the me...
Class with common parameters for MFEMVectorFESpace and MFEMScalarFESpace.