numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::ode::pi_step_size_controller< Formula > Class Template Reference

Class to control step sizes using PI controller [8]. More...

#include <num_collect/ode/pi_step_size_controller.h>

+ Inheritance diagram for num_collect::ode::pi_step_size_controller< Formula >:
+ Collaboration diagram for num_collect::ode::pi_step_size_controller< Formula >:

Public Types

using base_type
 Base class.
 
- Public Types inherited from num_collect::ode::step_size_controller_base< pi_step_size_controller< Formula >, Formula >
using formula_type
 Type of formula.
 
using problem_type
 Type of problem.
 
using scalar_type
 Type of scalars.
 
using variable_type
 Type of variables.
 

Public Member Functions

 pi_step_size_controller ()
 Constructor.
 
auto check_and_calc_next (scalar_type &step_size, const variable_type &variable, const variable_type &error) -> bool
 Check the error estimate and calculate the next step size.
 
auto current_step_error_exponent (const scalar_type &val) -> pi_step_size_controller &
 Set the exponent of the error of the current time step.
 
void init ()
 Initialize.
 
auto max_step_size_factor (const scalar_type &val) -> pi_step_size_controller &
 Set the maximum factor of step sizes.
 
auto min_step_size_factor (const scalar_type &val) -> pi_step_size_controller &
 Set the minimum factor of step sizes.
 
auto previous_step_error_exponent (const scalar_type &val) -> pi_step_size_controller &
 Set the exponent of the error of the previous time step.
 
auto step_size_factor_safety_coeff (const scalar_type &val) -> pi_step_size_controller &
 Set the safety coefficient for factors of step sizes.
 
- Public Member Functions inherited from num_collect::ode::step_size_controller_base< pi_step_size_controller< Formula >, Formula >
auto limits () const -> const step_size_limits< scalar_type > &
 Get the limits of step sizes.
 
auto limits (const step_size_limits< scalar_type > &val) -> pi_step_size_controller< Formula > &
 Set the limits of step sizes.
 
auto reduction_rate (const scalar_type &val) -> pi_step_size_controller< Formula > &
 Set the rate to reduce step sizes when error is large.
 
auto tolerances () const -> const error_tolerances< variable_type > &
 Get the error tolerances.
 
auto tolerances (const error_tolerances< variable_type > &val) -> pi_step_size_controller< Formula > &
 Set the error tolerances.
 
- Public Member Functions inherited from num_collect::logging::logging_mixin
 logging_mixin (log_tag_view tag)
 Constructor.
 
template<typename Child >
void configure_child_algorithm_logger_if_exists (Child &child)
 Configure a logger of a child algorithm if exists.
 
auto logger () const noexcept -> const num_collect::logging::logger &
 Access to the logger.
 
auto logger () noexcept -> num_collect::logging::logger &
 Access to the logger.
 

Static Public Attributes

static constexpr scalar_type default_current_step_error_exponent
 Default exponent of the error of the current time step.
 
static constexpr scalar_type default_previous_step_error_exponent
 Default exponent of the error of the previous time step.
 
static constexpr index_type formula_order_for_exponent
 Order of the formula used in exponents.
 

Private Member Functions

void calc_next (scalar_type &step_size, const variable_type &variable, const variable_type &error)
 Calculate the next step size.
 

Private Attributes

scalar_type current_step_error_exponent_
 Exponent of the error of the current time step.
 
scalar_type max_step_size_factor_ {default_max_step_size_factor}
 Maximum factor of step sizes.
 
scalar_type min_step_size_factor_ {default_min_step_size_factor}
 Minimum factor of step sizes.
 
scalar_type previous_step_error_ {static_cast<scalar_type>(1)}
 Error of the previous time step.
 
scalar_type previous_step_error_exponent_
 Exponent of the error of the previous time step.
 
scalar_type step_size_factor_safety_coeff_
 Safety coefficient for factors of step sizes.
 

Static Private Attributes

static constexpr auto default_max_step_size_factor
 Default maximum factor of step sizes.
 
static constexpr auto default_min_step_size_factor
 Default minimum factor of step sizes.
 
static constexpr auto default_step_size_factor_safety_coeff
 Default safety coefficient for factors of step sizes.
 

Additional Inherited Members

