| 337 |
|
|
| 338 |
|
/* Partially advect between recorded incident angles and allocate new RBF */ |
| 339 |
|
RBFNODE * |
| 340 |
< |
advect_rbf(const FVECT invec) |
| 340 |
> |
advect_rbf(const FVECT invec, int lobe_lim) |
| 341 |
|
{ |
| 342 |
+ |
double cthresh = FTINY; |
| 343 |
|
FVECT sivec; |
| 344 |
|
MIGRATION *miga[3]; |
| 345 |
|
RBFNODE *rbf; |
| 380 |
|
geodesic(v1, miga[0]->rbfv[0]->invec, miga[0]->rbfv[1]->invec, |
| 381 |
|
s, GEOD_REL); |
| 382 |
|
t = acos(DOT(v1,sivec)) / acos(DOT(v1,miga[1]->rbfv[1]->invec)); |
| 383 |
+ |
tryagain: |
| 384 |
|
n = 0; /* count migrating particles */ |
| 385 |
|
for (i = 0; i < mtx_nrows(miga[0]); i++) |
| 386 |
|
for (j = 0; j < mtx_ncols(miga[0]); j++) |
| 387 |
< |
for (k = (mtx_coef(miga[0],i,j) > FTINY) * |
| 387 |
> |
for (k = (mtx_coef(miga[0],i,j) > cthresh) * |
| 388 |
|
mtx_ncols(miga[2]); k--; ) |
| 389 |
< |
n += (mtx_coef(miga[2],i,k) > FTINY || |
| 390 |
< |
mtx_coef(miga[1],j,k) > FTINY); |
| 389 |
> |
n += (mtx_coef(miga[2],i,k) > cthresh || |
| 390 |
> |
mtx_coef(miga[1],j,k) > cthresh); |
| 391 |
> |
if ((lobe_lim > 0) & (n > lobe_lim)) { |
| 392 |
> |
cthresh = cthresh*2. + 10.*FTINY; |
| 393 |
> |
goto tryagain; |
| 394 |
> |
} |
| 395 |
|
#ifdef DEBUG |
| 396 |
|
fprintf(stderr, "Input RBFs have %d, %d, %d nodes -> output has %d\n", |
| 397 |
|
miga[0]->rbfv[0]->nrbf, miga[0]->rbfv[1]->nrbf, |
| 419 |
|
const float ma = mtx_coef(miga[0],i,j); |
| 420 |
|
const RBFVAL *rbf1j; |
| 421 |
|
double rad1j, srad2; |
| 422 |
< |
if (ma <= FTINY) |
| 422 |
> |
if (ma <= cthresh) |
| 423 |
|
continue; |
| 424 |
|
rbf1j = &miga[0]->rbfv[1]->rbfa[j]; |
| 425 |
|
rad1j = R2ANG(rbf1j->crad); |
| 432 |
|
const RBFVAL *rbf2k; |
| 433 |
|
double rad2k; |
| 434 |
|
int pos[2]; |
| 435 |
< |
if ((mb <= FTINY) & (mc <= FTINY)) |
| 435 |
> |
if ((mb <= cthresh) & (mc <= cthresh)) |
| 436 |
|
continue; |
| 437 |
|
rbf2k = &miga[2]->rbfv[1]->rbfa[k]; |
| 438 |
|
rbf->rbfa[n].peak = w0i * ma * (mb*mbfact + mc*mcfact); |