#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)
{
this->setReservoirData(new RigEclipseCaseData);
this->setReservoirData(new RigEclipseCaseData(this));
}
// First find and read the grid data
@ -192,7 +192,7 @@ bool RimEclipseInputCase::openEclipseGridFile()
{
readerInterface = new RifReaderEclipseInput;
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData;
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(this);
if (!readerInterface->open(m_gridFileName, eclipseCase.p()))
{
return false;
@ -220,8 +220,8 @@ bool RimEclipseInputCase::openEclipseGridFile()
RimReservoirCellResultsStorage* matrixResults = results(RiaDefines::MATRIX_MODEL);
RimReservoirCellResultsStorage* fractureResults = results(RiaDefines::FRACTURE_MODEL);
matrixResults->computeDepthRelatedResults();
fractureResults->computeDepthRelatedResults();
matrixResults->cellResults()->computeDepthRelatedResults();
fractureResults->cellResults()->computeDepthRelatedResults();
}
return true;
@ -346,7 +346,7 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
//--------------------------------------------------------------------------------------------------
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;
if (modelName == RiaDefines::mockModelBasicInputCase())

View File

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

View File

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

View File

@ -58,7 +58,6 @@ public:
const RifReaderInterface* readerInterface() const;
void computeDepthRelatedResults();
bool isDataPresent(size_t scalarResultIndex) const;
size_t findOrLoadScalarResultForTimeStep(RiaDefines::ResultCatType type, const QString& resultName, size_t timeStepIndex);
size_t findOrLoadScalarResult(RiaDefines::ResultCatType type, const QString& resultName);
@ -71,19 +70,6 @@ protected:
virtual void setupBeforeSave();
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 getCacheDirectoryPath();
// Fields

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,9 @@ class RigEclipseTimeStepInfo;
class RigCaseCellResultsData : public cvf::Object
{
public:
explicit RigCaseCellResultsData(RigMainGrid* ownerGrid);
explicit RigCaseCellResultsData(RigEclipseCaseData* ownerCaseData);
void setReaderInterface(RifReaderInterface* readerInterface);
void setMainGrid(RigMainGrid* ownerGrid);
void setActiveCellInfo(RigActiveCellInfo* activeCellInfo) { m_activeCellInfo = activeCellInfo;}
@ -86,6 +88,10 @@ public:
std::vector<RigEclipseTimeStepInfo> timeStepInfos(size_t scalarResultIndex) const;
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
size_t findOrCreateScalarResultIndex(RiaDefines::ResultCatType type, const QString& resultName, bool needsToBeStored);
@ -95,6 +101,7 @@ public:
QString makeResultNameUnique(const QString& resultNameProposal) const;
void createPlaceholderResultEntries();
void computeDepthRelatedResults();
void removeResult(const QString& resultName);
void clearAllResults();
@ -122,7 +129,25 @@ public:
bool needsToBeStored,
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:
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;
RigMainGrid* m_ownerMainGrid;
RigEclipseCaseData* m_ownerCaseData;
RigActiveCellInfo* m_activeCellInfo;
};

View File

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

View File

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

View File

@ -467,7 +467,7 @@ TEST(RigReservoirTest, WellTest)
TEST(DISABLED_RigReservoirTest, WellTest)
{
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
#ifdef WIN32

View File

@ -32,7 +32,7 @@ TEST(RigGridManager, BasicTest)
{
cvf::ref<RigMainGrid> mainGridA = new RigMainGrid;
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData;
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(nullptr);
eclipseCase->setMainGrid(mainGridA.p());
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, 2));
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData;
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(nullptr);
eclipseCase->setMainGrid(mainGridA.p());