LCOV - code coverage report
Current view: top level - src/kokkos/functions - KokkosFunctionInterface.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31761 (28487c) with base 701993 Lines: 15 24 62.5 %
Date: 2025-11-11 13:51:07 Functions: 4 6 66.7 %
Legend: Lines: hit not hit

          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      262930 : FunctionInterface::FunctionInterface(const FunctionInterface & object,
      16      222032 :                                      const Moose::Kokkos::FunctorCopy &)
      17      222032 :   : _fni_object(object._fni_object),
      18      222032 :     _fni_params(object._fni_params),
      19      222032 :     _fni_feproblem(object._fni_feproblem),
      20      222032 :     _fni_tid(object._fni_tid)
      21             : {
      22      262930 : }
      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          90 : FunctionInterface::getKokkosFunctionByName(const FunctionName & name) const
      32             : {
      33             : #ifdef MOOSE_ENABLE_KOKKOS_GPU
      34           0 :   _fni_object.mooseError(
      35             :       "Retrieving a Kokkos function as abstract type is currently not supported for GPU.");
      36             : #endif
      37             : 
      38          90 :   if (!_fni_object.isKokkosObject())
      39           0 :     _fni_object.mooseError("Attempted to retrieve a Kokkos function from a non-Kokkos object.");
      40             : 
      41          90 :   return _fni_feproblem.getKokkosFunction(name);
      42             : }
      43             : 
      44             : bool
      45           0 : FunctionInterface::hasKokkosFunction(const std::string & param_name) const
      46             : {
      47           0 :   return hasKokkosFunctionByName(_fni_params.get<FunctionName>(param_name));
      48             : }
      49             : 
      50             : bool
      51           0 : FunctionInterface::hasKokkosFunctionByName(const FunctionName & name) const
      52             : {
      53           0 :   if (!_fni_object.isKokkosObject())
      54           0 :     _fni_object.mooseError("Attempted to retrieve a Kokkos function from a non-Kokkos object.");
      55             : 
      56           0 :   return _fni_feproblem.hasKokkosFunction(name);
      57             : }
      58             : 
      59             : const Moose::FunctionBase *
      60          14 : FunctionInterface::getKokkosFunctionByNameHelper(const FunctionName & name) const
      61             : {
      62          14 :   if (!_fni_object.isKokkosObject())
      63           0 :     _fni_object.mooseError("Attempted to retrieve a Kokkos function from a non-Kokkos object.");
      64             : 
      65          14 :   return &_fni_feproblem.getKokkosFunction<Moose::FunctionBase>(name);
      66             : }

Generated by: LCOV version 1.14