我正在使用空间索引(http://libspatialindex.github.com/)库批量加载 R 树:
string baseName = "streets";
size_t capacity = 10 * 1024 * 1024;
bool bWriteThrough = false;
indexIdentifier = 0;
IStorageManager *disk = StorageManager::createNewDiskStorageManager(baseName, 512);
fileInMem = StorageManager
::createNewRandomEvictionsBuffer(*disk, capacity, bWriteThrough);
// bulkLoads my tree
bulkLoadRTree();
cout << "tree info:" << endl;
cout << *tree << endl;
delete disk;
以下是有关已构建树的信息的输出:
Dimension: 2
Fill factor: 0.7
Index capacity: 100
Leaf capacity: 100
Tight MBRs: enabled
Near minimum overlap factor: 32
Reinsert factor: 0.3
Split distribution factor: 0.4
Utilization: 69%
Reads: 1
Writes: 35980
Hits: 0
Misses: 0
Tree height: 4
Number of data: 2482376
Number of nodes: 35979
Level 0 pages: 35463
Level 1 pages: 507
Level 2 pages: 8
Level 3 pages: 1
Splits: 0
Adjustments: 0
Query results: 0
现在我正在尝试加载我保存在磁盘中的内容:
IStorageManager *ldisk = StorageManager::loadDiskStorageManager(baseName);
SpatialIndex::StorageManager::IBuffer* fileLoadBuffer = StorageManager
::createNewRandomEvictionsBuffer(*ldisk, capacity, bWriteThrough);
id_type id = 1;
tree = RTree::loadRTree(*fileLoadBuffer, id);
cout << *tree << endl;
并且树只有一个节点(树的输出是:)
Dimension: 2
Fill factor: 0.7
Index capacity: 100
Leaf capacity: 100
Tight MBRs: enabled
Near minimum overlap factor: 32
Reinsert factor: 0.3
Split distribution factor: 0.4
Utilization: 0%
Reads: 0
Writes: 0
Hits: 0
Misses: 0
Tree height: 1
Number of data: 0
Number of nodes: 1
Level 0 pages: 1
Splits: 0
Adjustments: 0
Query results: 0
我做错了什么?为什么我不从磁盘加载整个树?