https://mooseframework.inl.gov
IterationInfo.h
Go to the documentation of this file.
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 #pragma once
11 
12 #include "GeneralReporter.h"
13 class Transient;
14 
19 {
20 public:
23  virtual void initialize() override {}
24  virtual void finalize() override {}
25  virtual void execute() override;
26 
27 protected:
29 
30  // Reporter values to return (all are computed as "replicated" values)
32  unsigned int & _time_step_value;
33  unsigned int & _num_linear;
34  unsigned int & _num_nonlinear;
35  unsigned int & _num_fixed_point;
36 
38  const unsigned int _nl_sys_num;
39 
40  // Used to allow for optional declare
42  unsigned int _dummy_unsigned_int = 0;
43 
44  // Helper to perform optional declaration based on "_items"
45  template <typename T>
46  T & declareHelper(const std::string & item_name, T & _dummy, bool extra_check = true);
47 };
48 
49 template <typename T>
50 T &
51 IterationInfo::declareHelper(const std::string & item_name, T & dummy, bool extra_check)
52 {
53  return (extra_check && (!_items.isValid() || _items.isValueSet(item_name)))
54  ? declareValueByName<T>(item_name, REPORTER_MODE_REPLICATED)
55  : dummy;
56 }
unsigned int & _num_nonlinear
Definition: IterationInfo.h:34
Transient executioners usually loop through a number of timesteps...
Definition: Transient.h:20
Reporter object that has a single execution of the "execute" method for for each execute flag...
unsigned int _dummy_unsigned_int
Definition: IterationInfo.h:42
unsigned int & _num_linear
Definition: IterationInfo.h:33
virtual bool isValid() const override
IsValid.
static InputParameters validParams()
Definition: IterationInfo.C:17
Real & _time_value
Definition: IterationInfo.h:31
const unsigned int _nl_sys_num
The nonlinear system that this should report iteration info for.
Definition: IterationInfo.h:38
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
unsigned int & _time_step_value
Definition: IterationInfo.h:32
virtual void execute() override
Execute method.
Definition: IterationInfo.C:47
IterationInfo(const InputParameters &parameters)
Definition: IterationInfo.C:33
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition: IterationInfo.h:23
unsigned int & _num_fixed_point
Definition: IterationInfo.h:35
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
const MultiMooseEnum & _items
Definition: IterationInfo.h:28
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
T & declareHelper(const std::string &item_name, T &_dummy, bool extra_check=true)
Definition: IterationInfo.h:51
Report the time and iteration information for the simulation.
Definition: IterationInfo.h:18
const InputParameters & parameters() const
Get the parameters of the object.
const ReporterMode REPORTER_MODE_REPLICATED
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
virtual void finalize() override
Finalize.
Definition: IterationInfo.h:24