LCOV - code coverage report
Current view: top level - src/postprocessors - Receiver.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 21 22 95.5 %
Date: 2025-07-17 01:28:37 Functions: 3 3 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             : #include "Receiver.h"
      11             : 
      12             : registerMooseObject("MooseApp", Receiver);
      13             : 
      14             : InputParameters
      15       23545 : Receiver::validParams()
      16             : {
      17       23545 :   InputParameters params = GeneralPostprocessor::validParams();
      18       23545 :   params.addParam<Real>("default", 0, "The default value");
      19       70635 :   params.addParam<bool>(
      20       47090 :       "initialize_old", true, "Initialize the old postprocessor value with the default value");
      21             : 
      22       23545 :   params.addClassDescription("Reports the value stored in this processor, which is usually filled "
      23             :                              "in by another object. The Receiver does not compute its own value.");
      24       23545 :   return params;
      25           0 : }
      26             : 
      27        4640 : Receiver::Receiver(const InputParameters & params)
      28             :   : GeneralPostprocessor(params),
      29        4640 :     _initialize_old(getParam<bool>("initialize_old")),
      30        9280 :     _my_value(getPostprocessorValueByName(name()))
      31             : {
      32        4640 :   const PostprocessorReporterName r_name(name());
      33        4640 :   auto & write_data = _fe_problem.getReporterData(ReporterData::WriteKey());
      34             : 
      35             :   // Request that we need the old and older time values for this Receiver
      36        4640 :   write_data.needReporterTimeIndex<PostprocessorValue>(r_name, 2);
      37             : 
      38             :   // Initialize values
      39        4640 :   const Real & value = getParam<Real>("default");
      40        4640 :   write_data.setReporterValue<PostprocessorValue>(r_name, value, 0);
      41        4640 :   if (_initialize_old)
      42             :   {
      43        4628 :     write_data.setReporterValue<PostprocessorValue>(r_name, value, 1);
      44        4628 :     write_data.setReporterValue<PostprocessorValue>(r_name, value, 2);
      45             :   }
      46        4640 : }
      47             : 
      48             : Real
      49       63136 : Receiver::getValue() const
      50             : {
      51             :   // Return the stored value (references stored value in getPostprocessorData)
      52       63136 :   return _my_value;
      53             : }

Generated by: LCOV version 1.14