-
Notifications
You must be signed in to change notification settings - Fork 0
/
recombine.c
42 lines (38 loc) · 809 Bytes
/
recombine.c
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
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "header.h"
void recombine ()
{
int i, high;
/* Find highest subdivision level */
high = 0;
for (i=0; i<N+1; i++)
if (sd[i] > high) high = sd[i];
for (i=high; i>=1; i/=2)
recombine_level(i);
}
void recombine_level (int l)
{
int i, j, count, done;
/* sweep right */
count= 0;
done = 0;
for (i=N-1; i>0; i--) /* search for first relevant point */
{
if (sd[i+1] == l/2 && sd[i] == l)
{
/* Look for points to the right that need recombination */
count = 0;
while (sd[i-count]==l && fabs(dx*dx*d2dx2(Tm,i-count)/(sd[i-count]*sd[i-count]))<1e-6)
count++;
i -= count;
if (count>10) {done = 1;printf("count = %d, %d, %d\n", count, i, l);}
}
}
if (done && 0)
{
output_state("state", 0);
exit(0);
}
}