From a411a8ae59b9dad65d2a7ec27389cddb4f5a8619 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 19 Mar 2013 08:21:55 +0100 Subject: [PATCH] Removed obsolete code from interface Use time steps from source case with largest time step count p4#: 20954 --- .../FileInterface/RifReaderInterface.h | 1 - .../ProjectDataModel/RimResultReservoir.cpp | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ApplicationCode/FileInterface/RifReaderInterface.h b/ApplicationCode/FileInterface/RifReaderInterface.h index e313ca4bbd..0ad153db1f 100644 --- a/ApplicationCode/FileInterface/RifReaderInterface.h +++ b/ApplicationCode/FileInterface/RifReaderInterface.h @@ -48,7 +48,6 @@ public: virtual ~RifReaderInterface() {} virtual bool open(const QString& fileName, RigEclipseCase* eclipseCase) = 0; - virtual bool openAndReadActiveCellData(const QString& fileName, RigEclipseCase* mainEclipseCase, RigEclipseCase* eclipseCase) { return true; }; virtual void close() = 0; virtual bool staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector* values) = 0; diff --git a/ApplicationCode/ProjectDataModel/RimResultReservoir.cpp b/ApplicationCode/ProjectDataModel/RimResultReservoir.cpp index 655a175c0c..b85640de6e 100644 --- a/ApplicationCode/ProjectDataModel/RimResultReservoir.cpp +++ b/ApplicationCode/ProjectDataModel/RimResultReservoir.cpp @@ -117,15 +117,26 @@ bool RimResultReservoir::openAndReadActiveCellData(RigEclipseCase* mainEclipseCa CVF_ASSERT(mainEclipseCase && mainEclipseCase->mainGrid()); eclipseCase->setMainGrid(mainEclipseCase->mainGrid()); - readerInterface = new RifReaderEclipseOutput; - if (!readerInterface->openAndReadActiveCellData(fname, mainEclipseCase, eclipseCase.p())) + size_t scalarIndexWithMaxTimeStepCount = cvf::UNDEFINED_SIZE_T; + mainEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount(&scalarIndexWithMaxTimeStepCount); + if (scalarIndexWithMaxTimeStepCount == cvf::UNDEFINED_SIZE_T) { return false; } - readerInterface->close(); + std::vector timeStepDates = mainEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->timeStepDates(scalarIndexWithMaxTimeStepCount); + + cvf::ref readerEclipseOutput = new RifReaderEclipseOutput; + if (!readerEclipseOutput->openAndReadActiveCellData(fname, timeStepDates, eclipseCase.p())) + { + return false; + } + + readerEclipseOutput->close(); this->setReservoirData( eclipseCase.p() ); + + readerInterface = readerEclipseOutput; } results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());