#include <src/args-callback/callbacks.hpp>
template<typename Operation, typename Scalar>
TimeSlice class
Template parameters | |
---|---|
Operation | Callable object. |
Scalar |
Contents
Create a wrapper on callable object(function pointer, functor, lambda) of which accepts one parameter. The type of the parameter must have method time()
. The wrapped callable object will be invoked for equal spacing time interval for time provided by time(). This class is basically used to implement equal time operation in simulations. For example, one can provide a printer [](auto&p){std::cout << p << std::endl;}
as the pre_step_operation in RunArgs to output the state of the integrated system. This printer then will be invoked before every step. The output might be very dense sometimes, thus outputting the result of every step is somewhat heavy. If one wraps the printer with TimeSlice, ‘TimeSlice([](auto&p){std::cout << p << ’
'}, 0, 100, 10)`, then the output will be performed only at p.time()=[0,100/10, 2*100/10, 3*100/10,...100].
Constructors, destructors, conversion operators
Public functions
- auto operator=(TimeSlice const&) -> TimeSlice& defaulted
- auto operator=(TimeSlice&&) -> TimeSlice& defaulted
-
template<typename ParticleSys>auto operator()(ParticleSys& ptc, typename ParticleSys::Scalar step_size) >>, void > -> auto
-
template<typename ParticleSys>auto operator()(ParticleSys& ptc, typename ParticleSys::Scalar step_size) >>, bool > -> auto
- void reset_slice_params(Scalar start, Scalar end, size_t opt_num = 5000)
Function documentation
template<typename Operation, typename Scalar>
hub:: callback:: TimeSlice<Operation, Scalar>:: TimeSlice() defaulted
Default constructor.
template<typename Operation, typename Scalar>
hub:: callback:: TimeSlice<Operation, Scalar>:: TimeSlice(Operation const& opt,
Scalar start,
Scalar end,
size_t opt_num = 5000)
Parameters | |
---|---|
opt in | Callable object |
start in | The start time of the time slice |
end in | The end time of the time slice |
opt_num in | The bin number of the time slice. i.e time interval = (end-start)/opt_num |
Constructor of the time slice
template<typename Operation, typename Scalar>
template<typename ParticleSys>
auto hub:: callback:: TimeSlice<Operation, Scalar>:: operator()(ParticleSys& ptc,
typename ParticleSys::Scalar step_size) >>, void >
Template parameters | |
---|---|
ParticleSys | Any type provides method time() |
Parameters | |
ptc in/out | Input parameter. |
step_size in | The step size of the integration. |
Callable interface.
template<typename Operation, typename Scalar>
template<typename ParticleSys>
auto hub:: callback:: TimeSlice<Operation, Scalar>:: operator()(ParticleSys& ptc,
typename ParticleSys::Scalar step_size) >>, bool >
Template parameters | |
---|---|
ParticleSys | Any type provides method time() |
Parameters | |
ptc in/out | Input parameter. |
step_size in | The step size of the integration. |
Returns | auto bool |
Callable interface.
template<typename Operation, typename Scalar>
void hub:: callback:: TimeSlice<Operation, Scalar>:: reset_slice_params(Scalar start,
Scalar end,
size_t opt_num = 5000)
Parameters | |
---|---|
start in | The start time of the time slice. |
end in | The end time of the time slice. |
opt_num in | The bin number of the time slice. i.e time interval = (end-start)/opt_num |
Reset the slice parameters.