mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add result type and create and use custom legend if possible
* Update submodule * Use postfix functions and add custom color legend * Add type to RigEclipseResultAddress Read types from ROFF and create default legend based on type or custom created legend. * Use caseId to connect legend configuration to result in a case
This commit is contained in:
@@ -58,12 +58,12 @@ void RigIndexIjkResultCalculator::calculate( const RigEclipseResultAddress& resV
|
||||
size_t reservoirCellCount = m_resultsData->activeCellInfo()->reservoirCellCount();
|
||||
if ( reservoirCellCount == 0 ) return;
|
||||
|
||||
size_t iResultIndex = m_resultsData->findScalarResultIndexFromAddress(
|
||||
RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexIResultName() ) );
|
||||
size_t jResultIndex = m_resultsData->findScalarResultIndexFromAddress(
|
||||
RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexJResultName() ) );
|
||||
size_t kResultIndex = m_resultsData->findScalarResultIndexFromAddress(
|
||||
RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexKResultName() ) );
|
||||
size_t iResultIndex =
|
||||
m_resultsData->findScalarResultIndexFromAddress( RiaResultNames::staticIntegerAddress( RiaResultNames::indexIResultName() ) );
|
||||
size_t jResultIndex =
|
||||
m_resultsData->findScalarResultIndexFromAddress( RiaResultNames::staticIntegerAddress( RiaResultNames::indexJResultName() ) );
|
||||
size_t kResultIndex =
|
||||
m_resultsData->findScalarResultIndexFromAddress( RiaResultNames::staticIntegerAddress( RiaResultNames::indexKResultName() ) );
|
||||
|
||||
if ( iResultIndex == cvf::UNDEFINED_SIZE_T || jResultIndex == cvf::UNDEFINED_SIZE_T || kResultIndex == cvf::UNDEFINED_SIZE_T ) return;
|
||||
|
||||
|
||||
@@ -24,8 +24,11 @@
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaResultNames.h"
|
||||
|
||||
#include "RifReaderEclipseOutput.h"
|
||||
|
||||
#include "RigAllanDiagramData.h"
|
||||
#include "RigAllanUtil.h"
|
||||
#include "RigCaseCellResultCalculator.h"
|
||||
@@ -51,8 +54,6 @@
|
||||
#include "RimGridCalculationCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RifReaderEclipseOutput.h"
|
||||
|
||||
#include "cafAssert.h"
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
@@ -746,6 +747,45 @@ size_t RigCaseCellResultsData::addStaticScalarResult( RiaDefines::ResultCatType
|
||||
return resultIdx;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigEclipseResultAddress RigCaseCellResultsData::defaultResult() const
|
||||
{
|
||||
auto allResults = existingResults();
|
||||
|
||||
if ( maxTimeStepCount() > 0 )
|
||||
{
|
||||
auto prefs = RiaPreferences::current();
|
||||
if ( prefs->loadAndShowSoil ) return RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() );
|
||||
|
||||
auto dynamicResult = std::find_if( allResults.begin(),
|
||||
allResults.end(),
|
||||
[]( const RigEclipseResultAddress& adr )
|
||||
{ return adr.resultCatType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE; } );
|
||||
|
||||
if ( dynamicResult != allResults.end() ) return *dynamicResult;
|
||||
}
|
||||
|
||||
// If any input property exists, use that
|
||||
auto inputProperty = std::find_if( allResults.begin(),
|
||||
allResults.end(),
|
||||
[]( const RigEclipseResultAddress& adr )
|
||||
{ return adr.resultCatType() == RiaDefines::ResultCatType::INPUT_PROPERTY; } );
|
||||
|
||||
if ( inputProperty != allResults.end() ) return *inputProperty;
|
||||
|
||||
// If any static property exists, use that
|
||||
auto staticResult = std::find_if( allResults.begin(),
|
||||
allResults.end(),
|
||||
[]( const RigEclipseResultAddress& adr )
|
||||
{ return adr.resultCatType() == RiaDefines::ResultCatType::STATIC_NATIVE; } );
|
||||
|
||||
if ( staticResult != allResults.end() ) return *staticResult;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -882,6 +922,7 @@ void RigCaseCellResultsData::setRemovedTagOnGeneratedResult( const RigEclipseRes
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
{
|
||||
bool needsToBeStored = false;
|
||||
// SOIL
|
||||
{
|
||||
if ( !hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ) )
|
||||
@@ -891,7 +932,7 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
{
|
||||
size_t soilIndex = findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
RiaResultNames::soil() ),
|
||||
false );
|
||||
needsToBeStored );
|
||||
this->setMustBeCalculated( soilIndex );
|
||||
}
|
||||
}
|
||||
@@ -904,7 +945,7 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
RiaResultNames::riOilVolumeResultName() ),
|
||||
false );
|
||||
needsToBeStored );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,18 +953,18 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
RiaResultNames::completionTypeResultName() ),
|
||||
false );
|
||||
needsToBeStored );
|
||||
}
|
||||
|
||||
// Fault results
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::ALLAN_DIAGRAMS,
|
||||
RiaResultNames::formationBinaryAllanResultName() ),
|
||||
false );
|
||||
needsToBeStored );
|
||||
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::ALLAN_DIAGRAMS,
|
||||
RiaResultNames::formationAllanResultName() ),
|
||||
false );
|
||||
needsToBeStored );
|
||||
}
|
||||
|
||||
// FLUX
|
||||
@@ -934,7 +975,7 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
RiaResultNames::combinedWaterFluxResultName() ),
|
||||
false );
|
||||
needsToBeStored );
|
||||
}
|
||||
|
||||
if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "FLROILI+" ) ) &&
|
||||
@@ -943,7 +984,7 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
RiaResultNames::combinedOilFluxResultName() ),
|
||||
false );
|
||||
needsToBeStored );
|
||||
}
|
||||
|
||||
if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "FLRGASI+" ) ) &&
|
||||
@@ -952,7 +993,7 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
RiaResultNames::combinedGasFluxResultName() ),
|
||||
false );
|
||||
needsToBeStored );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -960,7 +1001,10 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
{
|
||||
if ( hasCompleteTransmissibilityResults() )
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::combinedTransmissibilityResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
RiaResultNames::combinedTransmissibilityResultName(),
|
||||
needsToBeStored,
|
||||
0 );
|
||||
}
|
||||
}
|
||||
// MULTXYZ
|
||||
@@ -972,7 +1016,7 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "MULTZ" ) ) &&
|
||||
hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "MULTZ-" ) ) )
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::combinedMultResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::combinedMultResultName(), needsToBeStored, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -982,10 +1026,10 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PERMY" ) ) &&
|
||||
hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PERMZ" ) ) )
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riTranXResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riTranYResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riTranZResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::combinedRiTranResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riTranXResultName(), needsToBeStored, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riTranYResultName(), needsToBeStored, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riTranZResultName(), needsToBeStored, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::combinedRiTranResultName(), needsToBeStored, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -996,10 +1040,10 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riTranYResultName() ) ) &&
|
||||
hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riTranZResultName() ) ) )
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riMultXResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riMultYResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riMultZResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::combinedRiMultResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riMultXResultName(), needsToBeStored, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riMultYResultName(), needsToBeStored, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riMultZResultName(), needsToBeStored, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::combinedRiMultResultName(), needsToBeStored, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1007,54 +1051,54 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
{
|
||||
if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "TRANX" ) ) )
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riAreaNormTranXResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riAreaNormTranXResultName(), needsToBeStored, 0 );
|
||||
}
|
||||
|
||||
if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "TRANY" ) ) )
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riAreaNormTranYResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riAreaNormTranYResultName(), needsToBeStored, 0 );
|
||||
}
|
||||
|
||||
if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "TRANZ" ) ) )
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riAreaNormTranZResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riAreaNormTranZResultName(), needsToBeStored, 0 );
|
||||
}
|
||||
}
|
||||
// riTRANSXYZbyArea
|
||||
{
|
||||
if ( hasCompleteTransmissibilityResults() )
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::combinedRiAreaNormTranResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
RiaResultNames::combinedRiAreaNormTranResultName(),
|
||||
needsToBeStored,
|
||||
0 );
|
||||
}
|
||||
}
|
||||
|
||||
// Cell Volume
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riCellVolumeResultName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riCellVolumeResultName(), needsToBeStored, 0 );
|
||||
}
|
||||
|
||||
// Mobile Pore Volume
|
||||
{
|
||||
if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORV" ) ) )
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::mobilePoreVolumeName(), false, 0 );
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::mobilePoreVolumeName(), needsToBeStored, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
// I/J/K indexes
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexIResultName() ),
|
||||
false );
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexJResultName() ),
|
||||
false );
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexKResultName() ),
|
||||
false );
|
||||
findOrCreateScalarResultIndex( RiaResultNames::staticIntegerAddress( RiaResultNames::indexIResultName() ), needsToBeStored );
|
||||
findOrCreateScalarResultIndex( RiaResultNames::staticIntegerAddress( RiaResultNames::indexJResultName() ), needsToBeStored );
|
||||
findOrCreateScalarResultIndex( RiaResultNames::staticIntegerAddress( RiaResultNames::indexKResultName() ), needsToBeStored );
|
||||
}
|
||||
|
||||
// Fault distance
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::faultDistanceName() ),
|
||||
false );
|
||||
needsToBeStored );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -147,6 +147,8 @@ public:
|
||||
|
||||
size_t addStaticScalarResult( RiaDefines::ResultCatType type, const QString& resultName, bool needsToBeStored, size_t resultValueCount );
|
||||
|
||||
RigEclipseResultAddress defaultResult() const;
|
||||
|
||||
private:
|
||||
size_t findOrLoadKnownScalarResult( const RigEclipseResultAddress& resVarAddr );
|
||||
size_t findOrLoadKnownScalarResultByResultTypeOrder( const RigEclipseResultAddress& resVarAddr,
|
||||
|
||||
@@ -27,6 +27,7 @@ class RigEclipseResultAddress
|
||||
public:
|
||||
RigEclipseResultAddress()
|
||||
: m_resultCatType( RiaDefines::ResultCatType::UNDEFINED )
|
||||
, m_resultDataType( RiaDefines::ResultDataType::UNKNOWN )
|
||||
, m_timeLapseBaseFrameIdx( NO_TIME_LAPSE )
|
||||
, m_differenceCaseId( NO_CASE_DIFF )
|
||||
, m_divideByCellFaceArea( false )
|
||||
@@ -35,6 +36,7 @@ public:
|
||||
|
||||
explicit RigEclipseResultAddress( const QString& resultName )
|
||||
: m_resultCatType( RiaDefines::ResultCatType::UNDEFINED )
|
||||
, m_resultDataType( RiaDefines::ResultDataType::UNKNOWN )
|
||||
, m_resultName( resultName )
|
||||
, m_timeLapseBaseFrameIdx( NO_TIME_LAPSE )
|
||||
, m_differenceCaseId( NO_CASE_DIFF )
|
||||
@@ -48,12 +50,22 @@ public:
|
||||
int differenceCaseId = NO_CASE_DIFF,
|
||||
bool divideByCellFaceArea = false )
|
||||
: m_resultCatType( type )
|
||||
, m_resultDataType( RiaDefines::ResultDataType::UNKNOWN )
|
||||
, m_resultName( resultName )
|
||||
, m_timeLapseBaseFrameIdx( timeLapseBaseTimeStep )
|
||||
, m_differenceCaseId( differenceCaseId )
|
||||
, m_divideByCellFaceArea( divideByCellFaceArea )
|
||||
{
|
||||
}
|
||||
|
||||
explicit RigEclipseResultAddress( RiaDefines::ResultCatType type, RiaDefines::ResultDataType dataType, const QString& resultName )
|
||||
: m_resultCatType( type )
|
||||
, m_resultDataType( dataType )
|
||||
, m_resultName( resultName )
|
||||
, m_timeLapseBaseFrameIdx( NO_TIME_LAPSE )
|
||||
, m_differenceCaseId( NO_CASE_DIFF )
|
||||
, m_divideByCellFaceArea( false )
|
||||
{
|
||||
enableDivideByCellFaceArea( divideByCellFaceArea );
|
||||
}
|
||||
|
||||
bool isValid() const
|
||||
@@ -68,6 +80,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void setDataType( RiaDefines::ResultDataType dataType ) { m_resultDataType = dataType; }
|
||||
RiaDefines::ResultDataType dataType() const { return m_resultDataType; }
|
||||
|
||||
// Delta Time Step
|
||||
bool isDeltaTimeStepActive() const { return m_timeLapseBaseFrameIdx > NO_TIME_LAPSE; }
|
||||
void setDeltaTimeStepIndex( int timeStepIndex ) { m_timeLapseBaseFrameIdx = timeStepIndex; }
|
||||
@@ -131,11 +146,12 @@ public:
|
||||
void setResultCatType( RiaDefines::ResultCatType catType ) { m_resultCatType = catType; }
|
||||
|
||||
private:
|
||||
int m_timeLapseBaseFrameIdx;
|
||||
int m_differenceCaseId;
|
||||
bool m_divideByCellFaceArea;
|
||||
RiaDefines::ResultCatType m_resultCatType;
|
||||
QString m_resultName;
|
||||
RiaDefines::ResultCatType m_resultCatType;
|
||||
RiaDefines::ResultDataType m_resultDataType;
|
||||
QString m_resultName;
|
||||
int m_timeLapseBaseFrameIdx;
|
||||
int m_differenceCaseId;
|
||||
bool m_divideByCellFaceArea;
|
||||
|
||||
static const int ALL_TIME_LAPSES = -2;
|
||||
static const int NO_TIME_LAPSE = -1;
|
||||
|
||||
Reference in New Issue
Block a user