Merge pull request #3755 from bska/usys-const-mem-fn

Make UnitSystem::*_si(string) Const Members
This commit is contained in:
Bård Skaflestad 2023-11-08 17:24:25 +01:00 committed by GitHub
commit 552fe8950f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -116,8 +116,8 @@ namespace Opm {
Dimension parse(const std::string& dimension) const;
double from_si( const std::string& dimension, double );
double to_si( const std::string& dimension, double );
double from_si( const std::string& dimension, double ) const;
double to_si( const std::string& dimension, double ) const;
double from_si( measure, double ) const;
double to_si( measure, double ) const;
void from_si( measure, std::vector<double>& ) const;

View File

@ -242,7 +242,7 @@ namespace {
"KG-M",
"PPM", /*Parts per million */
"GPa",
"DAY/SM3"
"DAY/SM3",
};
static_assert(numElems(from_metric_offset) == static_cast<std::size_t>(UnitSystem::measure::_count),
@ -1594,12 +1594,14 @@ namespace {
+ this->measure_table_to_si_offset[ static_cast< int >( m ) ];
}
double UnitSystem::from_si( const std::string& dimension, double value) {
double UnitSystem::from_si( const std::string& dimension, double value) const
{
const auto& dim = this->parse(dimension);
return dim.convertSiToRaw(value);
}
double UnitSystem::to_si( const std::string& dimension, double value) {
double UnitSystem::to_si( const std::string& dimension, double value) const
{
const auto& dim = this->parse(dimension);
return dim.convertRawToSi(value);
}