diff --git a/opm/simulators/flow/KeywordValidation.cpp b/opm/simulators/flow/KeywordValidation.cpp index ec39470a1..49aaec4bb 100644 --- a/opm/simulators/flow/KeywordValidation.cpp +++ b/opm/simulators/flow/KeywordValidation.cpp @@ -21,7 +21,6 @@ #include "config.h" #endif // HAVE_CONFIG_H -#include #include #include @@ -36,20 +35,13 @@ #include #include -namespace Opm -{ - - - -namespace KeywordValidation -{ - +namespace Opm::KeywordValidation { std::string get_error_report(const std::vector& errors, const bool include_noncritical, const bool include_critical) { const std::string keyword_format = " {keyword}: keyword not supported\n"; - const std::string item_format1 = " {{keyword}}: invalid value '{}' for item {}\n"; - const std::string item_format2 = " {{keyword}}: invalid value '{}' in record {} for item {}\n"; + constexpr std::string_view item_format1 = " {{keyword}}: invalid value '{}' for item {}\n"; + constexpr std::string_view item_format2 = " {{keyword}}: invalid value '{}' in record {} for item {}\n"; const std::string location_format = " In file: {file}, line {line}\n"; std::string report; @@ -206,7 +198,4 @@ namespace KeywordValidation } } - -} // namespace KeywordValidation - -} // namespace Opm +} // namespace Opm::KeywordValidation diff --git a/opm/simulators/wells/GasLiftSingleWellGeneric.cpp b/opm/simulators/wells/GasLiftSingleWellGeneric.cpp index 7cb660dc3..e87e5a63c 100644 --- a/opm/simulators/wells/GasLiftSingleWellGeneric.cpp +++ b/opm/simulators/wells/GasLiftSingleWellGeneric.cpp @@ -421,8 +421,8 @@ void GasLiftSingleWellGeneric:: debugShowBhpAlqTable_() { Scalar alq = 0.0; - const std::string fmt_fmt1 {"{:^12s} {:^12s} {:^12s} {:^12s}"}; - const std::string fmt_fmt2 {"{:>12.5g} {:>12.5g} {:>12.5g} {:>12.5g}"}; + constexpr std::string_view fmt_fmt1 {"{:^12s} {:^12s} {:^12s} {:^12s}"}; + constexpr std::string_view fmt_fmt2 {"{:>12.5g} {:>12.5g} {:>12.5g} {:>12.5g}"}; const std::string header = fmt::format(fmt_fmt1, "ALQ", "BHP", "oil", "gas"); displayDebugMessage_(header); auto max_it = 50; diff --git a/opm/simulators/wells/GroupEconomicLimitsChecker.cpp b/opm/simulators/wells/GroupEconomicLimitsChecker.cpp index 940752c1b..fb0fe5d5e 100644 --- a/opm/simulators/wells/GroupEconomicLimitsChecker.cpp +++ b/opm/simulators/wells/GroupEconomicLimitsChecker.cpp @@ -330,7 +330,7 @@ addPrintMessage(const std::string& msg, this->group_.name() ); const std::string measure_name(this->unit_system_.name(measure)); - const std::string message = fmt::format(msg, + const std::string message = fmt::format(fmt::runtime(msg), this->unit_system_.from_si(measure, value), measure_name, this->unit_system_.from_si(measure, limit), measure_name);