LCOV - code coverage report
Current view: top level - include/utils - SwiftConstantInterface.h (source / functions) Hit Total Coverage
Test: idaholab/swift: #92 (25e020) with base b3cd84 Lines: 3 3 100.0 %
Date: 2025-09-10 17:10:32 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /**********************************************************************/
       2             : /*                    DO NOT MODIFY THIS HEADER                       */
       3             : /*             Swift, a Fourier spectral solver for MOOSE             */
       4             : /*                                                                    */
       5             : /*            Copyright 2024 Battelle Energy Alliance, LLC            */
       6             : /*                        ALL RIGHTS RESERVED                         */
       7             : /**********************************************************************/
       8             : 
       9             : #pragma once
      10             : 
      11             : #include "SwiftTypes.h"
      12             : #include "TensorProblem.h"
      13             : 
      14             : class InputParameters;
      15             : 
      16             : class SwiftConstantInterface
      17             : {
      18             : public:
      19             :   SwiftConstantInterface(const InputParameters & params);
      20             : 
      21             :   template <typename T>
      22             :   const T & getConstant(const std::string & param_name);
      23             :   template <typename T>
      24             :   const T & getConstantByName(const SwiftConstantName & name);
      25             : 
      26             :   template <typename T>
      27             :   void declareConstant(const std::string & param_name, const T & value);
      28             :   template <typename T>
      29             :   void declareConstantByName(const SwiftConstantName & name, const T & value);
      30             : 
      31             : protected:
      32             :   const InputParameters & _params;
      33             :   TensorProblem & _sci_tensor_problem;
      34             : };
      35             : 
      36             : template <typename T>
      37             : const T &
      38         332 : SwiftConstantInterface::getConstant(const std::string & param_name)
      39             : {
      40         332 :   return getConstantByName<T>(_params.get<SwiftConstantName>(param_name));
      41             : }
      42             : 
      43             : template <typename T>
      44             : const T &
      45             : SwiftConstantInterface::getConstantByName(const SwiftConstantName & name)
      46             : {
      47         332 :   return _sci_tensor_problem.getConstant<T>(name);
      48             : }
      49             : 
      50             : template <typename T>
      51             : void
      52             : SwiftConstantInterface::declareConstant(const std::string & param_name, const T & value)
      53             : {
      54             :   declareConstantByName<T>(_params.get<SwiftConstantName>(param_name), value);
      55             : }
      56             : 
      57             : template <typename T>
      58             : void
      59             : SwiftConstantInterface::declareConstantByName(const SwiftConstantName & name, const T & value)
      60             : {
      61             :   _sci_tensor_problem.declareConstant<T>(name, value);
      62             : }

Generated by: LCOV version 1.14