diff --git a/AwesomeAttractor.cbp b/AwesomeAttractor.cbp
index 6b3e446..9dfab29 100644
--- a/AwesomeAttractor.cbp
+++ b/AwesomeAttractor.cbp
@@ -12,18 +12,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -49,6 +67,7 @@
+
diff --git a/defines.hpp b/defines.hpp
new file mode 100644
index 0000000..56db02d
--- /dev/null
+++ b/defines.hpp
@@ -0,0 +1,15 @@
+
+
+//TODO: do this with files
+#define ATTRACTOR_FILE "attractors/testPolynomial.stf"
+
+#ifdef UNI_BUILD
+ #warning Building for the RU, are you sure?
+ #define WIDTH 8000
+ #define HEIGHT 8000
+ #define ITERATIONS 800000000
+#else
+ #define WIDTH 800
+ #define HEIGHT 800
+ #define ITERATIONS 200000
+#endif
diff --git a/kernels/BasicKernel.cpp b/kernels/BasicKernel.cpp
index 80662a3..064fa97 100644
--- a/kernels/BasicKernel.cpp
+++ b/kernels/BasicKernel.cpp
@@ -1,6 +1,9 @@
-
#include "BasicKernel.h"
+BasicKernel::BasicKernel():
+ myParameters(NULL), vectorNew(NULL), vectorOld(NULL) {
+}
+
double * & BasicKernel::parameters() {
return myParameters;
}
diff --git a/kernels/BasicKernel.h b/kernels/BasicKernel.h
index 8e8e3de..ef05f35 100644
--- a/kernels/BasicKernel.h
+++ b/kernels/BasicKernel.h
@@ -1,20 +1,26 @@
#ifndef BASICKERNEL_HPP
#define BASICKERNEL_HPP
-#include
#include
#include "../AttractorKernel.hpp"
+
+/*
+ A basic abstract implementatoin of the AttractorKernel, should
+ be used to avoid copying the same stuff in all attractorKernels
+*/
class BasicKernel : public AttractorKernel {
- protected:
+protected:
double * myParameters;
double * vectorNew;
double * vectorOld;
- public:
+public:
+
+ BasicKernel();
// parameters are stored in a array of doubles
// if you want to use other types, use the properties
@@ -27,5 +33,5 @@ class BasicKernel : public AttractorKernel {
};
-#endif // POLYNOMIAL_HPP
+#endif
diff --git a/kernels/Logistic.cpp b/kernels/Logistic.cpp
index 0623982..8eb2098 100644
--- a/kernels/Logistic.cpp
+++ b/kernels/Logistic.cpp
@@ -9,14 +9,14 @@
#include "Logistic.hpp"
Logistic::Logistic():
- myParameters(NULL), vectorNew(NULL), vectorOld(NULL) {
+ BasicKernel() {
dimension = 3;
init();
}
Logistic::Logistic(const unsigned int dimension):
- myParameters(NULL), vectorNew(NULL), vectorOld(NULL), dimension(dimension) {
+ BasicKernel(), dimension(dimension) {
init();
}
@@ -76,22 +76,7 @@ void Logistic::setProperty(const string identifier, const void * _value) {
}
}
-double * & Logistic::parameters() {
- return myParameters;
-}
-
-double & Logistic::parameter(const unsigned int index) {
- return myParameters[index];
-}
-
unsigned int Logistic::getNumberOfParameters() {
return dimension;
}
-double * & Logistic::vector() {
- return vectorNew;
-}
-
-double * & Logistic::previousVector() {
- return vectorOld;
-}
diff --git a/kernels/Logistic.hpp b/kernels/Logistic.hpp
index 3f6de68..c42a62c 100644
--- a/kernels/Logistic.hpp
+++ b/kernels/Logistic.hpp
@@ -4,42 +4,26 @@
#include
#include "../AttractorKernel.hpp"
+#include "BasicKernel.h"
-class Logistic : public AttractorKernel {
- double * myParameters;
-
- double * vectorNew;
- double * vectorOld;
+class Logistic : public BasicKernel {
unsigned int dimension;
void init();
- public:
+public:
Logistic();
Logistic(const unsigned int dimension);
- // parameters are stored in a array of doubles
- // if you want to use other types, use the properties
- virtual double& parameter(const unsigned int index);
- virtual double*& parameters();
- virtual unsigned int getNumberOfParameters();
+ virtual void iterate();
- // get properties of the attractor
- // such as the dimension
- // you should delete the void pointer if you used it
virtual void * getProperty(const string identifier);
virtual void setProperty(const string identifier, const void * value);
+ virtual unsigned int getNumberOfParameters();
- // iterate his formula
- // vector pointers will be swapped! so new remains new and old remains old
- virtual void iterate();
-
- // getter functions for teh resulta
- virtual double * & vector();
- virtual double * & previousVector();
};
#endif // LOGISTIC_HPP
diff --git a/kernels/Lorenz3D.cpp b/kernels/Lorenz3D.cpp
index cc3eff4..a1319eb 100644
--- a/kernels/Lorenz3D.cpp
+++ b/kernels/Lorenz3D.cpp
@@ -57,24 +57,7 @@ void Lorenz3D::setProperty(const string identifier, const void * value) {
return;
}
-//double * & Lorenz3D::parameters() {
-// return myParameters;
-//}
-//
-//double & Lorenz3D::parameter(const unsigned int index) {
-// return myParameters[index];
-//}
-
unsigned int Lorenz3D::getNumberOfParameters() {
return numberOfParameters;
}
-//double * & Lorenz3D::vector() {
-// return vectorNew;
-//}
-//
-//double * & Lorenz3D::previousVector() {
-// return vectorOld;
-//}
-
-
diff --git a/kernels/Lorenz3D.hpp b/kernels/Lorenz3D.hpp
index 4adb53d..570c8f3 100644
--- a/kernels/Lorenz3D.hpp
+++ b/kernels/Lorenz3D.hpp
@@ -12,38 +12,19 @@ using namespace std;
class Lorenz3D : public BasicKernel {
-// double * myParameters;
-//
-// double * vectorNew;
-// double * vectorOld;
-
void init();
- public:
+public:
Lorenz3D();
Lorenz3D(const unsigned int dimensions);
- // parameters are stored in a array of doubles
- // if you want to use other types, use the properties
-// virtual double& parameter(const unsigned int index);
-// virtual double*& parameters();
- virtual unsigned int getNumberOfParameters();
+ virtual void iterate();
- // get properties of the attractor
- // such as the dimension
- // you should delete the void pointer if you used it
virtual void * getProperty(const string identifier);
virtual void setProperty(const string identifier, const void * value);
-
- // iterate his formula
- // vector pointers will be swapped! so new remains new and old remains old
- virtual void iterate();
-
- // getter functions for teh resulta
-// virtual double * & vector();
-// virtual double * & previousVector();
+ virtual unsigned int getNumberOfParameters();
};
diff --git a/kernels/Polynomial.cpp b/kernels/Polynomial.cpp
index 8faab07..b10d34b 100644
--- a/kernels/Polynomial.cpp
+++ b/kernels/Polynomial.cpp
@@ -11,7 +11,7 @@
using namespace std;
Polynomial::Polynomial():
- myParameters(NULL), vectorNew(NULL), vectorOld(NULL) {
+ BasicKernel() {
dimension = 3;
orde = 2;
@@ -19,7 +19,7 @@ Polynomial::Polynomial():
}
Polynomial::Polynomial(const unsigned int dimension, const unsigned int orde):
- myParameters(NULL), vectorNew(NULL), vectorOld(NULL), dimension(dimension), orde(orde) {
+ BasicKernel(), dimension(dimension), orde(orde) {
init();
}
@@ -124,22 +124,6 @@ void Polynomial::setProperty(const string identifier, const void * _value) {
}
}
-double * & Polynomial::parameters() {
- return myParameters;
-}
-
-double & Polynomial::parameter(const unsigned int index) {
- return myParameters[index];
-}
-
unsigned int Polynomial::getNumberOfParameters() {
return numberOfParameters;
}
-
-double * & Polynomial::vector() {
- return vectorNew;
-}
-
-double * & Polynomial::previousVector() {
- return vectorOld;
-}
diff --git a/kernels/Polynomial.hpp b/kernels/Polynomial.hpp
index 4325d63..e65b9a9 100644
--- a/kernels/Polynomial.hpp
+++ b/kernels/Polynomial.hpp
@@ -5,13 +5,9 @@
#include
#include "../AttractorKernel.hpp"
+#include "BasicKernel.h"
-class Polynomial : public AttractorKernel {
-
- double * myParameters;
-
- double * vectorNew;
- double * vectorOld;
+class Polynomial : public BasicKernel {
unsigned int dimension;
unsigned int orde;
@@ -21,31 +17,17 @@ class Polynomial : public AttractorKernel {
void calculateNumberOfParameters();
void recur(unsigned int curr_dimension, unsigned int prev_i, unsigned int n, unsigned int& m, double prev_product=1.0);
- public:
+public:
Polynomial();
Polynomial(const unsigned int dimensions, const unsigned int orde);
- // parameters are stored in a array of doubles
- // if you want to use other types, use the properties
- virtual double& parameter(const unsigned int index);
- virtual double*& parameters();
- virtual unsigned int getNumberOfParameters();
+ virtual void iterate();
- // get properties of the attractor
- // such as the dimension
- // you should delete the void pointer if you used it
virtual void * getProperty(const string identifier);
virtual void setProperty(const string identifier, const void * value);
-
- // iterate his formula
- // vector pointers will be swapped! so new remains new and old remains old
- virtual void iterate();
-
- // getter functions for teh resulta
- virtual double * & vector();
- virtual double * & previousVector();
+ virtual unsigned int getNumberOfParameters();
};
diff --git a/kernels/PolynomialA3D.cpp b/kernels/PolynomialA3D.cpp
index 7776159..fb5afbd 100644
--- a/kernels/PolynomialA3D.cpp
+++ b/kernels/PolynomialA3D.cpp
@@ -60,22 +60,6 @@ void PolynomialA3D::setProperty(const string identifier, const void * _value) {
}
-double * & PolynomialA3D::parameters() {
- return myParameters;
-}
-
-double & PolynomialA3D::parameter(const unsigned int index) {
- return myParameters[index];
-}
-
unsigned int PolynomialA3D::getNumberOfParameters() {
return numberOfParameters;
}
-
-double * & PolynomialA3D::vector() {
- return vectorNew;
-}
-
-double * & PolynomialA3D::previousVector() {
- return vectorOld;
-}
diff --git a/kernels/PolynomialA3D.hpp b/kernels/PolynomialA3D.hpp
index 1434fc6..7288f90 100644
--- a/kernels/PolynomialA3D.hpp
+++ b/kernels/PolynomialA3D.hpp
@@ -4,41 +4,23 @@
#include
#include "../AttractorKernel.hpp"
+#include "BasicKernel.h"
-class PolynomialA3D : public AttractorKernel {
+class PolynomialA3D : public BasicKernel {
// of course this can be seen as a subclasse of Polynomial
- double * myParameters;
-
- double * vectorNew;
- double * vectorOld;
-
void init();
- public:
+public:
PolynomialA3D();
- // parameters are stored in a array of doubles
- // if you want to use other types, use the properties
- virtual double& parameter(const unsigned int index);
- virtual double*& parameters();
- virtual unsigned int getNumberOfParameters();
+ virtual void iterate();
- // get properties of the attractor
- // such as the dimension
- // you should delete the void pointer if you used it
virtual void * getProperty(const string identifier);
virtual void setProperty(const string identifier, const void * value);
-
- // iterate his formula
- // vector pointers will be swapped! so new remains new and old remains old
- virtual void iterate();
-
- // getter functions for teh resulta
- virtual double * & vector();
- virtual double * & previousVector();
+ virtual unsigned int getNumberOfParameters();
};
diff --git a/kernels/Unravel3D.cpp b/kernels/Unravel3D.cpp
index 328629e..d19b160 100644
--- a/kernels/Unravel3D.cpp
+++ b/kernels/Unravel3D.cpp
@@ -57,22 +57,6 @@ void Unravel3D::setProperty(const string identifier, const void * value) {
return;
}
-double * & Unravel3D::parameters() {
- return myParameters;
-}
-
-double & Unravel3D::parameter(const unsigned int index) {
- return myParameters[index];
-}
-
unsigned int Unravel3D::getNumberOfParameters() {
return numberOfParameters;
}
-
-double * & Unravel3D::vector() {
- return vectorNew;
-}
-
-double * & Unravel3D::previousVector() {
- return vectorOld;
-}
diff --git a/kernels/Unravel3D.hpp b/kernels/Unravel3D.hpp
index 94a693a..d37b6eb 100644
--- a/kernels/Unravel3D.hpp
+++ b/kernels/Unravel3D.hpp
@@ -9,41 +9,23 @@
using namespace std;
#include "../AttractorKernel.hpp"
+#include "BasicKernel.h"
-class Unravel3D : public AttractorKernel {
-
- double * myParameters;
-
- double * vectorNew;
- double * vectorOld;
+class Unravel3D : public BasicKernel {
void init();
- public:
+public:
Unravel3D();
Unravel3D(const unsigned int dimensions);
- // parameters are stored in a array of doubles
- // if you want to use other types, use the properties
- virtual double& parameter(const unsigned int index);
- virtual double*& parameters();
- virtual unsigned int getNumberOfParameters();
+ virtual void iterate();
- // get properties of the attractor
- // such as the dimension
- // you should delete the void pointer if you used it
virtual void * getProperty(const string identifier);
virtual void setProperty(const string identifier, const void * value);
-
- // iterate his formula
- // vector pointers will be swapped! so new remains new and old remains old
- virtual void iterate();
-
- // getter functions for teh resulta
- virtual double * & vector();
- virtual double * & previousVector();
+ virtual unsigned int getNumberOfParameters();
};
diff --git a/main.cpp b/main.cpp
index f671496..d36dc63 100644
--- a/main.cpp
+++ b/main.cpp
@@ -6,15 +6,17 @@ using namespace std;
#include "Canvas.hpp"
#include "Projector.hpp"
+#include "defines.hpp"
+
int main(int argc, char *argv[]) {
clock_t start, end;
double totalTime, totalIterations;
// initialising stuff
- Attractor myAttractor("attractors/testPolynomial.stf");
+ Attractor myAttractor(ATTRACTOR_FILE);
Projector projection;
- Canvas canvas(8000, 8000, 3);
+ Canvas canvas(WIDTH, HEIGHT, 3);
projection.canvas = &canvas;
myAttractor.projectors.push_back(&projection);
@@ -22,8 +24,7 @@ int main(int argc, char *argv[]) {
projection.output();
- // iterating 4 evah
- unsigned int iterations = 800000000; // acht honderd miljoen
+ unsigned int iterations = ITERATIONS;
start = clock();
for ( unsigned int j = 1; j <= 100; j++ ) {
for ( unsigned int i = 0; i <= iterations; i++ ) {
@@ -49,6 +50,7 @@ int main(int argc, char *argv[]) {
totalTime = ((double)(end-start)/(double)(CLOCKS_PER_SEC));
printf("total clock time for writing png: %f\n", totalTime );
+ printf("\n Awesome Attractor, version %s\n", __DATE__);
/*if ( argc <= 2 ) {
cout << endl << "nothing to do..." << endl;