https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMParsedCoefficient.C
Go to the documentation of this file.
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
13
15 const unsigned & arity,
16 const std::vector<std::reference_wrapper<mfem::Coefficient>> & coefficients,
18 : _coefficients(coefficients), _sym_function(sym_function), _vals(arity), _transip(3)
19{
20}
21
22mfem::real_t
23MFEMParsedCoefficient::Eval(mfem::ElementTransformation & T, const mfem::IntegrationPoint & ip)
24{
25 for (unsigned i = 0; i < _coefficients.size(); i++)
26 _vals[i] = _coefficients[i].get().Eval(T, ip);
27
28 T.Transform(ip, _transip);
29
30 for (int i = 0; i < 3; i++)
31 _vals[_coefficients.size() + i] = i < _transip.Size() ? _transip(i) : 0.;
32
33 _vals[_coefficients.size() + 3] = GetTime();
34
35 return _sym_function->Eval(_vals.GetData());
36}
37
38#endif
std::shared_ptr< SymFunction > SymFunctionPtr
Shorthand for an smart pointer to an autodiff function parser object.
const FunctionParserUtils< false >::SymFunctionPtr & _sym_function
const std::vector< std::reference_wrapper< mfem::Coefficient > > & _coefficients
mfem::Array< mfem::real_t > _vals
MFEMParsedCoefficient(const unsigned &arity, const std::vector< std::reference_wrapper< mfem::Coefficient > > &coefs, const FunctionParserUtils< false >::SymFunctionPtr &sym_function)
mfem::real_t Eval(mfem::ElementTransformation &T, const mfem::IntegrationPoint &ip) override