LF2.h 792 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
#ifndef LF2_H
#define LF2_H

#include "Stepper.h"
#include "Physics/Physics.h"

/// Leap-Frog 2nd order
template <typename FieldFunction, typename ... Arguments>
class LF2 : public Stepper<FieldFunction, Arguments...> {
    
public:
    
    LF2(const FieldFunction& fieldfunc) : Stepper<FieldFunction, Arguments ...>(fieldfunc) { }
    
    bool advance(PartBunch* bunch,
                 const size_t& i,
                 const double& t,
                 const double dt,
                 Arguments& ... args) const;
    
private:
    
    void push_m(Vector_t& R, const Vector_t& P, const double& h) const;
    
    bool kick_m(PartBunch* bunch, const size_t& i,
                const double& t, const double& h,
                Arguments& ... args) const;
};

#include "LF2.hpp"

#endif