Initial commit of ResInsight version 0.4.8

This commit is contained in:
Alf B. Rustad
2012-05-18 09:45:23 +02:00
parent a680bf941e
commit dfe97efb1b
657 changed files with 176690 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
cmake_minimum_required (VERSION 2.8)
SET (ProjectName FileInterface_UnitTests)
project ( ${ProjectName} )
# Qt
find_package (Qt4 COMPONENTS QtCore QtGui QtMain QtOpenGl REQUIRED)
include (${QT_USE_FILE})
include_directories(
${LibCore_SOURCE_DIR}
${LibGeometry_SOURCE_DIR}
${LibRender_SOURCE_DIR}
${LibViewing_SOURCE_DIR}
${ResInsight_SOURCE_DIR}/ApplicationCode
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel
${ResInsight_SOURCE_DIR}/ApplicationCode/FileInterface
${ResInsight_SOURCE_DIR}/ApplicationCode/ProjectDataModel
${ResInsight_SOURCE_DIR}/ThirdParty
${ResInsight_SOURCE_DIR}/cafProjectDataModel
${ResInsight_SOURCE_DIR}/CommonCode
${ResInsight_SOURCE_DIR}/ThirdParty/Ert/ecl/include
${ResInsight_SOURCE_DIR}/ThirdParty/Ert/util/include
${ResInsight_SOURCE_DIR}/ThirdParty/Ert/well/include
)
set( FILEINTERFACE_CPP_SOURCES
../RifReaderEclipseFileAccess.cpp
../RifReaderEclipseRestartFiles.cpp
../RifReaderEclipseResultAccess.cpp
../RifReaderEclipseUnifiedRestartFile.cpp
../RifReaderInterfaceEcl.cpp
../RifReaderInterfaceMock.cpp
)
set( RESERVOIRDATAMODEL_CPP_SOURCES
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigCell.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigGridBase.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigLocalGrid.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigReservoir.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigWellResults.cpp
)
set( CPP_SOURCES
${FILEINTERFACE_CPP_SOURCES}
${RESERVOIRDATAMODEL_CPP_SOURCES}
)
source_group( "FileInterface" FILES ${FILEINTERFACE_CPP_SOURCES} )
source_group( "ReservoirDataModel" FILES ${RESERVOIRDATAMODEL_CPP_SOURCES} )
set( UNIT_TEST_CPP_SOURCES
main.cpp
RifReaderInterfaceEcl-Test.cpp
Ert-Test.cpp
)
set( LINK_LIBRARIES
CommonCode
LibViewing
LibRender
LibGeometry
LibCore
${QT_LIBRARIES}
)
add_executable( ${ProjectName}
${CPP_SOURCES}
${UNIT_TEST_CPP_SOURCES}
${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc
)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set ( LINUX_LINK_LIBRARIES
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/ecl/lib/libecl.a
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/util/lib/libutil.a
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/well/lib/libwell.a
lapack
)
# Linux specific code
set(CMAKE_CXX_FLAGS "-DCVF_LINUX -DUSE_ECL_LIB -pipe -Wextra -Woverloaded-virtual -Wformat")
set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG -D_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNO_DEBUG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries( ${ProjectName} ${LINK_LIBRARIES} ${LINUX_LINK_LIBRARIES})
# Copy Qt Dlls
if (MSVC)
set (QTLIBLIST QtCore QtGui QtOpenGl)
foreach (qtlib ${QTLIBLIST})
# Debug
execute_process(COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}d4.dll ${CMAKE_CURRENT_BINARY_DIR}/Debug/${qtlib}d4.dll)
# Release
execute_process(COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}4.dll ${CMAKE_CURRENT_BINARY_DIR}/Release/${qtlib}4.dll)
endforeach( qtlib )
endif(MSVC)

View File

@@ -0,0 +1,104 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#ifdef USE_ECL_LIB
#include <time.h>
#include <stdbool.h>
#include <util.h>
#include <int_vector.h>
#include <ecl_intehead.h>
#include <ecl_file.h>
#include <ecl_kw.h>
#include <ecl_kw_magic.h>
#include <ecl_util.h>
#include <well_state.h>
#include <well_info.h>
#include <well_conn.h>
#include <well_ts.h>
#include "gtest/gtest.h"
//--------------------------------------------------------------------------------------------------
/// This file contains test code taken from the test cases in ERT source code.
// There is a typedef issue (center) between ERT and QTextStream, so this file does not include any
// Qt files.
//--------------------------------------------------------------------------------------------------
TEST(RigReservoirTest, WellTestErt)
{
char filename[1024] = "/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.UNRST";
well_info_type * well_info = well_info_alloc( NULL );
well_info_load_rstfile( well_info , filename);
// List all wells:
{
int iwell;
for (iwell = 0; iwell < well_info_get_num_wells( well_info ); iwell++)
{
printf("Well[%02d] : %s \n",iwell , well_info_iget_well_name( well_info , iwell));
}
}
// Look at the timeseries for one well:
{
well_ts_type * well_ts = well_info_get_ts( well_info , well_info_iget_well_name( well_info , 0));
for (int i =0; i < well_ts_get_size( well_ts ); i++)
{
well_state_type * well_state = well_ts_iget_state( well_ts , i );
printf("Well:%s report:%04d state:",well_state_get_name( well_state ), well_state_get_report_nr( well_state ));
if (well_state_is_open( well_state ))
printf("OPEN\n");
else
printf("CLOSED\n");
}
}
// Look at one well_state:
{
well_state_type * well_state = well_info_iiget_state( well_info , 0 , 0 );
printf("Well:%s report:%04d \n",well_state_get_name( well_state ), well_state_get_report_nr( well_state ));
{
int branchCount = well_state_get_num_branches(well_state);
for (int ibranch = 0 ; ibranch < branchCount; ++ibranch)
{
printf("Branch: %d", ibranch);
for (int iconn = 0; iconn < well_state_get_num_connections( well_state, ibranch ); iconn++)
{
const well_conn_type * conn = well_state_get_connections( well_state , ibranch)[iconn];
printf("Connection:%02d i=%3d j=%3d k=%3d State:",iconn , conn->i, conn->j , conn->k);
if (conn->open)
printf("Open\n");
else
printf("Closed\n");
}
}
}
}
well_info_free( well_info );
}
#endif //USE_ECL_LIB

View File

