11#include "discrete_element.hpp"
12#include "discrete_vector.hpp"
18template <
class Support,
class Element, std::size_t N,
class Functor,
class... Is>
19void host_for_each_serial(
20 Support
const& domain,
21 std::array<Element, N>
const& size,
23 Is
const&... is)
noexcept
25 static constexpr std::size_t I =
sizeof...(Is);
26 if constexpr (I == N) {
27 f(domain(
typename Support::discrete_vector_type(is...)));
29 for (Element ii = 0; ii < size[I]; ++ii) {
30 host_for_each_serial(domain, size, f, is..., ii);
35template <
class Support,
class Element, std::size_t N,
class Functor,
class... Is>
36KOKKOS_FUNCTION
void device_for_each_serial(
37 Support
const& domain,
38 std::array<Element, N>
const& size,
40 Is
const&... is)
noexcept
42 static constexpr std::size_t I =
sizeof...(Is);
43 if constexpr (I == N) {
44 f(domain(
typename Support::discrete_vector_type(is...)));
46 for (Element ii = 0; ii < size[I]; ++ii) {
47 device_for_each_serial(domain, size, f, is..., ii);
54#if defined(DDC_BUILD_DEPRECATED_CODE)
56
57
58
68
69
70
71template <
class Support,
class Functor>
72void host_for_each(Support
const& domain, Functor&& f)
noexcept
74 detail::host_for_each_serial(domain, detail::array(domain.extents()), std::forward<Functor>(f));
78
79
80
81template <
class Support,
class Functor>
84 detail::device_for_each_serial(
86 detail::array(domain.extents()),
87 std::forward<Functor>(f));
The top-level namespace of DDC.
void host_for_each(Support const &domain, Functor &&f) noexcept
iterates over a nD domain in serial
KOKKOS_FUNCTION void device_for_each(Support const &domain, Functor &&f) noexcept
iterates over a nD domain in serial