13#ifndef CD_BOXLOOPSIMPLEM_H
14#define CD_BOXLOOPSIMPLEM_H
17#include <CD_NamespaceHeader.H>
20template <
int Si,
int Sj,
typename Functor>
24 static_assert(Si >= 1 && Sj >= 1,
"BoxLoops::loop strides must be >= 1");
26 const int* lo = computeBox.loVect();
27 const int* hi = computeBox.hiVect();
29 for (
int j = lo[1]; j <= hi[1]; j += Sj) {
31 for (
int i = lo[0]; i <= hi[0]; i += Si) {
37template <
int Si,
int Sj,
int Sk,
typename Functor>
41 static_assert(Si >= 1 && Sj >= 1 && Sk >= 1,
"BoxLoops::loop strides must be >= 1");
43 const int* lo = computeBox.loVect();
44 const int* hi = computeBox.hiVect();
46 for (
int k = lo[2]; k <= hi[2]; k += Sk) {
47 for (
int j = lo[1]; j <= hi[1]; j += Sj) {
49 for (
int i = lo[0]; i <= hi[0]; i += Si) {
50 func(IntVect(i, j, k));
57template <
typename Functor>
61 for (IVSIterator iter(a_ivs); iter.ok(); ++iter) {
66template <
typename Functor>
70 for (DenseIntVectSetIterator iter(a_ivs); iter.ok(); ++iter) {
75template <
typename Functor>
81 for (iter.reset(); iter.ok(); ++iter) {
86template <
typename Functor>
92 for (iter.reset(); iter.ok(); ++iter) {
97template <
typename T,
typename Functor>
101 const std::vector<T>& stdVec = ((Vector<T>&)a_subset).stdVector();
103 for (
const auto& v : stdVec) {
108#include <CD_NamespaceFooter.H>
ALWAYS_INLINE void loop(const Box &a_computeBox, Functor &&kernel)
Launch a C++ kernel over a regular grid with compile-time per-dimension strides.
Definition CD_BoxLoopsImplem.H:39