BioCMAMC-ST
move_kernel.hpp
1#ifndef __SIMULATION_MOVE_KERNEL_HPP__
2#define __SIMULATION_MOVE_KERNEL_HPP__
3
4#include <Kokkos_Assert.hpp>
5#include <Kokkos_Core.hpp>
6#include <Kokkos_Printf.hpp>
7#include <Kokkos_Random.hpp>
8#include <biocma_cst_config.hpp>
9#include <cassert>
10#include <common/common.hpp>
11#include <mc/alias.hpp>
12#include <mc/domain.hpp>
13#include <mc/events.hpp>
14#include <mc/prng/prng.hpp>
15#include <mc/traits.hpp>
16#include <simulation/probability_leaving.hpp>
17#include <simulation/probe.hpp>
18#include <utility>
19
21{
22 constexpr bool enable_leave = true;
23 constexpr bool disable_leave = false;
24 constexpr bool disable_move = false;
25 constexpr bool enable_move = true;
26
27 template <class ExecutionSpace,
28 class ViewType,
29 class RandomPool,
30 class IndexType = int64_t,
31 const std::size_t CHUNK_SIZE>
32 void
33 fill_random(const ExecutionSpace& exec,
34 ViewType a,
35 RandomPool g,
36 typename ViewType::const_value_type begin,
37 typename ViewType::const_value_type end)
38 {
39 int64_t LDA = a.extent(0);
40
41 if (LDA > 0)
42 {
43 Kokkos::parallel_for(
44 "Kokkos::fill_random",
45 Kokkos::RangePolicy<ExecutionSpace>(
46 exec, 0, (LDA + (CHUNK_SIZE - 1)) / CHUNK_SIZE),
47 Kokkos::Impl::fill_random_functor_begin_end<ViewType,
48 RandomPool,
49 CHUNK_SIZE,
50 ViewType::rank,
51 IndexType>(
52 a, g, begin, end));
53 }
54 }
55
61 KOKKOS_INLINE_FUNCTION std::size_t
63 const bool do_serch,
66 cumulative_probability,
67 const std::size_t i_compartment,
68 const double random_number)
69 {
70 const int mask_do_serch = static_cast<int>(do_serch);
71 const int max_neighbor = static_cast<int>(neighbors.extent(1));
72
73 KOKKOS_ASSERT(max_neighbor >= 1);
74 KOKKOS_ASSERT(random_number <= 1. && random_number >= 0.);
75 KOKKOS_ASSERT(neighbors.extent(1) == cumulative_probability.extent(1));
76
77 // Do not use cumulative_probability(i_compartment, max_neighbor - 1)==1
78 // Bcause proba can be 0.999999999
79 // KOKKOS_ASSERT(cumulative_probability(i_compartment, max_neighbor -
80 // 1)>0.95); //5% relative
81
82 // v1.1: This assert was there to be sure that the particle will leave but
83 // actually
84 // not needed because if rand< then left will be the last at the the ned of
85 // the loop
86 // KOKKOS_ASSERT(cumulative_probability(i_compartment, max_neighbor - 1)
87 // >= random_number);
88
89 int left = 0;
90 int right = mask_do_serch * (max_neighbor - 1);
91 while (left < right)
92 {
93 const int mid = (left + right) >> 1; // NOLINT
94 const auto pm = cumulative_probability(i_compartment, mid);
95 const int mask = static_cast<int>(random_number > pm);
96 left = mask * (mid + 1) + (1 - mask) * left;
97 right = mask * right + (1 - mask) * mid;
98 }
99 KOKKOS_ASSERT(left >= 0 && static_cast<size_t>(left) < neighbors.extent(1));
100 const auto ret = i_compartment * (1 - mask_do_serch)
101 + neighbors(i_compartment, left) * mask_do_serch;
102 return ret;
103 }
104 struct TagRNG
105 {
106 };
107 struct TagMove
108 {
109 };
110 struct TagLeave
111 {
112 };
113
115 {
116 using TeamPolicy = Kokkos::TeamPolicy<ComputeSpace>;
117 using TeamMember = TeamPolicy::member_type;
118 MoveFunctor() = default;
119 MoveFunctor(std::size_t p_team_move,
120 std::size_t p_team_leave,
122 MC::ParticleStatus _status,
124 MC::pool_type _random_pool,
125 MC::EventContainer _events,
127 MC::ParticleAges _ages)
128 : MoveFunctor(p_team_move,
129 p_team_leave,
130 0,
131 std::move(p),
132 std::move(_status),
133 0,
134 std::move(m),
135 std::move(_random_pool),
136 std::move(_events),
137 std::move(_probes),
138 std::move(_ages),
139 false,
140 false) {};
141
142 MoveFunctor(std::size_t p_team_move,
143 std::size_t p_team_leave,
144 double _d_t,
146 MC::ParticleStatus _status,
147 std::size_t n_p,
149 MC::pool_type _random_pool,
150 MC::EventContainer _events,
152 MC::ParticleAges _ages,
153 bool b_move,
154 bool b_leave)
155 : d_t(_d_t), positions(std::move(p)), n_particles(n_p),
156 move(std::move(m)), random_pool(_random_pool), // NOLINT
157 status(std::move(_status)), events(std::move(_events)),
158 probes(std::move(_probes)), ages(std::move(_ages)),
159 m_p_team_leave(p_team_leave), m_p_team_move(p_team_move),
160 enable_move(b_move), enable_leave(b_leave) {};
161
162 void
163 update(double _d_t,
164 std::size_t n_p,
166 MC::ParticlePositions _positions,
167 MC::ParticleStatus _status,
168 MC::ParticleAges _ages,
169 bool b_move,
170 bool b_leave)
171 {
172
173 this->d_t = _d_t;
174 this->n_particles = n_p;
175 this->enable_leave = b_leave;
176 this->enable_move = b_move;
177 this->move = std::move(move_i);
178
179 this->positions = std::move(_positions);
180 this->status = std::move(_status);
181 this->ages = std::move(_ages);
182 }
183
184 KOKKOS_INLINE_FUNCTION void
186 const Kokkos::TeamPolicy<ComputeSpace>::member_type& team) const
187 {
188 using ScratchSpace
189 = Kokkos::TeamPolicy<>::execution_space::scratch_memory_space;
190 using ScratchView = Kokkos::View<float*, ScratchSpace>;
191
192 const std::size_t count = m_p_team_move;
193 const std::size_t p0 = team.league_rank() * count;
194 const std::size_t n_particle = n_particles;
195
196 const auto upper_bound
197 = ((p0 + count) >= n_particle) ? n_particle - p0 : count;
198 KOKKOS_ASSERT(upper_bound > 0 && upper_bound < n_particle);
199 const auto& rp = random_pool;
200
201 const std::size_t N = count * 2;
202
203 // rng is actually a flat m*p array
204 const std::size_t p = team.team_size();
205 const std::size_t m = (N + p - 1) / p;
206
207 ScratchView rng(team.team_scratch(0), N);
208
209 // Use "tiling" to minimize contention when aquired_state
210 // State is aquired m times instead of N, it is supposed to reduce
211 // contention
212 Kokkos::parallel_for(Kokkos::TeamThreadRange(team, 0, m),
213 [&rp, &rng, p, N](const std::size_t idx)
214 {
215 // Ok to use here, get_state should be called in
216 // each thread
217 auto gen = rp.get_state();
218
219 const std::size_t base = idx * p;
220 // current thread iteration p times with the same
221 // state
222 for (std::size_t k = 0; k < p; ++k)
223 {
224 const std::size_t i = base + k;
225 if (i >= N)
226 {
227 break;
228 }
229
230 rng(i) = gen.frand(0., 1.);
231 }
232
233 rp.free_state(gen);
234 });
235 team.team_barrier();
236
237 // We can use flat array index here ordering of random doesnt matter
238 Kokkos::parallel_for(Kokkos::TeamThreadRange(team, 0, upper_bound),
239 [&](const std::size_t idx)
240 {
241 const auto flat_index = p0 + idx;
242 const std::size_t base = idx * 2;
243 KOKKOS_ASSERT(base + 1 < N);
244 const auto rng1 = rng(base);
245 const auto rng2 = rng(base + 1);
246 handle_move(flat_index, rng1, rng2);
247 });
248 }
249
250 // KOKKOS_INLINE_FUNCTION void
251 // operator()(TagLeave _tag,
252 // const TeamMember& team,
253 // std::size_t& local_dead_count) const
254 // {
255 // (void)_tag;
256 // const std::size_t count = m_p_team_leave;
257 // const std::size_t p0 = team.league_rank() * count;
258 // const std::size_t n_particle = n_particles;
259 // const auto _d_t = static_cast<float>(d_t);
260
261 // const auto upper_bound
262 // = ((p0 + count) >= n_particle) ? n_particle - p0 : count;
263 // KOKKOS_ASSERT(upper_bound > 0 && upper_bound < n_particle);
264
265 // const std::size_t n_flow = move.leaving_flow.extent(0);
266
267 // using ScratchSpace = TeamPolicy::execution_space::scratch_memory_space;
268 // using ScratchView = Kokkos::View<MC::LeavingFlow*, ScratchSpace>;
269 // const auto leaving_flow = ScratchView(team.team_scratch(0), n_flow);
270
271 // // Kokkos::parallel_for(Kokkos::TeamVectorRange(team, n_flow),
272 // // [&](const std::size_t j)
273 // // { leaving_flow(j) = move.leaving_flow(j); });
274
275 // Kokkos::single(Kokkos::PerTeam(team),
276 // [&]()
277 // {
278 // for (std::size_t j = 0; j < n_flow; ++j)
279 // {
280 // leaving_flow(j) = move.leaving_flow(j);
281 // }
282 // });
283
284 // team.team_barrier();
285
286 // std::size_t t_local = 0;
287 // Kokkos::parallel_reduce(
288 // Kokkos::TeamThreadRange(team, 0, upper_bound),
289 // [&](const std::size_t relative_index,
290 // std::size_t& thread_local_dead_count)
291 // {
292 // const std::size_t flatten_index = p0 + relative_index;
293 // if (status(flatten_index) == MC::Status::Idle)
294 // {
295 // ages(flatten_index, 0) += _d_t;
296 // handle_exit<ScratchSpace>(
297 // flatten_index, leaving_flow, thread_local_dead_count);
298 // }
299 // },
300 // t_local);
301
302 // team.team_barrier();
303
304 // Kokkos::single(Kokkos::PerTeam(team),
305 // [&]()
306 // {
307 // Kokkos::single(Kokkos::PerThread(team),
308 // [&]() { local_dead_count += t_local;
309 // });
310 // });
311 // // Kokkos::single(Kokkos::PerTeam(team),
312 // // [&]()
313 // // {
314 // // Kokkos::single(Kokkos::PerThread(team),
315 // // [&]() {
316 // // local_dead_count
317 // // += t_local;
318 // // });
319 // // });
320 // }
321
322 KOKKOS_INLINE_FUNCTION void
323 operator()([[maybe_unused]] TagLeave _tag,
324 const std::size_t& idx,
325 std::size_t& local_dead_count) const
326 {
327 if (status(idx) != MC::Status::Idle) [[unlikely]]
328 {
329 return;
330 }
331
332 ages(idx, 0) += d_t;
333 handle_exit(idx, move.leaving_flow, local_dead_count);
334 }
335
336 // KOKKOS_INLINE_FUNCTION void
337 // operator()(TagLeave _tag,
338 // const Kokkos::TeamPolicy<ComputeSpace>::member_type&
339 // team_handle, std::size_t& local_dead_count) const
340 // {
341 // (void)_tag;
342 // const std::size_t league_size = team_handle.league_size();
343 // const std::size_t league_rank = team_handle.league_rank();
344 // const std::size_t start_idx = league_rank * (n_particles /
345 // league_size); std::size_t end_idx = (league_rank + 1) * (n_particles /
346 // league_size);
347
348 // if (league_rank == (league_size - 1))
349 // {
350 // end_idx = n_particles;
351 // }
352 // Kokkos::parallel_for(
353 // Kokkos::TeamThreadRange(team_handle, start_idx, end_idx),
354 // [&](int idx)
355 // {
356 // ages(idx, 0) += d_t;
357 // handle_exit(idx, local_dead_count);
358 // });
359 // }
360
361 [[nodiscard]] bool
363 {
364 return enable_leave || enable_move;
365 }
366
367 KOKKOS_FUNCTION void
368 handle_move(const std::size_t idx, const float rng1, const float rng2) const
369 {
370
371 // const auto rng1 = static_cast<float>(random(idx, 0));
372 // const auto rng2 = static_cast<float>(random(idx, 1));
373
374 KOKKOS_ASSERT(rng1 >= 0. && rng1 <= 1 && rng2 >= 0. && rng2 <= 1);
375
376 const std::size_t i_current_compartment = positions(idx);
377
378 KOKKOS_ASSERT(
379 i_current_compartment < move.liquid_volume.extent(0)
380 && "Particle position is incorect (greater than compartment number)");
381
382 const bool mask_next = probability_leaving<fast_tag>(
383 rng1,
384 move.liquid_volume(i_current_compartment),
385 move.diag_transition(i_current_compartment),
386 d_t);
387
388 positions(idx) = __find_next_compartment(mask_next,
389 move.neighbors,
390 move.cumulative_probability,
391 i_current_compartment,
392 rng2);
393
394 // positions(idx)
395 // = (mask_next) ? __find_next_compartment(move.neighbors,
396 // move.cumulative_probability,
397 // i_current_compartment,
398 // rng2)
399 // : i_current_compartment;
400
401 KOKKOS_ASSERT(
402 positions(idx) < move.liquid_volume.extent(0)
403 && " Position after move is greater than compartment number");
404
405 if constexpr (AutoGenerated::FlagCompileTime::enable_event_counter)
406 {
407 if (mask_next)
408 {
409 events.wrap_incr<MC::EventType::Move>();
410 }
411 }
412 }
413
414 // KOKKOS_INLINE_FUNCTION void
415 // inner_handle_exit(const std::size_t i_flow,
416 // const std::size_t idx,
417 // const double liquid_volume,
418 // const std::size_t position,
419 // const MC::LeavingFlowView<true>& leaving_flow,
420 // std ::size_t& dead_count) const
421 // {
422 // // FIXME : when move AND exit, take the same random number,
423 // // is it really important ?
424 // const auto random_number = static_cast<float>(random(idx, 2));
425 // const auto& [index, flow] = leaving_flow(i_flow);
426
427 // const bool is_leaving = (position == index)
428 // && probability_leaving<void>(
429 // random_number, liquid_volume, flow, d_t);
430
431 // const int leave_mask = static_cast<int>(is_leaving);
432
433 // // If using probes
434 // if constexpr (AutoGenerated::FlagCompileTime::use_probe)
435 // {
436 // // Execute probe set, but only actually do something if leaving
437 // if (is_leaving)
438 // {
439 // const auto _ = probes.set(ages(idx, 0));
440 // }
441 // }
442 // if constexpr (AutoGenerated::FlagCompileTime::enable_event_counter)
443 // {
444
445 // events.add<MC::EventType::Exit>(leave_mask);
446 // }
447
448 // dead_count += leave_mask;
449 // ages(idx, 0) = (1 - leave_mask) * ages(idx, 0) /*leave_mask * 0 + */;
450 // status(idx) = is_leaving ? MC::Status::Exit : status(idx);
451 // }
452
453 // KOKKOS_FORCEINLINE_FUNCTION void
454 // handle_exit(std::size_t idx,
455 // const MC::VolumeView<ComputeSpace, true>& liquid_volumes,
456 // std::size_t& dead_count) const
457 // {
458 // const auto position = positions(idx);
459 // const auto liquid_volume = liquid_volumes(position);
460 // const MC::LeavingFlowView<true>& leaving_flow = move.leaving_flow;
461 // const std::size_t n_flow = leaving_flow.size();
462 // for (std::size_t i_flow = 0LU; i_flow < n_flow; ++i_flow)
463 // {
464 // inner_handle_exit(
465 // i_flow, idx, liquid_volume, position, leaving_flow, dead_count);
466 // }
467 // }
468
469 // KOKKOS_FORCEINLINE_FUNCTION void
470 // handle_exit(std::size_t idx,
471 // const MC::VolumeView<ComputeSpace, true>& liquid_volumes,
472 // std::size_t& dead_count) const
473 // {
474 // const std::size_t position = positions(idx);
475 // const double liquid_volume = liquid_volumes(position);
476 // const MC::LeavingFlowView<true>& leaving_flow = move.leaving_flow;
477 // const std::size_t n_flow = leaving_flow.size();
478
479 // // Strategy: most of the time there is only one flow (0d reactor or
480 // // uniquement leaving point)
481 // // Then the first flow is out of the loop
482 // // For the first leaving flow use precomputed index_random_leave
483 // // If the particle position is correct probability to leave is high
484 // // then pregenerated only one number and get random on the fly in the
485 // // loop if needed
486
487 // // One improvement is to use rng1 as long as as the we do consume it
488 // // If first ok_p is false, rng1 is then not used
489 // // This needs a branch ?
490
491 // auto rng1 = static_cast<float>(random(idx, index_random_leave));
492
493 // const auto& [index, flow] = leaving_flow(0);
494 // const bool p
495 // = probability_leaving<precision_tag>(rng1, liquid_volume, flow,
496 // d_t);
497 // const bool ok_p = position == index;
498 // const int m = static_cast<int>(ok_p) * static_cast<int>(p);
499 // int leave_mask = m;
500
501 // for (std::size_t i_flow = 1; i_flow < n_flow; ++i_flow)
502 // {
503 // if (leave_mask != 0)
504 // {
505 // break;
506 // }
507 // const auto& [index, flow] = leaving_flow(i_flow);
508 // const bool ok_p = position == index;
509 // if (!ok_p)
510 // {
511 // continue;
512 // }
513
514 // // if (!ok_p || leave_mask != 0)
515 // // {
516 // // continue;
517 // // }
518 // auto gen = random_pool.get_state();
519 // rng1 = gen.frand(0, 1);
520 // random_pool.free_state(gen);
521
522 // const bool p = probability_leaving<precision_tag>(
523 // rng1, liquid_volume, flow, d_t);
524
525 // const int m = static_cast<int>(ok_p) * static_cast<int>(p);
526 // leave_mask |= m;
527 // }
528
529 // dead_count += leave_mask;
530
531 // // DO this betore age set to 0
532 // if constexpr (AutoGenerated::FlagCompileTime::use_probe)
533 // {
534 // // Execute probe set, but only actually do something if leaving
535 // if (leave_mask != 0)
536 // {
537 // // const auto _ = probes.template set<(ages(idx, 0));
538 // }
539 // }
540
541 // ages(idx, 0) *= (1 - leave_mask);
542
543 // // status(idx) = (leave_mask == 0) ? status(idx) : MC::Status::Exit;
544
545 // status(idx) = static_cast<MC::Status>(
546 // static_cast<int>(status(idx)) * (1 - leave_mask)
547 // + static_cast<int>(MC::Status::Exit) * leave_mask);
548
549 // if constexpr (AutoGenerated::FlagCompileTime::enable_event_counter)
550 // {
551 // events.add<MC::EventType::Exit>(leave_mask);
552 // }
553 // }
554 template <typename ExecSpace>
555 KOKKOS_FORCEINLINE_FUNCTION std::size_t
557 const std::size_t idx,
558 const Kokkos::View<const MC::LeavingFlow*, ExecSpace>& leaving_flow,
559 std::size_t& dead_count) const
560 {
561
562 using mem_space = ComputeSpace::memory_space;
563
564 const std::size_t position = positions(idx);
565 // const MC::LeavingFlowView<true>& leaving_flow = move.leaving_flow;
566 const std::size_t n_flow = leaving_flow.size();
567 // const auto rng1 = static_cast<float>(random(idx, index_random_leave));
568
569 // Strategy:
570 // first find the value of leaving flow (0-> particle doesn´t leave)
571 // do-while +early break is ok as n_flow is likely <10
572 // second: calculate probability leaving, flow=0 => p=0 theres no need to
573 // check condition
574 std::size_t i_flow = 0;
575 double val_flow = 0.;
576 double _liquid_volume = 0.;
577
578 // do-while because n_flow is likely to be 1
579 do
580 {
581 const auto& [index, flow, liquid_volume] = leaving_flow(i_flow++);
582 if (position == index)
583 {
584 val_flow = flow;
585 _liquid_volume = liquid_volume;
586 break;
587 }
588 } while (i_flow < n_flow);
589
590 int leave_mask = 0;
591 // Cases
592 // 0D: one flow and position always 0 then (val_flow != 0.) is always true
593 // 3D: only for few particles
594 //
595 if (val_flow != 0.)
596 {
597 auto gen = random_pool.get_state();
598 const auto rng1 = gen.frand(0., 1.);
599 random_pool.free_state(gen);
600
601 KOKKOS_ASSERT(_liquid_volume > 0.);
602 KOKKOS_ASSERT(val_flow > 0.);
604 rng1, _liquid_volume, val_flow, d_t);
605
606 leave_mask = static_cast<int>(p);
607 // DO this betore age is reset to 0
608 // if (p)
609 // {
610 dead_count += leave_mask;
611 // }
612 if constexpr (AutoGenerated::FlagCompileTime::use_probe)
613 {
614 if (leave_mask != 0)
615 {
616 const auto _ = probes.set<mem_space>(ages(idx, 0));
617 }
618 }
619 ages(idx, 0) *= (1 - leave_mask);
620 status(idx) = static_cast<MC::Status>(
621 static_cast<int>(status(idx)) * (1 - leave_mask)
622 + static_cast<int>(MC::Status::Exit) * leave_mask);
623
624 if constexpr (AutoGenerated::FlagCompileTime::enable_event_counter)
625 {
626 events.add<MC::EventType::Exit>(leave_mask);
627 }
628 }
629
630 return 0;
631 }
632
633 double d_t{};
635 std::size_t n_particles{};
642 std::size_t m_p_team_leave{};
643 std::size_t m_p_team_move{};
644
645 // Kokkos::View<float**, Kokkos::LayoutLeft> random;
646
649 };
650} // namespace Simulation::KernelInline
651
652#endif
std::conditional_t< is_const, Kokkos::View< const std::size_t **, Kokkos::LayoutRight, ExecSpace, Kokkos::MemoryTraits< Kokkos::RandomAccess > >, Kokkos::View< std::size_t **, Kokkos::LayoutRight, ExecSpace > > NeighborsView
Definition alias.hpp:206
Kokkos::View< Status *, ComputeSpace > ParticleStatus
Definition alias.hpp:141
Kokkos::View< uint64_t *, ComputeSpace > ParticlePositions
Definition alias.hpp:140
@ Move
Move in domain.
Definition events.hpp:21
@ Exit
Remove particle from list due to move in domain.
Definition events.hpp:20
Status
Definition alias.hpp:125
@ Idle
Definition alias.hpp:126
@ Exit
Definition alias.hpp:128
ParticleAgesBase< ComputeSpace > ParticleAges
Definition alias.hpp:144
gen_pool_type< Kokkos::DefaultExecutionSpace > pool_type
Definition alias.hpp:100
std::conditional_t< is_const, Kokkos::View< const double **, Kokkos::LayoutRight, ExecSpace, Kokkos::MemoryTraits< Kokkos::RandomAccess > >, Kokkos::View< double **, Kokkos::LayoutRight, ExecSpace > > CumulativeProbabilityView
Definition alias.hpp:197
Definition kernels.hpp:16
void fill_random(const ExecutionSpace &exec, ViewType a, RandomPool g, typename ViewType::const_value_type begin, typename ViewType::const_value_type end)
Definition move_kernel.hpp:33
constexpr bool enable_leave
Definition move_kernel.hpp:22
constexpr bool enable_move
Definition move_kernel.hpp:25
KOKKOS_INLINE_FUNCTION std::size_t __find_next_compartment(const bool do_serch, const MC::NeighborsView< ComputeSpace, true > &neighbors, const MC::CumulativeProbabilityView< ComputeSpace, true > &cumulative_probability, const std::size_t i_compartment, const double random_number)
probably overkill binary search to find next compartment
Definition move_kernel.hpp:62
constexpr bool disable_leave
Definition move_kernel.hpp:23
KOKKOS_INLINE_FUNCTION bool probability_leaving(float random_number, double volume, double flow, double dt)
Definition probability_leaving.hpp:18
KOKKOS_INLINE_FUNCTION bool probability_leaving< fast_tag >(float random_number, double volume, double flow, double dt)
Definition probability_leaving.hpp:35
constexpr bool disable_move
Definition move_kernel.hpp:24
Probes< AutoGenerated::probe_buffer_size > ProbeAutogeneratedBuffer
Definition probe.hpp:148
Structure to store information about domain needed during MC cycle data is likely to change between e...
Definition domain.hpp:28
Use to count events that occurs during Monte-Carlo processing cycles.
Definition events.hpp:150
MoveFunctor(std::size_t p_team_move, std::size_t p_team_leave, double _d_t, MC::ParticlePositions p, MC::ParticleStatus _status, std::size_t n_p, MC::DomainState< ComputeSpace > m, MC::pool_type _random_pool, MC::EventContainer _events, ProbeAutogeneratedBuffer _probes, MC::ParticleAges _ages, bool b_move, bool b_leave)
Definition move_kernel.hpp:142
KOKKOS_FUNCTION void handle_move(const std::size_t idx, const float rng1, const float rng2) const
Definition move_kernel.hpp:368
bool enable_leave
Definition move_kernel.hpp:648
KOKKOS_INLINE_FUNCTION void operator()(TagLeave _tag, const std::size_t &idx, std::size_t &local_dead_count) const
Definition move_kernel.hpp:323
MoveFunctor(std::size_t p_team_move, std::size_t p_team_leave, MC::ParticlePositions p, MC::ParticleStatus _status, MC::DomainState< ComputeSpace > m, MC::pool_type _random_pool, MC::EventContainer _events, ProbeAutogeneratedBuffer _probes, MC::ParticleAges _ages)
Definition move_kernel.hpp:119
bool need_launch() const
Definition move_kernel.hpp:362
Kokkos::TeamPolicy< ComputeSpace > TeamPolicy
Definition move_kernel.hpp:116
TeamPolicy::member_type TeamMember
Definition move_kernel.hpp:117
MC::ParticlePositions positions
Definition move_kernel.hpp:634
std::size_t m_p_team_move
Definition move_kernel.hpp:643
double d_t
Definition move_kernel.hpp:633
MC::DomainState< ComputeSpace, true > move
Definition move_kernel.hpp:636
KOKKOS_FORCEINLINE_FUNCTION std::size_t handle_exit(const std::size_t idx, const Kokkos::View< const MC::LeavingFlow *, ExecSpace > &leaving_flow, std::size_t &dead_count) const
Definition move_kernel.hpp:556
std::size_t n_particles
Definition move_kernel.hpp:635
MC::EventContainer events
Definition move_kernel.hpp:639
ProbeAutogeneratedBuffer probes
Definition move_kernel.hpp:640
void update(double _d_t, std::size_t n_p, MC::DomainState< ComputeSpace > move_i, MC::ParticlePositions _positions, MC::ParticleStatus _status, MC::ParticleAges _ages, bool b_move, bool b_leave)
Definition move_kernel.hpp:163
MC::ParticleStatus status
Definition move_kernel.hpp:638
KOKKOS_INLINE_FUNCTION void operator()(TagMove, const Kokkos::TeamPolicy< ComputeSpace >::member_type &team) const
Definition move_kernel.hpp:185
bool enable_move
Definition move_kernel.hpp:647
MC::ParticleAges ages
Definition move_kernel.hpp:641
std::size_t m_p_team_leave
Definition move_kernel.hpp:642
MC::pool_type random_pool
Definition move_kernel.hpp:637
Definition move_kernel.hpp:111
Definition move_kernel.hpp:108
Definition move_kernel.hpp:105