114 |
|
static int |
115 |
|
add_pabopto_inp(const int i) |
116 |
|
{ |
117 |
< |
FILE *fp = fopen(inpfile[i].fname, "r"); |
118 |
< |
double theta_out, phi_out, val; |
119 |
< |
int n, c; |
117 |
> |
static int lastnew = -1; |
118 |
> |
FILE *fp = fopen(inpfile[i].fname, "r"); |
119 |
> |
double theta_out, phi_out, val; |
120 |
> |
int n, c; |
121 |
|
|
122 |
|
if (fp == NULL || fseek(fp, inpfile[i].dstart, 0) == EOF) { |
123 |
|
fputs(inpfile[i].fname, stderr); |
126 |
|
} |
127 |
|
/* prepare input grid */ |
128 |
|
angle_eps = 180./2./GRIDRES; |
129 |
< |
if (!i || cmp_inang(&inpfile[i-1], &inpfile[i])) { |
130 |
< |
if (i) /* need to process previous incidence */ |
129 |
> |
if (lastnew < 0 || cmp_inang(&inpfile[lastnew], &inpfile[i])) { |
130 |
> |
if (lastnew >= 0) /* need to process previous incidence */ |
131 |
|
make_rbfrep(); |
132 |
|
#ifdef DEBUG |
133 |
|
fprintf(stderr, "New incident (theta,phi)=(%f,%f)\n", |
134 |
|
inpfile[i].theta, inpfile[i].phi); |
135 |
|
#endif |
136 |
|
new_bsdf_data(inpfile[i].theta, inpfile[i].phi); |
137 |
+ |
lastnew = i; |
138 |
|
} |
139 |
|
#ifdef DEBUG |
140 |
|
fprintf(stderr, "Loading measurements from '%s'...\n", inpfile[i].fname); |