260 |
|
|
261 |
|
/* Advect and allocate new RBF along edge */ |
262 |
|
static RBFNODE * |
263 |
< |
e_advect_rbf(const MIGRATION *mig, const FVECT invec) |
263 |
> |
e_advect_rbf(const MIGRATION *mig, const FVECT invec, int lobe_lim) |
264 |
|
{ |
265 |
+ |
double cthresh = FTINY; |
266 |
|
RBFNODE *rbf; |
267 |
|
int n, i, j; |
268 |
|
double t, full_dist; |
287 |
|
rbf->next = NULL; rbf->ejl = NULL; |
288 |
|
return(rbf); |
289 |
|
} |
290 |
< |
t /= full_dist; |
290 |
> |
t /= full_dist; |
291 |
> |
tryagain: |
292 |
|
n = 0; /* count migrating particles */ |
293 |
|
for (i = 0; i < mtx_nrows(mig); i++) |
294 |
|
for (j = 0; j < mtx_ncols(mig); j++) |
295 |
< |
n += (mtx_coef(mig,i,j) > FTINY); |
295 |
> |
n += (mtx_coef(mig,i,j) > cthresh); |
296 |
> |
/* are we over our limit? */ |
297 |
> |
if ((lobe_lim > 0) & (n > lobe_lim)) { |
298 |
> |
cthresh = cthresh*2. + 10.*FTINY; |
299 |
> |
goto tryagain; |
300 |
> |
} |
301 |
|
#ifdef DEBUG |
302 |
|
fprintf(stderr, "Input RBFs have %d, %d nodes -> output has %d\n", |
303 |
|
mig->rbfv[0]->nrbf, mig->rbfv[1]->nrbf, n); |
318 |
|
float mv; |
319 |
|
ovec_from_pos(v0, rbf0i->gx, rbf0i->gy); |
320 |
|
for (j = 0; j < mtx_ncols(mig); j++) |
321 |
< |
if ((mv = mtx_coef(mig,i,j)) > FTINY) { |
321 |
> |
if ((mv = mtx_coef(mig,i,j)) > cthresh) { |
322 |
|
const RBFVAL *rbf1j = &mig->rbfv[1]->rbfa[j]; |
323 |
|
double rad1 = R2ANG(rbf1j->crad); |
324 |
|
FVECT v; |
361 |
|
if (sym < 0) /* can't interpolate? */ |
362 |
|
return(NULL); |
363 |
|
if (miga[1] == NULL) { /* advect along edge? */ |
364 |
< |
rbf = e_advect_rbf(miga[0], sivec); |
364 |
> |
rbf = e_advect_rbf(miga[0], sivec, lobe_lim); |
365 |
|
if (single_plane_incident) |
366 |
|
rotate_rbf(rbf, invec); |
367 |
|
else |
395 |
|
mtx_ncols(miga[2]); k--; ) |
396 |
|
n += (mtx_coef(miga[2],i,k) > cthresh || |
397 |
|
mtx_coef(miga[1],j,k) > cthresh); |
398 |
+ |
/* are we over our limit? */ |
399 |
|
if ((lobe_lim > 0) & (n > lobe_lim)) { |
400 |
|
cthresh = cthresh*2. + 10.*FTINY; |
401 |
|
goto tryagain; |