11#include "ddc/discrete_domain.hpp"
12#include "ddc/discrete_element.hpp"
13#include "ddc/discrete_vector.hpp"
19template <
class RetType,
class Element, std::size_t N,
class Functor,
class... Is>
21 std::array<Element, N>
const& begin,
22 std::array<Element, N>
const& end,
24 Is
const&... is)
noexcept
26 static constexpr std::size_t I =
sizeof...(Is);
27 if constexpr (I == N) {
30 for (Element ii = begin[I]; ii < end[I]; ++ii) {
31 for_each_serial<RetType>(begin, end, f, is..., ii);
39
40
41
42template <
class... DDims,
class Functor>
45 DiscreteElement<DDims...>
const ddc_begin = domain.front();
46 DiscreteElement<DDims...>
const ddc_end = domain.front() + domain.extents();
47 std::array
const begin = detail::array(ddc_begin);
48 std::array
const end = detail::array(ddc_end);
49 detail::for_each_serial<DiscreteElement<DDims...>>(begin, end, std::forward<Functor>(f));
friend class DiscreteDomain
The top-level namespace of DDC.
void for_each(DiscreteDomain< DDims... > const &domain, Functor &&f) noexcept
iterates over a nD domain in serial