www.mooseframework.org
Console.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 // MOOSE includes
13 #include "TableOutput.h"
14 
15 // Forward declarations
16 class Console;
17 
18 template <>
20 
24 class Console : public TableOutput
25 {
26 public:
31 
35  virtual ~Console();
36 
42  virtual void initialSetup() override;
43 
44  virtual void timestepSetup() override;
45 
56  virtual void output(const ExecFlagType & type) override;
57 
63  virtual std::string filename() override;
64 
68  static void petscSetupOutput();
69 
73  void meshChanged() override;
74 
80  static std::string outputNorm(const Real & old_norm, const Real & norm);
81 
86  {
88  mooseError(
89  "accessing console system information flags is not allowed after console initial setup");
90  return _system_info_flags;
91  }
92 
93 protected:
97  void init();
98 
102  virtual void outputInput() override;
103 
107  virtual void outputScalarVariables() override;
108 
112  virtual void outputPostprocessors() override;
113 
117  virtual void outputVectorPostprocessors() override
118  {
119  mooseError("Can't currently output VectorPostprocessors to the screen");
120  };
121 
125  virtual void outputSystemInformation() override;
126 
132  void writeTimestepInformation(bool output_dt);
133 
139  void write(std::string message, bool indent = true);
140 
149  void writeStreamToFile(bool append = true);
150 
154  void writeVariableNorms();
155 
157  unsigned int _max_rows;
158 
161 
164 
167 
170 
172  bool _verbose;
173 
175  std::stringstream _file_output_stream;
176 
178  bool _perf_log;
179 
181  unsigned int _perf_log_interval;
182 
185 
188 
191 
194 
197 
199  std::vector<Real> _outlier_multiplier;
200 
202  unsigned int _precision;
203 
204 private:
215  void mooseConsole(const std::string & message);
216 
218  const std::ostringstream & _console_buffer;
219 
222 
225 
228 
231 
232  friend class OutputWarehouse;
233 
234 private:
237 };
238 
InputParameters validParams< Console >()
Definition: Console.C:30
std::string indent(unsigned int spaces)
Create empty string for indenting.
Definition: ConsoleUtils.C:30
bool _libmesh_log
Control the display libMesh performance log.
Definition: Console.h:187
unsigned int _precision
Number of significant digits.
Definition: Console.h:202
static void petscSetupOutput()
Output string for setting up PETSC output.
Definition: Console.C:674
void writeVariableNorms()
Print the L2-norms for each variable.
Definition: Console.C:444
virtual void outputSystemInformation() override
Print system information.
Definition: Console.C:590
MooseEnum _fit_mode
The FormattedTable fit mode.
Definition: Console.h:160
bool _all_variable_norms
Flag for writing all variable norms.
Definition: Console.h:193
An output object for writing to the console (screen)
Definition: Console.h:24
bool _verbose
Flag for writing detailed time step information.
Definition: Console.h:172
bool _write_screen
Flag for controlling outputting console information to screen.
Definition: Console.h:169
const std::ostringstream & _console_buffer
Reference to cached messages from calls to _console.
Definition: Console.h:218
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void mooseError(Args &&... args) const
Definition: MooseObject.h:147
MultiMooseEnum & systemInfoFlags()
Return system information flags.
Definition: Console.h:85
bool _allow_changing_sysinfo_flag
A boolean for protecting _system_info_flags from being changed undesirably.
Definition: Console.h:236
virtual void output(const ExecFlagType &type) override
Customizes the order of output for the various components as well as adds additional output such as t...
Definition: Console.C:292
const std::string & type() const
Get the type of this object.
Definition: MooseObject.h:53
bool _outlier_variable_norms
Flag for writing outlier variable norms.
Definition: Console.h:196
bool _perf_header
State for the performance log header information.
Definition: Console.h:190
MultiMooseEnum _system_info_flags
Flags for controlling the what simulations information is shown.
Definition: Console.h:230
virtual std::string filename() override
Creates the output file name Appends the user-supplied &#39;file_base&#39; input parameter with a &#39;...
Definition: Console.C:280
virtual void outputPostprocessors() override
Prints the postprocessor table to the screen.
Definition: Console.C:557
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
bool _solve_log
State for solve performance log.
Definition: Console.h:184
std::stringstream _file_output_stream
Stream for storing information to be written to a file.
Definition: Console.h:175
void write(std::string message, bool indent=true)
Write message to screen and/or file.
Definition: Console.C:644
unsigned int _perf_log_interval
The interval at which the performance log is printed.
Definition: Console.h:181
virtual void initialSetup() override
Initial setup function Prints the system information, this is done here so that the system informatio...
Definition: Console.C:232
virtual void timestepSetup() override
Gets called at the beginning of the timestep before this object is asked to do its job...
Definition: Console.C:286
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
virtual void outputInput() override
Print the input file at the beginning of the simulation.
Definition: Console.C:544
virtual void outputScalarVariables() override
Prints the aux scalar variables table to the screen.
Definition: Console.C:572
void mooseConsole(const std::string &message)
Add a message to the output streams.
Definition: Console.C:664
unsigned int _max_rows
The max number of table rows.
Definition: Console.h:157
Class for storing and utilizing output objects.
Real _old_nonlinear_norm
Storage for the old non linear residual (needed for color output and only when used when printing to ...
Definition: Console.h:224
bool _write_file
Flag for controlling outputting console information to a file.
Definition: Console.h:166
virtual ~Console()
Destructor.
Definition: Console.C:217
bool _perf_log
State for all performance logging.
Definition: Console.h:178
void writeStreamToFile(bool append=true)
Write the file stream to the file.
Definition: Console.C:363
virtual void outputVectorPostprocessors() override
Not implemented.
Definition: Console.h:117
std::vector< Real > _outlier_multiplier
Multipliers for coloring variable residual norms (default [2, 0.8])
Definition: Console.h:199
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:21
void meshChanged() override
Performs console related printing when the mesh is changed.
Definition: Console.C:627
Real _old_linear_norm
Storage for the old linear residual (needed for color output and only when used when printing to the ...
Definition: Console.h:221
Base class for scalar variables and postprocessors output objects.
Definition: TableOutput.h:33
bool _scientific_time
Toggle for outputting time in time and dt in scientific notation.
Definition: Console.h:163
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
void writeTimestepInformation(bool output_dt)
Prints the time step information for the screen output.
Definition: Console.C:390
bool _print_mesh_changed_info
Flag for printing mesh information when the mesh changes.
Definition: Console.h:227
void init()
Adds the printing of system information to the init() method.
static std::string outputNorm(const Real &old_norm, const Real &norm)
A helper function for outputting norms in color.
Definition: Console.C:526
Console(const InputParameters &parameters)
Class constructor.
Definition: Console.C:161