Implémentation du raytracing pour Global Memory/Shared Memory/Constant Memory
[GPU.git] / WCudaMSE / BilatTools_CPP / src / core / tools / cpp / VariateurI.cpp
1 #include "VariateurI.h"
2 #include <assert.h>
3
4 /*----------------------------------------------------------------------*\
5 |* Declaration *|
6 \*---------------------------------------------------------------------*/
7
8 /*--------------------------------------*\
9 |* Public *|
10 \*-------------------------------------*/
11
12 /*--------------------------------------*\
13 |* Private *|
14 \*-------------------------------------*/
15
16 /*----------------------------------------------------------------------*\
17 |* Implementation *|
18 \*---------------------------------------------------------------------*/
19
20 /*--------------------------------------*\
21 |* Public *|
22 \*-------------------------------------*/
23
24 VariateurI::VariateurI(const IntervalI& range, int dt)
25 {
26 this->dt = dt;
27 this->tMin = range.a;
28 this->tMax = range.b;
29
30 // Tools
31 this->isCroisssantPhase = true;
32 this->t =range.a;
33
34 assert(tMin<tMax);
35 }
36
37 VariateurI::VariateurI()
38 {
39 //rien
40 }
41
42 VariateurI::~VariateurI()
43 {
44 // rien
45 }
46
47 int VariateurI::varierAndGet()
48 {
49 if (isCroisssantPhase)
50 {
51 if (t >= tMax)
52 {
53 isCroisssantPhase = false;
54 t -= dt;
55 }
56 else
57 {
58 t += dt;
59 }
60 }
61 else
62 {
63 if (t <= tMin)
64 {
65 isCroisssantPhase = true;
66 t += dt;
67 }
68 else
69 {
70 t -= dt;
71 }
72 }
73
74 return t;
75 }
76
77 int VariateurI::get()
78 {
79 return t;
80 }
81
82 /*--------------------------------------*\
83 |* Private *|
84 \*-------------------------------------*/
85
86 /*----------------------------------------------------------------------*\
87 |* End *|
88 \*---------------------------------------------------------------------*/
89