21 #include <sys/types.h> 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());
142 const 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);
232 bool this_message_ends_in_newline = message.empty() ? true : message.back() ==
'\n';
240 Moose::out << message << std::flush;
268 std::map<std::string, unsigned int>::const_iterator it = input.find(ptr->
name());
269 if (it != input.end())
271 int value = it->second + offset;
281 std::map<std::string, unsigned int>
285 std::map<std::string, unsigned int> output;
315 const std::set<std::string> & variable_names)
317 _interface_map[output_name].insert(variable_names.begin(), variable_names.end());
322 std::set<std::string> & hide)
324 std::map<std::string, std::set<std::string>>::const_iterator it =
332 const bool supports_material_output)
334 std::string reserved_name =
"";
335 for (
const auto &
name : names)
338 if (is_reserved_name)
339 reserved_name =
name;
340 if (!is_reserved_name)
343 mooseError(
"The output object '",
name,
"' is not a defined output object.");
345 mooseError(
"The output object '",
name,
"' does not support material output.");
348 if (!reserved_name.empty() && names.size() > 1)
349 mooseError(
"When setting output name to reserved name '" + reserved_name +
350 "', only one entry is allowed in outputs parameter.");
356 std::set<OutputName> output_names;
359 const auto * output =
static_cast<const Output *
>(pair.second);
360 if (output->supportsMaterialPropertyOutput())
361 output_names.insert(pair.first);
366 const std::set<std::string> &
388 obj->allowOutput(state);
402 auto * table =
dynamic_cast<TableOutput *
>(pair.second);
405 auto * exodus =
dynamic_cast<Exodus *
>(pair.second);
416 if (
FileOutput * file_output = dynamic_cast<FileOutput *>(obj))
418 std::string file_base;
419 if (obj->parameters().get<
bool>(
"_built_by_moose"))
421 if (obj->isParamValid(
"file_base"))
422 file_base = obj->getParam<std::string>(
"file_base");
429 file_output->setFileBase(file_base);
std::string name(const ElemQuality q)
std::map< OutputName, std::set< OutFileBase > > _file_base_map
List of object names.
void outputStep(ExecFlagType type)
Calls the outputStep method for each output object.
const InputParameters * _common_params_ptr
Pointer to the common InputParameters (.
bool _buffer_action_console_outputs
True to buffer console outputs in actions.
void initialSetup()
Calls the initialSetup function for each of the output objects.
const ExecFlagType EXEC_CUSTOM
const ExecFlagType EXEC_FORCED
std::map< OutputName, Output * > _object_map
A map of the output pointers.
void checkOutputs(const std::set< OutputName > &names, const bool supports_material_output=false)
Test that the output names exist.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
bool isTaskComplete(const std::string &task) const
std::string getOutputFileBase(bool for_non_moose_build_output=false) const
Get the output file base name.
std::set< OutputName > _object_names
A set of output names.
unsigned int multiAppLevel() const
The MultiApp Level.
bool isReservedName(const std::string &name)
Test if the given name is reserved.
bool hasOutput(const std::string &name) const
Returns true if the output object exists.
Base class for MOOSE-based applications.
unsigned int getFileNumber()
Return the current file number for this outputter.
void customSetup(const ExecFlagType &exec_type)
Calls the setup function for each of the output objects.
void clear()
Reset Exodus output.
const std::list< Action * > & getActionListByName(const std::string &task) const
Retrieve a constant list of Action pointers associated with the passed in task.
void setOutputExecutionType(ExecFlagType type)
Sets the execution flag type.
std::vector< Output * > _all_objects
All instances of objects (raw pointers)
virtual const std::string & name() const
Get the name of the class.
bool hasMaterialPropertyOutput(const std::string &name) const
Returns true if the output object exists, and it supports material property output.
void forceOutput()
Indicates that the next call to outputStep should be forced This is private, users should utilize FEP...
std::set< std::string > _reserved
List of reserved names.
void jacobianSetup()
Calls the jacobianSetup function for each of the output objects.
void setFileNumber(unsigned int num)
Sets the file number manually.
std::map< std::string, std::set< std::string > > _interface_map
Storage for variables to hide as prescribed by the object via the OutputInterface.
Based class for output objects.
std::set< OutputName > getAllMaterialPropertyOutputNames() const
Returns all output names that support material output.
const std::ostringstream * _last_buffer
What the last buffer was that was printed.
ExecFlagType _output_exec_flag
The current output execution flag.
void resetFileBase()
Resets the file base for all FileOutput objects.
OutputWarehouse(MooseApp &app)
Class constructor.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void indentMessage(const std::string &prefix, std::string &message, const char *color=COLOR_CYAN, bool dont_indent_first_line=true, const std::string &post_prefix=": ")
Indents the supplied message given the prefix and color.
static std::mutex moose_console_mutex
std::map< std::string, unsigned int > getFileNumbers()
Extracts the file numbers from the output objects.
void meshChanged()
Calls the meshChanged method for every output object.
bool _force_output
Flag indicating that next call to outputStep is forced.
virtual ~OutputWarehouse()
Class for output data to the ExodusII format.
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
std::atomic< unsigned long long int > _num_printed
Number of times the stream has been printed to.
virtual bool supportsMaterialPropertyOutput() const
A virtual function that stores whether output type supports material output.
Interface for objects interacting with the PerfGraph.
std::ostringstream _console_buffer
The stream for holding messages passed to _console prior to Output object construction.
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< std::shared_ptr< Output > > _all_ptrs
We are using std::shared_ptr to handle the cleanup of the pointers at the end of execution.
void residualSetup()
Calls the residualSetup function for each of the output objects.
void solveSetup()
Calls the timestepSetup function for each of the output objects.
const std::set< OutputName > & getOutputNames()
Get a complete set of all output object names.
bool hasActions(const std::string &task) const
Check if Actions associated with passed in task exist.
const InputParameters * getCommonParameters() const
Get a reference to the common output parameters.
Class for containing MooseEnum item information.
void subdomainSetup()
Calls the subdomainSetup function for each of the output objects.
void allowOutput(bool state)
Ability to enable/disable output calls This is private, users should utilize FEProblemBase::allowOutp...
void addOutput(std::shared_ptr< Output > output)
Adds an existing output object to the warehouse.
Base class for scalar variables and postprocessors output objects.
void mooseConsole()
Send current output buffer to Console output objects.
void reset()
Reset the output system.
void setCommonParameters(const InputParameters *params_ptr)
Stores the common InputParameters object.
void addInterfaceHideVariables(const std::string &output_name, const std::set< std::string > &variable_names)
Insert variable names for hiding via the OutoutInterface.
void buildInterfaceHideVariables(const std::string &output_name, std::set< std::string > &hide)
Return the list of hidden variables for the given output name.
An outputter with filename support.
const std::set< std::string > & getReservedNames() const
Return a set of reserved output names.
void setFileNumbers(std::map< std::string, unsigned int > input, unsigned int offset=0)
Calls the setFileNumber method for every FileOutput output object.
std::set< Real > & getSyncTimes()
Return the sync times for all objects.
void timestepSetup()
Calls the timestepSetup function for each of the output objects.
bool _last_message_ended_in_newline
Whether or not the last thing output by mooseConsole had a newline as the last character.
void flushConsoleBuffer()
If content exists in the buffer, write it.
std::set< Real > _sync_times
Sync times for all objects.