Cleaning du code de heat transfert.
authorgburri <gregory.burri@master.hes-so.ch>
Thu, 18 Dec 2014 07:52:37 +0000 (08:52 +0100)
committergburri <gregory.burri@master.hes-so.ch>
Thu, 18 Dec 2014 07:52:37 +0000 (08:52 +0100)
WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/device/HeatTransfertDevice.cu
WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/host/HeatTransfert.cu
WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/provider/HeatTransfertProvider.cpp

index 03225a5..82f1289 100755 (executable)
@@ -71,7 +71,7 @@ void diffuseMethode1(HeatImage from, HeatImage to)
     const int H = from.getHCuda() - 2;\r
     const int WH = W * H;\r
 \r
-    const float k = 0.1;\r
+    const float k = 0.2;\r
 \r
     int pixelI;\r
     int pixelJ;\r
index 7aa7cf6..613e576 100755 (executable)
@@ -10,11 +10,11 @@ using namespace std;
 \r
 #include "HeatTransfertDevice.h"\r
 \r
-HeatTransfert::HeatTransfert() :\r
+HeatTransfert::HeatTransfert(int w, int h) :\r
       calibreur(IntervalF(0, 1), IntervalF(0.7, 0)),\r
-      devImageHeaters(800, 800),\r
-      devImageA(800, 800),\r
-      devImageB(800, 800),\r
+      devImageHeaters(w, h),\r
+      devImageA(w, h),\r
+      devImageB(w, h),\r
       t(0),\r
       dg(8, 8, 1),\r
       db(32, 32, 1),\r
@@ -92,28 +92,31 @@ string HeatTransfert::getTitle()
 \r
 void HeatTransfert::setHeaters(HeatImage& image)\r
     {\r
+    const float tempCentre = 1.0;\r
+    const float tempCotes = 0.2;\r
+\r
     for (int x = 179; x <= 195; x++)\r
         {\r
         for (int y = 179; y <= 195; y++)\r
-            image.set(x, y, 0.2);\r
+            image.set(x, y, tempCotes);\r
         for (int y = 605; y <= 621; y++)\r
-            image.set(x, y, 0.2);\r
+            image.set(x, y, tempCotes);\r
         }\r
 \r
     for (int x = 605; x <= 621; x++)\r
         {\r
         for (int y = 179; y <= 195; y++)\r
-            image.set(x, y, 0.2);\r
+            image.set(x, y, tempCotes);\r
         for (int y = 605; y <= 621; y++)\r
-            image.set(x, y, 0.2);\r
+            image.set(x, y, tempCotes);\r
         }\r
 \r
-    image.set(295, 400, 0.2);\r
-    image.set(400, 295, 0.2);\r
-    image.set(505, 400, 0.2);\r
-    image.set(400, 505, 0.2);\r
+    image.set(295, 400, tempCotes);\r
+    image.set(400, 295, tempCotes);\r
+    image.set(505, 400, tempCotes);\r
+    image.set(400, 505, tempCotes);\r
 \r
     for (int x = 300; x <= 500; x++)\r
         for (int y = 300; y <= 500; y++)\r
-            image.set(x, y, 1);\r
+            image.set(x, y, tempCentre);\r
     }\r
index 3d95d87..303ce3e 100755 (executable)
@@ -2,7 +2,7 @@
 \r
 HeatTransfert* HeatTransfertProvider::create()\r
     {\r
-    return new HeatTransfert();\r
+    return new HeatTransfert(800, 800);\r
     }\r
 \r
 Image* HeatTransfertProvider::createGL()\r