UnitSystem named constructors with automatic storage

This commit is contained in:
Jørgen Kvalsvik
2016-10-13 11:36:51 +02:00
parent 0e7752c499
commit f2e509f59f
6 changed files with 116 additions and 124 deletions

View File

@@ -192,11 +192,11 @@ namespace Opm {
* marked mutable.
*/
this->defaultUnits = std::unique_ptr< UnitSystem >( UnitSystem::newMETRIC() );
this->defaultUnits = std::unique_ptr< UnitSystem >( new UnitSystem( UnitSystem::newMETRIC() ) );
if (hasKeyword("FIELD"))
this->activeUnits = std::unique_ptr< UnitSystem >( UnitSystem::newFIELD() );
this->activeUnits = std::unique_ptr< UnitSystem >( new UnitSystem( UnitSystem::newFIELD() ) );
else
this->activeUnits = std::unique_ptr< UnitSystem >( UnitSystem::newMETRIC() );
this->activeUnits = std::unique_ptr< UnitSystem >( new UnitSystem( UnitSystem::newMETRIC() ) );
}
const std::string Deck::getDataFile() const {

View File

@@ -361,14 +361,14 @@ VFPPROD \n\
Opm::Parser parser;
auto deck = parser.parseString(deckData, Opm::ParseContext());
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
const auto& vfpprodKeyword = deck.getKeyword("VFPPROD");
BOOST_CHECK_EQUAL(deck.count("VFPPROD"), 1);
Opm::VFPProdTable vfpprodTable;
vfpprodTable.init(vfpprodKeyword, *units);
vfpprodTable.init(vfpprodKeyword, units);
BOOST_CHECK_EQUAL(vfpprodTable.getTableNum(), 5);
BOOST_CHECK_EQUAL(vfpprodTable.getDatumDepth(), 32.9);
@@ -489,13 +489,13 @@ VFPPROD \n\
Opm::Parser parser;
auto deck = parser.parseString(deckData, Opm::ParseContext());
const auto& vfpprodKeyword = deck.getKeyword("VFPPROD");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
BOOST_CHECK_EQUAL(deck.count("VFPPROD"), 1);
Opm::VFPProdTable vfpprodTable;
vfpprodTable.init(vfpprodKeyword, *units);
vfpprodTable.init(vfpprodKeyword, units);
BOOST_CHECK_EQUAL(vfpprodTable.getTableNum(), 5);
BOOST_CHECK_EQUAL(vfpprodTable.getDatumDepth(), 32.9);
@@ -601,13 +601,11 @@ VFPPROD \n\
Opm::Parser parser;
auto deck = parser.parseString(missing_values, Opm::ParseContext());
const auto& vfpprodKeyword = deck.getKeyword("VFPPROD");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
BOOST_CHECK_EQUAL(deck.count("VFPPROD"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, *units), std::invalid_argument);
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, units), std::invalid_argument);
}
@@ -638,13 +636,13 @@ VFPPROD \n\
Opm::Parser parser;
auto deck = parser.parseString(missing_values, Opm::ParseContext());
const auto& vfpprodKeyword = deck.getKeyword("VFPPROD");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
BOOST_CHECK_EQUAL(deck.count("VFPPROD"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, *units), std::invalid_argument);
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, units), std::invalid_argument);
}
@@ -673,13 +671,13 @@ VFPPROD \n\
Opm::Parser parser;
auto deck = parser.parseString(missing_metadata, Opm::ParseContext());
const auto& vfpprodKeyword = deck.getKeyword("VFPPROD");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
BOOST_CHECK_EQUAL(deck.count("VFPPROD"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, *units), std::out_of_range);
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, units), std::out_of_range);
}
@@ -709,12 +707,12 @@ VFPPROD \n\
Opm::Parser parser;
auto deck = parser.parseString(wrong_metadata, Opm::ParseContext());
const auto& vfpprodKeyword = deck.getKeyword("VFPPROD");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
BOOST_CHECK_EQUAL(deck.count("VFPPROD"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, *units), std::invalid_argument);
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, units), std::invalid_argument);
}
@@ -744,12 +742,12 @@ VFPPROD \n\
Opm::Parser parser;
auto deck = parser.parseString(missing_axes, Opm::ParseContext());
const auto& vfpprodKeyword = deck.getKeyword("VFPPROD");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
BOOST_CHECK_EQUAL(deck.count("VFPPROD"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, *units), std::invalid_argument);
BOOST_CHECK_THROW(vfpprodTable.init(vfpprodKeyword, units), std::invalid_argument);
}
}
@@ -777,13 +775,13 @@ VFPINJ \n\
Opm::Parser parser;
auto deck = parser.parseString(deckData, Opm::ParseContext());
const auto& vfpprodKeyword = deck.getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
BOOST_CHECK_EQUAL(deck.count("VFPINJ"), 1);
Opm::VFPInjTable vfpinjTable;
vfpinjTable.init(vfpprodKeyword, *units);
vfpinjTable.init(vfpprodKeyword, units);
BOOST_CHECK_EQUAL(vfpinjTable.getTableNum(), 5);
BOOST_CHECK_EQUAL(vfpinjTable.getDatumDepth(), 32.9);
@@ -879,13 +877,13 @@ VFPINJ \n\
Opm::Parser parser;
auto deck = parser.parseString(missing_values, Opm::ParseContext());
const auto& vfpinjKeyword = deck.getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
BOOST_CHECK_EQUAL(deck.count("VFPINJ"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, *units), std::invalid_argument);
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, units), std::invalid_argument);
}
@@ -910,13 +908,11 @@ VFPINJ \n\
Opm::Parser parser;
auto deck = parser.parseString(missing_values, Opm::ParseContext());
const auto& vfpinjKeyword = deck.getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
BOOST_CHECK_EQUAL(deck.count("VFPINJ"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, *units), std::invalid_argument);
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, units), std::invalid_argument);
}
@@ -940,13 +936,11 @@ VFPINJ \n\
Opm::Parser parser;
auto deck = parser.parseString(missing_metadata, Opm::ParseContext());
const auto& vfpinjKeyword = deck.getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
BOOST_CHECK_EQUAL(deck.count("VFPINJ"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, *units), std::invalid_argument);
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, units), std::invalid_argument);
}
@@ -971,12 +965,12 @@ VFPINJ \n\
Opm::Parser parser;
auto deck = parser.parseString(wrong_metadata, Opm::ParseContext());
const auto& vfpinjKeyword = deck.getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units(Opm::UnitSystem::newMETRIC());
BOOST_CHECK_EQUAL(deck.count("VFPINJ"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, *units), std::invalid_argument);
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, units), std::invalid_argument);
}
@@ -1001,12 +995,12 @@ VFPINJ \n\
Opm::Parser parser;
auto deck = parser.parseString(missing_axes, Opm::ParseContext());
const auto& vfpinjKeyword = deck.getKeyword("VFPINJ");
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
BOOST_CHECK_EQUAL(deck.count("VFPINJ"), 1);
Opm::VFPProdTable vfpprodTable;
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, *units), std::invalid_argument);
BOOST_CHECK_THROW(vfpprodTable.init(vfpinjKeyword, units), std::invalid_argument);
}
}

