#3958 Refactoring: Remove scalarResultIndex from RigEclipseResultAddress

and real external use (outside CaseCellResultsData)
Regression tests OK.
This commit is contained in:
Jacob Støren
2019-01-25 12:58:07 +01:00
parent 98f2b50180
commit 3e3d3871ed
35 changed files with 304 additions and 297 deletions

View File

@@ -176,13 +176,11 @@ std::set<RigEclipseResultAddress> RiaMemoryCleanup::findEclipseResultsInUse() co
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case());
if (eclipseCase)
{
RigCaseCellResultsData* caseData = eclipseCase->results(RiaDefines::MATRIX_MODEL);
std::vector<RimEclipseResultDefinition*> eclipseResultDefs;
eclipseCase->descendantsIncludingThisOfType(eclipseResultDefs);
for (RimEclipseResultDefinition* resultDef : eclipseResultDefs)
{
RigEclipseResultAddress resultAddr(caseData->findScalarResultIndex(resultDef->resultType(), resultDef->resultVariable()));
RigEclipseResultAddress resultAddr(resultDef->resultType(), resultDef->resultVariable());
resultsInUse.insert(resultAddr);
}
}

View File

@@ -222,7 +222,6 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
const RigMainGrid* mainGrid = caseToApply->eclipseCaseData()->mainGrid();
const RigCaseCellResultsData* results = caseToApply->results(RiaDefines::MATRIX_MODEL);
size_t pressureResultIndex = results->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "PRESSURE");
const RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
bool performPressureDepletionScaling = pdParams.performScaling;
@@ -262,7 +261,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
const std::vector<double>* currentMatrixPressures = nullptr;
if (performPressureDepletionScaling)
{
pressureResultVector = &results->cellScalarResults(RigEclipseResultAddress(pressureResultIndex));
pressureResultVector = &results->cellScalarResults(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "PRESSURE"));
CVF_ASSERT(!pressureResultVector->empty());
if (pdParams.pressureScalingTimeStep < static_cast<int>(pressureResultVector->size()))

View File

@@ -318,12 +318,17 @@ bool RifEclipseInputFileTools::readDataFromKeyword(ecl_kw_type* eclipseKeywordDa
if (!mathingItemCount) return false;
size_t resultIndex = RifEclipseInputFileTools::findOrCreateResult(resultName, caseData);
if (resultIndex == cvf::UNDEFINED_SIZE_T) return false;
size_t resultIndex = caseData->results(RiaDefines::MATRIX_MODEL)->findScalarResultIndex(resultName); // Todo : Is it neccessary to search without type first ?
if (resultIndex == cvf::UNDEFINED_SIZE_T)
{
caseData->results(RiaDefines::MATRIX_MODEL)->findOrCreateScalarResultIndex(RiaDefines::INPUT_PROPERTY, resultName, false);
}
std::vector< std::vector<double> >& newPropertyData = caseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(resultName));
std::vector< std::vector<double> >& newPropertyData = caseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(resultIndex));
newPropertyData.push_back(std::vector<double>());
newPropertyData[0].resize(ecl_kw_get_size(eclipseKeywordData), HUGE_VAL);
ecl_kw_get_data_as_double(eclipseKeywordData, newPropertyData[0].data());
return true;
@@ -630,20 +635,6 @@ qint64 RifEclipseInputFileTools::findKeyword(const QString& keyword, QFile& file
return -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RifEclipseInputFileTools::findOrCreateResult(const QString& newResultName, RigEclipseCaseData* reservoir)
{
size_t resultIndex = reservoir->results(RiaDefines::MATRIX_MODEL)->findScalarResultIndex(newResultName);
if (resultIndex == cvf::UNDEFINED_SIZE_T)
{
resultIndex = reservoir->results(RiaDefines::MATRIX_MODEL)->findOrCreateScalarResultIndex(RiaDefines::INPUT_PROPERTY, newResultName, false);
}
return resultIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -91,7 +91,6 @@ private:
static size_t findFaultByName(const cvf::Collection<RigFault>& faults, const QString& name);
static qint64 findKeyword(const QString& keyword, QFile& file, qint64 startPos);
static size_t findOrCreateResult(const QString& newResultName, RigEclipseCaseData* reservoir);
static bool isValidDataKeyword(const QString& keyword);
private:

View File

@@ -575,8 +575,8 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName)
QStringList resultNames = hdf5ReaderInterface->propertyNames();
for (int i = 0; i < resultNames.size(); ++i)
{
size_t resIndex = matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::SOURSIMRL, resultNames[i], false);
matrixModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), timeStepInfos);
matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::SOURSIMRL, resultNames[i], false);
matrixModelResults->setTimeStepInfos(RigEclipseResultAddress(RiaDefines::SOURSIMRL, resultNames[i]), timeStepInfos);
}
m_hdfReaderInterface = std::move(hdf5ReaderInterface);
@@ -855,8 +855,8 @@ void RifReaderEclipseOutput::buildMetaData(ecl_grid_type* grid)
for (int i = 0; i < matrixResultNames.size(); ++i)
{
size_t resIndex = matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, matrixResultNames[i], false);
matrixModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), timeStepInfos);
matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, matrixResultNames[i], false);
matrixModelResults->setTimeStepInfos(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, matrixResultNames[i]), timeStepInfos);
}
}
@@ -868,8 +868,8 @@ void RifReaderEclipseOutput::buildMetaData(ecl_grid_type* grid)
for (int i = 0; i < fractureResultNames.size(); ++i)
{
size_t resIndex = fractureModelResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, fractureResultNames[i], false);
fractureModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), timeStepInfos);
fractureModelResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, fractureResultNames[i], false);
fractureModelResults->setTimeStepInfos(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, fractureResultNames[i]), timeStepInfos);
}
}
}
@@ -939,8 +939,8 @@ void RifReaderEclipseOutput::buildMetaData(ecl_grid_type* grid)
for (int i = 0; i < matrixResultNames.size(); ++i)
{
size_t resIndex = matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, matrixResultNames[i], false);
matrixModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), staticTimeStepInfo);
matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, matrixResultNames[i], false);
matrixModelResults->setTimeStepInfos(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, matrixResultNames[i]), staticTimeStepInfo);
}
}
@@ -954,8 +954,8 @@ void RifReaderEclipseOutput::buildMetaData(ecl_grid_type* grid)
for (int i = 0; i < fractureResultNames.size(); ++i)
{
size_t resIndex = fractureModelResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, fractureResultNames[i], false);
fractureModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), staticTimeStepInfo);
fractureModelResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, fractureResultNames[i], false);
fractureModelResults->setTimeStepInfos(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, fractureResultNames[i]), staticTimeStepInfo);
}
}
}

View File

@@ -53,8 +53,8 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
for (size_t i = 0; i < m_reservoirBuilder.resultCount(); i++)
{
size_t resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, QString("Dynamic_Result_%1").arg(i), false);
cellResults->setTimeStepInfos(RigEclipseResultAddress(resIdx), timeStepInfos);
cellResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, QString("Dynamic_Result_%1").arg(i), false);
cellResults->setTimeStepInfos(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, QString("Dynamic_Result_%1").arg(i)), timeStepInfos);
}
if (m_reservoirBuilder.timeStepCount() == 0) return true;
@@ -70,19 +70,19 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
int resIndex = 0;
if (i > 1) resIndex = i;
size_t resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, QString("Static_Result_%1%2").arg(resIndex).arg(varEnd), false);
cellResults->setTimeStepInfos(RigEclipseResultAddress(resIdx), staticResultTimeStepInfos);
cellResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, QString("Static_Result_%1%2").arg(resIndex).arg(varEnd), false);
cellResults->setTimeStepInfos(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, QString("Static_Result_%1%2").arg(resIndex).arg(varEnd)), staticResultTimeStepInfos);
}
#define ADD_INPUT_PROPERTY(Name) \
{ \
size_t resIdx; \
QString resultName(Name); \
resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::INPUT_PROPERTY, resultName, false); \
cellResults->setTimeStepInfos(RigEclipseResultAddress(resIdx), staticResultTimeStepInfos); \
cellResults->cellScalarResults(RigEclipseResultAddress(resIdx)).resize(1); \
std::vector<double>& values = cellResults->cellScalarResults(RigEclipseResultAddress(resIdx))[0]; \
RigEclipseResultAddress resAddr(RiaDefines::INPUT_PROPERTY, resultName);\
cellResults->findOrCreateScalarResultIndex(RiaDefines::INPUT_PROPERTY, resultName, false); \
cellResults->setTimeStepInfos(resAddr, staticResultTimeStepInfos); \
cellResults->cellScalarResults(resAddr).resize(1); \
std::vector<double>& values = cellResults->cellScalarResults(resAddr)[0]; \
this->inputProperty(resultName, &values); \
}

View File