- Protected Member Functions inherited from num_collect::ode::step_size_controller_base< pi_step_size_controller< Formula >, Formula >
 step_size_controller_base (logging::log_tag_view tag)
 Constructor.
 
auto derived () const noexcept -> const pi_step_size_controller< Formula > &
 Access derived object.
 
auto derived () noexcept -> pi_step_size_controller< Formula > &
 Access derived object.
 
auto reduce_if_needed (scalar_type &step_size, const variable_type &variable, const variable_type &error) -> bool
 Reduce step size if needed.
 

Detailed Description

template<concepts::formula Formula>
class num_collect::ode::pi_step_size_controller< Formula >

Class to control step sizes using PI controller [8].

Template Parameters
FormulaType of the formula.

Definition at line 47 of file pi_step_size_controller.h.

Member Typedef Documentation

◆ base_type

template<concepts::formula Formula>
using num_collect::ode::pi_step_size_controller< Formula >::base_type

Constructor & Destructor Documentation

◆ pi_step_size_controller()

template<concepts::formula Formula>
num_collect::ode::pi_step_size_controller< Formula >::pi_step_size_controller ( )
inline

Constructor.

Definition at line 85 of file pi_step_size_controller.h.

Member Function Documentation

◆ calc_next()

template<concepts::formula Formula>
void num_collect::ode::pi_step_size_controller< Formula >::calc_next ( scalar_type & step_size,
const variable_type & variable,
const variable_type & error )
inlineprivate

Calculate the next step size.

Parameters
[in,out]step_sizeStep size.
[in]variableVariable.
[in]errorError estimate.

Definition at line 197 of file pi_step_size_controller.h.

◆ check_and_calc_next()

template<concepts::formula Formula>
auto num_collect::ode::pi_step_size_controller< Formula >::check_and_calc_next ( scalar_type & step_size,
const variable_type & variable,
const variable_type & error ) -> bool
inlinenodiscard

Check the error estimate and calculate the next step size.

Parameters
[in,out]step_sizeStep size.
[in]variableVariable.
[in]errorError estimate.
Return values
trueGiven error satisfies tolerances.
falseGiven error doesn't satisfy tolerances.

Definition at line 103 of file pi_step_size_controller.h.

◆ current_step_error_exponent()

template<concepts::formula Formula>
auto num_collect::ode::pi_step_size_controller< Formula >::current_step_error_exponent ( const scalar_type & val) -> pi_step_size_controller&
inline

Set the exponent of the error of the current time step.

Parameters
[in]valValue.
Returns
This.

Definition at line 118 of file pi_step_size_controller.h.

◆ init()

template<concepts::formula Formula>
void num_collect::ode::pi_step_size_controller< Formula >::init ( )
inline

Initialize.

Definition at line 90 of file pi_step_size_controller.h.

◆ max_step_size_factor()

template<concepts::formula Formula>
auto num_collect::ode::pi_step_size_controller< Formula >::max_step_size_factor ( const scalar_type & val) -> pi_step_size_controller&
inline

Set the maximum factor of step sizes.

Parameters
[in]valValue.
Returns
This.

Definition at line 164 of file pi_step_size_controller.h.

◆ min_step_size_factor()

template<concepts::formula Formula>
auto num_collect::ode::pi_step_size_controller< Formula >::min_step_size_factor ( const scalar_type & val) -> pi_step_size_controller&
inline

Set the minimum factor of step sizes.

Parameters
[in]valValue.
Returns
This.

Definition at line 179 of file pi_step_size_controller.h.

◆ previous_step_error_exponent()

template<concepts::formula Formula>
auto num_collect::ode::pi_step_size_controller< Formula >::previous_step_error_exponent ( const scalar_type & val) -> pi_step_size_controller&
inline

Set the exponent of the error of the previous time step.

Parameters
[in]valValue.
Returns
This.

Definition at line 133 of file pi_step_size_controller.h.

◆ step_size_factor_safety_coeff()

template<concepts::formula Formula>
auto num_collect::ode::pi_step_size_controller< Formula >::step_size_factor_safety_coeff ( const scalar_type & val) -> pi_step_size_controller&
inline

Set the safety coefficient for factors of step sizes.

Parameters
[in]valValue.
Returns
This.

Definition at line 149 of file pi_step_size_controller.h.

Member Data Documentation

◆ current_step_error_exponent_

