From 00dcb50daad8129676832b0b646e675770ee51a0 Mon Sep 17 00:00:00 2001 From: gburri Date: Thu, 18 Dec 2014 08:52:37 +0100 Subject: [PATCH] Cleaning du code de heat transfert. --- .../moo/device/HeatTransfertDevice.cu | 2 +- .../moo/host/HeatTransfert.cu | 29 ++++++++++--------- .../provider/HeatTransfertProvider.cpp | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/device/HeatTransfertDevice.cu b/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/device/HeatTransfertDevice.cu index 03225a5..82f1289 100755 --- a/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/device/HeatTransfertDevice.cu +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/device/HeatTransfertDevice.cu @@ -71,7 +71,7 @@ void diffuseMethode1(HeatImage from, HeatImage to) const int H = from.getHCuda() - 2; const int WH = W * H; - const float k = 0.1; + const float k = 0.2; int pixelI; int pixelJ; diff --git a/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/host/HeatTransfert.cu b/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/host/HeatTransfert.cu index 7aa7cf6..613e576 100755 --- a/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/host/HeatTransfert.cu +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/host/HeatTransfert.cu @@ -10,11 +10,11 @@ using namespace std; #include "HeatTransfertDevice.h" -HeatTransfert::HeatTransfert() : +HeatTransfert::HeatTransfert(int w, int h) : calibreur(IntervalF(0, 1), IntervalF(0.7, 0)), - devImageHeaters(800, 800), - devImageA(800, 800), - devImageB(800, 800), + devImageHeaters(w, h), + devImageA(w, h), + devImageB(w, h), t(0), dg(8, 8, 1), db(32, 32, 1), @@ -92,28 +92,31 @@ string HeatTransfert::getTitle() void HeatTransfert::setHeaters(HeatImage& image) { + const float tempCentre = 1.0; + const float tempCotes = 0.2; + for (int x = 179; x <= 195; x++) { for (int y = 179; y <= 195; y++) - image.set(x, y, 0.2); + image.set(x, y, tempCotes); for (int y = 605; y <= 621; y++) - image.set(x, y, 0.2); + image.set(x, y, tempCotes); } for (int x = 605; x <= 621; x++) { for (int y = 179; y <= 195; y++) - image.set(x, y, 0.2); + image.set(x, y, tempCotes); for (int y = 605; y <= 621; y++) - image.set(x, y, 0.2); + image.set(x, y, tempCotes); } - image.set(295, 400, 0.2); - image.set(400, 295, 0.2); - image.set(505, 400, 0.2); - image.set(400, 505, 0.2); + image.set(295, 400, tempCotes); + image.set(400, 295, tempCotes); + image.set(505, 400, tempCotes); + image.set(400, 505, tempCotes); for (int x = 300; x <= 500; x++) for (int y = 300; y <= 500; y++) - image.set(x, y, 1); + image.set(x, y, tempCentre); } diff --git a/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/provider/HeatTransfertProvider.cpp b/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/provider/HeatTransfertProvider.cpp index 3d95d87..303ce3e 100755 --- a/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/provider/HeatTransfertProvider.cpp +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/provider/HeatTransfertProvider.cpp @@ -2,7 +2,7 @@ HeatTransfert* HeatTransfertProvider::create() { - return new HeatTransfert(); + return new HeatTransfert(800, 800); } Image* HeatTransfertProvider::createGL() -- 2.45.2