-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfastDLA.cpp
More file actions
53 lines (47 loc) · 1.02 KB
/
fastDLA.cpp
File metadata and controls
53 lines (47 loc) · 1.02 KB
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
#include "fastDLA.hpp"
#include <iostream>
#include <stdlib.h>
int main(int argc, char** argv)
{
int n, seed;
char filename[1000];
double noiseReductionFactor=1;
seed=time(NULL);
filename[0]='\0';
switch(argc-1)
{
case 4:
sscanf(argv[4],"%lf",&noiseReductionFactor);
case 3:
sscanf(argv[3],"%d",&seed);
case 2:
sscanf(argv[2],"%s",&filename);
case 1:
sscanf(argv[1],"%d",&n);
break;
default:
fprintf(stderr,"First 2 arguments (Cluster Size and Filename) are mandatory.\nThird argument (seed) and fourth argument (noise reduction factor) are optional.\n");
return 1;
}
FastCluster grid(n,seed,noiseReductionFactor);
if (filename[0])
{
FILE* fp=fopen(filename, "w");
if (!fp)
{
fprintf(stderr, "Failed to open file to save\n");
return 1;
}
else
{
grid.writePoints(fp);
fclose(fp);
printf("Written cluster to file\n");
}
}
else
{
printf("Not saving points as no filename given\n");
}
return 0;
}