Class for storing and utilizing output objects. More...
#include <OutputWarehouse.h>
Public Member Functions | |
OutputWarehouse (MooseApp &app) | |
Class constructor. More... | |
virtual | ~OutputWarehouse () |
void | addOutput (std::shared_ptr< Output > output) |
Adds an existing output object to the warehouse. More... | |
const std::set< OutputName > & | getOutputNames () |
Get a complete set of all output object names. More... | |
bool | hasOutput (const std::string &name) const |
Returns true if the output object exists. More... | |
bool | hasMaterialPropertyOutput (const std::string &name) const |
Returns true if the output object exists, and it supports material property output. More... | |
void | meshChanged () |
Calls the meshChanged method for every output object. More... | |
void | buildInterfaceHideVariables (const std::string &output_name, std::set< std::string > &hide) |
Return the list of hidden variables for the given output name. More... | |
void | setFileNumbers (std::map< std::string, unsigned int > input, unsigned int offset=0) |
Calls the setFileNumber method for every FileOutput output object. More... | |
std::map< std::string, unsigned int > | getFileNumbers () |
Extracts the file numbers from the output objects. More... | |
void | setCommonParameters (const InputParameters *params_ptr) |
Stores the common InputParameters object. More... | |
const InputParameters * | getCommonParameters () const |
Get a reference to the common output parameters. More... | |
std::set< Real > & | getSyncTimes () |
Return the sync times for all objects. More... | |
void | checkOutputs (const std::set< OutputName > &names, const bool supports_material_output=false) |
Test that the output names exist. More... | |
std::set< OutputName > | getAllMaterialPropertyOutputNames () const |
Returns all output names that support material output. More... | |
template<typename T > | |
T * | getOutput (const OutputName &name) |
Return an Output object by name. More... | |
template<typename T > | |
std::vector< T * > | getOutputs (const std::vector< OutputName > &names) |
Return a vector of objects by names. More... | |
template<typename T > | |
std::vector< T * > | getOutputs () const |
Return a vector of objects of a given type. More... | |
template<typename T > | |
std::vector< OutputName > | getOutputNames () |
Return a list of output objects with a given type. More... | |
const std::set< std::string > & | getReservedNames () const |
Return a set of reserved output names. More... | |
bool | isReservedName (const std::string &name) |
Test if the given name is reserved. More... | |
void | mooseConsole () |
Send current output buffer to Console output objects. More... | |
void | mooseConsole (std::ostringstream &buffer) |
Send a buffer to Console output objects. More... | |
std::ostringstream & | consoleBuffer () |
The buffered messages stream for Console objects. More... | |
void | bufferConsoleOutputsBeforeConstruction (bool buffer) |
Set if the outputs to Console before its construction are to be buffered or to screen directly. More... | |
void | reset () |
Reset the output system. More... | |
void | solveSetup () |
Calls the timestepSetup function for each of the output objects. More... | |
unsigned long long int | numPrinted () const |
The number of times something has been printed. More... | |
Protected Member Functions | |
PerfGraph & | perfGraph () |
Get the PerfGraph. More... | |
PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level) const |
Call to register a named section for timing. More... | |
PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const |
Call to register a named section for timing. More... | |
std::string | timedSectionName (const std::string §ion_name) const |
Static Protected Member Functions | |
static InputParameters | validParams () |
Protected Attributes | |
MooseApp & | _pg_moose_app |
The MooseApp that owns the PerfGraph. More... | |
const std::string | _prefix |
A prefix to use for all sections. More... | |
Private Member Functions | |
void | outputStep (ExecFlagType type) |
Calls the outputStep method for each output object. More... | |
void | forceOutput () |
Indicates that the next call to outputStep should be forced This is private, users should utilize FEProblemBase::forceOutput() More... | |
void | addOutputFilename (const OutputName &obj_name, const OutFileBase &filename) |
Adds the file name to the map of filenames being output with an associated object The main function of this object is to test that the same output file does not already exist in another object to protect against output files overwriting each other. More... | |
void | initialSetup () |
Calls the initialSetup function for each of the output objects. More... | |
void | timestepSetup () |
Calls the timestepSetup function for each of the output objects. More... | |
void | customSetup (const ExecFlagType &exec_type) |
Calls the setup function for each of the output objects. More... | |
void | jacobianSetup () |
Calls the jacobianSetup function for each of the output objects. More... | |
void | residualSetup () |
Calls the residualSetup function for each of the output objects. More... | |
void | subdomainSetup () |
Calls the subdomainSetup function for each of the output objects. More... | |
void | addInterfaceHideVariables (const std::string &output_name, const std::set< std::string > &variable_names) |
Insert variable names for hiding via the OutoutInterface. More... | |
void | setOutputExecutionType (ExecFlagType type) |
Sets the execution flag type. More... | |
void | flushConsoleBuffer () |
If content exists in the buffer, write it. More... | |
void | resetFileBase () |
Resets the file base for all FileOutput objects. More... | |
void | allowOutput (bool state) |
Ability to enable/disable output calls This is private, users should utilize FEProblemBase::allowOutput() More... | |
template<typename T > | |
void | allowOutput (bool state) |
Private Attributes | |
std::vector< std::shared_ptr< Output > > | _all_ptrs |
We are using std::shared_ptr to handle the cleanup of the pointers at the end of execution. More... | |
MooseApp & | _app |
MooseApp. More... | |
std::vector< Output * > | _all_objects |
All instances of objects (raw pointers) More... | |
bool | _buffer_action_console_outputs |
True to buffer console outputs in actions. More... | |
std::map< OutputName, Output * > | _object_map |
A map of the output pointers. More... | |
std::set< OutputName > | _object_names |
A set of output names. More... | |
std::map< OutputName, std::set< OutFileBase > > | _file_base_map |
List of object names. More... | |
const InputParameters * | _common_params_ptr |
Pointer to the common InputParameters (. More... | |
std::set< Real > | _sync_times |
Sync times for all objects. More... | |
std::string | _input_file_name |
Input file name for this output object. More... | |
std::map< OutputName, std::set< AuxVariableName > > | _material_output_map |
Map of output name and AuxVariable names to be output (used by auto Material output) More... | |
std::set< AuxVariableName > | _all_material_output_variables |
List of all variable created by auto material output. More... | |
std::set< std::string > | _reserved |
List of reserved names. More... | |
std::ostringstream | _console_buffer |
The stream for holding messages passed to _console prior to Output object construction. More... | |
std::map< std::string, std::set< std::string > > | _interface_map |
Storage for variables to hide as prescribed by the object via the OutputInterface. More... | |
ExecFlagType | _output_exec_flag |
The current output execution flag. More... | |
bool | _force_output |
Flag indicating that next call to outputStep is forced. More... | |
bool | _last_message_ended_in_newline |
Whether or not the last thing output by mooseConsole had a newline as the last character. More... | |
const std::ostringstream * | _last_buffer |
What the last buffer was that was printed. More... | |
std::atomic< unsigned long long int > | _num_printed |
Number of times the stream has been printed to. More... | |
Friends | |
class | FEProblemBase |
class | MaterialOutputAction |
class | OutputInterface |
class | PetscOutputInterface |
class | MooseApp |
Class for storing and utilizing output objects.
Definition at line 26 of file OutputWarehouse.h.
OutputWarehouse::OutputWarehouse | ( | MooseApp & | app | ) |
Class constructor.
Definition at line 25 of file OutputWarehouse.C.
|
virtual |
Definition at line 41 of file OutputWarehouse.C.
|
private |
Insert variable names for hiding via the OutoutInterface.
output_name | The name of the output object on which the variable is to be hidden |
variable_names | The names of the variables to be hidden |
This is a private method used by the OutputInterface system, it is not intended for any other purpose.
Definition at line 312 of file OutputWarehouse.C.
Referenced by MaterialOutputAction::act(), and OutputInterface::buildOutputHideVariableList().
Adds an existing output object to the warehouse.
output | Pointer to the output object It is the responsibility of the OutputWarehouse to delete the output objects add using this method |
Definition at line 102 of file OutputWarehouse.C.
Referenced by FEProblemBase::addOutput(), and AutomaticMortarGeneration::initOutput().
|
private |
Adds the file name to the map of filenames being output with an associated object The main function of this object is to test that the same output file does not already exist in another object to protect against output files overwriting each other.
obj_name | Name of an FileOutput object |
filename | Name of an output file (extracted from filename() method of the objects) |
Definition at line 155 of file OutputWarehouse.C.
Referenced by resetFileBase().
|
private |
Ability to enable/disable output calls This is private, users should utilize FEProblemBase::allowOutput()
Definition at line 383 of file OutputWarehouse.C.
Referenced by FEProblemBase::allowOutput().
|
private |
Definition at line 491 of file OutputWarehouse.h.
|
inline |
Set if the outputs to Console before its construction are to be buffered or to screen directly.
buffer | Ture to buffer |
Definition at line 208 of file OutputWarehouse.h.
void OutputWarehouse::buildInterfaceHideVariables | ( | const std::string & | output_name, |
std::set< std::string > & | hide | ||
) |
Return the list of hidden variables for the given output name.
output_name | The name of the output object for which the variables should be returned |
hide | The set of variables to hide which is built by this method |
Objects inheriting from the OutputInterface have the ability to control the output of variables associated with the objects (i.e., Marker elemental variable). This method returns a list of variables that should be hidden for the supplied object name due to the 'outputs' parameter being set by the object(s).
This method is used by Output::initOutputList to populate the correct hide lists for the output object, it is not intended for general use.
Definition at line 319 of file OutputWarehouse.C.
Referenced by AdvancedOutput::initOutputList().
void OutputWarehouse::checkOutputs | ( | const std::set< OutputName > & | names, |
const bool | supports_material_output = false |
||
) |
Test that the output names exist.
names | A vector of names to check |
supports_material_output | Optional parameter to check if all output objects associated with 'names' must support material property output |
This method will produce an error if any of the supplied names do not exist in the warehouse. Reserved names are not considered.
Definition at line 329 of file OutputWarehouse.C.
Referenced by CheckOutputAction::checkMaterialOutput(), CheckOutputAction::checkVariableOutput(), and AdvancedOutput::initPostprocessorOrVectorPostprocessorLists().
|
inline |
The buffered messages stream for Console objects.
Definition at line 202 of file OutputWarehouse.h.
|
private |
Calls the setup function for each of the output objects.
Definition at line 67 of file OutputWarehouse.C.
Referenced by FEProblemBase::customSetup().
|
private |
If content exists in the buffer, write it.
This is used by Console to make sure PETSc related output does not dump before buffered content. It is private because people shouldn't be messing with it.
Definition at line 252 of file OutputWarehouse.C.
Referenced by outputStep().
|
private |
Indicates that the next call to outputStep should be forced This is private, users should utilize FEProblemBase::forceOutput()
Definition at line 390 of file OutputWarehouse.C.
Referenced by FEProblemBase::forceOutput().
std::set< OutputName > OutputWarehouse::getAllMaterialPropertyOutputNames | ( | ) | const |
Returns all output names that support material output.
Definition at line 352 of file OutputWarehouse.C.
Referenced by MaterialOutputAction::act().
const InputParameters * OutputWarehouse::getCommonParameters | ( | ) | const |
Get a reference to the common output parameters.
Definition at line 300 of file OutputWarehouse.C.
Referenced by FEProblemBase::addOutput().
std::map< std::string, unsigned int > OutputWarehouse::getFileNumbers | ( | ) |
Extracts the file numbers from the output objects.
Definition at line 280 of file OutputWarehouse.C.
Referenced by MultiApp::createApp().
T * OutputWarehouse::getOutput | ( | const OutputName & | name | ) |
Return an Output object by name.
T | The Out put object type to return |
name | The name of the output object |
Definition at line 415 of file OutputWarehouse.h.
const std::set< OutputName > & OutputWarehouse::getOutputNames | ( | ) |
Get a complete set of all output object names.
Note, if this method is called prior to the creation of outputs in AddOutputAction it will create the proxy list of names from the action system. The main use is for the OutputInterface, specifically, when used with Postprocessors in the UserObjects block of the input file. UserObjects are created prior to Outputs objects, but OutputInterface needs the list of output names to operate correctly.
Definition at line 143 of file OutputWarehouse.C.
Referenced by OutputInterface::buildOutputHideVariableList().
std::vector< OutputName > OutputWarehouse::getOutputNames | ( | ) |
Return a list of output objects with a given type.
T | The output object type |
Definition at line 470 of file OutputWarehouse.h.
std::vector< T * > OutputWarehouse::getOutputs | ( | const std::vector< OutputName > & | names | ) |
Return a vector of objects by names.
T | The Output object type to return |
names | A vector of names of the output object |
Definition at line 434 of file OutputWarehouse.h.
Referenced by AutoCheckpointAction::act(), CheckOutputAction::checkConsoleOutput(), CheckOutputAction::checkPerfLogOutput(), ConsoleUtils::outputFrameworkInformation(), and ConsoleUtils::outputOutputInformation().
std::vector< T * > OutputWarehouse::getOutputs | ( | ) | const |
Return a vector of objects of a given type.
T | The Output object type to return |
Definition at line 449 of file OutputWarehouse.h.
const std::set< std::string > & OutputWarehouse::getReservedNames | ( | ) | const |
Return a set of reserved output names.
Definition at line 365 of file OutputWarehouse.C.
std::set< Real > & OutputWarehouse::getSyncTimes | ( | ) |
Return the sync times for all objects.
Definition at line 306 of file OutputWarehouse.C.
Referenced by TimePeriod::initialSetup().
bool OutputWarehouse::hasMaterialPropertyOutput | ( | const std::string & | name | ) | const |
Returns true if the output object exists, and it supports material property output.
name | The name of the output object for which to test for existence within the warehouse |
Definition at line 129 of file OutputWarehouse.C.
Referenced by checkOutputs().
bool OutputWarehouse::hasOutput | ( | const std::string & | name | ) | const |
Returns true if the output object exists.
name | The name of the output object for which to test for existence within the warehouse |
Definition at line 123 of file OutputWarehouse.C.
Referenced by FEProblemBase::addOutput(), checkOutputs(), getOutput(), and hasMaterialPropertyOutput().
|
private |
Calls the initialSetup function for each of the output objects.
Definition at line 49 of file OutputWarehouse.C.
Referenced by FEProblemBase::initialSetup().
bool OutputWarehouse::isReservedName | ( | const std::string & | name | ) |
Test if the given name is reserved.
name | The name to test |
Definition at line 371 of file OutputWarehouse.C.
Referenced by FEProblemBase::addOutput(), and checkOutputs().
|
private |
Calls the jacobianSetup function for each of the output objects.
Definition at line 81 of file OutputWarehouse.C.
Referenced by FEProblemBase::computeJacobianTags(), and FEProblemBase::computeLinearSystemTags().
void OutputWarehouse::meshChanged | ( | ) |
Calls the meshChanged method for every output object.
Definition at line 190 of file OutputWarehouse.C.
Referenced by MooseApp::setOutputPosition().
void OutputWarehouse::mooseConsole | ( | ) |
Send current output buffer to Console output objects.
Definition at line 199 of file OutputWarehouse.C.
Referenced by MooseBase::callMooseError(), flushConsoleBuffer(), FEProblemBase::initialSetup(), ConsoleStream::operator<<(), and ~OutputWarehouse().
void OutputWarehouse::mooseConsole | ( | std::ostringstream & | buffer | ) |
Send a buffer to Console output objects.
Definition at line 205 of file OutputWarehouse.C.
|
inline |
The number of times something has been printed.
Definition at line 228 of file OutputWarehouse.h.
Referenced by ConsoleStream::numPrinted().
|
private |
Calls the outputStep method for each output object.
type | The type execution flag (see Moose.h) |
This is private, users should utilize FEProblemBase::outputStep()
This is one of three locations where we explicitly flush the output buffers during a simulation: PetscOutput::petscNonlinearOutput() PetscOutput::petscLinearOutput() OutputWarehouse::outputStep()
All other Console output should be using newlines to avoid covering buffer errors and to avoid excessive I/O
Definition at line 164 of file OutputWarehouse.C.
Referenced by FEProblemBase::outputStep().
|
inherited |
Get the PerfGraph.
Definition at line 78 of file PerfGraphInterface.C.
Referenced by CommonOutputAction::act(), PerfGraphData::finalize(), and PerfGraphOutput::output().
|
protectedinherited |
Call to register a named section for timing.
section_name | The name of the code section to be timed |
level | The importance of the timer - lower is more important (0 will always come out) |
Definition at line 53 of file PerfGraphInterface.C.
|
protectedinherited |
Call to register a named section for timing.
section_name | The name of the code section to be timed |
level | The importance of the timer - lower is more important (0 will always come out) |
live_message | The message to be printed to the screen during execution |
print_dots | Whether or not progress dots should be printed for this section |
Definition at line 64 of file PerfGraphInterface.C.
void OutputWarehouse::reset | ( | ) |
Reset the output system.
Definition at line 396 of file OutputWarehouse.C.
|
private |
Resets the file base for all FileOutput objects.
Definition at line 410 of file OutputWarehouse.C.
Referenced by initialSetup(), and MooseApp::setOutputFileBase().
|
private |
Calls the residualSetup function for each of the output objects.
Definition at line 88 of file OutputWarehouse.C.
Referenced by FEProblemBase::computeResidualAndJacobian(), and FEProblemBase::computeResidualTags().
void OutputWarehouse::setCommonParameters | ( | const InputParameters * | params_ptr | ) |
Stores the common InputParameters object.
params_ptr | A pointer to the common parameters object to be stored |
Definition at line 294 of file OutputWarehouse.C.
Referenced by CommonOutputAction::act().
void OutputWarehouse::setFileNumbers | ( | std::map< std::string, unsigned int > | input, |
unsigned int | offset = 0 |
||
) |
Calls the setFileNumber method for every FileOutput output object.
Definition at line 259 of file OutputWarehouse.C.
|
private |
Sets the execution flag type.
This is a private method used by FEProblemBase, it is not intended for any other purpose
Definition at line 377 of file OutputWarehouse.C.
void OutputWarehouse::solveSetup | ( | ) |
Calls the timestepSetup function for each of the output objects.
Definition at line 74 of file OutputWarehouse.C.
Referenced by EigenProblem::initPetscOutputAndSomeSolverSettings(), and FEProblemBase::initPetscOutputAndSomeSolverSettings().
|
private |
Calls the subdomainSetup function for each of the output objects.
Definition at line 95 of file OutputWarehouse.C.
Referenced by FEProblemBase::subdomainSetup().
|
protectedinherited |
section_name
.Optionally adds a prefix if one is defined.
Definition at line 47 of file PerfGraphInterface.C.
Referenced by PerfGraphInterface::registerTimedSection().
|
private |
Calls the timestepSetup function for each of the output objects.
Definition at line 60 of file OutputWarehouse.C.
Referenced by FEProblemBase::timestepSetup().
|
staticinherited |
Definition at line 16 of file PerfGraphInterface.C.
Referenced by Convergence::validParams().
|
friend |
Definition at line 398 of file OutputWarehouse.h.
|
friend |
Definition at line 401 of file OutputWarehouse.h.
|
friend |
Definition at line 410 of file OutputWarehouse.h.
|
friend |
Definition at line 404 of file OutputWarehouse.h.
|
friend |
Definition at line 407 of file OutputWarehouse.h.
|
private |
List of all variable created by auto material output.
Definition at line 370 of file OutputWarehouse.h.
|
private |
All instances of objects (raw pointers)
Definition at line 343 of file OutputWarehouse.h.
Referenced by addOutput(), allowOutput(), customSetup(), getFileNumbers(), initialSetup(), jacobianSetup(), meshChanged(), outputStep(), resetFileBase(), residualSetup(), setFileNumbers(), solveSetup(), subdomainSetup(), and timestepSetup().
|
private |
We are using std::shared_ptr to handle the cleanup of the pointers at the end of execution.
This is necessary since several warehouses might be sharing a single instance of a MooseObject.
Definition at line 261 of file OutputWarehouse.h.
Referenced by addOutput().
|
private |
Definition at line 340 of file OutputWarehouse.h.
Referenced by getOutputNames(), mooseConsole(), and resetFileBase().
|
private |
True to buffer console outputs in actions.
Definition at line 346 of file OutputWarehouse.h.
Referenced by bufferConsoleOutputsBeforeConstruction(), and mooseConsole().
|
private |
Pointer to the common InputParameters (.
Definition at line 358 of file OutputWarehouse.h.
Referenced by getCommonParameters(), and setCommonParameters().
|
private |
The stream for holding messages passed to _console prior to Output object construction.
Definition at line 376 of file OutputWarehouse.h.
Referenced by consoleBuffer(), flushConsoleBuffer(), mooseConsole(), and ~OutputWarehouse().
|
private |
List of object names.
Definition at line 355 of file OutputWarehouse.h.
Referenced by addOutputFilename().
|
private |
Flag indicating that next call to outputStep is forced.
Definition at line 385 of file OutputWarehouse.h.
Referenced by forceOutput(), and outputStep().
|
private |
Input file name for this output object.
Definition at line 364 of file OutputWarehouse.h.
|
private |
Storage for variables to hide as prescribed by the object via the OutputInterface.
Definition at line 379 of file OutputWarehouse.h.
Referenced by addInterfaceHideVariables(), and buildInterfaceHideVariables().
|
private |
What the last buffer was that was printed.
Definition at line 391 of file OutputWarehouse.h.
Referenced by mooseConsole().
|
private |
Whether or not the last thing output by mooseConsole had a newline as the last character.
Definition at line 388 of file OutputWarehouse.h.
Referenced by mooseConsole().
|
private |
Map of output name and AuxVariable names to be output (used by auto Material output)
Definition at line 367 of file OutputWarehouse.h.
|
private |
Number of times the stream has been printed to.
Definition at line 394 of file OutputWarehouse.h.
Referenced by mooseConsole(), and numPrinted().
|
private |
A map of the output pointers.
Definition at line 349 of file OutputWarehouse.h.
Referenced by addOutput(), getAllMaterialPropertyOutputNames(), getOutput(), getOutputNames(), getOutputs(), hasMaterialPropertyOutput(), hasOutput(), and reset().
|
private |
A set of output names.
Definition at line 352 of file OutputWarehouse.h.
Referenced by addOutput(), and getOutputNames().
|
private |
The current output execution flag.
Definition at line 382 of file OutputWarehouse.h.
Referenced by setOutputExecutionType().
|
protectedinherited |
The MooseApp that owns the PerfGraph.
Definition at line 124 of file PerfGraphInterface.h.
Referenced by PerfGraphInterface::perfGraph().
|
protectedinherited |
A prefix to use for all sections.
Definition at line 127 of file PerfGraphInterface.h.
Referenced by PerfGraphInterface::timedSectionName().
|
private |
List of reserved names.
Definition at line 373 of file OutputWarehouse.h.
Referenced by getReservedNames(), isReservedName(), and OutputWarehouse().
|
private |
Sync times for all objects.
Definition at line 361 of file OutputWarehouse.h.
Referenced by addOutput(), and getSyncTimes().