mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
[refactor] Use limits and OPM_THROW when checking max equil regions.
that will ease changing the limits and the error will appear in all logs.
This commit is contained in:
parent
712b00dbdf
commit
78b629767f
@ -22,6 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include <limits>
|
||||||
#include <ebos/eclgenericthresholdpressure.hh>
|
#include <ebos/eclgenericthresholdpressure.hh>
|
||||||
|
|
||||||
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
||||||
@ -120,10 +121,16 @@ finishInit()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
numEquilRegions_ = eclState_.getTableManager().getEqldims().getNumEquilRegions();
|
numEquilRegions_ = eclState_.getTableManager().getEqldims().getNumEquilRegions();
|
||||||
if (numEquilRegions_ > 0xff) {
|
const decltype(numEquilRegions_) maxRegions =
|
||||||
|
std::numeric_limits<std::decay_t<decltype(elemEquilRegion_[0])>>::max();
|
||||||
|
|
||||||
|
if (numEquilRegions_ > maxRegions) {
|
||||||
// make sure that the index of an equilibration region can be stored in a
|
// make sure that the index of an equilibration region can be stored in a
|
||||||
// single byte
|
// single byte
|
||||||
throw std::runtime_error("The maximum number of supported equilibration regions is 255!");
|
OPM_THROW(std::invalid_argument,
|
||||||
|
(fmt::format("The maximum number of supported "
|
||||||
|
"equilibration regions by OPM flow is {}!",
|
||||||
|
maxRegions)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// internalize the data specified using the EQLNUM keyword
|
// internalize the data specified using the EQLNUM keyword
|
||||||
|
Loading…
Reference in New Issue
Block a user