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());
128 const std::set<OutputName> &
134 for (
const auto & act : actions)
145 if (it.first != obj_name && it.second.find(filename) != it.second.end())
146 mooseError(
"An output file with the name, ", filename,
", already exists.");
157 obj->outputStep(type);
195 std::string message = buffer.str();
199 message =
'\n' + message;
202 std::vector<Console *> objects = getOutputs<Console>();
203 if (!objects.empty())
205 for (
const auto & obj : objects)
206 obj->mooseConsole(message);
218 bool this_message_ends_in_newline = message.empty() ? true : message.back() ==
'\n';
226 Moose::out << message << std::flush;
254 std::map<std::string, unsigned int>::const_iterator it = input.find(ptr->
name());
255 if (it != input.end())
257 int value = it->second + offset;
267 std::map<std::string, unsigned int>
271 std::map<std::string, unsigned int> output;
301 const std::set<std::string> & variable_names)
303 _interface_map[output_name].insert(variable_names.begin(), variable_names.end());
308 std::set<std::string> & hide)
310 std::map<std::string, std::set<std::string>>::const_iterator it =
319 for (
const auto &
name : names)
321 mooseError(
"The output object '",
name,
"' is not a defined output object");
324 const std::set<std::string> &
346 obj->allowOutput(state);
360 auto * table =
dynamic_cast<TableOutput *
>(pair.second);
363 auto * exodus =
dynamic_cast<Exodus *
>(pair.second);
378 const std::string file_base = obj->
parameters().
get<
bool>(
"_built_by_moose")
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 (.
virtual std::string filename()
The filename for the output file.
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 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.
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.
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.
void setFileBase(const std::string &file_base)
Sets the file base string if the 'file_base' parameter is not set.
virtual ~OutputWarehouse()
Class for output data to the ExodusII format.
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
void checkOutputs(const std::set< OutputName > &names)
Test that the output names exist.
std::atomic< unsigned long long int > _num_printed
Number of times the stream has been printed to.
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.
const InputParameters & parameters() const
Get the parameters of the 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.