View File

@@ -49,7 +49,7 @@ const std::string testHeader =
"#include <opm/parser/eclipse/Parser/ParserRecord.hpp>\n"
"#include <opm/parser/eclipse/Units/UnitSystem.hpp>\n"
"using namespace Opm;\n"
"std::shared_ptr<UnitSystem> unitSystem( UnitSystem::newMETRIC() );\n";
"auto unitSystem = UnitSystem::newMETRIC();\n";
const std::string sourceHeader =
"#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>\n"
@@ -239,7 +239,7 @@ namespace Opm {
stream << " ParserItemConstPtr item = parserRecord->get( i );" << std::endl;
stream << " for (size_t j=0; j < item->numDimensions(); j++) {" << std::endl;
stream << " std::string dimString = item->getDimension(j);" << std::endl;
stream << " BOOST_CHECK_NO_THROW( unitSystem->getNewDimension( dimString ));" << std::endl;
stream << " BOOST_CHECK_NO_THROW( unitSystem.getNewDimension( dimString ));" << std::endl;
stream << " }" << std::endl;
stream << " }" << std::endl;
stream << " }" << std::endl;

View File

@@ -451,88 +451,88 @@ namespace {
return this->unit_name_table[ static_cast< int >( m ) ];
}
UnitSystem * UnitSystem::newMETRIC() {
UnitSystem * system = new UnitSystem(UnitType::UNIT_TYPE_METRIC);
UnitSystem UnitSystem::newMETRIC() {
UnitSystem system( UnitType::UNIT_TYPE_METRIC );
system->addDimension("1" , 1.0);
system->addDimension("Pressure" , Metric::Pressure );
system->addDimension("Temperature", Metric::Temperature, Metric::TemperatureOffset);
system->addDimension("AbsoluteTemperature", Metric::AbsoluteTemperature);
system->addDimension("Length" , Metric::Length);
system->addDimension("Time" , Metric::Time );
system->addDimension("Mass" , Metric::Mass );
system->addDimension("Permeability", Metric::Permeability );
system->addDimension("Transmissibility", Metric::Transmissibility );
system->addDimension("GasDissolutionFactor", Metric::GasDissolutionFactor);
system->addDimension("OilDissolutionFactor", Metric::OilDissolutionFactor);
system->addDimension("LiquidSurfaceVolume", Metric::LiquidSurfaceVolume );
system->addDimension("GasSurfaceVolume" , Metric::GasSurfaceVolume );
system->addDimension("ReservoirVolume", Metric::ReservoirVolume );
system->addDimension("Density" , Metric::Density );
system->addDimension("PolymerDensity", Metric::PolymerDensity);
system->addDimension("Salinity", Metric::Salinity);
system->addDimension("Viscosity" , Metric::Viscosity);
system->addDimension("Timestep" , Metric::Timestep);
system->addDimension("SurfaceTension" , Metric::SurfaceTension);
system->addDimension("ContextDependent", std::numeric_limits<double>::quiet_NaN());
system.addDimension("1" , 1.0);
system.addDimension("Pressure" , Metric::Pressure );
system.addDimension("Temperature", Metric::Temperature, Metric::TemperatureOffset);
system.addDimension("AbsoluteTemperature", Metric::AbsoluteTemperature);
system.addDimension("Length" , Metric::Length);
system.addDimension("Time" , Metric::Time );
system.addDimension("Mass" , Metric::Mass );
system.addDimension("Permeability", Metric::Permeability );
system.addDimension("Transmissibility", Metric::Transmissibility );
system.addDimension("GasDissolutionFactor", Metric::GasDissolutionFactor);
system.addDimension("OilDissolutionFactor", Metric::OilDissolutionFactor);
system.addDimension("LiquidSurfaceVolume", Metric::LiquidSurfaceVolume );
system.addDimension("GasSurfaceVolume" , Metric::GasSurfaceVolume );
system.addDimension("ReservoirVolume", Metric::ReservoirVolume );
system.addDimension("Density" , Metric::Density );
system.addDimension("PolymerDensity", Metric::PolymerDensity);
system.addDimension("Salinity", Metric::Salinity);
system.addDimension("Viscosity" , Metric::Viscosity);
system.addDimension("Timestep" , Metric::Timestep);
system.addDimension("SurfaceTension" , Metric::SurfaceTension);
system.addDimension("ContextDependent", std::numeric_limits<double>::quiet_NaN());
return system;
}
UnitSystem * UnitSystem::newFIELD() {
UnitSystem * system = new UnitSystem(UnitType::UNIT_TYPE_FIELD);
UnitSystem UnitSystem::newFIELD() {
UnitSystem system( UnitType::UNIT_TYPE_FIELD );
system->addDimension("1" , 1.0);
system->addDimension("Pressure", Field::Pressure );
system->addDimension("Temperature", Field::Temperature, Field::TemperatureOffset);
system->addDimension("AbsoluteTemperature", Field::AbsoluteTemperature);
system->addDimension("Length", Field::Length);
system->addDimension("Time" , Field::Time);
system->addDimension("Mass", Field::Mass);
system->addDimension("Permeability", Field::Permeability );
system->addDimension("Transmissibility", Field::Transmissibility );
system->addDimension("GasDissolutionFactor" , Field::GasDissolutionFactor);
system->addDimension("OilDissolutionFactor", Field::OilDissolutionFactor);
system->addDimension("LiquidSurfaceVolume", Field::LiquidSurfaceVolume );
system->addDimension("GasSurfaceVolume", Field::GasSurfaceVolume );
system->addDimension("ReservoirVolume", Field::ReservoirVolume );
system->addDimension("Density", Field::Density );
system->addDimension("PolymerDensity", Field::PolymerDensity);
system->addDimension("Salinity", Field::Salinity);
system->addDimension("Viscosity", Field::Viscosity);
system->addDimension("Timestep", Field::Timestep);
system->addDimension("SurfaceTension" , Field::SurfaceTension);
system->addDimension("ContextDependent", std::numeric_limits<double>::quiet_NaN());
system.addDimension("1" , 1.0);
system.addDimension("Pressure", Field::Pressure );
system.addDimension("Temperature", Field::Temperature, Field::TemperatureOffset);
system.addDimension("AbsoluteTemperature", Field::AbsoluteTemperature);
system.addDimension("Length", Field::Length);
system.addDimension("Time" , Field::Time);
system.addDimension("Mass", Field::Mass);
system.addDimension("Permeability", Field::Permeability );
system.addDimension("Transmissibility", Field::Transmissibility );
system.addDimension("GasDissolutionFactor" , Field::GasDissolutionFactor);
system.addDimension("OilDissolutionFactor", Field::OilDissolutionFactor);
system.addDimension("LiquidSurfaceVolume", Field::LiquidSurfaceVolume );
system.addDimension("GasSurfaceVolume", Field::GasSurfaceVolume );
system.addDimension("ReservoirVolume", Field::ReservoirVolume );
system.addDimension("Density", Field::Density );
system.addDimension("PolymerDensity", Field::PolymerDensity);
system.addDimension("Salinity", Field::Salinity);
system.addDimension("Viscosity", Field::Viscosity);
system.addDimension("Timestep", Field::Timestep);
system.addDimension("SurfaceTension" , Field::SurfaceTension);
system.addDimension("ContextDependent", std::numeric_limits<double>::quiet_NaN());
return system;
}
UnitSystem * UnitSystem::newLAB() {
UnitSystem * system = new UnitSystem(UnitType::UNIT_TYPE_LAB);
UnitSystem UnitSystem::newLAB() {
UnitSystem system( UnitType::UNIT_TYPE_LAB );
system->addDimension("1" , 1.0);
system->addDimension("Pressure", Lab::Pressure );
system->addDimension("Temperature", Lab::Temperature, Lab::TemperatureOffset);
system->addDimension("AbsoluteTemperature", Lab::AbsoluteTemperature);
system->addDimension("Length", Lab::Length);
system->addDimension("Time" , Lab::Time);
system->addDimension("Mass", Lab::Mass);
system->addDimension("Permeability", Lab::Permeability );
system->addDimension("Transmissibility", Lab::Transmissibility );
system->addDimension("GasDissolutionFactor" , Lab::GasDissolutionFactor);
system->addDimension("OilDissolutionFactor", Lab::OilDissolutionFactor);
system->addDimension("LiquidSurfaceVolume", Lab::LiquidSurfaceVolume );
system->addDimension("GasSurfaceVolume", Lab::GasSurfaceVolume );
system->addDimension("ReservoirVolume", Lab::ReservoirVolume );
system->addDimension("Density", Lab::Density );
system->addDimension("PolymerDensity", Lab::PolymerDensity);
system->addDimension("Salinity", Lab::Salinity);
system->addDimension("Viscosity", Lab::Viscosity);
system->addDimension("Timestep", Lab::Timestep);
system->addDimension("SurfaceTension" , Lab::SurfaceTension);
system->addDimension("ContextDependent", std::numeric_limits<double>::quiet_NaN());
system.addDimension("1" , 1.0);
system.addDimension("Pressure", Lab::Pressure );
system.addDimension("Temperature", Lab::Temperature, Lab::TemperatureOffset);
system.addDimension("AbsoluteTemperature", Lab::AbsoluteTemperature);
system.addDimension("Length", Lab::Length);
system.addDimension("Time" , Lab::Time);
system.addDimension("Mass", Lab::Mass);
system.addDimension("Permeability", Lab::Permeability );
system.addDimension("Transmissibility", Lab::Transmissibility );
system.addDimension("GasDissolutionFactor" , Lab::GasDissolutionFactor);
system.addDimension("OilDissolutionFactor", Lab::OilDissolutionFactor);
system.addDimension("LiquidSurfaceVolume", Lab::LiquidSurfaceVolume );
system.addDimension("GasSurfaceVolume", Lab::GasSurfaceVolume );
system.addDimension("ReservoirVolume", Lab::ReservoirVolume );
system.addDimension("Density", Lab::Density );
system.addDimension("PolymerDensity", Lab::PolymerDensity);
system.addDimension("Salinity", Lab::Salinity);
system.addDimension("Viscosity", Lab::Viscosity);
system.addDimension("Timestep", Lab::Timestep);
system.addDimension("SurfaceTension" , Lab::SurfaceTension);
system.addDimension("ContextDependent", std::numeric_limits<double>::quiet_NaN());
return system;
}

View File

@@ -89,9 +89,9 @@ namespace Opm {
void to_si( measure, std::vector<double>& ) const;
const char* name( measure ) const;
static UnitSystem * newMETRIC();
static UnitSystem * newFIELD();
static UnitSystem * newLAB();
static UnitSystem newMETRIC();
static UnitSystem newFIELD();
static UnitSystem newLAB();
private:
Dimension parseFactor( const std::string& ) const;

View File

@@ -134,7 +134,7 @@ static void checkSystemHasRequiredDimensions( const UnitSystem& system) {
BOOST_AUTO_TEST_CASE(CreateMetricSystem) {
auto system = *UnitSystem::newMETRIC();
auto system = UnitSystem::newMETRIC();
checkSystemHasRequiredDimensions( system );
BOOST_CHECK_EQUAL( Metric::Length , system.getDimension("Length").getSIScaling() );
@@ -147,7 +147,7 @@ BOOST_AUTO_TEST_CASE(CreateMetricSystem) {
BOOST_AUTO_TEST_CASE(CreateFieldSystem) {
auto system = *UnitSystem::newFIELD();
auto system = UnitSystem::newFIELD();
checkSystemHasRequiredDimensions( system );
BOOST_CHECK_EQUAL( Field::Length , system.getDimension("Length").getSIScaling() );
@@ -180,9 +180,9 @@ inline std::ostream& operator<<( std::ostream& stream, const UnitSystem& us ) {
BOOST_AUTO_TEST_CASE(UnitSystemEqual) {
auto metric1 = *UnitSystem::newMETRIC();
auto metric2 = *UnitSystem::newMETRIC();
auto field = *UnitSystem::newFIELD();
auto metric1 = UnitSystem::newMETRIC();
auto metric2 = UnitSystem::newMETRIC();
auto field = UnitSystem::newFIELD();
BOOST_CHECK_EQUAL( metric1, metric1 );
BOOST_CHECK_EQUAL( metric1, metric2 );
@@ -197,12 +197,12 @@ BOOST_AUTO_TEST_CASE(UnitSystemEqual) {
BOOST_AUTO_TEST_CASE(LabUnitConversions) {
using Meas = UnitSystem::measure;
auto lab = std::unique_ptr<UnitSystem>( UnitSystem::newLAB() );
auto lab = UnitSystem::newLAB();
{
const auto furlong = 660*unit::feet;
BOOST_CHECK_CLOSE( 2.01168e4 , lab->from_si( Meas::length , furlong ) , 1.0e-10 );
BOOST_CHECK_CLOSE( furlong , lab->to_si( Meas::length , 2.01168e4 ) , 1.0e-10 );
BOOST_CHECK_CLOSE( 2.01168e4 , lab.from_si( Meas::length , furlong ) , 1.0e-10 );
BOOST_CHECK_CLOSE( furlong , lab.to_si( Meas::length , 2.01168e4 ) , 1.0e-10 );
}
struct Factor { Meas m; double f; };
@@ -215,8 +215,8 @@ BOOST_AUTO_TEST_CASE(LabUnitConversions) {
Factor{ Meas::time , 3600.0 } ,
Factor{ Meas::mass , 1.0e-3 } })
{
BOOST_CHECK_CLOSE( q.f , lab->to_si( q.m , 1.0 ) , 1.0e-10 );
BOOST_CHECK_CLOSE( 1.0 , lab->from_si( q.m , q.f ) , 1.0e-10 );
BOOST_CHECK_CLOSE( q.f , lab.to_si( q.m , 1.0 ) , 1.0e-10 );
BOOST_CHECK_CLOSE( 1.0 , lab.from_si( q.m , q.f ) , 1.0e-10 );
}
}
@@ -224,11 +224,9 @@ BOOST_AUTO_TEST_CASE(LabUnitConversions) {
BOOST_AUTO_TEST_CASE( VectorConvert ) {
std::vector<double> d0 = {1,2,3};
std::vector<double> d1 = {1,2,3};
UnitSystem * units = UnitSystem::newLAB();
UnitSystem units = UnitSystem::newLAB();
units->from_si( UnitSystem::measure::pressure , d0 );
units.from_si( UnitSystem::measure::pressure , d0 );
for (size_t i = 0; i < d1.size(); i++)
BOOST_CHECK_EQUAL( units->from_si( UnitSystem::measure::pressure , d1[i] ) , d0[i]);
delete units;
BOOST_CHECK_EQUAL( units.from_si( UnitSystem::measure::pressure , d1[i] ) , d0[i]);
}