X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2F02_Mandelbrot_Julia%2Fmoo%2Fhost%2FFractal.cu;fp=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2F02_Mandelbrot_Julia%2Fmoo%2Fhost%2FFractal.cu;h=a92b86b6320a2ada62b11756d9a71b37437d38ae;hb=7798b7c27cf13aaeada22faae8648df8cb339f1b;hp=0000000000000000000000000000000000000000;hpb=3e601cb6c0cc2c5b3a9b30ebf3ad1102e53c0e0b;p=GPU.git diff --git a/WCudaMSE/Student_Cuda_Image/src/cpp/core/02_Mandelbrot_Julia/moo/host/Fractal.cu b/WCudaMSE/Student_Cuda_Image/src/cpp/core/02_Mandelbrot_Julia/moo/host/Fractal.cu new file mode 100755 index 0000000..a92b86b --- /dev/null +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/02_Mandelbrot_Julia/moo/host/Fractal.cu @@ -0,0 +1,129 @@ +#include +#include + +#include "Fractal.h" +#include "Device.h" + +using std::cout; +using std::endl; + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Imported *| + \*-------------------------------------*/ + +extern __global__ void fractal(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n, float t); + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* Implementation *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/*-------------------------*\ + |* Constructeur *| + \*-------------------------*/ + +Fractal::Fractal(int w, int h, float dt, int n) + : w(w), h(h), n(n), + dg(8, 8, 1), + db(16, 16, 1), + t(0), + variateurAnimation(IntervalF(0, 2 * PI), dt), + ptrDomaineMathInit(new DomaineMath(-2, -1.3, 0.8, 1.3)), + title("Fractal Cuda") + { + assert(w == h); + + //print(dg, db); + Device::assertDim(dg, db); + } + +Fractal::~Fractal() + { + delete this->ptrDomaineMathInit; + } + +/*-------------------------*\ + |* Methode *| + \*-------------------------*/ + +/** + * Override + */ +void Fractal::runGPU(uchar4* ptrDevPixels, const DomaineMath& domaineMath) + { + fractal<<>>(ptrDevPixels, this->w, this->h, domaineMath, this->n, this->t); + } + +/** + * Override + */ +void Fractal::animationStep() + { + this->t = this->variateurAnimation.varierAndGet(); + } + +/*--------------*\ + |* get *| + \*--------------*/ + + +/** + * Override + */ +int Fractal::getW() + { + return this->w; + } + +/** + * Override + */ +int Fractal::getH() + { + return this->h; + } + +DomaineMath* Fractal::getDomaineMathInit() + { + return this->ptrDomaineMathInit; + } + +/** + * Override + */ +float Fractal::getT() + { + return this->t; + } + +/** + * Override + */ +string Fractal::getTitle() + { + return this->title; + } + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* End *| + \*---------------------------------------------------------------------*/ +