summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Temparray.cpp11
-rw-r--r--Temparray.h29
2 files changed, 21 insertions, 19 deletions
diff --git a/Temparray.cpp b/Temparray.cpp
index af46f8d..a2303ab 100644
--- a/Temparray.cpp
+++ b/Temparray.cpp
@@ -1,7 +1,8 @@
#include "Temparray.h"
Temparray::Temparray(float initialtemp, int x0, int y0, int z0){
- temparray = new float[x0*y0*z0*6*4];
+ temparraynew = new float[x0*y0*z0*6*4];
+ temparrayold = new float[x0*y0*z0*6*4];
cubearray = new Cubehole[x0*y0*z0*6];
sx = x0;
@@ -10,12 +11,12 @@ Temparray::Temparray(float initialtemp, int x0, int y0, int z0){
tempInit(initialtemp, x0, y0, z0);
-// static const float pos[5] = {-2.0, -1.0, 0.0, 1.0, 2.0};
+ // static const float pos[5] = {-2.0, -1.0, 0.0, 1.0, 2.0};
for(int i = 0; i < x0; ++i) {
for(int j = 0; j < y0; ++j) {
for(int k = 0; k < z0; ++k) {
for(int l = 0; l < 6; ++l) {
- cubehole(i, j, k, l).setSize((6-l)/6*0.9, 3, (6-l)/6*0.9, (5-l)/6*0.9, (5-l)/6*0.9);
+ cubehole(i, j, k, l).setSize((6-l)/6*0.9, 0.9, (6-l)/6*0.9, (5-l)/6*0.9, (5-l)/6*0.9);
float x, y, z;
if(x0 % 2 == 0) x = -(x0/2)+i+0.5;
@@ -36,6 +37,10 @@ Temparray::Temparray(float initialtemp, int x0, int y0, int z0){
}
}
+void Temparray::calcTemp(int x, int y, int z, int line, int pos){
+
+}
+
std::list<Triangle> Temparray::getTriangles(){
std::list<Triangle> triangles;
diff --git a/Temparray.h b/Temparray.h
index 1274cfb..ac082b4 100644
--- a/Temparray.h
+++ b/Temparray.h
@@ -3,19 +3,21 @@
#include "Cubehole.h"
#include "gl.h"
+#include "Triangle.h"
#include <list>
class Temparray
{
public:
Temparray(float initialtemp, int x0, int y0, int z0);
- ~Temparray(){
-
+ Temparray(){}
+ ~Temparray(){}
+ void calcTemp(int x, int y, int z, int line, int pos);
+ float& temperatureold(int x, int y, int z, int line, int pos) {
+ return temparrayold[x*sy*sz*6*4 + y*sz*6*4 + z*6*4 + line*4 + pos];
}
- void setTemp(float temp, int x, int y, int z, int line, int pos){
- temperature(x, y, z, line, pos) = temp;
-
- calcAverage();
+ float& temperaturenew(int x, int y, int z, int line, int pos) {
+ return temparraynew[x*sy*sz*6*4 + y*sz*6*4 + z*6*4 + line*4 + pos];
}
void deactivateCube(int x, int y, int z){
for(int i=0; i<6; i++){
@@ -27,35 +29,30 @@ class Temparray
std::list<Triangle> getTriangles();
private:
- float *temparray;
+ float *temparrayold, *temparraynew;
Cubehole *cubearray;
int sx, sy, sz;
float averagetemp;
- float& temperature(int x, int y, int z, int line, int pos) {
- return temparray[x*sy*sz*6*4 + y*sz*6*4 + z*6*4 + line*4 + pos];
- }
Cubehole& cubehole(int x, int y, int z, int line) {
return cubearray[x*sy*sz*6 + y*sz*6 + z*6 + line];
}
-
-// void setColor(int x, int y, int z, int line){
-// }
void tempInit(float temp0, int x0, int y0, int z0){
for(int i=0; i<x0; i++){
for(int j=0; j<y0; j++){
for(int k=0; k<z0; k++){
for(int l=0; l<6; l++){
for(int m=0; m<4; m++){
- setTemp(temp0, i, j, k, l, m);
+ temperaturenew(x, y, z, line, pos) = temp;
+ temperatureold(x, y, z, line, pos) = temp;
}
}
}
}
}
}
- void calcAverage(){
+/* void calcAverage(){
float tempcache = 0;
int times = 0;
for(int i=0; i<sx; i++){
@@ -73,7 +70,7 @@ class Temparray
}
}
averagetemp = tempcache/times;
- }
+ }*/
};
#endif /* _TEMPARRAY_H_ */