#include "Lorenz3D.hpp" const static unsigned int dimension = 3; const static unsigned int numberOfParameters = 4; Lorenz3D::Lorenz3D() { init(); } void Lorenz3D::init() { // allocation myParameters = new double[numberOfParameters]; vectorNew = new double[dimension]; vectorOld = new double[dimension]; // initialisation assert(myParameters != NULL); assert(vectorNew != NULL); assert(vectorOld != NULL); for ( unsigned int i = 0; i < numberOfParameters; i++ ) { myParameters[i] = 0.0; } for ( unsigned int i = 0; i < dimension; i++ ) { vectorNew[i] = vectorOld[i] = 1.0; } } // the main function void Lorenz3D::iterate() { swap(vectorNew, vectorOld); vectorNew[0] = vectorOld[0] + myParameters[0] * myParameters[1] * (vectorOld[1] - vectorOld[0]); vectorNew[1] = vectorOld[1] + myParameters[0] * (vectorOld[0] * (myParameters[2] - vectorOld[2]) - vectorOld[1]); vectorNew[2] = vectorOld[2] + myParameters[0] * (vectorOld[0] * vectorOld[1] - myParameters[3] * vectorOld[2]); } /* 4D: new_point[0] = point[0] + param[0] * param[1] * (point[1] - point[0]); new_point[1] = point[1] + param[0] * (point[0] * (param[2] - point[2]) - point[1] + point[3]); new_point[2] = point[2] + param[0] * (point[0] * point[1] - param[3] * point[2]); new_point[3] = point[3] - param[0] * param[4] * point[0]; break; */ // setters, getters, all i/o to other classes/objects void * Lorenz3D::getProperty(const string identifier) { if ( identifier == "dimension" ) { unsigned int * _return = new unsigned int; *_return = dimension; return _return; } return NULL; } void Lorenz3D::setProperty(const string identifier, const void * value) { return; } unsigned int Lorenz3D::getNumberOfParameters() { return numberOfParameters; }