@@ -33,12 +33,12 @@ namespace impactx::elements
3333 namespace dipedge
3434 {
3535 AMREX_ENUM (Model,
36- linear = 0 , // ! for the linear fringe field model
37- nonlinear = 1 // ! for the 6th order fringe field model
36+ linear, // ! for the linear fringe field model
37+ nonlinear // ! for the 6th order fringe field model
3838 );
3939 AMREX_ENUM (Location,
40- entry = 1 , // ! for leading (entry) fringe field
41- exit = - 1 // ! for trailing (exit) fringe field
40+ entry, // ! for leading (entry) fringe field
41+ exit // ! for trailing (exit) fringe field
4242 );
4343 }
4444
@@ -149,19 +149,19 @@ namespace impactx::elements
149149 amrex::ParticleReal const sec_psi = 1_prt/cos_psi;
150150
151151 // the scale constant specifying entry or exit
152- amrex::ParticleReal const flg = static_cast <amrex::ParticleReal>(m_location) ;
152+ amrex::ParticleReal const loc = m_location == dipedge::Location::entry ? 1_prt : -1_prt ;
153153
154154 m_c1 = (m_g / m_rc) * m_K1 / cos_psi;
155155 m_c2_times_1plusdelta = powi<2 >(m_g/m_rc) * m_K0 * sin_psi * powi<3 >(sec_psi)/2_prt;
156- m_c3_times_1plusdelta = flg * powi<2 >(m_g)/m_rc * m_K0 * powi<2 >(sec_psi);
157- m_c4_times_1plusdelta = flg * (m_g / m_rc) * m_K1 * sin_psi / (powi<2 >(cos_psi));
156+ m_c3_times_1plusdelta = loc * powi<2 >(m_g)/m_rc * m_K0 * powi<2 >(sec_psi);
157+ m_c4_times_1plusdelta = loc * (m_g / m_rc) * m_K1 * sin_psi / (powi<2 >(cos_psi));
158158 m_c5 = tan_psi / (2_prt * m_rc);
159159 m_c6_times_1plusdelta = 0 .5_prt * powi<2 >(sin_psi)/(2_prt * m_rc * powi<3 >(cos_psi)) * m_g/m_rc * m_K1;
160160 m_c7_times_1plusdelta = 0 .5_prt * powi<3 >(sec_psi) * (m_g * m_K1 / (2_prt*powi<2 >(m_rc)) + (1_prt+powi<2 >(sin_psi))*m_g*m_K2/powi<2 >(m_rc));
161161 m_c8_times_1plusdelta = (1_prt/6_prt) * powi<3 >(tan_psi) / (2_prt * powi<2 >(m_rc));
162162 m_c9_times_1plusdelta = 0 .5_prt * tan_psi * powi<2 >(sec_psi) / (2_prt * powi<2 >(m_rc));
163- m_c10_times_1plusdelta = flg * powi<2 >(tan_psi) / (2_prt * m_rc);
164- m_c11_times_1plusdelta = flg * 1_prt / (2_prt * m_rc);
163+ m_c10_times_1plusdelta = loc * powi<2 >(tan_psi) / (2_prt * m_rc);
164+ m_c11_times_1plusdelta = loc * 1_prt / (2_prt * m_rc);
165165 m_c12_times_1plusdelta = (m_g > 0_prt) ? 1_prt / (24_prt) * (4_prt/cos_psi - 8_prt/(powi<3 >(cos_psi))) * m_K3/(powi<2 >(m_rc) * m_g) : 0_prt;
166166 m_c13 = powi<2 >(sin_psi) / (2_prt*powi<3 >(cos_psi)) * powi<2 >(m_g)/(m_rc*m_R) * m_K4;
167167 m_c14 = 0 .5_prt * sin_psi/(powi<3 >(cos_psi)) * m_g/(m_rc*m_R) * m_K5;
@@ -315,7 +315,7 @@ namespace impactx::elements
315315 amrex::ParticleReal m_K5; // ! fringe field integral
316316 amrex::ParticleReal m_K6; // ! fringe field integral
317317 dipedge::Model m_model; // ! fringe field model: linear or nonlinear
318- dipedge::Location m_location; // ! +1 for entry, or -1 for exit fringe field
318+ dipedge::Location m_location; // ! fringe field location: entry, or exit
319319
320320 private:
321321 // constants that are independent of the individually tracked particle,
0 commit comments