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 : #pragma once 11 : 12 : #include "KokkosFunction.h" 13 : #include "KokkosFunctionParser.h" 14 : 15 : #include "MooseParsedFunctionBase.h" 16 : 17 : class FEProblemBase; 18 : 19 : class KokkosParsedFunction : public Moose::Kokkos::FunctionBase, public MooseParsedFunctionBase 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : 24 : KokkosParsedFunction(const InputParameters & parameters); 25 : KokkosParsedFunction(const KokkosParsedFunction & function); 26 : 27 : using Real3 = Moose::Kokkos::Real3; 28 : 29 2486040 : KOKKOS_FUNCTION Real value(Real t, Real3 p) const { return _evaluator.eval(t, p); } 30 : 31 : /** 32 : * Create the parsed function 33 : */ 34 : virtual void initialSetup() override; 35 : 36 : protected: 37 : /** 38 : * Parsed function expression 39 : */ 40 : const std::string _expression; 41 : /** 42 : * Parsed function builder 43 : */ 44 : std::unique_ptr<Moose::Kokkos::RPNBuilder> _builder; 45 : /** 46 : * Parsed function evaluator 47 : */ 48 : Moose::Kokkos::RPNEvaluator _evaluator; 49 : /** 50 : * Constant values associated with symbols 51 : */ 52 : std::vector<Real> _symbol_values; 53 : /** 54 : * Functions associated with symbols 55 : */ 56 : std::vector<Moose::Kokkos::Function> _symbol_functions; 57 : 58 : private: 59 : FEProblemBase & _problem; 60 : };