Method class#
Note
Naming convention: about type name of template parameter.
Algorithm_t
matches to an algorithm i.e. a class that contains stages of a Runge-Kutta method. It needs to provide an operator()
with the following definition:state_t operator()( Stage<s>, Problem_t& f, value_t tn, state_t const& un, ArrayKi_t const& ki, value_t dt)
Method_t
matches to theponio::method
class, and provides the following operator()
:state_t operator()(Problem_t& f, value_t tn, state_t const& un, value_t dt)
-
template<typename Algorithm_t, typename state_t>
class method# define a time method
A method is define by its algorithm (how compute \(u^{n+1}\) from \((t^n,u^n,\Delta t)\)) and store possible substeps. Actually this class avoid the user to specify a template parameter, while making it easy to add new methods.
- Template Parameters:
Algorithm_t – type of the algorithm which define properly the method
state_t – type of \(u^n\)
There is 0 overloading of ponio::make_method
function, one for generic algorithm, and one for each implemanted splitting method (Lie splitting method and Strang splitting method).
-
template<typename Algorithm_t, typename state_t>
auto ponio::make_method(Algorithm_t const &algo, state_t const &shadow_of_u0)# generic factory to build a method from an algoritm, it only reuses
method
constructor- Parameters:
algo – a
Algorithm_t
objet with predifined stages of the methodshadow_of_u0 – an object with the same size of computed value for allocation
-
template<typename ...Algorithms_t, typename state_t>
auto ponio::make_method(splitting::lie::lie_tuple<Algorithms_t...> const &algos, state_t const &shadow_of_u0)# generic factory to build a method from an algoritm, it only reuses
method
constructor- Parameters:
algos – a variadic
splitting::lie_tuple
ofAlgorithms_t
shadow_of_u0 – an object with the same size of computed value for allocation
-
template<typename ...Algorithms_t, typename state_t>
auto ponio::make_method(splitting::strang::strang_tuple<Algorithms_t...> const &algos, state_t const &shadow_of_u0)# generic factory to build a method from an algoritm, it only reuses
method
constructor- Parameters:
algos – a variadic
splitting::strang_tuple
ofAlgorithms_t
shadow_of_u0 – an object with the same size of computed value for allocation
An helper function for splitting method factory.
-
template<typename state_t, typename ...Algorithms_t>
auto ponio::make_tuple_methods(std::tuple<Algorithms_t...> const &algos, state_t const &shadow_of_u0)# factory of tuple of methods from a tuple of
Algorithm_t
this factory is to prevent duplucation of code in factory of methods for splitting methods (Lie or Strang method).
- Parameters:
algos – a tuple of
Algorithm_t
objets with predifined stagesshadow_of_u0 – an object with the same size of computed value for allocation