if (!RTreeClose2(rtp, n->branch[i].child)) {
free(n->branch[i].child);
DisconBranch(n, i);
- rtp->EntryCount--;
- if (rtp->StatFlag)
- rtp->ElimCount++;
}
}
} else {
if (!n->branch[i].child)
continue;
DisconBranch(n, i);
- rtp->EntryCount--;
- if (rtp->StatFlag)
- rtp->ElimCount++;
}
}
return 0;
assert(n->level >= 0);
assert(r);
- rtp->SeTouchCount++;
-
if (n->level > 0) { /* this is an internal node in the tree */
for (size_t i = 0; i < NODECARD; i++)
if (n->branch[i].child && Overlap(r, &n->branch[i].rect)) {
fprintf(stderr, "RTreeInsert level=%d\n", level);
# endif
- if (rtp->StatFlag) {
- rtp->InsertCount++;
- }
- rtp->RectCount++;
-
if (RTreeInsert2(rtp, r, data, *n, &newnode, level)) { /* root was split */
- if (rtp->StatFlag) {
- rtp->InTouchCount++;
- }
Node_t *newroot = RTreeNewNode(rtp); /* grow a new root, make tree taller */
newroot->level = (*n)->level + 1;
b.child = newnode;
AddBranch(rtp, &b, newroot, NULL);
*n = newroot;
- rtp->EntryCount += 2;
result = 1;
}
assert(r && n && new);
assert(level >= 0 && level <= n->level);
- if (rtp->StatFlag) {
- rtp->InTouchCount++;
- }
-
/* Still above level for insertion, go down tree recursively */
if (n->level > level) {
int i = PickBranch(r, n);
n->branch[i].rect = NodeCover(n->branch[i].child);
b.child = n2;
b.rect = NodeCover(n2);
- rtp->EntryCount++;
return AddBranch(rtp, &b, n, new);
}
} else if (n->level == level) { /* at level for insertion. */
/*Add rect, split if necessary */
b.rect = *r;
b.child = (Node_t *) data;
- rtp->EntryCount++;
return AddBranch(rtp, &b, n, new);
} else { /* Not supposed to happen */
assert(FALSE);
/* times */
long ElapsedTime;
float UserTime, SystemTime;
-
- /* variables for statistics */
- int StatFlag; /* tells if we are counting or not */
- /* counters affected only when StatFlag set */
- int InsertCount;
- int DeleteCount;
- int ReInsertCount;
- int InSplitCount;
- int DeSplitCount;
- int ElimCount;
- int EvalCount;
- int InTouchCount;
- int DeTouchCount;
- int SeTouchCount;
- int CallCount;
- float SplitMeritSum;
-
- /* counters used even when StatFlag not set */
- int RectCount;
- int NodeCount;
- int EntryCount;
- int SearchCount;
- int HitCount;
-
};
typedef struct ListNode {
PrintBranch(-1, b);
#endif
- if (rtp->StatFlag) {
- rtp->InSplitCount++;
- }
-
/* load all the branches into a buffer, initialize old node */
int level = n->level;
GetBranches(rtp, n, b);
struct PartitionVars *p = &rtp->split.Partitions[0];
MethodZero(rtp);
- int area = RectArea(&p->cover[0]) + RectArea(&p->cover[1]);
-
- /* record how good the split was for statistics */
- if (rtp->StatFlag && area)
- rtp->SplitMeritSum += (float) rtp->split.CoverSplitArea / area;
-
/* put branches from buffer into 2 nodes according to chosen partition */
*nn = RTreeNewNode(rtp);
(*nn)->level = n->level = level;