mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-24 10:10:18 -06:00
Merge pull request #5713 from akva2/fmt_fix_runtime_formats
fixed: use constexpr formats and/or mark format strings runtime
This commit is contained in:
commit
2546d2b181
@ -21,7 +21,6 @@
|
||||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
@ -36,20 +35,13 @@
|
||||
#include <opm/input/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/simulators/flow/KeywordValidation.hpp>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
|
||||
|
||||
namespace KeywordValidation
|
||||
{
|
||||
|
||||
namespace Opm::KeywordValidation {
|
||||
|
||||
std::string get_error_report(const std::vector<ValidationError>& 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
|
||||
|
@ -421,8 +421,8 @@ void GasLiftSingleWellGeneric<Scalar>::
|
||||
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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user