ug4
|
Records statistics on how individual parts of a multigrid method worked. More...
#include <mg_stats.h>
Classes | |
struct | FuncEntry |
Public Types | |
typedef GridFunction< TDomain, TAlgebra > | grid_func_t |
typedef SmartPtr< grid_func_t > | sp_grid_func_t |
enum | Stage { BEFORE_PRE_SMOOTH , AFTER_PRE_SMOOTH , BEFORE_POST_SMOOTH , AFTER_POST_SMOOTH , INVALID } |
Defines at which stage data is recorded in a given multigrid cycle. More... | |
Public Member Functions | |
void | clear () |
clears the current stats More... | |
MGStats () | |
void | print () |
prints the current stats More... | |
void | save_stats_to_file () |
saves current stats to filenamePrefix.log More... | |
void | save_stats_to_file (const char *filename) |
saves current stats to the specified file More... | |
void | set_active_stages (const std::vector< int > &activeStages) |
sets the active stages. All other stages will be ignored. More... | |
void | set_defect (grid_func_t &gf, int lvl, Stage stage) |
set the defect on a certain level for a given stage More... | |
void | set_exit_on_error (bool exitOnError) |
If enabled, a deterioration of the norm of the defect leads to an error. More... | |
void | set_filename_prefix (const char *filename) |
sets the prefix with which files are written More... | |
void | set_write_err_diffs (bool writeErrDiffs) |
If enabled, a diff bettween defects involved is written to file if the defect deteriorates. More... | |
void | set_write_err_vecs (bool writeErrVecs) |
If enabled, involved defects are written to file if the defect deteriorates. More... | |
const char * | stage_name (Stage stage) |
returns the name of a given stage as a string More... | |
const char * | stage_norm_name (Stage stage) |
returns the name of the norm of a given stage as a string More... | |
Static Public Attributes | |
static const int | NUM_STAGES = INVALID + 1 |
Private Member Functions | |
void | level_required (int lvl) |
void | write_header (int maxLvl) |
Private Attributes | |
bool | m_exitOnError |
std::string | m_filenamePrefix |
std::vector< FuncEntry > | m_funcs |
int | m_lastLvlWritten |
int | m_maxLvl |
bool | m_stageIsActive [NUM_STAGES] |
StringTable | m_stats |
int | m_statsRow |
bool | m_writeErrDiffs |
bool | m_writeErrVecs |
Records statistics on how individual parts of a multigrid method worked.
typedef GridFunction<TDomain, TAlgebra> ug::MGStats< TDomain, TAlgebra >::grid_func_t |
typedef SmartPtr<grid_func_t> ug::MGStats< TDomain, TAlgebra >::sp_grid_func_t |
enum ug::MGStats::Stage |
ug::MGStats< TDomain, TAlgebra >::MGStats |
void ug::MGStats< TDomain, TAlgebra >::clear |
clears the current stats
|
private |
void ug::MGStats< TDomain, TAlgebra >::print |
prints the current stats
References UG_LOG.
void ug::MGStats< TDomain, TAlgebra >::save_stats_to_file |
saves current stats to filenamePrefix.log
References mkstr.
void ug::MGStats< TDomain, TAlgebra >::save_stats_to_file | ( | const char * | filename | ) |
saves current stats to the specified file
References pcl::ProcRank(), and UG_COND_THROW.
void ug::MGStats< TDomain, TAlgebra >::set_active_stages | ( | const std::vector< int > & | activeStages | ) |
sets the active stages. All other stages will be ignored.
activeStages | vector containing constants from MGStats::Stage. Each listed stage will be considered active, all non-listed stages will be ignored. |
void ug::MGStats< TDomain, TAlgebra >::set_defect | ( | grid_func_t & | gf, |
int | lvl, | ||
Stage | stage | ||
) |
set the defect on a certain level for a given stage
If the defect for the previous stage was set for the same level, norms are compared and a diff can be computed.
If 'exitOnError' is enabled, the method will print the current stats and throw an instance of UGError of the norm of the defect deteriorated.
References ug::GridFunction< TDomain, TAlgebra >::clone_without_values(), ug::MGStats< TDomain, TAlgebra >::FuncEntry::func, SmartPtr< T, FreePolicy >::invalid(), mkstr, ug::MGStats< TDomain, TAlgebra >::FuncEntry::norm, ug::GridFunction< TDomain, TAlgebra >::num_indices(), print(), ug::SaveVectorDiffForConnectionViewer(), ug::SaveVectorForConnectionViewer(), ug::MGStats< TDomain, TAlgebra >::FuncEntry::stage, ug::MGStats< TDomain, TAlgebra >::FuncEntry::tmpFunc, UG_LOG, and UG_THROW.
void ug::MGStats< TDomain, TAlgebra >::set_exit_on_error | ( | bool | exitOnError | ) |
If enabled, a deterioration of the norm of the defect leads to an error.
disabled by default.
void ug::MGStats< TDomain, TAlgebra >::set_filename_prefix | ( | const char * | filename | ) |
sets the prefix with which files are written
This concerns the log-file and grid-function files. Default is 'mgstats'.
void ug::MGStats< TDomain, TAlgebra >::set_write_err_diffs | ( | bool | writeErrDiffs | ) |
If enabled, a diff bettween defects involved is written to file if the defect deteriorates.
disabled by default.
void ug::MGStats< TDomain, TAlgebra >::set_write_err_vecs | ( | bool | writeErrVecs | ) |
If enabled, involved defects are written to file if the defect deteriorates.
disabled by default.
|
inline |
returns the name of a given stage as a string
|
inline |
returns the name of the norm of a given stage as a string
|
private |
References mkstr.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Referenced by ug::MGStats< TDomain, TAlgebra >::MGStats().
|
private |
|
private |
|
private |
|
private |
|
static |
Referenced by ug::MGStats< TDomain, TAlgebra >::MGStats().