|
|
|
#ifndef LORENZ_HPP
|
|
|
|
#define LORENZ_HPP
|
|
|
|
|
|
|
|
#include "../AttractorKernel.hpp"
|
|
|
|
|
|
|
|
class Lorenz3D : public AttractorKernel {
|
|
|
|
private:
|
|
|
|
void init() {
|
|
|
|
std::fill_n(vectorOld, dimension, 1.0);
|
|
|
|
std::fill_n(vectorNew, dimension, 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
Lorenz3D():
|
|
|
|
AttractorKernel(3, 4) {
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void generate_random_parameters() {
|
|
|
|
parameters[0] = rand() / double(RAND_MAX) * 0.02;
|
|
|
|
parameters[1] = rand() / double(RAND_MAX) * 4.0 + 8.0;
|
|
|
|
parameters[2] = rand() / double(RAND_MAX) * 10.0 + 23.0;
|
|
|
|
parameters[3] = rand() / double(RAND_MAX) * 4.0;
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void operator()() {
|
|
|
|
std::swap(vectorNew, vectorOld);
|
|
|
|
|
|
|
|
vectorNew[0] = vectorOld[0] + parameters[0] * parameters[1] * (vectorOld[1] - vectorOld[0]);
|
|
|
|
vectorNew[1] = vectorOld[1] + parameters[0] * (vectorOld[0] * (parameters[2] - vectorOld[2]) - vectorOld[1]);
|
|
|
|
vectorNew[2] = vectorOld[2] + parameters[0] * (vectorOld[0] * vectorOld[1] - parameters[3] * vectorOld[2]);
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LORENZ_HPP
|
|
|
|
|