1#ifndef __MC_EVENTS_HPP__
2#define __MC_EVENTS_HPP__
4#include "biocma_cst_config.hpp"
5#include <Kokkos_Core.hpp>
6#include <Kokkos_Core_fwd.hpp>
7#include <common/execinfo.hpp>
34 template <EventType event>
35 KOKKOS_INLINE_FUNCTION
consteval size_t
38 return static_cast<size_t>(event);
156 Kokkos::View<std::size_t[number_event_type], Kokkos::SharedSpace>
170 [[nodiscard]] std::span<std::size_t>
181 KOKKOS_INLINE_FUNCTION
void
193 template <EventType event>
194 [[nodiscard]]
constexpr std::size_t
198 "Count is not a valid event");
209 template <EventType event>
210 KOKKOS_FORCEINLINE_FUNCTION
constexpr void
214 "Count is not a valid event");
218 template <EventType event>
219 KOKKOS_FORCEINLINE_FUNCTION
constexpr void
223 "Count is not a valid event");
227 template <EventType event>
228 KOKKOS_FORCEINLINE_FUNCTION
constexpr void
231 if constexpr (AutoGenerated::FlagCompileTime::enable_event_counter)
237 template <
class Archive>
241 std::array<std::size_t, number_event_type> array{};
245 std::copy(rd.begin(), rd.end(), array.begin());
246 assert(rd[0] ==
_events[0] && rd[0] == array[0]);
251 template <
class Archive>
256 std::array<std::size_t, number_event_type> array{};
261 std::copy(array.begin(), array.end(), rd.begin());
Namespace that contains classes and structures related to Monte Carlo (MC) simulations.
Definition alias.hpp:16
constexpr size_t number_event_type
Definition events.hpp:28
EventType
Enumeration that represents events that can occurs during a Monte-Carlo cycle.
Definition events.hpp:18
@ Overflow
Definition events.hpp:23
@ Death
Remove particle from list.
Definition events.hpp:22
@ Move
Move in domain.
Definition events.hpp:21
@ __COUNT__
Definition events.hpp:25
@ NewParticle
Spawn new particle.
Definition events.hpp:19
@ ChangeWeight
Update in weight.
Definition events.hpp:24
@ Exit
Definition alias.hpp:128
KOKKOS_INLINE_FUNCTION consteval size_t event_index()
inline getter, converts event to its value in order to be use as array index
Definition events.hpp:36
KOKKOS_FORCEINLINE_FUNCTION constexpr void wrap_incr() const
Definition events.hpp:229
std::span< std::size_t > get_span() const
Get std const view of _events counter.
Definition events.hpp:171
void save(Archive &ar) const
Definition events.hpp:239
constexpr std::size_t get() const
Getter to specific event counter.
Definition events.hpp:195
KOKKOS_FORCEINLINE_FUNCTION constexpr void incr() const
Increment specific event counter.
Definition events.hpp:211
EventContainer()
Default container, initalise counter.
Definition events.hpp:162
KOKKOS_INLINE_FUNCTION void clear() const
Reset counters.
Definition events.hpp:182
KOKKOS_FORCEINLINE_FUNCTION constexpr void add(size_t val) const
Definition events.hpp:220
Kokkos::View< std::size_t[number_event_type], Kokkos::SharedSpace > _events
Definition events.hpp:157
void load(Archive &ar)
Definition events.hpp:253