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 "MFEMParsedCoefficient.h" 13 : 14 16 : MFEMParsedCoefficient::MFEMParsedCoefficient( 15 : const unsigned & arity, 16 : const std::vector<std::reference_wrapper<mfem::Coefficient>> & coefficients, 17 16 : const FunctionParserUtils<false>::SymFunctionPtr & sym_function) 18 16 : : _coefficients(coefficients), _sym_function(sym_function), _vals(arity), _transip(3) 19 : { 20 16 : } 21 : 22 : mfem::real_t 23 70686 : MFEMParsedCoefficient::Eval(mfem::ElementTransformation & T, const mfem::IntegrationPoint & ip) 24 : { 25 349110 : for (unsigned i = 0; i < _coefficients.size(); i++) 26 278424 : _vals[i] = _coefficients[i].get().Eval(T, ip); 27 : 28 70686 : T.Transform(ip, _transip); 29 : 30 282744 : for (int i = 0; i < 3; i++) 31 212058 : _vals[_coefficients.size() + i] = i < _transip.Size() ? _transip(i) : 0.; 32 : 33 70686 : _vals[_coefficients.size() + 3] = GetTime(); 34 : 35 70686 : return _sym_function->Eval(_vals.GetData()); 36 : } 37 : 38 : #endif