Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
ReductionControl Class Reference

#include <deal.II/lac/solver_control.h>

Inheritance diagram for ReductionControl:
[legend]

Public Member Functions

 ReductionControl (const unsigned int maxiter=100, const double tolerance=1.e-10, const double reduce=1.e-2, const bool log_history=false, const bool log_result=true)
 
 ReductionControl (const SolverControl &c)
 
ReductionControloperator= (const SolverControl &c)
 
virtual ~ReductionControl () override=default
 
void parse_parameters (ParameterHandler &param)
 
virtual State check (const unsigned int step, const double check_value) override
 
double reduction () const
 
double set_reduction (const double)
 
- Public Member Functions inherited from SolverControl
 SolverControl (const unsigned int n=100, const double tol=1.e-10, const bool log_history=false, const bool log_result=true)
 
virtual ~SolverControl () override=default
 
void parse_parameters (ParameterHandler &param)
 
State last_check () const
 
double initial_value () const
 
double last_value () const
 
unsigned int last_step () const
 
unsigned int max_steps () const
 
unsigned int set_max_steps (const unsigned int)
 
void set_failure_criterion (const double rel_failure_residual)
 
void clear_failure_criterion ()
 
double tolerance () const
 
double set_tolerance (const double)
 
void enable_history_data ()
 
const std::vector< double > & get_history_data () const
 
double average_reduction () const
 
double final_reduction () const
 
double step_reduction (unsigned int step) const
 
void log_history (const bool)
 
bool log_history () const
 
unsigned int log_frequency (unsigned int)
 
void log_result (const bool)
 
bool log_result () const
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&) noexcept
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&) noexcept
 
void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
template<typename StreamType >
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Static Public Member Functions

static void declare_parameters (ParameterHandler &param)
 
- Static Public Member Functions inherited from SolverControl
static void declare_parameters (ParameterHandler &param)
 
static ::ExceptionBaseExcHistoryDataRequired ()
 
- Static Public Member Functions inherited from Subscriptor
static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 

Protected Attributes

double reduce
 
double reduced_tol
 
- Protected Attributes inherited from SolverControl
unsigned int maxsteps
 
double tol
 
State lcheck
 
double initial_val
 
double lvalue
 
unsigned int lstep
 
bool check_failure
 
double relative_failure_residual
 
double failure_residual
 
bool m_log_history
 
unsigned int m_log_frequency
 
bool m_log_result
 
bool history_data_enabled
 
std::vector< double > history_data
 

Additional Inherited Members

- Public Types inherited from SolverControl
enum  State { iterate = 0, success, failure }
 

Detailed Description

Specialization of SolverControl which returns success if either the specified tolerance is achieved or if the initial residual (or whatever criterion was chosen by the solver class) is reduced by a given factor. This is useful in cases where you don't want to solve exactly, but rather want to gain two digits or if the maximal number of iterations is achieved. For example: The maximal number of iterations is 20, the reduction factor is 1% and the tolerance is 0.1%. The initial residual is 2.5. The process will break if 20 iteration are completed or the new residual is less then 2.5*1% or if it is less then 0.1%.

Author
Guido Kanschat

Definition at line 425 of file solver_control.h.

Constructor & Destructor Documentation

◆ ReductionControl() [1/2]

ReductionControl::ReductionControl ( const unsigned int  maxiter = 100,
const double  tolerance = 1.e-10,
const double  reduce = 1.e-2,
const bool  log_history = false,
const bool  log_result = true 
)

Constructor. Provide the reduction factor in addition to arguments that have the same meaning as those of the constructor of the SolverControl constructor.

Definition at line 227 of file solver_control.cc.

◆ ReductionControl() [2/2]

ReductionControl::ReductionControl ( const SolverControl c)

Initialize with a SolverControl object. The result will emulate SolverControl by setting reduce to zero.

Definition at line 238 of file solver_control.cc.

◆ ~ReductionControl()

virtual ReductionControl::~ReductionControl ( )
overridevirtualdefault

Virtual destructor is needed as there are virtual functions in this class.

Member Function Documentation

◆ operator=()

ReductionControl & ReductionControl::operator= ( const SolverControl c)

Assign a SolverControl object to ReductionControl. The result of the assignment will emulate SolverControl by setting reduce to zero.

Definition at line 248 of file solver_control.cc.

◆ declare_parameters()

void ReductionControl::declare_parameters ( ParameterHandler param)
static

Interface to parameter file.

Definition at line 294 of file solver_control.cc.

◆ parse_parameters()

void ReductionControl::parse_parameters ( ParameterHandler param)

Read parameters from file.

Definition at line 302 of file solver_control.cc.

◆ check()

SolverControl::State ReductionControl::check ( const unsigned int  step,
const double  check_value 
)
overridevirtual

Decide about success or failure of an iteration. This function calls the one in the base class, but sets the tolerance to reduction * initial value upon the first iteration.

Reimplemented from SolverControl.

Definition at line 258 of file solver_control.cc.

◆ reduction()

double ReductionControl::reduction ( ) const

Reduction factor.

◆ set_reduction()

double ReductionControl::set_reduction ( const double  )

Change reduction factor.

Member Data Documentation

◆ reduce

double ReductionControl::reduce
protected

Desired reduction factor.

Definition at line 494 of file solver_control.h.

◆ reduced_tol

double ReductionControl::reduced_tol
protected

Reduced tolerance. Stop iterations if either this value is achieved or if the base class indicates success.

Definition at line 500 of file solver_control.h.


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