Merge pull request #174 from joakim-hove/double-float-grid
Will temporarily convert double -> float before instantiating an ERT ecl...
This commit is contained in:
commit
72b183b0c6
@ -76,10 +76,10 @@ namespace Opm {
|
||||
DeckKeywordConstPtr ZCORNKeyWord = gridSection->getKeyword("ZCORN");
|
||||
DeckKeywordConstPtr COORDKeyWord = gridSection->getKeyword("COORD");
|
||||
|
||||
const std::vector<float>& zcorn = ZCORNKeyWord->getSIFloatData();
|
||||
const std::vector<float>& coord = COORDKeyWord->getSIFloatData();
|
||||
const int * actnum = NULL;
|
||||
const float * mapaxes = NULL;
|
||||
const std::vector<double>& zcorn = ZCORNKeyWord->getSIDoubleData();
|
||||
const std::vector<double>& coord = COORDKeyWord->getSIDoubleData();
|
||||
const int * actnum = NULL;
|
||||
const double * mapaxes = NULL;
|
||||
|
||||
if (gridSection->hasKeyword("ACTNUM")) {
|
||||
DeckKeywordConstPtr actnumKeyword = gridSection->getKeyword("ACTNUM");
|
||||
@ -89,13 +89,32 @@ namespace Opm {
|
||||
|
||||
if (gridSection->hasKeyword("MAPAXES")) {
|
||||
DeckKeywordConstPtr mapaxesKeyword = gridSection->getKeyword("MAPAXES");
|
||||
const std::vector<float>& mapaxesVector = mapaxesKeyword->getRawFloatData();
|
||||
const std::vector<double>& mapaxesVector = mapaxesKeyword->getSIDoubleData();
|
||||
mapaxes = mapaxesVector.data();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
ecl_grid_type * ecl_grid = ecl_grid_alloc_GRDECL_data(dims[0] , dims[1] , dims[2] , zcorn.data() , coord.data() , actnum , mapaxes);
|
||||
m_grid.reset( ecl_grid , ecl_grid_free);
|
||||
*/
|
||||
{
|
||||
const std::vector<float> zcorn_float( zcorn.begin() , zcorn.end() );
|
||||
const std::vector<float> coord_float( coord.begin() , coord.end() );
|
||||
float * mapaxes_float = NULL;
|
||||
if (mapaxes) {
|
||||
mapaxes_float = new float[6];
|
||||
for (size_t i=0; i < 6; i++)
|
||||
mapaxes_float[i] = mapaxes[i];
|
||||
}
|
||||
|
||||
ecl_grid_type * ecl_grid = ecl_grid_alloc_GRDECL_data(dims[0] , dims[1] , dims[2] , zcorn_float.data() , coord_float.data() , actnum , mapaxes_float);
|
||||
m_grid.reset( ecl_grid , ecl_grid_free);
|
||||
|
||||
if (mapaxes)
|
||||
delete[] mapaxes_float;
|
||||
}
|
||||
|
||||
ecl_grid_type * ecl_grid = ecl_grid_alloc_GRDECL_data(dims[0] , dims[1] , dims[2] , zcorn.data() , coord.data() , actnum , mapaxes);
|
||||
m_grid.reset( ecl_grid , ecl_grid_free);
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,36 +31,33 @@
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Dummy) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateCPGrid) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT.DATA");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
std::shared_ptr<RUNSPECSection> runspecSection(new RUNSPECSection(deck) );
|
||||
std::shared_ptr<GRIDSection> gridSection(new GRIDSection(deck) );
|
||||
std::shared_ptr<EclipseGrid> grid(new EclipseGrid( runspecSection , gridSection ));
|
||||
|
||||
BOOST_CHECK_EQUAL( 10 , grid->getNX( ));
|
||||
BOOST_CHECK_EQUAL( 10 , grid->getNY( ));
|
||||
BOOST_CHECK_EQUAL( 5 , grid->getNZ( ));
|
||||
BOOST_CHECK_EQUAL( 500 , grid->getNumActive() );
|
||||
}
|
||||
|
||||
//BOOST_AUTO_TEST_CASE(CreateCPGrid) {
|
||||
// ParserPtr parser(new Parser());
|
||||
// boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT.DATA");
|
||||
// DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
// std::shared_ptr<RUNSPECSection> runspecSection(new RUNSPECSection(deck) );
|
||||
// std::shared_ptr<GRIDSection> gridSection(new GRIDSection(deck) );
|
||||
// std::shared_ptr<EclipseGrid> grid(new EclipseGrid( runspecSection , gridSection ));
|
||||
|
||||
// BOOST_CHECK_EQUAL( 10 , grid->getNX( ));
|
||||
// BOOST_CHECK_EQUAL( 10 , grid->getNY( ));
|
||||
// BOOST_CHECK_EQUAL( 5 , grid->getNZ( ));
|
||||
// BOOST_CHECK_EQUAL( 500 , grid->getNumActive() );
|
||||
//}
|
||||
BOOST_AUTO_TEST_CASE(CreateCPActnumGrid) {
|
||||
ParserPtr parser(new Parser());
|
||||
boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT_ACTNUM.DATA");
|
||||
DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
std::shared_ptr<RUNSPECSection> runspecSection(new RUNSPECSection(deck) );
|
||||
std::shared_ptr<GRIDSection> gridSection(new GRIDSection(deck) );
|
||||
std::shared_ptr<EclipseGrid> grid(new EclipseGrid( runspecSection , gridSection ));
|
||||
|
||||
|
||||
//BOOST_AUTO_TEST_CASE(CreateCPActnumGrid) {
|
||||
// ParserPtr parser(new Parser());
|
||||
// boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT_ACTNUM.DATA");
|
||||
// DeckPtr deck = parser->parseFile(scheduleFile.string());
|
||||
// std::shared_ptr<RUNSPECSection> runspecSection(new RUNSPECSection(deck) );
|
||||
// std::shared_ptr<GRIDSection> gridSection(new GRIDSection(deck) );
|
||||
// std::shared_ptr<EclipseGrid> grid(new EclipseGrid( runspecSection , gridSection ));
|
||||
|
||||
// BOOST_CHECK_EQUAL( 10 , grid->getNX( ));
|
||||
// BOOST_CHECK_EQUAL( 10 , grid->getNY( ));
|
||||
// BOOST_CHECK_EQUAL( 5 , grid->getNZ( ));
|
||||
// BOOST_CHECK_EQUAL( 100 , grid->getNumActive() );
|
||||
//}
|
||||
BOOST_CHECK_EQUAL( 10 , grid->getNX( ));
|
||||
BOOST_CHECK_EQUAL( 10 , grid->getNY( ));
|
||||
BOOST_CHECK_EQUAL( 5 , grid->getNZ( ));
|
||||
BOOST_CHECK_EQUAL( 100 , grid->getNumActive() );
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{"name" : "MAPAXES" , "size" : 1 , "items" : [
|
||||
{"name" : "X1" , "value_type" : "FLOAT", "dimension" : "Length" },
|
||||
{"name" : "Y1" , "value_type" : "FLOAT", "dimension" : "Length" },
|
||||
{"name" : "X2" , "value_type" : "FLOAT", "dimension" : "Length" },
|
||||
{"name" : "Y2" , "value_type" : "FLOAT", "dimension" : "Length" },
|
||||
{"name" : "X3" , "value_type" : "FLOAT", "dimension" : "Length" },
|
||||
{"name" : "Y3" , "value_type" : "FLOAT", "dimension" : "Length" }]}
|
||||
{"name" : "X1" , "value_type" : "DOUBLE", "dimension" : "Length" },
|
||||
{"name" : "Y1" , "value_type" : "DOUBLE", "dimension" : "Length" },
|
||||
{"name" : "X2" , "value_type" : "DOUBLE", "dimension" : "Length" },
|
||||
{"name" : "Y2" , "value_type" : "DOUBLE", "dimension" : "Length" },
|
||||
{"name" : "X3" , "value_type" : "DOUBLE", "dimension" : "Length" },
|
||||
{"name" : "Y3" , "value_type" : "DOUBLE", "dimension" : "Length" }]}
|
||||
|
Loading…
Reference in New Issue
Block a user