LCOV - code coverage report
Current view: top level - src/mfem/utils - CoefficientMap.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 20 20 100.0 %
Date: 2025-07-17 01:28:37 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 MFEM_ENABLED
      11             : #include "CoefficientMap.h"
      12             : 
      13             : namespace Moose::MFEM
      14             : {
      15             : template <>
      16             : VectorMap::PWData
      17          22 : VectorMap::emptyPWData(std::shared_ptr<mfem::VectorCoefficient> coeff)
      18             : {
      19          44 :   return std::make_tuple(this->make<mfem::PWVectorCoefficient>(coeff->GetVDim()),
      20          66 :                          std::map<const std::string, std::shared_ptr<mfem::VectorCoefficient>>());
      21             : }
      22             : 
      23             : template <>
      24             : MatrixMap::PWData
      25          13 : MatrixMap::emptyPWData(std::shared_ptr<mfem::MatrixCoefficient> coeff)
      26             : {
      27             :   return std::make_tuple(
      28          26 :       this->make<mfem::PWMatrixCoefficient>(coeff->GetHeight(), coeff->GetWidth()),
      29          39 :       std::map<const std::string, std::shared_ptr<mfem::MatrixCoefficient>>());
      30             : }
      31             : 
      32             : template <>
      33             : void
      34          34 : VectorMap::checkPWData(std::shared_ptr<mfem::VectorCoefficient> coeff,
      35             :                        std::shared_ptr<mfem::PWVectorCoefficient> existing_pw,
      36             :                        const std::string & name)
      37             : {
      38          34 :   const int new_dim = coeff->GetVDim(), old_dim = existing_pw->GetVDim();
      39          34 :   if (new_dim != old_dim)
      40           6 :     mooseError("Trying to assign vector of dimension " + std::to_string(new_dim) +
      41           7 :                " to property '" + name + "' with dimension dimension " + std::to_string(old_dim));
      42          33 : }
      43             : 
      44             : template <>
      45             : void
      46          19 : MatrixMap::checkPWData(std::shared_ptr<mfem::MatrixCoefficient> coeff,
      47             :                        std::shared_ptr<mfem::PWMatrixCoefficient> existing_pw,
      48             :                        const std::string & name)
      49             : {
      50          19 :   const int new_height = coeff->GetHeight(), new_width = coeff->GetWidth(),
      51          19 :             old_height = existing_pw->GetHeight(), old_width = existing_pw->GetWidth();
      52          19 :   if (new_height != old_height || new_width != old_width)
      53           8 :     mooseError("Trying to assign matrix with dimensions (" + std::to_string(new_height) + ", " +
      54          10 :                std::to_string(new_width) + ") to property '" + name + "' with dimensions (" +
      55           9 :                std::to_string(old_height) + ", " + std::to_string(old_width) + ")");
      56          18 : }
      57             : }
      58             : 
      59             : #endif

Generated by: LCOV version 1.14