12 #ifndef CD_BoxLoopsImplem_H
13 #define CD_BoxLoopsImplem_H
16 #include <CD_NamespaceHeader.H>
18 template <
typename Functor>
20 BoxLoops::loop(
const Box& computeBox, Functor&& func,
const IntVect& a_stride)
23 CH_assert(a_stride > IntVect::Zero);
25 const int* lo = computeBox.loVect();
26 const int* hi = computeBox.hiVect();
30 for (
int k = lo[2]; k <= hi[2]; k += a_stride[2]) {
32 for (
int j = lo[1]; j <= hi[1]; j += a_stride[1]) {
34 for (
int i = lo[0]; i <= hi[0]; i += a_stride[0]) {
35 func(IntVect(D_DECL(i, j, k)));
43 template <
typename Functor>
47 for (IVSIterator iter(a_ivs); iter.ok(); ++iter) {
52 template <
typename Functor>
56 for (DenseIntVectSetIterator iter(a_ivs); iter.ok(); ++iter) {
61 template <
typename Functor>
67 for (iter.reset(); iter.ok(); ++iter) {
72 template <
typename Functor>
78 for (iter.reset(); iter.ok(); ++iter) {
83 template <
typename T,
typename Functor>
87 const std::vector<T>& stdVec = ((Vector<T>&)a_subset).stdVector();
89 for (
const auto& v : stdVec) {
94 #include <CD_NamespaceFooter.H>
ALWAYS_INLINE void loop(const Box &a_computeBox, Functor &&kernel, const IntVect &a_stride=IntVect::Unit)
Launch a C++ kernel over a regular grid.
Definition: CD_BoxLoopsImplem.H:20