template<concepts::formula Formula>
scalar_type num_collect::ode::pi_step_size_controller< Formula >::current_step_error_exponent_
private
Initial value:
{
static constexpr scalar_type default_current_step_error_exponent
Default exponent of the error of the current time step.

Exponent of the error of the current time step.

Definition at line 230 of file pi_step_size_controller.h.

◆ default_current_step_error_exponent

template<concepts::formula Formula>
scalar_type num_collect::ode::pi_step_size_controller< Formula >::default_current_step_error_exponent
staticconstexpr
Initial value:
=
static_cast<scalar_type>(0.7) /
static constexpr index_type formula_order_for_exponent
Order of the formula used in exponents.

Default exponent of the error of the current time step.

This is a value proposed by [8].

Definition at line 69 of file pi_step_size_controller.h.

◆ default_max_step_size_factor

template<concepts::formula Formula>
auto num_collect::ode::pi_step_size_controller< Formula >::default_max_step_size_factor
staticconstexprprivate
Initial value:
=
static_cast<scalar_type>(2)

Default maximum factor of step sizes.

Definition at line 246 of file pi_step_size_controller.h.

◆ default_min_step_size_factor

template<concepts::formula Formula>
auto num_collect::ode::pi_step_size_controller< Formula >::default_min_step_size_factor
staticconstexprprivate
Initial value:
=
static_cast<scalar_type>(0.1)

Default minimum factor of step sizes.

Definition at line 253 of file pi_step_size_controller.h.

◆ default_previous_step_error_exponent

template<concepts::formula Formula>
scalar_type num_collect::ode::pi_step_size_controller< Formula >::default_previous_step_error_exponent
staticconstexpr
Initial value:
=
static_cast<scalar_type>(0.4) /

Default exponent of the error of the previous time step.

This is a value proposed by [8].

Definition at line 78 of file pi_step_size_controller.h.

◆ default_step_size_factor_safety_coeff

template<concepts::formula Formula>
auto num_collect::ode::pi_step_size_controller< Formula >::default_step_size_factor_safety_coeff
staticconstexprprivate
Initial value:
=
static_cast<scalar_type>(0.9)

Default safety coefficient for factors of step sizes.

Definition at line 238 of file pi_step_size_controller.h.

◆ formula_order_for_exponent

template<concepts::formula Formula>
index_type num_collect::ode::pi_step_size_controller< Formula >::formula_order_for_exponent
staticconstexpr
Initial value:
=
constexpr auto get_least_known_order() -> index_type
Get the least known order of a formula.

Order of the formula used in exponents.

Definition at line 61 of file pi_step_size_controller.h.

◆ max_step_size_factor_

template<concepts::formula Formula>
scalar_type num_collect::ode::pi_step_size_controller< Formula >::max_step_size_factor_ {default_max_step_size_factor}
private

Maximum factor of step sizes.

Definition at line 250 of file pi_step_size_controller.h.

◆ min_step_size_factor_

template<concepts::formula Formula>
scalar_type num_collect::ode::pi_step_size_controller< Formula >::min_step_size_factor_ {default_min_step_size_factor}
private

Minimum factor of step sizes.

Definition at line 257 of file pi_step_size_controller.h.

◆ previous_step_error_

template<concepts::formula Formula>
scalar_type num_collect::ode::pi_step_size_controller< Formula >::previous_step_error_ {static_cast<scalar_type>(1)}
private

Error of the previous time step.

Definition at line 227 of file pi_step_size_controller.h.

◆ previous_step_error_exponent_

template<concepts::formula Formula>
scalar_type num_collect::ode::pi_step_size_controller< Formula >::previous_step_error_exponent_
private
Initial value:
{
static constexpr scalar_type default_previous_step_error_exponent
Default exponent of the error of the previous time step.

Exponent of the error of the previous time step.

Definition at line 234 of file pi_step_size_controller.h.

◆ step_size_factor_safety_coeff_

template<concepts::formula Formula>
scalar_type num_collect::ode::pi_step_size_controller< Formula >::step_size_factor_safety_coeff_
private
Initial value:
{
static constexpr auto default_step_size_factor_safety_coeff
Default safety coefficient for factors of step sizes.

Safety coefficient for factors of step sizes.

Definition at line 242 of file pi_step_size_controller.h.


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