1 #ifndef UPDATE_PARTICLE_FLAGS_HPP
2 #define UPDATE_PARTICLE_FLAGS_HPP
16 template<
class Device>
22 for (
int i_simd = 0; i_simd < SIMD_SIZE; i_simd++){
28 bt1[i_simd] = (magnetic_field.
is_in_region_1(part_tmp.
ph.
r[i_simd],part_tmp.
ph.
z[i_simd],psi[i_simd]));
30 bt3[i_simd] = part_tmp.
ph.
r[i_simd] > magnetic_field.
equil.axis_r ;
33 itmp[i_simd] = part_tmp.flag[i_simd];
48 for (
int i_simd = 0; i_simd < SIMD_SIZE; i_simd++){
51 long long int l_step = push_controls.
gstep;
59 for (
int i_simd = 0; i_simd < SIMD_SIZE; i_simd++){
60 part_tmp.flag[i_simd] = (bt0[i_simd]) ? (part_tmp.flag[i_simd]) : (itmp[i_simd]);
71 template<
class Device>
77 if(push_controls.
ipc==2 && push_controls.
gstep%push_controls.particle_stream.reset_period==0){
78 for (
int i_simd = 0; i_simd < SIMD_SIZE; i_simd++){
83 bt0[i_simd] = (push_controls.particle_stream.pin < psi[i_simd]) && ( psi[i_simd]<push_controls.particle_stream.pout);
86 itmp[i_simd] = part_tmp.flag[i_simd];
91 part_tmp.flag[i_simd] = itmp[i_simd];
107 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++){
112 bool dw_nonzero = not_in_triangle[i_simd] & (dw[i_simd]!=0.0);
114 itmp[i_simd]=part_tmp.flag[i_simd];
118 part_tmp.flag[i_simd] = (bt0[i_simd] || !dw_nonzero) ? (part_tmp.flag[i_simd]) : (itmp[i_simd]);
127 constexpr
double min_dw=-256.;
128 constexpr
double max_dw= 256.;
133 constexpr
int factor1 = 1u << nb1;
134 constexpr
int factor2= 1u << nb2;
140 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++){
141 dw[i_simd] = min(max_dw, max(min_dw, dw[i_simd]));
142 itmp[i_simd] = dw[i_simd] *
static_cast<double>(factor1);
143 itmp[i_simd] = itmp[i_simd] * factor2;
147 part_tmp.flag[i_simd]+=itmp[i_simd];
constexpr int ps_flag_bits
Definition: particle_stream.hpp:49
KOKKOS_INLINE_FUNCTION bool is_in_region_1(double r, double z, double psi) const
Definition: magnetic_field.tpp:73
constexpr long long int ps_is_escaped
Definition: particle_stream.hpp:39
constexpr int ps_dw_factor_bits
Definition: particle_stream.hpp:52
constexpr int ps_flag_step_bits
Definition: particle_stream.hpp:51
KOKKOS_INLINE_FUNCTION void flag_set(long long int &flags, const bool tf, const long long int flag_loc)
Definition: particle_stream.tpp:9
constexpr long long int ps_is_to_write
Definition: particle_stream.hpp:36
Definition: push_controls.hpp:9
Definition: magnetic_field.hpp:13
Equilibrium equil
The object containing information about the magnetic equilibrium.
Definition: magnetic_field.hpp:45
constexpr long long int ps_flag_mask
Definition: particle_stream.hpp:55
KOKKOS_INLINE_FUNCTION bool flag_check(const long long int flags, const long long int flag_loc)
Definition: particle_stream.tpp:15
constexpr long long int ps_is_outboard
Definition: particle_stream.hpp:42
Simd< double > r
Definition: particles.hpp:18
constexpr long long int ps_is_divertor
Definition: particle_stream.hpp:41
constexpr long long int ps_flag_step_mask
Definition: particle_stream.hpp:54
SimdPhase ph
Definition: particles.hpp:59
Definition: particles.hpp:58
int gstep
Definition: push_controls.hpp:19
Simd< double > z
Definition: particles.hpp:19
constexpr long long int ps_was_inside
Definition: particle_stream.hpp:43
int ipc
Definition: push_controls.hpp:20
Definition: magnetic_field.F90:1
constexpr long long int ps_is_tracked
Definition: particle_stream.hpp:44