1 #ifndef DIY_VERTICES_HPP
2 #define DIY_VERTICES_HPP
11 template<
class Vertex,
size_t I>
14 static constexpr
bool value = (Vertex::dimension() - 1 == I);
17 template<
class Vertex,
class Callback,
size_t I,
bool P>
20 void operator()(Vertex& pos,
const Vertex& from,
const Vertex& to,
const Callback& callback)
const
22 for (pos[I] = from[I]; pos[I] <= to[I]; ++pos[I])
23 ForEach<Vertex, Callback, I+1, IsLast<Vertex,I+1>::value>()(pos, from, to, callback);
27 template<
class Vertex,
class Callback,
size_t I>
28 struct ForEach<Vertex,Callback,I,true>
30 void operator()(Vertex& pos,
const Vertex& from,
const Vertex& to,
const Callback& callback)
const
32 for (pos[I] = from[I]; pos[I] <= to[I]; ++pos[I])
38 template<
class Vertex,
class Callback>
39 void for_each(
const Vertex& from,
const Vertex& to,
const Callback& callback)
42 grid::detail::ForEach<Vertex, Callback, 0, detail::IsLast<Vertex,0>::value>()(pos, from, to, callback);
45 template<
class Vertex,
class Callback>
46 void for_each(
const Vertex& shape,
const Callback& callback)
49 grid::for_each(Vertex::zero(), shape - Vertex::one(), callback);