mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1692 Put SourSimRL Results in a separate result type
#1693 Started to separate code for SourSim and Eclipse results data.
This commit is contained in:
@@ -29,6 +29,7 @@ namespace caf
|
||||
{
|
||||
addItem(RimDefines::DYNAMIC_NATIVE, "DYNAMIC_NATIVE", "Dynamic");
|
||||
addItem(RimDefines::STATIC_NATIVE, "STATIC_NATIVE", "Static");
|
||||
addItem(RimDefines::SOURSIMRL, "SOURSIMRL", "SourSimRL");
|
||||
addItem(RimDefines::GENERATED, "GENERATED", "Generated");
|
||||
addItem(RimDefines::INPUT_PROPERTY, "INPUT_PROPERTY", "Input Property");
|
||||
addItem(RimDefines::FORMATION_NAMES, "FORMATION_NAMES", "Formation Names");
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
{
|
||||
DYNAMIC_NATIVE,
|
||||
STATIC_NATIVE,
|
||||
SOURSIMRL,
|
||||
GENERATED,
|
||||
INPUT_PROPERTY,
|
||||
FORMATION_NAMES,
|
||||
|
||||
@@ -464,6 +464,14 @@ void RimEclipseResultCase::setSourSimFileName(const QString& fileName)
|
||||
loadAndUpdateSourSimData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultCase::hasSourSimFile()
|
||||
{
|
||||
return !m_sourSimFileName().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
void setGridFileName(const QString& caseFileName);
|
||||
void setCaseInfo(const QString& userDescription, const QString& caseFileName);
|
||||
void setSourSimFileName(const QString& fileName);
|
||||
bool hasSourSimFile();
|
||||
|
||||
virtual bool openEclipseGridFile();
|
||||
virtual void reloadEclipseGridFile();
|
||||
|
||||
@@ -422,33 +422,41 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
if ( fieldNeedingOptions == &m_resultTypeUiField )
|
||||
{
|
||||
bool hasFlowDiagFluxes = false;
|
||||
bool hasSourSimRLFile = false;
|
||||
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
|
||||
if ( eclResCase && eclResCase->eclipseCaseData() )
|
||||
{
|
||||
hasFlowDiagFluxes = eclResCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes();
|
||||
hasSourSimRLFile = eclResCase->hasSourSimFile();
|
||||
}
|
||||
|
||||
|
||||
RimGridTimeHistoryCurve* timeHistoryCurve;
|
||||
this->firstAncestorOrThisOfType(timeHistoryCurve);
|
||||
|
||||
// Do not include flow diagnostics results if not available or is a time history curve
|
||||
if ( !hasFlowDiagFluxes || timeHistoryCurve != nullptr )
|
||||
if ( !hasFlowDiagFluxes || timeHistoryCurve != nullptr || !hasSourSimRLFile)
|
||||
{
|
||||
using ResCatEnum = caf::AppEnum< RimDefines::ResultCatType >;
|
||||
for ( size_t i = 0; i < ResCatEnum::size(); ++i )
|
||||
{
|
||||
RimDefines::ResultCatType resType = ResCatEnum::fromIndex(i);
|
||||
if ( resType != RimDefines::FLOW_DIAGNOSTICS )
|
||||
if ( resType == RimDefines::FLOW_DIAGNOSTICS
|
||||
&& (!hasFlowDiagFluxes || timeHistoryCurve) )
|
||||
{
|
||||
QString uiString = ResCatEnum::uiTextFromIndex(i);
|
||||
options.push_back(caf::PdmOptionItemInfo(uiString, resType));
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( resType == RimDefines::SOURSIMRL
|
||||
&& (!hasSourSimRLFile ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QString uiString = ResCatEnum::uiTextFromIndex(i);
|
||||
options.push_back(caf::PdmOptionItemInfo(uiString, resType));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do nothing, and thereby use the defaults of the AppEnum field
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_resultTypeUiField() != RimDefines::FLOW_DIAGNOSTICS )
|
||||
@@ -857,6 +865,10 @@ bool RimEclipseResultDefinition::hasDynamicResult() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (m_resultType() == RimDefines::SOURSIMRL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (m_resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QUuid>
|
||||
#include "RifReaderEclipseOutput.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimReservoirCellResultsStorage, "ReservoirCellResultStorage");
|
||||
|
||||
@@ -240,6 +241,11 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(const QString& res
|
||||
scalarResultIndex = this->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, resultName);
|
||||
}
|
||||
|
||||
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
scalarResultIndex = this->findOrLoadScalarResult(RimDefines::SOURSIMRL, resultName);
|
||||
}
|
||||
|
||||
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
scalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::GENERATED, resultName);
|
||||
@@ -418,6 +424,26 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RimDefines::Result
|
||||
}
|
||||
}
|
||||
|
||||
// Handle SourSimRL reading
|
||||
|
||||
if (type == RimDefines::SOURSIMRL)
|
||||
{
|
||||
RifReaderEclipseOutput* eclReader = dynamic_cast<RifReaderEclipseOutput*>(m_readerInterface.p());
|
||||
if (eclReader)
|
||||
{
|
||||
size_t timeStepCount = m_cellResults->infoForEachResultIndex()[scalarResultIndex].m_timeStepDates.size();
|
||||
|
||||
m_cellResults->cellScalarResults(scalarResultIndex).resize(timeStepCount);
|
||||
|
||||
size_t i;
|
||||
for ( i = 0; i < timeStepCount; i++ )
|
||||
{
|
||||
std::vector<double>& values = m_cellResults->cellScalarResults(scalarResultIndex)[i];
|
||||
eclReader->sourSimRlResult(resultName, i, &values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return scalarResultIndex;
|
||||
}
|
||||
|
||||
@@ -493,6 +519,26 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResultForTimeStep(RimDefi
|
||||
}
|
||||
}
|
||||
|
||||
// Handle SourSimRL reading
|
||||
|
||||
if (type == RimDefines::SOURSIMRL)
|
||||
{
|
||||
RifReaderEclipseOutput* eclReader = dynamic_cast<RifReaderEclipseOutput*>(m_readerInterface.p());
|
||||
if (eclReader)
|
||||
{
|
||||
size_t timeStepCount = m_cellResults->infoForEachResultIndex()[scalarResultIndex].m_timeStepDates.size();
|
||||
|
||||
m_cellResults->cellScalarResults(scalarResultIndex).resize(timeStepCount);
|
||||
|
||||
std::vector<double>& values = m_cellResults->cellScalarResults(scalarResultIndex)[timeStepIndex];
|
||||
|
||||
if ( values.size() == 0)
|
||||
{
|
||||
eclReader->sourSimRlResult(resultName, timeStepIndex, &values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return scalarResultIndex;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user