1#ifndef __MC_EVENTS_HPP__
2#define __MC_EVENTS_HPP__
4#include "biocma_cst_config.hpp"
5#include "impl/Kokkos_Profiling.hpp"
6#include <Kokkos_Core.hpp>
7#include <Kokkos_Core_fwd.hpp>
9#include <common/execinfo.hpp>
36 template <EventType event>
37 KOKKOS_INLINE_FUNCTION
consteval size_t
40 return static_cast<size_t>(event);
179 = Kokkos::View<std::size_t*, Kokkos::LayoutStride, Kokkos::SharedSpace>;
207 [[nodiscard]] std::array<std::size_t, number_event_type>
212 std::array<std::size_t, number_event_type> packed{};
223 KOKKOS_INLINE_FUNCTION
void
242 template <EventType event>
243 [[nodiscard]]
constexpr std::size_t
247 "Count is not a valid event");
257 template <EventType event>
258 [[nodiscard]]
constexpr std::size_t
262 "Count is not a valid event");
273 template <EventType event>
274 KOKKOS_FORCEINLINE_FUNCTION
constexpr void
278 "Count is not a valid event");
282 template <EventType event>
283 KOKKOS_FORCEINLINE_FUNCTION
constexpr void
284 add(
size_t val)
const
287 "Count is not a valid event");
291 template <EventType event>
292 KOKKOS_FORCEINLINE_FUNCTION
constexpr void
295 if constexpr (AutoGenerated::FlagCompileTime::enable_event_counter)
301 template <
class Archive>
303 save(Archive& ar)
const
305 const std::array<std::size_t, number_event_type> array =
get_span();
306 assert(array[0] ==
_events(0));
317 template <
class Archive>
322 std::array<std::size_t, number_event_type> array{};
331 assert(array[0] ==
_events(0));
Definition move_kernel.hpp:631
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:30
EventType
Enumeration that represents events that can occurs during a Monte-Carlo cycle.
Definition events.hpp:20
@ Overflow
Definition events.hpp:25
@ Death
Remove particle from list.
Definition events.hpp:24
@ Move
Move in domain.
Definition events.hpp:23
@ __COUNT__
Definition events.hpp:27
@ NewParticle
Spawn new particle.
Definition events.hpp:21
@ ChangeWeight
Update in weight.
Definition events.hpp:26
@ Exit
Definition alias.hpp:128
constexpr std::size_t event_stride
Number of std::size_t slots reserved per counter.
Definition events.hpp:57
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:38
KOKKOS_FORCEINLINE_FUNCTION constexpr void wrap_incr() const
Definition events.hpp:292
constexpr std::size_t get_cumulative() const
Getter to specific event counter.
Definition events.hpp:258
void save(Archive &ar) const
Definition events.hpp:302
constexpr std::size_t get() const
Getter to specific event counter.
Definition events.hpp:243
KOKKOS_FORCEINLINE_FUNCTION constexpr void incr() const
Increment specific event counter.
Definition events.hpp:274
EventContainer()
Default container, initalise counter.
Definition events.hpp:190
event_view_type _events
Definition events.hpp:180
KOKKOS_INLINE_FUNCTION void clear() const
Reset counters.
Definition events.hpp:223
KOKKOS_FORCEINLINE_FUNCTION constexpr void add(size_t val) const
Definition events.hpp:283
void load(Archive &ar)
Definition events.hpp:318
Kokkos::View< std::size_t *, Kokkos::LayoutStride, Kokkos::SharedSpace > event_view_type
Definition events.hpp:178
std::array< std::size_t, number_event_type > get_span() const
Get a packed copy of the event counters.
Definition events.hpp:207