-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrccds-memtest.cc
48 lines (43 loc) · 1.3 KB
/
rccds-memtest.cc
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
#include "rccds.h"
#include <iostream>
#include <map>
typedef vector<chord_t> diagram_t;
int main(int argc, char const *argv[])
{
struct timespec tstart={0,0}, tend={0,0};
clock_gettime(CLOCK_MONOTONIC, &tstart);
chord_t d[4];
d[0] = mk_chord(1,5,0);
d[1] = mk_chord(2,8,0);
d[2] = mk_chord(3,6,0);
d[3] = mk_chord(4,7,0);
if( fast_is_connected(d,4) )
{
cout << "is connected" << endl;
vector<int> terminals(4-1);
int num_terminals = 0;
int label = 0;
get_intersection_terminals(d,4,d,4,&label,&terminals,&num_terminals);
for( int i = 0 ; i < 4 ; i++ )
{
printf("%d %d %d\n", d[i].first, d[i].second, d[i].id);
}
int size1 = 0; int size2 = 0;
int index = 0;
BinTreeManager<int> btm;
BinTree<int>* int_tree = fast_build_int_tree(btm,d,4);
BinTree<int>* ins_tree = get_insertion_tree(btm,int_tree);
map<int,int> bl_map;
get_ld_map(&bl_map,ins_tree,0);
for( map<int,int>::iterator i = bl_map.begin() ; i != bl_map.end() ; i++ )
{
cout << i->first << " " << i->second << endl;
}
}
cout << endl;
clock_gettime(CLOCK_MONOTONIC, &tend);
printf("some_long_computation took about %.5f seconds\n",
((double)tend.tv_sec + 1.0e-9*tend.tv_nsec) -
((double)tstart.tv_sec + 1.0e-9*tstart.tv_nsec));
return 0;
}