@@ -105,7 +105,7 @@ bool RimWellPlotTools::hasPressureData(RimWellPath* wellPath)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<size_t, QString> RimWellPlotTools::pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData)
std::pair<RigEclipseResultAddress, QString> RimWellPlotTools::pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData)
{
if (eclipseCaseData != nullptr)
{
@@ -115,11 +115,11 @@ std::pair<size_t, QString> RimWellPlotTools::pressureResultDataInfo(const RigEcl
->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, pressureDataName);
if (index != cvf::UNDEFINED_SIZE_T)
{
return std::make_pair(index, pressureDataName);
return std::make_pair(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, pressureDataName), pressureDataName);
}
}
}
return std::make_pair(cvf::UNDEFINED_SIZE_T, "");
return std::make_pair(RigEclipseResultAddress(), "");
}
//--------------------------------------------------------------------------------------------------
@@ -139,7 +139,7 @@ bool RimWellPlotTools::isPressureChannel(RimWellLogFileChannel* channel)
//--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::hasPressureData(RimEclipseResultCase* gridCase)
{
return pressureResultDataInfo(gridCase->eclipseCaseData()).first != cvf::UNDEFINED_SIZE_T;
return pressureResultDataInfo(gridCase->eclipseCaseData()).first.isValid();
}
//--------------------------------------------------------------------------------------------------
///
@@ -413,12 +413,12 @@ std::vector<RimEclipseResultCase*> RimWellPlotTools::rftCasesForWell(const QStri
std::map<QDateTime, std::set<RifDataSourceForRftPlt>> RimWellPlotTools::timeStepsMapFromGridCase(RimEclipseCase* gridCase)
{
const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData();
std::pair<size_t, QString> resultDataInfo = pressureResultDataInfo(eclipseCaseData);
std::pair<RigEclipseResultAddress, QString> resultDataInfo = pressureResultDataInfo(eclipseCaseData);
std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMap;
if (resultDataInfo.first != cvf::UNDEFINED_SIZE_T)
if (resultDataInfo.first.isValid())
{
for (const QDateTime& timeStep : eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->timeStepDates(RigEclipseResultAddress(resultDataInfo.first)))
for (const QDateTime& timeStep : eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->timeStepDates(resultDataInfo.first))
{
if (timeStepsMap.count(timeStep) == 0)
{

View File

@@ -29,6 +29,7 @@
#include "RifEclipseRftAddress.h"
#include "RimWellLogFile.h"
#include "RiaEclipseUnitTools.h"
#include "RigEclipseResultAddress.h"
class RimEclipseCase;
class RimEclipseResultCase;
@@ -62,7 +63,9 @@ public:
static RimWellPath* wellPathByWellPathNameOrSimWellName(const QString& wellPathNameOrSimwellName);
// RFT Only
static std::pair<size_t, QString> pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData);
private:
static std::pair<RigEclipseResultAddress, QString> pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData);
public:
static void addTimeStepsToMap(std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& destMap,
const std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepsToAdd);
static std::vector<RimWellLogFile*> wellLogFilesContainingPressure(const QString& wellPathNameOrSimWellName);

View File

@@ -120,7 +120,7 @@ void RimCellEdgeColors::loadResult()
int i;
for (i = 0; i < vars.size(); ++i)
{
size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadKnownScalarResult(RiaDefines::STATIC_NATIVE, vars[i]);
m_reservoirView->currentGridCellResults()->findOrLoadKnownScalarResult(RiaDefines::STATIC_NATIVE, vars[i]);
int cubeFaceIdx;
for (cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
{
@@ -132,7 +132,7 @@ void RimCellEdgeColors::loadResult()
if (vars[i].endsWith(varEnd))
{
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(vars[i], RigEclipseResultAddress(resultindex));
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(vars[i], RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, vars[i]));
}
}
}
@@ -387,7 +387,7 @@ void RimCellEdgeColors::resetResultIndices()
int cubeFaceIndex;
for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex)
{
m_resultNameToIndexPairs[cubeFaceIndex].second = RigEclipseResultAddress(cvf::UNDEFINED_SIZE_T);
m_resultNameToIndexPairs[cubeFaceIndex].second = RigEclipseResultAddress();
}
}

View File

@@ -793,29 +793,29 @@ bool RimEclipseCase::openReserviorCase()
results->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName());
if (combinedTransResIdx != cvf::UNDEFINED_SIZE_T)
{
eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameCombTrans(),
RigEclipseResultAddress(combinedTransResIdx));
eclipseCaseData()->mainGrid()->nncData()->setEclResultAddress(RigNNCData::propertyNameCombTrans(),
RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName()));
}
size_t combinedWatFluxResIdx =
results->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::combinedWaterFluxResultName());
if (combinedWatFluxResIdx != cvf::UNDEFINED_SIZE_T)
{
eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameFluxWat(),
RigEclipseResultAddress(combinedWatFluxResIdx));
eclipseCaseData()->mainGrid()->nncData()->setEclResultAddress(RigNNCData::propertyNameFluxWat(),
RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, RiaDefines::combinedWaterFluxResultName()));
}
size_t combinedOilFluxResIdx =
results->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::combinedOilFluxResultName());
if (combinedOilFluxResIdx != cvf::UNDEFINED_SIZE_T)
{
eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameFluxOil(),
RigEclipseResultAddress(combinedOilFluxResIdx));
eclipseCaseData()->mainGrid()->nncData()->setEclResultAddress(RigNNCData::propertyNameFluxOil(),
RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, RiaDefines::combinedOilFluxResultName()));
}
size_t combinedGasFluxResIdx =
results->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::combinedGasFluxResultName());
if (combinedGasFluxResIdx != cvf::UNDEFINED_SIZE_T)
{
eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameFluxGas(),
RigEclipseResultAddress(combinedGasFluxResIdx));
eclipseCaseData()->mainGrid()->nncData()->setEclResultAddress(RigNNCData::propertyNameFluxGas(),
RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, RiaDefines::combinedGasFluxResultName()));
}
}
}

View File

@@ -442,6 +442,8 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
{
size_t scalarSetIndex = gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SOIL");
RigEclipseResultAddress resAddr(RiaDefines::DYNAMIC_NATIVE, "SOIL");
if ( scalarSetIndex != cvf::UNDEFINED_SIZE_T )
{
double globalMin = 0.0;
@@ -449,8 +451,8 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
double localMin = 0.0;
double localMax = 1.0;
cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), globalMin, globalMax);
cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), currentTimeStep, localMin, localMax);
cellResultsData->minMaxCellScalarValues(resAddr, globalMin, globalMax);
cellResultsData->minMaxCellScalarValues(resAddr, currentTimeStep, localMin, localMax);
ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SOIL_IDX, globalMin, globalMax, localMin, localMax);
}
@@ -458,6 +460,7 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
{
size_t scalarSetIndex = gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS");
RigEclipseResultAddress resAddr(RiaDefines::DYNAMIC_NATIVE, "SGAS");
if ( scalarSetIndex != cvf::UNDEFINED_SIZE_T )
{
double globalMin = 0.0;
@@ -465,8 +468,8 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
double localMin = 0.0;
double localMax = 1.0;
cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), globalMin, globalMax);
cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), currentTimeStep, localMin, localMax);
cellResultsData->minMaxCellScalarValues(resAddr, globalMin, globalMax);
cellResultsData->minMaxCellScalarValues(resAddr, currentTimeStep, localMin, localMax);
ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SGAS_IDX, globalMin, globalMax, localMin, localMax);
}
@@ -474,6 +477,7 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
{
size_t scalarSetIndex = gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT");
RigEclipseResultAddress resAddr(RiaDefines::DYNAMIC_NATIVE, "SWAT");
if ( scalarSetIndex != cvf::UNDEFINED_SIZE_T )
{
double globalMin = 0.0;
@@ -481,8 +485,8 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
double localMin = 0.0;
double localMax = 1.0;
cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), globalMin, globalMax);
cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), currentTimeStep, localMin, localMax);
cellResultsData->minMaxCellScalarValues(resAddr, globalMin, globalMax);
cellResultsData->minMaxCellScalarValues(resAddr, currentTimeStep, localMin, localMax);
ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SWAT_IDX, globalMin, globalMax, localMin, localMax);
}

View File

