Use unique_ptr instead of raw pointer
This commit is contained in:
@@ -2,23 +2,24 @@
|
||||
#include "conewobble.h"
|
||||
#include "coordinates.h"
|
||||
|
||||
#include <random>
|
||||
#include <string>
|
||||
|
||||
namespace motions {
|
||||
WobbleCone::WobbleCone(const double delta, const double eta, const double chi, std::mt19937_64 &rng) : BaseMotion("Wobble in Cone", delta, eta, rng), m_angle(chi) {}
|
||||
WobbleCone::WobbleCone(std::mt19937_64 &rng) : BaseMotion("Wobble in Cone", rng) {}
|
||||
WobbleCone::WobbleCone(const double delta, const double eta, const double chi) : BaseMotion("Wobble in Cone", delta, eta), m_angle(chi) {}
|
||||
WobbleCone::WobbleCone() : BaseMotion("Wobble in Cone") {}
|
||||
|
||||
void WobbleCone::initialize() {
|
||||
m_axis = draw_position();
|
||||
void WobbleCone::initialize(std::mt19937_64& rng) {
|
||||
m_axis = draw_position(rng);
|
||||
}
|
||||
|
||||
double WobbleCone::jump() {
|
||||
const double real_angle = m_uni_dist(m_rng) * m_angle;
|
||||
const double phi = 2 * M_PI * m_uni_dist(m_rng);
|
||||
double WobbleCone::jump(std::mt19937_64& rng) {
|
||||
const double real_angle = m_uni_dist(rng) * m_angle;
|
||||
const double phi = 2 * M_PI * m_uni_dist(rng);
|
||||
return omega_q(rotate(m_axis, real_angle, phi));
|
||||
}
|
||||
|
||||
std::unique_ptr<BaseMotion> WobbleCone::clone() const {
|
||||
return std::make_unique<WobbleCone>(*this);
|
||||
}
|
||||
|
||||
void WobbleCone::setParameters(const std::unordered_map<std::string, double> ¶meters) {
|
||||
BaseMotion::setParameters(parameters);
|
||||
m_angle = parameters.at("angle");
|
||||
@@ -34,4 +35,4 @@ namespace motions {
|
||||
std::string WobbleCone::toString() const {
|
||||
return std::string("ConeWobble/angle=") + std::to_string(m_angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user