Skip to content

Commit

Permalink
add sanity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
atmyers committed Jun 28, 2023
1 parent 9b07338 commit 2ff2708
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Src/Base/AMReX_PODVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@ namespace amrex::VectorGrowthStrategy
void Initialize () {
ParmParse pp("amrex");
pp.queryAdd("vector_growth_factor", growth_factor);

// sanity checks
auto eps = std::numeric_limits<Real>::epsilon();
auto huge = 1000._rt; // huge enough for our purposes...
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(growth_factor - 1.0_rt >= eps,
"User-specified vector growth factor is too small.");
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(growth_factor < huge,
"User-specified vector growth factor is too large.");
}
}

0 comments on commit 2ff2708

Please sign in to comment.