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 MOOSE_MFEM_ENABLED 11 : 12 : #include "MFEMScalarFESpace.h" 13 : 14 : registerMooseObject("MooseApp", MFEMScalarFESpace); 15 : 16 : InputParameters 17 9270 : MFEMScalarFESpace::validParams() 18 : { 19 9270 : InputParameters params = MFEMSimplifiedFESpace::validParams(); 20 18540 : params.addClassDescription("Convenience class to construct scalar finite element spaces."); 21 37080 : MooseEnum fec_types("H1 L2", "H1", true); 22 37080 : params.addParam<MooseEnum>("fec_type", fec_types, "Specifies the family of FE shape functions."); 23 27810 : params.addParam<std::string>( 24 : "basis", "GaussLobatto", "Specifies the quadrature basis used for scalar elements."); 25 : 26 18540 : return params; 27 9270 : } 28 : 29 320 : MFEMScalarFESpace::MFEMScalarFESpace(const InputParameters & parameters) 30 320 : : MFEMSimplifiedFESpace(parameters), _fec_type(parameters.get<MooseEnum>("fec_type")) 31 : { 32 320 : } 33 : 34 : std::string 35 320 : MFEMScalarFESpace::getFECName() const 36 : { 37 960 : const char b = mfem::BasisType::GetChar(getBasis(getParam<std::string>("basis"))); 38 320 : 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 320 : if (_fec_type == "H1") 43 801 : basis = (basis == "G" ? "" : "@" + basis); 44 53 : else if (_fec_type == "L2") 45 : { 46 53 : if (basis != "g") 47 212 : mooseInfo("L2 finite element space only supports GaussLegendre basis. Ignoring " + 48 159 : getParam<std::string>("basis") + 49 : " basis choice and using GaussLegendre instead.\n"); 50 : 51 53 : basis = ""; 52 : } 53 : 54 640 : return _fec_type + basis + "_" + std::to_string(getProblemDim()) + "D_P" + 55 1280 : std::to_string(_fec_order); 56 320 : } 57 : 58 : int 59 320 : MFEMScalarFESpace::getVDim() const 60 : { 61 320 : return 1; 62 : } 63 : 64 : #endif