Dakota  Version 6.15
Explore and Predict with Confidence
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
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...

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. More...
 
 ~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 ProgramOptions &prog_opts, const ProblemDescDB &problem_db)
 Extract environment options from ProblemDescDB and update from late updates to ProgramOptions.
 
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.
 
String build_output_tag () const
 return the full output tag
 
void pop_output_tag ()
 (Potentially) remove an output context and rebind streams More...
 
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 open_tabular_datastream ()
 open the tabular datastream on iterator leaders More...
 
void create_tabular_header (const Variables &vars, const Response &resp)
 output a complete header to the tabular datastream More...
 
void create_tabular_header (const StringArray &iface_ids)
 initiate the header for the tabular datastream with the leading fields
 
void append_tabular_header (const Variables &vars)
 append variables labels to the tabular header
 
void append_tabular_header (const Variables &vars, size_t start_index, size_t num_items)
 append a range of variables labels to the tabular header
 
void append_tabular_header (const StringArray &labels, bool rtn=false)
 append an array of labels to the tabular header
 
void append_tabular_header (const Response &response)
 append response labels to the tabular header
 
void add_tabular_data (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 for the evaluation variables/response More...
 
void add_tabular_data (const Variables &vars)
 adds data to each window in the 2d graphics and adds a row to the tabular data file for the evaluation variables
 
void add_tabular_data (const Variables &vars, size_t start_index, size_t num_items)
 adds data to each window in the 2d graphics and adds a row to the tabular data file for a portion of the evaluation variables
 
void add_tabular_data (const StringArray &iface_ids)
 adds data to a row of the tabular data file for the interface id
 
void add_tabular_data (const Response &response)
 adds data to each window in the 2d graphics and adds a row to the tabular data file for the evaluation response
 
template<class T >
void add_tabular_scalar (T val)
 augments the data set for a row in the tabular data file
 
void close_tabular_datastream ()
 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
 
void init_results_db ()
 At runtime, initialize the global ResultsManager, tagging filename with MPI worldRank + 1 if needed.
 
void archive_input (const ProgramOptions &prog_opts) const
 Archive the input file to the results database.
 

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
 
unsigned short modelEvalsSelection
 Models selected to store their evaluations.
 
unsigned short interfEvalsSelection
 Interfaces selected to store their evaluations.
 

Private Member Functions

void initial_redirects (const ProgramOptions &prog_opts)
 Perform initial output/error redirects from user requests.
 
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)
 
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< std::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
 
std::string tabularInterfLabel
 label for interface used in first line comment w/i the tabular data file
 
short outputLevel
 output level (for debugging only; not passed in)
 
unsigned short resultsOutputFormat
 Output results format.
 

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::initial_redirects(), OutputManager::mpirunFlag, and Dakota::start_dakota_heartbeat().

Member Function Documentation

void pop_output_tag ( )
void open_tabular_datastream ( )

open 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::build_output_tag(), OutputManager::tabularDataFile, and OutputManager::tabularDataFStream.

Referenced by HierarchSurrModel::create_tabular_datastream(), and Model::create_tabular_datastream().

void create_tabular_header ( const Variables vars,
const Response response 
)

output a complete header to the tabular datastream

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::tabularCntrLabel, OutputManager::tabularDataFStream, OutputManager::tabularFormat, and OutputManager::tabularInterfLabel.

Referenced by HierarchSurrModel::create_tabular_datastream(), and Model::create_tabular_datastream().

void add_tabular_data ( 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 for the evaluation variables/response

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 HierarchSurrModel::derived_auto_graphics(), and Model::derived_auto_graphics().


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