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 "CoefficientMap.h" 13 : 14 : namespace Moose::MFEM 15 : { 16 : template <> 17 : VectorMap::PWData 18 39 : VectorMap::emptyPWData(std::shared_ptr<mfem::VectorCoefficient> coeff) 19 : { 20 78 : return std::make_tuple(this->make<mfem::PWVectorCoefficient>(coeff->GetVDim()), 21 117 : std::map<const std::string, std::shared_ptr<mfem::VectorCoefficient>>()); 22 : } 23 : 24 : template <> 25 : MatrixMap::PWData 26 26 : MatrixMap::emptyPWData(std::shared_ptr<mfem::MatrixCoefficient> coeff) 27 : { 28 : return std::make_tuple( 29 52 : this->make<mfem::PWMatrixCoefficient>(coeff->GetHeight(), coeff->GetWidth()), 30 78 : std::map<const std::string, std::shared_ptr<mfem::MatrixCoefficient>>()); 31 : } 32 : 33 : template <> 34 : void 35 58 : VectorMap::checkPWData(std::shared_ptr<mfem::VectorCoefficient> coeff, 36 : std::shared_ptr<mfem::PWVectorCoefficient> existing_pw, 37 : const std::string & name) 38 : { 39 58 : const int new_dim = coeff->GetVDim(), old_dim = existing_pw->GetVDim(); 40 58 : if (new_dim != old_dim) 41 12 : mooseError("Trying to assign vector of dimension " + std::to_string(new_dim) + 42 14 : " to property '" + name + "' with dimension dimension " + std::to_string(old_dim)); 43 56 : } 44 : 45 : template <> 46 : void 47 38 : MatrixMap::checkPWData(std::shared_ptr<mfem::MatrixCoefficient> coeff, 48 : std::shared_ptr<mfem::PWMatrixCoefficient> existing_pw, 49 : const std::string & name) 50 : { 51 38 : const int new_height = coeff->GetHeight(), new_width = coeff->GetWidth(), 52 38 : old_height = existing_pw->GetHeight(), old_width = existing_pw->GetWidth(); 53 38 : if (new_height != old_height || new_width != old_width) 54 16 : mooseError("Trying to assign matrix with dimensions (" + std::to_string(new_height) + ", " + 55 20 : std::to_string(new_width) + ") to property '" + name + "' with dimensions (" + 56 18 : std::to_string(old_height) + ", " + std::to_string(old_width) + ")"); 57 36 : } 58 : } 59 : 60 : #endif