12 #ifdef MOOSE_KOKKOS_SCOPE 28 template <
typename thread_
id_type = ThreadID,
unsigned int max_dimension = 4>
31 static_assert(std::is_integral_v<thread_id_type>,
32 "Kokkos thread index type must be an integral type");
33 static_assert(std::is_unsigned_v<thread_id_type>,
"Kokkos thread index type must be unsigned");
34 static_assert(!std::is_same_v<bool, thread_id_type>,
"Kokkos thread index type must not be bool");
39 #ifdef MOOSE_KOKKOS_SCOPE 44 template <
typename... size_type>
45 void resize(size_type... sizes);
50 KOKKOS_FUNCTION thread_id_type
size()
const {
return _size; }
56 KOKKOS_FUNCTION thread_id_type
size(
const unsigned int dim)
const 68 KOKKOS_FUNCTION thread_id_type
operator()(
const thread_id_type tid,
const unsigned int dim)
const 88 thread_id_type
_dims[max_dimension];
95 #ifdef MOOSE_KOKKOS_SCOPE 96 template <
typename thread_
id_type,
unsigned int max_dimension>
97 template <
typename... size_type>
101 static_assert((std::is_convertible<size_type, thread_id_type>::value && ...),
102 "All arguments must be convertible to thread_id_type");
103 static_assert(
sizeof...(sizes) <= max_dimension,
"Number of arguments exceeds maximum dimension");
105 std::vector<thread_id_type> dims;
106 (dims.push_back(sizes), ...);
111 for (
unsigned int dim = 0;
dim < _dim; ++
dim)
114 _strides[
dim] =
dim ? _strides[
dim - 1] * dims[
dim - 1] : 1;
119 mooseError(
"Kokkos thread error: the dimensions provided (",
121 ") has the total size of ",
123 " which exceeds the limit of ",
124 MooseUtils::prettyCppType<thread_id_type>(),
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
KOKKOS_FUNCTION thread_id_type size(const unsigned int dim) const
Get the size of each dimension.
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
auto max(const L &left, const R &right)
thread_id_type _dims[max_dimension]
Thread pool size of each dimension.
MOOSE_KOKKOS_INDEX_TYPE ThreadID
void resize(size_type... sizes)
Set the thread pool size and dimension.
KOKKOS_FUNCTION thread_id_type operator()(const thread_id_type tid, const unsigned int dim) const
Get the multi-dimensional thread index of a dimension given a one-dimensional thread index...
thread_id_type _strides[max_dimension]
Thread pool stride of each dimension.
std::string stringify(const T &t)
conversion to string
thread_id_type _size
Total thread pool size.
unsigned int _dim
Thread pool dimension.
KOKKOS_FUNCTION thread_id_type size() const
Get the total thread pool size.
The Kokkos thread object that aids in converting the one-dimensional thread index into multi-dimensio...