Skip to content
Snippets Groups Projects
Commit 58e34dae authored by nadolski's avatar nadolski
Browse files

Bug. Loss particle flag badly initialized

parent 61611af3
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,8 @@ template<typename T>
inline bool CheckAmpl(const ss_vect<T> &x, const long int loc)
{
bool not_lost;
status.lossplane = 0;
if (globval.Aperture_on)
not_lost = is_double<T>::cst(x[x_]) > Cell[loc].maxampl[X_][0] &&
is_double<T>::cst(x[x_]) < Cell[loc].maxampl[X_][1] &&
......@@ -45,6 +46,7 @@ inline bool CheckAmpl(const ss_vect<T> &x, const long int loc)
is_double<T>::cst(x[y_]) > -max_ampl&&
is_double<T>::cst(x[y_]) < max_ampl;
// particle lost
if (!not_lost) {
if (is_double<T>::cst(x[x_]) < Cell[loc].maxampl[X_][0] ||
is_double<T>::cst(x[x_]) > Cell[loc].maxampl[X_][1])
......@@ -54,7 +56,7 @@ inline bool CheckAmpl(const ss_vect<T> &x, const long int loc)
status.lossplane = 2;
if (trace)
printf("CheckAmpl: Particle lost in plane %d at element:"
fprintf(stdout, "CheckAmpl: Particle lost in plane %d at element:"
" %5ld s = %10.5f, x = %12.5e, z= %12.5e\n",
status.lossplane, loc, Cell[loc].S,
is_double<T>::cst(x[x_]), is_double<T>::cst(x[y_]));
......@@ -103,7 +105,6 @@ void Elem_Pass(const long i, ss_vect<T> &x)
}
if (globval.IBS) {
// trace = i == 34;
is_tps<T>::do_IBS(Cell[i].Elem.PL, x);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment