diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake
index 5ab278db..f86e19cc 100644
--- a/CMakeLists_files.cmake
+++ b/CMakeLists_files.cmake
@@ -39,7 +39,6 @@ list (APPEND MAIN_SOURCE_FILES
opm/core/grid/cpgpreprocess/preprocess.c
opm/core/grid/cpgpreprocess/uniquepoints.c
opm/core/io/eclipse/EclipseGridInspector.cpp
- opm/core/io/eclipse/EclipseGridParser.cpp
opm/core/io/eclipse/EclipseWriter.cpp
opm/core/io/eclipse/writeECLData.cpp
opm/core/io/OutputWriter.cpp
@@ -223,15 +222,10 @@ list (APPEND EXAMPLE_SOURCE_FILES
# originally generated with the command:
# find attic -name '*.c*' -printf '\t%p\n' | sort
list (APPEND ATTIC_FILES
- attic/bo_resprop_test.cpp
- attic/pvt_test.cpp
- attic/relperm_test.cpp
attic/test_cfs_tpfa.c
- attic/test_ert.cpp
attic/test_jacsys.cpp
attic/test_lapack.cpp
attic/test_read_grid.c
- attic/test_readpolymer.cpp
attic/test_read_vag.cpp
attic/test_writeVtkData.cpp
)
@@ -261,11 +255,8 @@ list (APPEND PUBLIC_HEADER_FILES
opm/core/grid/cpgpreprocess/uniquepoints.h
opm/core/io/eclipse/CornerpointChopper.hpp
opm/core/io/eclipse/EclipseGridInspector.hpp
- opm/core/io/eclipse/EclipseGridParser.hpp
- opm/core/io/eclipse/EclipseGridParserHelpers.hpp
opm/core/io/eclipse/EclipseUnits.hpp
opm/core/io/eclipse/EclipseWriter.hpp
- opm/core/io/eclipse/SpecialEclipseFields.hpp
opm/core/io/eclipse/writeECLData.hpp
opm/core/io/OutputWriter.hpp
opm/core/io/vag/vag.hpp
diff --git a/attic/bo_resprop_test.cpp b/attic/bo_resprop_test.cpp
deleted file mode 100644
index 98a25306..00000000
--- a/attic/bo_resprop_test.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- Copyright 2012 SINTEF ICT, Applied Mathematics.
-
- This file is part of the Open Porous Media project (OPM).
-
- OPM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OPM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with OPM. If not, see .
-*/
-
-#include "config.h"
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-int main(int argc, char** argv)
-{
- // Parameters.
- Opm::parameter::ParameterGroup param(argc, argv);
-
- // Parser.
- std::string ecl_file = param.get("filename");
- Opm::EclipseGridParser deck(ecl_file);
- UnstructuredGrid grid;
- grid.number_of_cells = 1;
- grid.global_cell = NULL;
- Opm::BlackoilPropertiesFromDeck props(deck, grid, param);
-
- const int n = 1;
- double p[n] = { 150e5 };
- double z[3*n] = { 1.0, 1.0, 1.0 };
- int cells[n] = { 0 };
- double A[9*n];
- props.matrix(n, p, z, cells, A, 0);
- std::copy(A, A + 9, std::ostream_iterator(std::cout, " "));
- std::cout << std::endl;
-}
diff --git a/attic/pvt_test.cpp b/attic/pvt_test.cpp
deleted file mode 100644
index f1963c83..00000000
--- a/attic/pvt_test.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- Copyright 2012 SINTEF ICT, Applied Mathematics.
-
- This file is part of the Open Porous Media project (OPM).
-
- OPM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OPM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with OPM. If not, see .
-*/
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif // HAVE_CONFIG_H
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-int main(int argc, char** argv)
-{
- using namespace std;
- // Parameters.
- Opm::parameter::ParameterGroup param(argc, argv);
-
- // Parser.
- std::string ecl_file = param.get("deck_filename");
- std::string input_file = param.get("input_filename");
- std::string matrix_output = param.get("matrix_output");
- std::string rs_output = param.get("rs_output");
- std::string b_output = param.get("b_output");
- std::string mu_output = param.get("mu_output");
- Opm::EclipseGridParser deck(ecl_file);
- UnstructuredGrid grid;
- grid.number_of_cells = 1;
- grid.global_cell = NULL;
- grid.dimensions = 3;
- grid.cartdims[0] = 1;
- grid.cartdims[1] = 1;
- grid.cartdims[2] = 1;
- Opm::BlackoilPropertiesFromDeck props(deck, grid, param);
- Opm::BlackoilPvtProperties pvt;
- int samples = param.getDefault("dead_tab_size", 1025);
- pvt.init(deck, samples);
-
-
- const int n = 1;
- std::fstream inos(input_file.c_str());
- if(!inos.good()){
- std::cout << "Could not open :" << input_file << std::endl;
- exit(3);
- }
- std::fstream aos(matrix_output.c_str(), std::fstream::out | std::fstream::trunc);
- aos << setiosflags(ios::scientific) << setprecision(12);
- if(!(aos.good())){
- std::cout << "Could not open"<< matrix_output << std::endl;
- exit(3);
- }
- std::fstream bos(b_output.c_str(), std::fstream::out | std::fstream::trunc);
- bos << setiosflags(ios::scientific) << setprecision(12);
- if(!(bos.good())){
- std::cout << "Could not open"<< b_output << std::endl;
- exit(3);
- }
- std::fstream rsos(rs_output.c_str(), std::fstream::out | std::fstream::trunc);
- rsos << setiosflags(ios::scientific) << setprecision(12);
- if(!(rsos.good())){
- std::cout << "Could not open"<< rs_output << std::endl;
- exit(3);
- }
- std::fstream muos(mu_output.c_str(), std::fstream::out | std::fstream::trunc);
- if(!(muos.good())){
- std::cout << "Could not open"<< rs_output << std::endl;
- exit(3);
- }
-
-
-
- const int np = props.numPhases();
- const int max_np = 3;
- if (np > max_np) {
- OPM_THROW(std::runtime_error, "Max #phases is 3.");
- }
- while((inos.good()) && (!inos.eof())){
- double p[n];
- double z[max_np*n];
- int cells[n] = { 0 };
- inos >> p[0];
- for(int i=0; i < np; ++i){
- inos >> z[i];
- }
-
- if(inos.good()){
- double A[max_np*max_np*n];
- double dA[max_np*max_np*n];
- props.matrix(n, p, z, cells, A, dA);
- std::copy(A, A + np*np*n, std::ostream_iterator(aos, " "));
- std::copy(dA, dA + np*np*n, std::ostream_iterator(aos, " "));
- aos << std::endl;
- double mu[max_np];
- //double dmu[max_np];//not implemented
- props.viscosity(n, p, z, cells, mu, 0);
- std::copy(mu, mu + np*n, std::ostream_iterator(muos, " "));
- //std::copy(dmu, dmu + np*n, std::ostream_iterator(muos, " "));
- aos << std::endl;
-
- double b[max_np];
- double dbdp[max_np];
- pvt.dBdp(n, p, z, b, dbdp);
- std::copy(b, b + np*n, std::ostream_iterator(bos, " "));
- std::copy(dbdp, dbdp + np*n, std::ostream_iterator(bos, " "));
- bos << std::endl;
-
- double rs[max_np];
- double drs[max_np];
- //pvt.R(n, p, z, rs);
- pvt.dRdp(n, p, z, rs,drs);
- std::copy(rs, rs + np*n, std::ostream_iterator(rsos, " "));
- std::copy(drs, drs + np*n, std::ostream_iterator(rsos, " "));
- rsos << std::endl;
- }
- }
- if (param.anyUnused()) {
- std::cout << "-------------------- Unused parameters: --------------------\n";
- param.displayUsage();
- std::cout << "----------------------------------------------------------------" << std::endl;
- }
-}
diff --git a/attic/relperm_test.cpp b/attic/relperm_test.cpp
deleted file mode 100644
index b8e7ea9b..00000000
--- a/attic/relperm_test.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- Copyright 2012 SINTEF ICT, Applied Mathematics.
-
- This file is part of the Open Porous Media project (OPM).
-
- OPM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OPM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with OPM. If not, see .
-*/
-
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif // HAVE_CONFIG_H
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-int main(int argc, char** argv)
-{
- // Parameters.
- Opm::parameter::ParameterGroup param(argc, argv);
-
- // Parser.
- std::string ecl_file = param.get("deck_filename");
- std::string input_file = param.get("input_filename");
- std::string relperm_output = param.get("relperm_output");
- //std::string relperm_output = param.get("relperm_outout");
- Opm::EclipseGridParser deck(ecl_file);
- UnstructuredGrid grid;
- grid.number_of_cells = 1;
- grid.global_cell = NULL;
- grid.dimensions = 3;
- grid.cartdims[0] = 1;
- grid.cartdims[1] = 1;
- grid.cartdims[2] = 1;
- Opm::BlackoilPropertiesFromDeck props(deck, grid, param);
-
- std::fstream inos(input_file.c_str());//, std::fstream::in);
- if(!inos.good()){
- std::cout << "Could not open :" << input_file << std::endl;
- exit(3);
- }
- std::fstream kros(relperm_output.c_str(), std::fstream::out | std::fstream::trunc);
- if(!kros.good()){
- std::cout << "Could not open :" << input_file << std::endl;
- exit(3);
- }
- const int np = props.numPhases();
- const int max_np = 3;
- if (np > max_np) {
- OPM_THROW(std::runtime_error, "Max #phases is 3.");
- }
- while((inos.good()) && (!inos.eof())){
- double s[max_np];
- for(int i=0; i < np; ++i){
- inos >> s[i];
- }
- if(inos.good()){
- double kr[max_np];
- double dkr[max_np*max_np];
- int cell[1];
- cell[0]=1;
- props.relperm(1,s, cell, kr, dkr);
- std::copy(s, s + np, std::ostream_iterator(kros, " "));
- kros << " ";
- std::copy(kr, kr + np, std::ostream_iterator(kros, " "));
- kros << " ";
- std::copy(dkr, dkr + np*np, std::ostream_iterator(kros, " "));
- kros << "\n";
- }
- }
- if (param.anyUnused()) {
- std::cout << "-------------------- Unused parameters: --------------------\n";
- param.displayUsage();
- std::cout << "----------------------------------------------------------------" << std::endl;
- }
-}
diff --git a/attic/test_ert.cpp b/attic/test_ert.cpp
deleted file mode 100644
index bdd63431..00000000
--- a/attic/test_ert.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- Copyright 2012 SINTEF ICT, Applied Mathematics.
-
- This file is part of the Open Porous Media project (OPM).
-
- OPM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OPM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with OPM. If not, see .
-*/
-
-
-#include "config.h"
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-#include
-
-#include
-#include
-#include
-
-using namespace std;
-
-#if 0
-static
-void cell_nodes(const UnstructuredGrid * c_grid , int cell , std::vector& nodes) {
- int face_offset = c_grid->cell_facepos[cell];
- int num_faces = c_grid->cell_facepos[cell + 1] - face_offset;
-
- nodes.clear();
- //printf("cell: %d \n",cell);
- for (int iface = 0; iface < num_faces; iface++) {
- int face = c_grid->cell_faces[ face_offset + iface];
- //printf("face[%d] = %d \n",iface , face );
-
- {
- int node_offset = c_grid->face_nodepos[ face ];
- int num_nodes = c_grid->face_nodepos[ face + 1] - node_offset;
- for (int inode = 0; inode < num_nodes; inode++) {
- int node = c_grid->face_nodes[ inode + node_offset ];
- //printf(" node[%d] = %d \n",inode , node);
- nodes.push_back( node );
- }
- }
- }
-
- {
- /*for (int i =0; i < nodes.size(); i++)
- std::cout << nodes[i] << " ";
- std::cout << "\n";
- */
- sort( nodes.begin() , nodes.end());
- /*for (int i =0; i < nodes.size(); i++)
- std::cout << nodes[i] << " ";
- std::cout << "\n";
- */
- unique( nodes.begin() , nodes.end() );
- /*for (int i =0; i < nodes.size(); i++)
- std::cout << nodes[i] << " ";
- std::cout << "\n";
- */
- nodes.resize( 8 );
- /*for (int i =0; i < nodes.size(); i++)
- std::cout << nodes[i] << " ";
- std::cout << "\n";
- */
- }
-}
-#endif
-
-/*
-static
-void eclExport(Opm::GridManager& grid) {
- const UnstructuredGrid * c_grid = grid.c_grid();
-
- printf("dimensions : %d \n",c_grid->dimensions);
- printf("number of cells : %d \n",c_grid->number_of_cells);
- printf("number of nodes : %d \n",c_grid->number_of_nodes);
- printf("number of faces : %d \n",c_grid->number_of_faces);
- printf("length(face_nodes) : %d \n",c_grid->face_nodepos[ c_grid->number_of_faces ]);
- printf("cartdims : %d %d %d \n",
- c_grid->cartdims[0] ,
- c_grid->cartdims[1] ,
- c_grid->cartdims[2]);
-
- printf("global_cell : %d %d %d %d %d\n",
- c_grid->global_cell[0] ,
- c_grid->global_cell[1] ,
- c_grid->global_cell[2] ,
- c_grid->global_cell[3] ,
- c_grid->global_cell[4]);
-
- {
- std::vector nodes;
- cell_nodes( c_grid , 10 , nodes );
- cell_nodes( c_grid , 15 , nodes );
- cell_nodes( c_grid , 20 , nodes );
- cell_nodes( c_grid , 25 , nodes );
- }
-
- {
- ecl_grid_type * ecl_grid;
- int num_coords = c_grid->number_of_cells;
- int coords_size = 4;
- int nx = c_grid->cartdims[0];
- int ny = c_grid->cartdims[1];
- int nz = c_grid->cartdims[2];
-
- int ** coords;
- float ** corners;
- // float * mapaxes = NULL;
- std::vector nodes;
-
- corners = (float **) malloc( num_coords * sizeof * corners );
- coords = (int **) malloc( num_coords * sizeof * coords );
-
- {
- int c;
- for (c=0; c < num_coords; c++) {
- corners[c] = (float *) malloc( 24 * sizeof * corners[c] );
- coords[c] = (int *) malloc( coords_size * sizeof * coords[c] );
- }
-
- for (c=0; c < num_coords; c++) {
- cell_nodes( c_grid , c , nodes );
- for (int p=0; p < 8; p++) {
- int n = nodes[p];
- for (int d=0; d < c_grid->dimensions; d++)
- corners[c][3*p + d] = c_grid->node_coordinates[ c_grid->dimensions * n + d ];
- }
-
- {
- int i,j,k;
- {
- int g = c_grid->global_cell[ c ];
- k = g / nx*ny; g -= k * nx*ny;
- j = g / nx; g -= j * nx;
- i = g;
- }
-
- coords[c][0] = i + 1;
- coords[c][1] = j + 1;
- coords[c][2] = k + 1;
- coords[c][3] = c_grid->global_cell[ c ] + 1;
- }
- }
- }
-
- ecl_grid = ecl_grid_alloc( "/private/joaho/ERT/NR/libenkf/src/Gurbat/EXAMPLE_01_BASE.EGRID" );
- printf("Grid loaded ... \n");
- ecl_grid_free( ecl_grid );
-
- printf("Grid discarded ... \n");
-
- ecl_grid = ecl_grid_alloc_GRID_data( num_coords , nx , ny , nz , coords_size , coords , corners , NULL );
- ecl_grid_fwrite_GRID( ecl_grid , "/tmp/test.GRID" );
-
- {
- FILE * stream = fopen( "/tmp/test.grdecl" , "w");
- ecl_grid_fprintf_grdecl( ecl_grid , stream );
- fclose( stream );
- }
-
- ecl_grid_free( ecl_grid );
-
- {
- for (int c=0; c < num_coords; c++) {
- free(corners[c]);
- free(coords[c]);
- }
- }
- free( corners );
- free( coords );
- }
-}
-*/
-
-
-/*
-
- #ifdef HAVE_ERT
-ecl_grid_type * create_ecl_grid( const struct UnstructuredGrid * g) {
- int num_coords = g->number_of_cells;
- int nx = g->cartdims[0];
- int ny = g->cartdims[1];
- int nz = g->cartdims[2];
- int coords_size = 4;
- int ** coords;
- float ** corners;
- float * mapaxes = NULL;
-
- corners = malloc( num_coords * sizeof * corners );
- coords = malloc( num_coords * sizeof * coords );
-
- {
- for (int c=0; c < num_coords; c++) {
- corners[c] = malloc( 24 * sizeof * corners[0] );
- coords[c] = malloc( coords_size * sizeof * coords[0] );
- }
- }
-
- {
- for (int k=0; k < nz; k++) {
- for (int j=0; j < ny; j++) {
- for (int i=0; i < nx; i++) {
- int global_index = i + j*nx + k*nx*ny;
-
- coords[global_index][0] = i;
- coords[global_index][1] = j;
- coords[global_index][2] = k;
- coords[global_index][3] = 1;
-
- }
- }
- }
- }
- {
- for (int c=0; c < num_coords; c++) {
- free(corners[c]);
- free(coords[c]);
- }
- }
- free( corners );
- free( coords );
-}
-#endif
-
-
- */
-
-// struct grdecl : opm/core/grid/cpgpreprocess/preprocess.h
-// struct processes_grid : opm/core/grid/cpgpreprocess/preprocess.h
-
-
-
-int main(int /*argc*/ , char **argv)
-{
- std::string filename( argv[1] );
- const std::unique_ptr grid;
- const std::unique_ptr props;
- Opm::EclipseGridParser eclParser(filename , false);
-
- //eclParser.saveEGRID_INIT("/tmp" , "OPM" );
-
- grid.reset(new Opm::GridManager(eclParser));
-
- props.reset(new Opm::IncompPropertiesFromDeck(eclParser , *grid->c_grid()));
-}
diff --git a/attic/test_readpolymer.cpp b/attic/test_readpolymer.cpp
deleted file mode 100644
index ac045a34..00000000
--- a/attic/test_readpolymer.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-//===========================================================================
-//
-// File: test_readpolymer.cpp
-//
-// Created: Thu Jan 12 15:18:46 2012
-//
-// Author: Bjørn Spjelkavik
-//
-// Revision: $Id$
-//
-//===========================================================================
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include
-
-#include
-
-// Test program for reading Eclipse Polymer keywords.
-
-int main(int argc, char** argv)
-{
- using namespace std;
-
- std::string ecl_filename;
- if (argc == 2) {
- ecl_filename = argv[1];
- } else {
- std::cout << "\nUsage: test_readpolymer filename.grdecl\n";
- exit( 1 );
- }
-
-
- bool convert_to_SI = true;
- Opm::EclipseGridParser parser(ecl_filename, convert_to_SI);
-
- std::cout << "\n Polymer fields\n\n";
-
- if (parser.hasField("PLYVISC")) {
- parser.getPLYVISC().write(std::cout);
- }
- if (parser.hasField("PLYROCK")) {
- parser.getPLYROCK().write(std::cout);
- }
- if (parser.hasField("PLYADS")) {
- parser.getPLYADS().write(std::cout);
- }
- if (parser.hasField("TLMIXPAR")) {
- parser.getTLMIXPAR().write(std::cout);
- }
- if (parser.hasField("PLYMAX")) {
- parser.getPLYMAX().write(std::cout);
- }
- if (parser.hasField("WPOLYMER")) {
- parser.getWPOLYMER().write(std::cout);
- }
-
-}
-
-
diff --git a/examples/compute_tof.cpp b/examples/compute_tof.cpp
index 95d6cfe6..8ad1fda0 100644
--- a/examples/compute_tof.cpp
+++ b/examples/compute_tof.cpp
@@ -104,7 +104,7 @@ try
// If we have a "deck_filename", grid and props will be read from that.
bool use_deck = param.has("deck_filename");
- Opm::DeckConstPtr newParserDeck;
+ Opm::DeckConstPtr deck;
std::unique_ptr grid;
std::unique_ptr props;
std::unique_ptr wells;
@@ -115,22 +115,22 @@ try
if (use_deck) {
std::string deck_filename = param.get("deck_filename");
Opm::ParserPtr parser(new Opm::Parser());
- newParserDeck = parser->parseFile(deck_filename);
- Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(newParserDeck));
+ deck = parser->parseFile(deck_filename);
+ Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck));
// Grid init
- grid.reset(new GridManager(newParserDeck));
+ grid.reset(new GridManager(deck));
// Rock and fluid init
- props.reset(new IncompPropertiesFromDeck(newParserDeck, *grid->c_grid()));
+ props.reset(new IncompPropertiesFromDeck(deck, *grid->c_grid()));
// Wells init.
wells.reset(new Opm::WellsManager(eclipseState , 0 , *grid->c_grid(), props->permeability()));
// Gravity.
- gravity[2] = newParserDeck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
+ gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
// Init state variables (saturation and pressure).
if (param.has("init_saturation")) {
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
} else {
- initStateFromDeck(*grid->c_grid(), *props, newParserDeck, gravity[2], state);
+ initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], state);
}
} else {
// Grid init.
diff --git a/examples/sim_2p_comp_reorder.cpp b/examples/sim_2p_comp_reorder.cpp
index 9ce2270e..cd38b4b6 100644
--- a/examples/sim_2p_comp_reorder.cpp
+++ b/examples/sim_2p_comp_reorder.cpp
@@ -90,7 +90,7 @@ try
std::unique_ptr rock_comp;
ParserPtr parser(new Opm::Parser());
- Opm::DeckConstPtr newParserDeck;
+ Opm::DeckConstPtr deck;
BlackoilState state;
// bool check_well_controls = false;
@@ -98,24 +98,24 @@ try
double gravity[3] = { 0.0 };
if (use_deck) {
std::string deck_filename = param.get("deck_filename");
- newParserDeck = parser->parseFile(deck_filename);
+ deck = parser->parseFile(deck_filename);
- eclipseState.reset(new EclipseState(newParserDeck));
+ eclipseState.reset(new EclipseState(deck));
// Grid init
- grid.reset(new GridManager(newParserDeck));
+ grid.reset(new GridManager(deck));
// Rock and fluid init
- props.reset(new BlackoilPropertiesFromDeck(newParserDeck, *grid->c_grid(), param));
+ props.reset(new BlackoilPropertiesFromDeck(deck, *grid->c_grid(), param));
// check_well_controls = param.getDefault("check_well_controls", false);
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
// Rock compressibility.
- rock_comp.reset(new RockCompressibility(newParserDeck));
+ rock_comp.reset(new RockCompressibility(deck));
// Gravity.
- gravity[2] = newParserDeck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
+ gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
// Init state variables (saturation and pressure).
if (param.has("init_saturation")) {
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
} else {
- initStateFromDeck(*grid->c_grid(), *props, newParserDeck, gravity[2], state);
+ initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], state);
}
initBlackoilSurfvol(*grid->c_grid(), *props, state);
} else {
@@ -225,7 +225,7 @@ try
int step = 0;
SimulatorTimer simtimer;
// Use timer for last epoch to obtain total time.
- Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
+ Opm::TimeMapPtr timeMap(new Opm::TimeMap(deck));
simtimer.init(timeMap);
const double total_time = simtimer.totalTime();
for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) {
diff --git a/examples/sim_2p_incomp.cpp b/examples/sim_2p_incomp.cpp
index cf1efe99..2550662d 100644
--- a/examples/sim_2p_incomp.cpp
+++ b/examples/sim_2p_incomp.cpp
@@ -100,7 +100,7 @@ try
bool use_deck = param.has("deck_filename");
EclipseStateConstPtr eclipseState;
- Opm::DeckConstPtr newParserDeck;
+ Opm::DeckConstPtr deck;
std::unique_ptr grid;
std::unique_ptr props;
std::unique_ptr rock_comp;
@@ -112,23 +112,23 @@ try
ParserPtr parser(new Opm::Parser());
std::string deck_filename = param.get("deck_filename");
- newParserDeck = parser->parseFile(deck_filename);
- eclipseState.reset( new EclipseState(newParserDeck));
+ deck = parser->parseFile(deck_filename);
+ eclipseState.reset( new EclipseState(deck));
// Grid init
- grid.reset(new GridManager(newParserDeck));
+ grid.reset(new GridManager(deck));
// Rock and fluid init
- props.reset(new IncompPropertiesFromDeck(newParserDeck, *grid->c_grid()));
+ props.reset(new IncompPropertiesFromDeck(deck, *grid->c_grid()));
// check_well_controls = param.getDefault("check_well_controls", false);
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
// Rock compressibility.
- rock_comp.reset(new RockCompressibility(newParserDeck));
+ rock_comp.reset(new RockCompressibility(deck));
// Gravity.
- gravity[2] = newParserDeck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
+ gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
// Init state variables (saturation and pressure).
if (param.has("init_saturation")) {
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
} else {
- initStateFromDeck(*grid->c_grid(), *props, newParserDeck, gravity[2], state);
+ initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], state);
}
} else {
// Grid init.
@@ -214,7 +214,7 @@ try
param.writeParam(output_dir + "/simulation.param");
}
- Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
+ Opm::TimeMapPtr timeMap(new Opm::TimeMap(deck));
std::cout << "\n\n================ Starting main simulation loop ===============\n"
<< " (number of report steps: "
diff --git a/examples/wells_example.cpp b/examples/wells_example.cpp
index ea8db46f..f2874800 100644
--- a/examples/wells_example.cpp
+++ b/examples/wells_example.cpp
@@ -35,16 +35,16 @@ try
// Read input file
Opm::ParserPtr parser(new Opm::Parser());
- Opm::DeckConstPtr newParserDeck = parser->parseFile(file_name);
+ Opm::DeckConstPtr deck = parser->parseFile(file_name);
std::cout << "Done!" << std::endl;
// Setup grid
- GridManager grid(newParserDeck);
+ GridManager grid(deck);
// Define rock and fluid properties
- IncompPropertiesFromDeck incomp_properties(newParserDeck, *grid.c_grid());
- RockCompressibility rock_comp(newParserDeck);
- EclipseStateConstPtr eclipseState(new Opm::EclipseState(newParserDeck));
+ IncompPropertiesFromDeck incomp_properties(deck, *grid.c_grid());
+ RockCompressibility rock_comp(deck);
+ EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck));
// Finally handle the wells
WellsManager wells(eclipseState , 0 , *grid.c_grid(), incomp_properties.permeability());
@@ -76,7 +76,7 @@ try
Opm::TwophaseState state;
- initStateFromDeck(*grid.c_grid(), incomp_properties, newParserDeck, gravity[2], state);
+ initStateFromDeck(*grid.c_grid(), incomp_properties, deck, gravity[2], state);
Opm::WellState well_state;
well_state.init(wells.c_wells(), state);
diff --git a/opm/core/doxygen_main.hpp b/opm/core/doxygen_main.hpp
index a757ae4f..bfd4deeb 100644
--- a/opm/core/doxygen_main.hpp
+++ b/opm/core/doxygen_main.hpp
@@ -48,7 +48,7 @@ creation and destruction of an UnstructuredGrid. The method
Opm::GridManager::c_grid() provides access to the underlying
UnstructuredGrid structure. This class also provides an easy way
to initialize a grid from an ECLIPSE-format input deck, via the
-constructor taking an Opm::EclipseGridParser.
+constructor taking an Opm::DeckConstPtr.
Well handling
@@ -109,7 +109,7 @@ There are two simulator programs for two-phase immiscible flow in opm-core:
Various utilities
Utilities contained in opm-core include:
-- IO utilities (Opm::EclipseGridParser, binary I/O via the ERT library, vtk output)
+- IO utilities (binary output via the ERT library, vtk output)
- Interpolation utilities (Opm::MonotCubicInterpolator, Opm::VelocityInterpolationECVI)
- Support for SI and non-SI units (Opm::unit and Opm::prefix)
- Low-order quadratures for general geometries (Opm::CellQuadrature, Opm::FaceQuadrature)
diff --git a/opm/core/grid/GridManager.cpp b/opm/core/grid/GridManager.cpp
index bcaaa1a6..e78dcfdd 100644
--- a/opm/core/grid/GridManager.cpp
+++ b/opm/core/grid/GridManager.cpp
@@ -20,10 +20,10 @@
#include "config.h"
#include
-#include
#include
#include
#include
+#include
#include
#include
@@ -32,30 +32,6 @@
namespace Opm
{
/// Construct a 3d corner-point grid from a deck.
- GridManager::GridManager(const Opm::EclipseGridParser& deck)
- {
- // We accept two different ways to specify the grid.
- // 1. Corner point format.
- // Requires ZCORN, COORDS, DIMENS or SPECGRID, optionally
- // ACTNUM, optionally MAPAXES.
- // For this format, we will verify that DXV, DYV, DZV,
- // DEPTHZ and TOPS are not present.
- // 2. Tensor grid format.
- // Requires DXV, DYV, DZV, optionally DEPTHZ or TOPS.
- // For this format, we will verify that ZCORN, COORDS
- // and ACTNUM are not present.
- // Note that for TOPS, we only allow a uniform vector of values.
-
- if (deck.hasField("ZCORN") && deck.hasField("COORD")) {
- initFromDeckCornerpoint(deck);
- } else if (deck.hasField("DXV") && deck.hasField("DYV") && deck.hasField("DZV")) {
- initFromDeckTensorgrid(deck);
- } else {
- OPM_THROW(std::runtime_error, "Could not initialize grid from deck. "
- "Need either ZCORN + COORD or DXV + DYV + DZV keywords.");
- }
- }
-
GridManager::GridManager(Opm::EclipseGridConstPtr eclipseGrid) {
struct grdecl g;
std::vector actnum;
@@ -84,8 +60,7 @@ namespace Opm
}
- /// Construct a 3d corner-point grid from a deck.
- GridManager::GridManager(Opm::DeckConstPtr newParserDeck)
+ GridManager::GridManager(Opm::DeckConstPtr deck)
{
// We accept two different ways to specify the grid.
// 1. Corner point format.
@@ -99,10 +74,10 @@ namespace Opm
// and ACTNUM are not present.
// Note that for TOPS, we only allow a uniform vector of values.
- if (newParserDeck->hasKeyword("ZCORN") && newParserDeck->hasKeyword("COORD")) {
- initFromDeckCornerpoint(newParserDeck);
- } else if (newParserDeck->hasKeyword("DXV") && newParserDeck->hasKeyword("DYV") && newParserDeck->hasKeyword("DZV")) {
- initFromDeckTensorgrid(newParserDeck);
+ if (deck->hasKeyword("ZCORN") && deck->hasKeyword("COORD")) {
+ initFromDeckCornerpoint(deck);
+ } else if (deck->hasKeyword("DXV") && deck->hasKeyword("DYV") && deck->hasKeyword("DZV")) {
+ initFromDeckTensorgrid(deck);
} else {
OPM_THROW(std::runtime_error, "Could not initialize grid from deck. "
"Need either ZCORN + COORD or DXV + DYV + DZV keywords.");
@@ -165,11 +140,6 @@ namespace Opm
}
}
- void GridManager::saveEGRID(const std::string& filename , const Opm::EclipseGridParser& deck) {
- deck.saveEGRID( filename , ug_->number_of_cells , ug_->global_cell );
- }
-
-
/// Destructor.
GridManager::~GridManager()
{
@@ -187,28 +157,13 @@ namespace Opm
return ug_;
}
-
// Construct corner-point grid from deck.
- void GridManager::initFromDeckCornerpoint(const Opm::EclipseGridParser& deck)
- {
- // Extract data from deck.
- // Collect in input struct for preprocessing.
- struct grdecl grdecl = deck.get_grdecl();
-
- // Process grid.
- ug_ = create_grid_cornerpoint(&grdecl, 0.0);
- if (!ug_) {
- OPM_THROW(std::runtime_error, "Failed to construct grid.");
- }
- }
-
- // Construct corner-point grid from deck.
- void GridManager::initFromDeckCornerpoint(Opm::DeckConstPtr newParserDeck)
+ void GridManager::initFromDeckCornerpoint(Opm::DeckConstPtr deck)
{
// Extract data from deck.
// Collect in input struct for preprocessing.
struct grdecl grdecl;
- createGrdecl(newParserDeck, grdecl);
+ createGrdecl(deck, grdecl);
// Process grid.
ug_ = create_grid_cornerpoint(&grdecl, 0.0);
@@ -217,24 +172,24 @@ namespace Opm
}
}
- void GridManager::createGrdecl(Opm::DeckConstPtr newParserDeck, struct grdecl &grdecl)
+ void GridManager::createGrdecl(Opm::DeckConstPtr deck, struct grdecl &grdecl)
{
// Extract data from deck.
- const std::vector& zcorn = newParserDeck->getKeyword("ZCORN")->getSIDoubleData();
- const std::vector& coord = newParserDeck->getKeyword("COORD")->getSIDoubleData();
+ const std::vector& zcorn = deck->getKeyword("ZCORN")->getSIDoubleData();
+ const std::vector& coord = deck->getKeyword("COORD")->getSIDoubleData();
const int* actnum = NULL;
- if (newParserDeck->hasKeyword("ACTNUM")) {
- actnum = &(newParserDeck->getKeyword("ACTNUM")->getIntData()[0]);
+ if (deck->hasKeyword("ACTNUM")) {
+ actnum = &(deck->getKeyword("ACTNUM")->getIntData()[0]);
}
std::array dims;
- if (newParserDeck->hasKeyword("DIMENS")) {
- Opm::DeckKeywordConstPtr dimensKeyword = newParserDeck->getKeyword("DIMENS");
+ if (deck->hasKeyword("DIMENS")) {
+ Opm::DeckKeywordConstPtr dimensKeyword = deck->getKeyword("DIMENS");
dims[0] = dimensKeyword->getRecord(0)->getItem(0)->getInt(0);
dims[1] = dimensKeyword->getRecord(0)->getItem(1)->getInt(0);
dims[2] = dimensKeyword->getRecord(0)->getItem(2)->getInt(0);
- } else if (newParserDeck->hasKeyword("SPECGRID")) {
- Opm::DeckKeywordConstPtr specgridKeyword = newParserDeck->getKeyword("SPECGRID");
+ } else if (deck->hasKeyword("SPECGRID")) {
+ Opm::DeckKeywordConstPtr specgridKeyword = deck->getKeyword("SPECGRID");
dims[0] = specgridKeyword->getRecord(0)->getItem(0)->getInt(0);
dims[1] = specgridKeyword->getRecord(0)->getItem(1)->getInt(0);
dims[2] = specgridKeyword->getRecord(0)->getItem(2)->getInt(0);
@@ -251,8 +206,8 @@ namespace Opm
grdecl.dims[1] = dims[1];
grdecl.dims[2] = dims[2];
- if (newParserDeck->hasKeyword("MAPAXES")) {
- Opm::DeckKeywordConstPtr mapaxesKeyword = newParserDeck->getKeyword("MAPAXES");
+ if (deck->hasKeyword("MAPAXES")) {
+ Opm::DeckKeywordConstPtr mapaxesKeyword = deck->getKeyword("MAPAXES");
Opm::DeckRecordConstPtr mapaxesRecord = mapaxesKeyword->getRecord(0);
// memleak alert: here we need to make sure that C code
@@ -280,82 +235,17 @@ namespace Opm
} // anonymous namespace
- // Construct tensor grid from deck.
- void GridManager::initFromDeckTensorgrid(const Opm::EclipseGridParser& deck)
- {
- // Extract logical cartesian size.
- std::vector dims;
- if (deck.hasField("DIMENS")) {
- dims = deck.getIntegerValue("DIMENS");
- } else if (deck.hasField("SPECGRID")) {
- dims = deck.getSPECGRID().dimensions;
- } else {
- OPM_THROW(std::runtime_error, "Deck must have either DIMENS or SPECGRID.");
- }
-
- // Extract coordinates (or offsets from top, in case of z).
- const std::vector& dxv = deck.getFloatingPointValue("DXV");
- const std::vector& dyv = deck.getFloatingPointValue("DYV");
- const std::vector& dzv = deck.getFloatingPointValue("DZV");
- std::vector x = coordsFromDeltas(dxv);
- std::vector y = coordsFromDeltas(dyv);
- std::vector z = coordsFromDeltas(dzv);
-
- // Check that number of cells given are consistent with DIMENS/SPECGRID.
- if (dims[0] != int(dxv.size())) {
- OPM_THROW(std::runtime_error, "Number of DXV data points do not match DIMENS or SPECGRID.");
- }
- if (dims[1] != int(dyv.size())) {
- OPM_THROW(std::runtime_error, "Number of DYV data points do not match DIMENS or SPECGRID.");
- }
- if (dims[2] != int(dzv.size())) {
- OPM_THROW(std::runtime_error, "Number of DZV data points do not match DIMENS or SPECGRID.");
- }
-
- // Extract top corner depths, if available.
- const double* top_depths = 0;
- std::vector top_depths_vec;
- if (deck.hasField("DEPTHZ")) {
- const std::vector& depthz = deck.getFloatingPointValue("DEPTHZ");
- if (depthz.size() != x.size()*y.size()) {
- OPM_THROW(std::runtime_error, "Incorrect size of DEPTHZ: " << depthz.size());
- }
- top_depths = &depthz[0];
- } else if (deck.hasField("TOPS")) {
- // We only support constant values for TOPS.
- // It is not 100% clear how we best can deal with
- // varying TOPS (stair-stepping grid, or not).
- const std::vector& tops = deck.getFloatingPointValue("TOPS");
- if (std::count(tops.begin(), tops.end(), tops[0]) != int(tops.size())) {
- OPM_THROW(std::runtime_error, "We do not support nonuniform TOPS, please use ZCORN/COORDS instead.");
- }
- top_depths_vec.resize(x.size()*y.size(), tops[0]);
- top_depths = &top_depths_vec[0];
- } else {
- OPM_THROW(std::runtime_error,
- "Could not find either TOPS or DEPTHZ keyword, "
- "one of them is required for initialization with DXV/DYV/DZV.");
- }
-
- // Construct grid.
- ug_ = create_grid_tensor3d(dxv.size(), dyv.size(), dzv.size(),
- &x[0], &y[0], &z[0], top_depths);
- if (!ug_) {
- OPM_THROW(std::runtime_error, "Failed to construct grid.");
- }
- }
-
- void GridManager::initFromDeckTensorgrid(Opm::DeckConstPtr newParserDeck)
+ void GridManager::initFromDeckTensorgrid(Opm::DeckConstPtr deck)
{
// Extract logical cartesian size.
std::array dims;
- if (newParserDeck->hasKeyword("DIMENS")) {
- Opm::DeckKeywordConstPtr dimensKeyword = newParserDeck->getKeyword("DIMENS");
+ if (deck->hasKeyword("DIMENS")) {
+ Opm::DeckKeywordConstPtr dimensKeyword = deck->getKeyword("DIMENS");
dims[0] = dimensKeyword->getRecord(0)->getItem(0)->getInt(0);
dims[1] = dimensKeyword->getRecord(0)->getItem(1)->getInt(0);
dims[2] = dimensKeyword->getRecord(0)->getItem(2)->getInt(0);
- } else if (newParserDeck->hasKeyword("SPECGRID")) {
- Opm::DeckKeywordConstPtr specgridKeyword = newParserDeck->getKeyword("SPECGRID");
+ } else if (deck->hasKeyword("SPECGRID")) {
+ Opm::DeckKeywordConstPtr specgridKeyword = deck->getKeyword("SPECGRID");
dims[0] = specgridKeyword->getRecord(0)->getItem(0)->getInt(0);
dims[1] = specgridKeyword->getRecord(0)->getItem(1)->getInt(0);
dims[2] = specgridKeyword->getRecord(0)->getItem(2)->getInt(0);
@@ -364,9 +254,9 @@ namespace Opm
}
// Extract coordinates (or offsets from top, in case of z).
- const std::vector& dxv = newParserDeck->getKeyword("DXV")->getSIDoubleData();
- const std::vector& dyv = newParserDeck->getKeyword("DYV")->getSIDoubleData();
- const std::vector& dzv = newParserDeck->getKeyword("DZV")->getSIDoubleData();
+ const std::vector& dxv = deck->getKeyword("DXV")->getSIDoubleData();
+ const std::vector& dyv = deck->getKeyword("DYV")->getSIDoubleData();
+ const std::vector& dzv = deck->getKeyword("DZV")->getSIDoubleData();
std::vector x = coordsFromDeltas(dxv);
std::vector y = coordsFromDeltas(dyv);
std::vector z = coordsFromDeltas(dzv);
@@ -385,17 +275,17 @@ namespace Opm
// Extract top corner depths, if available.
const double* top_depths = 0;
std::vector top_depths_vec;
- if (newParserDeck->hasKeyword("DEPTHZ")) {
- const std::vector& depthz = newParserDeck->getKeyword("DEPTHZ")->getSIDoubleData();
+ if (deck->hasKeyword("DEPTHZ")) {
+ const std::vector& depthz = deck->getKeyword("DEPTHZ")->getSIDoubleData();
if (depthz.size() != x.size()*y.size()) {
OPM_THROW(std::runtime_error, "Incorrect size of DEPTHZ: " << depthz.size());
}
top_depths = &depthz[0];
- } else if (newParserDeck->hasKeyword("TOPS")) {
+ } else if (deck->hasKeyword("TOPS")) {
// We only support constant values for TOPS.
// It is not 100% clear how we best can deal with
// varying TOPS (stair-stepping grid, or not).
- const std::vector& tops = newParserDeck->getKeyword("TOPS")->getSIDoubleData();
+ const std::vector& tops = deck->getKeyword("TOPS")->getSIDoubleData();
if (std::count(tops.begin(), tops.end(), tops[0]) != int(tops.size())) {
OPM_THROW(std::runtime_error, "We do not support nonuniform TOPS, please use ZCORN/COORDS instead.");
}
diff --git a/opm/core/grid/GridManager.hpp b/opm/core/grid/GridManager.hpp
index bc82ef38..6cc5b85b 100644
--- a/opm/core/grid/GridManager.hpp
+++ b/opm/core/grid/GridManager.hpp
@@ -30,9 +30,6 @@ struct grdecl;
namespace Opm
{
-
- class EclipseGridParser;
-
/// This class manages an Opm::UnstructuredGrid in the sense that it
/// encapsulates creation and destruction of the grid.
/// The following grid types can be constructed:
@@ -45,10 +42,7 @@ namespace Opm
{
public:
/// Construct a 3d corner-point grid or tensor grid from a deck.
- explicit GridManager(const Opm::EclipseGridParser& deck);
-
- /// Construct a 3d corner-point grid or tensor grid from a deck.
- explicit GridManager(Opm::DeckConstPtr newParserDeck);
+ explicit GridManager(Opm::DeckConstPtr deck);
/// Construct a grid from an EclipseState::EclipseGrid instance
explicit GridManager(Opm::EclipseGridConstPtr eclipseGrid);
@@ -74,14 +68,12 @@ namespace Opm
/// Destructor.
~GridManager();
- void saveEGRID(const std::string& filename , const Opm::EclipseGridParser& deck);
-
/// Access the managed UnstructuredGrid.
/// The method is named similarly to c_str() in std::string,
/// to make it clear that we are returning a C-compatible struct.
const UnstructuredGrid* c_grid() const;
- static void createGrdecl(Opm::DeckConstPtr newParserDeck, struct grdecl &grdecl);
+ static void createGrdecl(Opm::DeckConstPtr deck, struct grdecl &grdecl);
private:
// Disable copying and assignment.
@@ -89,11 +81,9 @@ namespace Opm
GridManager& operator=(const GridManager& other);
// Construct corner-point grid from deck.
- void initFromDeckCornerpoint(const Opm::EclipseGridParser& deck);
- void initFromDeckCornerpoint(Opm::DeckConstPtr newParserDeck);
+ void initFromDeckCornerpoint(Opm::DeckConstPtr deck);
// Construct tensor grid from deck.
- void initFromDeckTensorgrid(const Opm::EclipseGridParser& deck);
- void initFromDeckTensorgrid(Opm::DeckConstPtr newParserDeck);
+ void initFromDeckTensorgrid(Opm::DeckConstPtr deck);
// The managed UnstructuredGrid.
UnstructuredGrid* ug_;
diff --git a/opm/core/io/eclipse/CornerpointChopper.hpp b/opm/core/io/eclipse/CornerpointChopper.hpp
index 9c6ec743..c6aaa435 100644
--- a/opm/core/io/eclipse/CornerpointChopper.hpp
+++ b/opm/core/io/eclipse/CornerpointChopper.hpp
@@ -20,7 +20,6 @@
#ifndef OPM_CORNERPOINTCHOPPER_HEADER_INCLUDED
#define OPM_CORNERPOINTCHOPPER_HEADER_INCLUDED
-#include
#include
#include
#include
@@ -44,7 +43,6 @@ namespace Opm
{
public:
CornerPointChopper(const std::string& file)
- : parser_(file, false)
{
Opm::ParserPtr parser(new Opm::Parser());
deck_ = parser->parseFile(file);
@@ -258,38 +256,6 @@ namespace Opm
filterIntegerField("SATNUM", new_SATNUM_);
}
-
-
- /// Return a subparser with fields corresponding to the selected subset.
- /// Note that the returned parser is NOT converted to SI, that must be done
- /// by the user afterwards with the parser's convertToSI() method.
- EclipseGridParser subparser()
- {
- if (parser_.hasField("FIELD") || parser_.hasField("LAB") || parser_.hasField("PVT-M")) {
- OPM_THROW(std::runtime_error, "CornerPointChopper::subparser() cannot handle any eclipse unit system other than METRIC.");
- }
-
- EclipseGridParser sp;
- std::shared_ptr sg(new SPECGRID);
- for (int dd = 0; dd < 3; ++dd) {
- sg->dimensions[dd] = new_dims_[dd];
- }
- sp.setSpecialField("SPECGRID", sg);
- sp.setFloatingPointField("COORD", new_COORD_);
- sp.setFloatingPointField("ZCORN", new_ZCORN_);
- if (!new_ACTNUM_.empty()) sp.setIntegerField("ACTNUM", new_ACTNUM_);
- if (!new_PORO_.empty()) sp.setFloatingPointField("PORO", new_PORO_);
- if (!new_NTG_.empty()) sp.setFloatingPointField("NTG", new_NTG_);
- if (!new_SWCR_.empty()) sp.setFloatingPointField("SWCR", new_SWCR_);
- if (!new_SOWCR_.empty()) sp.setFloatingPointField("SOWCR", new_SOWCR_);
- if (!new_PERMX_.empty()) sp.setFloatingPointField("PERMX", new_PERMX_);
- if (!new_PERMY_.empty()) sp.setFloatingPointField("PERMY", new_PERMY_);
- if (!new_PERMZ_.empty()) sp.setFloatingPointField("PERMZ", new_PERMZ_);
- if (!new_SATNUM_.empty()) sp.setIntegerField("SATNUM", new_SATNUM_);
- sp.computeUnits(); // Always METRIC, since that is default.
- return sp;
- }
-
/// Return a sub-deck with fields corresponding to the selected subset.
Opm::DeckConstPtr subDeck()
{
@@ -319,7 +285,6 @@ namespace Opm
specGridKw->addRecord(specGridRecord);
subDeck->addKeyword(specGridKw);
-
addDoubleKeyword_(subDeck, "COORD", /*dimension=*/"Length", new_COORD_);
addDoubleKeyword_(subDeck, "ZCORN", /*dimension=*/"Length", new_ZCORN_);
addIntKeyword_(subDeck, "ACTNUM", new_ACTNUM_);
@@ -331,10 +296,8 @@ namespace Opm
addDoubleKeyword_(subDeck, "PERMY", /*dimension=*/"Permeability", new_PERMY_);
addDoubleKeyword_(subDeck, "PERMZ", /*dimension=*/"Permeability", new_PERMZ_);
addIntKeyword_(subDeck, "SATNUM", new_SATNUM_);
-
return subDeck;
}
-
void writeGrdecl(const std::string& filename)
{
// Output new versions of SPECGRID, COORD, ZCORN, ACTNUM, PERMX, PORO, SATNUM.
@@ -363,7 +326,6 @@ namespace Opm
bool hasSOWCR() const {return !new_SOWCR_.empty(); }
private:
- Opm::EclipseGridParser parser_;
Opm::DeckConstPtr deck_;
std::shared_ptr metricUnits_;
diff --git a/opm/core/io/eclipse/EclipseGridInspector.cpp b/opm/core/io/eclipse/EclipseGridInspector.cpp
index 77ac712f..4b851fe0 100644
--- a/opm/core/io/eclipse/EclipseGridInspector.cpp
+++ b/opm/core/io/eclipse/EclipseGridInspector.cpp
@@ -51,40 +51,30 @@
namespace Opm
{
-
-EclipseGridInspector::EclipseGridInspector(const EclipseGridParser& oldParser)
-{
- Opm::ParserConstPtr parser(new Opm::Parser());
- newParserDeck_ = parser->parseFile(oldParser.deckFileName());
-
- init_();
-}
-
-
-EclipseGridInspector::EclipseGridInspector(Opm::DeckConstPtr newParserDeck)
- : newParserDeck_(newParserDeck)
+EclipseGridInspector::EclipseGridInspector(Opm::DeckConstPtr deck)
+ : deck_(deck)
{
init_();
}
void EclipseGridInspector::init_()
{
- if (!newParserDeck_->hasKeyword("COORD")) {
+ if (!deck_->hasKeyword("COORD")) {
OPM_THROW(std::runtime_error, "Needed field \"COORD\" is missing in file");
}
- if (!newParserDeck_->hasKeyword("ZCORN")) {
+ if (!deck_->hasKeyword("ZCORN")) {
OPM_THROW(std::runtime_error, "Needed field \"ZCORN\" is missing in file");
}
- if (newParserDeck_->hasKeyword("SPECGRID")) {
+ if (deck_->hasKeyword("SPECGRID")) {
Opm::DeckRecordConstPtr specgridRecord =
- newParserDeck_->getKeyword("SPECGRID")->getRecord(0);
+ deck_->getKeyword("SPECGRID")->getRecord(0);
logical_gridsize_[0] = specgridRecord->getItem("NX")->getInt(0);
logical_gridsize_[1] = specgridRecord->getItem("NY")->getInt(0);
logical_gridsize_[2] = specgridRecord->getItem("NZ")->getInt(0);
- } else if (newParserDeck_->hasKeyword("DIMENS")) {
+ } else if (deck_->hasKeyword("DIMENS")) {
Opm::DeckRecordConstPtr dimensRecord =
- newParserDeck_->getKeyword("DIMENS")->getRecord(0);
+ deck_->getKeyword("DIMENS")->getRecord(0);
logical_gridsize_[0] = dimensRecord->getItem("NX")->getInt(0);
logical_gridsize_[1] = dimensRecord->getItem("NY")->getInt(0);
logical_gridsize_[2] = dimensRecord->getItem("NZ")->getInt(0);
@@ -107,13 +97,13 @@ std::pair EclipseGridInspector::cellDips(int i, int j, int k) con
{
checkLogicalCoords(i, j, k);
const std::vector& pillc =
- newParserDeck_->getKeyword("COORD")->getSIDoubleData();
+ deck_->getKeyword("COORD")->getSIDoubleData();
int num_pillars = (logical_gridsize_[0] + 1)*(logical_gridsize_[1] + 1);
if (6*num_pillars != int(pillc.size())) {
throw std::runtime_error("Wrong size of COORD field.");
}
const std::vector& z =
- newParserDeck_->getKeyword("ZCORN")->getSIDoubleData();
+ deck_->getKeyword("ZCORN")->getSIDoubleData();
int num_cells = logical_gridsize_[0]*logical_gridsize_[1]*logical_gridsize_[2];
if (8*num_cells != int(z.size())) {
throw std::runtime_error("Wrong size of ZCORN field");
@@ -217,13 +207,13 @@ double EclipseGridInspector::cellVolumeVerticalPillars(int i, int j, int k) cons
// Checking parameters and obtaining values from parser.
checkLogicalCoords(i, j, k);
const std::vector& pillc =
- newParserDeck_->getKeyword("COORD")->getSIDoubleData();
+ deck_->getKeyword("COORD")->getSIDoubleData();
int num_pillars = (logical_gridsize_[0] + 1)*(logical_gridsize_[1] + 1);
if (6*num_pillars != int(pillc.size())) {
throw std::runtime_error("Wrong size of COORD field.");
}
const std::vector& z =
- newParserDeck_->getKeyword("ZCORN")->getSIDoubleData();
+ deck_->getKeyword("ZCORN")->getSIDoubleData();
int num_cells = logical_gridsize_[0]*logical_gridsize_[1]*logical_gridsize_[2];
if (8*num_cells != int(z.size())) {
throw std::runtime_error("Wrong size of ZCORN field");
@@ -281,12 +271,12 @@ void EclipseGridInspector::checkLogicalCoords(int i, int j, int k) const
std::array EclipseGridInspector::getGridLimits() const
{
- if (! (newParserDeck_->hasKeyword("COORD") && newParserDeck_->hasKeyword("ZCORN") && newParserDeck_->hasKeyword("SPECGRID")) ) {
+ if (! (deck_->hasKeyword("COORD") && deck_->hasKeyword("ZCORN") && deck_->hasKeyword("SPECGRID")) ) {
throw std::runtime_error("EclipseGridInspector: Grid does not have SPECGRID, COORD, and ZCORN, can't find dimensions.");
}
- std::vector coord = newParserDeck_->getKeyword("COORD")->getSIDoubleData();
- std::vector zcorn = newParserDeck_->getKeyword("ZCORN")->getSIDoubleData();
+ std::vector coord = deck_->getKeyword("COORD")->getSIDoubleData();
+ std::vector zcorn = deck_->getKeyword("ZCORN")->getSIDoubleData();
double xmin = +DBL_MAX;
double xmax = -DBL_MAX;
@@ -335,7 +325,7 @@ std::array EclipseGridInspector::gridSize() const
std::array EclipseGridInspector::cellZvals(int i, int j, int k) const
{
// Get the zcorn field.
- const std::vector& z = newParserDeck_->getKeyword("ZCORN")->getSIDoubleData();
+ const std::vector& z = deck_->getKeyword("ZCORN")->getSIDoubleData();
int num_cells = logical_gridsize_[0]*logical_gridsize_[1]*logical_gridsize_[2];
if (8*num_cells != int(z.size())) {
throw std::runtime_error("Wrong size of ZCORN field");
diff --git a/opm/core/io/eclipse/EclipseGridInspector.hpp b/opm/core/io/eclipse/EclipseGridInspector.hpp
index e0ee3f70..df0dba0c 100644
--- a/opm/core/io/eclipse/EclipseGridInspector.hpp
+++ b/opm/core/io/eclipse/EclipseGridInspector.hpp
@@ -38,8 +38,6 @@
#include
#include
-#include
-#include
#include
namespace Opm
@@ -48,9 +46,8 @@ namespace Opm
/**
@brief A class for inspecting the contents of an eclipse file.
- Given an EclipseGridParser that has successfully read en Eclipse
- .grdecl-file, this class may be used to answer certain queries about
- its contents.
+ Given an Eclipse deck, this class may be used to answer certain
+ queries about its contents.
@author Atgeirr F. Rasmussen
@date 2008/06/02 09:46:08
@@ -60,11 +57,7 @@ class EclipseGridInspector
public:
/// Constructor taking a parser as argument.
/// The parser must already have read an Eclipse file.
- EclipseGridInspector(const EclipseGridParser& parser);
-
- /// Constructor taking a parser as argument.
- /// The parser must already have read an Eclipse file.
- EclipseGridInspector(Opm::DeckConstPtr newParserDeck);
+ EclipseGridInspector(Opm::DeckConstPtr deck);
/// Assuming that the pillars are vertical, compute the
/// volume of the cell given by logical coordinates (i, j, k).
@@ -98,7 +91,7 @@ public:
std::array cellZvals(int i, int j, int k) const;
private:
- Opm::DeckConstPtr newParserDeck_;
+ Opm::DeckConstPtr deck_;
int logical_gridsize_[3];
void init_();
void checkLogicalCoords(int i, int j, int k) const;
diff --git a/opm/core/io/eclipse/EclipseGridParser.cpp b/opm/core/io/eclipse/EclipseGridParser.cpp
deleted file mode 100644
index e05534f2..00000000
--- a/opm/core/io/eclipse/EclipseGridParser.cpp
+++ /dev/null
@@ -1,1215 +0,0 @@
-//===========================================================================
-//
-// File: EclipseGridParser.C
-//
-// Created: Thu Dec 6 08:46:05 2007
-//
-// Author: Atgeirr F Rasmussen
-//
-// $Date$
-//
-// $Revision$
-//
-// Revision: $Id: EclipseGridParser.C,v 1.4 2008/08/18 14:16:14 atgeirr Exp $
-//
-//===========================================================================
-
-/*
- Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
- Copyright 2009, 2010 Statoil ASA.
-
- This file is part of the Open Porous Media project (OPM).
-
- OPM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OPM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with OPM. If not, see .
-*/
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#ifdef HAVE_ERT
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#endif
-
-using namespace std;
-
-//#define VERBOSE
-
-namespace Opm
-{
-
-// ---------- List of supported keywords ----------
-
-namespace EclipseKeywords
-{
- string integer_fields[] =
- { string("ACTNUM"),
- string("SATNUM"),
- string("EQLNUM"),
- string("REGNUM"),
- string("ROCKTYPE"),
- string("DIMENS"),
- string("REGDIMS"),
- string("WELLDIMS"),
- string("TABDIMS"),
- string("FIPNUM"),
- string("GRIDFILE")
- };
- const int num_integer_fields = sizeof(integer_fields) / sizeof(integer_fields[0]);
-
- string floating_fields[] =
- { string("COORD"), string("ZCORN"), string("PERMX"),
- string("PERMY"), string("PERMZ"), string("PERMXX"),
- string("PERMYY"), string("PERMZZ"), string("PERMXY"),
- string("PERMYZ"), string("PERMZX"), string("PORO"),
- string("BULKMOD"), string("YOUNGMOD"), string("LAMEMOD"),
- string("SHEARMOD"), string("POISSONMOD"), string("PWAVEMOD"),
- string("MULTPV"), string("PRESSURE"), string("SGAS"),
- string("SWAT"), string("SOIL"), string("RS"),
- string("RV"),
- string("DXV"), string("DYV"), string("DZV"),
- string("DEPTHZ"), string("TOPS"), string("MAPAXES"),
- string("SWL"), string("SWCR"), string("SWU"),
- string("SGL"), string("SGCR"), string("SGU"),
- string("SOWCR"), string("SOGCR"), string("KRW"),
- string("KRWR"), string("KRG"), string("KRGR"),
- string("KRO"), string("KRORW"), string("KRORG"),
- string("ISWL"), string("ISWCR"), string("ISWU"),
- string("ISGL"), string("ISGCR"), string("ISGU"),
- string("ISOWCR"), string("ISOGCR"), string("IKRW"),
- string("IKRWR"), string("IKRG"), string("IKRGR"),
- string("IKRO"), string("IKRORW"), string("IKRORG"),
- string("NTG"), string("RHO")
- };
- const int num_floating_fields = sizeof(floating_fields) / sizeof(floating_fields[0]);
-
- string special_fields[] =
- { string("SPECGRID"), string("FAULTS"), string("MULTFLT"),
- string("TITLE"), string("START"), string("DATES"),
- string("DENSITY"), string("PVDG"), string("PVDO"),
- string("PVTG"), string("PVTO"), string("PVTW"),
- string("SGOF"), string("SWOF"), string("ROCK"),
- string("ROCKTAB"), string("WELSPECS"), string("COMPDAT"),
- string("WCONINJE"), string("WCONPROD"), string("WELTARG"),
- string("WELOPEN"),
- string("EQUIL"), string("PVCDO"), string("TSTEP"),
- string("PLYVISC"), string("PLYROCK"), string("PLYADS"),
- string("PLYMAX"), string("TLMIXPAR"), string("WPOLYMER"),
- string("PLYSHEAR"),
- string("GRUPTREE"), string("GCONINJE"), string("GCONPROD"),
- string("WGRUPCON"), string("ENDSCALE"), string("SCALECRS"),
- string("ENPTVD"), string("ENKRVD"),
- // The following fields only have a dummy implementation
- // that allows us to ignore them.
- string("SWFN"),
- string("SOF2"),
- string("TUNING")
- };
-
- const int num_special_fields = sizeof(special_fields) / sizeof(special_fields[0]);
-
- string ignore_with_data[] =
- { string("MAPUNITS"), string("GRIDUNIT"),
- string("REGDIMS"), string("WELLDIMS"),
- string("NSTACK"), string("SATNUM"),
- string("RPTRST"), string("ROIP"), string("RWIP"),
- string("RWSAT"), string("RPR"), string("WBHP"),
- string("WOIR"), string("BOX"),
- string("COORDSYS"), string("PBVD")
- };
- const int num_ignore_with_data = sizeof(ignore_with_data) / sizeof(ignore_with_data[0]);
-
- string ignore_no_data[] =
- { string("RUNSPEC"), string("WATER"), string("OIL"),
- string("METRIC"), string("FMTIN"), string("FMTOUT"),
- string("GRID"), string("INIT"), string("NOECHO"),
- string("ECHO"), string("EDIT"), string("PROPS"),
- string("REGIONS"), string("SOLUTION"), string("SUMMARY"),
- string("FPR"), string("FOIP"), string("FWIP"),
- string("RUNSUM"), string("EXCEL"), string("SCHEDULE"),
- string("END"), string("ENDBOX"), string("CONTINUE"),
- string("NONNC"), string("GAS"), string("DISGAS"),
- string("FIELD"), string("POLYMER")
- };
- const int num_ignore_no_data = sizeof(ignore_no_data) / sizeof(ignore_no_data[0]);
-
- string include_keywords[] = { string("INCLUDE") };
- const int num_include_keywords = sizeof(include_keywords) / sizeof(include_keywords[0]);
-
- string import_keywords[] = { string("IMPORT") };
- const int num_import_keywords = sizeof(import_keywords) / sizeof(import_keywords[0]);
-
-
-} // namespace EclipseKeywords
-
-namespace {
-
- inline std::string upcase(const std::string& s)
- {
- std::string us(s);
- // Getting the character type facet for toupper().
- // We use the classic (i.e. C) locale.
- const std::ctype& ct = std::use_facet< std::ctype >(std::locale::classic());
- for (int i = 0; i < int(s.size()); ++i) {
- us[i] = ct.toupper(s[i]);
- }
- return us;
- }
-
-
-
-} // anon namespace
-
-
-
-// ---------- Member functions ----------
-
-/// Default constructor.
-//---------------------------------------------------------------------------
-EclipseGridParser::EclipseGridParser()
-//---------------------------------------------------------------------------
- : current_reading_mode_(Regular),
- start_date_(boost::date_time::not_a_date_time),
- current_time_days_(0.0),
- current_epoch_(0),
- special_field_by_epoch_(1)
-{
-}
-
-
-/// Constructor taking an eclipse filename.
-//---------------------------------------------------------------------------
-EclipseGridParser::EclipseGridParser(const string& filename, bool convert_to_SI)
-//---------------------------------------------------------------------------
- : current_reading_mode_(Regular),
- start_date_(boost::date_time::not_a_date_time),
- current_time_days_(0.0),
- current_epoch_(0),
- special_field_by_epoch_(1)
-{
- // Store directory of filename
- boost::filesystem::path p(filename);
- directory_ = p.parent_path().string();
- deckFileName_ = p.string();
- ifstream is(deckFileName_.c_str());
- if (!is) {
- cerr << "Unable to open file " << filename << endl;
- throw exception();
- }
- read(is, convert_to_SI);
-}
-
-
- FieldType EclipseGridParser::classifyKeyword(const string& keyword)
- {
- using namespace EclipseKeywords;
- if (count(integer_fields, integer_fields + num_integer_fields, keyword)) {
- return Integer;
- } else if (count(floating_fields, floating_fields + num_floating_fields, keyword)) {
- return FloatingPoint;
- } else if (keyword == "TSTEP" || keyword == "DATES") {
- return Timestepping;
- } else if (count(special_fields, special_fields + num_special_fields, keyword)) {
- return SpecialField;
- } else if (count(ignore_with_data, ignore_with_data + num_ignore_with_data, keyword)) {
- return IgnoreWithData;
- } else if (count(ignore_no_data, ignore_no_data + num_ignore_no_data, keyword)) {
- return IgnoreNoData;
- } else if (count(include_keywords, include_keywords + num_include_keywords, keyword)) {
- return Include;
- } else if (count(import_keywords, import_keywords + num_import_keywords, keyword)) {
- return Import;
- } else {
- return Unknown;
- }
- }
-
-
-bool EclipseGridParser::readKeyword(std::istream& is, std::string& keyword)
-{
- char buf[9];
- int i, j;
- char c;
- /* Clear buf */
- for (i=0; i<9; ++i) {
- buf[i] = '\0';
- }
-
- /* Read first character and check if it is uppercase*/
- //buf[0] = fgetc(fp);
- is.get(buf[0]);
- if ( !isupper( buf[0] ) ) {
- is.unget();
- return false; /* NOT VALID CHARACTER */
- }
-
- /* Scan as much as possible possible keyword, 8 characters long */
- i = 1;
- is.get(c);
- while ( (is.good()) &&
- (c != EOF ) &&
- (!isblank(c) ) &&
- (isupper(c) || isdigit(c)) &&
- (c != '\n' ) &&
- (c != '/' ) &&
- (i < 8 )) {
- buf[i++] = c;
- is.get(c);
- }
-
- /* Skip rest of line */
- if (c != '\n'){
- is.get(c);
- while ( (is.good()) &&
- (c != EOF ) &&
- (c != '\n' )) {
- is.get(c);
- }
- }
- if(c == '\n') {
- is.unget();
- }
-
- /* Find first non-uppercase or non-digit character */
- for (i=0; i<8; ++i) {
- if ( !(isupper(buf[i]) || isdigit(buf[i])) ) {
- break;
- }
- }
-
- /* Check if remaining characters are blank */
- for (j = i; j<8; ++j) {
- if(!isspace(buf[j]) && buf[j] != '\0') {
- return false; /* CHARACTER AFTER SPACE OR INVALID CHARACTER */
- }
- buf[j] = '\0';
- }
- keyword = std::string(buf);
- std::string::size_type end = keyword.find_last_of('\0');
- if(end != keyword.npos)
- keyword = keyword.substr(0, end+1);
- return true;
-}
-
-
-/// Read the given stream, overwriting any previous data.
-//---------------------------------------------------------------------------
-void EclipseGridParser::read(istream& is, bool convert_to_SI)
-//---------------------------------------------------------------------------
-{
- integer_field_map_.clear();
- floating_field_map_.clear();
- special_field_by_epoch_.clear();
- special_field_by_epoch_.push_back(SpecialMap());
- current_time_days_ = 0.0;
- current_epoch_ = 0;
-
- readImpl(is);
-
- current_epoch_ = 0;
-
- computeUnits();
- if (convert_to_SI) {
- convertToSI();
- }
-
-#define VERBOSE_LIST_FIELDS 1
-#if VERBOSE_LIST_FIELDS
- std::cout << "\nInteger fields:\n";
- for (std::map >::iterator
- i = integer_field_map_.begin(); i != integer_field_map_.end(); ++i)
- std::cout << '\t' << i->first << '\n';
-
- std::cout << "\nFloat fields:\n";
- for (std::map >::iterator
- i = floating_field_map_.begin(); i != floating_field_map_.end(); ++i)
- std::cout << '\t' << i->first << '\n';
-
- std::cout << "\nSpecial fields:\n";
- for (int epoch = 0; epoch < numberOfEpochs(); ++epoch) {
- std::cout << "Epoch " << epoch << '\n';
- const SpecialMap& sm = special_field_by_epoch_[epoch];
- for (SpecialMap::const_iterator i = sm.begin(); i != sm.end(); ++i) {
- std::cout << '\t' << i->first << '\n';
- }
- }
-#endif
-}
-
-//---------------------------------------------------------------------------
-void EclipseGridParser::readImpl(istream& is)
-//---------------------------------------------------------------------------
-{
- if (!is) {
- cerr << "Could not read given input stream." << endl;
- throw exception();
- }
-
- // Make temporary maps that will at the end be swapped with the
- // member maps
- // NOTE: Above is no longer true, for easier implementation of
- // the INCLUDE keyword. We lose the strong exception guarantee,
- // though (of course retaining the basic guarantee).
- map >& intmap = integer_field_map_;
- map >& floatmap = floating_field_map_;
-
- // Actually read the data
- std::string keyword;
- while (is.good()) {
- is >> ignoreWhitespace;
- bool ok = readKeyword(is, keyword);
- if (ok) {
- //#ifdef VERBOSE
- cout << "Keyword found: " << keyword << endl;
- //#endif
- FieldType type = classifyKeyword(keyword);
- // std::cout << "Classification: " << type << std::endl;
- switch (type) {
- case Integer: {
- readVectorData(is, intmap[keyword]);
- break;
- }
- case FloatingPoint: {
- readVectorData(is, floatmap[keyword]);
- break;
- }
- case Timestepping: {
- SpecialMap& sm = special_field_by_epoch_[current_epoch_];
- if (start_date_.is_not_a_date()) {
- // Set it to START date, or default if no START.
- // This will only ever happen in the first epoch,
- // upon first encountering a timestepping keyword.
- if (hasField("START")) {
- start_date_ = getSTART().date;
- } else {
- start_date_ = boost::gregorian::date( 1983 , 1 , 1 );
- }
- }
- if (current_reading_mode_ == Regular) {
- current_reading_mode_ = Timesteps;
- }
- // Get current epoch's TSTEP, if it exists, create new if not.
- SpecialMap::iterator it = sm.find("TSTEP");
- TSTEP* tstep = 0;
- if (it != sm.end()) {
- tstep = dynamic_cast(it->second.get());
- } else {
- SpecialFieldPtr sb_ptr(new TSTEP());
- tstep = dynamic_cast(sb_ptr.get());
- sm["TSTEP"] = sb_ptr;
- }
- assert(tstep != 0);
- // Append new steps to current TSTEP object
- if (keyword == "TSTEP") {
- const int num_steps_old = tstep->tstep_.size();
- tstep->read(is); // This will append to the TSTEP object.
- const double added_days
- = std::accumulate(tstep->tstep_.begin() + num_steps_old, tstep->tstep_.end(), 0.0);
- current_time_days_ += added_days;
- } else if (keyword == "DATES") {
- DATES dates;
- dates.read(is);
- for (std::size_t dix = 0; dix < dates.dates.size(); ++dix) {
- boost::gregorian::date_duration since_start = dates.dates[dix] - start_date_;
- double step = double(since_start.days()) - current_time_days_;
- tstep->tstep_.push_back(step);
- current_time_days_ = double(since_start.days());
- }
- } else {
- OPM_THROW(std::runtime_error, "Keyword " << keyword << " cannot be handled here.");
- }
- break;
- }
- case SpecialField: {
- if (current_reading_mode_ == Timesteps) {
- // We have been reading timesteps, but have
- // now encountered something else.
- // That means we are in a new epoch.
- current_reading_mode_ = Regular;
- special_field_by_epoch_.push_back(SpecialMap());
- ++current_epoch_;
- assert(int(special_field_by_epoch_.size()) == current_epoch_ + 1);
- // Add clones of all existing special fields to new map.
- SpecialMap& oldmap = special_field_by_epoch_[current_epoch_ - 1];
- SpecialMap& newmap = special_field_by_epoch_[current_epoch_];
- for (SpecialMap::iterator it = oldmap.begin(); it != oldmap.end(); ++it) {
- // if (it->first != "TSTEP") {
- newmap[it->first] = cloneSpecialField(it->first, it->second);
- //}
- }
- //assert(newmap.count("TSTEP") == 0);
- }
- // Check if the keyword already exists. If so, append. Otherwise, create new.
- SpecialMap::iterator it = special_field_by_epoch_[current_epoch_].find(keyword);
- if (it != special_field_by_epoch_[current_epoch_].end()) {
- it->second->read(is);
- } else {
- SpecialFieldPtr sb_ptr = createSpecialField(is, keyword);
- if (sb_ptr) {
- special_field_by_epoch_[current_epoch_][keyword] = sb_ptr;
- } else {
- OPM_THROW(std::runtime_error, "Could not create field " << keyword);
- }
- }
- break;
- }
- case IgnoreWithData: {
- ignored_fields_.insert(keyword);
- //is >> ignoreSlashLine;
- //#ifdef VERBOSE
- // cout << "(ignored)" << endl;
- //#endif
- break;
- }
- case IgnoreNoData: {
- ignored_fields_.insert(keyword);
- //is >> ignoreLine;
- //#ifdef VERBOSE
- // cout << "(ignored)" << endl;
- //#endif
- break;
- }
- case Include: {
- string include_filename = readString(is);
- if (!directory_.empty()) {
- include_filename = directory_ + '/' + include_filename;
- }
- ifstream include_is(include_filename.c_str());
- if (!include_is) {
- OPM_THROW(std::runtime_error, "Unable to open INCLUDEd file " << include_filename);
- }
- readImpl(include_is);
- // is >> ignoreSlashLine;
- break;
- }
- case Import: {
- string import_filename = readString(is);
- if (!directory_.empty()) {
- import_filename = directory_ + '/' + import_filename;
- }
- getNumericErtFields(import_filename);
- break;
- }
- case Unknown:
- default:
- ignored_fields_.insert(keyword);
- cout << "*** Warning: keyword " << keyword << " is unknown." << endl;
- //is >> ignoreSlashLine;
- //throw exception();
- }
- } else {
- // if (!ok)
- is >> ignoreLine;
- }
- }
-}
-
-
-
-//---------------------------------------------------------------------------
-void EclipseGridParser::convertToSI()
-//---------------------------------------------------------------------------
-{
- // Convert all special fields.
- typedef SpecialMap::iterator SpecialIt;
- for (int epoch = 0; epoch < numberOfEpochs(); ++epoch) {
- SpecialMap& sm = special_field_by_epoch_[epoch];
- for (SpecialIt i = sm.begin(); i != sm.end(); ++i) {
- i->second->convertToSI(units_);
- }
- }
-
- // Convert all floating point fields.
- typedef std::map >::iterator FloatIt;
- for (FloatIt i = floating_field_map_.begin(); i != floating_field_map_.end(); ++i) {
- const std::string& key = i->first;
- std::vector& field = i->second;
- // Find the right unit.
- double unit = 1e100;
- bool do_convert = true;
- if (key == "COORD" || key == "ZCORN" ||
- key == "DXV" || key == "DYV" || key == "DZV" ||
- key == "DEPTHZ" || key == "TOPS") {
- unit = units_.length;
- } else if (key == "PERMX" || key == "PERMY" || key == "PERMZ" ||
- key == "PERMXX" || key == "PERMYY" || key == "PERMZZ" ||
- key == "PERMXY" || key == "PERMYZ" || key == "PERMZX") {
- unit = units_.permeability;
- } else if (key == "PORO" || key == "BULKMOD" || key == "YOUNGMOD" ||
- key == "LAMEMOD" || key == "SHEARMOD" || key == "POISSONMOD" ||
- key == "PWAVEMOD" || key == "MULTPV" || key == "PWAVEMOD" ||
- key == "SGAS" || key == "SWAT" || key == "SOIL" ||
- key == "SWL" || key == "SWCR" || key == "SWU" ||
- key == "SGL" || key == "SGCR" || key == "SGU" ||
- key == "SOWCR" || key == "SOGCR" || key == "KRW" ||
- key == "KRWR" || key == "KRG" || key == "KRGR" ||
- key == "KRO" || key == "KRORW" || key == "KRORG" ||
- key == "ISWL" || key == "ISWCR" || key == "ISWU" ||
- key == "ISGL" || key == "ISGCR" || key == "ISGU" ||
- key == "ISOWCR" || key == "ISOGCR" || key == "IKRW" ||
- key == "IKRWR" || key == "IKRG" || key == "IKRGR" ||
- key == "IKRO" || key == "IKRORW" || key == "IKRORG" ||
- key == "NTG" ||
- key == "RHO") /* nonstandard field with no unit logic. use with caution */ {
- unit = 1.0;
- do_convert = false; // Dimensionless keywords...
- } else if (key == "PRESSURE") {
- unit = units_.pressure;
- } else if (key == "RS") {
- unit = units_.gasvol_s / units_.liqvol_s;
- } else if (key == "RV") {
- unit = units_.liqvol_s / units_.gasvol_s;
- } else if (key == "MAPAXES") {
- OPM_MESSAGE("Not applying units to MAPAXES yet!");
- unit = 1.0;
- } else {
- OPM_THROW(std::runtime_error, "Units for field " << key << " not specified. Cannon convert to SI.");
- }
-
- if (do_convert) {
- for (std::vector::size_type j = 0; j < field.size(); ++j) {
- field[j] = unit::convert::from(field[j], unit);
- }
- }
- }
-
- // Set all units to one.
- units_.setToOne();
-}
-
-
-/// Returns true if the given keyword corresponds to a field that
-/// was found in the file.
-//---------------------------------------------------------------------------
-bool EclipseGridParser::hasField(const string& keyword) const
-//---------------------------------------------------------------------------
-{
- string ukey = upcase(keyword);
- return integer_field_map_.count(ukey) || floating_field_map_.count(ukey) ||
- special_field_by_epoch_[current_epoch_].count(ukey) || ignored_fields_.count(ukey);
-}
-
-
-/// Returns true if all the given keywords correspond to fields
-/// that were found in the file.
-//---------------------------------------------------------------------------
-bool EclipseGridParser::hasFields(const vector& keywords) const
-//---------------------------------------------------------------------------
-{
- int num_keywords = keywords.size();
- for (int i = 0; i < num_keywords; ++i) {
- if (!hasField(keywords[i])) {
- return false;
- }
- }
- return true;
-}
-
-//---------------------------------------------------------------------------
-vector EclipseGridParser::fieldNames() const
-//---------------------------------------------------------------------------
-{
- vector names;
- names.reserve(integer_field_map_.size() +
- floating_field_map_.size() +
- special_field_by_epoch_[current_epoch_].size() +
- ignored_fields_.size());
- {
- map >::const_iterator it = integer_field_map_.begin();
- for (; it != integer_field_map_.end(); ++it) {
- names.push_back(it->first);
- }
- }
- {
- map >::const_iterator it = floating_field_map_.begin();
- for (; it != floating_field_map_.end(); ++it) {
- names.push_back(it->first);
- }
- }
- {
- SpecialMap::const_iterator it = special_field_by_epoch_[current_epoch_].begin();
- for (; it != special_field_by_epoch_[current_epoch_].end(); ++it) {
- names.push_back(it->first);
- }
- }
- {
- set::const_iterator it = ignored_fields_.begin();
- for (; it != ignored_fields_.end(); ++it) {
- names.push_back(*it);
- }
- }
- return names;
-}
-
-
-//---------------------------------------------------------------------------
-int EclipseGridParser::numberOfEpochs() const
-//---------------------------------------------------------------------------
-{
- return special_field_by_epoch_.size();
-}
-
-
-//---------------------------------------------------------------------------
-void EclipseGridParser::setCurrentEpoch(int epoch)
-//---------------------------------------------------------------------------
-{
- assert(epoch >= 0 && epoch < numberOfEpochs());
- current_epoch_ = epoch;
-}
-
-//-----------------------------------------------------------------
-boost::gregorian::date EclipseGridParser::getStartDate() const
-//---------------------------------------------------------------------------
-{
- return start_date_;
-}
-
-//---------------------------------------------------------------------------
-const std::vector& EclipseGridParser::getIntegerValue(const std::string& keyword) const
-//---------------------------------------------------------------------------
-{
- if (keyword == "SPECGRID") {
- cerr << "\nERROR. Interface has changed!\n"
- << "const vector& dim = parser.getIntegerValue(""SPECGRID"") is deprecated.\n"
- << "Use:\n"
- << "const SPECGRID& specgrid = parser.getSPECGRID();\n"
- << "const vector& dim = specgrid.dimensions;\n\n";
- throw exception();
- }
-
- map >::const_iterator it
- = integer_field_map_.find(keyword);
- if (it == integer_field_map_.end()) {
- OPM_THROW(std::runtime_error, "No such field: " << keyword);
- } else {
- return it->second;
- }
-}
-
-//---------------------------------------------------------------------------
-const std::vector& EclipseGridParser::getFloatingPointValue(const std::string& keyword) const
-//---------------------------------------------------------------------------
-{
- map >::const_iterator it
- = floating_field_map_.find(keyword);
- if (it == floating_field_map_.end()) {
- OPM_THROW(std::runtime_error, "No such field: " << keyword);
- } else {
- return it->second;
- }
-}
-
-
-//---------------------------------------------------------------------------
-const std::shared_ptr EclipseGridParser::getSpecialValue(const std::string& keyword) const
-//---------------------------------------------------------------------------
-{
- SpecialMap::const_iterator it = special_field_by_epoch_[current_epoch_].find(keyword);
- if (it == special_field_by_epoch_[current_epoch_].end()) {
- OPM_THROW(std::runtime_error, "No such field: " << keyword);
- } else {
- return it->second;
- }
-}
-
-//---------------------------------------------------------------------------
-std::shared_ptr
-EclipseGridParser::createSpecialField(std::istream& is,
- const std::string& fieldname)
-//---------------------------------------------------------------------------
-{
- string ukey = upcase(fieldname);
- std::shared_ptr spec_ptr
- = Factory::createObject(fieldname);
- is >> ignoreWhitespace;
- spec_ptr->read(is);
- return spec_ptr;
-}
-
-//---------------------------------------------------------------------------
-std::shared_ptr
-EclipseGridParser::cloneSpecialField(const std::string& fieldname,
- const std::shared_ptr original)
-//---------------------------------------------------------------------------
-{
- string ukey = upcase(fieldname);
- std::shared_ptr spec_ptr
- = Factory::cloneObject(fieldname, original);
- return spec_ptr;
-}
-
-
-//---------------------------------------------------------------------------
-void EclipseGridParser::setIntegerField(const std::string& keyword,
- const std::vector& field)
-//---------------------------------------------------------------------------
-{
- integer_field_map_[keyword] = field;
-}
-
-//---------------------------------------------------------------------------
-void EclipseGridParser::setFloatingPointField(const std::string& keyword,
- const std::vector& field)
-//---------------------------------------------------------------------------
-{
- floating_field_map_[keyword] = field;
-}
-
-//---------------------------------------------------------------------------
-void EclipseGridParser::setSpecialField(const std::string& keyword,
- std::shared_ptr field)
-//---------------------------------------------------------------------------
-{
- special_field_by_epoch_[current_epoch_][keyword] = field;
-}
-
-//---------------------------------------------------------------------------
-const EclipseUnits& EclipseGridParser::units() const
-//---------------------------------------------------------------------------
-{
- return units_;
-}
-
-//---------------------------------------------------------------------------
-void EclipseGridParser::computeUnits()
-//---------------------------------------------------------------------------
-{
- // Decide unit family.
- enum EclipseUnitFamily { Metric = 0, Field = 1, Lab = 2, Pvtm = 3 };
- EclipseUnitFamily unit_family = Metric; // The default.
- if (hasField("FIELD")) unit_family = Field;
- if (hasField("LAB")) unit_family = Lab;
- if (hasField("PVT-M")) unit_family = Pvtm;
-
- // Set units.
- using namespace prefix;
- using namespace unit;
- switch (unit_family) {
- case Metric:
- units_.length = meter;
- units_.time = day;
- units_.density = kilogram/cubic(meter);
- units_.polymer_density = kilogram/cubic(meter);
- units_.pressure = barsa;
- units_.compressibility = 1.0/barsa;
- units_.viscosity = centi*Poise;
- units_.permeability = milli*darcy;
- units_.liqvol_s = cubic(meter);
- units_.liqvol_r = cubic(meter);
- units_.gasvol_s = cubic(meter);
- units_.gasvol_r = cubic(meter);
- units_.transmissibility = centi*Poise * cubic(meter) / (day * barsa);
- break;
- case Field:
- units_.length = feet;
- units_.time = day;
- units_.density = pound/cubic(feet);
- units_.polymer_density = pound/stb;
- units_.pressure = psia;
- units_.compressibility = 1.0/psia;
- units_.viscosity = centi*Poise;
- units_.permeability = milli*darcy;
- units_.liqvol_s = stb;
- units_.liqvol_r = stb;
- units_.gasvol_s = 1000*cubic(feet); // Prefix 'M' is 1000
- units_.gasvol_r = stb;
- units_.transmissibility = centi*Poise * stb / (day * psia);
- break;
- case Lab:
- OPM_THROW(std::runtime_error, "Unhandled unit family " << unit_family);
- break;
- case Pvtm:
- OPM_THROW(std::runtime_error, "Unhandled unit family " << unit_family);
- break;
- default:
- OPM_THROW(std::runtime_error, "Unknown unit family " << unit_family);
- }
-}
-
-
-struct grdecl EclipseGridParser::get_grdecl() const {
- struct grdecl grdecl;
-
- // Extract data from deck.
- const std::vector& zcorn = getFloatingPointValue("ZCORN");
- const std::vector& coord = getFloatingPointValue("COORD");
- const int* actnum = NULL;
- if (hasField("ACTNUM")) {
- actnum = &(getIntegerValue("ACTNUM")[0]);
- }
-
- std::vector dims;
- if (hasField("DIMENS")) {
- dims = getIntegerValue("DIMENS");
- } else if (hasField("SPECGRID")) {
- dims = getSPECGRID().dimensions;
- } else {
- OPM_THROW(std::runtime_error, "Deck must have either DIMENS or SPECGRID.");
- }
-
- // Collect in input struct for preprocessing.
-
- grdecl.zcorn = &zcorn[0];
- grdecl.coord = &coord[0];
- grdecl.actnum = actnum;
- grdecl.dims[0] = dims[0];
- grdecl.dims[1] = dims[1];
- grdecl.dims[2] = dims[2];
-
- if (hasField("MAPAXES")) {
- const std::vector &mapaxes = getFloatingPointValue("MAPAXES");
- grdecl.mapaxes = &mapaxes[0];
- } else
- grdecl.mapaxes = NULL;
-
-
- return grdecl;
-}
-
-
-#ifdef HAVE_ERT
-/*
- This function will create a ecl_kw instance filled with the data
- from input argument @keyword. The ecl_kw will get it's own copy of
- the data.
-
- If the input type ecl_type == ECL_INT_TYPE the function will use the
- getIntegerValue() method to get the keyword data, if ecl_type ==
- ECL_DOUBLE_TYPE || ECL_FLOAT_TYPE the getFloatingPointValue()
- function is invoked. If ecl_type == ECL_FLOAT_TYPE the data will be
- converted to when inserting into the ecl_kw.
-
- When the ecl_kw instance is no longer needed it should be discarded
- with a call to ecl_kw_free( ).
-
- If you are asking for a non-existent field the function will return NULL
-*/
-
-ecl_kw_type * EclipseGridParser::newEclKW(const std::string &keyword , ecl_type_enum ecl_type) const {
- ecl_kw_type * ecl_kw = NULL;
- if (hasField(keyword)) {
- if (ecl_type == ECL_INT_TYPE) {
- std::vector data = getIntegerValue( keyword );
- ecl_kw = ecl_kw_alloc( keyword.c_str() , data.size() , ecl_type );
- ecl_kw_set_memcpy_data( ecl_kw , &data[0]);
- } else {
- std::vector data = getFloatingPointValue( keyword );
- if (ecl_type == ECL_DOUBLE_TYPE) {
- ecl_kw = ecl_kw_alloc( keyword.c_str() , data.size() , ecl_type );
- ecl_kw_set_memcpy_data( ecl_kw , &data[0]);
- } else if (ecl_type == ECL_FLOAT_TYPE) {
- ecl_kw = ecl_kw_alloc( keyword.c_str() , data.size() , ecl_type );
- for (std::vector::size_type i=0; i < data.size(); i++)
- ecl_kw_iset_float( ecl_kw , i , data[i] );
- }
- }
- }
- return ecl_kw;
-}
-
-
-/**
- This function will extract the COORD, ZCORN, ACTNUM and optionaly
- MAPAXES keywords from the eclipse deck and create an ecl_grid
- instance.
-
- When you are finished working with the ecl_grid instance it should
- be disposed with ecl_grid_free( ).
-*/
-
-ecl_grid_type * EclipseGridParser::newGrid( ) {
- struct grdecl grdecl = get_grdecl();
- ecl_kw_type * coord_kw = newEclKW( COORD_KW , ECL_FLOAT_TYPE );
- ecl_kw_type * zcorn_kw = newEclKW( ZCORN_KW , ECL_FLOAT_TYPE );
- ecl_kw_type * actnum_kw = newEclKW( ACTNUM_KW , ECL_INT_TYPE );
- ecl_kw_type * mapaxes_kw = NULL;
-
- ecl_grid_type * grid ;
- if (grdecl.mapaxes != NULL)
- mapaxes_kw = newEclKW( MAPAXES_KW , ECL_FLOAT_TYPE );
-
- grid = ecl_grid_alloc_GRDECL_kw( grdecl.dims[0] , grdecl.dims[1] , grdecl.dims[2] , zcorn_kw , coord_kw , actnum_kw , mapaxes_kw );
-
- ecl_kw_free( coord_kw );
- ecl_kw_free( zcorn_kw );
- ecl_kw_free( actnum_kw );
- if (mapaxes_kw != NULL)
- ecl_kw_free( mapaxes_kw );
-
- return grid;
-}
-
-
-
-/**
- This function will save an EGRID file based on the COORD, ZCORN,
- ACTNUM and optionally MAPAXES keywords included in the deck.
-
- This function creates the EGRID file without going through a
- ecl_grid instance; this is obviously somewhat faster and less
- memory demanding. Alternatively you can create a ecl_grid instance
- and then subsequently store that grid as an EGRID file:
-
- {
- ecl_grid_type * grid = newGRID( );
- ecl_grid_fwrite_EGRID( grid , filename );
- ecl_grid_free( grid );
- }
-*/
-
- void EclipseGridParser::saveEGRID( const std::string & filename , int num_cells , const int * global_cell) const {
- bool endian_flip = true;//ECL_ENDIAN_FLIP;
- bool fmt_file;
- struct grdecl grdecl = get_grdecl();
- fortio_type * fortio;
-
- if (!ecl_util_fmt_file( filename.c_str() , &fmt_file)) {
- cerr << "Could not determine formatted/unformatted status of file:" << filename << " non-standard name?" << endl;
- throw exception();
- }
-
- fortio = fortio_open_writer( filename.c_str() , fmt_file , endian_flip );
- {
- float * mapaxes = NULL;
- if (grdecl.mapaxes != NULL) {
- mapaxes = new float[6];
- for (int i=0; i < 6; i++)
- mapaxes[i]= grdecl.mapaxes[i];
- }
-
- ecl_grid_fwrite_EGRID_header( grdecl.dims , mapaxes , fortio );
-
- if (grdecl.mapaxes != NULL)
- delete[] mapaxes;
- }
-
- {
- ecl_kw_type * coord_kw = newEclKW( COORD_KW , ECL_FLOAT_TYPE );
- ecl_kw_type * zcorn_kw = newEclKW( ZCORN_KW , ECL_FLOAT_TYPE );
- ecl_kw_type * endgrid_kw = ecl_kw_alloc( ENDGRID_KW , 0 , ECL_INT_TYPE );
-
-
- ecl_kw_fwrite( coord_kw , fortio );
- ecl_kw_fwrite( zcorn_kw , fortio );
- if (global_cell) {
- int global_size = grdecl.dims[0] * grdecl.dims[1] * grdecl.dims[2];
- ecl_kw_type * actnum_kw = ecl_kw_alloc( ACTNUM_KW , global_size , ECL_INT_TYPE );
- int * actnum_data = ecl_kw_get_int_ptr( actnum_kw );
-
- ecl_kw_scalar_set_int( actnum_kw , 0 );
- for (int c=0; c < num_cells; c++)
- actnum_data[global_cell[c]] = 1;
-
- ecl_kw_fwrite( actnum_kw , fortio );
- ecl_kw_free( actnum_kw );
- }
- ecl_kw_fwrite( endgrid_kw , fortio );
-
- ecl_kw_free( coord_kw );
- ecl_kw_free( zcorn_kw );
- ecl_kw_free( endgrid_kw );
- }
- fortio_fclose( fortio );
- }
-
-
-/**
- Will query the deck for keyword @kw; and save it to the @fortio
- instance if the keyword can be found.
-*/
-void EclipseGridParser::save_kw( fortio_type * fortio , const std::string & kw , ecl_type_enum ecl_type) {
- ecl_kw_type * ecl_kw = newEclKW( kw , ecl_type );
- if (ecl_kw != NULL) {
- ecl_kw_fwrite( ecl_kw , fortio );
- ecl_kw_free( ecl_kw );
- }
-}
-
-
-/**
- Will save an ECLIPSE INIT file to @filename. Observe that the main
- focus of this function is to store grid properties like PERMX and
- PORO, various tabular properties like e.g. relperm tables and
- thermodynamic properties are ignored.
-*/
-
-void EclipseGridParser::saveINIT( const std::string & filename , const ecl_grid_type * ecl_grid) {
- int phases = ECL_OIL_PHASE + ECL_WATER_PHASE;
- bool endian_flip = true;//ECL_ENDIAN_FLIP;
- bool fmt_file;
- fortio_type * fortio;
-
- if (!ecl_util_fmt_file( filename.c_str() , &fmt_file)) {
- cerr << "Could not determine formatted/unformatted status of file:" << filename << " non-standard name?" << endl;
- throw exception();
- }
- fortio = fortio_open_writer( filename.c_str() , fmt_file , endian_flip );
-
- {
- ecl_kw_type * poro_kw = newEclKW( PORO_KW , ECL_FLOAT_TYPE );
- time_t start_date;
-
- {
- tm td_tm = to_tm( start_date_ );
- start_date = mktime( &td_tm );
- }
-
- ecl_init_file_fwrite_header( fortio , ecl_grid , poro_kw , phases , start_date );
- ecl_kw_free( poro_kw );
- }
-
- /* This collection of keywords is somewhat arbitrary and random. */
- save_kw( fortio , "PERMX" , ECL_FLOAT_TYPE);
- save_kw( fortio , "PERMY" , ECL_FLOAT_TYPE);
- save_kw( fortio , "PERMZ" , ECL_FLOAT_TYPE);
-
- save_kw( fortio , "FIPNUM" , ECL_INT_TYPE);
- save_kw( fortio , "SATNUM" , ECL_INT_TYPE);
- save_kw( fortio , "EQLNUM" , ECL_INT_TYPE);
-
- fortio_fclose( fortio );
-}
-
-
-/**
- This is the main function used to save the state of the ECLIPSE
- deck in ECLIPSE format. The function will save an INIT file and an
- EGRID file.
-
- The input arguments are the output directory to store files in, and
- the basename to use for the files; the function will build up a
- ECLIPSE standard filename internally.
-*/
-
-void EclipseGridParser::saveEGRID_INIT( const std::string& output_dir , const std::string& basename, bool fmt_file) {
- ecl_grid_type * ecl_grid = newGrid();
- char * egrid_file = ecl_util_alloc_filename( output_dir.c_str() , basename.c_str() , ECL_EGRID_FILE , fmt_file , 0);
- char * init_file = ecl_util_alloc_filename( output_dir.c_str() , basename.c_str() , ECL_INIT_FILE , fmt_file , 0);
-
- ecl_grid_fwrite_EGRID( ecl_grid , egrid_file );
- saveINIT( init_file , ecl_grid );
-
- free( init_file );
- free( egrid_file );
- ecl_grid_free( ecl_grid );
-}
-#else
-
-void EclipseGridParser::saveEGRID( const std::string & filename, int num_cells , const int * global_cell) const
-{
- static_cast(filename); // Suppress "unused variable" warning.
- static_cast(num_cells); // Suppress "unused variable" warning.
- static_cast(global_cell); // Suppress "unused variable" warning.
- OPM_THROW(std::runtime_error, "Cannot write EGRID format without ERT library support. Reconfigure opm-core with ERT support and recompile.");
-}
-
-#endif
-
-// Read an imported fortio data file using Ert.
-// Data stored in 'integer_field_map_' and 'floating_field_map_'.
-void EclipseGridParser::getNumericErtFields(const string& filename)
-{
-#ifdef HAVE_ERT
- // Read file
- ecl_file_type * ecl_file = ecl_file_open(filename.c_str() , 0);
- if (ecl_file == NULL) {
- OPM_THROW(std::runtime_error, "Could not open IMPORTed file " << filename);
- }
- const int num_kw = ecl_file_get_size(ecl_file);
- std::vector double_vec;
- std::vector int_vec;
- for (int i=0; i const std::vector&
-EclipseGridParser::getValue (const std::string& keyword) const {
- return this->getIntegerValue(keyword);
-}
-
-template <> const std::vector&
-EclipseGridParser::getValue (const std::string& keyword) const {
- return this->getFloatingPointValue(keyword);
-}
-
-} // namespace Opm
diff --git a/opm/core/io/eclipse/EclipseGridParser.hpp b/opm/core/io/eclipse/EclipseGridParser.hpp
deleted file mode 100644
index bdcbf0f7..00000000
--- a/opm/core/io/eclipse/EclipseGridParser.hpp
+++ /dev/null
@@ -1,289 +0,0 @@
-//===========================================================================
-//
-// File: EclipseGridParser.h
-//
-// Created: Wed Dec 5 17:05:13 2007
-//
-// Author: Atgeirr F Rasmussen
-//
-// $Date$
-//
-// Revision: $Id: EclipseGridParser.h,v 1.3 2008/08/18 14:16:13 atgeirr Exp $
-//
-//===========================================================================
-
-/*
- Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
- Copyright 2009, 2010 Statoil ASA.
-
- This file is part of the Open Porous Media project (OPM).
-
- OPM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OPM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with OPM. If not, see .
-*/
-
-#ifndef OPM_ECLIPSEGRIDPARSER_HEADER
-#define OPM_ECLIPSEGRIDPARSER_HEADER
-
-#include
-#include
-#include
-#include