Make UnitSystem::*_si(string) Const Members

There is no need for these to require that the UnitSystem be mutable.
This commit is contained in:
Bård Skaflestad 2023-11-08 16:06:53 +01:00
parent af4b985eb2
commit d9a1d7fe62
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);
}