Discontinuous Galerkin Library
#include "dg/algorithm.h"
|
Abstract timeloop independent of stepper and ODE. More...
Public Types | |
using | value_type = dg::get_value_type< ContainerType > |
using | container_type = ContainerType |
Public Member Functions | |
void | integrate (value_type t0, const ContainerType &u0, value_type t1, ContainerType &u1) |
Integrate a differential equation between given bounds. More... | |
void | integrate (value_type &t0, const ContainerType &u0, value_type t1, ContainerType &u1, enum to mode) |
Build your own timeloop. More... | |
value_type | get_dt () const |
The current timestep. More... | |
virtual aTimeloop * | clone () const =0 |
Abstract copy method that returns a copy of *this on the heap. More... | |
virtual | ~aTimeloop () |
Protected Member Functions | |
aTimeloop () | |
empty More... | |
aTimeloop (const aTimeloop &) | |
empty More... | |
aTimeloop & | operator= (const aTimeloop &) |
return *this More... | |
Abstract timeloop independent of stepper and ODE.
This class enables to write abstract time-loops that are independent of the used stepper (e.g. dg::RungeKutta, dg::ExplicitMultistep, ...) and the differential equation in use. The recommended way to implement it is using a std::function that erases the latter tpyes and emulates the step function of the stepper type.
ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag . Among others
ContainerTypes in the argument list, then TensorTraits must exist for all of them |
using dg::aTimeloop< ContainerType >::container_type = ContainerType |
using dg::aTimeloop< ContainerType >::value_type = dg::get_value_type<ContainerType> |
|
inlinevirtual |
|
inlineprotected |
empty
|
inlineprotected |
empty
|
pure virtual |
Abstract copy method that returns a copy of *this on the heap.
Implemented in dg::AdaptiveTimeloop< ContainerType >, dg::MultistepTimeloop< ContainerType >, and dg::SinglestepTimeloop< ContainerType >.
|
inline |
The current timestep.
dt
value at the end of the latest call to integrate. If integrate fails for some reason then return the timestep at which the failure happens. Undefined if integrate
has not been called at least once.
|
inline |
Build your own timeloop.
Integrate an ode from t = t0
until t >= t1
using a set of discrete steps with or without forcing a certain timestep to match t1 exactly. For example, if t0=0
and t1=1
and the timestep is dt=0.6
then the timestepper without forcing stops at t1=1.2
This behaviour is useful especially for adaptive timesteppers because it allows to implement timeloops with minimal interference with the controller
t0 | (read-write) initial time on entry; on exit it is the value to where the ode is actually integrated, corresponding to u1 |
u0 | initial value at t0 |
t1 | (read-only) end time |
u1 | (write only) contains the result corresponding to exactly or at least t1 on output (may alias u0) |
mode | either integrate exactly to t1 or at least to t1 . In dg::at_least mode the timestep is bound only by t1-t0 |
dg::Error
(or anything derived from std::exception
).
|
inline |
Integrate a differential equation between given bounds.
Integrate an ode from t = t0
until t == t1
using a set of discrete steps and forcing the last timestep to land on t1 exactly.
t0 | initial time |
u0 | initial value at t0 |
t1 | end time |
u1 | (write only) contains the result corresponding to t1 on output. May alias u0 . |
dg::Error
(or anything derived from std::exception
).
|
inlineprotected |
return *this