@@ -202,8 +202,7 @@ std::vector<double> RimEclipseContourMapProjection::generateResults(int timeStep
else
{
m_currentResultName = cellColors->resultVariable();
size_t resultIndex = resultData->findScalarResultIndex(cellColors->resultType(), cellColors->resultVariable());
gridResultValues = resultData->cellScalarResults(RigEclipseResultAddress( resultIndex), timeStep);
gridResultValues = resultData->cellScalarResults(RigEclipseResultAddress( cellColors->resultType(), cellColors->resultVariable()), timeStep);
}
if (!gridResultValues.empty())
@@ -251,26 +250,27 @@ std::vector<double> RimEclipseContourMapProjection::calculateColumnResult(Result
{
const RigCaseCellResultsData* resultData = eclipseCase()->results(RiaDefines::MATRIX_MODEL);
size_t poroResultIndex = resultData->findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PORO");
size_t ntgResultIndex = resultData->findScalarResultIndex(RiaDefines::STATIC_NATIVE, "NTG");
size_t dzResultIndex = resultData->findScalarResultIndex(RiaDefines::STATIC_NATIVE, "DZ");
size_t ntgResultIndex = resultData->findScalarResultIndex(RiaDefines::STATIC_NATIVE, "NTG" );
size_t dzResultIndex = resultData->findScalarResultIndex(RiaDefines::STATIC_NATIVE, "DZ" );
if (poroResultIndex == cvf::UNDEFINED_SIZE_T || ntgResultIndex == cvf::UNDEFINED_SIZE_T || dzResultIndex == cvf::UNDEFINED_SIZE_T)
{
return std::vector<double>();
}
const std::vector<double>& poroResults = resultData->cellScalarResults(RigEclipseResultAddress(poroResultIndex), 0);
const std::vector<double>& ntgResults = resultData->cellScalarResults(RigEclipseResultAddress(ntgResultIndex), 0);
const std::vector<double>& dzResults = resultData->cellScalarResults(RigEclipseResultAddress(dzResultIndex), 0);
const std::vector<double>& poroResults = resultData->cellScalarResults(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "PORO"), 0);
const std::vector<double>& ntgResults = resultData->cellScalarResults(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "NTG" ), 0);
const std::vector<double>& dzResults = resultData->cellScalarResults(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "DZ" ), 0);
CVF_ASSERT(poroResults.size() == ntgResults.size() && ntgResults.size() == dzResults.size());
int timeStep = view()->currentTimeStep();
std::vector<double> resultValues(poroResults.size(), 0.0);
if (resultAggregation == RESULTS_OIL_COLUMN || resultAggregation == RESULTS_HC_COLUMN)
{
size_t soilResultIndex = resultData->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "SOIL");
const std::vector<double>& soilResults = resultData->cellScalarResults(RigEclipseResultAddress(soilResultIndex), timeStep);
const std::vector<double>& soilResults = resultData->cellScalarResults(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "SOIL"), timeStep);
for (size_t cellResultIdx = 0; cellResultIdx < resultValues.size(); ++cellResultIdx)
{
resultValues[cellResultIdx] = soilResults[cellResultIdx];
@@ -278,8 +278,7 @@ std::vector<double> RimEclipseContourMapProjection::calculateColumnResult(Result
}
if (resultAggregation == RESULTS_GAS_COLUMN || resultAggregation == RESULTS_HC_COLUMN)
{
size_t sgasResultIndex = resultData->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "SGAS");
const std::vector<double>& sgasResults = resultData->cellScalarResults(RigEclipseResultAddress(sgasResultIndex), timeStep);
const std::vector<double>& sgasResults = resultData->cellScalarResults(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "SGAS"), timeStep);
for (size_t cellResultIdx = 0; cellResultIdx < resultValues.size(); ++cellResultIdx)
{
resultValues[cellResultIdx] += sgasResults[cellResultIdx];

View File

@@ -627,17 +627,17 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
//--------------------------------------------------------------------------------------------------
RigEclipseResultAddress RimEclipseResultDefinition::eclipseResultAddress() const
{
size_t gridScalarResultIndex = cvf::UNDEFINED_SIZE_T;
if (isFlowDiagOrInjectionFlooding()) return RigEclipseResultAddress();
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
if (gridCellResults )
{
gridScalarResultIndex = gridCellResults->findScalarResultIndex(m_resultType(), m_resultVariable());
return RigEclipseResultAddress(m_resultType(), m_resultVariable());
}
else
{
return RigEclipseResultAddress();
}
return RigEclipseResultAddress(gridScalarResultIndex);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -39,18 +39,21 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseStatisticsCaseEvaluator::addNamedResult(RigCaseCellResultsData* destinationCellResults, RiaDefines::ResultCatType resultType, const QString& resultName, size_t activeUnionCellCount)
void RimEclipseStatisticsCaseEvaluator::addNamedResult(RigCaseCellResultsData* destinationCellResults,
RiaDefines::ResultCatType resultType,
const QString& resultName,
size_t activeUnionCellCount)
{
// Use time step dates from first result in first source case
CVF_ASSERT(m_sourceCases.size() > 0);
std::vector<RigEclipseTimeStepInfo> sourceTimeStepInfos = m_sourceCases[0]->results(RiaDefines::MATRIX_MODEL)->timeStepInfos(RigEclipseResultAddress(0));
std::vector<RigEclipseResultAddress> resAddresses = m_sourceCases[0]->results(RiaDefines::MATRIX_MODEL)->existingResults();
std::vector<RigEclipseTimeStepInfo> sourceTimeStepInfos = m_sourceCases[0]->results(RiaDefines::MATRIX_MODEL)->timeStepInfos(resAddresses[0]);
size_t destinationScalarResultIndex = destinationCellResults->findOrCreateScalarResultIndex(resultType, resultName, true);
CVF_ASSERT(destinationScalarResultIndex != cvf::UNDEFINED_SIZE_T);
destinationCellResults->findOrCreateScalarResultIndex(resultType, resultName, true);
destinationCellResults->setTimeStepInfos(RigEclipseResultAddress(destinationScalarResultIndex), sourceTimeStepInfos);
std::vector< std::vector<double> >& dataValues = destinationCellResults->cellScalarResults(RigEclipseResultAddress(destinationScalarResultIndex));
destinationCellResults->setTimeStepInfos(RigEclipseResultAddress(resultType, resultName), sourceTimeStepInfos);
std::vector< std::vector<double> >& dataValues = destinationCellResults->cellScalarResults(RigEclipseResultAddress(resultType, resultName));
dataValues.resize(sourceTimeStepInfos.size());
@@ -188,9 +191,13 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults(const QList<ResSpec>&
for (size_t stIdx = 0; stIdx < statisticalResultNames.size(); ++stIdx)
{
size_t scalarResultIndex = destCellResultsData->findScalarResultIndex(resultType, statisticalResultNames[stIdx]);
destCellResultsData->findScalarResultIndex(resultType, statisticalResultNames[stIdx]);
cvf::ref<RigResultModifier> resultModifier = RigResultModifierFactory::createResultModifier(m_destinationCase, grid->gridIndex(), poroModel, dataAccessTimeStepIndex, scalarResultIndex);
cvf::ref<RigResultModifier> resultModifier = RigResultModifierFactory::createResultModifier(m_destinationCase,
grid->gridIndex(),
poroModel,
dataAccessTimeStepIndex,
RigEclipseResultAddress(resultType, statisticalResultNames[stIdx]));
destinationDataAccessList.push_back(resultModifier.p());
}

View File

@@ -272,13 +272,13 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
for (size_t rIdx = 0; rIdx < m_resultCacheMetaData.size(); ++rIdx)
{
RimReservoirCellResultsStorageEntryInfo* resInfo = m_resultCacheMetaData[rIdx];
size_t resultIndex = m_cellResults->findOrCreateScalarResultIndex(resInfo->m_resultType(), resInfo->m_resultName, true);
m_cellResults->findOrCreateScalarResultIndex(resInfo->m_resultType(), resInfo->m_resultName, true);
std::vector<int> reportNumbers; // Hack: Using no report step numbers. Not really used except for Flow Diagnostics...
reportNumbers.resize(resInfo->m_timeStepDates().size());
std::vector<RigEclipseTimeStepInfo> timeStepInfos = RigEclipseTimeStepInfo::createTimeStepInfos(resInfo->m_timeStepDates(), reportNumbers, resInfo->m_daysSinceSimulationStart());
m_cellResults->setTimeStepInfos(RigEclipseResultAddress(resultIndex), timeStepInfos);
m_cellResults->setTimeStepInfos(RigEclipseResultAddress(resInfo->m_resultType(), resInfo->m_resultName), timeStepInfos);
progress.setProgressDescription(resInfo->m_resultName);
@@ -286,7 +286,7 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
{
std::vector<double>* data = nullptr;
data = &(m_cellResults->cellScalarResults(RigEclipseResultAddress(resultIndex), tsIdx));
data = &(m_cellResults->cellScalarResults(RigEclipseResultAddress(resInfo->m_resultType(), resInfo->m_resultName), tsIdx));
quint64 cellCount = 0;
stream >> cellCount;

View File

@@ -348,9 +348,9 @@ size_t RigCaseCellResultsData::findOrCreateScalarResultIndex(RiaDefines::ResultC
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, "TRANX"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, "TRANY"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, "TRANZ"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "TRANX"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "TRANY"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "TRANZ"));
statisticsCalculator = calc;
}
@@ -358,12 +358,12 @@ size_t RigCaseCellResultsData::findOrCreateScalarResultIndex(RiaDefines::ResultC
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, "MULTX"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, "MULTX-"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, "MULTY"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, "MULTY-"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, "MULTZ"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, "MULTZ-"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "MULTX"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "MULTX-"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "MULTY"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "MULTY-"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "MULTZ"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "MULTZ-"));
statisticsCalculator = calc;
}
@@ -371,71 +371,71 @@ size_t RigCaseCellResultsData::findOrCreateScalarResultIndex(RiaDefines::ResultC
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranXResultName()));
RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::riTranXResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranYResultName()));
RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::riTranYResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranZResultName()));
RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::riTranZResultName()));
statisticsCalculator = calc;
}
else if (resultName == RiaDefines::combinedRiMultResultName())
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultXResultName()));
RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::riMultXResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultYResultName()));
RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::riMultYResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultZResultName()));
RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::riMultZResultName()));
statisticsCalculator = calc;
}
else if (resultName == RiaDefines::combinedRiAreaNormTranResultName())
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(
this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranXResultName()));
this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranXResultName()));
calc->addNativeStatisticsCalculator(
this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranYResultName()));
this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranYResultName()));
calc->addNativeStatisticsCalculator(
this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranZResultName()));
this, RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranZResultName()));
statisticsCalculator = calc;
}
else if (resultName == RiaDefines::combinedWaterFluxResultName())
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "FLRWATI+"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "FLRWATJ+"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "FLRWATK+"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLRWATI+"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLRWATJ+"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLRWATK+"));
statisticsCalculator = calc;
}
else if (resultName == RiaDefines::combinedOilFluxResultName())
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "FLROILI+"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "FLROILJ+"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "FLROILK+"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLROILI+"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLROILJ+"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLROILK+"));
statisticsCalculator = calc;
}
else if (resultName == RiaDefines::combinedGasFluxResultName())
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "FLRGASI+"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "FLRGASJ+"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "FLRGASK+"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLRGASI+"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLRGASJ+"));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLRGASK+"));
statisticsCalculator = calc;
}
else if (resultName.endsWith("IJK"))
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
QString baseName = resultName.left(resultName.size() - 3);
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::GENERATED, QString("%1I").arg(baseName)));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::GENERATED, QString("%1J").arg(baseName)));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::GENERATED, QString("%1K").arg(baseName)));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::GENERATED, QString("%1I").arg(baseName)));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::GENERATED, QString("%1J").arg(baseName)));
calc->addNativeStatisticsCalculator(this, RigEclipseResultAddress(RiaDefines::GENERATED, QString("%1K").arg(baseName)));
statisticsCalculator = calc;
}
else
{
statisticsCalculator = new RigEclipseNativeStatCalc(this, scalarResultIndex);
statisticsCalculator = new RigEclipseNativeStatCalc(this, RigEclipseResultAddress(type, resultName));
}
cvf::ref<RigStatisticsDataCache> dataCache = new RigStatisticsDataCache(statisticsCalculator.p());
@@ -622,20 +622,19 @@ void RigCaseCellResultsData::setTimeStepInfos(const RigEclipseResultAddress& res
size_t RigCaseCellResultsData::maxTimeStepCount(RigEclipseResultAddress* resultAddressWithMostTimeSteps) const
{
size_t maxTsCount = 0;
size_t scalarResultIndexWithMaxTsCount = cvf::UNDEFINED_SIZE_T;
RigEclipseResultAddress scalarResultIndexWithMaxTsCount;
for (size_t i = 0; i < m_resultInfos.size(); i++)
{
if (m_resultInfos[i].timeStepInfos().size() > maxTsCount)
{
maxTsCount = m_resultInfos[i].timeStepInfos().size();
scalarResultIndexWithMaxTsCount = i;
}
}
if (resultAddressWithMostTimeSteps)
{
*resultAddressWithMostTimeSteps = RigEclipseResultAddress(scalarResultIndexWithMaxTsCount);
if (resultAddressWithMostTimeSteps)
{
*resultAddressWithMostTimeSteps = m_resultInfos[i].toAddress();
}
}
}
return maxTsCount;
@@ -668,9 +667,7 @@ QString RigCaseCellResultsData::makeResultNameUnique(const QString& resultNamePr
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::clearScalarResult(RiaDefines::ResultCatType type, const QString& resultName)
{
size_t scalarResultIndex = this->findScalarResultIndex(type, resultName);
clearScalarResult(RigEclipseResultAddress(scalarResultIndex));
clearScalarResult(RigEclipseResultAddress(type, resultName));
}
//--------------------------------------------------------------------------------------------------
@@ -678,17 +675,17 @@ void RigCaseCellResultsData::clearScalarResult(RiaDefines::ResultCatType type, c
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::clearScalarResult(const RigEclipseResultAddress& resultAddress)
{
if (!resultAddress.isValid()) return;
size_t scalarResultIndex = findScalarResultIndexFromAddress(resultAddress);
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) return;
for (size_t tsIdx = 0; tsIdx < m_cellScalarResults[scalarResultIndex].size(); ++tsIdx)
{
std::vector<double> empty;
m_cellScalarResults[scalarResultIndex][tsIdx].swap(empty);
}
recalculateStatistics(RigEclipseResultAddress(scalarResultIndex));
recalculateStatistics(resultAddress);
}
//--------------------------------------------------------------------------------------------------
@@ -785,9 +782,9 @@ const std::vector<double>*
if (scalarResultIndexPorv == cvf::UNDEFINED_SIZE_T) return nullptr;
const std::vector<double>* porvResults = &(gridCellResults->cellScalarResults(RigEclipseResultAddress(scalarResultIndexPorv), 0));
const std::vector<double>* porvResults = &(gridCellResults->cellScalarResults(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, porvResultName), 0));
if (!gridCellResults->isUsingGlobalActiveIndex(RigEclipseResultAddress(scalarResultIndexPorv)))
if (!gridCellResults->isUsingGlobalActiveIndex(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, porvResultName)))
{
// PORV is given for all cells
@@ -1036,7 +1033,7 @@ std::vector<RigEclipseResultAddress> RigCaseCellResultsData::existingResults() c
std::vector<RigEclipseResultAddress> addresses;
for (const auto & ri: m_resultInfos)
{
addresses.emplace_back(RigEclipseResultAddress(ri.gridScalarResultIndex()));
addresses.emplace_back(ri.toAddress());
}
return addresses;
@@ -1416,6 +1413,10 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
// Compute SGAS based on SWAT if the simulation contains no oil
testAndComputeSgasForTimeStep(timeStepIndex);
RigEclipseResultAddress SWATAddr(RiaDefines::DYNAMIC_NATIVE, "SWAT");
RigEclipseResultAddress SGASAddr(RiaDefines::DYNAMIC_NATIVE, "SGAS");
RigEclipseResultAddress SSOLAddr(RiaDefines::DYNAMIC_NATIVE, "SSOL");
size_t scalarIndexSWAT = findOrLoadKnownScalarResultForTimeStep(RiaDefines::DYNAMIC_NATIVE, "SWAT", timeStepIndex);
size_t scalarIndexSGAS = findOrLoadKnownScalarResultForTimeStep(RiaDefines::DYNAMIC_NATIVE, "SGAS", timeStepIndex);
size_t scalarIndexSSOL = findOrLoadKnownScalarResultForTimeStep(RiaDefines::DYNAMIC_NATIVE, "SSOL", timeStepIndex);
@@ -1431,7 +1432,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T)
{
std::vector<double>& swatForTimeStep = this->cellScalarResults(RigEclipseResultAddress(scalarIndexSWAT), timeStepIndex);
std::vector<double>& swatForTimeStep = this->cellScalarResults(SWATAddr, timeStepIndex);
if (swatForTimeStep.size() > 0)
{
soilResultValueCount = swatForTimeStep.size();
@@ -1441,7 +1442,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T)
{
std::vector<double>& sgasForTimeStep = this->cellScalarResults(RigEclipseResultAddress(scalarIndexSGAS), timeStepIndex);
std::vector<double>& sgasForTimeStep = this->cellScalarResults(SGASAddr, timeStepIndex);
if (sgasForTimeStep.size() > 0)
{
soilResultValueCount = qMax(soilResultValueCount, sgasForTimeStep.size());
@@ -1452,11 +1453,11 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
}
// Make sure memory is allocated for the new SOIL results
RigEclipseResultAddress SOILAddr(RiaDefines::DYNAMIC_NATIVE, "SOIL");
size_t soilResultScalarIndex = this->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "SOIL");
m_cellScalarResults[soilResultScalarIndex].resize(soilTimeStepCount);
if (this->cellScalarResults(RigEclipseResultAddress(soilResultScalarIndex), timeStepIndex).size() > 0)
if (this->cellScalarResults(SOILAddr, timeStepIndex).size() > 0)
{
// Data is computed and allocated, nothing more to do
return;
@@ -1470,7 +1471,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T)
{
swatForTimeStep = &(this->cellScalarResults(RigEclipseResultAddress(scalarIndexSWAT), timeStepIndex));
swatForTimeStep = &(this->cellScalarResults(SWATAddr, timeStepIndex));
if (swatForTimeStep->size() == 0)
{
swatForTimeStep = nullptr;
@@ -1479,7 +1480,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T)
{
sgasForTimeStep = &(this->cellScalarResults(RigEclipseResultAddress(scalarIndexSGAS), timeStepIndex));
sgasForTimeStep = &(this->cellScalarResults(SGASAddr, timeStepIndex));
if (sgasForTimeStep->size() == 0)
{
sgasForTimeStep = nullptr;
@@ -1488,14 +1489,14 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSSOL != cvf::UNDEFINED_SIZE_T)
{
ssolForTimeStep = &(this->cellScalarResults(RigEclipseResultAddress(scalarIndexSSOL), timeStepIndex));
ssolForTimeStep = &(this->cellScalarResults(SSOLAddr, timeStepIndex));
if (ssolForTimeStep->size() == 0)
{
ssolForTimeStep = nullptr;
}
}
std::vector<double>& soilForTimeStep = this->cellScalarResults(RigEclipseResultAddress(soilResultScalarIndex), timeStepIndex);
std::vector<double>& soilForTimeStep = this->cellScalarResults(SOILAddr, timeStepIndex);
#pragma omp parallel for
for (int idx = 0; idx < static_cast<int>(soilResultValueCount); idx++)
@@ -1911,12 +1912,12 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
ResultIndexFunction permIdxFunc = nullptr;
ResultIndexFunction ntgIdxFunc = nullptr;
{
bool isPermUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permResultIdx));
bool isTransUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(riTransResultIdx));
bool isPermUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, permCompName));
bool isTransUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, riTransComponentResultName));
bool isNtgUsingResIdx = false;
if (hasNTGResults)
{
isNtgUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(ntgResultIdx));
isNtgUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "NTG"));
}
// Set up result index function pointers
@@ -2024,8 +2025,7 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeNncCombRiTrans()
{
RigEclipseResultAddress riCombTransEclResAddr = RigEclipseResultAddress(
this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiTranResultName()));
RigEclipseResultAddress riCombTransEclResAddr(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiTranResultName());
if (m_ownerMainGrid->nncData()->staticConnectionScalarResult( riCombTransEclResAddr )) return;
double cdarchy = darchysValue();
@@ -2047,7 +2047,7 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
std::vector<double>& permZResults = m_cellScalarResults[permZResultIdx][0];
std::vector<double>& riCombTransResults =
m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTrans());
m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTrans(), riCombTransEclResAddr);
m_ownerMainGrid->nncData()->setEclResultAddress(RigNNCData::propertyNameRiCombTrans(), riCombTransEclResAddr);
std::vector<double>* ntgResults = nullptr;
if (hasNTGResults)
@@ -2061,13 +2061,13 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
ResultIndexFunction permZIdxFunc = nullptr;
ResultIndexFunction ntgIdxFunc = nullptr;
{
bool isPermXUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permXResultIdx));
bool isPermYUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permYResultIdx));
bool isPermZUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permZResultIdx));
bool isPermXUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "PERMX"));
bool isPermYUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "PERMY"));
bool isPermZUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "PERMZ"));
bool isNtgUsingResIdx = false;
if (hasNTGResults)
{
isNtgUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(ntgResultIdx));
isNtgUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, "NTG"));
}
// Set up result index function pointers
@@ -2277,22 +2277,22 @@ void RigCaseCellResultsData::computeRiMULTComponent(const QString& riMultCompNam
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeNncCombRiMULT()
{
auto riCombMultEclResAddr =
RigEclipseResultAddress(this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiMultResultName()));
auto riCombTransEclResAddr =
RigEclipseResultAddress(this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiTranResultName()));
auto combTransEclResAddr =
RigEclipseResultAddress(this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName()));
auto riCombMultEclResAddr = RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiMultResultName());
auto riCombTransEclResAddr = RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiTranResultName());
auto combTransEclResAddr = RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName());
if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombMultEclResAddr)) return;
std::vector<double>& riMultResults =
m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombMult());
const std::vector<double>* riTransResults =
m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransEclResAddr);
const std::vector<double>* transResults =
m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransEclResAddr);
m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombMult(), riCombMultEclResAddr);
m_ownerMainGrid->nncData()->setEclResultAddress(RigNNCData::propertyNameRiCombMult(), riCombMultEclResAddr);
for (size_t nncConIdx = 0; nncConIdx < riMultResults.size(); ++nncConIdx)
{
@@ -2354,7 +2354,7 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent(const QString& riTran
// Prepare how to index the result values:
bool isUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(tranCompScResIdx));
bool isUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, transCompName));
// Set up result index function pointers
@@ -2414,15 +2414,17 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent(const QString& riTran
void RigCaseCellResultsData::computeNncCombRiTRANSbyArea()
{
auto riCombTransByAreaEclResAddr =
RigEclipseResultAddress(this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiAreaNormTranResultName()));
RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiAreaNormTranResultName());
auto combTransEclResAddr =
RigEclipseResultAddress(this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName()));
RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName());
if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransByAreaEclResAddr)) return;
std::vector<double>& riAreaNormTransResults =
m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTransByArea());
m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTransByArea(), riCombTransByAreaEclResAddr);
m_ownerMainGrid->nncData()->setEclResultAddress(RigNNCData::propertyNameRiCombTransByArea(), riCombTransByAreaEclResAddr);
const std::vector<double>* transResults =
m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransEclResAddr);
@@ -2631,12 +2633,13 @@ void RigCaseCellResultsData::setActiveFormationNames(RigFormationNames* activeFo
m_activeFormationNamesData = activeFormationNames;
size_t totalGlobCellCount = m_ownerMainGrid->globalCellArray().size();
size_t resIndex = this->addStaticScalarResult(RiaDefines::FORMATION_NAMES,
RiaDefines::activeFormationNamesResultName(),
false,
totalGlobCellCount);
this->addStaticScalarResult(RiaDefines::FORMATION_NAMES,
RiaDefines::activeFormationNamesResultName(),
false,
totalGlobCellCount);
std::vector<double>& fnData = this->cellScalarResults(RigEclipseResultAddress(resIndex),0);
std::vector<double>& fnData = this->cellScalarResults(RigEclipseResultAddress(RiaDefines::FORMATION_NAMES,
RiaDefines::activeFormationNamesResultName()),0);
if (m_activeFormationNamesData.isNull())
{
@@ -2788,9 +2791,9 @@ RigStatisticsDataCache* RigCaseCellResultsData::statistics(const RigEclipseResul
//--------------------------------------------------------------------------------------------------
size_t RigCaseCellResultsData::findScalarResultIndexFromAddress(const RigEclipseResultAddress& resVarAddr) const
{
if(resVarAddr.scalarResultIndex != cvf::UNDEFINED_SIZE_T)
if (!resVarAddr.isValid())
{
return resVarAddr.scalarResultIndex;
return cvf::UNDEFINED_SIZE_T;
}
else if (resVarAddr.m_resultCatType == RiaDefines::UNDEFINED)
{
@@ -2813,7 +2816,8 @@ void RigCaseCellResultsData::copyResultsMetaDataFromMainCase(RigEclipseCaseData*
RiaDefines::PorosityModelType poroModel,
std::vector<RimEclipseCase*> destinationCases)
{
std::vector<RigEclipseTimeStepInfo> timeStepInfos = mainCaseResultsData->results(poroModel)->timeStepInfos(RigEclipseResultAddress(0));
std::vector<RigEclipseResultAddress> resAddresses = mainCaseResultsData->results(poroModel)->existingResults();
std::vector<RigEclipseTimeStepInfo> timeStepInfos = mainCaseResultsData->results(poroModel)->timeStepInfos(resAddresses[0]);
const std::vector<RigEclipseResultInfo> resultInfos = mainCaseResultsData->results(poroModel)->infoForEachResultIndex();
@@ -2840,9 +2844,9 @@ void RigCaseCellResultsData::copyResultsMetaDataFromMainCase(RigEclipseCaseData*
if ( mustBeCalculated ) cellResultsStorage->setMustBeCalculated(scalarResultIndex);
cellResultsStorage->setTimeStepInfos(RigEclipseResultAddress(scalarResultIndex), timeStepInfos);
cellResultsStorage->setTimeStepInfos(RigEclipseResultAddress(resultType, resultName), timeStepInfos);
std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellScalarResults(RigEclipseResultAddress(scalarResultIndex));
std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellScalarResults(RigEclipseResultAddress(resultType, resultName));
dataValues.resize(timeStepInfos.size());
}
}

View File

@@ -735,7 +735,7 @@ const std::vector<double>* RigEclipseCaseData::resultValues(RiaDefines::Porosity
const std::vector<double>* swatResults = nullptr;
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{
swatResults = &(gridCellResults->cellScalarResults(RigEclipseResultAddress(scalarResultIndex), timeStepIndex));
swatResults = &(gridCellResults->cellScalarResults(RigEclipseResultAddress(type, resultName), timeStepIndex));
}
return swatResults;

View File

@@ -127,11 +127,11 @@ size_t RigEclipseMultiPropertyStatCalc::timeStepCount()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigEclipseMultiPropertyStatCalc::addNativeStatisticsCalculator(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex)
void RigEclipseMultiPropertyStatCalc::addNativeStatisticsCalculator(RigCaseCellResultsData* cellResultsData, const RigEclipseResultAddress& eclipseResultAddress)
{
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
if (eclipseResultAddress.isValid())
{
this->addStatisticsCalculator(new RigEclipseNativeStatCalc(cellResultsData, scalarResultIndex));
this->addStatisticsCalculator(new RigEclipseNativeStatCalc(cellResultsData, eclipseResultAddress));
}
}

View File

@@ -29,7 +29,7 @@
class RigHistogramCalculator;
class RigCaseCellResultsData;
class RigEclipseResultAddress;
//==================================================================================================
///
@@ -39,7 +39,7 @@ class RigEclipseMultiPropertyStatCalc : public RigStatisticsCalculator
public:
RigEclipseMultiPropertyStatCalc();
void addStatisticsCalculator(RigStatisticsCalculator* statisticsCalculator);
void addNativeStatisticsCalculator(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndices);
void addNativeStatisticsCalculator(RigCaseCellResultsData* cellResultsData, const RigEclipseResultAddress& scalarResultIndices);
void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) override;
void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) override;

View File

@@ -30,9 +30,9 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseNativeStatCalc::RigEclipseNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex)
: m_resultsData(cellResultsData),
m_scalarResultIndex(scalarResultIndex)
RigEclipseNativeStatCalc::RigEclipseNativeStatCalc(RigCaseCellResultsData* cellResultsData, const RigEclipseResultAddress& eclipseResultAddress)
: m_resultsData(cellResultsData)
, m_eclipseResultAddress(eclipseResultAddress)
{
}
@@ -93,7 +93,7 @@ void RigEclipseNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, doub
//--------------------------------------------------------------------------------------------------
size_t RigEclipseNativeStatCalc::timeStepCount()
{
return m_resultsData->timeStepCount(RigEclipseResultAddress(m_scalarResultIndex));
return m_resultsData->timeStepCount(m_eclipseResultAddress);
}
//--------------------------------------------------------------------------------------------------
@@ -110,10 +110,10 @@ void RigEclipseNativeStatCalc::mobileVolumeWeightedMean(size_t timeStepIndex, do
return;
}
const std::vector<double>& weights = m_resultsData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0);
const std::vector<double>& values = m_resultsData->cellScalarResults(RigEclipseResultAddress(m_scalarResultIndex), timeStepIndex);
const std::vector<double>& weights = m_resultsData->cellScalarResults(RigEclipseResultAddress(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName()), 0);
const std::vector<double>& values = m_resultsData->cellScalarResults(m_eclipseResultAddress, timeStepIndex);
const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo();
RigWeightedMeanCalc::weightedMeanOverCells(&weights, &values, nullptr, false, actCellInfo, m_resultsData->isUsingGlobalActiveIndex(RigEclipseResultAddress(m_scalarResultIndex)), &mean);
RigWeightedMeanCalc::weightedMeanOverCells(&weights, &values, nullptr, false, actCellInfo, m_resultsData->isUsingGlobalActiveIndex(m_eclipseResultAddress), &mean);
}

View File

@@ -33,7 +33,7 @@ class RigHistogramCalculator;
class RigEclipseNativeStatCalc : public RigStatisticsCalculator
{
public:
RigEclipseNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex);
RigEclipseNativeStatCalc(RigCaseCellResultsData* cellResultsData, const RigEclipseResultAddress& eclipseResultAddress);
void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) override;
void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) override;
@@ -45,17 +45,17 @@ public:
private:
RigCaseCellResultsData* m_resultsData;
size_t m_scalarResultIndex;
RigEclipseResultAddress m_eclipseResultAddress;
template <typename StatisticsAccumulator>
void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex)
{
if (timeStepIndex >= m_resultsData->cellScalarResults(RigEclipseResultAddress(m_scalarResultIndex)).size())
if (timeStepIndex >= m_resultsData->cellScalarResults(m_eclipseResultAddress).size())
{
return;
}
std::vector<double>& values = m_resultsData->cellScalarResults(RigEclipseResultAddress(m_scalarResultIndex), timeStepIndex);
std::vector<double>& values = m_resultsData->cellScalarResults(m_eclipseResultAddress, timeStepIndex);
if (values.empty())
{
@@ -66,13 +66,14 @@ private:
const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo();
size_t cellCount = actCellInfo->reservoirCellCount();
bool isUsingGlobalActiveIndex = m_resultsData->isUsingGlobalActiveIndex(m_eclipseResultAddress);
for (size_t cIdx = 0; cIdx < cellCount; ++cIdx)
{
// Filter out inactive cells
if (!actCellInfo->isActive(cIdx)) continue;
size_t cellResultIndex = cIdx;
if (m_resultsData->isUsingGlobalActiveIndex(RigEclipseResultAddress(m_scalarResultIndex)))
if (isUsingGlobalActiveIndex)
{
cellResultIndex = actCellInfo->cellResultIndex(cIdx);
}

View File

@@ -105,9 +105,9 @@ size_t RigEclipseNativeVisibleCellsStatCalc::timeStepCount()
//--------------------------------------------------------------------------------------------------
void RigEclipseNativeVisibleCellsStatCalc::mobileVolumeWeightedMean(size_t timeStepIndex, double &result)
{
size_t mobPVResultIndex = m_caseData->findOrLoadKnownScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
m_caseData->findOrLoadKnownScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
const std::vector<double>& weights = m_caseData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0);
const std::vector<double>& weights = m_caseData->cellScalarResults(RigEclipseResultAddress(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName()), 0);
const std::vector<double>& values = m_caseData->cellScalarResults(m_resultAddress, timeStepIndex);
const RigActiveCellInfo* actCellInfo = m_caseData->activeCellInfo();

View File

@@ -24,24 +24,21 @@ class RigEclipseResultAddress
{
public:
RigEclipseResultAddress()
: scalarResultIndex(-1)
, m_resultCatType(RiaDefines::UNDEFINED)
: m_resultCatType(RiaDefines::UNDEFINED)
{}
explicit RigEclipseResultAddress(size_t ascalarResultIndex)
: scalarResultIndex(ascalarResultIndex)
, m_resultCatType(RiaDefines::UNDEFINED)
explicit RigEclipseResultAddress(const QString& resultName)
: m_resultCatType(RiaDefines::UNDEFINED)
, m_resultName(resultName)
{}
explicit RigEclipseResultAddress(RiaDefines::ResultCatType type, const QString& resultName)
: scalarResultIndex(-1)
, m_resultCatType(type)
: m_resultCatType(type)
, m_resultName(resultName)
{}
bool isValid() const
{
if (scalarResultIndex != -1) return true;
if (!m_resultName.isEmpty()) return true;
return false;
@@ -49,11 +46,6 @@ public:
bool operator< (const RigEclipseResultAddress& other ) const
{
if (scalarResultIndex != other.scalarResultIndex)
{
return (scalarResultIndex < other.scalarResultIndex);
}
if (m_resultCatType != other.m_resultCatType)
{
return (m_resultCatType < other.m_resultCatType);
@@ -62,8 +54,6 @@ public:
return (m_resultName < other.m_resultName);
}
size_t scalarResultIndex; // Temporary. Must be removed
RiaDefines::ResultCatType m_resultCatType;
QString m_resultName;
};

View File

@@ -18,6 +18,8 @@
#pragma once
#include "RigEclipseResultAddress.h"
#include "RiaDefines.h"
#include <QDateTime>
@@ -65,6 +67,8 @@ public:
bool operator<(const RigEclipseResultInfo& rhs) const;
RigEclipseResultAddress toAddress() const { return RigEclipseResultAddress (m_resultType, m_resultName );}
private:
friend class RigCaseCellResultsData;
void setResultType(RiaDefines::ResultCatType newType);

View File

@@ -120,9 +120,9 @@ void RigFlowDiagStatCalc::mobileVolumeWeightedMean(size_t timeStepIndex, double&
RigCaseCellResultsData* caseCellResultsData = eclCase->results(RiaDefines::MATRIX_MODEL);
size_t mobPVResultIndex = caseCellResultsData->findOrLoadKnownScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
caseCellResultsData->findOrLoadKnownScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
const std::vector<double>& weights = caseCellResultsData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0);
const std::vector<double>& weights = caseCellResultsData->cellScalarResults(RigEclipseResultAddress(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName()), 0);
const std::vector<double>* values = m_resultsData->resultValues(m_resVarAddr, timeStepIndex);
const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo(m_resVarAddr);

View File

@@ -109,9 +109,9 @@ void RigFlowDiagVisibleCellsStatCalc::mobileVolumeWeightedMean(size_t timeStepIn
RigCaseCellResultsData* caseCellResultsData = eclCase->results(RiaDefines::MATRIX_MODEL);
size_t mobPVResultIndex = caseCellResultsData->findOrLoadKnownScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
caseCellResultsData->findOrLoadKnownScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
const std::vector<double>& weights = caseCellResultsData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0);
const std::vector<double>& weights = caseCellResultsData->cellScalarResults(RigEclipseResultAddress(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName()), 0);
const std::vector<double>* values = m_resultsData->resultValues(m_resVarAddr, timeStepIndex);
const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo(m_resVarAddr);

View File

@@ -494,9 +494,9 @@ std::vector<QString> RigNNCData::availableProperties(NNCResultType resultType) c
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigNNCData::setScalarResultIndex(const QString& nncDataType, const RigEclipseResultAddress& resVarAddr)
void RigNNCData::setEclResultAddress(const QString& nncDataType, const RigEclipseResultAddress& resVarAddr)
{
m_resultIndexToNNCDataType[resVarAddr.scalarResultIndex] = nncDataType;
m_resultAddrToNNCDataType[resVarAddr] = nncDataType;
}
//--------------------------------------------------------------------------------------------------
@@ -516,8 +516,8 @@ bool RigNNCData::hasScalarValues(const RigEclipseResultAddress& resVarAddr)
//--------------------------------------------------------------------------------------------------
const QString RigNNCData::getNNCDataTypeFromScalarResultIndex(const RigEclipseResultAddress& resVarAddr) const
{
auto it = m_resultIndexToNNCDataType.find(resVarAddr.scalarResultIndex);
if (it != m_resultIndexToNNCDataType.end())
auto it = m_resultAddrToNNCDataType.find(resVarAddr);
if (it != m_resultAddrToNNCDataType.end())
{
return it->second;
}

View File

@@ -109,7 +109,7 @@ public:
std::vector<QString> availableProperties(NNCResultType resultType) const;
void setScalarResultIndex(const QString& nncDataType, const RigEclipseResultAddress& resVarAddr);
void setEclResultAddress(const QString& nncDataType, const RigEclipseResultAddress& resVarAddr);
bool hasScalarValues(const RigEclipseResultAddress& resVarAddr);
@@ -120,5 +120,5 @@ private:
private:
std::vector<RigConnection> m_connections;
std::map<QString, std::vector< std::vector<double> > > m_connectionResults;
std::map<size_t, QString> m_resultIndexToNNCDataType;
std::map<RigEclipseResultAddress, QString> m_resultAddrToNNCDataType;
};

View File

@@ -68,10 +68,13 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator
swcrResults = RigCaseCellResultsData::getResultIndexableStaticResult(actCellInfo, gridCellResults, "SWCR", porvActiveCellsResultStorage);
progress.incrementProgress();
std::vector<size_t> scalarResultIndexTracers;
std::vector<RigEclipseResultAddress> tracerResAddrs;
for (QString tracerName : tracerNames)
{
scalarResultIndexTracers.push_back(gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, tracerName));
if (gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, tracerName) != cvf::UNDEFINED_SIZE_T)
{
tracerResAddrs.push_back(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, tracerName));
}
progress.incrementProgress();
}
std::vector<std::vector<double> > summedTracersAtAllTimesteps;
@@ -109,7 +112,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator
const std::vector<double>* flowrateI = nullptr;
if (scalarResultIndexFlowrateI != cvf::UNDEFINED_SIZE_T)
{
flowrateI = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(scalarResultIndexFlowrateI),
flowrateI = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLRWATI+"),
timeStep));
}
flowrateIatAllTimeSteps.push_back(flowrateI);
@@ -118,7 +121,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator
const std::vector<double>* flowrateJ = nullptr;
if (scalarResultIndexFlowrateJ != cvf::UNDEFINED_SIZE_T)
{
flowrateJ = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(scalarResultIndexFlowrateJ),
flowrateJ = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLRWATJ+"),
timeStep));
}
flowrateJatAllTimeSteps.push_back(flowrateJ);
@@ -127,7 +130,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator
const std::vector<double>* flowrateK = nullptr;
if (scalarResultIndexFlowrateK != cvf::UNDEFINED_SIZE_T)
{
flowrateK = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(scalarResultIndexFlowrateK),
flowrateK = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "FLRWATK+"),
timeStep));
}
flowrateKatAllTimeSteps.push_back(flowrateK);
@@ -140,16 +143,13 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator
//sum all tracers at current timestep
std::vector<double> summedTracerValues(resultCellCount);
for (size_t tracerIndex : scalarResultIndexTracers)
for (const RigEclipseResultAddress& tracerResAddr : tracerResAddrs)
{
if (tracerIndex != cvf::UNDEFINED_SIZE_T)
{
const std::vector<double>* tracerResult = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(tracerIndex), timeStep));
const std::vector<double>* tracerResult = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(tracerResAddr, timeStep));
for (size_t i = 0; i < summedTracerValues.size(); i++)
{
summedTracerValues[i] += tracerResult->at(i);
}
for ( size_t i = 0; i < summedTracerValues.size(); i++ )
{
summedTracerValues[i] += tracerResult->at(i);
}
}
summedTracersAtAllTimesteps.push_back(summedTracerValues);

