Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loop: reordered loop_box arguments to be more standard #175

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Loop/src/loop.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ public:

// Loop over a given box
template <int CI, int CJ, int CK, int VS = 1, typename F>
void loop_box(const F &f, const vect<int, dim> &restrict bnd_min,
void loop_box(const vect<int, dim> &restrict bnd_min,
const vect<int, dim> &restrict bnd_max,
const vect<int, dim> &restrict loop_min,
const vect<int, dim> &restrict loop_max) const {
const vect<int, dim> &restrict loop_max, const F &f) const {
static_assert(CI == 0 || CI == 1);
static_assert(CJ == 0 || CJ == 1);
static_assert(CK == 0 || CK == 1);
Expand Down Expand Up @@ -240,7 +240,7 @@ public:
boundary_box<CI, CJ, CK>(group_nghostzones, bnd_min, bnd_max);
vect<int, dim> imin, imax;
box_all<CI, CJ, CK>(group_nghostzones, imin, imax);
loop_box<CI, CJ, CK, VS>(f, bnd_min, bnd_max, imin, imax);
loop_box<CI, CJ, CK, VS>(bnd_min, bnd_max, imin, imax, f);
}

// Loop over all interior points
Expand All @@ -251,7 +251,7 @@ public:
boundary_box<CI, CJ, CK>(group_nghostzones, bnd_min, bnd_max);
vect<int, dim> imin, imax;
box_int<CI, CJ, CK>(group_nghostzones, imin, imax);
loop_box<CI, CJ, CK, VS>(f, bnd_min, bnd_max, imin, imax);
loop_box<CI, CJ, CK, VS>(bnd_min, bnd_max, imin, imax, f);
}

// Loop over a part of the domain. Loop over the interior first,
Expand Down Expand Up @@ -304,7 +304,7 @@ public:
imax[d] = min(tmax[d], imax[d]);
}

loop_box<CI, CJ, CK, VS>(f, bnd_min, bnd_max, imin, imax);
loop_box<CI, CJ, CK, VS>(bnd_min, bnd_max, imin, imax, f);
}
} // if rank
}
Expand Down Expand Up @@ -363,7 +363,7 @@ public:
imax[d] = min(tmax[d], imax[d]);
}

loop_box<CI, CJ, CK, VS>(f, bnd_min, bnd_max, imin, imax);
loop_box<CI, CJ, CK, VS>(bnd_min, bnd_max, imin, imax, f);
}
} // if rank
}
Expand Down Expand Up @@ -445,7 +445,7 @@ public:
}
#endif

loop_box_boundary<CI, CJ, CK>(f, imin, imax, inormal);
loop_box_boundary<CI, CJ, CK>(imin, imax, inormal, f);
}
} // if rank
}
Expand Down Expand Up @@ -503,7 +503,7 @@ public:
imax[d] = min(tmax[d], imax[d]);
}

loop_box<CI, CJ, CK, VS>(f, bnd_min, bnd_max, imin, imax);
loop_box<CI, CJ, CK, VS>(bnd_min, bnd_max, imin, imax, f);
}
} // if rank
}
Expand Down
28 changes: 14 additions & 14 deletions Loop/src/loop_device.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ public:

// Loop over a given box
template <int CI, int CJ, int CK, int VS = 1, typename F>
void loop_box_device(const F &f, const vect<int, dim> &restrict bnd_min,
void loop_box_device(const vect<int, dim> &restrict bnd_min,
const vect<int, dim> &restrict bnd_max,
const vect<int, dim> &restrict loop_min,
const vect<int, dim> &restrict loop_max) const {
const vect<int, dim> &restrict loop_max, const F &f) const {
#ifndef AMREX_USE_GPU

return this->template loop_box<CI, CJ, CK, VS>(f, bnd_min, bnd_max,
loop_min, loop_max);
return this->template loop_box<CI, CJ, CK, VS>(bnd_min, bnd_max,
loop_min, loop_max, f);

#else

Expand Down Expand Up @@ -121,7 +121,7 @@ public:
boundary_box<CI, CJ, CK>(group_nghostzones, bnd_min, bnd_max);
vect<int, dim> imin, imax;
box_all<CI, CJ, CK>(group_nghostzones, imin, imax);
loop_box_device<CI, CJ, CK, VS>(f, bnd_min, bnd_max, imin, imax);
loop_box_device<CI, CJ, CK, VS>(bnd_min, bnd_max, imin, imax, f);
}

// Loop over all interior points
Expand All @@ -132,7 +132,7 @@ public:
boundary_box<CI, CJ, CK>(group_nghostzones, bnd_min, bnd_max);
vect<int, dim> imin, imax;
box_int<CI, CJ, CK>(group_nghostzones, imin, imax);
loop_box_device<CI, CJ, CK, VS>(f, bnd_min, bnd_max, imin, imax);
loop_box_device<CI, CJ, CK, VS>(bnd_min, bnd_max, imin, imax, f);
}

// Loop over a part of the domain. Loop over the interior first,
Expand Down Expand Up @@ -185,8 +185,8 @@ public:
imax[d] = min(tmax[d], imax[d]);
}

loop_box_device<CI, CJ, CK, VS>(f, bnd_min, bnd_max, imin,
imax);
loop_box_device<CI, CJ, CK, VS>(bnd_min, bnd_max, imin,
imax, f);
}
} // if rank
}
Expand Down Expand Up @@ -245,8 +245,8 @@ public:
imax[d] = min(tmax[d], imax[d]);
}

loop_box_device<CI, CJ, CK, VS>(f, bnd_min, bnd_max, imin,
imax);
loop_box_device<CI, CJ, CK, VS>(bnd_min, bnd_max, imin,
imax, f);
}
} // if rank
}
Expand Down Expand Up @@ -307,8 +307,8 @@ public:
imax[d] = std::min(tmax[d], imax[d]);
}

loop_box_boundary_device<CI, CJ, CK, VS>(f, imin, imax,
inormal);
loop_box_boundary_device<CI, CJ, CK, VS>(imin, imax,
inormal, f);
}
} // if rank
}
Expand Down Expand Up @@ -367,8 +367,8 @@ public:
imax[d] = min(tmax[d], imax[d]);
}

loop_box_device<CI, CJ, CK, VS>(f, bnd_min, bnd_max, imin,
imax);
loop_box_device<CI, CJ, CK, VS>( bnd_min, bnd_max, imin,
imax, f);
}
} // if rank
}
Expand Down