mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3958 Refactoring : Moved formation names calculation into CaseCellResultsData.
Made one more method private.
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include "RigFormationNames.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@@ -2613,6 +2614,77 @@ void RigCaseCellResultsData::setHdf5Filename(const QString& hdf5SourSimFilename)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigCaseCellResultsData::setActiveFormationNames(RigFormationNames* activeFormationNames)
|
||||||
|
{
|
||||||
|
m_activeFormationNamesData = activeFormationNames;
|
||||||
|
|
||||||
|
size_t totalGlobCellCount = m_ownerMainGrid->globalCellArray().size();
|
||||||
|
size_t resIndex = this->addStaticScalarResult(RiaDefines::FORMATION_NAMES,
|
||||||
|
RiaDefines::activeFormationNamesResultName(),
|
||||||
|
false,
|
||||||
|
totalGlobCellCount);
|
||||||
|
|
||||||
|
std::vector<double>& fnData = this->cellScalarResults(RigEclipseResultAddress(resIndex),0);
|
||||||
|
|
||||||
|
if (m_activeFormationNamesData.isNull())
|
||||||
|
{
|
||||||
|
for ( size_t cIdx = 0; cIdx < totalGlobCellCount; ++cIdx )
|
||||||
|
{
|
||||||
|
fnData[cIdx] = HUGE_VAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t localCellCount = m_ownerMainGrid->cellCount();
|
||||||
|
for (size_t cIdx = 0; cIdx < localCellCount; ++cIdx)
|
||||||
|
{
|
||||||
|
size_t i (cvf::UNDEFINED_SIZE_T), j(cvf::UNDEFINED_SIZE_T), k(cvf::UNDEFINED_SIZE_T);
|
||||||
|
|
||||||
|
if(!m_ownerMainGrid->ijkFromCellIndex(cIdx, &i, &j, &k)) continue;
|
||||||
|
|
||||||
|
int formNameIdx = activeFormationNames->formationIndexFromKLayerIdx(k);
|
||||||
|
if (formNameIdx != -1)
|
||||||
|
{
|
||||||
|
fnData[cIdx] = formNameIdx;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fnData[cIdx] = HUGE_VAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t cIdx = localCellCount; cIdx < totalGlobCellCount; ++cIdx)
|
||||||
|
{
|
||||||
|
size_t mgrdCellIdx = m_ownerMainGrid->globalCellArray()[cIdx].mainGridCellIndex();
|
||||||
|
|
||||||
|
size_t i (cvf::UNDEFINED_SIZE_T), j(cvf::UNDEFINED_SIZE_T), k(cvf::UNDEFINED_SIZE_T);
|
||||||
|
|
||||||
|
if(!m_ownerMainGrid->ijkFromCellIndex(mgrdCellIdx, &i, &j, &k)) continue;
|
||||||
|
|
||||||
|
int formNameIdx = activeFormationNames->formationIndexFromKLayerIdx(k);
|
||||||
|
if (formNameIdx != -1)
|
||||||
|
{
|
||||||
|
fnData[cIdx] = formNameIdx;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fnData[cIdx] = HUGE_VAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RigFormationNames* RigCaseCellResultsData::activeFormationNames()
|
||||||
|
{
|
||||||
|
return m_activeFormationNamesData.p();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// If we have any results on any time step, assume we have loaded results
|
/// If we have any results on any time step, assume we have loaded results
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class RigEclipseResultInfo;
|
|||||||
class RigStatisticsDataCache;
|
class RigStatisticsDataCache;
|
||||||
class RigEclipseTimeStepInfo;
|
class RigEclipseTimeStepInfo;
|
||||||
class RigEclipseCaseData;
|
class RigEclipseCaseData;
|
||||||
|
class RigFormationNames;
|
||||||
|
|
||||||
class RimEclipseCase;
|
class RimEclipseCase;
|
||||||
|
|
||||||
@@ -54,6 +55,8 @@ public:
|
|||||||
|
|
||||||
void setReaderInterface(RifReaderInterface* readerInterface);
|
void setReaderInterface(RifReaderInterface* readerInterface);
|
||||||
void setHdf5Filename(const QString& hdf5SourSimFilename );
|
void setHdf5Filename(const QString& hdf5SourSimFilename );
|
||||||
|
void setActiveFormationNames(RigFormationNames* activeFormationNames);
|
||||||
|
RigFormationNames* activeFormationNames();
|
||||||
|
|
||||||
void setMainGrid(RigMainGrid* ownerGrid);
|
void setMainGrid(RigMainGrid* ownerGrid);
|
||||||
void setActiveCellInfo(RigActiveCellInfo* activeCellInfo);
|
void setActiveCellInfo(RigActiveCellInfo* activeCellInfo);
|
||||||
@@ -124,10 +127,6 @@ public:
|
|||||||
size_t findScalarResultIndex(RiaDefines::ResultCatType type, const QString& resultName) const;
|
size_t findScalarResultIndex(RiaDefines::ResultCatType type, const QString& resultName) const;
|
||||||
size_t findScalarResultIndex(const QString& resultName) const;
|
size_t findScalarResultIndex(const QString& resultName) const;
|
||||||
|
|
||||||
size_t addStaticScalarResult(RiaDefines::ResultCatType type,
|
|
||||||
const QString& resultName,
|
|
||||||
bool needsToBeStored,
|
|
||||||
size_t resultValueCount);
|
|
||||||
// <---
|
// <---
|
||||||
|
|
||||||
// Access the results data
|
// Access the results data
|
||||||
@@ -149,6 +148,10 @@ public:
|
|||||||
const RigEclipseResultInfo* resultInfo(const RigEclipseResultAddress& resVarAddr) const;
|
const RigEclipseResultInfo* resultInfo(const RigEclipseResultAddress& resVarAddr) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
size_t addStaticScalarResult(RiaDefines::ResultCatType type,
|
||||||
|
const QString& resultName,
|
||||||
|
bool needsToBeStored,
|
||||||
|
size_t resultValueCount);
|
||||||
|
|
||||||
const std::vector<RigEclipseResultInfo>& infoForEachResultIndex();
|
const std::vector<RigEclipseResultInfo>& infoForEachResultIndex();
|
||||||
size_t resultCount() const;
|
size_t resultCount() const;
|
||||||
@@ -183,6 +186,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::ref<RifReaderInterface> m_readerInterface;
|
cvf::ref<RifReaderInterface> m_readerInterface;
|
||||||
|
cvf::ref<RigFormationNames> m_activeFormationNamesData;
|
||||||
|
|
||||||
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
|
||||||
cvf::Collection<RigStatisticsDataCache> m_statisticsDataCache;
|
cvf::Collection<RigStatisticsDataCache> m_statisticsDataCache;
|
||||||
|
|||||||
@@ -675,62 +675,7 @@ void RigEclipseCaseData::computeActiveCellsGeometryBoundingBox()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RigEclipseCaseData::setActiveFormationNames(RigFormationNames* activeFormationNames)
|
void RigEclipseCaseData::setActiveFormationNames(RigFormationNames* activeFormationNames)
|
||||||
{
|
{
|
||||||
m_activeFormationNamesData = activeFormationNames;
|
m_matrixModelResults->setActiveFormationNames(activeFormationNames);
|
||||||
|
|
||||||
size_t totalGlobCellCount = m_mainGrid->globalCellArray().size();
|
|
||||||
size_t resIndex = m_matrixModelResults->addStaticScalarResult(RiaDefines::FORMATION_NAMES,
|
|
||||||
RiaDefines::activeFormationNamesResultName(),
|
|
||||||
false,
|
|
||||||
totalGlobCellCount);
|
|
||||||
|
|
||||||
std::vector<double>& fnData = m_matrixModelResults->cellScalarResults(RigEclipseResultAddress(resIndex),0);
|
|
||||||
|
|
||||||
if (m_activeFormationNamesData.isNull())
|
|
||||||
{
|
|
||||||
for ( size_t cIdx = 0; cIdx < totalGlobCellCount; ++cIdx )
|
|
||||||
{
|
|
||||||
fnData[cIdx] = HUGE_VAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t localCellCount = m_mainGrid->cellCount();
|
|
||||||
for (size_t cIdx = 0; cIdx < localCellCount; ++cIdx)
|
|
||||||
{
|
|
||||||
size_t i (cvf::UNDEFINED_SIZE_T), j(cvf::UNDEFINED_SIZE_T), k(cvf::UNDEFINED_SIZE_T);
|
|
||||||
|
|
||||||
if(!m_mainGrid->ijkFromCellIndex(cIdx, &i, &j, &k)) continue;
|
|
||||||
|
|
||||||
int formNameIdx = activeFormationNames->formationIndexFromKLayerIdx(k);
|
|
||||||
if (formNameIdx != -1)
|
|
||||||
{
|
|
||||||
fnData[cIdx] = formNameIdx;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fnData[cIdx] = HUGE_VAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t cIdx = localCellCount; cIdx < totalGlobCellCount; ++cIdx)
|
|
||||||
{
|
|
||||||
size_t mgrdCellIdx = m_mainGrid->globalCellArray()[cIdx].mainGridCellIndex();
|
|
||||||
|
|
||||||
size_t i (cvf::UNDEFINED_SIZE_T), j(cvf::UNDEFINED_SIZE_T), k(cvf::UNDEFINED_SIZE_T);
|
|
||||||
|
|
||||||
if(!m_mainGrid->ijkFromCellIndex(mgrdCellIdx, &i, &j, &k)) continue;
|
|
||||||
|
|
||||||
int formNameIdx = activeFormationNames->formationIndexFromKLayerIdx(k);
|
|
||||||
if (formNameIdx != -1)
|
|
||||||
{
|
|
||||||
fnData[cIdx] = formNameIdx;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fnData[cIdx] = HUGE_VAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RimProject* project = RiaApplication::instance()->project();
|
RimProject* project = RiaApplication::instance()->project();
|
||||||
if (project)
|
if (project)
|
||||||
@@ -747,7 +692,7 @@ void RigEclipseCaseData::setActiveFormationNames(RigFormationNames* activeFormat
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigFormationNames* RigEclipseCaseData::activeFormationNames()
|
RigFormationNames* RigEclipseCaseData::activeFormationNames()
|
||||||
{
|
{
|
||||||
return m_activeFormationNamesData.p();
|
return m_matrixModelResults->activeFormationNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -132,8 +132,6 @@ private:
|
|||||||
cvf::ref<RigCaseCellResultsData> m_matrixModelResults;
|
cvf::ref<RigCaseCellResultsData> m_matrixModelResults;
|
||||||
cvf::ref<RigCaseCellResultsData> m_fractureModelResults;
|
cvf::ref<RigCaseCellResultsData> m_fractureModelResults;
|
||||||
|
|
||||||
cvf::ref<RigFormationNames> m_activeFormationNamesData;
|
|
||||||
|
|
||||||
cvf::ref<RigVirtualPerforationTransmissibilities> m_virtualPerforationTransmissibilities;
|
cvf::ref<RigVirtualPerforationTransmissibilities> m_virtualPerforationTransmissibilities;
|
||||||
|
|
||||||
cvf::Collection<RigSimWellData> m_simWellData; //< A WellResults object for each well in the reservoir
|
cvf::Collection<RigSimWellData> m_simWellData; //< A WellResults object for each well in the reservoir
|
||||||
|
|||||||
Reference in New Issue
Block a user