LCOV - code coverage report
Current view: top level - include/libtorch/postprocessors - LibtorchControlValuePostprocessor.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 8601ad Lines: 2 2 100.0 %
Date: 2025-07-18 13:27:08 Functions: 2 2 100.0 %
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             : #ifdef LIBTORCH_ENABLED
      11             : 
      12             : #pragma once
      13             : 
      14             : #include "LibtorchNeuralNetControl.h"
      15             : #include "GeneralPostprocessor.h"
      16             : #include "InputParameterWarehouse.h"
      17             : 
      18             : /**
      19             :  * A class for querying output signals from LibtorchNeuralNetControl and
      20             :  * derived objects.
      21             :  */
      22             : class LibtorchControlValuePostprocessor : public GeneralPostprocessor
      23             : {
      24             : public:
      25             :   static InputParameters validParams();
      26             : 
      27             :   /**
      28             :    * Class constructor
      29             :    * @param parameters The input parameters
      30             :    */
      31             :   LibtorchControlValuePostprocessor(const InputParameters & parameters);
      32             : 
      33             :   ///@{
      34             :   /**
      35             :    * No action taken
      36             :    */
      37          78 :   void initialize() override {}
      38          78 :   void execute() override {}
      39             :   ///@}
      40             : 
      41             :   /// We override this to setup the linking withthe control object. We need to do it here
      42             :   /// because the PPs are contructed before te Control objects.
      43             :   void initialSetup() override;
      44             : 
      45             :   /**
      46             :    * Returns the value of the latest response of a neural-network-based controller.
      47             :    * This means that we grab current response value stored wihtin the controller.
      48             :    */
      49             :   virtual Real getValue() const override;
      50             : 
      51             : private:
      52             :   unsigned int _signal_index;
      53             : 
      54             :   // This can't be const beause PPs are constructed before Controls
      55             :   const LibtorchNeuralNetControl * _libtorch_nn_control;
      56             : };
      57             : 
      58             : #endif

Generated by: LCOV version 1.14