www.mooseframework.org
Output.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 <chrono>
13 
14 // MOOSE includes
15 #include "MooseObject.h"
16 #include "Restartable.h"
17 #include "MeshChangedInterface.h"
18 #include "SetupInterface.h"
19 #include "PostprocessorInterface.h"
21 #include "ReporterInterface.h"
22 #include "AdvancedOutputUtils.h"
23 #include "PerfGraphInterface.h"
24 #include "FunctionInterface.h"
25 
26 class MooseMesh;
27 class Times;
28 
29 // libMesh forward declarations
30 namespace libMesh
31 {
32 class EquationSystems;
33 }
34 
43 class Output : public MooseObject,
44  public Restartable,
45  public MeshChangedInterface,
46  public SetupInterface,
47  public FunctionInterface,
50  public ReporterInterface,
51  public PerfGraphInterface
52 {
53 public:
55 
65 
73  virtual Real time();
74 
81  virtual Real timeOld();
82 
86  virtual Real dt();
87 
91  virtual Real dtOld();
92 
96  virtual int timeStep();
97 
101  const unsigned int & interval() const;
102 
106  const MultiMooseEnum & executeOn() const;
107 
111  bool isAdvanced();
112 
118  virtual const OutputOnWarehouse & advancedExecuteOn() const;
119 
124 
129  void allowOutput(bool state) { _allow_output = state; }
130 
134  static void addDeprecatedInputParameters(InputParameters & params);
135 
142  virtual void outputStep(const ExecFlagType & type);
143 
144  const std::set<Real> & getSyncTimes() { return _sync_times; }
145 
146 protected:
150  virtual void output() = 0;
151 
156  virtual void solveSetup();
157 
162  virtual bool shouldOutput();
163 
168  virtual bool onInterval();
169 
177 
180 
183 
186 
188  EquationSystems * _es_ptr;
189 
192 
194  bool _sequence;
195 
198 
206 
209 
212 
214  int & _t_step;
215 
218 
221 
223  unsigned int _num;
224 
227 
229  unsigned int _time_step_interval;
230 
233 
236 
239 
241  std::set<Real> _sync_times;
242 
244  const Times * const _sync_times_object;
245 
248 
251 
254 
257 
260 
263 
266 
269 
271  // This is here rather than in AdvancedOutput to allow generic
272  // access to this data from the Console object for displaying
273  // the output settings.
275 
278 
280  std::chrono::time_point<std::chrono::steady_clock> _last_output_wall_time;
281 
284 
285  friend class OutputWarehouse;
286 };
bool _sequence
Flag for forcing call to outputSetup() with every call to output() (restartable)
Definition: Output.h:194
Real & _time_old
The old time.
Definition: Output.h:211
const MultiMooseEnum & executeOn() const
Get the current &#39;execute_on&#39; selections for display.
Definition: Output.C:393
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:21
virtual Real dtOld()
Get old time step size.
Definition: Output.C:378
A class for creating restricted objects.
Definition: Restartable.h:28
ExecFlagEnum _execute_on
The common Execution types; this is used as the default execution type for everything except system i...
Definition: Output.h:197
OutputOnWarehouse _advanced_execute_on
Storage for the individual component execute flags.
Definition: Output.h:274
virtual bool onInterval()
Returns true if the output interval is satisfied.
Definition: Output.C:286
virtual Real dt()
Get the current time step size.
Definition: Output.C:369
Real & _dt_old
Old time step delta.
Definition: Output.h:220
const unsigned int & interval() const
Get the output interval.
Real _start_time
Start outputting time.
Definition: Output.h:247
static ExecFlagEnum getDefaultExecFlagEnum()
Return an ExecFlagEnum object with the available execution flags for Output objects.
Definition: Output.C:113
Times objects are under the hood Reporters, but limited to a vector of Real.
Definition: Times.h:18
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
unsigned int _num
The number of outputs written.
Definition: Output.h:223
int & _t_step
The current time step.
Definition: Output.h:214
bool _transient
Transient flag (true = transient)
Definition: Output.h:182
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
static void addDeprecatedInputParameters(InputParameters &params)
A static helper for injecting deprecated parameters.
Real _wall_time_since_last_output
time in seconds since last output
Definition: Output.h:283
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual void solveSetup()
A method called just prior to the solve, this is used by PetscOutput to perform the necessary setup a...
Definition: Output.C:234
Output(const InputParameters &parameters)
Class constructor.
Definition: Output.C:120
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
Definition: Output.C:278
Based class for output objects.
Definition: Output.h:43
int _start_step
Start outputting at this time step.
Definition: Output.h:253
const Real _simulation_time_interval
Target simulation time between outputs.
Definition: Output.h:235
Real & _last_output_simulation_time
last simulation time an output has occured
Definition: Output.h:277
virtual Real timeOld()
Get the old output time.
Definition: Output.C:360
Interface for notifications that the mesh has changed.
EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Definition: Output.h:188
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:33
const bool _time_step_interval_set_by_addparam
Whether time step interval is set by AddParam.
Definition: Output.h:226
ExecFlagType _current_execute_flag
Current execute on flag.
Definition: Output.h:205
virtual void outputStep(const ExecFlagType &type)
A single call to this function should output all the necessary data for a single timestep.
Definition: Output.C:239
Interface to allow object to consume Reporter values.
int _end_step
End outputting at this time step.
Definition: Output.h:256
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
Definition: Output.h:179
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
bool _allow_output
Flag for disabling output.
Definition: Output.h:265
virtual void output()=0
Overload this function with the desired output activities.
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:51
A helper warehouse class for storing the "execute_on" settings for the various output types...
const Times *const _sync_times_object
Sync times object for this outputter.
Definition: Output.h:244
void allowOutput(bool state)
Method for controlling the allow output state.
Definition: Output.h:129
bool _sync_only
Flag for only executing at sync times.
Definition: Output.h:262
Real _wall_time_interval
Target wall time between outputs in seconds.
Definition: Output.h:238
Class for storing and utilizing output objects.
Interface for objects interacting with the PerfGraph.
unsigned int _time_step_interval
The output time step interval.
Definition: Output.h:229
bool _use_displaced
Flag for using displaced mesh.
Definition: Output.h:185
virtual Real time()
Get the output time.
Definition: Output.C:351
bool _is_advanced
Flag for advanced output testing.
Definition: Output.h:268
std::set< Real > _sync_times
Sync times for this outputter.
Definition: Output.h:241
void setWallTimeIntervalFromCommandLineParam()
Function to set the wall time interval based on value of command line parameter (used for testing onl...
Definition: Output.C:336
bool isAdvanced()
Returns true if this object is an AdvancedOutput object.
Definition: Output.C:399
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::chrono::time_point< std::chrono::steady_clock > _last_output_wall_time
last wall time an output has occured
Definition: Output.h:280
Real _t_tol
Time checking tolerance.
Definition: Output.h:259
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
Real _end_time
End outputting time.
Definition: Output.h:250
MooseMesh * _mesh_ptr
A convenience pointer to the current mesh (reference or displaced depending on "use_displaced") ...
Definition: Output.h:191
const InputParameters & parameters() const
Get the parameters of the object.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
virtual const OutputOnWarehouse & advancedExecuteOn() const
Returns the advanced &#39;execute_on&#39; settings.
Definition: Output.C:405
virtual int timeStep()
Get the current time step.
Definition: Output.C:387
const std::set< Real > & getSyncTimes()
Definition: Output.h:144
static InputParameters validParams()
Definition: Output.C:32
Interface for objects that need to use functions.
Real & _time
The current time for output purposes.
Definition: Output.h:208
Real & _dt
Time step delta.
Definition: Output.h:217
const Real _min_simulation_time_interval
Minimum simulation time between outputs.
Definition: Output.h:232
Interface class for classes which interact with Postprocessors.