DOpE
|
#include <optproblemcontainer.h>
Public Member Functions | |
DOpEOutputHandler (ReducedProblemInterface_Base< VECTOR > *SI, ParameterReader ¶m_reader) | |
~DOpEOutputHandler () | |
void | WriteAux (std::string msg, std::string file, bool append=true) |
void | Write (std::string msg, int priority=20, unsigned int pre_newlines=0, unsigned int post_newlines=0) |
void | Write (std::stringstream &msg, int priority=20, unsigned int pre_newlines=0, unsigned int post_newlines=0) |
void | Write (const VECTOR &q, std::string name, std::string dof_type) |
void | WriteElementwise (const Vector< double > &q, std::string name, std::string dof_type) |
void | Write (const ControlVector< VECTOR > &q, std::string name, std::string dof_type) |
void | Write (const std::vector< double > &q, std::string name, std::string dof_type) |
void | WriteError (std::string msg) |
void | SetIterationNumber (unsigned int iteration, std::string type) |
void | ReInit () |
std::string | ZeroTolerance (double value, double reference_value) |
void | InitNewtonOut (std::stringstream &msg) |
void | InitOut (std::stringstream &msg) |
void | DisallowAllOutput () |
void | ResumeOutput () |
std::string | ConstructOutputName (std::string name, std::string dof_type) |
void | StartSaveCTypeOutputToLog () |
void | StopSaveCTypeOutputToLog () |
std::string | GetResultsDir () const |
Static Public Member Functions | |
static void | declare_params (ParameterReader ¶m_reader) |
Protected Member Functions | |
std::map< std::string, unsigned int >::const_iterator | ReorderAndInsert (std::string type) |
std::string | GetPostIndex () |
ReducedProblemInterface_Base < VECTOR > * | GetReducedProblem () |
bool | AllowWrite (std::string name) |
bool | AllowIteration (std::string name) |
void | ParseString (const std::string tmp, std::vector< std::string > &list) |
This class takes care of all output from the programm. It includes special filter routines on what information is to be displayed, and what vectors should be stored. The filters and output opptions can be configured using a parameter file.
DOpE::DOpEOutputHandler< VECTOR >::DOpEOutputHandler | ( | ReducedProblemInterface_Base< VECTOR > * | SI, |
ParameterReader & | param_reader | ||
) |
DOpE::DOpEOutputHandler< VECTOR >::~DOpEOutputHandler | ( | ) |
|
protected |
This function decides whether or not to store an iteration counter for automatic filename extension. It returns false if the name contains any substring that is given by the parameter file option 'ignore_iterations', otherwise it returns true. If the debug mode is activated via the paramfile, a declined name is noted in the log.
name | The name to be checked |
|
protected |
This function decides whether or not a Vector with the given name should be written. It returns false if the name contains any substring that is given by the parameter file option 'never_write_list', otherwise it returns true. If the debug mode is activated via the paramfile, a declined name is noted in the log.
name | The name to be checked |
std::string DOpE::DOpEOutputHandler< VECTOR >::ConstructOutputName | ( | std::string | name, |
std::string | dof_type | ||
) |
This function constructs the correct output name given by name and dof_type.
|
static |
This method must be called prior to instanciation of the object to be able to read the required parameters from the paramfile. Between the call of this function and the instanciation of the OutputHandler param_reader.read_parameters must be called.
|
inline |
This function can be called to disable all output.
|
protected |
This function computes the extension to the file name given by the stored iteration variables.
|
inlineprotected |
std::string DOpE::DOpEOutputHandler< VECTOR >::GetResultsDir | ( | ) | const |
This function gives the current output directory
void DOpE::DOpEOutputHandler< VECTOR >::InitNewtonOut | ( | std::stringstream & | msg | ) |
This function sets the precision of the newton output values.
void DOpE::DOpEOutputHandler< VECTOR >::InitOut | ( | std::stringstream & | msg | ) |
This function sets the precision of the functional output values.
|
protected |
This function parses a string into words that are separated by a ';'
tmp | The string to be parsed. |
list | A reference to a vector of strings. All words in the string tmp are beeing stored as a separate string in this list. |
void DOpE::DOpEOutputHandler< VECTOR >::ReInit | ( | ) |
If called this Method initializes a new subdirectory into which the solutions are written. Usually this should be called once on each mesh.
|
protected |
For internal use. This function is used to insert a new iteration counter whose values should be stored. If necessary the counters are reordered.
type | The name of the counter to be stored. |
|
inline |
This function is used to restore normal output behavior after a call of DisallowAllOutput
void DOpE::DOpEOutputHandler< VECTOR >::SetIterationNumber | ( | unsigned int | iteration, |
std::string | type | ||
) |
Sets the iteration number for the automatic file name extension. Whether it is actually used is decided by the AllowIteration method.
iteration | The number of the current iteration. |
type | A name indicating which iteration the number corresponds to. |
void DOpE::DOpEOutputHandler< VECTOR >::StartSaveCTypeOutputToLog | ( | ) |
Redirects all output to std::cout to the logfile. This is usefull if third party software directly prints output onto the screen.
void DOpE::DOpEOutputHandler< VECTOR >::StopSaveCTypeOutputToLog | ( | ) |
Disables the redirect of std::cout
void DOpE::DOpEOutputHandler< VECTOR >::Write | ( | std::string | msg, |
int | priority = 20 , |
||
unsigned int | pre_newlines = 0 , |
||
unsigned int | post_newlines = 0 |
||
) |
Call this function to write a string both to std::out and into the logfile. If the debug mode is activated via the paramfile, the message is always printed into the log.
msg | The message that should be printed. |
priority | The priority of the message. This is used to decide whether the string is actually be printed. By comparing this number with the printlevel given in the paramfile. A message is printed only if priority < printlevel, or if printlevel < 0 As a general rule: priority 0 : Things that must be printed always and can't be turned of. priority 1 : Tell what Major Algorithms are running priority 2 : Things like number of Total Iterations priority 3 : Major subiterations priority 4 : Minor subiteration (e.g ComputeState) priority 5 : Subiteration infos priority 20: Debug Infos |
pre_newlines | Number of empty lines in front of the message. |
post_newlines | Number of empty lines after the message. |
void DOpE::DOpEOutputHandler< VECTOR >::Write | ( | std::stringstream & | msg, |
int | priority = 20 , |
||
unsigned int | pre_newlines = 0 , |
||
unsigned int | post_newlines = 0 |
||
) |
Call this function to write a stringstream both to std::out and into the logfile. If the debug mode is activated via the paramfile, the message is always printed into the log.
msg | The message that should be printed. |
priority | The priority of the message. This is used to decide whether the string is actually be printed. By comparing this number with the printlevel given in the paramfile. A message is printed only if priority < printlevel, or if printlevel < 0 As a general rule: priority 0 : Things that must be printed always and can't be turned of. priority 1 : Tell what Major Algorithms are running priority 2 : Things like number of Total Iterations priority 3 : Major subiterations priority 4 : Minor subiteration (e.g ComputeState) priority 5 : Subiteration infos priority 20: Debug Infos |
pre_newlines | Number of empty lines in front of the message. |
post_newlines | Number of empty lines after the message. |
void DOpE::DOpEOutputHandler< VECTOR >::Write | ( | const VECTOR & | q, |
std::string | name, | ||
std::string | dof_type | ||
) |
Call this Function to write a BlockVector into a file. The method AllowWrite is called to check if this actually happens. If successfull the filename of the output file will be written with priority 3.
q | A Reference to the BlockVector to be written. |
name | The Name of the output file (this is what is checked by AllowWrite). The directory, iteration counters and ending are added automatically. |
dof_type | A string indicating which dof_handler is associated to the BlockVector. Valid options are 'control' and 'state' |
void DOpE::DOpEOutputHandler< VECTOR >::Write | ( | const ControlVector< VECTOR > & | q, |
std::string | name, | ||
std::string | dof_type | ||
) |
Call this Function to write a ControlVector into a file. The method AllowWrite is called to check if this actually happens. If successfull the filename of the output file will be written with priority 3.
q | A Reference to the ControlVector to be written. |
name | The Name of the output file (this is what is checked by AllowWrite). The directory, iteration counters and ending are added automatically. |
dof_type | A string indicating which dof_handler is associated to the BlockVector. Valid options are 'control' and 'state' |
void DOpE::DOpEOutputHandler< VECTOR >::Write | ( | const std::vector< double > & | q, |
std::string | name, | ||
std::string | dof_type | ||
) |
same as above for ControlVector<dealii::Vector<double> > Call this Function to write a std::vector into a file. The method AllowWrite is called to check if this actually happens. If successfull the filename of the output file will be written with priority 3. The output is a gnuplot file.
q | A Reference to the ControlVector to be written. |
name | The Name of the output file (this is what is checked by AllowWrite). The directory, iteration counters and ending are added automatically. |
dof_type | A string indicating which dof_handler is associated to the BlockVector. Valid options are 'time'. |
void DOpE::DOpEOutputHandler< VECTOR >::WriteAux | ( | std::string | msg, |
std::string | file, | ||
bool | append = true |
||
) |
Call this function to write a string to an auxilliary file
msg | The message that should be printed. |
file | Filename |
append | String appendend to file ? |
void DOpE::DOpEOutputHandler< VECTOR >::WriteElementwise | ( | const Vector< double > & | q, |
std::string | name, | ||
std::string | dof_type | ||
) |
Call this Function to write a Vector containing element-related data into a file. The method AllowWrite is called to check if this actually happens. If successfull the filename of the output file will be written with priority 3.
q | A Reference to the Vector to be written. |
name | The Name of the output file (this is what is checked by AllowWrite). The directory, iteration counters and ending are added automatically. |
dof_type | A string indicating which dof_handler is associated to the BlockVector. Valid options are 'control' and 'state'. |
void DOpE::DOpEOutputHandler< VECTOR >::WriteError | ( | std::string | msg | ) |
Writes an error message to std::cerr and into the Log. This message is printed always regardless of priorities.
msg | The message to be printed. |
std::string DOpE::DOpEOutputHandler< VECTOR >::ZeroTolerance | ( | double | value, |
double | reference_value | ||
) |
Decides if the exact output value is written out or zero (in case if the exact output value is below a certain tolerance.