|
| MultistepTimeloop ()=default |
| no allocation More...
|
|
| MultistepTimeloop (std::function< void(value_type &, ContainerType &)> step, value_type dt) |
| Construct using a std::function . More...
|
|
template<class Stepper , class ODE > |
| MultistepTimeloop (Stepper &&stepper, ODE &&ode, value_type t0, const ContainerType &u0, value_type dt) |
| Initialize and bind the step function of a Multistep stepper. More...
|
|
template<class ... Params> |
void | construct (Params &&...ps) |
| Perfect forward parameters to one of the constructors. More...
|
|
virtual MultistepTimeloop * | clone () const |
| Abstract copy method that returns a copy of *this on the heap. More...
|
|
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 () |
|
template<class ContainerType>
struct dg::MultistepTimeloop< ContainerType >
Integrate using a for loop and a fixed non-changeable time-step.
The implementation (of integrate) is equivalent to
unsigned N = round((t1 - t0)/dt);
for( unsigned i=0; i<N; i++)
step( t0, u1);
void copy(const ContainerTypeIn &source, ContainerTypeOut &target)
Definition: blas1.h:164
where dt
is a given constant. t1
can only be matched exactly if the timestep evenly divides the given interval.
- Note
- the difference to dg::SinglestepTimeloop is the way the step function is called and the fact that
dt
cannot be changed
- See also
- AdaptiveTimeloop, SinglestepTimeloop
- Template Parameters
-
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
dg::HVec (serial), dg::DVec (cuda / omp), dg::MHVec (mpi + serial) or dg::MDVec (mpi + cuda / omp)
std::vector<dg::DVec> (vector of shared device vectors), std::array<double, 4> (array of 4 doubles) or std::map < std::string, dg::DVec> ( a map of named vectors)
double (scalar) and other primitive types ...
If there are several ContainerTypes in the argument list, then TensorTraits must exist for all of them |
- See also
- See The dg dispatch system for a detailed explanation of our type dispatch system
template<class ContainerType >
template<class Stepper , class ODE >
Initialize and bind the step function of a Multistep stepper.
First call stepper.init()
. Then construct a lambda function that calls the step function of stepper
with given parameters and stores it internally in a std::function
- Template Parameters
-
- Parameters
-
stepper | If constructed in-place (rvalue), will be copied into the lambda. If an lvalue, then the lambda stores a reference |
- Attention
- If stepper is an lvalue then you need to make sure that stepper remains valid to avoid a "dangling reference"
- Template Parameters
-
ODE | The ExplicitRHS or tuple type that corresponds to what is inserted into the step member of the Stepper |
- Parameters
-
ode | rhs or tuple |
t0 | The initial time (forwarded to stepper.init( ode, t0, u0, dt) ) |
u0 | The initial condition (forwarded to stepper.init( ode, t0, u0, dt) ) |
dt | The constant timestep. Can be negative. Cannot be changed as changing it would require to re-init the multistep stepper (which is hidden in the lambda). (forwarded to stepper.init( ode, t0, u0, dt) ) |