PARALUTION  1.0.0
PARALUTION
paralution::IterationControl Class Reference

Iteration control for iterative solvers, monitor the residual (L2 norm) behavior. More...

#include <iter_ctrl.hpp>

Public Member Functions

 IterationControl ()
 
 ~IterationControl ()
 
void Init (const double abs, const double rel, const double div, const int max)
 Initialize with absolute/relative/divergence tolerance and maximum number of iterations. More...
 
void Init (const double abs, const double rel, const double div, const int min, const int max)
 Initialize with absolute/relative/divergence tolerance and minimum/maximum number of iterations. More...
 
void InitTolerance (const double abs, const double rel, const double div)
 Initialize with absolute/relative/divergence tolerance. More...
 
void InitMinimumIterations (const int min)
 Set the minimum number of iterations. More...
 
void InitMaximumIterations (const int max)
 Set the maximal number of iterations. More...
 
int GetMinimumIterations (void) const
 Get the minimum number of iterations. More...
 
int GetMaximumIterations (void) const
 Get the maximal number of iterations. More...
 
bool InitResidual (const double res)
 Initialize the initial residual. More...
 
void Clear (void)
 Clear (reset) More...
 
bool CheckResidual (const double res)
 Check the residual (this count also the number of iterations) More...
 
bool CheckResidual (const double res, const int index)
 Check the residual and index value for the inf norm (this count also the number of iterations) More...
 
bool CheckResidualNoCount (const double res) const
 Check the residual (without counting the number of iterations) More...
 
void RecordHistory (void)
 Record the history of the residual. More...
 
void WriteHistoryToFile (const std::string filename) const
 Write the history of the residual to an ASCII file. More...
 
void Verbose (const int verb=1)
 Provide verbose output of the solver (iter, residual) More...
 
void PrintInit (void)
 Print the initialized information of the iteration control. More...
 
void PrintStatus (void)
 Print the current status (is the any criteria reached or not) More...
 
int GetIterationCount (void)
 
double GetCurrentResidual (void)
 
int GetSolverStatus (void)
 
int GetAmaxResidualIndex (void)
 Return absolute maximum index of residual vector when using Linf norm. More...
 

Private Attributes

int verb_
 Verbose flag verb == 0 no output verb == 1 print info about the solver (start,end); verb == 2 print (iter, residual) via iteration control;. More...
 
int iteration_
 Iteration count. More...
 
bool init_res_
 Flag == true after calling InitResidual() More...
 
double initial_residual_
 Initial residual. More...
 
double absolute_tol_
 Absolute tolerance. More...
 
double relative_tol_
 Relative tolerance. More...
 
double divergence_tol_
 Divergence tolerance. More...
 
int minimum_iter_
 Minimum number of iteration. More...
 
int maximum_iter_
 Maximum number of iteration. More...
 
int reached_
 Indicator for the reached criteria: 0 - not yet; 1 - abs tol is reached; 2 - rel tol is reached; 3 - div tol is reached; 4 - max iter is reached. More...
 
std::vector< double > residual_history_
 STL vector keeping the residual history. More...
 
double current_res_
 Current residual (obtained via CheckResidual()) More...
 
int current_index_
 Current residual, index for the inf norm (obtained via CheckResidual()) More...
 
bool rec_
 Flag == true then the residual is recorded in the residual_history_ vector. More...
 

Detailed Description

Iteration control for iterative solvers, monitor the residual (L2 norm) behavior.

Constructor & Destructor Documentation

paralution::IterationControl::IterationControl ( )
paralution::IterationControl::~IterationControl ( )

Member Function Documentation

bool paralution::IterationControl::CheckResidual ( const double  res)

Check the residual (this count also the number of iterations)

Referenced by CheckResidual().

bool paralution::IterationControl::CheckResidual ( const double  res,
const int  index 
)

Check the residual and index value for the inf norm (this count also the number of iterations)

bool paralution::IterationControl::CheckResidualNoCount ( const double  res) const

Check the residual (without counting the number of iterations)

void paralution::IterationControl::Clear ( void  )

Clear (reset)

Referenced by IterationControl(), and ~IterationControl().

int paralution::IterationControl::GetAmaxResidualIndex ( void  )

