ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::odeiv2::control Class Reference

Adaptive step size control. More...

#include <odeiv2.hpp>

Collaboration diagram for gsl::odeiv2::control:
Collaboration graph

Public Types

typedef gsl_odeiv2_control_type type
 Convenience typedef. More...
 

Public Member Functions

 control ()
 The default constructor is only really useful for assigning to. More...
 
 control (type const *T)
 The constructor creates a new control of type T. More...
 
 control (gsl_odeiv2_control *v)
 Could construct from a gsl_odeiv2_control. More...
 
 control (control const &v)
 The copy constructor. More...
 
controloperator= (control const &v)
 The assignment operator. More...
 
 ~control ()
 The destructor only deletes the pointers if count reaches zero. More...
 
 control (control &&v)
 Move constructor. More...
 
controloperator= (control &&v)
 Move operator. More...
 
bool operator== (control const &v) const
 Two control are identically equal if their elements are identical. More...
 
bool operator!= (control const &v) const
 Two control are different if their elements are not identical. More...
 
bool operator< (control const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator> (control const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator<= (control const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator>= (control const &v) const
 A container needs to define an ordering for sorting. More...
 
bool empty () const
 Find if the control is empty. More...
 
void swap (control &v)
 Swap two control objects. More...
 
gsl_odeiv2_control * get () const
 Get the gsl_odeiv2_control. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_odeiv2_control. More...
 
size_t use_count () const
 Find how many control objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 
int init (double eps_abs, double eps_rel, double a_y, double a_dydt)
 C++ version of gsl_odeiv2_control_init(). More...
 
int hadjust (step &s, double const y[], double const yerr[], double const dydt[], double *h)
 C++ version of gsl_odeiv2_control_hadjust(). More...
 
template<typename Y , typename YERR , typename DYDT >
int hadjust (step &s, Y const &y, YERR const &yerr, DYDT const &dydt, double &h)
 C++ version of gsl_odeiv2_control_hadjust(). More...
 
char const * name () const
 C++ version of gsl_odeiv2_control_name(). More...
 
int errlevel (double const y, double const dydt, double const h, size_t const ind, double &errlev)
 C++ version of gsl_odeiv2_control_errlevel(). More...
 
int set_driver (driver const &d)
 C++ version of gsl_odeiv2_control_set_driver(). More...
 

Static Public Member Functions

static control standard_new (double eps_abs, double eps_rel, double a_y, double a_dydt)
 C++ version of gsl_odeiv2_control_standard_new(). More...
 
static control y_new (double eps_abs, double eps_rel)
 C++ version of gsl_odeiv2_control_y_new(). More...
 
static control yp_new (double eps_abs, double eps_rel)
 C++ version of gsl_odeiv2_control_yp_new(). More...
 
template<typename SCALE_ABS >
static control scaled_new (double eps_abs, double eps_rel, double a_y, double a_dydt, SCALE_ABS const &scale_abs)
 C++ version of gsl_odeiv2_control_scaled_new(). More...
 

Private Attributes

gsl_odeiv2_control * ccgsl_pointer
 The shared pointer. More...
 
size_t * count
 The shared reference count. More...
 

Detailed Description

Adaptive step size control.

Definition at line 411 of file odeiv2.hpp.

Member Typedef Documentation

◆ type

typedef gsl_odeiv2_control_type gsl::odeiv2::control::type

Convenience typedef.

Definition at line 416 of file odeiv2.hpp.

Constructor & Destructor Documentation

◆ control() [1/5]

gsl::odeiv2::control::control ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 420 of file odeiv2.hpp.

References ccgsl_pointer, and count.

Referenced by operator=(), scaled_new(), standard_new(), y_new(), and yp_new().

◆ control() [2/5]

gsl::odeiv2::control::control ( type const *  T)
inlineexplicit

The constructor creates a new control of type T.

The four static constructors are more useful if you have not defined a type.

Parameters
TThe type

Definition at line 431 of file odeiv2.hpp.

References ccgsl_pointer, and count.

◆ control() [3/5]

gsl::odeiv2::control::control ( gsl_odeiv2_control *  v)
inlineexplicit

Could construct from a gsl_odeiv2_control.

This is not usually a good idea. In this case we should not use gsl_odeiv2_control_free() to deallocate the memory.

Parameters
vThe control

Definition at line 447 of file odeiv2.hpp.

References ccgsl_pointer, and count.

◆ control() [4/5]

gsl::odeiv2::control::control ( control const &  v)
inline

The copy constructor.

This creates a new reference to the workspace.

Parameters
vThe control to copy.

Definition at line 458 of file odeiv2.hpp.

References ccgsl_pointer, and count.

◆ ~control()

gsl::odeiv2::control::~control ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 477 of file odeiv2.hpp.

References ccgsl_pointer, and count.

◆ control() [5/5]

gsl::odeiv2::control::control ( control &&  v)
inline

Move constructor.

Parameters
vThe control to move.

Definition at line 489 of file odeiv2.hpp.

References count.

Member Function Documentation

◆ empty()

bool gsl::odeiv2::control::empty ( ) const
inline

Find if the control is empty.

Returns
true if has size zero; otherwise false

Definition at line 566 of file odeiv2.hpp.

References ccgsl_pointer.

◆ errlevel()

int gsl::odeiv2::control::errlevel ( double const  y,
double const  dydt,
double const  h,
size_t const  ind,
double &  errlev 
)
inline

C++ version of gsl_odeiv2_control_errlevel().

Parameters
yThe current value of y
dydtThe current value of dydt
hThe current step size
indThe index
errlevThe desired error level (return value)
Returns
Error code on failure

Definition at line 684 of file odeiv2.hpp.

References get().

◆ get()

gsl_odeiv2_control * gsl::odeiv2::control::get ( ) const
inline

Get the gsl_odeiv2_control.

Returns
the gsl_odeiv2_control

Definition at line 592 of file odeiv2.hpp.

References ccgsl_pointer.

Referenced by gsl::odeiv2::evolve::apply(), gsl::odeiv2::evolve::apply_fixed_step(), errlevel(), hadjust(), init(), name(), and set_driver().

◆ hadjust() [1/2]

int gsl::odeiv2::control::hadjust ( step s,
double const  y[],
double const  yerr[],
double const  dydt[],
double *  h 
)
inline

C++ version of gsl_odeiv2_control_hadjust().

Parameters
sThe step
y[]Current value of y
yerr[]Current value of yerr
dydt[]Current value of dydt
hStep size (return value)
Returns
GSL_ODEIV_HADJ_DEC, GSL_ODEIV_HADJ_INC or GSL_ODEIV_HADJ_NIL according as h is decreased, may be increased or is unchanged

Definition at line 636 of file odeiv2.hpp.

References gsl::odeiv2::step::get(), and get().

◆ hadjust() [2/2]

template<typename Y , typename YERR , typename DYDT >
int gsl::odeiv2::control::hadjust ( step s,
Y const &  y,
YERR const &  yerr,
DYDT const &  dydt,
double &  h 
)
inline

C++ version of gsl_odeiv2_control_hadjust().

This version allows arrays as gsl::vector objects (or std::vector<double>).

Parameters
sThe step
yCurrent value of y
yerrCurrent value of yerr
dydtCurrent value of dydt
hStep size (return value)
Returns
GSL_ODEIV_HADJ_DEC, GSL_ODEIV_HADJ_INC or GSL_ODEIV_HADJ_NIL according as h is decreased, may be increased or is unchanged

Definition at line 651 of file odeiv2.hpp.

References gsl::odeiv2::step::get(), and get().

◆ init()

int gsl::odeiv2::control::init ( double  eps_abs,
double  eps_rel,
double  a_y,
double  a_dydt 
)
inline

C++ version of gsl_odeiv2_control_init().

Parameters
eps_absAbsolute error
eps_relRelative error
a_yScaling factor for y
a_dydtScaling factor for dydt
Returns
Error code on failure

Definition at line 623 of file odeiv2.hpp.

References get().

◆ name()

char const * gsl::odeiv2::control::name ( ) const
inline

C++ version of gsl_odeiv2_control_name().

Returns
The name of the control type.

Definition at line 659 of file odeiv2.hpp.

References get().

◆ operator bool()

gsl::odeiv2::control::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

Returns
true or false according as this contains a pointer to a gsl_odeiv2_control.

Definition at line 612 of file odeiv2.hpp.

References ccgsl_pointer.

◆ operator!=()

bool gsl::odeiv2::control::operator!= ( control const &  v) const
inline

Two control are different if their elements are not identical.

Parameters
vThe control to be compared with this
Returns
false or true according as this and v have identical elements or not

Definition at line 519 of file odeiv2.hpp.

References operator==().

◆ operator<()

bool gsl::odeiv2::control::operator< ( control const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a control is nonnegative.

Parameters
vThe control to be compared with this
Returns
false or true according as this is less than v lexicographically

Definition at line 531 of file odeiv2.hpp.

References ccgsl_pointer.

◆ operator<=()

bool gsl::odeiv2::control::operator<= ( control const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a control is nonnegative.

Parameters
vThe control to be compared with this
Returns
false or true according as this is less than or equal to v lexicographically

Definition at line 551 of file odeiv2.hpp.

References ccgsl_pointer.

◆ operator=() [1/2]

control & gsl::odeiv2::control::operator= ( control &&  v)
inline

Move operator.

Parameters
vThe control to move.
Returns
A reference to this.

Definition at line 498 of file odeiv2.hpp.

References control().

◆ operator=() [2/2]

control & gsl::odeiv2::control::operator= ( control const &  v)
inline

The assignment operator.

This copies elementwise.

Parameters
vThe control to copy

Definition at line 465 of file odeiv2.hpp.

References ccgsl_pointer, and count.

◆ operator==()

bool gsl::odeiv2::control::operator== ( control const &  v) const
inline

Two control are identically equal if their elements are identical.

Parameters
vThe control to be compared with this
Returns
true or false according as this and v have identical elements or not

Definition at line 511 of file odeiv2.hpp.

References ccgsl_pointer.

Referenced by operator!=().

◆ operator>()

bool gsl::odeiv2::control::operator> ( control const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a control is nonnegative.

Parameters
vThe control to be compared with this
Returns
false or true according as this is greater than v lexicographically

Definition at line 541 of file odeiv2.hpp.

References ccgsl_pointer.

◆ operator>=()

bool gsl::odeiv2::control::operator>= ( control const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a control is nonnegative.

Parameters
vThe control to be compared with this
Returns
false or true according as this is no less than v lexicographically

Definition at line 561 of file odeiv2.hpp.

References ccgsl_pointer.

◆ scaled_new()

template<typename SCALE_ABS >
static control gsl::odeiv2::control::scaled_new ( double  eps_abs,
double  eps_rel,
double  a_y,
double  a_dydt,
SCALE_ABS const &  scale_abs 
)
inlinestatic

C++ version of gsl_odeiv2_control_scaled_new().

This version allows scale_abs to be gsl::vector or anything for which scale_abs.data() returns an array of doubles.

Parameters
eps_absAbsolute error
eps_relRelative error
a_yScaling factor for y
a_dydtScaling factor for dydt
scale_absAn array of scales for absolute error
Returns
The control object (shared pointer)

Definition at line 754 of file odeiv2.hpp.

References control().

◆ set_driver()

int gsl::odeiv2::control::set_driver ( driver const &  d)
inline

C++ version of gsl_odeiv2_control_set_driver().

Parameters
dThe driver
Returns
Error code on failure

Definition at line 1408 of file odeiv2.hpp.

References get(), and gsl::odeiv2::driver::get().

◆ standard_new()

static control gsl::odeiv2::control::standard_new ( double  eps_abs,
double  eps_rel,
double  a_y,
double  a_dydt 
)
inlinestatic

C++ version of gsl_odeiv2_control_standard_new().

Parameters
eps_absAbsolute error
eps_relRelative error
a_yScaling factor for y
a_dydtScaling factor for dydt
Returns
The control object (shared pointer)

Definition at line 704 of file odeiv2.hpp.

References control().

◆ swap()

void gsl::odeiv2::control::swap ( control v)
inline

Swap two control objects.

This works even if the control have different sizes because it swaps pointers.

Parameters
vThe control to swap with this.

Definition at line 573 of file odeiv2.hpp.

References ccgsl_pointer, and count.

◆ unique()

bool gsl::odeiv2::control::unique ( ) const
inline

Find if this is the only object sharing the gsl_odeiv2_control.

Returns
true or falses according as this is the only control object sharing the gsl_odeiv2_control.

Definition at line 598 of file odeiv2.hpp.

References count.

◆ use_count()

size_t gsl::odeiv2::control::use_count ( ) const
inline

Find how many control objects share this pointer.

Returns
the number of control objects that share this pointer.

Definition at line 603 of file odeiv2.hpp.

References count.

◆ y_new()

static control gsl::odeiv2::control::y_new ( double  eps_abs,
double  eps_rel 
)
inlinestatic

C++ version of gsl_odeiv2_control_y_new().

Parameters
eps_absAbsolute error
eps_relRelative error
Returns
The control object (shared pointer)

Definition at line 714 of file odeiv2.hpp.

References control().

◆ yp_new()

static control gsl::odeiv2::control::yp_new ( double  eps_abs,
double  eps_rel 
)
inlinestatic

C++ version of gsl_odeiv2_control_yp_new().

Parameters
eps_absAbsolute error
eps_relRelative error
Returns
The control object (shared pointer)

Definition at line 723 of file odeiv2.hpp.

References control().

Member Data Documentation

◆ ccgsl_pointer

gsl_odeiv2_control* gsl::odeiv2::control::ccgsl_pointer
private

The shared pointer.

Definition at line 581 of file odeiv2.hpp.

Referenced by control(), empty(), get(), operator bool(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), swap(), and ~control().

◆ count

size_t* gsl::odeiv2::control::count
private

The shared reference count.

Definition at line 585 of file odeiv2.hpp.

Referenced by control(), operator=(), swap(), unique(), use_count(), and ~control().


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