View File

@@ -91,7 +91,7 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromNameAndType(cons
adjustedTimeStepIndex = 0;
}
return createFromResultIdx(eclipseCase, gridIndex, porosityModel, adjustedTimeStepIndex, RigEclipseResultAddress(scalarSetIndex));
return createFromResultIdx(eclipseCase, gridIndex, porosityModel, adjustedTimeStepIndex, RigEclipseResultAddress(resultType, uiResultName));
}
//--------------------------------------------------------------------------------------------------
@@ -154,7 +154,7 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createNativeFromUiResultNa
return nullptr;
}
return createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(scalarSetIndex));
return createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(uiResultName));
}
//--------------------------------------------------------------------------------------------------
@@ -306,9 +306,9 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultIdx(const
size_t gridIndex,
RiaDefines::PorosityModelType porosityModel,
size_t timeStepIndex,
const RigEclipseResultAddress& resultIndex)
const RigEclipseResultAddress& resultAddress)
{
if ( !resultIndex.isValid() )
if ( !resultAddress.isValid() )
{
return new RigHugeValResultAccessor;
}
@@ -318,7 +318,7 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultIdx(const
const RigGridBase* grid = eclipseCase->grid(gridIndex);
if (!grid) return nullptr;
const std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(RigEclipseResultAddress(resultIndex));
const std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(resultAddress);
if (timeStepIndex >= scalarSetResults.size())
{
@@ -336,7 +336,7 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultIdx(const
return new RigHugeValResultAccessor;
}
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(RigEclipseResultAddress(resultIndex));
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(resultAddress);
if (useGlobalActiveIndex)
{
cvf::ref<RigResultAccessor> object = new RigActiveCellsResultAccessor(grid, resultValues, eclipseCase->activeCellInfo(porosityModel));

View File

@@ -42,9 +42,9 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigEc
return nullptr;
}
size_t scalarSetIndex = eclipseCase->results(porosityModel)->findScalarResultIndex(uiResultName);
eclipseCase->results(porosityModel)->findScalarResultIndex(uiResultName);
return createResultModifier(eclipseCase, gridIndex, porosityModel, timeStepIndex, scalarSetIndex);
return createResultModifier(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(uiResultName));
}
@@ -54,7 +54,8 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigEc
cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigEclipseCaseData* eclipseCase,
size_t gridIndex,
RiaDefines::PorosityModelType porosityModel,
size_t timeStepIndex, size_t scalarResultIndex)
size_t timeStepIndex,
const RigEclipseResultAddress& resVarAddr)
{
if ( !eclipseCase ) return nullptr;
@@ -63,7 +64,7 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigEc
return nullptr;
}
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T)
if (!resVarAddr.isValid())
{
return nullptr;
}
@@ -74,7 +75,7 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigEc
return nullptr;
}
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(RigEclipseResultAddress(scalarResultIndex));
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(resVarAddr);
if (timeStepIndex >= scalarSetResults.size())
{
@@ -87,7 +88,7 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigEc
resultValues = &(scalarSetResults[timeStepIndex]);
}
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(RigEclipseResultAddress(scalarResultIndex));
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(resVarAddr);
if (useGlobalActiveIndex)
{
cvf::ref<RigResultModifier> object = new RigActiveCellsResultModifier(grid, eclipseCase->activeCellInfo(porosityModel), resultValues);

View File

@@ -23,6 +23,7 @@
class RigEclipseCaseData;
class RigResultModifier;
class RigEclipseResultAddress;
class RigResultModifierFactory
{
@@ -39,7 +40,7 @@ public:
size_t gridIndex,
RiaDefines::PorosityModelType porosityModel,
size_t timeStepIndex,
size_t scalarResultIndex);
const RigEclipseResultAddress& resVarAddr);
};

