41 fprintf(stderr,
"Splitting:\n");
43 fprintf(stderr,
"new branch:\n");
54 for (
size_t i = 0; i <
NODECARD + 1; i++) {
67 (*nn)->level = n->
level = level;
73 fprintf(stderr,
"group 0:\n");
75 fprintf(stderr,
"group 1:\n");
77 fprintf(stderr,
"\n");
91 for (
size_t i = 0; i <
NODECARD; i++) {
99 for (
size_t i = 1; i <
NODECARD + 1; i++) {
123 int group, chosen = 0, betterGroup = 0;
132 bool biggestDiffSet =
false;
133 uint64_t biggestDiff = 0;
134 for (
int i = 0; i <
NODECARD + 1; i++) {
142 if (growth1 >= growth0) {
143 diff = growth1 - growth0;
146 diff = growth0 - growth1;
150 if (!biggestDiffSet || diff > biggestDiff) {
152 biggestDiffSet =
true;
155 }
else if (diff == biggestDiff &&
172 for (
int i = 0; i <
NODECARD + 1; i++) {
190 int seed0 = 0, seed1 = 0;
193 for (
int i = 0; i <
NODECARD + 1; i++)
197 for (
int i = 0; i <
NODECARD; i++) {
198 for (
int j = i + 1; j <
NODECARD + 1; j++) {
241 MFBSetColor(group + 3);
242 for (j = 0; j <
NODECARD + 1; j++) {
245 PrintRect(&rtrtp->split.Partitions[0].BranchBuf[j].rect);
262 for (
size_t i = 0; i <
NODECARD + 1; i++) {
283 for (
size_t i = 0; i <
NODECARD + 1; i++) {
296 fprintf(stderr,
"\npartition:\n");
297 for (
size_t i = 0; i <
NODECARD + 1; i++) {
298 fprintf(stderr,
"%3zu\t", i);
300 fprintf(stderr,
"\n");
301 for (
size_t i = 0; i <
NODECARD + 1; i++) {
303 fprintf(stderr,
" t\t");
305 fprintf(stderr,
"\t");
307 fprintf(stderr,
"\n");
308 for (
size_t i = 0; i <
NODECARD + 1; i++) {
311 fprintf(stderr,
"\n");
313 fprintf(stderr,
"count[0] = %d area = %" PRIu64
"\n",
316 fprintf(stderr,
"count[1] = %d area = %" PRIu64
"\n",
321 fprintf(stderr,
"total area = %" PRIu64
" effectiveness = %3.2f\n",
328 fprintf(stderr,
"cover[0]:\n");
331 fprintf(stderr,
"cover[1]:\n");
Node_t * RTreeNewNode(void)
int AddBranch(RTree_t *rtp, Branch_t *b, Node_t *n, Node_t **new)
void PrintBranch(int, Branch_t *)
Rect_t CombineRect(const Rect_t *r, const Rect_t *rr)
uint64_t RectArea(const Rect_t *r)
static void GetBranches(RTree_t *rtp, Node_t *n, Branch_t *b)
static void Classify(RTree_t *rtp, int i, int group)
void SplitNode(RTree_t *rtp, Node_t *n, Branch_t *b, Node_t **nn)
static void LoadNodes(RTree_t *rtp, Node_t *n, Node_t *q, struct PartitionVars *p)
static void MethodZero(RTree_t *rtp)
static void InitPVars(RTree_t *rtp)
static void PickSeeds(RTree_t *rtp)
struct Branch branch[NODECARD]
int partition[NODECARD+1]
struct PartitionVars Partitions[METHODS]
struct Branch BranchBuf[NODECARD+1]