1 | #ifndef PMT_H |
1 | #ifndef PMT_H |
2 | #define PMT_H |
2 | #define PMT_H |
3 | |
3 | |
4 | #include <GiSTlist.h> |
4 | #include <GiSTlist.h> |
|
|
5 | |
|
|
6 | typedef unsigned long velem; |
5 | |
7 | |
6 | class MT; |
8 | class MT; |
7 | |
9 | |
8 | class PMT { |
10 | class PMT { |
9 | MT *mt; |
11 | MT *mt; |
… | |
… | |
14 | double max; |
16 | double max; |
15 | double steps; |
17 | double steps; |
16 | |
18 | |
17 | double maxDist; |
19 | double maxDist; |
18 | int elemsize; |
20 | int elemsize; |
|
|
21 | velem vzero; |
|
|
22 | |
|
|
23 | int distfast; // can distance be computed fast (integer arithmetic) |
|
|
24 | double distmul; // then use this corrective factor |
19 | |
25 | |
20 | public: |
26 | public: |
21 | PMT(int ndims, double min, double max, double steps); |
27 | PMT(int ndims, |
|
|
28 | double min, |
|
|
29 | double max, |
|
|
30 | double steps, |
|
|
31 | unsigned int pagesize); |
22 | ~PMT(); |
32 | ~PMT(); |
|
|
33 | void sync(); |
23 | void create(const char *path); |
34 | void create(const char *path); |
24 | void open(const char *path); |
35 | void open(const char *path); |
25 | void insert(double *k, int data); |
36 | void insert(double *k, int data); |
26 | double distance(double *k1, double *k2) const; |
37 | double distance(double *k1, double *k2) const; |
27 | void range(double *k, double r) const; |
38 | void range(double *k, double r) const; |
28 | void top(double *k, int n) const; |
39 | void top(double *k, int n) const; |
|
|
40 | int maxlevel() const; |
29 | //bulkload(PKey *o, int count); |
41 | //bulkload(PKey *o, int count); |
30 | }; |
42 | }; |
31 | |
43 | |
32 | #define ACC (current_pmt) |
44 | #define ACC (current_pmt) |
33 | #define NDIMS (ACC->ndims) |
45 | #define NDIMS (ACC->ndims) |
34 | |
46 | |
35 | extern const PMT *current_pmt; |
47 | extern const PMT *current_pmt; |
36 | |
48 | |
37 | extern void add_result(double distance, int data, double *k, int ndims); |
49 | extern void add_result(int data, double *k, int ndims); |
38 | |
50 | |
39 | #endif |
51 | #endif |