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 : #include "KokkosFunction.h" 11 : 12 : #include "FunctionInterface.h" 13 : #include "FEProblemBase.h" 14 : 15 508913 : FunctionInterface::FunctionInterface(const FunctionInterface & object, 16 289687 : const Moose::Kokkos::FunctorCopy &) 17 289687 : : _fni_object(object._fni_object), 18 289687 : _fni_params(object._fni_params), 19 289687 : _fni_feproblem(object._fni_feproblem), 20 289687 : _fni_tid(object._fni_tid) 21 : { 22 508913 : } 23 : 24 : Moose::Kokkos::Function 25 90 : FunctionInterface::getKokkosFunction(const std::string & name) const 26 : { 27 90 : return getKokkosFunctionByName(_fni_params.get<FunctionName>(name)); 28 : } 29 : 30 : Moose::Kokkos::Function 31 117 : FunctionInterface::getKokkosFunctionByName(const FunctionName & name) const 32 : { 33 117 : if (!_fni_object.isKokkosObject()) 34 0 : _fni_object.mooseError("Attempted to retrieve a Kokkos function from a non-Kokkos object."); 35 : 36 117 : return _fni_feproblem.getKokkosFunction(name); 37 : } 38 : 39 : bool 40 0 : FunctionInterface::hasKokkosFunction(const std::string & param_name) const 41 : { 42 0 : return hasKokkosFunctionByName(_fni_params.get<FunctionName>(param_name)); 43 : } 44 : 45 : bool 46 0 : FunctionInterface::hasKokkosFunctionByName(const FunctionName & name) const 47 : { 48 0 : if (!_fni_object.isKokkosObject()) 49 0 : _fni_object.mooseError("Attempted to retrieve a Kokkos function from a non-Kokkos object."); 50 : 51 0 : return _fni_feproblem.hasKokkosFunction(name); 52 : } 53 : 54 : const Moose::FunctionBase * 55 36 : FunctionInterface::getKokkosFunctionByNameHelper(const FunctionName & name) const 56 : { 57 36 : if (!_fni_object.isKokkosObject()) 58 0 : _fni_object.mooseError("Attempted to retrieve a Kokkos function from a non-Kokkos object."); 59 : 60 36 : return &_fni_feproblem.getKokkosFunction<Moose::FunctionBase>(name); 61 : }