View File

@@ -299,7 +299,7 @@ class RiaSetNNCProperty: public RiaSocketCommand
public:
RiaSetNNCProperty() :
m_currentReservoir(nullptr),
m_currentScalarIndex(cvf::UNDEFINED_SIZE_T),
m_currentEclResultAddress(),
m_timeStepCountToRead(0),
m_bytesPerTimeStepToRead(0),
m_currentTimeStepNumberToRead(0),
@@ -350,8 +350,9 @@ public:
server->errorMessageDialog()->showMessage(RiaSocketServer::tr("ResInsight SocketServer: \n") + RiaSocketServer::tr("Could not find the property named: \"%2\"").arg(propertyName));
return true;
}
size_t scalarResultIndex = rimCase->results(m_porosityModelEnum)->findOrLoadKnownScalarResult(QString("%1IJK").arg(propertyName));
nncData->setScalarResultIndex(propertyName, RigEclipseResultAddress(scalarResultIndex));
QString totalPropName = QString("%1IJK").arg(propertyName);
rimCase->results(m_porosityModelEnum)->findOrLoadKnownScalarResult(totalPropName);
nncData->setEclResultAddress(propertyName, RigEclipseResultAddress(totalPropName));
}
// Create a list of all the requested time steps
@@ -408,7 +409,7 @@ public:
return false;
}
private:
static bool createIJKCellResults(RigCaseCellResultsData* results, QString propertyName)
{
bool ok;
@@ -434,7 +435,7 @@ public:
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
scalarResultFrames = &(results->cellScalarResults(RigEclipseResultAddress(scalarResultIndex)));
scalarResultFrames = &(results->cellScalarResults(RigEclipseResultAddress(propertyName)));
size_t timeStepCount = results->maxTimeStepCount();
scalarResultFrames->resize(timeStepCount);
return true;
@@ -442,7 +443,7 @@ public:
return false;
}
public:
bool interpretMore(RiaSocketServer* server, QTcpSocket* currentClient) override
{
if (m_invalidConnectionCountDetected) return true;
@@ -534,11 +535,11 @@ public:
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED_NOT_SAVED;
}
if( m_currentScalarIndex != cvf::UNDEFINED_SIZE_T &&
if( m_currentEclResultAddress.isValid() && // Will never be valid because it is never set. What is correct behaviour ?
m_currentReservoir->eclipseCaseData() &&
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum) )
{
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(RigEclipseResultAddress(m_currentScalarIndex));
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(m_currentEclResultAddress);
}
for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i)
@@ -565,7 +566,7 @@ public:
private:
RimEclipseCase* m_currentReservoir;
size_t m_currentScalarIndex;
RigEclipseResultAddress m_currentEclResultAddress;
QString m_currentPropertyName;
std::vector<size_t> m_requestedTimesteps;
RiaDefines::PorosityModelType m_porosityModelEnum;

