Added getEclType() to UnitSystem
This commit is contained in:
@@ -364,6 +364,18 @@ namespace {
|
||||
}
|
||||
|
||||
|
||||
ert_ecl_unit_enum UnitSystem::getEclType() const {
|
||||
switch ( m_unittype ) {
|
||||
case UnitType::UNIT_TYPE_METRIC: return ECL_METRIC_UNITS;
|
||||
case UnitType::UNIT_TYPE_FIELD: return ECL_FIELD_UNITS;
|
||||
case UnitType::UNIT_TYPE_LAB: return ECL_LAB_UNITS;
|
||||
default:
|
||||
throw std::runtime_error("What has happened here?");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Dimension UnitSystem::parseFactor(const std::string& dimension) const {
|
||||
std::vector<std::string> dimensionList;
|
||||
boost::split(dimensionList , dimension , boost::is_any_of("*"));
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
|
||||
#include <opm/parser/eclipse/Units/Dimension.hpp>
|
||||
|
||||
namespace Opm {
|
||||
@@ -70,6 +72,7 @@ namespace Opm {
|
||||
|
||||
const std::string& getName() const;
|
||||
UnitType getType() const;
|
||||
ert_ecl_unit_enum getEclType( ) const;
|
||||
|
||||
void addDimension(const std::string& dimension, double SIfactor, double SIoffset = 0.0);
|
||||
void addDimension( Dimension );
|
||||
|
||||
@@ -142,6 +142,8 @@ BOOST_AUTO_TEST_CASE(CreateMetricSystem) {
|
||||
BOOST_CHECK_EQUAL( Metric::Time , system.getDimension("Time").getSIScaling() );
|
||||
BOOST_CHECK_EQUAL( Metric::Permeability , system.getDimension("Permeability").getSIScaling() );
|
||||
BOOST_CHECK_EQUAL( Metric::Pressure , system.getDimension("Pressure").getSIScaling() );
|
||||
|
||||
BOOST_CHECK_EQUAL( system.getEclType( ) , ECL_METRIC_UNITS );
|
||||
}
|
||||
|
||||
|
||||
@@ -155,6 +157,8 @@ BOOST_AUTO_TEST_CASE(CreateFieldSystem) {
|
||||
BOOST_CHECK_EQUAL( Field::Time , system.getDimension("Time").getSIScaling() );
|
||||
BOOST_CHECK_EQUAL( Field::Permeability , system.getDimension("Permeability").getSIScaling() );
|
||||
BOOST_CHECK_EQUAL( Field::Pressure , system.getDimension("Pressure").getSIScaling() );
|
||||
|
||||
BOOST_CHECK_EQUAL( system.getEclType( ) , ECL_FIELD_UNITS );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user