LCOV - code coverage report
Current view: top level - src/mfem/fespaces - MFEMScalarFESpace.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 26 26 100.0 %
Date: 2025-08-08 20:01:16 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14