-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
45 lines (39 loc) · 1.49 KB
/
main.cpp
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
#include <chrono>
#include <iostream>
#include <string>
#include "functional-utils.h"
#include "schneider.h"
using namespace functional_utils;
using namespace schneider;
int main()
{
static const TIndex ZAUBERON_COUNT{1000};
static const TIndex ITERATIONS{10000};
static const TIndex ITERATION_DISPLAY_DIVISOR{1000};
auto zauberons{Zauberons(ZAUBERON_COUNT)};
{
Print("Initialization ... ");
auto xyzInitial{XYZ(50000.0, 50000.0, 50000.0)};
auto start{NOW};
IMap([xyzInitial] UNARY_TYPE_NAME(TZauberon&, z) { return ZauberonInitialize(1, xyzInitial); }, zauberons);
auto end{NOW};
PrintLn("Elapsed Time: " + FormatElapsedTime(ELAPSED_TIME(end, start)) + "\n");
}
{
auto start{NOW};
WithOpen("zauberons.dat", [&zauberons] OPEN_FN(os) {
PrintLn("# X Y Z", os);
DoTimes(ITERATIONS, [&zauberons, &os] DOTIMES_FN(i) {
PrintLn("# Iteration: " + std::to_string(i), os);
if (!(i % ITERATION_DISPLAY_DIVISOR))
std::cout << i << "\n";
DoTimes(Count(zauberons), [&zauberons] DOTIMES_FN(i) { ZauberonNewPosition(1, zauberons[i]); });
DoTimes(Count(zauberons),
[&zauberons, &os] DOTIMES_FN(i) { PrintLn(FormatNumbers(zauberons[i].xyz), os); });
});
});
auto end{NOW};
PrintLn("\nElapsed Time: " + FormatElapsedTime(ELAPSED_TIME(end, start)) + "\n");
}
return 0;
}