LCOV - code coverage report
Current view: top level - src/mfem/fespaces - MFEMGenericFESpace.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 22 23 95.7 %
Date: 2025-07-17 01:28:37 Functions: 6 6 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 MFEM_ENABLED
      11             : 
      12             : #include "MFEMGenericFESpace.h"
      13             : #include "MFEMProblem.h"
      14             : 
      15             : registerMooseObject("MooseApp", MFEMGenericFESpace);
      16             : 
      17             : InputParameters
      18        8716 : MFEMGenericFESpace::validParams()
      19             : {
      20        8716 :   InputParameters params = MFEMFESpace::validParams();
      21        8716 :   params.addClassDescription("Class for creating arbitrary MFEM finite element spaces. It requires "
      22             :                              "the user to have some knowledge of how MFEM works.");
      23        8716 :   params.addRequiredParam<std::string>("fec_name",
      24             :                                        "The name of the finite element collection to use for this "
      25             :                                        "space. See MFEM documentation for details.");
      26        8716 :   params.addParam<int>("vdim", 1, "The number of degrees of freedom per basis function.");
      27        8716 :   return params;
      28           0 : }
      29             : 
      30          31 : MFEMGenericFESpace::MFEMGenericFESpace(const InputParameters & parameters)
      31             :   : MFEMFESpace(parameters),
      32          31 :     _fec_name(parameters.get<std::string>("fec_name")),
      33          62 :     _vdim(parameters.get<int>("vdim"))
      34             : {
      35          31 : }
      36             : 
      37             : std::string
      38         105 : MFEMGenericFESpace::getFECName() const
      39             : {
      40         105 :   return _fec_name;
      41             : }
      42             : 
      43             : int
      44          87 : MFEMGenericFESpace::getVDim() const
      45             : {
      46          87 :   return _vdim;
      47             : }
      48             : 
      49             : bool
      50          55 : MFEMGenericFESpace::isScalar() const
      51             : {
      52          55 :   return !isVector();
      53             : }
      54             : 
      55             : bool
      56          74 : MFEMGenericFESpace::isVector() const
      57             : {
      58          74 :   std::string fec = getFECName();
      59          74 :   if (!strncmp(fec.c_str(), "RT", 2) || !strncmp(fec.c_str(), "ND", 2))
      60          18 :     return true;
      61             :   // FIXME: This assumes ALL other possible FEC types be scalar. Is that correct?
      62          56 :   return getVDim() > 1;
      63          74 : }
      64             : 
      65             : #endif

Generated by: LCOV version 1.14