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>
8#include <common/execinfo.hpp>
35 template <EventType event>
36 KOKKOS_INLINE_FUNCTION
consteval size_t
39 return static_cast<size_t>(event);
157 Kokkos::View<std::size_t[number_event_type], Kokkos::SharedSpace>
179 [[nodiscard]] std::span<std::size_t>
190 KOKKOS_INLINE_FUNCTION
void
209 template <EventType event>
210 [[nodiscard]]
constexpr std::size_t
214 "Count is not a valid event");
224 template <EventType event>
225 [[nodiscard]]
constexpr std::size_t
229 "Count is not a valid event");
240 template <EventType event>
241 KOKKOS_FORCEINLINE_FUNCTION
constexpr void
245 "Count is not a valid event");
249 template <EventType event>
250 KOKKOS_FORCEINLINE_FUNCTION
constexpr void
254 "Count is not a valid event");
258 template <EventType event>
259 KOKKOS_FORCEINLINE_FUNCTION
constexpr void
262 if constexpr (AutoGenerated::FlagCompileTime::enable_event_counter)
268 template <
class Archive>
272 std::array<std::size_t, number_event_type> array{};
275 std::copy(rd.begin(), rd.end(), array.begin());
276 assert(rd[0] ==
_events[0] && rd[0] == array[0]);
287 template <
class Archive>
292 std::array<std::size_t, number_event_type> array{};
298 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:29
EventType
Enumeration that represents events that can occurs during a Monte-Carlo cycle.
Definition events.hpp:19
@ Overflow
Definition events.hpp:24
@ Death
Remove particle from list.
Definition events.hpp:23
@ Move
Move in domain.
Definition events.hpp:22
@ __COUNT__
Definition events.hpp:26
@ NewParticle
Spawn new particle.
Definition events.hpp:20
@ ChangeWeight
Update in weight.
Definition events.hpp:25
@ 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:37
KOKKOS_FORCEINLINE_FUNCTION constexpr void wrap_incr() const
Definition events.hpp:260
std::span< std::size_t > get_span() const
Get std const view of _events counter.
Definition events.hpp:180
constexpr std::size_t get_cumulative() const
Getter to specific event counter.
Definition events.hpp:226
void save(Archive &ar) const
Definition events.hpp:270
constexpr std::size_t get() const
Getter to specific event counter.
Definition events.hpp:211
KOKKOS_FORCEINLINE_FUNCTION constexpr void incr() const
Increment specific event counter.
Definition events.hpp:242
EventContainer()
Default container, initalise counter.
Definition events.hpp:168
KOKKOS_INLINE_FUNCTION void clear() const
Reset counters.
Definition events.hpp:191
KOKKOS_FORCEINLINE_FUNCTION constexpr void add(size_t val) const
Definition events.hpp:251
Kokkos::View< std::size_t[number_event_type], Kokkos::SharedSpace > _events
Definition events.hpp:158
void load(Archive &ar)
Definition events.hpp:289