Merge pull request #732 from joakim-hove/use-to_bool

Use DeckItem::to_bool( )
This commit is contained in:
Joakim Hove 2019-04-18 21:11:49 +02:00 committed by GitHub
commit abc674d40f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 15 deletions

View File

@ -250,8 +250,6 @@ namespace Opm
const UnitSystem& unit_system,
std::vector<std::pair<const DeckKeyword*, size_t > >& rftProperties);
void addWellEvent(const std::string& well, ScheduleEvents::Events event, size_t reportStep);
static bool convertEclipseStringToBool(const std::string& eclipseString);
#ifdef CHECK_WELLS
bool checkWells(const ParseContext& parseContext, ErrorGuard& errors) const;
#endif

View File

@ -1492,7 +1492,7 @@ namespace Opm {
const std::string& wellName = record.getItem("WELL").getTrimmedString(0);
auto& well = this->m_wells.get( wellName );
bool availableForGroupControl = convertEclipseStringToBool(record.getItem("GROUP_CONTROLLED").getTrimmedString(0));
bool availableForGroupControl = DeckItem::to_bool( record.getItem("GROUP_CONTROLLED").getTrimmedString(0) );
well.setAvailableForGroupControl(currentStep, availableForGroupControl);
well.setGuideRate(currentStep, record.getItem("GUIDE_RATE").get< double >(0));
@ -1917,18 +1917,6 @@ namespace Opm {
}
bool Schedule::convertEclipseStringToBool(const std::string& eclipseString) {
std::string lowerTrimmed = boost::algorithm::to_lower_copy(eclipseString);
boost::algorithm::trim(lowerTrimmed);
if (lowerTrimmed == "y" || lowerTrimmed == "yes") {
return true;
}
else if (lowerTrimmed == "n" || lowerTrimmed == "no") {
return false;
}
else throw std::invalid_argument("String " + eclipseString + " not recognized as a boolean-convertible string.");
}
const Tuning& Schedule::getTuning() const {