optimize the switch of white boundary

This commit is contained in:
rockfool 2019-09-16 12:00:47 -04:00
parent 46367e8369
commit dd9bff40a1

View file

@ -458,15 +458,11 @@ Particle::cross_surface()
score_surface_tally(this, model::active_meshsurf_tallies);
this->r() = r;
}
Direction u;
if(surf->bc_ == BC_REFLECT) {
// Reflect particle off surface
u = surf->reflect(this->r(), this->u());
} else if(surf->bc_ == BC_WHITE) {
// Diffuse reflect particle off surface
u = surf->diffuse_reflect(this->r(), this->u());
}
Direction u = (surf->bc_ == BC_REFLECT) ?
surf->reflect(this->r(), this->u()) :
surf->diffuse_reflect(this->r(), this->u());
// Make sure new particle direction is normalized
this->u() = u / u.norm();