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

Convert Box to BoxND #4016

Merged
Prev Previous commit
Next Next commit
fix atOffset
  • Loading branch information
AlexanderSinn committed Jul 8, 2024
commit fb0befed7b0269e633f60b53cd3857ec0ff32292
6 changes: 3 additions & 3 deletions Src/Base/AMReX_Box.H
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ AMREX_FORCE_INLINE
IntVectND<dim>
BoxND<dim>::atOffset (Long offset) const noexcept
{
IntVectND<dim> result;
IntVectND<dim> result = smallend;

if constexpr (dim > 1) {
GpuArray<Long, dim-1> mult{};
Expand All @@ -942,11 +942,11 @@ BoxND<dim>::atOffset (Long offset) const noexcept
for (int i = dim-1 ; i > 0; --i) {
Long idx = offset / mult[i-1];
offset -= idx * mult[i-1];
result[i] = static_cast<int>(idx);
result[i] += static_cast<int>(idx);
}
}

result[0] = static_cast<int>(offset);
result[0] += static_cast<int>(offset);
}

template<int dim>
Expand Down
Loading