LCOV - code coverage report
Current view: top level - src/reporters - IterationInfo.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 25 25 100.0 %
Date: 2025-08-08 20:01:16 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 "IterationInfo.h"
      11             : #include "SubProblem.h"
      12             : #include "Transient.h"
      13             : 
      14             : registerMooseObject("MooseApp", IterationInfo);
      15             : 
      16             : InputParameters
      17       14405 : IterationInfo::validParams()
      18             : {
      19       14405 :   InputParameters params = GeneralReporter::validParams();
      20       14405 :   params.addClassDescription("Report the time and iteration information for the simulation.");
      21             : 
      22             :   MultiMooseEnum items(
      23       14405 :       "time timestep num_linear_iterations num_nonlinear_iterations num_fixed_point_iterations");
      24       14405 :   params.addParam<MultiMooseEnum>(
      25             :       "items",
      26             :       items,
      27             :       "The iteration information to output, if nothing is provided everything will be output.");
      28       14405 :   params.addParam<NonlinearSystemName>(
      29             :       "nl_sys", "nl0", "The nonlinear system that this should report iteration info for.");
      30       28810 :   return params;
      31       14405 : }
      32             : 
      33          70 : IterationInfo::IterationInfo(const InputParameters & parameters)
      34             :   : GeneralReporter(parameters),
      35          70 :     _items(getParam<MultiMooseEnum>("items")),
      36          70 :     _time_value(declareHelper<Real>("time", _dummy_real)),
      37          70 :     _time_step_value(declareHelper<unsigned int>("timestep", _dummy_unsigned_int)),
      38          70 :     _num_linear(declareHelper<unsigned int>("num_linear_iterations", _dummy_unsigned_int)),
      39          70 :     _num_nonlinear(declareHelper<unsigned int>("num_nonlinear_iterations", _dummy_unsigned_int)),
      40          70 :     _num_fixed_point(
      41          70 :         declareHelper<unsigned int>("num_fixed_point_iterations", _dummy_unsigned_int)),
      42         140 :     _nl_sys_num(_subproblem.nlSysNum(getParam<NonlinearSystemName>("nl_sys")))
      43             : {
      44          70 : }
      45             : 
      46             : void
      47         420 : IterationInfo::execute()
      48             : {
      49         420 :   _time_value = _t;
      50         420 :   _time_step_value = _t_step;
      51         420 :   _num_nonlinear = _subproblem.nNonlinearIterations(_nl_sys_num);
      52         420 :   _num_linear = _subproblem.nLinearIterations(_nl_sys_num);
      53         420 :   _num_fixed_point = _app.getExecutioner()->fixedPointSolve().numFixedPointIts();
      54         420 : }

Generated by: LCOV version 1.14