#1693 Move a lot of code from RimReservoirCellResultsStorage to RigCaseCellResultsData

This commit is contained in:
Jacob Støren 2017-09-08 14:43:28 +02:00
parent d638f536d8
commit 75f350db10
11 changed files with 1359 additions and 1320 deletions

View File

@ -105,7 +105,7 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
if (this->eclipseCaseData() == NULL) if (this->eclipseCaseData() == NULL)
{ {
this->setReservoirData(new RigEclipseCaseData); this->setReservoirData(new RigEclipseCaseData(this));
} }
// First find and read the grid data // First find and read the grid data
@ -192,7 +192,7 @@ bool RimEclipseInputCase::openEclipseGridFile()
{ {
readerInterface = new RifReaderEclipseInput; readerInterface = new RifReaderEclipseInput;
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData; cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(this);
if (!readerInterface->open(m_gridFileName, eclipseCase.p())) if (!readerInterface->open(m_gridFileName, eclipseCase.p()))
{ {
return false; return false;
@ -220,8 +220,8 @@ bool RimEclipseInputCase::openEclipseGridFile()
RimReservoirCellResultsStorage* matrixResults = results(RiaDefines::MATRIX_MODEL); RimReservoirCellResultsStorage* matrixResults = results(RiaDefines::MATRIX_MODEL);
RimReservoirCellResultsStorage* fractureResults = results(RiaDefines::FRACTURE_MODEL); RimReservoirCellResultsStorage* fractureResults = results(RiaDefines::FRACTURE_MODEL);
matrixResults->computeDepthRelatedResults(); matrixResults->cellResults()->computeDepthRelatedResults();
fractureResults->computeDepthRelatedResults(); fractureResults->cellResults()->computeDepthRelatedResults();
} }
return true; return true;
@ -346,7 +346,7 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
cvf::ref<RifReaderInterface> RimEclipseInputCase::createMockModel(QString modelName) cvf::ref<RifReaderInterface> RimEclipseInputCase::createMockModel(QString modelName)
{ {
cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData; cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData(this);
cvf::ref<RifReaderMockModel> mockFileInterface = new RifReaderMockModel; cvf::ref<RifReaderMockModel> mockFileInterface = new RifReaderMockModel;
if (modelName == RiaDefines::mockModelBasicInputCase()) if (modelName == RiaDefines::mockModelBasicInputCase())

View File

@ -166,7 +166,7 @@ bool RimEclipseResultCase::importGridAndResultMetaData(bool showTimeStepFilter)
readerEclipseOutput->setTimeStepFilter(m_timeStepFilter->selectedTimeStepIndices()); readerEclipseOutput->setTimeStepFilter(m_timeStepFilter->selectedTimeStepIndices());
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData; cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(this);
if (!readerEclipseOutput->open(caseFileName(), eclipseCase.p())) if (!readerEclipseOutput->open(caseFileName(), eclipseCase.p()))
{ {
return false; return false;
@ -240,7 +240,7 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl
return false; return false;
} }
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData; cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(this);
CVF_ASSERT(mainEclipseCase && mainEclipseCase->mainGrid()); CVF_ASSERT(mainEclipseCase && mainEclipseCase->mainGrid());
eclipseCase->setMainGrid(mainEclipseCase->mainGrid()); eclipseCase->setMainGrid(mainEclipseCase->mainGrid());
@ -316,7 +316,7 @@ void RimEclipseResultCase::loadAndUpdateSourSimData()
cvf::ref<RifReaderInterface> RimEclipseResultCase::createMockModel(QString modelName) cvf::ref<RifReaderInterface> RimEclipseResultCase::createMockModel(QString modelName)
{ {
cvf::ref<RifReaderMockModel> mockFileInterface = new RifReaderMockModel; cvf::ref<RifReaderMockModel> mockFileInterface = new RifReaderMockModel;
cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData; cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData(this);
if (modelName == RiaDefines::mockModelBasic()) if (modelName == RiaDefines::mockModelBasic())
{ {

View File

@ -148,7 +148,7 @@ bool RimEclipseStatisticsCase::openEclipseGridFile()
{ {
if (this->eclipseCaseData()) return true; if (this->eclipseCaseData()) return true;
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData; cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(this);
CVF_ASSERT(parentStatisticsCaseCollection()); CVF_ASSERT(parentStatisticsCaseCollection());

View File

@ -58,7 +58,6 @@ public:
const RifReaderInterface* readerInterface() const; const RifReaderInterface* readerInterface() const;
void computeDepthRelatedResults(); void computeDepthRelatedResults();
bool isDataPresent(size_t scalarResultIndex) const;
size_t findOrLoadScalarResultForTimeStep(RiaDefines::ResultCatType type, const QString& resultName, size_t timeStepIndex); size_t findOrLoadScalarResultForTimeStep(RiaDefines::ResultCatType type, const QString& resultName, size_t timeStepIndex);
size_t findOrLoadScalarResult(RiaDefines::ResultCatType type, const QString& resultName); size_t findOrLoadScalarResult(RiaDefines::ResultCatType type, const QString& resultName);
@ -71,19 +70,6 @@ protected:
virtual void setupBeforeSave(); virtual void setupBeforeSave();
private: private:
void computeSOILForTimeStep(size_t timeStepIndex);
void computeRiTransComponent(const QString& riTransComponentResultName);
void computeNncCombRiTrans();
void computeRiMULTComponent(const QString& riMultCompName);
void computeNncCombRiMULT();
void computeRiTRANSbyAreaComponent(const QString& riTransByAreaCompResultName);
void computeNncCombRiTRANSbyArea();
void computeCompletionTypeForTimeStep(size_t timeStep);
double darchysValue();
QString getValidCacheFileName(); QString getValidCacheFileName();
QString getCacheDirectoryPath(); QString getCacheDirectoryPath();
// Fields // Fields

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,9 @@ class RigEclipseTimeStepInfo;
class RigCaseCellResultsData : public cvf::Object class RigCaseCellResultsData : public cvf::Object
{ {
public: public:
explicit RigCaseCellResultsData(RigMainGrid* ownerGrid); explicit RigCaseCellResultsData(RigEclipseCaseData* ownerCaseData);
void setReaderInterface(RifReaderInterface* readerInterface);
void setMainGrid(RigMainGrid* ownerGrid); void setMainGrid(RigMainGrid* ownerGrid);
void setActiveCellInfo(RigActiveCellInfo* activeCellInfo) { m_activeCellInfo = activeCellInfo;} void setActiveCellInfo(RigActiveCellInfo* activeCellInfo) { m_activeCellInfo = activeCellInfo;}
@ -86,6 +88,10 @@ public:
std::vector<RigEclipseTimeStepInfo> timeStepInfos(size_t scalarResultIndex) const; std::vector<RigEclipseTimeStepInfo> timeStepInfos(size_t scalarResultIndex) const;
void setTimeStepInfos(size_t scalarResultIndex, const std::vector<RigEclipseTimeStepInfo>& timeStepInfos); void setTimeStepInfos(size_t scalarResultIndex, const std::vector<RigEclipseTimeStepInfo>& timeStepInfos);
size_t findOrLoadScalarResultForTimeStep(RiaDefines::ResultCatType type, const QString& resultName, size_t timeStepIndex);
size_t findOrLoadScalarResult(RiaDefines::ResultCatType type, const QString& resultName);
size_t findOrLoadScalarResult(const QString& resultName); ///< Simplified search. Assumes unique names across types.
// Find or create a slot for the results // Find or create a slot for the results
size_t findOrCreateScalarResultIndex(RiaDefines::ResultCatType type, const QString& resultName, bool needsToBeStored); size_t findOrCreateScalarResultIndex(RiaDefines::ResultCatType type, const QString& resultName, bool needsToBeStored);
@ -95,6 +101,7 @@ public:
QString makeResultNameUnique(const QString& resultNameProposal) const; QString makeResultNameUnique(const QString& resultNameProposal) const;
void createPlaceholderResultEntries(); void createPlaceholderResultEntries();
void computeDepthRelatedResults();
void removeResult(const QString& resultName); void removeResult(const QString& resultName);
void clearAllResults(); void clearAllResults();
@ -122,7 +129,25 @@ public:
bool needsToBeStored, bool needsToBeStored,
size_t resultValueCount); size_t resultValueCount);
bool findTransmissibilityResults(size_t& tranX, size_t& tranY, size_t& tranZ) const; bool
findTransmissibilityResults(size_t& tranX, size_t& tranY, size_t& tranZ) const;
private: // from RimReservoirCellResultsStorage
void computeSOILForTimeStep(size_t timeStepIndex);
void computeRiTransComponent(const QString& riTransComponentResultName);
void computeNncCombRiTrans();
void computeRiMULTComponent(const QString& riMultCompName);
void computeNncCombRiMULT();
void computeRiTRANSbyAreaComponent(const QString& riTransByAreaCompResultName);
void computeNncCombRiTRANSbyArea();
void computeCompletionTypeForTimeStep(size_t timeStep);
double darchysValue();
bool isDataPresent(size_t scalarResultIndex) const;
cvf::ref<RifReaderInterface> m_readerInterface;
private: private:
std::vector< std::vector< std::vector<double> > > m_cellScalarResults; ///< Scalar results on the complete reservoir for each Result index (ResultVariable) and timestep std::vector< std::vector< std::vector<double> > > m_cellScalarResults; ///< Scalar results on the complete reservoir for each Result index (ResultVariable) and timestep
@ -132,5 +157,6 @@ private:
std::vector<RigEclipseResultInfo> m_resultInfos; std::vector<RigEclipseResultInfo> m_resultInfos;
RigMainGrid* m_ownerMainGrid; RigMainGrid* m_ownerMainGrid;
RigEclipseCaseData* m_ownerCaseData;
RigActiveCellInfo* m_activeCellInfo; RigActiveCellInfo* m_activeCellInfo;
}; };

View File

@ -32,12 +32,13 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigEclipseCaseData::RigEclipseCaseData() RigEclipseCaseData::RigEclipseCaseData(RimEclipseCase* ownerCase)
{ {
m_mainGrid = new RigMainGrid(); m_mainGrid = new RigMainGrid();
m_ownerCase = ownerCase;
m_matrixModelResults = new RigCaseCellResultsData(m_mainGrid.p()); m_matrixModelResults = new RigCaseCellResultsData(this);
m_fractureModelResults = new RigCaseCellResultsData(m_mainGrid.p()); m_fractureModelResults = new RigCaseCellResultsData(this);
m_activeCellInfo = new RigActiveCellInfo; m_activeCellInfo = new RigActiveCellInfo;
m_fractureActiveCellInfo = new RigActiveCellInfo; m_fractureActiveCellInfo = new RigActiveCellInfo;

View File

@ -42,6 +42,7 @@ class RigCaseCellResultsData;
class RigActiveCellInfo; class RigActiveCellInfo;
class RigSingleWellResultsData; class RigSingleWellResultsData;
class RigCell; class RigCell;
class RimEclipseCase;
struct RigWellResultPoint; struct RigWellResultPoint;
@ -51,9 +52,11 @@ struct RigWellResultPoint;
class RigEclipseCaseData : public cvf::Object class RigEclipseCaseData : public cvf::Object
{ {
public: public:
RigEclipseCaseData(); explicit RigEclipseCaseData(RimEclipseCase* ownerCase);
~RigEclipseCaseData(); ~RigEclipseCaseData();
RimEclipseCase* ownerCase() { return m_ownerCase; }
RigMainGrid* mainGrid(); RigMainGrid* mainGrid();
const RigMainGrid* mainGrid() const; const RigMainGrid* mainGrid() const;
void setMainGrid(RigMainGrid* mainGrid); void setMainGrid(RigMainGrid* mainGrid);
@ -96,6 +99,7 @@ private:
private: private:
cvf::ref<RigMainGrid> m_mainGrid; cvf::ref<RigMainGrid> m_mainGrid;
RimEclipseCase* m_ownerCase;
cvf::ref<RigActiveCellInfo> m_activeCellInfo; cvf::ref<RigActiveCellInfo> m_activeCellInfo;
cvf::ref<RigActiveCellInfo> m_fractureActiveCellInfo; cvf::ref<RigActiveCellInfo> m_fractureActiveCellInfo;

View File

@ -467,7 +467,7 @@ TEST(RigReservoirTest, WellTest)
TEST(DISABLED_RigReservoirTest, WellTest) TEST(DISABLED_RigReservoirTest, WellTest)
{ {
cvf::ref<RifReaderEclipseOutput> readerInterfaceEcl = new RifReaderEclipseOutput; cvf::ref<RifReaderEclipseOutput> readerInterfaceEcl = new RifReaderEclipseOutput;
cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData; cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData(nullptr);
// Location of test dataset received from Håkon Høgstøl in July 2011 with 10k active cells // Location of test dataset received from Håkon Høgstøl in July 2011 with 10k active cells
#ifdef WIN32 #ifdef WIN32

View File

@ -32,7 +32,7 @@ TEST(RigGridManager, BasicTest)
{ {
cvf::ref<RigMainGrid> mainGridA = new RigMainGrid; cvf::ref<RigMainGrid> mainGridA = new RigMainGrid;
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData; cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(nullptr);
eclipseCase->setMainGrid(mainGridA.p()); eclipseCase->setMainGrid(mainGridA.p());
EXPECT_EQ(mainGridA->refCount(), 2); EXPECT_EQ(mainGridA->refCount(), 2);
@ -58,7 +58,7 @@ TEST(RigGridManager, EqualTests)
mainGridA->nodes().push_back(cvf::Vec3d(0, 0, 1)); mainGridA->nodes().push_back(cvf::Vec3d(0, 0, 1));
mainGridA->nodes().push_back(cvf::Vec3d(0, 0, 2)); mainGridA->nodes().push_back(cvf::Vec3d(0, 0, 2));
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData; cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(nullptr);
eclipseCase->setMainGrid(mainGridA.p()); eclipseCase->setMainGrid(mainGridA.p());