Return absolute maximum index of residual vector when using Linf norm.

double paralution::IterationControl::GetCurrentResidual ( void  )
int paralution::IterationControl::GetIterationCount ( void  )
int paralution::IterationControl::GetMaximumIterations ( void  ) const

Get the maximal number of iterations.

int paralution::IterationControl::GetMinimumIterations ( void  ) const

Get the minimum number of iterations.

int paralution::IterationControl::GetSolverStatus ( void  )
void paralution::IterationControl::Init ( const double  abs,
const double  rel,
const double  div,
const int  max 
)

Initialize with absolute/relative/divergence tolerance and maximum number of iterations.

void paralution::IterationControl::Init ( const double  abs,
const double  rel,
const double  div,
const int  min,
const int  max 
)

Initialize with absolute/relative/divergence tolerance and minimum/maximum number of iterations.

void paralution::IterationControl::InitMaximumIterations ( const int  max)

Set the maximal number of iterations.

Referenced by Init().

void paralution::IterationControl::InitMinimumIterations ( const int  min)

Set the minimum number of iterations.

Referenced by Init().

bool paralution::IterationControl::InitResidual ( const double  res)

Initialize the initial residual.

void paralution::IterationControl::InitTolerance ( const double  abs,
const double  rel,
const double  div 
)

Initialize with absolute/relative/divergence tolerance.

Referenced by Init().

void paralution::IterationControl::PrintInit ( void  )

Print the initialized information of the iteration control.

void paralution::IterationControl::PrintStatus ( void  )

Print the current status (is the any criteria reached or not)

void paralution::IterationControl::RecordHistory ( void  )

Record the history of the residual.

void paralution::IterationControl::Verbose ( const int  verb = 1)

Provide verbose output of the solver (iter, residual)

void paralution::IterationControl::WriteHistoryToFile ( const std::string  filename) const

Write the history of the residual to an ASCII file.

Field Documentation

double paralution::IterationControl::absolute_tol_
private
int paralution::IterationControl::current_index_
private

Current residual, index for the inf norm (obtained via CheckResidual())

Referenced by CheckResidual(), Clear(), and GetAmaxResidualIndex().

double paralution::IterationControl::current_res_
private

Current residual (obtained via CheckResidual())

Referenced by CheckResidual(), Clear(), GetCurrentResidual(), and PrintStatus().

double paralution::IterationControl::divergence_tol_
private

Divergence tolerance.

Referenced by CheckResidual(), CheckResidualNoCount(), Clear(), InitTolerance(), and PrintInit().

bool paralution::IterationControl::init_res_
private

Flag == true after calling InitResidual()

Referenced by CheckResidual(), CheckResidualNoCount(), Clear(), and InitResidual().

double paralution::IterationControl::initial_residual_
private

Initial residual.

Referenced by CheckResidual(), CheckResidualNoCount(), InitResidual(), and PrintStatus().

int paralution::IterationControl::iteration_
private
int paralution::IterationControl::maximum_iter_
private
int paralution::IterationControl::minimum_iter_
private
int paralution::IterationControl::reached_
private

Indicator for the reached criteria: 0 - not yet; 1 - abs tol is reached; 2 - rel tol is reached; 3 - div tol is reached; 4 - max iter is reached.

Referenced by CheckResidual(), Clear(), GetSolverStatus(), InitResidual(), and PrintStatus().

bool paralution::IterationControl::rec_
private

Flag == true then the residual is recorded in the residual_history_ vector.

Referenced by CheckResidual(), Clear(), InitResidual(), and RecordHistory().

double paralution::IterationControl::relative_tol_
private

Relative tolerance.

Referenced by CheckResidual(), CheckResidualNoCount(), Clear(), InitTolerance(), and PrintInit().

std::vector<double> paralution::IterationControl::residual_history_
private

STL vector keeping the residual history.

Referenced by CheckResidual(), Clear(), InitResidual(), and WriteHistoryToFile().

int paralution::IterationControl::verb_
private

Verbose flag verb == 0 no output verb == 1 print info about the solver (start,end); verb == 2 print (iter, residual) via iteration control;.

Referenced by CheckResidual(), Clear(), InitResidual(), and Verbose().


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