Moved initialized variables into if statement

This commit is contained in:
myerspat 2022-06-09 10:39:46 -05:00
parent 61db44f40e
commit 70b1706460

View file

@ -345,12 +345,14 @@ void sample_photon_reaction(Particle& p)
// Photoelectric effect
double prob_after = prob + micro.photoelectric;
int i_grid = micro.index_grid;
double f = micro.interp_factor;
const auto& xs_lower = xt::row(element.cross_sections_, i_grid);
const auto& xs_upper = xt::row(element.cross_sections_, i_grid + 1);
if (prob_after > cutoff) {
int i_grid = micro.index_grid;
double f = micro.interp_factor;
const auto& xs_lower = xt::row(element.cross_sections_, i_grid);
const auto& xs_upper = xt::row(element.cross_sections_, i_grid + 1);
for (int i_shell = 0; i_shell < element.shells_.size(); ++i_shell) {
const auto& shell {element.shells_[i_shell]};