#2146 Num Flooded PV: Move getResultIndexableStaticResult

This commit is contained in:
Rebecca Cox 2017-11-16 10:22:55 +01:00
parent 797115d5c1
commit 4b2af286e3
3 changed files with 39 additions and 39 deletions

View File

@ -682,6 +682,42 @@ bool RigCaseCellResultsData::updateResultName(RiaDefines::ResultCatType resultTy
return anyNameUpdated;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>* RigCaseCellResultsData::getResultIndexableStaticResult(RigActiveCellInfo* actCellInfo, RigCaseCellResultsData* gridCellResults, QString porvResultName, std::vector<double> &activeCellsResultsTempContainer)
{
size_t resultCellCount = actCellInfo->reservoirCellResultCount();
size_t reservoirCellCount = actCellInfo->reservoirCellCount();
size_t scalarResultIndexPorv = gridCellResults->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, porvResultName);
if (scalarResultIndexPorv == cvf::UNDEFINED_SIZE_T) return nullptr;
const std::vector<double>* porvResults = &(gridCellResults->cellScalarResults(scalarResultIndexPorv, 0));
if (!gridCellResults->isUsingGlobalActiveIndex(scalarResultIndexPorv))
{
// PORV is given for all cells
activeCellsResultsTempContainer.resize(resultCellCount, HUGE_VAL);
for (size_t globalCellIndex = 0; globalCellIndex < reservoirCellCount; globalCellIndex++)
{
size_t resultIdx = actCellInfo->cellResultIndex(globalCellIndex);
if (resultIdx != cvf::UNDEFINED_SIZE_T)
{
activeCellsResultsTempContainer[resultIdx] = porvResults->at(globalCellIndex);
}
}
return &activeCellsResultsTempContainer;
}
else
{
return porvResults;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -117,6 +117,7 @@ public:
bool updateResultName(RiaDefines::ResultCatType resultType, QString& oldName, const QString& newName);
static const std::vector<double>* getResultIndexableStaticResult(RigActiveCellInfo* actCellInfo,
public:
const std::vector<RigEclipseResultInfo>& infoForEachResultIndex() { return m_resultInfos;}

View File

@ -36,43 +36,6 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>* getResultIndexableStaticResult(RigActiveCellInfo* actCellInfo,
RigCaseCellResultsData* gridCellResults,
QString porvResultName,
std::vector<double> &activeCellsResultsTempContainer)
{
size_t resultCellCount = actCellInfo->reservoirCellResultCount();
size_t reservoirCellCount = actCellInfo->reservoirCellCount();
size_t scalarResultIndexPorv = gridCellResults->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, porvResultName);
if (scalarResultIndexPorv == cvf::UNDEFINED_SIZE_T) return nullptr;
const std::vector<double>* porvResults = &(gridCellResults->cellScalarResults(scalarResultIndexPorv, 0));
if ( !gridCellResults->isUsingGlobalActiveIndex(scalarResultIndexPorv) )
{
// PORV is given for all cells
activeCellsResultsTempContainer.resize(resultCellCount, HUGE_VAL);
for ( size_t globalCellIndex = 0; globalCellIndex < reservoirCellCount; globalCellIndex++ )
{
size_t resultIdx = actCellInfo->cellResultIndex(globalCellIndex);
if ( resultIdx != cvf::UNDEFINED_SIZE_T )
{
activeCellsResultsTempContainer[resultIdx] = porvResults->at(globalCellIndex);
}
}
return &activeCellsResultsTempContainer;
}
else
{
return porvResults;
}
}
RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator(RimEclipseCase* caseToApply,
const std::vector<QString> tracerNames)
{
@ -87,12 +50,12 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator
// PORV
const std::vector<double>* porvResults = nullptr;
std::vector<double> porvActiveCellsResultStorage;
porvResults = getResultIndexableStaticResult(actCellInfo, gridCellResults, "PORV", porvActiveCellsResultStorage);
porvResults = RigCaseCellResultsData::getResultIndexableStaticResult(actCellInfo, gridCellResults, "PORV", porvActiveCellsResultStorage);
// SWCR if defined
const std::vector<double>* swcrResults = nullptr;
swcrResults = getResultIndexableStaticResult(actCellInfo, gridCellResults, "SWCR", porvActiveCellsResultStorage);
swcrResults = RigCaseCellResultsData::getResultIndexableStaticResult(actCellInfo, gridCellResults, "SWCR", porvActiveCellsResultStorage);
std::vector<size_t> scalarResultIndexTracers;
for (QString tracerName : tracerNames)