-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.mpd
80 lines (60 loc) · 1.98 KB
/
run.mpd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
resource run()
import Mandelbrot;
import MPDWin;
optype Proc = ();
const int NUM_VERSIONS = 5;
string[NUM_VERSIONS + 1] activated;
type VersionName = string[11];
VersionName versionNames[5];
versionNames[1] = "séquentiel";
versionNames[2] = "PIF";
versionNames[3] = "PIGA";
versionNames[4] = "PIGC";
versionNames[5] = "PST";
if (numargs() < 1) { activated= "111111"; }
else { getarg(1, activated); }
const int width = 400;
const int height = 300;
const int pixelsNumber = width * height;
const Complex center = complex(-.7, 0);
const Complex span = complex(2.7, -(4.0 / 3.0) * 2.7 * height / width);
const Complex beginning = complex(center^.realPart - span^.realPart / 2, center^.imaginaryPart - span^.imaginaryPart / 2);
const Complex ending = complex(center^.realPart + span^.realPart / 2, center^.imaginaryPart + span^.imaginaryPart / 2);
ComplexArray complexes;
IntegerArray iterations;
complexes = assignateComplexArray(width, height, beginning, span);
int beginAge, endAge = 0;
procedure sequential()
{ iterations = mandelbrotSequential(complexes); }
procedure pif()
{ iterations = mandelbrotPIF(complexes); }
procedure piga()
{ iterations = mandelbrotPIGA(complexes); }
procedure pigc()
{ iterations = mandelbrotPIGC(complexes); }
procedure pst()
{ iterations = mandelbrotPST(complexes); }
cap Proc versions[NUM_VERSIONS] = (sequential, pif, piga, pigc, pst);
procedure runVersion (string[*] procedureName, cap Proc p)
{
beginAge = age();
p();
endAge = age();
printf("Temps d'exécution %s : %i\n", procedureName, endAge - beginAge);
}
for [i = 1 to NUM_VERSIONS]
{
if(activated[i] == '1')
{
runVersion(versionNames[i], versions[i]);
}
}
if (activated[6] == '1')
{
winWindow screen = WinOpen( "", "Fenetre de rendu.", null, UseDefault, width, height);
WinSetForeground( screen, "black" );
WinSetBackground( screen, "white" );
WinEraseArea(screen, winRectangle(0, 0, width, height));
draw(iterations, screen, width);
}
end