XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
species.hpp
Go to the documentation of this file.
1 #ifndef SPECIES_HPP
2 #define SPECIES_HPP
3 #include <Cabana_AoSoA.hpp>
4 #include <Cabana_DeepCopy.hpp>
5 #include <Kokkos_Core.hpp>
6 #include "NamelistReader.hpp"
7 #include "timer_macro.hpp"
8 #include "particles.hpp"
9 #include "space_settings.hpp"
10 #include "distribution.hpp"
11 #include "profile.hpp"
13 
14 extern "C" void set_spall_num_and_ptr(int idx, int n_ptl, int n_vecs, VecParticles* ptl);
15 
20  return false;
21 }
22 
27  return false;
28 }
29 
30 // Used for Cabana slices (getting one particle property at a time)
31 namespace PtlSlice{
32 #ifdef ESC_PTL
33 enum{Ph=0,Ct,Gid,Flag};
34 #else
35 enum{Ph=0,Ct,Gid};
36 #endif
37 }
38 
39 struct PtlMvmt{
40  // Options for particle location management when looping over particles
41  enum SendOpt{
42  NoSend=0,
45  };
46 
47  enum ReturnOpt{
51  };
52 
55 
56  PtlMvmt(SendOpt send_opt, ReturnOpt return_opt) : send_opt(send_opt), return_opt(return_opt){}
57 };
58 
62 };
63 
64 // Species class
65 template<class Device>
66 class Species{
67  public:
68 
69  int idx;
70  bool is_electron;
71  bool is_adiabatic;
74  double mass;
75  double charge;
76  double charge_eu;
77  double c_m;
78  double c2_2m;
79 
80  bool is_deltaf;
81 
82  int ncycles;
84 
85  int n_ptl;
86  Cabana::AoSoA<ParticleDataTypes,HostType,VEC_LEN> particles;
87 
88  // Device particles
89  Cabana::AoSoA<ParticleDataTypes,Device,VEC_LEN> particles_d;
90 
92 
95 
96  /*** Could be its own class inside species? ***/
100 
101  // phase0 (for ion restoration)
102  Cabana::AoSoA<PhaseDataTypes,HostType,VEC_LEN> phase0;
103  Cabana::AoSoA<PhaseDataTypes,Device,VEC_LEN> phase0_d;
104 
105  // For electron restoration
106  Cabana::AoSoA<ParticleDataTypes,HostType,VEC_LEN> backup_particles;
107  int n_backup_particles; // Number of particles stored in backup_particles (can't be deduced from its size due to buffer)
108  /****/
109 
111 
112  Eq::Profile<Device> eq_temp; // Equilibrium temperature
113  Eq::Profile<Device> eq_den; // Equilibrium density
114  Eq::Profile<Device> eq_flow; // Equilibrium flow
115 
116  Species(int idx_in, int nonadiabatic_idx_in, bool is_electron_in, bool is_adiabatic_in, KinType kintype_in, double mass_in, double charge_in, double charge_eu_in, bool is_deltaf_in,
117  int ncycles_in);
118 
119  Species(NLReader::NamelistReader& nlr, int idx_in, int nonadiabatic_idx_in);
120 
121  // Electron or ion default constructor
122  Species(SpeciesType sp_type, int n_ptl)
123  : idx(sp_type==ELECTRON ? 0 : 1),
124  is_electron(sp_type==ELECTRON),
125  mass(is_electron ? 3.344e-30 : PROTON_MASS),
127  charge_eu(is_electron ? -1.0 : 1.0),
128  is_deltaf(true),
129  is_adiabatic(false),
130  nonadiabatic_idx(idx), // Since is_adiabatic is false above
131 #ifdef MULTI_RATE_DRIFT_ION
132  kintype(DriftKin),
133 #else
135 #endif
136  ncycles(is_electron ? 70 : 1),
137  c_m(charge/mass),
138  c2_2m(0.5*charge*charge/mass),
139  n_ptl(n_ptl),
140  backup_particles("backup_particles", 0),
141  particles("particles", add_vec_buffer(n_ptl)),
143  eq_temp(1.0e3,-0.1),
144  eq_den(1.0e19,-0.1),
145  owns_particles_d(false),
149 
150  // Special constructor for tests that involve tracking particles in memory
151  // The idea is to use these particles to test functions that reorder particles,
152  // e.g. sort, shift, and cleaning
153  Species(int n_ptl_in)
154  : n_ptl(n_ptl_in),
155  is_electron(true),
156  is_adiabatic(false),
157  particles("particles", add_vec_buffer(n_ptl_in)),
158  owns_particles_d(false),
163  {
164 
165  // Slice particle properties
166  auto ph = Cabana::slice<PtlSlice::Ph>(particles);
167  auto ct = Cabana::slice<PtlSlice::Ct>(particles);
168  auto gid = Cabana::slice<PtlSlice::Gid>(particles);
169 #ifdef ESC_PTL
170  auto flag = Cabana::slice<PtlSlice::Flag>(particles);
171 #endif
172 
173  // Offset gid if using MPI
174 #ifdef USE_MPI
175  long long int gid_offset = n_ptl*SML_COMM_RANK;
176 #else
177  long long int gid_offset = 0;
178 #endif
179 
180  // Assign trackable values
181  for (int i=0;i<n_ptl;i++){
182  // Set GID in order
183  gid(i) = gid_offset + i+1; // 1-indexed
184 
185  // Value of properties is gid + 0.1*(property index)
186  // First particle: (1.0, 1.1, ... 1.8)
187  // Second particle: (2.0, 2.1, ... 2.8)
188  for (int j=0;j<6;j++) ph(i, j) = gid(i) + (j)*0.1;
189  for (int j=0;j<3;j++) ct(i, j) = gid(i) + (j+6)*0.1;
190  }
191 
192  // Buffer particles: same but with gid = -1
193  if(n_ptl>0){
194  for (int i=n_ptl;i<add_vec_buffer(n_ptl);i++){
195  gid(i) = -1;
196  for (int j=0;j<6;j++) ph(i, j) = gid(i) + (j)*0.1;
197  for (int j=0;j<3;j++) ct(i, j) = gid(i) + (j+6)*0.1;
198  }
199  }
200  }
201 
202  void resize_particles(int new_n_ptl){
203  n_ptl = new_n_ptl;
204 
205 #ifndef USE_GPU
206  // If CPU-only, particles_d points to the same location as particles. If particles is resized, then Cabana will not deallocate the first allocation
207  // since it is still used by particles_d. So, reset particles_d before resize, and point it back to particles only afterwards
208  particles_d = Cabana::AoSoA<ParticleDataTypes,Device,VEC_LEN>();
209 #endif
210 
211  particles.resize(add_vec_buffer(n_ptl));
212 
213 #ifndef USE_GPU
214  // Point particles_d back to particles after resize
216 #endif
217 
219  }
220 
222 #ifdef USE_GPU
223  particles.resize(particles_d.size());
224 #else
225  // Point particles back to particles_d after resize
227 #endif
228 
230  }
231 
232  /* If using CPU-only, then "device" particles are a shallow copy of host particles so that
233  * there is no unnecessary duplication. When "device" particles are resized, Cabana will keep the
234  * original allocation if there is a second reference (i.e. host particles).
235  * To resolve this, we free the host particles here so that there is no second reference
236  * */
238  particles = Cabana::AoSoA<ParticleDataTypes,HostType,VEC_LEN>();
239  }
240 
241  /* Resizes device particles if on GPU, or just creates a shallow copy if CPU only
242  * */
244  if(!owns_particles_d) exit_XGC("\nSpecies tried to resize device particles, but doesn't own the device array.");
245 
246 #ifdef USE_GPU
247  // Resize device particles to match host particles
248  particles_d.resize(particles.size());
249 #else
250  // If kernels are on CPU, do shallow copy
252 #endif
253  }
254 
255  /* Resizes device particles
256  * */
257  void resize_device_particles(int new_n_ptl){
258  if(!owns_particles_d) exit_XGC("\nSpecies tried to resize device particles, but doesn't own the device array.");
259 
260  n_ptl = new_n_ptl;
261 
262  // Resize device particles to match host particles
264  }
265 
266  /* Copies particles to device - deep copy if using GPU, otherwise shallow copy
267  * Also takes the opportunity to set the buffer particles to realistic values
268  * */
270  if(!owns_particles_d) exit_XGC("\nSpecies tried to copy particles to device, but doesn't own the device array.");
271 
272 #ifdef USE_GPU
273  // Copy to device
274  Cabana::deep_copy(particles_d, particles);
275 #else
276  // No operation required if CPU-only
277 #endif
278 
279  // Copy last particle to fill remainder of trailing vector in AoSoA
281  }
282 
283  /* Copies particles from device - deep copy if using GPU, otherwise no copy is necessary
284  * */
286  if(!owns_particles_d) exit_XGC("\nSpecies tried to copy particles from device, but doesn't own the device array.");
287 
288 #ifdef USE_GPU
289  // Copy particles to host
290  Cabana::deep_copy(particles, particles_d);
291 #else
292  // No operation required if CPU-only
293 #endif
294  }
295 
296  /* Copies particles to device if they are resident on the device
297  * */
300  }
301 
302  /* Copies particles from device if they are resident on the device
303  * */
306  }
307 
308  /* Copies particles to device if they are NOT resident on the device
309  * */
312  }
313 
314  /* Copies particles from device if they are NOT resident on the device
315  * */
318  }
319 
328  if (n_ptl>0){
329  int last_ptl_index = n_ptl - 1;
330  auto ph = Cabana::slice<PtlSlice::Ph>(particles_d);
331  auto ct = Cabana::slice<PtlSlice::Ct>(particles_d);
332  auto gid = Cabana::slice<PtlSlice::Gid>(particles_d);
333 #ifdef ESC_PTL
334  auto flag = Cabana::slice<PtlSlice::Flag>(particles_d);
335 #endif
336 
337  Kokkos::parallel_for("set_buffer_particles_d", Kokkos::RangePolicy<ExSpace>( n_ptl, add_vec_buffer(n_ptl) ), KOKKOS_LAMBDA( const int i ){
338  // Buffer particles: same as last particle, gid = -1
339  for (int j=0;j<6;j++) ph(i, j) = ph(last_ptl_index, j);
340  for (int j=0;j<3;j++) ct(i, j) = ct(last_ptl_index, j);
341  gid(i) = -1;
342 #ifdef ESC_PTL
343  flag(i) = flag(last_ptl_index);
344 #endif
345  });
346  }
347  }
348 
357  if (n_ptl>0){
358  int last_ptl_index = n_ptl - 1;
359  auto ph = Cabana::slice<PtlSlice::Ph>(phase0_d);
360 
361  Kokkos::parallel_for("set_buffer_phase0", Kokkos::RangePolicy<ExSpace>( n_ptl, add_vec_buffer(n_ptl) ), KOKKOS_LAMBDA( const int i ){
362  // copy final real particle
363  for (int j=0;j<6;j++) ph(i, j) = ph(last_ptl_index, j);
364  });
365  }
366  }
367 
368  // Options for custom launch bounds since kokkos defaults are suboptimal for electron push kernel
369  enum class LaunchBounds{
370  Default,
371  Custom
372  };
373 
379  template<typename F>
380  inline void for_all_particles(const std::string label, F lambda_func) const {
381  Kokkos::RangePolicy<ExSpace> particle_range_policy( 0, p_range<DeviceType>(n_ptl) );
382  Kokkos::parallel_for(label, Opt::require(particle_range_policy, Async), lambda_func);
383  }
384 
392  template<typename F>
393  inline void for_all_particles(const std::string label, F lambda_func,
394  const PtlMvmt mvmt, LaunchBounds launch_bounds=LaunchBounds::Default) {
395  if(!owns_particles_d) exit_XGC("\nSpecies tried to loop over particles on device, but doesn't own the device array.");
396 
397  bool use_streaming = stream_particles;
398 #ifndef USE_STREAMS
399  use_streaming = false; // Just to be safe, turn streams off here
400 #endif
401 
402  bool send_ptl = ( mvmt.send_opt==PtlMvmt::Send ||
404  bool return_ptl = ( mvmt.return_opt==PtlMvmt::Return ||
406 
407  // Don't need to stream if particles are already present and don't need to be returned
408  if((!send_ptl) && (!return_ptl)) use_streaming = false;
409 
410  if(use_streaming){
411 #ifdef USE_STREAMS
412  Streamed::Option stream_option = Streamed::Normal; // Send to device and back
413  if(!send_ptl) stream_option = Streamed::NoSend;
414  if(!return_ptl) stream_option = Streamed::NoReturn;
415 
416  // Execute streaming parallel_for
417  Streamed::parallel_for(label, n_ptl, lambda_func, stream_option, particles, particles_d);
418 #endif
419  }else{
420  if(send_ptl) TIMER("copy_ptl_to_device",copy_particles_to_device() );
421 
422  if (launch_bounds==LaunchBounds::Custom) {
423 #ifdef USE_EPUSH_LAUNCH_BOUNDS
424 # if !defined(PUSH_MAX_THREADS_PER_BLOCK) || !defined(PUSH_MIN_WARPS_PER_EU)
425 # error "USE_EPUSH_LAUNCH_BOUNDS requires PUSH_MAX_THREADS_PER_BLOCK and PUSH_MIN_WARPS_PER_EU to be defined"
426 # endif
427  Kokkos::RangePolicy<ExSpace, Kokkos::LaunchBounds<PUSH_MAX_THREADS_PER_BLOCK, PUSH_MIN_WARPS_PER_EU>>
428  particle_range_policy( 0, p_range<DeviceType>(n_ptl) );
429  Kokkos::parallel_for(label, Opt::require(particle_range_policy, Async), lambda_func);
430 #else
431  exit_XGC("\nERROR: LaunchBounds::Custom specified, but USE_EPUSH_LAUNCH_BOUNDS is not defined\n");
432 #endif
433  } else {
434  Kokkos::RangePolicy<ExSpace>
435  particle_range_policy( 0, p_range<DeviceType>(n_ptl) );
436  Kokkos::parallel_for(label, Opt::require(particle_range_policy, Async), lambda_func);
437  }
438 
439  if(return_ptl) TIMER("copy_ptl_from_device", copy_particles_from_device() );
440  }
441  }
442 
443  KOKKOS_INLINE_FUNCTION VecParticles* ptl() const{
444  return (VecParticles*)(&particles_d.access(0));
445  }
446 
447  KOKKOS_INLINE_FUNCTION VecPhase* ph0() const{
448  return (VecPhase*)(&phase0_d.access(0));
449  }
450 
452  for_all_particles("copy_to_phase0", KOKKOS_LAMBDA( const int idx ){
453  AoSoAIndices<DeviceType> inds(idx);
454  VecParticles* ptl_loc = species.ptl();
455  VecPhase* ph0_loc = species.ph0();
456  for (int i_simd = 0; i_simd<SIMD_SIZE; i_simd++){
457  int p_vec = inds.a + i_simd;
458  ph0_loc[inds.s].r[p_vec] = ptl_loc[inds.s].ph.r[p_vec];
459  ph0_loc[inds.s].z[p_vec] = ptl_loc[inds.s].ph.z[p_vec];
460  ph0_loc[inds.s].phi[p_vec] = ptl_loc[inds.s].ph.phi[p_vec];
461  ph0_loc[inds.s].rho[p_vec] = ptl_loc[inds.s].ph.rho[p_vec];
462  ph0_loc[inds.s].w1[p_vec] = ptl_loc[inds.s].ph.w1[p_vec];
463  ph0_loc[inds.s].w2[p_vec] = ptl_loc[inds.s].ph.w2[p_vec];
464  }
465  });
466  }
467 
470  // If particles are resident on the device, then use the host particle allocation as the backup
471  // Otherwise, resize the backup_particle array
474  }else{
475  backup_particles.resize(particles_d.size());
476  }
477 
478  // Copy particle data to backup
479  Cabana::deep_copy(backup_particles, particles_d);
481  } else {
482  // For ions, save phase to phase0
483  phase0_d.resize(particles_d.size());
484  copy_to_phase0(*this); // Separate function to avoid implicit copy into lambda
485  }
487  }
488 
491  // If particles are resident on device, don't need to resize host particles since they are already used as the backup.
492  // If not, resize host particle array to fit backup particles
496  }else{
497  // If particles are not resident on device, resize host particle array to fit backup particles
499  }
500 
501  // Resize device particle array to fit backed up particles
503 
504  // Restore particle data from backup
505  Cabana::deep_copy(particles_d, backup_particles);
506 
508  // If the backup particles are simply pointing to the host particles, then
509  // point them to their own 0-sized allocation when finished using them
510  // so that they don't make a copy when host particles get resized
511  backup_particles = Cabana::AoSoA<ParticleDataTypes,HostType,VEC_LEN>("backup_particles", 0);
512  }
513  } else {
514  // When ipc==2, copy phase0 to device
515  // First, resize device phase0 and reset pointer
516  phase0_d.resize(phase0.size());
517 
518  // Next copy data to phase0 on device
519  Cabana::deep_copy(phase0_d, phase0);
520 
521  // Fill buffer with realistic ptl data
523  }
524  particles_are_backed_up = false;
525  }
526 
527  KOKKOS_INLINE_FUNCTION void restore_phase_from_phase0(const AoSoAIndices<Device>& inds, SimdParticles& part_one) const {
528  VecPhase* ph0_loc = ph0();
529  for (int i_simd = 0; i_simd<SIMD_SIZE; i_simd++){
530  int p_vec = inds.a + i_simd;
531  part_one.ph.r[i_simd] = ph0_loc[inds.s].r[p_vec];
532  part_one.ph.z[i_simd] = ph0_loc[inds.s].z[p_vec];
533  part_one.ph.phi[i_simd] = ph0_loc[inds.s].phi[p_vec];
534  part_one.ph.rho[i_simd] = ph0_loc[inds.s].rho[p_vec];
535  part_one.ph.w1[i_simd] = ph0_loc[inds.s].w1[p_vec];
536  part_one.ph.w2[i_simd] = ph0_loc[inds.s].w2[p_vec];
537  }
538  }
539 };
540 
541 #include "species.tpp"
542 #endif
Cabana::AoSoA< PhaseDataTypes, HostType, VEC_LEN > phase0
Definition: species.hpp:102
bool stream_particles
Whether to stream particles between host and device if possible.
Definition: species.hpp:94
Definition: globals.hpp:77
KOKKOS_INLINE_FUNCTION VecPhase * ph0() const
Definition: species.hpp:447
KOKKOS_INLINE_FUNCTION int divide_and_round_up(int a, int b)
Definition: globals.hpp:126
bool owns_particles_d
Whether the species owns the device particle allocation right now.
Definition: species.hpp:91
void set_spall_num_and_ptr(int idx, int n_ptl, int n_vecs, VecParticles *ptl)
Distribution< Device > f0
Species distribution in velocity space on local mesh nodes.
Definition: species.hpp:110
Cabana::AoSoA< ParticleDataTypes, HostType, VEC_LEN > backup_particles
Copy of particles to be restored for RK2.
Definition: species.hpp:106
bool is_electron
Whether this species is the electrons.
Definition: species.hpp:70
void for_all_particles(const std::string label, F lambda_func, const PtlMvmt mvmt, LaunchBounds launch_bounds=LaunchBounds::Default)
Definition: species.hpp:393
void save_backup_particles()
Definition: species.hpp:468
double c2_2m
c2/2m
Definition: species.hpp:78
double rho[VEC_LEN]
Definition: particles.hpp:72
void copy_to_phase0(Species< Device > &species)
Definition: species.hpp:451
Definition: species.hpp:35
Definition: species.hpp:49
Simd< double > w1
Definition: particles.hpp:22
double c_m
c/m
Definition: species.hpp:77
Definition: species.hpp:48
bool default_streaming_option()
Definition: species.hpp:19
Eq::Profile< Device > eq_den
Definition: species.hpp:113
Definition: globals.hpp:82
KOKKOS_INLINE_FUNCTION VecParticles * ptl() const
Definition: species.hpp:443
Definition: NamelistReader.hpp:163
KinType kintype
Whether the species is gyrokinetic or drift kinetic.
Definition: species.hpp:73
int add_vec_buffer(int n_ptl)
Definition: particles.hpp:164
int idx
Index in all_species.
Definition: species.hpp:69
Definition: particles.hpp:68
int a
The index in the inner array of the AoSoA.
Definition: particles.hpp:120
Definition: particles.hpp:85
Definition: species.hpp:35
bool particles_are_backed_up
Whether particles are currently backed up.
Definition: species.hpp:99
int nonadiabatic_idx
Index of species skipping adiabatic species (for compatibility with fortran arrays) ...
Definition: species.hpp:72
bool default_residence_option()
Definition: species.hpp:26
int n_ptl
Number of particles.
Definition: species.hpp:85
Definition: streamed_parallel_for.hpp:16
Definition: streamed_parallel_for.hpp:14
void set_buffer_phase0_d()
Definition: species.hpp:356
void set_buffer_particles_d()
Definition: species.hpp:327
Simd< double > rho
Definition: particles.hpp:21
Definition: species.hpp:50
int p_range< DeviceType >(int num_particle)
Definition: particles.hpp:157
double charge_eu
Particle charge in eu.
Definition: species.hpp:76
Definition: species.hpp:42
void resize_particles(int new_n_ptl)
Definition: species.hpp:202
double mass
Particle mass.
Definition: species.hpp:74
Species(int idx_in, int nonadiabatic_idx_in, bool is_electron_in, bool is_adiabatic_in, KinType kintype_in, double mass_in, double charge_in, double charge_eu_in, bool is_deltaf_in, int ncycles_in)
Definition: species.tpp:23
void for_all_particles(const std::string label, F lambda_func) const
Definition: species.hpp:380
Cabana::AoSoA< ParticleDataTypes, Device, VEC_LEN > particles_d
Particles on device.
Definition: species.hpp:89
Definition: species.hpp:39
double w2[VEC_LEN]
Definition: particles.hpp:74
#define TIMER(N, F)
Definition: timer_macro.hpp:19
RKRestorationMethod
Definition: species.hpp:59
idx
Definition: diag_f0_df_port1.hpp:32
void copy_particles_to_device_if_not_resident()
Definition: species.hpp:310
RKRestorationMethod RK_restoration_method
Currently, electrons must use first method and ions must use second.
Definition: species.hpp:97
Simd< double > r
Definition: particles.hpp:18
void resize_host_particles_to_match_device()
Definition: species.hpp:221
Definition: species.hpp:60
ReturnOpt return_opt
Definition: species.hpp:54
ReturnOpt
Definition: species.hpp:47
Option
Definition: streamed_parallel_for.hpp:13
void restore_particles_from_backup()
Definition: species.hpp:489
Definition: globals.hpp:83
SendOpt send_opt
Definition: species.hpp:53
double charge
Particle charge.
Definition: species.hpp:75
SimdPhase ph
Definition: particles.hpp:59
void copy_particles_from_device()
Definition: species.hpp:285
void copy_particles_from_device_if_not_resident()
Definition: species.hpp:316
void unassign_host_particles()
Definition: species.hpp:237
int ncycles_between_sorts
Number of subcycles between sorts.
Definition: species.hpp:83
Definition: particles.hpp:58
Cabana::AoSoA< PhaseDataTypes, Device, VEC_LEN > phase0_d
Definition: species.hpp:103
int SML_COMM_RANK
Definition: my_mpi.cpp:5
KinType
Definition: globals.hpp:81
Species(SpeciesType sp_type, int n_ptl)
Definition: species.hpp:122
bool is_deltaf
Whether this species is deltaf.
Definition: species.hpp:80
VecPhase ph
Definition: particles.hpp:86
Definition: species.hpp:61
constexpr double PROTON_MASS
Definition: globals.hpp:121
int s
The index in the outer array of the AoSoA.
Definition: particles.hpp:119
Simd< double > z
Definition: particles.hpp:19
void copy_particles_to_device_if_resident()
Definition: species.hpp:298
Definition: species.hpp:43
void resize_device_particles(int new_n_ptl)
Definition: species.hpp:257
Definition: species.hpp:44
void exit_XGC(std::string msg)
Definition: globals.hpp:36
void copy_particles_from_device_if_resident()
Definition: species.hpp:304
bool is_adiabatic
Whether this species is adiabatic.
Definition: species.hpp:71
Simd< double > phi
Definition: particles.hpp:20
static constexpr const Kokkos::Experimental::WorkItemProperty::HintLightWeight_t Async
Definition: space_settings.hpp:74
int n_backup_particles
Definition: species.hpp:107
Eq::Profile< Device > eq_flow
Definition: species.hpp:114
Definition: streamed_parallel_for.hpp:15
SendOpt
Definition: species.hpp:41
void copy_particles_to_device()
Definition: species.hpp:269
KOKKOS_INLINE_FUNCTION void restore_phase_from_phase0(const AoSoAIndices< Device > &inds, SimdParticles &part_one) const
Definition: species.hpp:527
Species(int n_ptl_in)
Definition: species.hpp:153
double phi[VEC_LEN]
Definition: particles.hpp:71
Simd< double > w2
Definition: particles.hpp:23
double r[VEC_LEN]
Definition: particles.hpp:69
Definition: species.hpp:66
void parallel_for(const std::string name, int n_ptl, Function func, Option option, HostAoSoA aosoa_h, DeviceAoSoA aosoa_d)
Definition: streamed_parallel_for.hpp:250
Definition: species.hpp:35
Eq::Profile< Device > eq_temp
Definition: species.hpp:112
bool particles_resident_on_device
Whether the particles can reside on device.
Definition: species.hpp:93
PtlMvmt(SendOpt send_opt, ReturnOpt return_opt)
Definition: species.hpp:56
int ncycles
Number of subcycles.
Definition: species.hpp:82
Definition: profile.hpp:65
Definition: particles.hpp:118
SpeciesType
Definition: globals.hpp:76
double z[VEC_LEN]
Definition: particles.hpp:70
constexpr double UNIT_CHARGE
Charge of an electron (C)
Definition: globals.hpp:118
Definition: distribution.hpp:15
void resize_device_particles()
Definition: species.hpp:243
LaunchBounds
Definition: species.hpp:369
Cabana::AoSoA< ParticleDataTypes, HostType, VEC_LEN > particles
Particles.
Definition: species.hpp:86
double w1[VEC_LEN]
Definition: particles.hpp:73