$extrastylesheet
Dakota  Version 6.2
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
OutputManager Class Reference

Class to manage redirection of stdout/stderr, keep track of current redir state, and manage rank 0 output. Also manage tabular data output for post-processing with Matlab, Tecplot, etc. and delegate to Graphics for X Windows Graphics. More...

List of all members.

Public Member Functions

 OutputManager ()
 Default constructor (needed for default environment ctors)
 OutputManager (const ProgramOptions &prog_opts, int dakota_world_rank=0, bool dakota_mpirun_flag=false)
 Standard constructor, taking user-specified program options and optionally taking the rank of this process in Dakota's MPI_Comm.
 ~OutputManager ()
 Destructor that closes streams and other outputs.
void close_streams ()
 helper to close streams during destructor or abnormal abort
Graphicsgraphics ()
 retrieve the graphics handler object
void parse (const ProblemDescDB &problem_db)
 Extract environment options from ProblemDescDB.
void startup_message (const String &start_msg)
 Set the Dakota startup message ("Running on...")
void push_output_tag (const String &iterator_tag, const ProgramOptions &prog_opts, bool force_cout_redirect, bool force_rst_redirect)
 Update the tag to use on files and rebind any streams as needed.
void pop_output_tag ()
 (Potentially) remove an output context and rebind streams
void output_version (std::ostream &os=Cout) const
 Output the current Dakota version.
void output_startup_message (std::ostream &os=Cout) const
 Output the startup header and time.
void output_helper (const String &message, std::ostream &os) const
 Output only on Dakota world rank 0 (for version, help, etc.)
void append_restart (const ParamResponsePair &prp)
 append a parameter/response set to the restart file
void add_datapoint (const Variables &vars, const String &iface, const Response &response)
 adds data to each window in the 2d graphics and adds a row to the tabular data file based on the results of a model evaluation
void create_tabular_datastream (const Variables &vars, const Response &resp)
 initialize the tabular datastream on iterator leaders
void close_tabular ()
 close tabular datastream
void graphics_counter (int cntr)
 set graphicsCntr equal to cntr
int graphics_counter () const
 return graphicsCntr
void tabular_counter_label (const std::string &label)
 set tabularCntrLabel equal to label

Public Attributes

bool graph2DFlag
 whether user requested 2D graphics plots
bool tabularDataFlag
 whether user requested tabular data file
bool resultsOutputFlag
 whether user requested results data output
String tabularDataFile
 filename for tabulation of graphics data
String resultsOutputFile
 filename for results data

Private Member Functions

void read_write_restart (bool restart_requested, bool read_restart_flag, const String &read_restart_filename, size_t stop_restart_eval, const String &write_restart_filename)
 conditionally import evaluations from restart file, then always create or overwrite restart file

Private Attributes

int worldRank
 output manager handles rank 0 only output when needed
bool mpirunFlag
 some output is only for MPI runs
StringArray fileTags
 set of tags for various input/output files (default none)
bool redirCalled
 temporary variable to prevent recursive tagging initially
ConsoleRedirector coutRedirector
 set of redirections for Dakota::Cout; stores any tagged filename when there are concurrent Iterators
ConsoleRedirector cerrRedirector
 set of redirections for Dakota::Cerr; stores any tagged filename when there are concurrent Iterators and error redirection is requested
std::vector< boost::shared_ptr
< RestartWriter > > 
restartDestinations
 Stack of active restart destinations; end is the last (active) redirection. All remain open until popped or destroyed.
String startupMessage
 message to print at startup when proceeding to instantiate objects
Graphics dakotaGraphics
 graphics and tabular data output handler used by meta-iterators, models, and approximations; encapsulated here so destroyed with the OutputManager
unsigned short tabularFormat
 tabular format options; see enum
int graphicsCntr
 used for x axis values in 2D graphics and for 1st column in tabular data
std::ofstream tabularDataFStream
 file stream for tabulation of graphics data within compute_response
std::string tabularCntrLabel
 label for counter used in first line comment w/i the tabular data file
short outputLevel
 output level (for debugging only; not passed in)

Detailed Description

Class to manage redirection of stdout/stderr, keep track of current redir state, and manage rank 0 output. Also manage tabular data output for post-processing with Matlab, Tecplot, etc. and delegate to Graphics for X Windows Graphics.


Constructor & Destructor Documentation

OutputManager ( const ProgramOptions prog_opts,
int  dakota_world_rank = 0,
bool  dakota_mpirun_flag = false 
)

Standard constructor, taking user-specified program options and optionally taking the rank of this process in Dakota's MPI_Comm.

Only get minimal information off ProgramOptions as may be updated later by broadcast.

References OutputManager::cerrRedirector, OutputManager::coutRedirector, ProgramOptions::error_file(), OutputManager::mpirunFlag, ProgramOptions::output_file(), OutputManager::outputLevel, ConsoleRedirector::push_back(), Dakota::start_dakota_heartbeat(), ProgramOptions::user_stderr_redirect(), ProgramOptions::user_stdout_redirect(), and OutputManager::worldRank.


Member Function Documentation

void pop_output_tag ( )
void add_datapoint ( const Variables vars,
const String &  iface,
const Response response 
)

adds data to each window in the 2d graphics and adds a row to the tabular data file based on the results of a model evaluation

Adds data to each 2d plot and each tabular data column (one for each active variable and for each response function). graphicsCntr is used for the x axis in the graphics and the first column in the tabular data.

References Response::active_set_request_vector(), Graphics::add_datapoint(), OutputManager::dakotaGraphics, OutputManager::graphicsCntr, OutputManager::tabularDataFStream, and OutputManager::tabularFormat.

Referenced by Model::compute_response(), SurrBasedLocalMinimizer::minimize_surrogates(), Model::synchronize(), and Model::synchronize_nowait().

void create_tabular_datastream ( const Variables vars,
const Response response 
)

initialize the tabular datastream on iterator leaders

Opens the tabular data file stream and prints headings, one for each active continuous and discrete variable and one for each response function, using the variable and response function labels. This tabular data is used for post-processing of DAKOTA results in Matlab, Tecplot, etc.

References OutputManager::fileTags, OutputManager::tabularDataFile, OutputManager::tabularDataFStream, and OutputManager::tabularFormat.

Referenced by SurrBasedMinimizer::initialize_graphics(), and Iterator::initialize_graphics().


The documentation for this class was generated from the following files: