Changes in the loading of restart files.

The main content of this commit is that the loading of restart files is
based on map of keys passed in from calling scope. This way the
selection of keywords to save and load is fully under control of calling
scope, but in addition there are many small refactorings:

 - The EclipseWriter class and implementation has been renamed
   EclipseIO.

 - The loading and saving of restart files has been moved to file and
   namespace RestartIO, which contains two loose functions load( ) and
   save( ).

 - The Summary() and RFT( ) data get their own copies of the data::Cells
   vector.

 - Removed some abstractions and wrrappers around C / ert
   datastructures. Using ecl_file_view when loading restart files,
   instead of bare ecl_file. Simplified opening of unified restart
   files.

 - Removed the ability to save restart keywords in double precision.
This commit is contained in:
Joakim Hove
2017-01-06 14:38:12 +01:00
parent 6ef1d909d9
commit 4d1693d027
15 changed files with 1224 additions and 1097 deletions

View File

@@ -199,7 +199,6 @@ struct setup {
EclipseState es;
SummaryConfig config;
const EclipseGrid& grid;
const out::RegionCache regionCache;
data::Wells wells;
std::string name;
ERT::TestArea ta;
@@ -214,7 +213,6 @@ struct setup {
es( deck, ParseContext() ),
config( deck, es, parseContext ),
grid( es.getInputGrid() ),
regionCache( es , grid ),
wells( result_wells() ),
name( fname ),
ta( ERT::TestArea("test_summary") ),
@@ -239,9 +237,9 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
cfg.name = "PATH/CASE";
out::Summary writer( cfg.es, cfg.config, cfg.grid , cfg.name );
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution);
writer.write();
auto res = readsum( cfg.name );
@@ -375,9 +373,9 @@ BOOST_AUTO_TEST_CASE(group_keywords) {
setup cfg( "test_Summary_group" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution);
writer.write();
auto res = readsum( cfg.name );
@@ -473,9 +471,9 @@ BOOST_AUTO_TEST_CASE(completion_kewords) {
setup cfg( "test_Summary_completion" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution);
writer.write();
auto res = readsum( cfg.name );
@@ -526,9 +524,9 @@ BOOST_AUTO_TEST_CASE(field_keywords) {
setup cfg( "test_Summary_field" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution);
writer.write();
auto res = readsum( cfg.name );
@@ -623,9 +621,9 @@ BOOST_AUTO_TEST_CASE(foe_test) {
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
writer.set_initial( sol );
writer.add_timestep( 1, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 5 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 2, 10 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells , cfg.solution);
writer.write();
auto res = readsum( cfg.name );
@@ -640,9 +638,9 @@ BOOST_AUTO_TEST_CASE(report_steps_time) {
setup cfg( "test_Summary_report_steps_time" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
writer.add_timestep( 1, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 5 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 2, 10 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells , cfg.solution);
writer.write();
auto res = readsum( cfg.name );
@@ -662,9 +660,9 @@ BOOST_AUTO_TEST_CASE(skip_unknown_var) {
setup cfg( "test_Summary_skip_unknown_var" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
writer.add_timestep( 1, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 5 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 2, 10 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells , cfg.solution);
writer.write();
auto res = readsum( cfg.name );
@@ -682,9 +680,9 @@ BOOST_AUTO_TEST_CASE(region_vars) {
{
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
writer.add_timestep( 1, 2 * day, cfg.es, cfg.regionCache, cfg.wells, cfg.solution);
writer.add_timestep( 1, 5 * day, cfg.es, cfg.regionCache, cfg.wells, cfg.solution);
writer.add_timestep( 2, 10 * day, cfg.es, cfg.regionCache, cfg.wells, cfg.solution);
writer.add_timestep( 1, 2 * day, cfg.es, cfg.wells, cfg.solution);
writer.add_timestep( 1, 5 * day, cfg.es, cfg.wells, cfg.solution);
writer.add_timestep( 2, 10 * day, cfg.es, cfg.wells, cfg.solution);
writer.write();
}
@@ -729,9 +727,9 @@ BOOST_AUTO_TEST_CASE(region_production) {
{
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution);
writer.write();
}
@@ -757,9 +755,9 @@ BOOST_AUTO_TEST_CASE(region_injection) {
setup cfg( "region_injection" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution);
writer.write();
auto res = readsum( cfg.name );
@@ -786,9 +784,9 @@ BOOST_AUTO_TEST_CASE(BLOCK_VARIABLES) {
setup cfg( "region_injection" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.name );
writer.add_timestep( 0, 0 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.regionCache, cfg.wells , cfg.solution);
writer.add_timestep( 0, 0 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 1, 1 * day, cfg.es, cfg.wells , cfg.solution);
writer.add_timestep( 2, 2 * day, cfg.es, cfg.wells , cfg.solution);
writer.write();
auto res = readsum( cfg.name );