Method class#
Note
Naming convention: about type name of template parameter.
Algorithm_tmatches 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_tmatches to theponio::methodclass, 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 value_t, 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
methodconstructor- Template Parameters:
value_t – type of coefficients
- Parameters:
algo – a
Algorithm_tobjet with predifined stages of the methodshadow_of_u0 – an object with the same size of computed value for allocation
-
template<typename value_t, template<typename, typename...> typename _splitting_method_t, typename state_t, typename optional_args_t, typename ...Algorithms_t>
auto ponio::make_method(splitting::detail::splitting_tuple<_splitting_method_t, value_t, optional_args_t, Algorithms_t...> const &algos, state_t const &shadow_of_u0)# generic factory for splitting methods to build a method from a tuple of algorithms and a state
- Template Parameters:
_splitting_method_t – splitting method (Lie or Strang splitting)
value_t – type of coefficients and time step
state_t – type of state
optional_args_t – type of tuple of optional arguments to build _splitting_method_t object (void if not needed)
Algorithms_t – types of algorithms to solve each step of splitting
- Parameters:
algos – tuple of algorithms and splitting method
shadow_of_u0 – an object with the same sixe of computed value for allocation
An helper function for splitting method factory.
-
template<typename value_t, 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_tthis factory is to prevent duplucation of code in factory of methods for splitting methods (Lie or Strang method).
- Parameters:
algos – a tuple of
Algorithm_tobjets with predifined stagesshadow_of_u0 – an object with the same size of computed value for allocation