28 _buffer_action_console_outputs(false),
29 _common_params_ptr(NULL),
32 _last_message_ended_in_newline(true),
51 TIME_SECTION(
"initialSetup", 5,
"Setting Up Outputs");
70 obj->customSetup(exec_type);
98 obj->subdomainSetup();
118 const std::set<Real> & sync_times = output->
getSyncTimes();
119 _sync_times.insert(sync_times.begin(), sync_times.end());
131 const auto found_object =
hasOutput(name);
142const std::set<OutputName> &
148 for (
const auto & act : actions)
159 if (it.first != obj_name && it.second.find(filename) != it.second.end())
160 mooseError(
"An output file with the name, ", filename,
", already exists.");
171 obj->outputStep(type);
209 std::string message = buffer.str();
213 message =
'\n' + message;
216 std::vector<Console *> objects = getOutputs<Console>();
217 if (!objects.empty())
219 for (
const auto & obj : objects)
220 obj->mooseConsole(message);
231 bool this_message_ends_in_newline = message.empty() ? true : message.back() ==
'\n';
239 Moose::out << message << std::flush;
266 std::map<std::string, unsigned int>::const_iterator it = input.find(ptr->
name());
267 if (it != input.end())
269 int value = it->second + offset;
279std::map<std::string, unsigned int>
283 std::map<std::string, unsigned int> output;
313 const std::set<std::string> & variable_names)
320 std::set<std::string> & hide)
322 std::map<std::string, std::set<std::string>>::const_iterator it =
330 const bool supports_material_output)
332 std::string reserved_name =
"";
333 for (
const auto & name : names)
336 if (is_reserved_name)
337 reserved_name = name;
338 if (!is_reserved_name)
341 mooseError(
"The output object '", name,
"' is not a defined output object.");
343 mooseError(
"The output object '", name,
"' does not support material output.");
346 if (!reserved_name.empty() && names.size() > 1)
347 mooseError(
"When setting output name to reserved name '" + reserved_name +
348 "', only one entry is allowed in outputs parameter.");
354 std::set<OutputName> output_names;
357 const auto * output =
static_cast<const Output *
>(pair.second);
358 if (output->supportsMaterialPropertyOutput())
359 output_names.insert(pair.first);
364const std::set<std::string> &
386 obj->allowOutput(state);
400 auto * table =
dynamic_cast<TableOutput *
>(pair.second);
403 auto * exodus =
dynamic_cast<Exodus *
>(pair.second);
416 std::string file_base;
417 if (obj->parameters().get<
bool>(
"_built_by_moose"))
419 if (obj->isParamValid(
"file_base"))
420 file_base = obj->getParam<std::string>(
"file_base");
427 file_output->setFileBase(file_base);
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const ExecFlagType EXEC_FORCED
const ExecFlagType EXEC_CUSTOM
static std::mutex moose_console_mutex
bool isTaskComplete(const std::string &task) const
bool hasActions(const std::string &task) const
Check if Actions associated with passed in task exist.
const std::list< Action * > & getActionListByName(const std::string &task) const
Retrieve a constant list of Action pointers associated with the passed in task.
bool hasTask(const std::string &task) const
Class for output data to the ExodusII format.
void clear()
Reset Exodus output.
An outputter with filename support.
unsigned int getFileNumber()
Return the current file number for this outputter.
void setFileNumber(unsigned int num)
Sets the file number manually.
Base class for MOOSE-based applications.
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
std::string getOutputFileBase(bool for_non_moose_build_output=false) const
Get the output file base name.
unsigned int multiAppLevel() const
The MultiApp Level.
const std::string & name() const
Get the name of the class.
Class for containing MooseEnum item information.
const InputParameters * getCommonParameters() const
Get a reference to the common output parameters.
void flushConsoleBuffer()
If content exists in the buffer, write it.
void reset()
Reset the output system.
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 o...
std::vector< Output * > _all_objects
All instances of objects (raw pointers)
bool isReservedName(const std::string &name)
Test if the given name is reserved.
void solveSetup()
Calls the timestepSetup function for each of the output objects.
void jacobianSetup()
Calls the jacobianSetup function for each of the output objects.
void setFileNumbers(std::map< std::string, unsigned int > input, unsigned int offset=0)
Calls the setFileNumber method for every FileOutput output object.
std::set< OutputName > getAllMaterialPropertyOutputNames() const
Returns all output names that support material output.
std::atomic< unsigned long long int > _num_printed
Number of times the stream has been printed to.
void forceOutput()
Indicates that the next call to outputStep should be forced This is private, users should utilize FEP...
void timestepSetup()
Calls the timestepSetup function for each of the output objects.
const InputParameters * _common_params_ptr
Pointer to the common InputParameters (.
std::set< Real > & getSyncTimes()
Return the sync times for all objects.
const std::set< std::string > & getReservedNames() const
Return a set of reserved output names.
const std::ostringstream * _last_buffer
What the last buffer was that was printed.
bool _last_message_ended_in_newline
Whether or not the last thing output by mooseConsole had a newline as the last character.
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.
std::set< Real > _sync_times
Sync times for all objects.
const std::set< OutputName > & getOutputNames()
Get a complete set of all output object names.
void initialSetup()
Calls the initialSetup function for each of the output objects.
ExecFlagType _output_exec_flag
The current output execution flag.
bool _buffer_action_console_outputs
True to buffer console outputs in actions.
void meshChanged()
Calls the meshChanged method for every output object.
void customSetup(const ExecFlagType &exec_type)
Calls the setup function for each of the output objects.
std::map< std::string, unsigned int > getFileNumbers()
Extracts the file numbers from the output objects.
bool hasOutput(const std::string &name) const
Returns true if the output object exists.
OutputWarehouse(MooseApp &app)
Class constructor.
void addInterfaceHideVariables(const std::string &output_name, const std::set< std::string > &variable_names)
Insert variable names for hiding via the OutoutInterface.
std::set< OutputName > _object_names
A set of output names.
std::map< std::string, std::set< std::string > > _interface_map
Storage for variables to hide as prescribed by the object via the OutputInterface.
virtual ~OutputWarehouse()
bool _force_output
Flag indicating that next call to outputStep is forced.
void subdomainSetup()
Calls the subdomainSetup function for each of the output objects.
void checkOutputs(const std::set< OutputName > &names, const bool supports_material_output=false)
Test that the output names exist.
void setCommonParameters(const InputParameters *params_ptr)
Stores the common InputParameters object.
void mooseConsole()
Send current output buffer to Console output objects.
void setOutputExecutionType(ExecFlagType type)
Sets the execution flag type.
void residualSetup()
Calls the residualSetup function for each of the output objects.
void outputStep(ExecFlagType type)
Calls the outputStep method for each output object.
void resetFileBase()
Resets the file base for all FileOutput objects.
void buildInterfaceHideVariables(const std::string &output_name, std::set< std::string > &hide)
Return the list of hidden variables for the given output name.
void allowOutput(bool state)
Ability to enable/disable output calls This is private, users should utilize FEProblemBase::allowOutp...
std::map< OutputName, std::set< OutFileBase > > _file_base_map
List of object names.
bool hasMaterialPropertyOutput(const std::string &name) const
Returns true if the output object exists, and it supports material property output.
std::map< OutputName, Output * > _object_map
A map of the output pointers.
void addOutput(std::shared_ptr< Output > output)
Adds an existing output object to the warehouse.
std::ostringstream _console_buffer
The stream for holding messages passed to _console prior to Output object construction.
std::set< std::string > _reserved
List of reserved names.
Based class for output objects.
const std::set< Real > & getSyncTimes()
virtual bool supportsMaterialPropertyOutput() const
A virtual function that stores whether output type supports material output.
Interface for objects interacting with the PerfGraph.
Base class for scalar variables and postprocessors output objects.
void insert(const std::string &)
void indentMessage(const std::string &prefix, std::string &message, const char *color, bool indent_first_line, const std::string &post_prefix)