Use plain C api for temporary testarea

This commit is contained in:
Joakim Hove 2018-09-07 05:45:23 +02:00
parent 085bbc263b
commit 45e81a02fa
3 changed files with 28 additions and 17 deletions

View File

@ -38,7 +38,7 @@
#include <ert/ecl/ecl_util.h>
#include <ert/util/test_work_area.h>
#include <ert/util/util.h>
#include <ert/util/TestArea.hpp>
#include <ert/util/test_work_area.h>
#include <vector>
@ -104,8 +104,8 @@ data::Solution createBlackoilState( int timeStepIdx, int numCells ) {
BOOST_AUTO_TEST_CASE(test_RFT) {
ParseContext parse_context;
std::string eclipse_data_filename = "testrft.DATA";
ERT::TestArea test_area("test_RFT");
test_area.copyFile( eclipse_data_filename );
test_work_area_type * test_area = test_work_area_alloc("test_RFT");
test_work_area_copy_file( test_area, eclipse_data_filename.c_str() );
auto deck = Parser().parseFile( eclipse_data_filename, parse_context );
auto eclipseState = Parser::parse( deck );
@ -162,6 +162,7 @@ BOOST_AUTO_TEST_CASE(test_RFT) {
}
verifyRFTFile("TESTRFT.RFT");
test_work_area_free( test_area );
}
namespace {
@ -191,8 +192,8 @@ void verifyRFTFile2(const std::string& rft_filename) {
BOOST_AUTO_TEST_CASE(test_RFT2) {
ParseContext parse_context;
std::string eclipse_data_filename = "testrft.DATA";
ERT::TestArea test_area("test_RFT");
test_area.copyFile( eclipse_data_filename );
test_work_area_type * test_area = test_work_area_alloc("test_RFT");
test_work_area_copy_file( test_area, eclipse_data_filename.c_str());
auto deck = Parser().parseFile( eclipse_data_filename, parse_context );
auto eclipseState = Parser::parse( deck );
@ -253,4 +254,5 @@ BOOST_AUTO_TEST_CASE(test_RFT2) {
verifyRFTFile2("TESTRFT.RFT");
}
}
test_work_area_free( test_area );
}

View File

@ -46,7 +46,7 @@
#include <ert/ecl/ecl_kw_magic.h>
#include <ert/ecl_well/well_info.h>
#include <ert/ecl_well/well_state.h>
#include <ert/util/TestArea.hpp>
#include <ert/util/test_work_area.h>
using namespace Opm;
@ -418,8 +418,8 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData) {
{"SWAT" , UnitSystem::measure::identity},
{"SGAS" , UnitSystem::measure::identity},
{"TEMP" , UnitSystem::measure::temperature}};
ERT::TestArea testArea("test_Restart");
testArea.copyFile( "FIRST_SIM.DATA" );
test_work_area_type * test_area = test_work_area_alloc("test_restart");
test_work_area_copy_file( test_area, "FIRST_SIM.DATA");
Setup setup("FIRST_SIM.DATA");
EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config);
@ -429,6 +429,7 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData) {
BOOST_CHECK_THROW( second_sim( eclWriter, {{"SOIL", UnitSystem::measure::pressure}} ) , std::runtime_error );
BOOST_CHECK_THROW( second_sim( eclWriter, {{"SOIL", UnitSystem::measure::pressure, true}}) , std::runtime_error );
test_work_area_free( test_area );
}
@ -462,21 +463,22 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData_double) {
std::vector<RestartKey> solution_keys {RestartKey("SWAT", UnitSystem::measure::identity),
RestartKey("SGAS", UnitSystem::measure::identity)};
ERT::TestArea testArea("test_Restart");
testArea.copyFile( "FIRST_SIM.DATA" );
test_work_area_type * test_area = test_work_area_alloc("test_Restart");
test_work_area_copy_file( test_area, "FIRST_SIM.DATA");
Setup setup("FIRST_SIM.DATA");
EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config);
auto state1 = first_sim( setup.es , eclWriter , true);
auto state2 = second_sim( eclWriter , solution_keys );
compare_equal( state1 , state2 , solution_keys);
test_work_area_free( test_area );
}
BOOST_AUTO_TEST_CASE(WriteWrongSOlutionSize) {
Setup setup("FIRST_SIM.DATA");
test_work_area_type * test_area = test_work_area_alloc("test_Restart");
{
ERT::TestArea testArea("test_Restart");
auto num_cells = setup.grid.getNumActive( ) + 1;
auto cells = mkSolution( num_cells );
auto wells = mkWells();
@ -489,6 +491,7 @@ BOOST_AUTO_TEST_CASE(WriteWrongSOlutionSize) {
setup.schedule),
std::runtime_error);
}
test_work_area_free(test_area);
}
@ -514,8 +517,8 @@ BOOST_AUTO_TEST_CASE(ExtraData_KEYS) {
BOOST_AUTO_TEST_CASE(ExtraData_content) {
Setup setup("FIRST_SIM.DATA");
test_work_area_type * test_area = test_work_area_alloc("test_Restart");
{
ERT::TestArea testArea("test_Restart");
auto num_cells = setup.grid.getNumActive( );
auto cells = mkSolution( num_cells );
auto wells = mkWells();
@ -566,13 +569,14 @@ BOOST_AUTO_TEST_CASE(ExtraData_content) {
}
}
}
test_work_area_free(test_area);
}
BOOST_AUTO_TEST_CASE(STORE_THPRES) {
Setup setup("FIRST_SIM_THPRES.DATA");
test_work_area_type * test_area = test_work_area_alloc("test_Restart_THPRES");
{
ERT::TestArea testArea("test_Restart_THPRES");
auto num_cells = setup.grid.getNumActive( );
auto cells = mkSolution( num_cells );
auto wells = mkWells();
@ -632,6 +636,7 @@ BOOST_AUTO_TEST_CASE(STORE_THPRES) {
}
}
test_work_area_free(test_area);
}

View File

@ -28,7 +28,7 @@
#include <ert/ecl/ecl_sum.h>
#include <ert/ecl/smspec_node.h>
#include <ert/util/util.h>
#include <ert/util/TestArea.hpp>
#include <ert/util/test_work_area.h>
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/Summary.hpp>
@ -181,7 +181,7 @@ struct setup {
SummaryConfig config;
data::Wells wells;
std::string name;
ERT::TestArea ta;
test_work_area_type * ta;
/*-----------------------------------------------------------------*/
@ -193,10 +193,14 @@ struct setup {
config( deck, schedule, es.getTableManager(), parseContext ),
wells( result_wells() ),
name( fname ),
ta( ERT::TestArea("test_summary") )
ta( test_work_area_alloc("summary_test"))
{
}
~setup() {
test_work_area_free(this->ta);
}
};
BOOST_AUTO_TEST_SUITE(Summary)