Gyselalib++
ITimeStepper< FieldMem, DerivFieldMem, ExecSpace > Class Template Referenceabstract

The superclass from which all timestepping methods inherit. More...

Public Types

using IdxRange = typename FieldMem::discrete_domain_type
 The type of the index range on which the values of the function are defined.
 
using ValField = typename FieldMem::span_type
 The type of the values of the function being evolved.
 
using ValConstField = typename FieldMem::view_type
 The constant type of the values of the function being evolved.
 
using DerivField = typename DerivFieldMem::span_type
 The type of the derivatives of the function being evolved.
 
using DerivConstField = typename DerivFieldMem::view_type
 The constant type of the derivatives values of the function being evolved.
 

Public Member Functions

void update (ValField y, double dt, std::function< void(DerivField, ValConstField)> dy_calculator) const
 Carry out one step of the timestepping scheme. More...
 
void update (ExecSpace const &exec_space, ValField y, double dt, std::function< void(DerivField, ValConstField)> dy_calculator) const
 Carry out one step of the timestepping scheme. More...
 
virtual void update (ExecSpace const &exec_space, ValField y, double dt, std::function< void(DerivField, ValConstField)> dy_calculator, std::function< void(ValField, DerivConstField, double)> y_update) const =0
 Carry out one step of the timestepping scheme. More...
 
template<class FieldType , class FuncType , std::size_t n_args>
void assemble_field_k_total (ExecSpace const &exec_space, FieldType k_total, FuncType func, std::array< FieldType, n_args > k_arr) const
 Calculate func(k_arr[0], k_arr[1], ...) when FieldType is a Field (ddc::ChunkSpan). More...
 
template<class FieldType , class FuncType , std::size_t n_args>
void assemble_vector_field_k_total (ExecSpace const &exec_space, FieldType k_total, FuncType func, std::array< FieldType, n_args > k_arr) const
 Calculate func(k_arr[0], k_arr[1], ...) when FieldType is a VectorField. More...
 

Protected Member Functions

void copy (ValField copy_to, ValConstField copy_from) const
 Make a copy of the values of the function being evolved. More...
 
template<class FuncType , class... T>
void assemble_k_total (ExecSpace const &exec_space, DerivField k_total, FuncType func, T... k) const
 A method to assemble multiple derivative fields into one. More...
 

Static Protected Member Functions

template<class DerivFieldType , class Idx , class... DDims>
static KOKKOS_FUNCTION void fill_k_total (DerivFieldType k_total, Idx i, Coord< DDims... > new_val)
 A method to fill an element of a vector field. More...
 

Detailed Description

template<class FieldMem, class DerivFieldMem = FieldMem, class ExecSpace = Kokkos::DefaultExecutionSpace>
class ITimeStepper< FieldMem, DerivFieldMem, ExecSpace >

The superclass from which all timestepping methods inherit.

The class exposes three update functions which are used to carry out one step of the chosen timestepping method to solve an ODE of the form: \(\partial_t y(t) = f(t, y(t)) \),

Member Function Documentation

◆ update() [1/3]

template<class FieldMem , class DerivFieldMem = FieldMem, class ExecSpace = Kokkos::DefaultExecutionSpace>
void ITimeStepper< FieldMem, DerivFieldMem, ExecSpace >::update ( ValField  y,
double  dt,
std::function< void(DerivField, ValConstField)>  dy_calculator 
) const
inline

Carry out one step of the timestepping scheme.

This function is a wrapper around the update function below. The values of the function are updated using the trivial method $f += df * dt$. This is the standard method however some cases may need a more complex update function which is why the more explicit method is also provided.

Parameters
[in,out]yThe value(s) which should be evolved over time defined on each of the dimensions at each point of the index range.
[in]dtThe time step over which the values should be evolved.
[in]dy_calculatorThe function describing how the derivative of the evolve function is calculated.

◆ update() [2/3]

template<class FieldMem , class DerivFieldMem = FieldMem, class ExecSpace = Kokkos::DefaultExecutionSpace>
void ITimeStepper< FieldMem, DerivFieldMem, ExecSpace >::update ( ExecSpace const &  exec_space,
ValField  y,
double  dt,
std::function< void(DerivField, ValConstField)>  dy_calculator 
) const
inline

Carry out one step of the timestepping scheme.

This function is a wrapper around the update function below. The values of the function are updated using the trivial method $f += df * dt$. This is the standard method however some cases may need a more complex update function which is why the more explicit method is also provided.

Parameters
[in]exec_spaceThe space on which the function is executed (CPU/GPU).
[in,out]yThe value(s) which should be evolved over time defined on each of the dimensions at each point of the index range.
[in]dtThe time step over which the values should be evolved.
[in]dy_calculatorThe function describing how the derivative of the evolve function is calculated.