View File

@@ -82,7 +82,7 @@ public:
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{
scalarResultFrames = &(rimCase->results(porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(scalarResultIndex)));
scalarResultFrames = &(rimCase->results(porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(propertyName)));
}
}
@@ -246,6 +246,8 @@ public:
}
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T;
RigEclipseResultAddress resVarAddr(propertyName);
if (gridIdx < 0 || rimCase->eclipseCaseData()->gridCount() <= (size_t)gridIdx)
{
@@ -278,7 +280,7 @@ public:
if (args.size() <= 5)
{
// Select all
for (size_t tsIdx = 0; tsIdx < rimCase->results(porosityModelEnum)->timeStepCount(RigEclipseResultAddress(scalarResultIndex)); ++tsIdx)
for (size_t tsIdx = 0; tsIdx < rimCase->results(porosityModelEnum)->timeStepCount(resVarAddr); ++tsIdx)
{
requestedTimesteps.push_back(tsIdx);
}
@@ -384,7 +386,7 @@ public:
RiaSetActiveCellProperty() :
m_currentReservoir(nullptr),
m_scalarResultsToAdd(nullptr),
m_currentScalarIndex(cvf::UNDEFINED_SIZE_T),
m_currentEclResultAddress(),
m_timeStepCountToRead(0),
m_bytesPerTimeStepToRead(0),
m_currentTimeStepNumberToRead(0),
@@ -408,12 +410,13 @@ public:
// Find the requested data, Or create a set if we are setting data and it is not found
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T;
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
if (rimCase && rimCase->results(m_porosityModelEnum))
{
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T;
scalarResultIndex = rimCase->results(m_porosityModelEnum)->findOrLoadKnownScalarResult(RiaDefines::GENERATED, propertyName);
RigEclipseResultAddress eclResAddr(RiaDefines::GENERATED, propertyName);
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T)
{
@@ -422,16 +425,16 @@ public:
RigEclipseResultAddress addrToMaxTimeStepCountResult;
rimCase->results(m_porosityModelEnum)->maxTimeStepCount(&addrToMaxTimeStepCountResult);
const std::vector<RigEclipseTimeStepInfo> timeStepInfos = rimCase->results(m_porosityModelEnum)->timeStepInfos(addrToMaxTimeStepCountResult);
rimCase->results(m_porosityModelEnum)->setTimeStepInfos(RigEclipseResultAddress(scalarResultIndex), timeStepInfos);
rimCase->results(m_porosityModelEnum)->setTimeStepInfos(eclResAddr, timeStepInfos);
}
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(scalarResultIndex)));
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellScalarResults(eclResAddr));
size_t timeStepCount = rimCase->results(m_porosityModelEnum)->maxTimeStepCount();
scalarResultFrames->resize(timeStepCount);
m_currentScalarIndex = scalarResultIndex;
m_currentEclResultAddress = eclResAddr;
m_currentPropertyName = propertyName;
}
}
@@ -654,15 +657,15 @@ public:
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED_NOT_SAVED;
}
if( m_currentScalarIndex != cvf::UNDEFINED_SIZE_T &&
if( m_currentEclResultAddress.isValid() &&
m_currentReservoir->eclipseCaseData() &&
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum) )
{
// Adjust the result data if only one time step is requested so the result behaves like a static result
if (m_requestedTimesteps.size() == 1 && m_currentScalarIndex != cvf::UNDEFINED_SIZE_T)
if (m_requestedTimesteps.size() == 1 && m_currentEclResultAddress.isValid())
{
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(m_currentScalarIndex)));
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(m_currentEclResultAddress));
size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T;
for (size_t i = 0; i < scalarResultFrames->size(); i++)
{
@@ -678,7 +681,7 @@ public:
}
}
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(RigEclipseResultAddress(m_currentScalarIndex));
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(m_currentEclResultAddress);
}
for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i)
@@ -706,7 +709,7 @@ public:
private:
RimEclipseCase* m_currentReservoir;
std::vector< std::vector<double> >* m_scalarResultsToAdd;
size_t m_currentScalarIndex;
RigEclipseResultAddress m_currentEclResultAddress;
QString m_currentPropertyName;
std::vector<size_t> m_requestedTimesteps;
RiaDefines::PorosityModelType m_porosityModelEnum;
@@ -731,7 +734,6 @@ public:
m_currentReservoir(nullptr),
m_scalarResultsToAdd(nullptr),
m_currentGridIndex(cvf::UNDEFINED_SIZE_T),
m_currentScalarIndex(cvf::UNDEFINED_SIZE_T),
m_timeStepCountToRead(0),
m_bytesPerTimeStepToRead(0),
m_currentTimeStepNumberToRead(0),
@@ -816,11 +818,11 @@ public:
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(scalarResultIndex)));
m_currentResultAddress = RigEclipseResultAddress(RiaDefines::GENERATED, propertyName);
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellScalarResults(m_currentResultAddress));
size_t timeStepCount = rimCase->results(m_porosityModelEnum)->maxTimeStepCount();
scalarResultFrames->resize(timeStepCount);
m_currentScalarIndex = scalarResultIndex;
m_currentPropertyName = propertyName;
}
}
@@ -983,7 +985,11 @@ public:
return true;
}
cvf::ref<RigResultModifier> resultModifier = RigResultModifierFactory::createResultModifier(m_currentReservoir->eclipseCaseData(), grid->gridIndex(), m_porosityModelEnum, m_requestedTimesteps[m_currentTimeStepNumberToRead], m_currentScalarIndex);
cvf::ref<RigResultModifier> resultModifier = RigResultModifierFactory::createResultModifier(m_currentReservoir->eclipseCaseData(),
grid->gridIndex(),
m_porosityModelEnum,
m_requestedTimesteps[m_currentTimeStepNumberToRead],
m_currentResultAddress);
if (!resultModifier.isNull())
{
for (size_t cellIdx = 0; static_cast<size_t>(cellIdx) < cellCountFromOctave; cellIdx++)
@@ -1018,15 +1024,15 @@ public:
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED_NOT_SAVED;
}
if( m_currentScalarIndex != cvf::UNDEFINED_SIZE_T &&
if( m_currentResultAddress.isValid() &&
m_currentReservoir->eclipseCaseData() &&
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum) )
{
// Adjust the result data if only one time step is requested so the result behaves like a static result
if (m_requestedTimesteps.size() == 1 && m_currentScalarIndex != cvf::UNDEFINED_SIZE_T)
if (m_requestedTimesteps.size() == 1 && m_currentResultAddress.isValid())
{
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(m_currentScalarIndex)));
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(m_currentResultAddress)));
size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T;
for (size_t i = 0; i < scalarResultFrames->size(); i++)
{
@@ -1042,7 +1048,7 @@ public:
}
}
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(RigEclipseResultAddress(m_currentScalarIndex));
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(RigEclipseResultAddress(m_currentResultAddress));
}
for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i)
@@ -1072,7 +1078,7 @@ private:
RimEclipseCase* m_currentReservoir;
std::vector< std::vector<double> >* m_scalarResultsToAdd;
size_t m_currentGridIndex;
size_t m_currentScalarIndex;
RigEclipseResultAddress m_currentResultAddress;
QString m_currentPropertyName;
std::vector<size_t> m_requestedTimesteps;
RiaDefines::PorosityModelType m_porosityModelEnum;
@@ -1198,17 +1204,16 @@ public:
}
}
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T;
if (rimCase && rimCase->results(porosityModel))
{
scalarResultIndex = rimCase->results(porosityModel)->findOrLoadKnownScalarResult(propertyName);
rimCase->results(porosityModel)->findOrLoadKnownScalarResult(propertyName);
}
std::vector<size_t> requestedTimesteps;
if (args.size() < 5)
{
// Select all
for (size_t tsIdx = 0; tsIdx < rimCase->results(porosityModel)->timeStepCount(RigEclipseResultAddress(scalarResultIndex)); ++tsIdx)
for (size_t tsIdx = 0; tsIdx < rimCase->results(porosityModel)->timeStepCount(RigEclipseResultAddress(propertyName)); ++tsIdx)
{
requestedTimesteps.push_back(tsIdx);
}

View File

@@ -470,13 +470,13 @@ void RiuResultTextBuilder::appendTextFromResultColors(RigEclipseCaseData* eclips
RigCaseCellResultsData* gridCellResults = resultColors->currentGridCellResults();
if (gridCellResults)
{
size_t soilScalarSetIndex = gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SOIL");
size_t sgasScalarSetIndex = gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS");
size_t swatScalarSetIndex = gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT");
gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SOIL");
gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS");
gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT");
cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(soilScalarSetIndex));
cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(sgasScalarSetIndex));
cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(swatScalarSetIndex));
cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "SOIL"));
cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "SGAS"));
cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "SWAT"));
double scalarValue = 0.0;
@@ -753,15 +753,15 @@ QString RiuResultTextBuilder::cellResultText(RimEclipseCellColors* resultColors)
RigCaseCellResultsData* gridCellResults = m_reservoirView->cellResult()->currentGridCellResults();
if (gridCellResults)
{
size_t soilScalarSetIndex = gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SOIL");
size_t sgasScalarSetIndex = gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS");
size_t swatScalarSetIndex = gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT");
gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SOIL");
gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS");
gridCellResults->findOrLoadKnownScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT");
RiaDefines::PorosityModelType porosityModel = resultColors->porosityModel();
cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(soilScalarSetIndex));
cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(sgasScalarSetIndex));
cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(swatScalarSetIndex));
cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "SOIL"));
cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "SGAS"));
cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "SWAT"));
double scalarValue = 0.0;