cpp/src/motions/base.h
2024-11-28 14:50:26 +01:00

46 lines
1.3 KiB
C++

#ifndef RWSIM_MOTIONBASE_H
#define RWSIM_MOTIONBASE_H
#include "coordinates.h"
#include <random>
#include <unordered_map>
class Motion {
public:
virtual ~Motion() = default;
Motion(std::string, double, double, std::mt19937_64&);
explicit Motion(std::string, std::mt19937_64&);
SphericalPos draw_position();
[[nodiscard]] double omega_q(double, double) const;
[[nodiscard]] double omega_q(const SphericalPos&) const;
virtual void initialize() = 0;
virtual double jump() = 0;
virtual void setParameters(const std::unordered_map<std::string, double>&);
[[nodiscard]] double getDelta() const { return m_delta; }
void setDelta(const double delta) { m_delta = delta; }
[[nodiscard]] double getEta() const { return m_eta; }
void setEta(const double eta) { m_eta = eta; }
[[nodiscard]] std::string getName() const { return m_name; }
[[nodiscard]] double getInitOmega() const { return m_initial_omega; };
static Motion* createFromInput(const std::string& input, std::mt19937_64& rng);
protected:
std::string m_name{"BaseMotion"};
double m_delta{1.};
double m_eta{0.};
std::mt19937_64& m_rng;
std::uniform_real_distribution<> m_uni_dist;
double m_initial_omega{0.};
};
std::ostream& operator<<(std::ostream& os, const Motion& m);
#endif //RWSIM_MOTIONBASE_H