mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2146 Num Flooded PV: Move getResultIndexableStaticResult
This commit is contained in:
parent
797115d5c1
commit
4b2af286e3
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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;}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user