◆ update() [3/3]

template<class FieldMem , class DerivFieldMem = FieldMem, class ExecSpace = Kokkos::DefaultExecutionSpace>
virtual void ITimeStepper< FieldMem, DerivFieldMem, ExecSpace >::update ( ExecSpace const &  exec_space,
ValField  y,
double  dt,
std::function< void(DerivField, ValConstField)>  dy_calculator,
std::function< void(ValField, DerivConstField, double)>  y_update 
) const
pure virtual

Carry out one step of the timestepping scheme.

Parameters
[in]exec_spaceThe space on which the function is executed (CPU/GPU).
[in,out]yThe value(s) which should be evolved over time defined on each of the dimensions at each point of the index range.
[in]dtThe time step over which the values should be evolved.
[in]dy_calculatorThe function describing how the derivative of the evolve function is calculated.
[in]y_updateThe function describing how the value(s) are updated using the derivative.

◆ copy()

template<class FieldMem , class DerivFieldMem = FieldMem, class ExecSpace = Kokkos::DefaultExecutionSpace>
void ITimeStepper< FieldMem, DerivFieldMem, ExecSpace >::copy ( ValField  copy_to,
ValConstField  copy_from 
) const
inlineprotected

Make a copy of the values of the function being evolved.

Parameters
[out]copy_tothe field that the values should be copied to.
[in]copy_fromThe field that the values should be copied from.

◆ fill_k_total()

template<class FieldMem , class DerivFieldMem = FieldMem, class ExecSpace = Kokkos::DefaultExecutionSpace>
template<class DerivFieldType , class Idx , class... DDims>
static KOKKOS_FUNCTION void ITimeStepper< FieldMem, DerivFieldMem, ExecSpace >::fill_k_total ( DerivFieldType  k_total,
Idx  i,
Coord< DDims... >  new_val 
)
inlinestaticprotected

A method to fill an element of a vector field.

Parameters
[out]k_totalThe vector field that will be filled.
[in]iThe index where the vector field should be filled.
[in]new_valThe coordinate that should be saved to the vector field.

◆ assemble_k_total()

template<class FieldMem , class DerivFieldMem = FieldMem, class ExecSpace = Kokkos::DefaultExecutionSpace>
template<class FuncType , class... T>
void ITimeStepper< FieldMem, DerivFieldMem, ExecSpace >::assemble_k_total ( ExecSpace const &  exec_space,
DerivField  k_total,
FuncType  func,
T...  k 
) const
inlineprotected

A method to assemble multiple derivative fields into one.

This method is responsible for choosing how this is done depending on the type of the derivative field.

Parameters
[in]exec_spaceThe space (CPU/GPU) where the calculation should be executed.
[out]k_totalThe field to be filled with the combined derivative fields.
[in]funcA function which combines an element from each of the derivative fields.
[in]kThe derivative fields being combined.

◆ assemble_field_k_total()

template<class FieldMem , class DerivFieldMem = FieldMem, class ExecSpace = Kokkos::DefaultExecutionSpace>
template<class FieldType , class FuncType , std::size_t n_args>
void ITimeStepper< FieldMem, DerivFieldMem, ExecSpace >::assemble_field_k_total ( ExecSpace const &  exec_space,
FieldType  k_total,
FuncType  func,
std::array< FieldType, n_args >  k_arr 
) const
inline

Calculate func(k_arr[0], k_arr[1], ...) when FieldType is a Field (ddc::ChunkSpan).

This function should be private but is public due to Cuda restrictions.

Parameters
[in]exec_spaceThe space (CPU/GPU) where the calculation should be executed.
[out]k_totalThe field to be filled with the combined derivative fields.
[in]funcA function which combines an element from each of the derivative fields.
[in]k_arrThe derivative fields being combined.

◆ assemble_vector_field_k_total()

template<class FieldMem , class DerivFieldMem = FieldMem, class ExecSpace = Kokkos::DefaultExecutionSpace>
template<class FieldType , class FuncType , std::size_t n_args>
void ITimeStepper< FieldMem, DerivFieldMem, ExecSpace >::assemble_vector_field_k_total ( ExecSpace const &  exec_space,
FieldType  k_total,
FuncType  func,
std::array< FieldType, n_args >  k_arr 
) const
inline

Calculate func(k_arr[0], k_arr[1], ...) when FieldType is a VectorField.

This function should be private but is public due to Cuda restrictions.

Parameters
[in]exec_spaceThe space (CPU/GPU) where the calculation should be executed.
[out]k_totalThe field to be filled with the combined derivative fields.
[in]funcA function which combines an element from each of the derivative fields.
[in]k_arrThe derivative fields being combined.

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