Ajout du squelette de Newton.
[GPU.git] / WCudaMSE / Student_Cuda_Image / src / cpp / core / 03_Newton / moo / host / Newton.cu
1 #include <iostream>\r
2 #include <assert.h>\r
3 \r
4 #include "Newton.h"\r
5 #include "Device.h"\r
6 \r
7 using std::cout;\r
8 using std::endl;\r
9 \r
10 extern __global__ void newton(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath);\r
11 \r
12 Newton::Newton(int w, int h)\r
13     : variateurAnimation(IntervalF(30, 100), 1),\r
14       w(w), h(h),\r
15       dg(8, 8, 1),\r
16       db(16, 16, 1),\r
17       title("Fractal Newton")\r
18     {\r
19     //print(dg, db);\r
20     Device::assertDim(dg, db);\r
21     }\r
22 \r
23 Newton::~Newton()\r
24     {\r
25     delete this->ptrDomaineMathInit;\r
26     }\r
27 \r
28 void Newton::runGPU(uchar4* ptrDevPixels, const DomaineMath& domaineMath)\r
29     {\r
30     newton<<<dg,db>>>(ptrDevPixels, this->w, this->h, domaineMath);\r
31     }\r
32 \r
33 void Newton::animationStep()\r
34     {\r
35     this->t = this->variateurAnimation.varierAndGet();\r
36     }\r
37 \r
38 int Newton::getW()\r
39     {\r
40     return this->w;\r
41     }\r
42 \r
43 int Newton::getH()\r
44     {\r
45     return this->h;\r
46     }\r
47 \r
48 DomaineMath* Newton::getDomaineMathInit()\r
49     {\r
50     return this->ptrDomaineMathInit;\r
51     }\r
52 \r
53 float Newton::getT()\r
54     {\r
55     return 0;\r
56     }\r
57 \r
58 string Newton::getTitle()\r
59     {\r
60     return this->title;\r
61     }\r
62 \r