6#ifndef PECLET_CORE_COMMON_TYPES_HPP
7#define PECLET_CORE_COMMON_TYPES_HPP
22using IVec = std::array<Index, Dim>;
26using Vec = std::array<Real, Dim>;
29template <
typename Label = Index>
38 return ((x % n) + n) % n;
43template <
int Dim,
int Axis>
45 template <
typename Func>
55 template <
typename Func>
57 for (idx[0] =
bgn[0]; idx[0] < end[0]; ++idx[0]) {
64template <
int Dim,
typename Func>
Index wrap(Index x, Index n)
Periodic wrap of a coordinate into [0, n): wrap(x, n) = (x % n + n) % n.
std::array< Real, Dim > Vec
Multi-dimensional real vector.
void forEachInBox(const IVec< Dim > &bgn, const IVec< Dim > &end, Func &&func)
Iterate the box [bgn, end) calling func(const IVec<Dim>&).
std::array< Index, Dim > IVec
Multi-dimensional integer index / coordinate (x-fastest order by convention).
Kokkos::View< T *, MemSpace > View
1D device array.
double Real
Default host floating type. Device kernels may use float; conversions happen at the boundary.
std::int64_t Index
Signed index type for grids and particles (supersedes block_decomposer's long int IndxT).
static void run(IVec< Dim > &idx, const IVec< Dim > &bgn, const IVec< Dim > &end, Func &&func)
Compile-time-unrolled nested loop over [bgn, end) in row-major (axis 0 fastest) order.
static void run(IVec< Dim > &idx, const IVec< Dim > &bgn, const IVec< Dim > &end, Func &&func)
Half-open range [begin, end) carrying a label (e.g. a block id). Ported from pbs::IndxRange.