Skip to content

Commit

Permalink
AmrMesh: add const to a few functions (#4021)
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Jul 6, 2024
1 parent eb1bba4 commit 3cd4640
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Src/AmrCore/AMReX_AmrMesh.H
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public:
void SetGeometry (int lev, const Geometry& geom_in) noexcept;

//! Given domain box, return AMR level. Return -1 if there is no match.
int GetLevel (Box const& domain) noexcept;
[[nodiscard]] int GetLevel (Box const& domain) const noexcept;

void ClearDistributionMap (int lev) noexcept;
void ClearBoxArray (int lev) noexcept;
Expand All @@ -201,7 +201,7 @@ public:
//! Return the largest allowable grid.
[[nodiscard]] const IntVect& maxGridSize (int lev) const noexcept { return max_grid_size[lev]; }

[[nodiscard]] bool LevelDefined (int lev) noexcept;
[[nodiscard]] bool LevelDefined (int lev) const noexcept;

//! Should we keep the coarser grids fixed (and not regrid those levels) at all?
[[nodiscard]] bool useFixedCoarseGrids () const noexcept { return use_fixed_coarse_grids; }
Expand Down Expand Up @@ -255,7 +255,7 @@ public:

[[nodiscard]] virtual BoxArray GetAreaNotToTag (int /*lev*/) { return BoxArray(); }

[[nodiscard]] long CountCells (int lev) noexcept;
[[nodiscard]] Long CountCells (int lev) const noexcept;

[[nodiscard]] virtual DistributionMapping MakeDistributionMap (int lev, BoxArray const& ba);

Expand Down
10 changes: 5 additions & 5 deletions Src/AmrCore/AMReX_AmrMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,9 @@ AmrMesh::SetGeometry (int lev, const Geometry& geom_in) noexcept
}

int
AmrMesh::GetLevel (Box const& domain) noexcept
AmrMesh::GetLevel (Box const& domain) const noexcept
{
Box ccdomain = amrex::enclosedCells(domain);
Box const& ccdomain = amrex::enclosedCells(domain);
for (int lev = 0; lev < geom.size(); ++lev) {
if (geom[lev].Domain() == ccdomain) { return lev; }
}
Expand All @@ -443,7 +443,7 @@ AmrMesh::ClearBoxArray (int lev) noexcept
}

bool
AmrMesh::LevelDefined (int lev) noexcept
AmrMesh::LevelDefined (int lev) const noexcept
{
return lev <= max_level && !grids[lev].empty() && !dmap[lev].empty();
}
Expand Down Expand Up @@ -1216,8 +1216,8 @@ AmrMesh::checkInput ()
}
}

long
AmrMesh::CountCells (int lev) noexcept
Long
AmrMesh::CountCells (int lev) const noexcept
{
return grids[lev].numPts();
}
Expand Down

0 comments on commit 3cd4640

Please sign in to comment.