@@ -0,0 +1,99 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RIStdInclude.h"
#include "gtest/gtest.h"
#include "RigReservoir.h"
#include "RifReaderInterfaceEcl.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RigReservoirTest, BasicTest)
{
cvf::ref<RifReaderInterfaceECL> readerInterfaceEcl = new RifReaderInterfaceECL;
cvf::ref<RigReservoir> reservoir = new RigReservoir;
// Location of test dataset received from Håkon Høgstøl in July 2011 with 10k active cells
QString filename("/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID");
bool result = readerInterfaceEcl->open(filename, reservoir.p());
EXPECT_TRUE(result);
{
QStringList staticResults = readerInterfaceEcl->staticResults();
EXPECT_EQ(42, staticResults.size());
qDebug() << "Static results\n" << staticResults;
QStringList dynamicResults = readerInterfaceEcl->dynamicResults();
EXPECT_EQ(23, dynamicResults.size());
qDebug() << "Dynamic results\n" << dynamicResults;
int numTimeSteps = static_cast<int>(readerInterfaceEcl->numTimeSteps());
EXPECT_EQ(9, numTimeSteps);
QStringList timeStepText = readerInterfaceEcl->timeStepText();
EXPECT_EQ(numTimeSteps, timeStepText.size());
qDebug() << "Time step texts\n" << timeStepText;
}
readerInterfaceEcl->close();
{
QStringList staticResults = readerInterfaceEcl->staticResults();
EXPECT_EQ(0, staticResults.size());
QStringList dynamicResults = readerInterfaceEcl->dynamicResults();
EXPECT_EQ(0, dynamicResults.size());
int numTimeSteps = static_cast<int>(readerInterfaceEcl->numTimeSteps());
EXPECT_EQ(0, numTimeSteps);
QStringList timeStepText = readerInterfaceEcl->timeStepText();
EXPECT_EQ(numTimeSteps, timeStepText.size());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RigReservoirTest, WellTest)
{
cvf::ref<RifReaderInterfaceECL> readerInterfaceEcl = new RifReaderInterfaceECL;
cvf::ref<RigReservoir> reservoir = new RigReservoir;
// Location of test dataset received from Håkon Høgstøl in July 2011 with 10k active cells
QString filename("/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID");
bool result = readerInterfaceEcl->open(filename, reservoir.p());
EXPECT_TRUE(result);
cvf::UByteArray* mainGridWellCells = reservoir->wellCellsInGrid(0);
EXPECT_TRUE(mainGridWellCells->size() == reservoir->mainGrid()->cellCount());
}

View File

@@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RIStdInclude.h"
#include "cvfBase.h"
#include "gtest/gtest.h"
#include <stdio.h>
#include "cvfTrace.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int main(int argc, char **argv)
{
cvf::Assert::setReportMode(cvf::Assert::CONSOLE);
testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
std::cout << "Please press <Enter> to close the window.";
std::cin.get();
return result;
}

View File

@@ -0,0 +1,365 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RifReaderEclipseFileAccess.h"
#ifdef USE_ECL_LIB
#include "ecl_file.h"
#include "ecl_intehead.h"
#endif //USE_ECL_LIB
#include <QFileInfo>
//--------------------------------------------------------------------------------------------------
/// Constructor
//--------------------------------------------------------------------------------------------------
RifReaderEclipseFileAccess::RifReaderEclipseFileAccess()
{
#ifdef USE_ECL_LIB
m_file = NULL;
#endif //USE_ECL_LIB
}
//--------------------------------------------------------------------------------------------------
/// Destructor
//--------------------------------------------------------------------------------------------------
RifReaderEclipseFileAccess::~RifReaderEclipseFileAccess()
{
close();
}
//--------------------------------------------------------------------------------------------------
/// Open file given by name
//--------------------------------------------------------------------------------------------------
bool RifReaderEclipseFileAccess::open(const QString& fileName)
{
#ifdef USE_ECL_LIB
// Close current file if any
close();
m_file = ecl_file_open(fileName.toAscii().data());
if (!m_file) return false;
return true;
#else
return false;
#endif //USE_ECL_LIB
}
//--------------------------------------------------------------------------------------------------
/// Close file
//--------------------------------------------------------------------------------------------------
void RifReaderEclipseFileAccess::close()
{
#ifdef USE_ECL_LIB
if (m_file)
{
ecl_file_close(m_file);
m_file = NULL;
}
#endif //USE_ECL_LIB
}
//--------------------------------------------------------------------------------------------------
/// Get the number of occurrences of the given keyword
//--------------------------------------------------------------------------------------------------
size_t RifReaderEclipseFileAccess::numOccurrences(const QString& keyword)
{
#ifdef USE_ECL_LIB
CVF_ASSERT(m_file);
return (size_t) ecl_file_get_num_named_kw(m_file, keyword.toAscii().data());
#else
return 0;
#endif //USE_ECL_LIB
}
//--------------------------------------------------------------------------------------------------
/// Get keywords found on file given by name.
/// If numDataItems > -1, get keywords with that exact number of data items only.
//--------------------------------------------------------------------------------------------------
bool RifReaderEclipseFileAccess::keywordsOnFile(QStringList* keywords, size_t numDataItems, size_t numSteps)
{
#ifdef USE_ECL_LIB
CVF_ASSERT(m_file);
CVF_ASSERT(keywords);
keywords->clear();
size_t numKeywords = ecl_file_get_num_distinct_kw(m_file);
size_t i;
for (i = 0; i < numKeywords; i++)
{
const char* kw = ecl_file_iget_distinct_kw(m_file , i);
size_t numKWOccurences = ecl_file_get_num_named_kw(m_file, kw);
if (numDataItems != cvf::UNDEFINED_SIZE_T)
{
bool dataTypeSupported = true;
size_t numKWValues = 0;
size_t j;
for (j = 0; j < numKWOccurences; j++)
{
numKWValues += (size_t) ecl_file_iget_named_size(m_file, kw, j);
// Check the data type - only float and double are supported
ecl_type_enum dataType = ecl_file_iget_named_type(m_file, kw, j);
if (dataType != ECL_DOUBLE_TYPE && dataType != ECL_FLOAT_TYPE && dataType != ECL_INT_TYPE )
{
dataTypeSupported = false;
break;
}
}
if (dataTypeSupported)
{
if (numSteps != cvf::UNDEFINED_SIZE_T && numSteps > 0)
{
numKWValues /= numSteps;
}
// Append keyword to the list if it has the given number of values in total
if (numKWValues == numDataItems)
{
keywords->append(QString(kw));
}
}
}
else
{
keywords->append(QString(kw));
}
}
return true;
#else
return false;
#endif //USE_ECL_LIB
}
//--------------------------------------------------------------------------------------------------
/// Get list of time step texts (dates)
//--------------------------------------------------------------------------------------------------
bool RifReaderEclipseFileAccess::timeStepsText(QStringList* timeSteps)
{
#ifdef USE_ECL_LIB
CVF_ASSERT(timeSteps);
CVF_ASSERT(m_file);
const char* KW_INTEHEAD = "INTEHEAD";
// Get the number of occurrences of the INTEHEAD keyword
size_t numINTEHEAD = numOccurrences(KW_INTEHEAD);
QStringList timeStepsFound;
size_t i;
for (i = 0; i < numINTEHEAD; i++)
{
ecl_kw_type* kwINTEHEAD = ecl_file_iget_named_kw(m_file, KW_INTEHEAD, i);
if (kwINTEHEAD)
{
// Get date info
time_t stepTime = util_make_date(ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_DAY_INDEX),
ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_MONTH_INDEX),
ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_YEAR_INDEX));
// Hack!!! We seem to get 01/01/1970 (time -1) for sub grids!
if (stepTime < 0) continue;
// Build date string
char* dateString = util_alloc_date_string(stepTime);
timeStepsFound += QString(dateString);
util_safe_free(dateString);
}
}
// Time steps are given for both the main grid and all sub grids,
// so we need to make sure that duplicates are removed
timeStepsFound.removeDuplicates();
// Return time step info to caller
*timeSteps = timeStepsFound;
return true;
#else
return false;
#endif //USE_ECL_LIB
}
//--------------------------------------------------------------------------------------------------
/// Get list of time step texts (dates)
//--------------------------------------------------------------------------------------------------
bool RifReaderEclipseFileAccess::timeSteps(QList<QDateTime>* timeSteps)
{
#ifdef USE_ECL_LIB
CVF_ASSERT(timeSteps);
CVF_ASSERT(m_file);
const char* KW_INTEHEAD = "INTEHEAD";
// Get the number of occurrences of the INTEHEAD keyword
size_t numINTEHEAD = numOccurrences(KW_INTEHEAD);
QList<QDateTime> timeStepsFound;
size_t i;
for (i = 0; i < numINTEHEAD; i++)
{
ecl_kw_type* kwINTEHEAD = ecl_file_iget_named_kw(m_file, KW_INTEHEAD, i);
if (kwINTEHEAD)
{
// Get date info
time_t stepTime = util_make_date(ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_DAY_INDEX),
ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_MONTH_INDEX),
ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_YEAR_INDEX));
// Hack!!! We seem to get 01/01/1970 (time -1) for sub grids!
if (stepTime < 0) continue;
// Build date string
QDateTime dateTime = QDateTime::fromTime_t(stepTime);
if (timeStepsFound.indexOf(dateTime) < 0)
{
timeStepsFound.push_back(dateTime);
}
}
}
// Return time step info to caller
*timeSteps = timeStepsFound;
return true;
#else
return false;
#endif //USE_ECL_LIB
}
//--------------------------------------------------------------------------------------------------
/// Get first occurrence of file of given type in given list of filenames, as filename or NULL if not found
//--------------------------------------------------------------------------------------------------
bool RifReaderEclipseFileAccess::keywordData(const QString& keyword, size_t index, std::vector<double>* values)
{
#ifdef USE_ECL_LIB
CVF_ASSERT(m_file);
CVF_ASSERT(values);
ecl_kw_type* kwData = ecl_file_iget_named_kw(m_file, keyword.toAscii().data(), index);
if (kwData)
{
size_t numValues = ecl_kw_get_size(kwData);
std::vector<double> doubleData;
doubleData.resize(numValues);
ecl_kw_get_data_as_double(kwData, doubleData.data());
values->insert(values->end(), doubleData.begin(), doubleData.end());
}
return true;
#else
return false;
#endif //USE_ECL_LIB
}
//--------------------------------------------------------------------------------------------------
/// Get first occurrence of file of given type in given list of filenames, as filename or NULL if not found
//--------------------------------------------------------------------------------------------------
#ifdef USE_ECL_LIB
QString RifReaderEclipseFileAccess::fileNameByType(const QStringList& fileSet, ecl_file_enum fileType)
{
int i;
for (i = 0; i < fileSet.count(); i++)
{
bool formatted = false;
int reportNumber = -1;
if (ecl_util_get_file_type(fileSet.at(i).toAscii().data(), &formatted, &reportNumber) == fileType)
{
return QString(fileSet.at(i).data());
}
}
return QString::null;
}
#endif //USE_ECL_LIB
//--------------------------------------------------------------------------------------------------
/// Get all files of file of given type in given list of filenames, as filename or NULL if not found
//--------------------------------------------------------------------------------------------------
#ifdef USE_ECL_LIB
QStringList RifReaderEclipseFileAccess::fileNamesByType(const QStringList& fileSet, ecl_file_enum fileType)
{
QStringList fileNames;
int i;
for (i = 0; i < fileSet.count(); i++)
{
bool formatted = false;
int reportNumber = -1;
if (ecl_util_get_file_type(fileSet.at(i).toAscii().data(), &formatted, &reportNumber) == fileType)
{
fileNames.append(QString(fileSet.at(i).data()));
}
}
return fileNames;
}
#endif //USE_ECL_LIB
//--------------------------------------------------------------------------------------------------
/// Get set of Eclipse files based on an input file and its path
//--------------------------------------------------------------------------------------------------
bool RifReaderEclipseFileAccess::fileSet(const QString& fileName, QStringList* fileSet)
{
CVF_ASSERT(fileSet);
fileSet->clear();
#ifdef USE_ECL_LIB
QString filePath = QFileInfo(fileName).path();
QString fileNameBase = QFileInfo(fileName).baseName();
stringlist_type* eclipseFiles = stringlist_alloc_new();
ecl_util_select_filelist(filePath.toAscii().data(), fileNameBase.toAscii().data(), ECL_OTHER_FILE, false, eclipseFiles);
int i;
for (i = 0; i < stringlist_get_size(eclipseFiles); i++)
{
fileSet->append(stringlist_safe_iget(eclipseFiles, i));
}
stringlist_free(eclipseFiles);
#endif //USE_ECL_LIB
return fileSet->count() > 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
#ifdef USE_ECL_LIB
ecl_file_type* RifReaderEclipseFileAccess::filePointer()
{
return m_file;
}
#endif //USE_ECL_LIB

View File

@@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfLibCore.h"
#include <QString>
#include <QStringList>
#include <QDateTime>
#ifdef USE_ECL_LIB
#include "ecl_file.h"
#endif //USE_ECL_LIB
//==================================================================================================
//
// Class for access to Eclipse "keyword" files using libecl
//
//==================================================================================================
class RifReaderEclipseFileAccess : public cvf::Object
{
public:
RifReaderEclipseFileAccess();
virtual ~RifReaderEclipseFileAccess();
bool open(const QString& fileName);
void close();
size_t numOccurrences(const QString& keyword);
bool keywordsOnFile(QStringList* keywords, size_t numDataItems = cvf::UNDEFINED_SIZE_T, size_t numSteps = cvf::UNDEFINED_SIZE_T);
bool timeStepsText(QStringList* timeSteps);
bool timeSteps(QList<QDateTime>* timeSteps);
bool keywordData(const QString& keyword, size_t index, std::vector<double>* values);
#ifdef USE_ECL_LIB
ecl_file_type* filePointer();
#endif //USE_ECL_LIB
// Static methods
static bool fileSet(const QString& fileName, QStringList* fileSet);
#ifdef USE_ECL_LIB
static QString fileNameByType(const QStringList& fileSet, ecl_file_enum fileType);
static QStringList fileNamesByType(const QStringList& fileSet, ecl_file_enum fileType);
#endif //USE_ECL_LIB
protected:
#ifdef USE_ECL_LIB
ecl_file_type* m_file;
#endif //USE_ECL_LIB
};

View File

@@ -0,0 +1,177 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RifReaderEclipseRestartFiles.h"
#include "RifReaderEclipseFileAccess.h"
//--------------------------------------------------------------------------------------------------
/// Constructor
//--------------------------------------------------------------------------------------------------
RifReaderEclipseRestartFiles::RifReaderEclipseRestartFiles(size_t numGrids, size_t numActiveCells)
: RifReaderEclipseResultsAccess(numGrids, numActiveCells)
{
}
//--------------------------------------------------------------------------------------------------
/// Destructor
//--------------------------------------------------------------------------------------------------
RifReaderEclipseRestartFiles::~RifReaderEclipseRestartFiles()
{
close();
}
//--------------------------------------------------------------------------------------------------
/// Open files
//--------------------------------------------------------------------------------------------------
bool RifReaderEclipseRestartFiles::open(const QStringList& fileSet)
{
close();
size_t numFiles = fileSet.size();
size_t i;
for (i = 0; i < numFiles; i++)
{
cvf::ref<RifReaderEclipseFileAccess> fileAccess = new RifReaderEclipseFileAccess;
if (!fileAccess->open(fileSet[i]))
{
close();
return false;
}
m_files.push_back(fileAccess);
}
return true;
}
//--------------------------------------------------------------------------------------------------
/// Close files
//--------------------------------------------------------------------------------------------------
void RifReaderEclipseRestartFiles::close()
{
m_files.clear();
}
//--------------------------------------------------------------------------------------------------
/// Get the number of time steps
//--------------------------------------------------------------------------------------------------
size_t RifReaderEclipseRestartFiles::numTimeSteps()
{
return m_files.size();
}
//--------------------------------------------------------------------------------------------------
/// Get the time step texts
//--------------------------------------------------------------------------------------------------
QStringList RifReaderEclipseRestartFiles::timeStepsText()
{
QStringList timeSteps;
size_t numSteps = numTimeSteps();
size_t i;
for (i = 0; i < numSteps; i++)
{
QStringList stepText;
m_files[i]->timeStepsText(&stepText);
timeSteps.append(stepText.size() == 1 ? stepText : QStringList(QString("Step %1").arg(i+1)));
}
return timeSteps;
}
//--------------------------------------------------------------------------------------------------
/// Get the time steps
//--------------------------------------------------------------------------------------------------
QList<QDateTime> RifReaderEclipseRestartFiles::timeSteps()
{
QList<QDateTime> timeSteps;
size_t numSteps = numTimeSteps();
size_t i;
for (i = 0; i < numSteps; i++)
{
QList<QDateTime> stepTime;
m_files[i]->timeSteps(&stepTime);
if (stepTime.size() == 1)
{
timeSteps.push_back(stepTime[0]);
}
else
{
timeSteps.push_back(QDateTime());
}
}
return timeSteps;
}
//--------------------------------------------------------------------------------------------------
/// Get list of result names
//--------------------------------------------------------------------------------------------------
QStringList RifReaderEclipseRestartFiles::resultNames()
{
CVF_ASSERT(numTimeSteps() > 0);
// Get the results found on the first file
QStringList resultsList;
m_files[0]->keywordsOnFile(&resultsList, m_numActiveCells, 1);
return resultsList;
}
//--------------------------------------------------------------------------------------------------
/// Get result values for given time step
//--------------------------------------------------------------------------------------------------
bool RifReaderEclipseRestartFiles::results(const QString& resultName, size_t timeStep, std::vector<double>* values)
{
size_t numOccurrences = m_files[timeStep]->numOccurrences(resultName);
CVF_ASSERT(m_numGrids == numOccurrences);
size_t i;
for (i = 0; i < numOccurrences; i++)
{
std::vector<double> partValues;
if (!m_files[timeStep]->keywordData(resultName, i, &partValues)) // !! don't need to append afterwards
{
return false;
}
values->insert(values->end(), partValues.begin(), partValues.end());
}
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
#ifdef USE_ECL_LIB
void RifReaderEclipseRestartFiles::readWellData(well_info_type* well_info)
{
if (!well_info) return;
size_t i;
for (i=0; i < m_files.size(); i++)
{
well_info_add_UNRST_wells(well_info, m_files[i]->filePointer());
}
}
#endif

View File

@@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RifReaderEclipseResultAccess.h"
#include <vector>
class RifReaderEclipseFileAccess;
//==================================================================================================
//
// Class for access to results from a set of restart files
//
//==================================================================================================
class RifReaderEclipseRestartFiles : public RifReaderEclipseResultsAccess
{
public:
RifReaderEclipseRestartFiles(size_t numGrids, size_t numActiveCells);
virtual ~RifReaderEclipseRestartFiles();
bool open(const QStringList& fileSet);
void close();
size_t numTimeSteps();
QStringList timeStepsText();
QList<QDateTime> timeSteps();
QStringList resultNames();
bool results(const QString& resultName, size_t timeStep, std::vector<double>* values);
#ifdef USE_ECL_LIB
virtual void readWellData(well_info_type* well_info);
#endif //USE_ECL_LIB
private:
std::vector< cvf::ref<RifReaderEclipseFileAccess> > m_files;
};

View File

@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RifReaderEclipseResultAccess.h"
//--------------------------------------------------------------------------------------------------
/// Constructor
//--------------------------------------------------------------------------------------------------
RifReaderEclipseResultsAccess::RifReaderEclipseResultsAccess(size_t numGrids, size_t numActiveCells)
{
m_numGrids = numGrids;
m_numActiveCells = numActiveCells;
}
//--------------------------------------------------------------------------------------------------
/// Destructor
//--------------------------------------------------------------------------------------------------
RifReaderEclipseResultsAccess::~RifReaderEclipseResultsAccess()
{
}

View File

@@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfLibCore.h"
#include <QStringList>
#include <QDateTime>
#include <vector>
#ifdef USE_ECL_LIB
#include "well_info.h"
#endif // USE_ECL_LIB
//==================================================================================================
//
// Abstract class for results access
//
//==================================================================================================
class RifReaderEclipseResultsAccess : public cvf::Object
{
public:
RifReaderEclipseResultsAccess(size_t numGrids, size_t numActiveCells);
virtual ~RifReaderEclipseResultsAccess();
virtual bool open(const QStringList& fileSet) = 0;
virtual void close() = 0;
virtual size_t numTimeSteps() = 0;
virtual QStringList timeStepsText() = 0;
virtual QList<QDateTime> timeSteps() = 0;
virtual QStringList resultNames() = 0;
virtual bool results(const QString& resultName, size_t timeStep, std::vector<double>* values) = 0;
#ifdef USE_ECL_LIB
virtual void readWellData(well_info_type * well_info) = 0;
#endif
protected:
size_t m_numGrids;
size_t m_numActiveCells;
};

View File

@@ -0,0 +1,164 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RifReaderEclipseUnifiedRestartFile.h"
#include "RifReaderEclipseFileAccess.h"
#ifdef USE_ECL_LIB
#include <well_state.h>
#include <well_info.h>
#include <well_conn.h>
#include <well_ts.h>
#endif
//--------------------------------------------------------------------------------------------------
/// Constructor
//--------------------------------------------------------------------------------------------------
RifReaderEclipseUnifiedRestartFile::RifReaderEclipseUnifiedRestartFile(size_t numGrids, size_t numActiveCells)
: RifReaderEclipseResultsAccess(numGrids, numActiveCells)
{
}
//--------------------------------------------------------------------------------------------------
/// Destructor
//--------------------------------------------------------------------------------------------------
RifReaderEclipseUnifiedRestartFile::~RifReaderEclipseUnifiedRestartFile()
{
close();
}
//--------------------------------------------------------------------------------------------------
/// Open file
//--------------------------------------------------------------------------------------------------
bool RifReaderEclipseUnifiedRestartFile::open(const QStringList& fileSet)
{
#ifdef USE_ECL_LIB
QString fileName = fileSet[0];
cvf::ref<RifReaderEclipseFileAccess> fileAccess = new RifReaderEclipseFileAccess;
if (!fileAccess->open(fileName))
{
return false;
}
m_file = fileAccess;
return true;
#else
return false;
#endif
}
//--------------------------------------------------------------------------------------------------
/// Close file
//--------------------------------------------------------------------------------------------------
void RifReaderEclipseUnifiedRestartFile::close()
{
if (m_file.notNull())
{
m_file->close();
m_file = NULL;
}
}
//--------------------------------------------------------------------------------------------------
/// Get the number of time steps
//--------------------------------------------------------------------------------------------------
size_t RifReaderEclipseUnifiedRestartFile::numTimeSteps()
{
QStringList timeSteps = timeStepsText();
return timeSteps.size();
}
//--------------------------------------------------------------------------------------------------
/// Get the time step texts
//--------------------------------------------------------------------------------------------------
QStringList RifReaderEclipseUnifiedRestartFile::timeStepsText()
{
RifReaderEclipseFileAccess* file = m_file.p();
CVF_ASSERT(file != NULL);
QStringList timeSteps;
file->timeStepsText(&timeSteps);
return timeSteps;
}
//--------------------------------------------------------------------------------------------------
/// Get the time steps
//--------------------------------------------------------------------------------------------------
QList<QDateTime> RifReaderEclipseUnifiedRestartFile::timeSteps()
{
RifReaderEclipseFileAccess* file = m_file.p();
CVF_ASSERT(file != NULL);
QList<QDateTime> timeSteps;
file->timeSteps(&timeSteps);
return timeSteps;
}
//--------------------------------------------------------------------------------------------------
/// Get list of result names
//--------------------------------------------------------------------------------------------------
QStringList RifReaderEclipseUnifiedRestartFile::resultNames()
{
// Get the results found on the UNRST file
QStringList resultsList;
m_file->keywordsOnFile(&resultsList, m_numActiveCells, numTimeSteps());
return resultsList;
}
//--------------------------------------------------------------------------------------------------
/// Get result values for given time step
//--------------------------------------------------------------------------------------------------
bool RifReaderEclipseUnifiedRestartFile::results(const QString& resultName, size_t timeStep, std::vector<double>* values)
{
size_t numOccurrences = m_file->numOccurrences(resultName);
size_t startIndex = timeStep*m_numGrids;
CVF_ASSERT(startIndex + m_numGrids <= numOccurrences);
size_t i;
for (i = startIndex; i < startIndex + m_numGrids; i++)
{
std::vector<double> partValues;
if (!m_file->keywordData(resultName, i, &partValues)) // !! don't need to append afterwards
{
return false;
}
values->insert(values->end(), partValues.begin(), partValues.end());
}
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
#ifdef USE_ECL_LIB
void RifReaderEclipseUnifiedRestartFile::readWellData(well_info_type* well_info)
{
if (!well_info) return;
well_info_add_UNRST_wells(well_info, m_file->filePointer());
}
#endif

View File

@@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RifReaderEclipseResultAccess.h"
class RifReaderEclipseFileAccess;
#ifdef USE_ECL_LIB
#include "well_info.h"
#endif // USE_ECL_LIB
//==================================================================================================
//
// Class for access to results from a unified restart file
//
//==================================================================================================
class RifReaderEclipseUnifiedRestartFile : public RifReaderEclipseResultsAccess
{
public:
RifReaderEclipseUnifiedRestartFile(size_t numGrids, size_t numActiveCells);
virtual ~RifReaderEclipseUnifiedRestartFile();
bool open(const QStringList& fileSet);
void close();
size_t numTimeSteps();
QStringList timeStepsText();
QList<QDateTime> timeSteps();
QStringList resultNames();
bool results(const QString& resultName, size_t timeStep, std::vector<double>* values);
#ifdef USE_ECL_LIB
virtual void readWellData(well_info_type * well_info);
#endif
private:
cvf::ref<RifReaderEclipseFileAccess> m_file;
};

View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfLibCore.h"
#include <QString>
#include <QStringList>
class RigReservoir;
//==================================================================================================
//
// Data interface base class
//
//==================================================================================================
class RifReaderInterface : public cvf::Object
{
public:
RifReaderInterface() {}
virtual ~RifReaderInterface() {}
virtual bool open(const QString& fileName, RigReservoir* reservoir) = 0;
virtual void close() = 0;
virtual const QStringList& staticResults() const = 0;
virtual const QStringList& dynamicResults() const = 0;
virtual size_t numTimeSteps() const = 0;
virtual const QStringList& timeStepText() const = 0;
virtual bool staticResult(const QString& result, std::vector<double>* values) = 0;
virtual bool dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values) = 0;
};

View File

@@ -0,0 +1,609 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "cvfBase.h"
#include "RigMainGrid.h"
#include "RigReservoir.h"
#include "RifReaderInterfaceEcl.h"
#include "RifReaderEclipseFileAccess.h"
#include "RifReaderEclipseUnifiedRestartFile.h"
#include "RifReaderEclipseRestartFiles.h"
#include <iostream>
#ifdef USE_ECL_LIB
#include "ecl_grid.h"
#include "well_state.h"
#endif //USE_ECL_LIB
//--------------------------------------------------------------------------------------------------
/// ECLIPSE cell numbering layout:
/// Lower layer: Upper layer
///
/// 2---3 6---7
/// | | | |
/// 0---1 4---5
///
///
///
//--------------------------------------------------------------------------------------------------
// The indexing conventions for vertices in ECLIPSE
//
// 6-------------7
// /| /|
// / | / |
// / | / |
// 4-------------5 |
// | | | |
// | 2---------|---3
// | / | /
// | / | /
// |/ |/
// 0-------------1
// vertex indices
//
// The indexing conventions for vertices in ResInsight
//
// 7-------------6
// /| /|
// / | / |
// / | / |
// 4-------------5 |
// | | | |
// | 3---------|---2
// | / | /
// | / | /
// |/ |/
// 0-------------1
// vertex indices
//
static const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 };
//**************************************************************************************************
// Static functions
//**************************************************************************************************
#ifdef USE_ECL_LIB
bool transferGridCellData(RigMainGrid* mainGrid, RigGridBase* localGrid, ecl_grid_type* localEclGrid, size_t activeStartIndex)
{
int cellCount = ecl_grid_get_global_size(localEclGrid);
size_t cellStartIndex = mainGrid->cells().size();
size_t nodeStartIndex = mainGrid->nodes().size();
RigCell defaultCell;
defaultCell.setHostGrid(localGrid);
mainGrid->cells().resize(cellStartIndex + cellCount, defaultCell);
mainGrid->nodes().resize(nodeStartIndex + cellCount*8, cvf::Vec3d(0,0,0));
// Loop over cells and fill them with data
#pragma omp parallel for
for (int gIdx = 0; gIdx < cellCount; ++gIdx)
{
RigCell& cell = mainGrid->cells()[cellStartIndex + gIdx];
// The invalid (tainted) cell concept in ecl was not correct at all,
// so this is disabeled.
//bool invalid = ecl_grid_cell_invalid1(localEclGrid, gIdx);
//cell.setInvalid(invalid);
cell.setCellIndex(gIdx);
bool active = ecl_grid_cell_active1(localEclGrid, gIdx);
cell.setActive(active);
cell.setGlobalActiveIndex(active ? activeStartIndex + ecl_grid_get_active_index1(localEclGrid, gIdx) : cvf::UNDEFINED_SIZE_T);
int parentCellIndex = ecl_grid_get_parent_cell1(localEclGrid, gIdx);
if (parentCellIndex == -1)
{
cell.setParentCellIndex(cvf::UNDEFINED_SIZE_T);
}
else
{
cell.setParentCellIndex(parentCellIndex);
}
// Corner coordinates
int cIdx;
for (cIdx = 0; cIdx < 8; ++cIdx)
{
double * point = mainGrid->nodes()[nodeStartIndex + gIdx * 8 + cellMappingECLRi[cIdx]].ptr();
ecl_grid_get_corner_xyz1(localEclGrid, gIdx, cIdx, &(point[0]), &(point[1]), &(point[2]));
point[2] = -point[2];
cell.cornerIndices()[cIdx] = nodeStartIndex + gIdx*8 + cIdx;
}
// Sub grid in cell
const ecl_grid_type* subGrid = ecl_grid_get_cell_lgr1(localEclGrid, gIdx);
if (subGrid != NULL)
{
int subGridFileIndex = ecl_grid_get_grid_nr(subGrid);
CVF_ASSERT(subGridFileIndex > 0);
cell.setSubGrid(static_cast<RigLocalGrid*>(mainGrid->gridByIndex(subGridFileIndex)));
}
}
}
#endif
//==================================================================================================
//
// Class RigReaderInterfaceECL
//
//==================================================================================================
//--------------------------------------------------------------------------------------------------
/// Constructor
//--------------------------------------------------------------------------------------------------
RifReaderInterfaceECL::RifReaderInterfaceECL()
{
ground();
}
//--------------------------------------------------------------------------------------------------
/// Destructor
//--------------------------------------------------------------------------------------------------
RifReaderInterfaceECL::~RifReaderInterfaceECL()
{
}
//--------------------------------------------------------------------------------------------------
/// Ground members
//--------------------------------------------------------------------------------------------------
void RifReaderInterfaceECL::ground()
{
m_fileName.clear();
m_fileSet.clear();
m_staticResults.clear();
m_dynamicResults.clear();
m_timeStepTexts.clear();
m_timeSteps.clear();
m_numGrids = 0;
}
//--------------------------------------------------------------------------------------------------
/// Close interface (for now, no files are kept open after calling methods, so just clear members)
//--------------------------------------------------------------------------------------------------
void RifReaderInterfaceECL::close()
{
m_staticResultsAccess = NULL;
m_dynamicResultsAccess = NULL;
ground();
}
//--------------------------------------------------------------------------------------------------
/// Read geometry from file given by name into given reservoir object
//--------------------------------------------------------------------------------------------------
bool RifReaderInterfaceECL::readGeometry(const QString& filename, RigReservoir* reservoir)
{
CVF_ASSERT(reservoir);
#ifdef USE_ECL_LIB
ecl_grid_type * mainEclGrid = ecl_grid_alloc( filename.toAscii().data() );
if (!mainEclGrid)
{
// Some error
return false;
}
RigMainGrid* mainGrid = reservoir->mainGrid();
{
cvf::Vec3st gridPointDim(0,0,0);
gridPointDim.x() = ecl_grid_get_nx(mainEclGrid) + 1;
gridPointDim.y() = ecl_grid_get_ny(mainEclGrid) + 1;
gridPointDim.z() = ecl_grid_get_nz(mainEclGrid) + 1;
mainGrid->setGridPointDimensions(gridPointDim);
}
// Get and set grid and lgr metadata
size_t totalCellCount = static_cast<size_t>(ecl_grid_get_global_size(mainEclGrid));
int numLGRs = ecl_grid_get_num_lgr(mainEclGrid);
int lgrIdx;
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
{
ecl_grid_type* localEclGrid = ecl_grid_iget_lgr(mainEclGrid, lgrIdx);
std::string lgrName = ecl_grid_get_name(localEclGrid);
cvf::Vec3st gridPointDim(0,0,0);
gridPointDim.x() = ecl_grid_get_nx(localEclGrid) + 1;
gridPointDim.y() = ecl_grid_get_ny(localEclGrid) + 1;
gridPointDim.z() = ecl_grid_get_nz(localEclGrid) + 1;
RigLocalGrid* localGrid = new RigLocalGrid(mainGrid);
mainGrid->addLocalGrid(localGrid);
localGrid->setIndexToStartOfCells(totalCellCount);
localGrid->setGridName(lgrName);
localGrid->setGridPointDimensions(gridPointDim);
totalCellCount += ecl_grid_get_global_size(localEclGrid);
}
// Reserve room for the cells and nodes and fill them with data
mainGrid->cells().reserve(totalCellCount);
mainGrid->nodes().reserve(8*totalCellCount);
transferGridCellData(mainGrid, mainGrid, mainEclGrid, 0);
size_t globalActiveSize = ecl_grid_get_active_size(mainEclGrid);
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
{
ecl_grid_type* localEclGrid = ecl_grid_iget_lgr(mainEclGrid, lgrIdx);
transferGridCellData(mainGrid, static_cast<RigLocalGrid*>(mainGrid->gridByIndex(lgrIdx+1)), localEclGrid, globalActiveSize);
globalActiveSize += ecl_grid_get_active_size(localEclGrid);
}
ecl_grid_free( mainEclGrid );
// !! Maybe this should set somewhere else, in a method that builds meta data !!
m_numGrids = numLGRs + 1;
#endif
return true;
}
//--------------------------------------------------------------------------------------------------
/// Open file and read geometry into given reservoir object
//--------------------------------------------------------------------------------------------------
bool RifReaderInterfaceECL::open(const QString& fileName, RigReservoir* reservoir)
{
CVF_ASSERT(reservoir);
// Make sure everything's closed
close();
// Get set of files
QStringList fileSet;
if (!RifReaderEclipseFileAccess::fileSet(fileName, &fileSet)) return false;
// Keep the set of files of interest
m_fileSet = fileSet;
// Read geometry
if (!readGeometry(fileName, reservoir)) return false;
// Build results meta data
if (!buildMetaData(reservoir)) return false;
readWellCells(reservoir);
return true;
}
//--------------------------------------------------------------------------------------------------
/// Build meta data - get states and results info
//--------------------------------------------------------------------------------------------------
bool RifReaderInterfaceECL::buildMetaData(RigReservoir* reservoir)
{
#ifdef USE_ECL_LIB
CVF_ASSERT(reservoir);
CVF_ASSERT(m_fileSet.size() > 0);
// Get the number of active cells in the grid
size_t numActiveCells = reservoir->mainGrid()->numActiveCells();
// Create access object for dynamic results
m_dynamicResultsAccess = dynamicResultsAccess(m_fileSet, m_numGrids, numActiveCells);
if (m_dynamicResultsAccess.notNull())
{
// Get time steps texts
m_timeStepTexts = m_dynamicResultsAccess->timeStepsText();
m_timeSteps = m_dynamicResultsAccess->timeSteps();
// Get the names of the dynamic results
m_dynamicResults = m_dynamicResultsAccess->resultNames();
}
QString initFileName = RifReaderEclipseFileAccess::fileNameByType(m_fileSet, ECL_INIT_FILE);
if (initFileName.size() > 0)
{
// Open init file
cvf::ref<RifReaderEclipseFileAccess> initFile = new RifReaderEclipseFileAccess;
if (!initFile->open(initFileName))
{
return false;
}
// Get the names of the static results
QStringList staticResults;
initFile->keywordsOnFile(&staticResults, numActiveCells);
m_staticResults = staticResults;
m_staticResultsAccess = initFile;
}
return true;
#else
return false;
#endif //USE_ECL_LIB
}
//--------------------------------------------------------------------------------------------------
/// Create results access object (.UNRST or .X0001 ... .XNNNN)
//--------------------------------------------------------------------------------------------------
RifReaderEclipseResultsAccess* RifReaderInterfaceECL::dynamicResultsAccess(const QStringList& fileSet, size_t numGrids, size_t numActiveCells)
{
RifReaderEclipseResultsAccess* resultsAccess = NULL;
#ifdef USE_ECL_LIB
// Look for unified restart file
QString unrstFileName = RifReaderEclipseFileAccess::fileNameByType(fileSet, ECL_UNIFIED_RESTART_FILE);
if (unrstFileName.size() > 0)
{
resultsAccess = new RifReaderEclipseUnifiedRestartFile(numGrids, numActiveCells);
if (!resultsAccess->open(QStringList(unrstFileName)))
{
delete resultsAccess;
return NULL;
}
}
else
{
// Look for set of restart files (one file per time step)
QStringList restartFiles = RifReaderEclipseFileAccess::fileNamesByType(fileSet, ECL_RESTART_FILE);
if (restartFiles.size() > 0)
{
resultsAccess = new RifReaderEclipseRestartFiles(numGrids, numActiveCells);
if (!resultsAccess->open(restartFiles))
{
delete resultsAccess;
return NULL;
}
}
}
#endif //USE_ECL_LIB
// !! could add support for formatted result files
// !! consider priorities in case multiple types exist (.UNRST, .XNNNN, ...)
return resultsAccess;
}
//--------------------------------------------------------------------------------------------------
/// Get the names of all static results
//--------------------------------------------------------------------------------------------------
const QStringList& RifReaderInterfaceECL::staticResults() const
{
return m_staticResults;
}
//--------------------------------------------------------------------------------------------------
/// Get the names of all dynamic results
//--------------------------------------------------------------------------------------------------
const QStringList& RifReaderInterfaceECL::dynamicResults() const
{
return m_dynamicResults;
}
//--------------------------------------------------------------------------------------------------
/// Get the number of time steps
//--------------------------------------------------------------------------------------------------
size_t RifReaderInterfaceECL::numTimeSteps() const
{
return m_timeStepTexts.size();
}
//--------------------------------------------------------------------------------------------------
/// Get all values of a given static result as doubles
//--------------------------------------------------------------------------------------------------
bool RifReaderInterfaceECL::staticResult(const QString& result, std::vector<double>* values)
{
CVF_ASSERT(values);
CVF_ASSERT(m_staticResultsAccess.notNull());
size_t numOccurrences = m_staticResultsAccess->numOccurrences(result);
size_t i;
for (i = 0; i < numOccurrences; i++)
{
std::vector<double> partValues;
if (!m_staticResultsAccess->keywordData(result, i, &partValues)) return false;
values->insert(values->end(), partValues.begin(), partValues.end());
}
return true;
}
//--------------------------------------------------------------------------------------------------
/// Get dynamic result at given step index. Will concatenate values for the main grid and all sub grids.
//--------------------------------------------------------------------------------------------------
bool RifReaderInterfaceECL::dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values)
{
CVF_ASSERT(m_dynamicResultsAccess.notNull());
return m_dynamicResultsAccess->results(result, stepIndex, values);
}
//--------------------------------------------------------------------------------------------------
/// Get list of time step texts
//--------------------------------------------------------------------------------------------------
const QStringList& RifReaderInterfaceECL::timeStepText() const
{
return m_timeStepTexts;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QList<QDateTime>& RifReaderInterfaceECL::timeSteps() const
{
return m_timeSteps;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderInterfaceECL::readWellCells(RigReservoir* reservoir)
{
CVF_ASSERT(reservoir);
if (m_dynamicResultsAccess.isNull()) return;
#ifdef USE_ECL_LIB
well_info_type* ert_well_info = well_info_alloc(NULL);
if (!ert_well_info) return;
m_dynamicResultsAccess->readWellData(ert_well_info);
RigMainGrid* mainGrid = reservoir->mainGrid();
std::vector<RigGridBase*> grids;
reservoir->allGrids(&grids);
cvf::Collection<RigWellResults> wells;
int wellIdx;
for (wellIdx = 0; wellIdx < well_info_get_num_wells(ert_well_info); wellIdx++)
{
const char* wellName = well_info_iget_well_name(ert_well_info, wellIdx);
CVF_ASSERT(wellName);
cvf::ref<RigWellResults> wellResults = new RigWellResults;
wellResults->m_wellName = wellName;
well_ts_type* ert_well_time_series = well_info_get_ts(ert_well_info , wellName);
int timeStepCount = well_ts_get_size(ert_well_time_series);
wellResults->m_wellCellsTimeSteps.resize(timeStepCount);
int timeIdx;
for (timeIdx = 0; timeIdx < timeStepCount; timeIdx++)
{
well_state_type* ert_well_state = well_ts_iget_state(ert_well_time_series, timeIdx);
RigWellResultFrame& wellResFrame = wellResults->m_wellCellsTimeSteps[timeIdx];
// Build timestamp for well
// Also see RifReaderEclipseFileAccess::timeStepsText for accessing time_t structures
{
time_t stepTime = well_state_get_sim_time(ert_well_state);
wellResFrame.m_timestamp = QDateTime::fromTime_t(stepTime);
}
// Production type
well_type_enum ert_well_type = well_state_get_type(ert_well_state);
if (ert_well_type == PRODUCER)
{
wellResFrame.m_productionType = RigWellResultFrame::PRODUCER;
}
else if (ert_well_type == WATER_INJECTOR)
{
wellResFrame.m_productionType = RigWellResultFrame::WATER_INJECTOR;
}
else if (ert_well_type == GAS_INJECTOR)
{
wellResFrame.m_productionType = RigWellResultFrame::GAS_INJECTOR;
}
else if (ert_well_type == OIL_INJECTOR)
{
wellResFrame.m_productionType = RigWellResultFrame::OIL_INJECTOR;
}
else
{
wellResFrame.m_productionType = RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE;
}
wellResFrame.m_isOpen = well_state_is_open( ert_well_state );
// Loop over all the grids in the model. If we have connections in one, we will discard
// the maingrid connections as they are "duplicates"
bool hasWellConnectionsInLGR = false;
for (size_t gridNr = 1; gridNr < grids.size(); ++gridNr)
{
int branchCount = well_state_iget_lgr_num_branches(ert_well_state, gridNr);
if (branchCount > 0)
{
hasWellConnectionsInLGR = true;
break;
}
}
size_t gridNr = hasWellConnectionsInLGR ? 1 : 0;
for (; gridNr < grids.size(); ++gridNr)
{
// Wellhead. If several grids have a wellhead definition for this well, we use tha last one. (Possibly the innermost LGR)
const well_conn_type* ert_wellhead = well_state_iget_wellhead(ert_well_state, gridNr);
if (ert_wellhead)
{
wellResFrame.m_wellHead.m_gridIndex = gridNr;
int gridK = CVF_MAX(0, ert_wellhead->k); // Why this ?
wellResFrame.m_wellHead.m_gridCellIndex = grids[gridNr]->cellIndexFromIJK(ert_wellhead->i, ert_wellhead->j, gridK);
}
int branchCount = well_state_iget_lgr_num_branches(ert_well_state, gridNr);
if (branchCount > 0)
{
if (static_cast<int>(wellResFrame.m_wellResultBranches.size()) < branchCount) wellResFrame.m_wellResultBranches.resize(branchCount);
for (int branchIdx = 0; branchIdx < branchCount; ++branchIdx )
{
// Connections
int connectionCount = well_state_iget_num_lgr_connections(ert_well_state, gridNr, branchIdx);
if (connectionCount > 0)
{
RigWellResultBranch& wellSegment = wellResFrame.m_wellResultBranches[branchIdx]; // Is this completely right? Is the branch index actually the same between lgrs ?
wellSegment.m_branchNumber = branchIdx;
size_t existingConnCount = wellSegment.m_wellCells.size();
wellSegment.m_wellCells.resize(existingConnCount + connectionCount);
int connIdx;
for (connIdx = 0; connIdx < connectionCount; connIdx++)
{
const well_conn_type* ert_connection = well_state_iget_lgr_connections( ert_well_state, gridNr, branchIdx)[connIdx];
CVF_ASSERT(ert_connection);
RigWellResultCell& data = wellSegment.m_wellCells[existingConnCount + connIdx];
data.m_gridIndex = gridNr;
data.m_gridCellIndex = grids[gridNr]->cellIndexFromIJK(ert_connection->i, ert_connection->j, ert_connection->k);
data.m_isOpen = ert_connection->open;
}
}
}
}
}
}
wellResults->computeMappingFromResultTimeIndicesToWellTimeIndices(m_timeSteps);
wells.push_back(wellResults.p());
}
well_info_free(ert_well_info);
reservoir->setWellResults(wells);
#endif
}

View File

@@ -0,0 +1,70 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RifReaderInterface.h"
class RifReaderEclipseFileAccess;
class RifReaderEclipseResultsAccess;
//==================================================================================================
//
// File interface for Eclipse output files
//
//==================================================================================================
class RifReaderInterfaceECL : public RifReaderInterface
{
public:
RifReaderInterfaceECL();
virtual ~RifReaderInterfaceECL();
bool open(const QString& fileName, RigReservoir* reservoir);
void close();
const QStringList& staticResults() const;
const QStringList& dynamicResults() const;
size_t numTimeSteps() const;
const QStringList& timeStepText() const;
const QList<QDateTime>& timeSteps() const;
bool staticResult(const QString& result, std::vector<double>* values);
bool dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values);
private:
void ground();
bool buildMetaData(RigReservoir* reservoir);
bool readGeometry(const QString& fileName, RigReservoir* reservoir);
void readWellCells(RigReservoir* reservoir);
static RifReaderEclipseResultsAccess* staticResultsAccess(const QStringList& fileSet, size_t numGrids, size_t numActiveCells);
static RifReaderEclipseResultsAccess* dynamicResultsAccess(const QStringList& fileSet, size_t numGrids, size_t numActiveCells);
private:
QString m_fileName; // Name of file used to start accessing Eclipse output files
QStringList m_fileSet; // Set of files in filename's path with same base name as filename
QStringList m_staticResults; // List of names of static results
QStringList m_dynamicResults; // List of names of dynamic results
QStringList m_timeStepTexts; // List of time step infos (dates)
QList<QDateTime> m_timeSteps;
size_t m_numGrids; // Total number of grids (main grid and all sub grids)
cvf::ref<RifReaderEclipseFileAccess> m_staticResultsAccess; // File access to static results
cvf::ref<RifReaderEclipseResultsAccess> m_dynamicResultsAccess; // File access to dynamic results
};

View File

@@ -0,0 +1,178 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RIStdInclude.h"
#include "RifReaderInterfaceMock.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifReaderInterfaceMock::open(const QString& fileName, RigReservoir* reservoir)
{
m_reservoirBuilder.populateReservoir(reservoir);
m_reservoir = reservoir;
m_dynamicResults.clear();
m_staticResults.clear();
m_timeStepTexts.clear();
size_t i;
for (i = 0; i < m_reservoirBuilder.resultCount(); i++)
{
m_dynamicResults.push_back(QString("Dynamic_Result_%1").arg(i));
}
for (i = 0; i < m_reservoirBuilder.resultCount(); i++)
{
QString varEnd;
if (i == 0) varEnd = "X";
if (i == 1) varEnd = "Y";
int resIndex = 0;
if (i > 1) resIndex = i;
m_staticResults.push_back(QString("Static_Result_%1%2").arg(resIndex).arg(varEnd));
}
for (i = 0; i < m_reservoirBuilder.timeStepCount(); i++)
{
m_timeStepTexts.push_back(QString("Timestep %1").arg(i));
}
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderInterfaceMock::close()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QStringList& RifReaderInterfaceMock::staticResults() const
{
return m_staticResults;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QStringList& RifReaderInterfaceMock::dynamicResults() const
{
return m_dynamicResults;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RifReaderInterfaceMock::numTimeSteps() const
{
return m_reservoirBuilder.timeStepCount();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifReaderInterfaceMock::staticResult(const QString& result, std::vector<double>* values)
{
m_reservoirBuilder.staticResult(m_reservoir.p(), result, values);
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifReaderInterfaceMock::dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values)
{
m_reservoirBuilder.dynamicResult(m_reservoir.p(), result, stepIndex, values);
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifReaderInterfaceMock::RifReaderInterfaceMock()
{
/*
m_cellResults.push_back("Dummy results");
m_cellProperties.push_back("Dummy static result");
*/
}
RifReaderInterfaceMock::~RifReaderInterfaceMock()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderInterfaceMock::setWorldCoordinates(cvf::Vec3d minWorldCoordinate, cvf::Vec3d maxWorldCoordinate)
{
m_reservoirBuilder.setWorldCoordinates(minWorldCoordinate, maxWorldCoordinate);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderInterfaceMock::setGridPointDimensions(const cvf::Vec3st& gridPointDimensions)
{
m_reservoirBuilder.setGridPointDimensions(gridPointDimensions);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderInterfaceMock::setResultInfo(size_t resultCount, size_t timeStepCount)
{
m_reservoirBuilder.setResultInfo(resultCount, timeStepCount);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderInterfaceMock::addLocalGridRefinement(const cvf::Vec3st& minCellPosition, const cvf::Vec3st& maxCellPosition, const cvf::Vec3st& singleCellRefinementFactors)
{
m_reservoirBuilder.addLocalGridRefinement(minCellPosition, maxCellPosition, singleCellRefinementFactors);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderInterfaceMock::populateReservoir(RigReservoir* reservoir)
{
m_reservoirBuilder.populateReservoir(reservoir);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QStringList& RifReaderInterfaceMock::timeStepText() const
{
return m_timeStepTexts;
}

View File

@@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight 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.
//
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RifReaderInterface.h"
#include "RigReservoirBuilderMock.h"
class RifReaderInterfaceMock : public RifReaderInterface
{
public:
RifReaderInterfaceMock();
virtual ~RifReaderInterfaceMock();
void setWorldCoordinates(cvf::Vec3d minWorldCoordinate, cvf::Vec3d maxWorldCoordinate);
void setGridPointDimensions(const cvf::Vec3st& gridPointDimensions);
void setResultInfo(size_t resultCount, size_t timeStepCount);
void addLocalGridRefinement(const cvf::Vec3st& minCellPosition, const cvf::Vec3st& maxCellPosition, const cvf::Vec3st& singleCellRefinementFactors);
virtual bool open( const QString& fileName, RigReservoir* reservoir );
virtual void close();
virtual const QStringList& staticResults() const;
virtual const QStringList& dynamicResults() const;
virtual size_t numTimeSteps() const;
const QStringList& timeStepText() const;
virtual bool staticResult( const QString& result, std::vector<double>* values );
virtual bool dynamicResult( const QString& result, size_t stepIndex, std::vector<double>* values );
private:
void populateReservoir(RigReservoir* reservoir);
QStringList m_staticResults;
QStringList m_dynamicResults;
QStringList m_timeStepTexts;
RigReservoirBuilderMock m_reservoirBuilder;
cvf::ref<RigReservoir> m_reservoir;
};