X-Git-Url: http://git.euphorik.ch/?p=GPU.git;a=blobdiff_plain;f=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2F05_HeatTransfert%2Fmoo%2Fhost%2FHeatImage.h;fp=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2F05_HeatTransfert%2Fmoo%2Fhost%2FHeatImage.h;h=00224c805e88d566be82bf75391c119b961f7495;hp=0000000000000000000000000000000000000000;hb=cb39d6a91b65d2862018430d65e633d2a8fdc818;hpb=2d95edd9a2d09421e5eae56755bdf3105e12edf7 diff --git a/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/host/HeatImage.h b/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/host/HeatImage.h new file mode 100644 index 0000000..00224c8 --- /dev/null +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/05_HeatTransfert/moo/host/HeatImage.h @@ -0,0 +1,73 @@ +#ifndef HEAT_IMAGE_H +#define HEAT_IMAGE_H + +/* + * Une classe représentant une image de float. + */ +class HeatImage + { + public: + HeatImage(int w, int h, float* image = 0); + ~HeatImage(); + + inline void clear() + { + memset(this->image, 0, this->w * this->h * sizeof(float)); + } + + __device__ + inline void setCuda(int x, int y, float value) + { + this->image[x + this->w * y] = value; + } + + inline void set(int x, int y, float value) + { + this->image[x + this->w * y] = value; + } + + __device__ + inline float getCuda(int x, int y) + { + return this->image[x + this->w * y]; + } + + __device__ + inline int getWCuda() + { + return this->w; + } + + inline int getW() + { + return this->w; + } + + __device__ + inline int getHCuda() + { + return this->h; + } + + inline int getH() + { + return this->h; + } + + inline void swapWith(HeatImage& other) + { + float* tmp = this->image; + this->image = other.image; + other.image = tmp; + } + + inline float*& getRaw() { return this->image; } + inline void setRaw(float* image) { this->image = image; } + + private: + int w, h; + float* image; + }; + + +#endif