Skip to content

Commit

Permalink
revert back calculation and move +1 outside int()
Browse files Browse the repository at this point in the history
  • Loading branch information
zhichen3 committed Sep 12, 2024
1 parent 6a5834d commit 6980dad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Src/Base/AMReX_CoordSys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ CoordSys::UpperIndex(const Real* point) const noexcept
IntVect ix;
for (int k = 0; k < AMREX_SPACEDIM; k++)
{
ix[k] = (int) ((point[k]-offset[k])/dx[k] + 1);
ix[k] = (int) ((point[k]-offset[k])/dx[k]) + 1;
}
return ix;
}
Expand Down Expand Up @@ -512,7 +512,7 @@ CoordSys::Volume (const Real xlo[AMREX_SPACEDIM],
*(xhi[2]-xlo[2]));
#if (AMREX_SPACEDIM==2)
case RZ:
return static_cast<Real>(0.5*TWOPI)*(xhi[1]-xlo[1])*(xhi[0]+xlo[0])*(xhi[0]-xlo[0]);
return static_cast<Real>(0.5*TWOPI)*(xhi[1]-xlo[1])*(xhi[0]*xhi[0]-xlo[0]*xlo[0]);
case SPHERICAL:
return static_cast<Real>(TWOPI/3.)*(std::cos(xlo[1])-std::cos(xhi[1])) *
(xhi[0]-xlo[0])*(xhi[0]*xhi[0]+xhi[0]*xlo[0]+xlo[0]*xlo[0]);
Expand Down

0 comments on commit 6980dad

Please sign in to comment.