Skip to content

Commit

Permalink
fix maximum time gate rounding bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Jul 25, 2019
1 parent eb109e0 commit a3b7714
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/mmc_core.cl
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ float branchless_badouel_raytet(ray *r, __constant MCXParam *gcfg,__constant int
r->Lmove=((r->isend) ? r->Lmove : Lmin);
r->pout=r->p0+FL3(Lmin)*r->vec;

if((int)((r->photontimer+r->Lmove*(prop.n*R_C0)-gcfg->tstart)*gcfg->Rtstep)>(int)((gcfg->tend-gcfg->tstart)*gcfg->Rtstep)){ /*exit time window*/
if((int)((r->photontimer+r->Lmove*(prop.n*R_C0)-gcfg->tstart)*gcfg->Rtstep)>gcfg->maxgate-1){ /*exit time window*/
r->faceid=-2;
r->pout.x=MMC_UNDEFINED;
r->Lmove=(gcfg->tend-r->photontimer)/(prop.n*R_C0)-1e-4f;
Expand Down
2 changes: 1 addition & 1 deletion src/tettracing.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ float branchless_badouel_raytet(ray *r, raytracer *tracer, mcconfig *cfg, visito
T = _mm_add_ps(T, S);
_mm_store_ps(&(r->pout.x),T);

if((int)((r->photontimer+r->Lmove*rc-cfg->tstart)*visit->rtstep)>=(int)((cfg->tend-cfg->tstart)*visit->rtstep)){ /*exit time window*/
if((int)((r->photontimer+r->Lmove*rc-cfg->tstart)*visit->rtstep)>cfg->maxgate-1){ /*exit time window*/
r->faceid=-2;
r->pout.x=MMC_UNDEFINED;
r->Lmove=(cfg->tend-r->photontimer)/(prop->n*R_C0)-1e-4f;
Expand Down

0 comments on commit a3b7714

Please sign in to comment.