Line data Source code
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 MFEM_ENABLED 11 : 12 : #include "MFEMScalarFESpace.h" 13 : 14 : registerMooseObject("MooseApp", MFEMScalarFESpace); 15 : 16 : InputParameters 17 8904 : MFEMScalarFESpace::validParams() 18 : { 19 8904 : InputParameters params = MFEMSimplifiedFESpace::validParams(); 20 8904 : params.addClassDescription("Convenience class to construct scalar finite element spaces."); 21 8904 : MooseEnum fec_types("H1 L2", "H1", true); 22 8904 : params.addParam<MooseEnum>("fec_type", fec_types, "Specifies the family of FE shape functions."); 23 8904 : params.addParam<std::string>( 24 : "basis", "GaussLobatto", "Specifies the quadrature basis used for scalar elements."); 25 : 26 17808 : return params; 27 8904 : } 28 : 29 137 : MFEMScalarFESpace::MFEMScalarFESpace(const InputParameters & parameters) 30 137 : : MFEMSimplifiedFESpace(parameters), _fec_type(parameters.get<MooseEnum>("fec_type")) 31 : { 32 137 : } 33 : 34 : std::string 35 137 : MFEMScalarFESpace::getFECName() const 36 : { 37 137 : const char b = mfem::BasisType::GetChar(getBasis(getParam<std::string>("basis"))); 38 137 : std::string basis(1, b); 39 : 40 : // This is to get around an MFEM bug where if you pass the full name of the default element type, 41 : // it crashes 42 137 : if (_fec_type == "H1") 43 115 : basis = (basis == "G" ? "" : "@" + basis); 44 22 : else if (_fec_type == "L2") 45 : { 46 22 : if (basis != "g") 47 66 : mooseInfo("L2 finite element space only supports GaussLegendre basis. Ignoring " + 48 66 : getParam<std::string>("basis") + 49 : " basis choice and using GaussLegendre instead.\n"); 50 : 51 22 : basis = ""; 52 : } 53 : 54 274 : return _fec_type + basis + "_" + std::to_string(getProblemDim()) + "D_P" + 55 548 : std::to_string(_fec_order); 56 137 : } 57 : 58 : int 59 137 : MFEMScalarFESpace::getVDim() const 60 : { 61 137 : return 1; 62 : } 63 : 64 : #endif