Refactor result definition

This commit is contained in:
Magne Sjaastad
2023-05-11 08:37:58 +02:00
committed by GitHub
parent 02ec71955b
commit 5ee764af48
66 changed files with 1045 additions and 822 deletions

View File

@@ -19,6 +19,7 @@
#include "RiaCompletionTypeCalculationScheduler.h"
#include "RiaApplication.h"
#include "RiaResultNames.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"

View File

@@ -28,6 +28,8 @@
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseCellColors.h"

View File

@@ -24,6 +24,7 @@
#include "RiaLogging.h"
#include "RiaQDateTimeTools.h"
#include "RiaSummaryTools.h"
#include "RigEclipseResultAddress.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultCase.h"

View File

@@ -40,6 +40,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigMainGrid.h"
#include "RigPerforationTransmissibilityEquations.h"
#include "RigResultAccessorFactory.h"

View File

@@ -19,8 +19,10 @@
#include "RicEclipseCellResultToFileImpl.h"
#include "RiaLogging.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigMainGrid.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"

View File

@@ -25,6 +25,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigMainGrid.h"
#include "RimEclipseResultDefinition.h"

View File

@@ -110,10 +110,10 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells( Rim
switch ( tracerStatus )
{
case RimFlowDiagSolution::TracerStatusType::PRODUCER:
viewToModify->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FLOW_TR_INJECTORS );
viewToModify->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_INJECTORS );
break;
case RimFlowDiagSolution::TracerStatusType::INJECTOR:
viewToModify->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FLOW_TR_PRODUCERS );
viewToModify->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_PRODUCERS );
break;
default:

View File

@@ -21,6 +21,7 @@
#include "RiaApplication.h"
#include "RiaDefines.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"

View File

@@ -35,6 +35,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigFault.h"
#include "RigMainGrid.h"

View File

@@ -27,6 +27,7 @@
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigMainGrid.h"
#include "RimEclipseInputProperty.h"

View File

@@ -24,6 +24,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigMainGrid.h"
#include "RimColorLegendCollection.h"

View File

@@ -144,7 +144,7 @@ void RigFemPartResultCalculatorGamma::calculateGammaFromFrames( int
int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodResIdx );
float por = inf;
if ( nodeIdx < srcPORFrameData.size() ) por = srcPORFrameData[nodeIdx];
if ( nodeIdx < static_cast<int>( srcPORFrameData.size() ) ) por = srcPORFrameData[nodeIdx];
if ( por == inf || fabs( por ) < 0.01e6 * 1.0e-5 )
dstFrameData[elmNodResIdx] = inf;

View File

@@ -108,7 +108,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorNormalST::calculate( int par
const size_t elmNodResIdx = femPart->elementNodeResultIdx( elmIdx, elmNodIdx );
const int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodResIdx );
float por = 0.0f;
if ( nodeIdx < srcPORFrameData.size() )
if ( nodeIdx < static_cast<int>( srcPORFrameData.size() ) )
{
por = srcPORFrameData[nodeIdx];
if ( por == inf ) por = 0.0f;

View File

@@ -18,7 +18,8 @@
#include "RivIntersectionResultsColoringTools.h"
#include "RiuGeoMechXfTensorResultAccessor.h"
#include "RiaOffshoreSphericalCoords.h"
#include "RiaResultNames.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
@@ -42,7 +43,7 @@
#include "RivScalarMapperUtils.h"
#include "RivTernaryTextureCoordsCreator.h"
#include "RiaOffshoreSphericalCoords.h"
#include "RiuGeoMechXfTensorResultAccessor.h"
#include "cvfGeometryTools.h"
#include "cvfStructGridGeometryGenerator.h"

View File

@@ -23,6 +23,7 @@
#include "RiaPreferences.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"
#include "RigResultAccessor.h"

View File

@@ -19,6 +19,7 @@
#include "RivReservoirFaultsPartMgr.h"
#include "RigEclipseResultAddress.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"

View File

@@ -19,8 +19,11 @@
#include "RivTernaryTextureCoordsCreator.h"
#include "RiaResultNames.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigPipeInCellEvaluator.h"
#include "RigResultAccessorFactory.h"
#include "RigTernaryResultAccessor.h"

View File

@@ -130,6 +130,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.h
${CMAKE_CURRENT_LIST_DIR}/RimMultipleEclipseResults.h
${CMAKE_CURRENT_LIST_DIR}/RimPressureDepthData.h
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultDefinitionTools.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -259,6 +260,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMultipleEclipseResults.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPressureDepthData.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultDefinitionTools.cpp
)
if(RESINSIGHT_USE_QT_CHARTS)

View File

@@ -26,6 +26,7 @@
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigFlowDiagResults.h"
#include "RigFormationNames.h"

View File

@@ -20,6 +20,8 @@
#include "RimEclipsePropertyFilterCollection.h"
#include "RiaResultNames.h"
#include "RimEclipseCellColors.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipseResultDefinition.h"

View File

@@ -542,7 +542,8 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
{
view->faultCollection()->showFaultCollection = false;
view->cellResult()->setResultType( RiaDefines::ResultCatType::FLOW_DIAGNOSTICS );
view->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FLOW_TR_BY_SELECTION );
view->cellResult()->setFlowDiagTracerSelectionType(
RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_BY_SELECTION );
view->cellResult()->setSelectedTracers( m_selectedTracerNames );
if ( m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION )

View File

@@ -116,6 +116,14 @@ RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
return m_flowDiagResults.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults() const
{
return m_flowDiagResults.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -40,6 +40,7 @@ public:
QString userDescription() const;
RigFlowDiagResults* flowDiagResults();
const RigFlowDiagResults* flowDiagResults() const;
std::vector<QString> tracerNames() const;
std::map<std::string, std::vector<int>> allInjectorTracerActiveCellIndices( size_t timeStepIndex ) const;

View File

@@ -29,20 +29,19 @@ bool RimFlowDiagnosticsTools::TracerComp::operator()( const QString& lhs, const
{
return true;
}
else if ( lhs.endsWith( "-XF" ) && !rhs.endsWith( "-XF" ) )
if ( lhs.endsWith( "-XF" ) && !rhs.endsWith( "-XF" ) )
{
return false;
}
else
{
return lhs < rhs;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimFlowDiagnosticsTools::calcOptionsForSelectedTracerField( RimFlowDiagSolution* flowSol, bool isInjector )
QList<caf::PdmOptionItemInfo> RimFlowDiagnosticsTools::calcOptionsForSelectedTracerField( FDS* flowSol, bool isInjector )
{
if ( !flowSol ) return {};
@@ -51,12 +50,12 @@ QList<caf::PdmOptionItemInfo> RimFlowDiagnosticsTools::calcOptionsForSelectedTra
for ( const QString& tracerName : sortedTracers )
{
QString postfix;
RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatusOverall( tracerName );
if ( status == RimFlowDiagSolution::TracerStatusType::VARYING )
FDS::TracerStatusType status = flowSol->tracerStatusOverall( tracerName );
if ( status == FDS::TracerStatusType::VARYING )
{
postfix = " [I/P]";
}
else if ( status == RimFlowDiagSolution::TracerStatusType::UNDEFINED )
else if ( status == FDS::TracerStatusType::UNDEFINED )
{
postfix = " [U]";
}
@@ -68,8 +67,7 @@ QList<caf::PdmOptionItemInfo> RimFlowDiagnosticsTools::calcOptionsForSelectedTra
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<QString, RimFlowDiagnosticsTools::TracerComp> RimFlowDiagnosticsTools::setOfTracersOfType( RimFlowDiagSolution* flowSol,
bool isInjector )
std::set<QString, RimFlowDiagnosticsTools::TracerComp> RimFlowDiagnosticsTools::setOfTracersOfType( const FDS* flowSol, bool isInjector )
{
if ( !flowSol ) return {};
@@ -77,11 +75,10 @@ std::set<QString, RimFlowDiagnosticsTools::TracerComp> RimFlowDiagnosticsTools::
std::vector<QString> tracerNames = flowSol->tracerNames();
for ( const QString& tracerName : tracerNames )
{
RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatusOverall( tracerName );
bool includeTracer = status == RimFlowDiagSolution::TracerStatusType::VARYING ||
status == RimFlowDiagSolution::TracerStatusType::UNDEFINED;
includeTracer |= isInjector && status == RimFlowDiagSolution::TracerStatusType::INJECTOR;
includeTracer |= !isInjector && status == RimFlowDiagSolution::TracerStatusType::PRODUCER;
FDS::TracerStatusType status = flowSol->tracerStatusOverall( tracerName );
bool includeTracer = status == FDS::TracerStatusType::VARYING || status == FDS::TracerStatusType::UNDEFINED;
includeTracer |= isInjector && status == FDS::TracerStatusType::INJECTOR;
includeTracer |= !isInjector && status == FDS::TracerStatusType::PRODUCER;
if ( includeTracer )
{
@@ -94,25 +91,23 @@ std::set<QString, RimFlowDiagnosticsTools::TracerComp> RimFlowDiagnosticsTools::
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimFlowDiagnosticsTools::producerTracersInTimeStep( RimFlowDiagSolution* flowSol, int timeStepIndex )
std::vector<QString> RimFlowDiagnosticsTools::producerTracersInTimeStep( const FDS* flowSol, int timeStepIndex )
{
return tracersOfStatusInTimeStep( flowSol, RimFlowDiagSolution::TracerStatusType::PRODUCER, timeStepIndex );
return tracersOfStatusInTimeStep( flowSol, FDS::TracerStatusType::PRODUCER, timeStepIndex );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimFlowDiagnosticsTools::injectorTracersInTimeStep( RimFlowDiagSolution* flowSol, int timeStepIndex )
std::vector<QString> RimFlowDiagnosticsTools::injectorTracersInTimeStep( const FDS* flowSol, int timeStepIndex )
{
return tracersOfStatusInTimeStep( flowSol, RimFlowDiagSolution::TracerStatusType::INJECTOR, timeStepIndex );
return tracersOfStatusInTimeStep( flowSol, FDS::TracerStatusType::INJECTOR, timeStepIndex );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimFlowDiagnosticsTools::tracersOfStatusInTimeStep( RimFlowDiagSolution* flowSol,
RimFlowDiagSolution::TracerStatusType status,
int timeStepIndex )
std::vector<QString> RimFlowDiagnosticsTools::tracersOfStatusInTimeStep( const FDS* flowSol, FDS::TracerStatusType status, int timeStepIndex )
{
if ( !flowSol || timeStepIndex < 0 ) return {};
@@ -131,7 +126,7 @@ std::vector<QString> RimFlowDiagnosticsTools::tracersOfStatusInTimeStep( RimFlow
///
//--------------------------------------------------------------------------------------------------
std::set<QString, RimFlowDiagnosticsTools::TracerComp>
RimFlowDiagnosticsTools::setOfInjectorTracersFromProducers( RimFlowDiagSolution* flowSol,
RimFlowDiagnosticsTools::setOfInjectorTracersFromProducers( FDS* flowSol,
const std::vector<QString>& producerTracers,
std::vector<int> timeStepIndices )
{
@@ -164,9 +159,7 @@ std::set<QString, RimFlowDiagnosticsTools::TracerComp>
///
//--------------------------------------------------------------------------------------------------
std::set<QString, RimFlowDiagnosticsTools::TracerComp>
RimFlowDiagnosticsTools::setOfInjectorTracersFromProducers( RimFlowDiagSolution* flowSol,
const std::vector<QString>& producerTracers,
int timeStepIndex )
RimFlowDiagnosticsTools::setOfInjectorTracersFromProducers( FDS* flowSol, const std::vector<QString>& producerTracers, int timeStepIndex )
{
if ( timeStepIndex < 0 ) return {};
@@ -178,7 +171,7 @@ std::set<QString, RimFlowDiagnosticsTools::TracerComp>
///
//--------------------------------------------------------------------------------------------------
std::set<QString, RimFlowDiagnosticsTools::TracerComp>
RimFlowDiagnosticsTools::setOfProducerTracersFromInjectors( RimFlowDiagSolution* flowSol,
RimFlowDiagnosticsTools::setOfProducerTracersFromInjectors( FDS* flowSol,
const std::vector<QString>& injectorTracers,
std::vector<int> timeStepIndices )
{
@@ -211,9 +204,7 @@ std::set<QString, RimFlowDiagnosticsTools::TracerComp>
///
//--------------------------------------------------------------------------------------------------
std::set<QString, RimFlowDiagnosticsTools::TracerComp>
RimFlowDiagnosticsTools::setOfProducerTracersFromInjectors( RimFlowDiagSolution* flowSol,
const std::vector<QString>& injectorTracers,
int timeStepIndex )
RimFlowDiagnosticsTools::setOfProducerTracersFromInjectors( FDS* flowSol, const std::vector<QString>& injectorTracers, int timeStepIndex )
{
if ( timeStepIndex < 0 ) return {};

View File

@@ -30,32 +30,30 @@
//==================================================================================================
namespace RimFlowDiagnosticsTools
{
// --- Structures ---
struct TracerComp
{
bool operator()( const QString& lhs, const QString& rhs ) const;
};
// --- Methods ---
QList<caf::PdmOptionItemInfo> calcOptionsForSelectedTracerField( RimFlowDiagSolution* flowSol, bool isInjector );
std::set<QString, TracerComp> setOfTracersOfType( RimFlowDiagSolution* flowSol, bool isInjector );
using FDS = RimFlowDiagSolution;
std::vector<QString> producerTracersInTimeStep( RimFlowDiagSolution* flowSol, int timeStepIndex );
std::vector<QString> injectorTracersInTimeStep( RimFlowDiagSolution* flowSol, int timeStepIndex );
std::vector<QString> tracersOfStatusInTimeStep( RimFlowDiagSolution* flowSol, RimFlowDiagSolution::TracerStatusType status, int timeStepIndex );
QList<caf::PdmOptionItemInfo> calcOptionsForSelectedTracerField( FDS* flowSol, bool isInjector );
std::set<QString, TracerComp> setOfTracersOfType( const FDS* flowSol, bool isInjector );
std::set<QString, RimFlowDiagnosticsTools::TracerComp> setOfInjectorTracersFromProducers( RimFlowDiagSolution* flowSol,
const std::vector<QString>& producerTracers,
std::vector<int> timeStepIndices );
std::vector<QString> producerTracersInTimeStep( const FDS* flowSol, int timeStepIndex );
std::vector<QString> injectorTracersInTimeStep( const FDS* flowSol, int timeStepIndex );
std::vector<QString> tracersOfStatusInTimeStep( const FDS* flowSol, FDS::TracerStatusType status, int timeStepIndex );
std::set<QString, RimFlowDiagnosticsTools::TracerComp>
setOfInjectorTracersFromProducers( RimFlowDiagSolution* flowSol, const std::vector<QString>& producerTracers, int timeStepIndex );
std::set<QString, RimFlowDiagnosticsTools::TracerComp> setOfProducerTracersFromInjectors( RimFlowDiagSolution* flowSol,
const std::vector<QString>& injectorTracers,
std::vector<int> timeStepIndices );
setOfInjectorTracersFromProducers( FDS* flowSol, const std::vector<QString>& producerTracers, std::vector<int> timeStepIndices );
std::set<QString, RimFlowDiagnosticsTools::TracerComp>
setOfProducerTracersFromInjectors( RimFlowDiagSolution* flowSol, const std::vector<QString>& injectorTracers, int timeStepIndex );
setOfInjectorTracersFromProducers( FDS* flowSol, const std::vector<QString>& producerTracers, int timeStepIndex );
std::set<QString, RimFlowDiagnosticsTools::TracerComp>
setOfProducerTracersFromInjectors( FDS* flowSol, const std::vector<QString>& injectorTracers, std::vector<int> timeStepIndices );
std::set<QString, RimFlowDiagnosticsTools::TracerComp>
setOfProducerTracersFromInjectors( FDS* flowSol, const std::vector<QString>& injectorTracers, int timeStepIndex );
}; // namespace RimFlowDiagnosticsTools

View File

@@ -25,6 +25,7 @@
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigSimWellData.h"
#include "RimEclipseCase.h"

View File

@@ -21,6 +21,8 @@
#include "RiaLogging.h"
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"

View File

@@ -26,8 +26,10 @@
#include "RigActiveCellInfo.h"
#include "RigActiveCellsResultAccessor.h"
#include "RigCaseCellResultCalculator.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseCrossPlotDataExtractor.h"
#include "RigEclipseResultAddress.h"
#include "RigFormationNames.h"
#include "RigMainGrid.h"

View File

@@ -23,6 +23,7 @@
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigEquil.h"
#include "RimEclipseResultCase.h"

View File

@@ -18,6 +18,9 @@
#include "RimIntersectionResultDefinition.h"
#include "RiaResultNames.h"
#include "RigCaseCellResultsData.h"
#include "Rim2dIntersectionView.h"
#include "RimCase.h"
#include "RimEclipseCase.h"

View File

@@ -20,6 +20,9 @@
#pragma once
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "cafAppEnum.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
@@ -27,8 +30,6 @@
#include <array>
#include "RigCaseCellResultsData.h"
class RigCaseCellResultsData;
class RimEclipseCase;
class RimEclipseCellColors;

View File

@@ -64,7 +64,7 @@ void RimColorLegendCollection::appendCustomColorLegend( RimColorLegend* colorLeg
//--------------------------------------------------------------------------------------------------
bool RimColorLegendCollection::isStandardColorLegend( RimColorLegend* legend )
{
for ( auto standardLegend : m_standardColorLegends )
for ( const auto& standardLegend : m_standardColorLegends )
{
if ( legend == standardLegend ) return true;
}
@@ -135,7 +135,7 @@ void RimColorLegendCollection::setDefaultColorLegendForResult( int caseId, const
//--------------------------------------------------------------------------------------------------
void RimColorLegendCollection::createStandardColorLegends()
{
typedef caf::AppEnum<RimRegularLegendConfig::ColorRangesType> ColorRangeEnum;
using ColorRangeEnum = caf::AppEnum<RimRegularLegendConfig::ColorRangesType>;
for ( size_t typeIdx = 0; typeIdx < ColorRangeEnum::size(); typeIdx++ )
{
@@ -158,14 +158,17 @@ void RimColorLegendCollection::createStandardColorLegends()
}
}
RimColorLegend* colorLegend = new RimColorLegend;
auto* colorLegend = new RimColorLegend;
colorLegend->setColorLegendName( legendName );
for ( size_t i = 0; i < colorArray.size(); i++ )
{
cvf::Color3f color3f( colorArray[i] );
RimColorLegendItem* colorLegendItem = new RimColorLegendItem;
auto* colorLegendItem = new RimColorLegendItem;
// Set empty text for color legend items
// The text defined is used in RimEclipseResultDefinitionTools::updateCellResultLegend()
colorLegendItem->setValues( "", static_cast<int>( i ), color3f );
colorLegend->appendColorLegendItem( colorLegendItem );
@@ -241,7 +244,7 @@ RimColorLegend* RimColorLegendCollection::findDefaultLegendForResult( int caseId
//--------------------------------------------------------------------------------------------------
RimColorLegendItem* RimColorLegendCollection::createColorLegendItem( const QString& name, int r, int g, int b ) const
{
RimColorLegendItem* item = new RimColorLegendItem;
auto* item = new RimColorLegendItem;
item->setValues( name, 0, cvf::Color3f::fromByteColor( r, g, b ) );
return item;
}
@@ -251,7 +254,7 @@ RimColorLegendItem* RimColorLegendCollection::createColorLegendItem( const QStri
//--------------------------------------------------------------------------------------------------
RimColorLegend* RimColorLegendCollection::createRockTypeColorLegend() const
{
RimColorLegend* colorLegend = new RimColorLegend;
auto* colorLegend = new RimColorLegend;
colorLegend->setColorLegendName( RiaDefines::rockTypeColorLegendName() );
// Rock types colors taken from "Equinor GeoStandard - May 2020" document.
@@ -325,7 +328,7 @@ QString RimColorLegendCollection::createLookupKey( int caseId, const QString& re
//--------------------------------------------------------------------------------------------------
void RimColorLegendCollection::initAfterRead()
{
for ( auto legend : m_customColorLegends )
for ( const auto& legend : m_customColorLegends )
{
legend->addReorderCapability();
}

View File

@@ -680,7 +680,7 @@ RimEclipseContourMapViewCollection* RimEclipseCase::contourMapCollection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseInputPropertyCollection* RimEclipseCase::inputPropertyCollection()
RimEclipseInputPropertyCollection* RimEclipseCase::inputPropertyCollection() const
{
return m_inputPropertyCollection();
}

View File

@@ -100,7 +100,7 @@ public:
RimCaseCollection* parentCaseCollection();
RimEclipseContourMapViewCollection* contourMapCollection();
RimEclipseInputPropertyCollection* inputPropertyCollection();
RimEclipseInputPropertyCollection* inputPropertyCollection() const;
QStringList timeStepStrings() const override;
QString timeStepName( int frameIdx ) const override;

View File

@@ -27,6 +27,7 @@
#include "RigCell.h"
#include "RigCellGeometryTools.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigHexIntersectionTools.h"
#include "RigMainGrid.h"

View File

@@ -25,6 +25,7 @@
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaRegressionTestRunner.h"
#include "RiaResultNames.h"
#include "RicfCommandObject.h"

View File

@@ -20,39 +20,31 @@
#include "RimEclipseResultDefinition.h"
#include "RiaColorTables.h"
#include "RiaColorTools.h"
#include "RiaLogging.h"
#include "RiaNncDefines.h"
#include "RiaQDateTimeTools.h"
#include "RicfCommandObject.h"
#include "RigActiveCellInfo.h"
#include "RigAllanDiagramData.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultInfo.h"
#include "RigFlowDiagResultAddress.h"
#include "RigFlowDiagResults.h"
#include "RigFormationNames.h"
#include "RigVisibleCategoriesCalculator.h"
#include "Rim3dView.h"
#include "Rim3dWellLogCurve.h"
#include "RimCellEdgeColors.h"
#include "RimColorLegend.h"
#include "RimColorLegendItem.h"
#include "RimContourMapProjection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseContourMapProjection.h"
#include "RimEclipseContourMapView.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipseInputProperty.h"
#include "RimEclipseInputPropertyCollection.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseResultDefinitionTools.h"
#include "RimEclipseView.h"
#include "RimFlowDiagSolution.h"
#include "RimFlowDiagnosticsTools.h"
@@ -65,9 +57,6 @@
#include "RimProject.h"
#include "RimRegularLegendConfig.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimSimWellInView.h"
#include "RimSimWellInViewCollection.h"
#include "RimTernaryLegendConfig.h"
#include "RimViewLinker.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogTrack.h"
@@ -76,7 +65,6 @@
#include "RimGridStatisticsPlot.h"
#endif
#include "cafCategoryMapper.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiToolButtonEditor.h"
@@ -90,12 +78,12 @@ namespace caf
template <>
void RimEclipseResultDefinition::FlowTracerSelectionEnum::setUp()
{
addItem( RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD, "FLOW_TR_INJ_AND_PROD", "All Injectors and Producers" );
addItem( RimEclipseResultDefinition::FLOW_TR_PRODUCERS, "FLOW_TR_PRODUCERS", "All Producers" );
addItem( RimEclipseResultDefinition::FLOW_TR_INJECTORS, "FLOW_TR_INJECTORS", "All Injectors" );
addItem( RimEclipseResultDefinition::FLOW_TR_BY_SELECTION, "FLOW_TR_BY_SELECTION", "By Selection" );
addItem( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD, "FLOW_TR_INJ_AND_PROD", "All Injectors and Producers" );
addItem( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_PRODUCERS, "FLOW_TR_PRODUCERS", "All Producers" );
addItem( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_INJECTORS, "FLOW_TR_INJECTORS", "All Injectors" );
addItem( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_BY_SELECTION, "FLOW_TR_BY_SELECTION", "By Selection" );
setDefault( RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD );
setDefault( RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD );
}
} // namespace caf
@@ -265,7 +253,8 @@ void RimEclipseResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* ch
// If the user are seeing the list with the actually selected result,
// select that result in the list. Otherwise select nothing.
QStringList varList = getResultNamesForResultType( m_resultTypeUiField(), this->currentGridCellResults() );
QStringList varList =
RimEclipseResultDefinitionTools::getResultNamesForResultType( m_resultTypeUiField(), this->currentGridCellResults() );
bool isFlowDiagFieldsRelevant = ( m_resultType() == RiaDefines::ResultCatType::FLOW_DIAGNOSTICS );
@@ -314,7 +303,7 @@ void RimEclipseResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* ch
}
else if ( m_resultTypeUiField() == RiaDefines::ResultCatType::INPUT_PROPERTY )
{
m_inputPropertyFileName = getInputPropertyFileName( newValue.toString() );
m_inputPropertyFileName = RimEclipseResultDefinitionTools::getInputPropertyFileName( eclipseCase(), newValue.toString() );
}
loadDataAndUpdate();
}
@@ -520,7 +509,7 @@ void RimEclipseResultDefinition::setTofAndSelectTracer( const QString& tracerNam
{
setResultType( RiaDefines::ResultCatType::FLOW_DIAGNOSTICS );
setResultVariable( "TOF" );
setFlowDiagTracerSelectionType( FLOW_TR_BY_SELECTION );
setFlowDiagTracerSelectionType( FlowTracerSelectionType::FLOW_TR_BY_SELECTION );
if ( m_flowSolution() == nullptr )
{
@@ -733,11 +722,17 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
{
if ( fieldNeedingOptions == &m_resultVariableUiField )
{
options.push_back( caf::PdmOptionItemInfo( timeOfFlightString( false ), RIG_FLD_TOF_RESNAME ) );
options.push_back( caf::PdmOptionItemInfo( RimEclipseResultDefinitionTools::timeOfFlightString( injectorSelectionState(),
producerSelectionState(),
false ),
RIG_FLD_TOF_RESNAME ) );
if ( m_phaseSelection() == RigFlowDiagResultAddress::PHASE_ALL )
{
options.push_back( caf::PdmOptionItemInfo( "Tracer Cell Fraction (Sum)", RIG_FLD_CELL_FRACTION_RESNAME ) );
options.push_back( caf::PdmOptionItemInfo( maxFractionTracerString( false ), RIG_FLD_MAX_FRACTION_TRACER_RESNAME ) );
options.push_back( caf::PdmOptionItemInfo( RimEclipseResultDefinitionTools::maxFractionTracerString( injectorSelectionState(),
producerSelectionState(),
false ),
RIG_FLD_MAX_FRACTION_TRACER_RESNAME ) );
options.push_back( caf::PdmOptionItemInfo( "Injector Producer Communication", RIG_FLD_COMMUNICATION_RESNAME ) );
}
}
@@ -949,7 +944,7 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
CVF_ASSERT( timeHistoryCurve == nullptr );
std::set<std::string> selTracerNames;
if ( m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION )
if ( m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_BY_SELECTION )
{
for ( const QString& tName : m_selectedInjectorTracers() )
{
@@ -967,7 +962,8 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
{
std::vector<QString> tracerNames = flowSol->tracerNames();
if ( m_flowTracerSelectionMode == FLOW_TR_INJECTORS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD )
if ( m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_INJECTORS ||
m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD )
{
for ( const QString& tracerName : tracerNames )
{
@@ -979,7 +975,8 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
}
}
if ( m_flowTracerSelectionMode == FLOW_TR_PRODUCERS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD )
if ( m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_PRODUCERS ||
m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD )
{
for ( const QString& tracerName : tracerNames )
{
@@ -1535,7 +1532,7 @@ void RimEclipseResultDefinition::defineUiOrdering( QString uiConfigName, caf::Pd
uiOrdering.add( &m_flowTracerSelectionMode );
if ( m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION )
if ( m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_BY_SELECTION )
{
caf::PdmUiGroup* selectionGroup = uiOrdering.addNewGroup( "Tracer Selection" );
selectionGroup->setEnableFrame( false );
@@ -1696,24 +1693,21 @@ QString RimEclipseResultDefinition::flowDiagResUiText( bool shortLabel, int maxT
QString uiText = QString::fromStdString( flowDiagResAddress().variableName );
if ( flowDiagResAddress().variableName == RIG_FLD_TOF_RESNAME )
{
uiText = timeOfFlightString( shortLabel );
uiText = RimEclipseResultDefinitionTools::timeOfFlightString( injectorSelectionState(), producerSelectionState(), shortLabel );
}
else if ( flowDiagResAddress().variableName == RIG_FLD_MAX_FRACTION_TRACER_RESNAME )
{
uiText = maxFractionTracerString( shortLabel );
uiText = RimEclipseResultDefinitionTools::maxFractionTracerString( injectorSelectionState(), producerSelectionState(), shortLabel );
}
QString tracersString = selectedTracersString();
QString tracersString = RimEclipseResultDefinitionTools::selectedTracersString( injectorSelectionState(),
producerSelectionState(),
m_selectedInjectorTracers(),
m_selectedProducerTracers(),
maxTracerStringLength );
if ( !tracersString.isEmpty() )
{
const QString postfix = "...";
if ( tracersString.size() > maxTracerStringLength + postfix.size() )
{
tracersString = tracersString.left( maxTracerStringLength );
tracersString += postfix;
}
uiText += QString( "\n%1" ).arg( tracersString );
}
return uiText;
@@ -1730,78 +1724,11 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
{
CVF_ASSERT( resultCatType != RiaDefines::ResultCatType::FLOW_DIAGNOSTICS && resultCatType != RiaDefines::ResultCatType::INJECTION_FLOODING );
if ( results )
{
QList<caf::PdmOptionItemInfo> optionList;
QStringList cellCenterResultNames;
QStringList cellFaceResultNames;
for ( const QString& s : getResultNamesForResultType( resultCatType, results ) )
{
if ( s == RiaResultNames::completionTypeResultName() )
{
if ( results->timeStepDates().empty() ) continue;
}
if ( RiaResultNames::isPerCellFaceResult( s ) )
{
cellFaceResultNames.push_back( s );
}
else
{
cellCenterResultNames.push_back( s );
}
}
cellCenterResultNames.sort();
cellFaceResultNames.sort();
// Cell Center result names
for ( const QString& s : cellCenterResultNames )
{
optionList.push_back( caf::PdmOptionItemInfo( s, s ) );
}
if ( addPerCellFaceOptionItems )
{
for ( const QString& s : cellFaceResultNames )
{
if ( showDerivedResultsFirst )
{
optionList.push_front( caf::PdmOptionItemInfo( s, s ) );
}
else
{
optionList.push_back( caf::PdmOptionItemInfo( s, s ) );
}
}
// Ternary Result
if ( ternaryEnabled )
{
bool hasAtLeastOneTernaryComponent = false;
if ( cellCenterResultNames.contains( RiaResultNames::soil() ) )
hasAtLeastOneTernaryComponent = true;
else if ( cellCenterResultNames.contains( RiaResultNames::sgas() ) )
hasAtLeastOneTernaryComponent = true;
else if ( cellCenterResultNames.contains( RiaResultNames::swat() ) )
hasAtLeastOneTernaryComponent = true;
if ( resultCatType == RiaDefines::ResultCatType::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent )
{
optionList.push_front( caf::PdmOptionItemInfo( RiaResultNames::ternarySaturationResultName(),
RiaResultNames::ternarySaturationResultName() ) );
}
}
}
optionList.push_front( caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), RiaResultNames::undefinedResultName() ) );
return optionList;
}
return QList<caf::PdmOptionItemInfo>();
return RimEclipseResultDefinitionTools::calcOptionsForVariableUiFieldStandard( resultCatType,
results,
showDerivedResultsFirst,
addPerCellFaceOptionItems,
ternaryEnabled );
}
//--------------------------------------------------------------------------------------------------
@@ -1812,35 +1739,6 @@ void RimEclipseResultDefinition::setTernaryEnabled( bool enabled )
m_ternaryEnabled = enabled;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool operator<( const cvf::Color3ub first, const cvf::Color3ub second )
{
if ( first.r() != second.r() ) return first.r() < second.r();
if ( first.g() != second.g() ) return first.g() < second.g();
if ( first.b() != second.b() ) return first.b() < second.b();
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class TupleCompare
{
public:
bool operator()( const std::tuple<QString, int, cvf::Color3ub>& t1, const std::tuple<QString, int, cvf::Color3ub>& t2 ) const
{
using namespace std;
if ( get<0>( t1 ) != get<0>( t2 ) ) return get<0>( t1 ) < get<0>( t2 );
if ( get<1>( t1 ) != get<1>( t2 ) ) return get<1>( t1 ) < get<1>( t2 );
if ( get<2>( t1 ) != get<2>( t2 ) ) return get<2>( t1 ) < get<2>( t2 );
return false;
}
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1849,386 +1747,24 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
int currentTimeStep )
{
RimEclipseCase* rimEclipseCase = this->eclipseCase();
if ( this->hasResult() )
{
if ( this->isFlowDiagOrInjectionFlooding() )
{
CVF_ASSERT( currentTimeStep >= 0 );
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
RigFlowDiagResults* flowResultsData = this->flowDiagSolution()->flowDiagResults();
RigFlowDiagResultAddress resAddr = this->flowDiagResAddress();
flowResultsData->minMaxScalarValues( resAddr, currentTimeStep, &globalMin, &globalMax );
flowResultsData->posNegClosestToZero( resAddr, currentTimeStep, &globalPosClosestToZero, &globalNegClosestToZero );
double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero;
if ( this->hasDynamicResult() )
if ( currentTimeStep >= 0 )
{
flowResultsData->minMaxScalarValues( resAddr, currentTimeStep, &localMin, &localMax );
flowResultsData->posNegClosestToZero( resAddr, currentTimeStep, &localPosClosestToZero, &localNegClosestToZero );
}
else
{
localMin = globalMin;
localMax = globalMax;
localPosClosestToZero = globalPosClosestToZero;
localNegClosestToZero = globalNegClosestToZero;
}
CVF_ASSERT( legendConfigToUpdate );
legendConfigToUpdate->disableAllTimeStepsRange( true );
legendConfigToUpdate->setClosestToZeroValues( globalPosClosestToZero,
globalNegClosestToZero,
localPosClosestToZero,
localNegClosestToZero );
legendConfigToUpdate->setAutomaticRanges( globalMin, globalMax, localMin, localMax );
if ( this->hasCategoryResult() )
{
RimEclipseView* eclView = nullptr;
this->firstAncestorOrThisOfType( eclView );
if ( eclView )
{
std::set<std::tuple<QString, int, cvf::Color3ub>, TupleCompare> categories;
std::vector<QString> tracerNames = this->flowDiagSolution()->tracerNames();
int tracerIndex = 0;
for ( const auto& tracerName : tracerNames )
{
cvf::Color3ub color( cvf::Color3::GRAY );
RimSimWellInView* well =
eclView->wellCollection()->findWell( RimFlowDiagSolution::removeCrossFlowEnding( tracerName ) );
if ( well ) color = cvf::Color3ub( well->wellPipeColor() );
categories.insert( std::make_tuple( tracerName, tracerIndex, color ) );
++tracerIndex;
}
std::vector<std::tuple<QString, int, cvf::Color3ub>> categoryVector;
if ( m_showOnlyVisibleCategoriesInLegend )
{
std::set<int> visibleTracers =
RigVisibleCategoriesCalculator::visibleFlowDiagCategories( *eclView, *flowResultsData, resAddr, currentTimeStep );
for ( auto tupIt : categories )
{
int tracerIndex = std::get<1>( tupIt );
if ( visibleTracers.count( tracerIndex ) ) categoryVector.push_back( tupIt );
RimEclipseResultDefinitionTools::updateLegendForFlowDiagnostics( this, legendConfigToUpdate, currentTimeStep );
}
}
else
{
for ( auto tupIt : categories )
RimEclipseResultDefinitionTools::updateCellResultLegend( this, legendConfigToUpdate, currentTimeStep );
}
}
if ( isTernarySaturationSelected() )
{
categoryVector.push_back( tupIt );
}
}
legendConfigToUpdate->setCategoryItems( categoryVector );
}
}
}
else
{
if ( !rimEclipseCase ) return;
RigEclipseCaseData* eclipseCaseData = rimEclipseCase->eclipseCaseData();
if ( !eclipseCaseData ) return;
RigCaseCellResultsData* cellResultsData = eclipseCaseData->results( this->porosityModel() );
cellResultsData->ensureKnownResultLoaded( this->eclipseResultAddress() );
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
cellResultsData->minMaxCellScalarValues( this->eclipseResultAddress(), globalMin, globalMax );
cellResultsData->posNegClosestToZero( this->eclipseResultAddress(), globalPosClosestToZero, globalNegClosestToZero );
double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero;
if ( this->hasDynamicResult() && currentTimeStep >= 0 )
{
cellResultsData->minMaxCellScalarValues( this->eclipseResultAddress(), currentTimeStep, localMin, localMax );
cellResultsData->posNegClosestToZero( this->eclipseResultAddress(), currentTimeStep, localPosClosestToZero, localNegClosestToZero );
}
else
{
localMin = globalMin;
localMax = globalMax;
localPosClosestToZero = globalPosClosestToZero;
localNegClosestToZero = globalNegClosestToZero;
}
CVF_ASSERT( legendConfigToUpdate );
legendConfigToUpdate->disableAllTimeStepsRange( false );
legendConfigToUpdate->setClosestToZeroValues( globalPosClosestToZero,
globalNegClosestToZero,
localPosClosestToZero,
localNegClosestToZero );
legendConfigToUpdate->setAutomaticRanges( globalMin, globalMax, localMin, localMax );
if ( this->hasCategoryResult() )
{
if ( this->resultType() == RiaDefines::ResultCatType::ALLAN_DIAGRAMS )
{
if ( this->resultVariable() == RiaResultNames::formationAllanResultName() )
{
const std::vector<QString> fnVector = eclipseCaseData->formationNames();
std::vector<int> fnameIdxes;
for ( int i = 0; i < static_cast<int>( fnVector.size() ); i++ )
{
fnameIdxes.push_back( i );
}
cvf::Color3ubArray legendBaseColors = legendConfigToUpdate->colorLegend()->colorArray();
cvf::ref<caf::CategoryMapper> formationColorMapper = new caf::CategoryMapper;
formationColorMapper->setCategories( fnameIdxes );
formationColorMapper->setInterpolateColors( legendBaseColors );
const std::map<std::pair<int, int>, int>& formationCombToCategory =
eclipseCaseData->allanDiagramData()->formationCombinationToCategory();
std::vector<std::tuple<QString, int, cvf::Color3ub>> categories;
for ( int frmNameIdx : fnameIdxes )
{
cvf::Color3ub formationColor = formationColorMapper->mapToColor( frmNameIdx );
categories.emplace_back( std::make_tuple( fnVector[frmNameIdx], frmNameIdx, formationColor ) );
}
std::set<size_t> visibleAllanCategories;
{
RimEclipseView* eclView = nullptr;
this->firstAncestorOrThisOfType( eclView );
visibleAllanCategories = RigVisibleCategoriesCalculator::visibleAllanCategories( eclView );
}
for ( auto [formationPair, categoryIndex] : formationCombToCategory )
{
int frmIdx1 = formationPair.first;
int frmIdx2 = formationPair.second;
if ( visibleAllanCategories.count( categoryIndex ) == 0 ) continue;
int fnVectorSize = static_cast<int>( fnVector.size() );
if ( frmIdx1 >= fnVectorSize || frmIdx2 >= fnVectorSize ) continue;
QString frmName1 = fnVector[frmIdx1];
QString frmName2 = fnVector[frmIdx2];
cvf::Color3f formationColor1 = cvf::Color3f( formationColorMapper->mapToColor( frmIdx1 ) );
cvf::Color3f formationColor2 = cvf::Color3f( formationColorMapper->mapToColor( frmIdx2 ) );
cvf::Color3ub blendColor = cvf::Color3ub( RiaColorTools::blendCvfColors( formationColor1, formationColor2 ) );
categories.emplace_back( std::make_tuple( frmName1 + "-" + frmName2, categoryIndex, blendColor ) );
}
legendConfigToUpdate->setCategoryItems( categories );
}
else if ( this->resultVariable() == RiaResultNames::formationBinaryAllanResultName() )
{
std::vector<std::tuple<QString, int, cvf::Color3ub>> categories;
categories.emplace_back( std::make_tuple( "Same formation", 0, cvf::Color3ub::BROWN ) );
categories.emplace_back( std::make_tuple( "Different formation", 1, cvf::Color3ub::ORANGE ) );
legendConfigToUpdate->setCategoryItems( categories );
}
}
else if ( this->resultType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE &&
this->resultVariable() == RiaResultNames::completionTypeResultName() )
{
const std::vector<int>& visibleCategories = cellResultsData->uniqueCellScalarValues( this->eclipseResultAddress() );
std::vector<RiaDefines::WellPathComponentType> supportedCompletionTypes = { RiaDefines::WellPathComponentType::WELL_PATH,
RiaDefines::WellPathComponentType::FISHBONES,
RiaDefines::WellPathComponentType::PERFORATION_INTERVAL,
RiaDefines::WellPathComponentType::FRACTURE };
RiaColorTables::WellPathComponentColors colors = RiaColorTables::wellPathComponentColors();
std::vector<std::tuple<QString, int, cvf::Color3ub>> categories;
for ( auto completionType : supportedCompletionTypes )
{
if ( std::find( visibleCategories.begin(), visibleCategories.end(), static_cast<int>( completionType ) ) !=
visibleCategories.end() )
{
QString categoryText = caf::AppEnum<RiaDefines::WellPathComponentType>::uiText( completionType );
categories.push_back( std::make_tuple( categoryText, static_cast<int>( completionType ), colors[completionType] ) );
}
}
legendConfigToUpdate->setCategoryItems( categories );
}
else
{
auto uniqueValues = cellResultsData->uniqueCellScalarValues( this->eclipseResultAddress() );
if ( this->eclipseResultAddress().resultCatType() == RiaDefines::ResultCatType::FORMATION_NAMES )
{
std::vector<QString> fnVector = eclipseCaseData->formationNames();
uniqueValues.resize( fnVector.size() );
std::iota( uniqueValues.begin(), uniqueValues.end(), 0 );
}
cvf::Color3ubArray legendBaseColors = legendConfigToUpdate->colorLegend()->colorArray();
cvf::ref<caf::CategoryMapper> categoryMapper = new caf::CategoryMapper;
categoryMapper->setCategories( uniqueValues );
categoryMapper->setInterpolateColors( legendBaseColors );
std::vector<int> visibleCategoryValues = uniqueValues;
if ( m_showOnlyVisibleCategoriesInLegend )
{
RimEclipseView* eclView = nullptr;
this->firstAncestorOrThisOfType( eclView );
if ( eclView && eclView->showWindow() )
{
// Check if current result is cell result, and update the visible set of values
// TODO: Can be extended to the separate geometry results (separate fault result, separate
// intersection results), but this requires some refactoring
if ( eclView->cellResult() == this )
{
std::set<int> visibleCategorySet = RigVisibleCategoriesCalculator::visibleCategories( eclView );
visibleCategoryValues.clear();
visibleCategoryValues.insert( visibleCategoryValues.begin(),
visibleCategorySet.begin(),
visibleCategorySet.end() );
}
}
}
std::vector<std::tuple<QString, int, cvf::Color3ub>> categoryVector;
for ( auto value : visibleCategoryValues )
{
cvf::Color3ub categoryColor = categoryMapper->mapToColor( value );
QString valueTxt;
if ( this->resultType() == RiaDefines::ResultCatType::FORMATION_NAMES )
{
std::vector<QString> fnVector = eclipseCaseData->formationNames();
if ( value < static_cast<int>( fnVector.size() ) )
{
valueTxt = fnVector[value];
}
}
else
{
auto items = legendConfigToUpdate->colorLegend()->colorLegendItems();
auto it = std::find_if( items.begin(),
items.end(),
[value]( const RimColorLegendItem* const item )
{ return item->categoryValue() == value; } );
if ( it != items.end() && !( *it )->categoryName().isEmpty() )
{
valueTxt = QString( "%1 (%2)" ).arg( ( *it )->categoryName() ).arg( value );
}
else
{
valueTxt = QString( "%1" ).arg( value );
}
}
categoryVector.push_back( std::make_tuple( valueTxt, value, categoryColor ) );
}
legendConfigToUpdate->setCategoryItems( categoryVector );
}
}
}
}
// Ternary legend update
{
if ( !rimEclipseCase ) return;
RigEclipseCaseData* eclipseCase = rimEclipseCase->eclipseCaseData();
if ( !eclipseCase ) return;
RigCaseCellResultsData* cellResultsData = eclipseCase->results( this->porosityModel() );
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();
if ( this->isTernarySaturationSelected() && maxTimeStepCount > 1 )
{
RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
{
RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() );
if ( gridCellResults->ensureKnownResultLoaded( resAddr ) )
{
double globalMin = 0.0;
double globalMax = 1.0;
double localMin = 0.0;
double localMax = 1.0;
cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax );
cellResultsData->minMaxCellScalarValues( resAddr, currentTimeStep, localMin, localMax );
ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SOIL_IDX,
globalMin,
globalMax,
localMin,
localMax );
}
}
{
RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() );
if ( gridCellResults->ensureKnownResultLoaded( resAddr ) )
{
double globalMin = 0.0;
double globalMax = 1.0;
double localMin = 0.0;
double localMax = 1.0;
cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax );
cellResultsData->minMaxCellScalarValues( resAddr, currentTimeStep, localMin, localMax );
ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SGAS_IDX,
globalMin,
globalMax,
localMin,
localMax );
}
}
{
RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() );
if ( gridCellResults->ensureKnownResultLoaded( resAddr ) )
{
double globalMin = 0.0;
double globalMax = 1.0;
double localMin = 0.0;
double localMax = 1.0;
cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax );
cellResultsData->minMaxCellScalarValues( resAddr, currentTimeStep, localMin, localMax );
ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SWAT_IDX,
globalMin,
globalMax,
localMin,
localMax );
}
}
}
RimEclipseResultDefinitionTools::updateTernaryLegend( currentGridCellResults(), ternaryLegendConfigToUpdate, currentTimeStep );
}
}
@@ -2256,202 +1792,33 @@ void RimEclipseResultDefinition::updateLegendTitle( RimRegularLegendConfig* lege
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::timeOfFlightString( bool shorter ) const
bool RimEclipseResultDefinition::showOnlyVisibleCategoriesInLegend() const
{
QString tofString;
bool multipleSelected = false;
if ( injectorSelectionState() != NONE_SELECTED && producerSelectionState() != NONE_SELECTED )
{
tofString = shorter ? "Res.Time" : "Residence Time";
multipleSelected = true;
}
else if ( injectorSelectionState() != NONE_SELECTED )
{
tofString = shorter ? "Fwd.TOF" : "Forward Time of Flight";
}
else if ( producerSelectionState() != NONE_SELECTED )
{
tofString = shorter ? "Rev.TOF" : "Reverse Time of Flight";
}
else
{
tofString = shorter ? "TOF" : "Time of Flight";
}
multipleSelected = multipleSelected || injectorSelectionState() >= MULTIPLE_SELECTED || producerSelectionState() >= MULTIPLE_SELECTED;
if ( multipleSelected && !shorter )
{
tofString += " (Average)";
}
tofString += " [days]";
// Conversion from seconds in flow module to days is done in RigFlowDiagTimeStepResult::setTracerTOF()
return tofString;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::maxFractionTracerString( bool shorter ) const
{
QString mfString;
if ( injectorSelectionState() >= ONE_SELECTED && producerSelectionState() == NONE_SELECTED )
{
mfString = shorter ? "FloodReg" : "Flooding Region";
if ( injectorSelectionState() >= MULTIPLE_SELECTED ) mfString += "s";
}
else if ( injectorSelectionState() == NONE_SELECTED && producerSelectionState() >= ONE_SELECTED )
{
mfString = shorter ? "DrainReg" : "Drainage Region";
if ( producerSelectionState() >= MULTIPLE_SELECTED ) mfString += "s";
}
else
{
mfString = shorter ? "Drain&FloodReg" : "Drainage/Flooding Regions";
}
return mfString;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::selectedTracersString() const
{
QStringList fullTracersList;
FlowTracerSelectionState injectorState = injectorSelectionState();
FlowTracerSelectionState producerState = producerSelectionState();
if ( injectorState == ALL_SELECTED && producerState == ALL_SELECTED )
{
fullTracersList += caf::AppEnum<FlowTracerSelectionType>::uiText( FLOW_TR_INJ_AND_PROD );
}
else
{
if ( injectorState == ALL_SELECTED )
{
fullTracersList += caf::AppEnum<FlowTracerSelectionType>::uiText( FLOW_TR_INJECTORS );
}
if ( producerState == ALL_SELECTED )
{
fullTracersList += caf::AppEnum<FlowTracerSelectionType>::uiText( FLOW_TR_PRODUCERS );
}
if ( injectorSelectionState() == ONE_SELECTED || injectorSelectionState() == MULTIPLE_SELECTED )
{
QStringList listOfSelectedInjectors;
for ( const QString& injector : m_selectedInjectorTracers() )
{
listOfSelectedInjectors.push_back( injector );
}
if ( !listOfSelectedInjectors.empty() )
{
fullTracersList += listOfSelectedInjectors.join( ", " );
}
}
if ( producerSelectionState() == ONE_SELECTED || producerSelectionState() == MULTIPLE_SELECTED )
{
QStringList listOfSelectedProducers;
for ( const QString& producer : m_selectedProducerTracers() )
{
listOfSelectedProducers.push_back( producer );
}
if ( !listOfSelectedProducers.empty() )
{
fullTracersList.push_back( listOfSelectedProducers.join( ", " ) );
}
}
}
QString tracersText;
if ( !fullTracersList.empty() )
{
tracersText = fullTracersList.join( ", " );
}
return tracersText;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RimEclipseResultDefinition::getResultNamesForResultType( RiaDefines::ResultCatType resultCatType,
const RigCaseCellResultsData* results )
{
if ( resultCatType != RiaDefines::ResultCatType::FLOW_DIAGNOSTICS )
{
if ( !results ) return QStringList();
return results->resultNames( resultCatType );
}
else
{
QStringList flowVars;
flowVars.push_back( RIG_FLD_TOF_RESNAME );
flowVars.push_back( RIG_FLD_CELL_FRACTION_RESNAME );
flowVars.push_back( RIG_FLD_MAX_FRACTION_TRACER_RESNAME );
flowVars.push_back( RIG_FLD_COMMUNICATION_RESNAME );
return flowVars;
}
return m_showOnlyVisibleCategoriesInLegend();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultDefinition::FlowTracerSelectionState RimEclipseResultDefinition::injectorSelectionState() const
{
if ( m_flowTracerSelectionMode == FLOW_TR_INJECTORS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD )
{
return ALL_SELECTED;
}
else if ( m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION )
{
const bool isInjector = true;
if ( m_selectedInjectorTracers().size() == RimFlowDiagnosticsTools::setOfTracersOfType( m_flowSolutionUiField(), isInjector ).size() )
{
return ALL_SELECTED;
}
else if ( m_selectedInjectorTracers().size() == (size_t)1 )
{
return ONE_SELECTED;
}
else if ( m_selectedInjectorTracers().size() > (size_t)1 )
{
return MULTIPLE_SELECTED;
}
}
return NONE_SELECTED;
return RimEclipseResultDefinitionTools::getFlowTracerSelectionState( isInjector,
m_flowTracerSelectionMode(),
m_flowSolutionUiField(),
m_selectedInjectorTracers().size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultDefinition::FlowTracerSelectionState RimEclipseResultDefinition::producerSelectionState() const
{
if ( m_flowTracerSelectionMode == FLOW_TR_PRODUCERS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD )
{
return ALL_SELECTED;
}
else if ( m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION )
{
const bool isInjector = false;
if ( m_selectedProducerTracers().size() == RimFlowDiagnosticsTools::setOfTracersOfType( m_flowSolutionUiField(), isInjector ).size() )
{
return ALL_SELECTED;
}
else if ( m_selectedProducerTracers().size() == (size_t)1 )
{
return ONE_SELECTED;
}
else if ( m_selectedProducerTracers().size() > (size_t)1 )
{
return MULTIPLE_SELECTED;
}
}
return NONE_SELECTED;
return RimEclipseResultDefinitionTools::getFlowTracerSelectionState( isInjector,
m_flowTracerSelectionMode(),
m_flowSolutionUiField(),
m_selectedProducerTracers().size() );
}
//--------------------------------------------------------------------------------------------------
@@ -2469,7 +1836,7 @@ void RimEclipseResultDefinition::syncInjectorToProducerSelection()
}
RimFlowDiagSolution* flowSol = m_flowSolution();
if ( flowSol && m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION )
if ( flowSol && m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_BY_SELECTION )
{
std::set<QString, RimFlowDiagnosticsTools::TracerComp> newProducerSelection =
RimFlowDiagnosticsTools::setOfProducerTracersFromInjectors( m_flowSolutionUiField(), m_selectedInjectorTracers(), timeStep );
@@ -2498,7 +1865,7 @@ void RimEclipseResultDefinition::syncProducerToInjectorSelection()
}
RimFlowDiagSolution* flowSol = m_flowSolution();
if ( flowSol && m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION )
if ( flowSol && m_flowTracerSelectionMode == FlowTracerSelectionType::FLOW_TR_BY_SELECTION )
{
std::set<QString, RimFlowDiagnosticsTools::TracerComp> newInjectorSelection =
RimFlowDiagnosticsTools::setOfInjectorTracersFromProducers( m_flowSolutionUiField(), m_selectedProducerTracers(), timeStep );
@@ -2561,31 +1928,7 @@ bool RimEclipseResultDefinition::isDeltaCaseActive() const
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isDivideByCellFaceAreaPossible() const
{
QString str = m_resultVariable;
// TODO : Move to RiaDefines or a separate file for cell face results
if ( str == "FLRWATI+" ) return true;
if ( str == "FLRWATJ+" ) return true;
if ( str == "FLRWATK+" ) return true;
if ( str == "FLROILI+" ) return true;
if ( str == "FLROILJ+" ) return true;
if ( str == "FLROILK+" ) return true;
if ( str == "FLRGASI+" ) return true;
if ( str == "FLRGASJ+" ) return true;
if ( str == "FLRGASK+" ) return true;
if ( str == "TRANX" ) return true;
if ( str == "TRANY" ) return true;
if ( str == "TRANZ" ) return true;
if ( str == "riTRANX" ) return true;
if ( str == "riTRANY" ) return true;
if ( str == "riTRANZ" ) return true;
return false;
return RimEclipseResultDefinitionTools::isDivideByCellFaceAreaPossible( m_resultVariable );
}
//--------------------------------------------------------------------------------------------------
@@ -2632,27 +1975,3 @@ bool RimEclipseResultDefinition::addPerCellFaceOptionsForVariableUiField() const
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::getInputPropertyFileName( const QString& resultName ) const
{
RimEclipseCase* eclipseCase;
this->firstAncestorOrThisOfType( eclipseCase );
if ( eclipseCase )
{
RimEclipseInputPropertyCollection* inputPropertyCollection = eclipseCase->inputPropertyCollection();
if ( inputPropertyCollection )
{
RimEclipseInputProperty* inputProperty = inputPropertyCollection->findInputProperty( resultName );
if ( inputProperty )
{
return inputProperty->fileName.v().path();
}
}
}
return "";
}

View File

@@ -24,6 +24,7 @@
#include "RiaPorosityModel.h"
#include "RigFlowDiagResultAddress.h"
#include "RimCheckableObject.h"
#include "RimFlowDiagSolution.h"
@@ -36,14 +37,13 @@
#include <limits>
#include "RigCaseCellResultsData.h"
class RigCaseCellResultsData;
class RimEclipseCase;
class RimEclipseView;
class RimReservoirCellResultsStorage;
class RimRegularLegendConfig;
class RimTernaryLegendConfig;
class RigEclipseResultAddress;
//==================================================================================================
///
@@ -54,7 +54,7 @@ class RimEclipseResultDefinition : public RimCheckableObject
CAF_PDM_HEADER_INIT;
public:
enum FlowTracerSelectionType
enum class FlowTracerSelectionType
{
FLOW_TR_INJ_AND_PROD,
FLOW_TR_PRODUCERS,
@@ -63,7 +63,7 @@ public:
};
using FlowTracerSelectionEnum = caf::AppEnum<RimEclipseResultDefinition::FlowTracerSelectionType>;
enum FlowTracerSelectionState
enum class FlowTracerSelectionState
{
NONE_SELECTED,
ONE_SELECTED,
@@ -139,6 +139,8 @@ public:
void updateRangesForExplicitLegends( RimRegularLegendConfig* legendConfig, RimTernaryLegendConfig* ternaryLegendConfig, int currentTimeStep );
void updateLegendTitle( RimRegularLegendConfig* legendConfig, const QString& legendHeading );
bool showOnlyVisibleCategoriesInLegend() const;
protected:
virtual void updateLegendCategorySettings(){};
@@ -197,13 +199,7 @@ private:
QString flowDiagResUiText( bool shortLabel, int maxTracerStringLength = std::numeric_limits<int>::max() ) const;
QString timeOfFlightString( bool shorter ) const;
QString maxFractionTracerString( bool shorter ) const;
QString selectedTracersString() const;
void changedTracerSelectionField( bool injector );
static QStringList getResultNamesForResultType( RiaDefines::ResultCatType resultCatType, const RigCaseCellResultsData* results );
FlowTracerSelectionState injectorSelectionState() const;
FlowTracerSelectionState producerSelectionState() const;
@@ -225,8 +221,6 @@ private:
bool showDerivedResultsFirstInVariableUiField() const;
bool addPerCellFaceOptionsForVariableUiField() const;
QString getInputPropertyFileName( const QString& resultName ) const;
private:
bool m_isDeltaResultEnabled;
caf::PdmUiItemInfo::LabelPosType m_labelPosition;

View File

@@ -0,0 +1,776 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimEclipseResultDefinitionTools.h"
#include "RiaColorTables.h"
#include "RiaColorTools.h"
#include "RigAllanDiagramData.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigFlowDiagResults.h"
#include "RigVisibleCategoriesCalculator.h"
#include "RimColorLegend.h"
#include "RimColorLegendItem.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseInputProperty.h"
#include "RimEclipseInputPropertyCollection.h"
#include "RimEclipseView.h"
#include "RimFlowDiagnosticsTools.h"
#include "RimRegularLegendConfig.h"
#include "RimSimWellInView.h"
#include "RimSimWellInViewCollection.h"
#include "RimTernaryLegendConfig.h"
#include <QString>
#include "cafCategoryMapper.h"
#include "cvfColor3.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinitionTools::isDivideByCellFaceAreaPossible( const QString& resultName )
{
if ( resultName == "FLRWATI+" ) return true;
if ( resultName == "FLRWATJ+" ) return true;
if ( resultName == "FLRWATK+" ) return true;
if ( resultName == "FLROILI+" ) return true;
if ( resultName == "FLROILJ+" ) return true;
if ( resultName == "FLROILK+" ) return true;
if ( resultName == "FLRGASI+" ) return true;
if ( resultName == "FLRGASJ+" ) return true;
if ( resultName == "FLRGASK+" ) return true;
if ( resultName == "TRANX" ) return true;
if ( resultName == "TRANY" ) return true;
if ( resultName == "TRANZ" ) return true;
if ( resultName == "riTRANX" ) return true;
if ( resultName == "riTRANY" ) return true;
if ( resultName == "riTRANZ" ) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RD::FlowTracerSelectionState RimEclipseResultDefinitionTools::getFlowTracerSelectionState( bool isInjector,
RD::FlowTracerSelectionType tracerSelectionType,
const RimFlowDiagSolution* flowDiagSolution,
size_t selectedTracerCount )
{
if ( tracerSelectionType == RD::FlowTracerSelectionType::FLOW_TR_INJECTORS ||
tracerSelectionType == RD::FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD )
{
return RD::FlowTracerSelectionState::ALL_SELECTED;
}
if ( tracerSelectionType == RD::FlowTracerSelectionType::FLOW_TR_BY_SELECTION )
{
if ( selectedTracerCount == RimFlowDiagnosticsTools::setOfTracersOfType( flowDiagSolution, isInjector ).size() )
{
return RD::FlowTracerSelectionState::ALL_SELECTED;
}
if ( selectedTracerCount == 1 )
{
return RD::FlowTracerSelectionState::ONE_SELECTED;
}
if ( selectedTracerCount > 1 )
{
return RD::FlowTracerSelectionState::MULTIPLE_SELECTED;
}
}
return RD::FlowTracerSelectionState::NONE_SELECTED;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RimEclipseResultDefinitionTools::getResultNamesForResultType( RiaDefines::ResultCatType resultCatType,
const RigCaseCellResultsData* results )
{
if ( resultCatType != RiaDefines::ResultCatType::FLOW_DIAGNOSTICS )
{
if ( !results ) return {};
return results->resultNames( resultCatType );
}
QStringList flowVars;
flowVars.push_back( RIG_FLD_TOF_RESNAME );
flowVars.push_back( RIG_FLD_CELL_FRACTION_RESNAME );
flowVars.push_back( RIG_FLD_MAX_FRACTION_TRACER_RESNAME );
flowVars.push_back( RIG_FLD_COMMUNICATION_RESNAME );
return flowVars;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinitionTools::timeOfFlightString( RD::FlowTracerSelectionState injectorState,
RD::FlowTracerSelectionState producerState,
bool shorter )
{
QString tofString;
bool multipleSelected = false;
if ( injectorState != RD::FlowTracerSelectionState::NONE_SELECTED && producerState != RD::FlowTracerSelectionState::NONE_SELECTED )
{
tofString = shorter ? "Res.Time" : "Residence Time";
multipleSelected = true;
}
else if ( injectorState != RD::FlowTracerSelectionState::NONE_SELECTED )
{
tofString = shorter ? "Fwd.TOF" : "Forward Time of Flight";
}
else if ( producerState != RD::FlowTracerSelectionState::NONE_SELECTED )
{
tofString = shorter ? "Rev.TOF" : "Reverse Time of Flight";
}
else
{
tofString = shorter ? "TOF" : "Time of Flight";
}
multipleSelected = multipleSelected || injectorState >= RD::FlowTracerSelectionState::MULTIPLE_SELECTED ||
producerState >= RD::FlowTracerSelectionState::MULTIPLE_SELECTED;
if ( multipleSelected && !shorter )
{
tofString += " (Average)";
}
tofString += " [days]";
// Conversion from seconds in flow module to days is done in RigFlowDiagTimeStepResult::setTracerTOF()
return tofString;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinitionTools::maxFractionTracerString( RD::FlowTracerSelectionState injectorState,
RD::FlowTracerSelectionState producerState,
bool shorter )
{
QString mfString;
if ( injectorState >= RD::FlowTracerSelectionState::ONE_SELECTED && producerState == RD::FlowTracerSelectionState::NONE_SELECTED )
{
mfString = shorter ? "FloodReg" : "Flooding Region";
if ( injectorState >= RD::FlowTracerSelectionState::MULTIPLE_SELECTED ) mfString += "s";
}
else if ( injectorState == RD::FlowTracerSelectionState::NONE_SELECTED && producerState >= RD::FlowTracerSelectionState::ONE_SELECTED )
{
mfString = shorter ? "DrainReg" : "Drainage Region";
if ( producerState >= RD::FlowTracerSelectionState::MULTIPLE_SELECTED ) mfString += "s";
}
else
{
mfString = shorter ? "Drain&FloodReg" : "Drainage/Flooding Regions";
}
return mfString;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinitionTools::selectedTracersString( RD::FlowTracerSelectionState injectorState,
RD::FlowTracerSelectionState producerState,
const std::vector<QString>& selectedInjectors,
const std::vector<QString>& selectedProducers,
int maxTracerStringLength )
{
QStringList fullTracersList;
if ( injectorState == RD::FlowTracerSelectionState::ALL_SELECTED && producerState == RD::FlowTracerSelectionState::ALL_SELECTED )
{
fullTracersList += caf::AppEnum<RD::FlowTracerSelectionType>::uiText( RD::FlowTracerSelectionType::FLOW_TR_INJ_AND_PROD );
}
else
{
if ( injectorState == RD::FlowTracerSelectionState::ALL_SELECTED )
{
fullTracersList += caf::AppEnum<RD::FlowTracerSelectionType>::uiText( RD::FlowTracerSelectionType::FLOW_TR_INJECTORS );
}
if ( producerState == RD::FlowTracerSelectionState::ALL_SELECTED )
{
fullTracersList += caf::AppEnum<RD::FlowTracerSelectionType>::uiText( RD::FlowTracerSelectionType::FLOW_TR_PRODUCERS );
}
if ( injectorState == RD::FlowTracerSelectionState::ONE_SELECTED || injectorState == RD::FlowTracerSelectionState::MULTIPLE_SELECTED )
{
QStringList listOfSelectedInjectors;
for ( const QString& injector : selectedInjectors )
{
listOfSelectedInjectors.push_back( injector );
}
if ( !listOfSelectedInjectors.empty() )
{
fullTracersList += listOfSelectedInjectors.join( ", " );
}
}
if ( producerState == RD::FlowTracerSelectionState::ONE_SELECTED || producerState == RD::FlowTracerSelectionState::MULTIPLE_SELECTED )
{
QStringList listOfSelectedProducers;
for ( const QString& producer : selectedProducers )
{
listOfSelectedProducers.push_back( producer );
}
if ( !listOfSelectedProducers.empty() )
{
fullTracersList.push_back( listOfSelectedProducers.join( ", " ) );
}
}
}
QString tracersText;
if ( !fullTracersList.empty() )
{
tracersText = fullTracersList.join( ", " );
}
if ( !tracersText.isEmpty() )
{
const QString postfix = "...";
if ( tracersText.size() > maxTracerStringLength + postfix.size() )
{
tracersText = tracersText.left( maxTracerStringLength );
tracersText += postfix;
}
}
return tracersText;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinitionTools::getInputPropertyFileName( const RimEclipseCase* eclipseCase, const QString& resultName )
{
if ( eclipseCase )
{
RimEclipseInputPropertyCollection* inputPropertyCollection = eclipseCase->inputPropertyCollection();
if ( inputPropertyCollection )
{
RimEclipseInputProperty* inputProperty = inputPropertyCollection->findInputProperty( resultName );
if ( inputProperty )
{
return inputProperty->fileName.v().path();
}
}
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinitionTools::updateTernaryLegend( RigCaseCellResultsData* cellResultsData,
RimTernaryLegendConfig* ternaryLegendConfigToUpdate,
int timeStep )
{
if ( !cellResultsData ) return;
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();
if ( maxTimeStepCount > 1 )
{
{
RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() );
if ( cellResultsData->ensureKnownResultLoaded( resAddr ) )
{
double globalMin = 0.0;
double globalMax = 1.0;
double localMin = 0.0;
double localMax = 1.0;
cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax );
cellResultsData->minMaxCellScalarValues( resAddr, timeStep, localMin, localMax );
ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SOIL_IDX, globalMin, globalMax, localMin, localMax );
}
}
{
RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() );
if ( cellResultsData->ensureKnownResultLoaded( resAddr ) )
{
double globalMin = 0.0;
double globalMax = 1.0;
double localMin = 0.0;
double localMax = 1.0;
cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax );
cellResultsData->minMaxCellScalarValues( resAddr, timeStep, localMin, localMax );
ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SGAS_IDX, globalMin, globalMax, localMin, localMax );
}
}
{
RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() );
if ( cellResultsData->ensureKnownResultLoaded( resAddr ) )
{
double globalMin = 0.0;
double globalMax = 1.0;
double localMin = 0.0;
double localMax = 1.0;
cellResultsData->minMaxCellScalarValues( resAddr, globalMin, globalMax );
cellResultsData->minMaxCellScalarValues( resAddr, timeStep, localMin, localMax );
ternaryLegendConfigToUpdate->setAutomaticRanges( RimTernaryLegendConfig::TERNARY_SWAT_IDX, globalMin, globalMax, localMin, localMax );
}
}
}
}
namespace RimEclipseResultDefinitionTools
{
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool operator<( const cvf::Color3ub first, const cvf::Color3ub second )
{
if ( first.r() != second.r() ) return first.r() < second.r();
if ( first.g() != second.g() ) return first.g() < second.g();
if ( first.b() != second.b() ) return first.b() < second.b();
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class TupleCompare
{
public:
bool operator()( const std::tuple<QString, int, cvf::Color3ub>& t1, const std::tuple<QString, int, cvf::Color3ub>& t2 ) const
{
using namespace std;
if ( get<0>( t1 ) != get<0>( t2 ) ) return get<0>( t1 ) < get<0>( t2 );
if ( get<1>( t1 ) != get<1>( t2 ) ) return get<1>( t1 ) < get<1>( t2 );
if ( get<2>( t1 ) != get<2>( t2 ) ) return get<2>( t1 ) < get<2>( t2 );
return false;
}
};
} // namespace RimEclipseResultDefinitionTools
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinitionTools::updateLegendForFlowDiagnostics( const RimEclipseResultDefinition* resultDefinition,
RimRegularLegendConfig* legendConfigToUpdate,
int timeStep )
{
if ( timeStep < 0 ) return;
if ( !resultDefinition || !legendConfigToUpdate ) return;
auto flowDiagSolution = resultDefinition->flowDiagSolution();
if ( !flowDiagSolution ) return;
RigFlowDiagResults* flowResultsData = flowDiagSolution->flowDiagResults();
if ( !flowResultsData ) return;
RigFlowDiagResultAddress resAddr = resultDefinition->flowDiagResAddress();
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
flowResultsData->minMaxScalarValues( resAddr, timeStep, &globalMin, &globalMax );
flowResultsData->posNegClosestToZero( resAddr, timeStep, &globalPosClosestToZero, &globalNegClosestToZero );
double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero;
if ( resultDefinition->hasDynamicResult() )
{
flowResultsData->minMaxScalarValues( resAddr, timeStep, &localMin, &localMax );
flowResultsData->posNegClosestToZero( resAddr, timeStep, &localPosClosestToZero, &localNegClosestToZero );
}
else
{
localMin = globalMin;
localMax = globalMax;
localPosClosestToZero = globalPosClosestToZero;
localNegClosestToZero = globalNegClosestToZero;
}
CVF_ASSERT( legendConfigToUpdate );
legendConfigToUpdate->disableAllTimeStepsRange( true );
legendConfigToUpdate->setClosestToZeroValues( globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero );
legendConfigToUpdate->setAutomaticRanges( globalMin, globalMax, localMin, localMax );
if ( resultDefinition->hasCategoryResult() )
{
RimEclipseView* eclView = nullptr;
resultDefinition->firstAncestorOrThisOfType( eclView );
if ( eclView )
{
std::set<std::tuple<QString, int, cvf::Color3ub>, TupleCompare> categories;
std::vector<QString> tracerNames = flowDiagSolution->tracerNames();
int tracerIndex = 0;
for ( const auto& tracerName : tracerNames )
{
cvf::Color3ub color( cvf::Color3::GRAY );
RimSimWellInView* well = eclView->wellCollection()->findWell( RimFlowDiagSolution::removeCrossFlowEnding( tracerName ) );
if ( well ) color = cvf::Color3ub( well->wellPipeColor() );
categories.insert( std::make_tuple( tracerName, tracerIndex, color ) );
++tracerIndex;
}
std::vector<std::tuple<QString, int, cvf::Color3ub>> categoryVector;
if ( resultDefinition->showOnlyVisibleCategoriesInLegend() )
{
std::set<int> visibleTracers =
RigVisibleCategoriesCalculator::visibleFlowDiagCategories( *eclView, *flowResultsData, resAddr, timeStep );
for ( auto tupIt : categories )
{
int tracerIndex = std::get<1>( tupIt );
if ( visibleTracers.count( tracerIndex ) ) categoryVector.push_back( tupIt );
}
}
else
{
for ( const auto& tupIt : categories )
{
categoryVector.push_back( tupIt );
}
}
legendConfigToUpdate->setCategoryItems( categoryVector );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinitionTools::updateCellResultLegend( const RimEclipseResultDefinition* resultDefinition,
RimRegularLegendConfig* legendConfigToUpdate,
int timeStep )
{
if ( !resultDefinition || !legendConfigToUpdate ) return;
auto cellResultsData = resultDefinition->currentGridCellResults();
if ( !cellResultsData ) return;
auto eclipseCaseData = resultDefinition->eclipseCase()->eclipseCaseData();
if ( !eclipseCaseData ) return;
cellResultsData->ensureKnownResultLoaded( resultDefinition->eclipseResultAddress() );
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
cellResultsData->minMaxCellScalarValues( resultDefinition->eclipseResultAddress(), globalMin, globalMax );
cellResultsData->posNegClosestToZero( resultDefinition->eclipseResultAddress(), globalPosClosestToZero, globalNegClosestToZero );
double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero;
if ( resultDefinition->hasDynamicResult() && timeStep >= 0 )
{
cellResultsData->minMaxCellScalarValues( resultDefinition->eclipseResultAddress(), timeStep, localMin, localMax );
cellResultsData->posNegClosestToZero( resultDefinition->eclipseResultAddress(), timeStep, localPosClosestToZero, localNegClosestToZero );
}
else
{
localMin = globalMin;
localMax = globalMax;
localPosClosestToZero = globalPosClosestToZero;
localNegClosestToZero = globalNegClosestToZero;
}
CVF_ASSERT( legendConfigToUpdate );
legendConfigToUpdate->disableAllTimeStepsRange( false );
legendConfigToUpdate->setClosestToZeroValues( globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero );
legendConfigToUpdate->setAutomaticRanges( globalMin, globalMax, localMin, localMax );
if ( resultDefinition->hasCategoryResult() )
{
if ( resultDefinition->resultType() == RiaDefines::ResultCatType::ALLAN_DIAGRAMS )
{
if ( resultDefinition->resultVariable() == RiaResultNames::formationAllanResultName() )
{
const std::vector<QString> fnVector = eclipseCaseData->formationNames();
std::vector<int> fnameIdxes;
for ( int i = 0; i < static_cast<int>( fnVector.size() ); i++ )
{
fnameIdxes.push_back( i );
}
cvf::Color3ubArray legendBaseColors = legendConfigToUpdate->colorLegend()->colorArray();
cvf::ref<caf::CategoryMapper> formationColorMapper = new caf::CategoryMapper;
formationColorMapper->setCategories( fnameIdxes );
formationColorMapper->setInterpolateColors( legendBaseColors );
const std::map<std::pair<int, int>, int>& formationCombToCategory =
eclipseCaseData->allanDiagramData()->formationCombinationToCategory();
std::vector<std::tuple<QString, int, cvf::Color3ub>> categories;
for ( int frmNameIdx : fnameIdxes )
{
cvf::Color3ub formationColor = formationColorMapper->mapToColor( frmNameIdx );
categories.emplace_back( std::make_tuple( fnVector[frmNameIdx], frmNameIdx, formationColor ) );
}
std::set<size_t> visibleAllanCategories;
{
RimEclipseView* eclView = nullptr;
resultDefinition->firstAncestorOrThisOfType( eclView );
visibleAllanCategories = RigVisibleCategoriesCalculator::visibleAllanCategories( eclView );
}
for ( auto [formationPair, categoryIndex] : formationCombToCategory )
{
int frmIdx1 = formationPair.first;
int frmIdx2 = formationPair.second;
if ( visibleAllanCategories.count( categoryIndex ) == 0 ) continue;
auto fnVectorSize = static_cast<int>( fnVector.size() );
if ( frmIdx1 >= fnVectorSize || frmIdx2 >= fnVectorSize ) continue;
QString frmName1 = fnVector[frmIdx1];
QString frmName2 = fnVector[frmIdx2];
cvf::Color3f formationColor1 = cvf::Color3f( formationColorMapper->mapToColor( frmIdx1 ) );
cvf::Color3f formationColor2 = cvf::Color3f( formationColorMapper->mapToColor( frmIdx2 ) );
cvf::Color3ub blendColor = cvf::Color3ub( RiaColorTools::blendCvfColors( formationColor1, formationColor2 ) );
categories.emplace_back( std::make_tuple( frmName1 + "-" + frmName2, categoryIndex, blendColor ) );
}
legendConfigToUpdate->setCategoryItems( categories );
}
else if ( resultDefinition->resultVariable() == RiaResultNames::formationBinaryAllanResultName() )
{
std::vector<std::tuple<QString, int, cvf::Color3ub>> categories;
categories.emplace_back( std::make_tuple( "Same formation", 0, cvf::Color3ub::BROWN ) );
categories.emplace_back( std::make_tuple( "Different formation", 1, cvf::Color3ub::ORANGE ) );
legendConfigToUpdate->setCategoryItems( categories );
}
}
else if ( resultDefinition->resultType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE &&
resultDefinition->resultVariable() == RiaResultNames::completionTypeResultName() )
{
const std::vector<int>& visibleCategories = cellResultsData->uniqueCellScalarValues( resultDefinition->eclipseResultAddress() );
std::vector<RiaDefines::WellPathComponentType> supportedCompletionTypes = { RiaDefines::WellPathComponentType::WELL_PATH,
RiaDefines::WellPathComponentType::FISHBONES,
RiaDefines::WellPathComponentType::PERFORATION_INTERVAL,
RiaDefines::WellPathComponentType::FRACTURE };
RiaColorTables::WellPathComponentColors colors = RiaColorTables::wellPathComponentColors();
std::vector<std::tuple<QString, int, cvf::Color3ub>> categories;
for ( auto completionType : supportedCompletionTypes )
{
if ( std::find( visibleCategories.begin(), visibleCategories.end(), static_cast<int>( completionType ) ) !=
visibleCategories.end() )
{
QString categoryText = caf::AppEnum<RiaDefines::WellPathComponentType>::uiText( completionType );
categories.emplace_back( categoryText, static_cast<int>( completionType ), colors[completionType] );
}
}
legendConfigToUpdate->setCategoryItems( categories );
}
else
{
auto uniqueValues = cellResultsData->uniqueCellScalarValues( resultDefinition->eclipseResultAddress() );
if ( resultDefinition->eclipseResultAddress().resultCatType() == RiaDefines::ResultCatType::FORMATION_NAMES )
{
std::vector<QString> fnVector = eclipseCaseData->formationNames();
uniqueValues.resize( fnVector.size() );
std::iota( uniqueValues.begin(), uniqueValues.end(), 0 );
}
cvf::Color3ubArray legendBaseColors = legendConfigToUpdate->colorLegend()->colorArray();
cvf::ref<caf::CategoryMapper> categoryMapper = new caf::CategoryMapper;
categoryMapper->setCategories( uniqueValues );
categoryMapper->setInterpolateColors( legendBaseColors );
std::vector<int> visibleCategoryValues = uniqueValues;
if ( resultDefinition->showOnlyVisibleCategoriesInLegend() )
{
RimEclipseView* eclView = nullptr;
resultDefinition->firstAncestorOrThisOfType( eclView );
if ( eclView && eclView->showWindow() )
{
// Check if current result is cell result, and update the visible set of values
// TODO: Can be extended to the separate geometry results (separate fault result, separate
// intersection results), but this requires some refactoring
if ( eclView->cellResult() == resultDefinition )
{
std::set<int> visibleCategorySet = RigVisibleCategoriesCalculator::visibleCategories( eclView );
visibleCategoryValues.clear();
visibleCategoryValues.insert( visibleCategoryValues.begin(), visibleCategorySet.begin(), visibleCategorySet.end() );
}
}
}
std::vector<std::tuple<QString, int, cvf::Color3ub>> categoryVector;
for ( auto value : visibleCategoryValues )
{
cvf::Color3ub categoryColor = categoryMapper->mapToColor( value );
QString valueTxt;
if ( resultDefinition->resultType() == RiaDefines::ResultCatType::FORMATION_NAMES )
{
std::vector<QString> fnVector = eclipseCaseData->formationNames();
if ( value < static_cast<int>( fnVector.size() ) )
{
valueTxt = fnVector[value];
}
}
else
{
auto items = legendConfigToUpdate->colorLegend()->colorLegendItems();
auto it = std::find_if( items.begin(),
items.end(),
[value]( const RimColorLegendItem* const item ) { return item->categoryValue() == value; } );
if ( it != items.end() && !( *it )->categoryName().isEmpty() )
{
valueTxt = QString( "%1 (%2)" ).arg( ( *it )->categoryName() ).arg( value );
}
else
{
valueTxt = QString( "%1" ).arg( value );
}
}
categoryVector.emplace_back( valueTxt, value, categoryColor );
}
legendConfigToUpdate->setCategoryItems( categoryVector );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimEclipseResultDefinitionTools::calcOptionsForVariableUiFieldStandard( RiaDefines::ResultCatType resultCatType,
const RigCaseCellResultsData* results,
bool showDerivedResultsFirst,
bool addPerCellFaceOptionItems,
bool enableTernary )
{
if ( !results ) return {};
QList<caf::PdmOptionItemInfo> optionList;
QStringList cellCenterResultNames;
QStringList cellFaceResultNames;
for ( const QString& s : RimEclipseResultDefinitionTools::getResultNamesForResultType( resultCatType, results ) )
{
if ( s == RiaResultNames::completionTypeResultName() )
{
if ( results->timeStepDates().empty() ) continue;
}
if ( RiaResultNames::isPerCellFaceResult( s ) )
{
cellFaceResultNames.push_back( s );
}
else
{
cellCenterResultNames.push_back( s );
}
}
cellCenterResultNames.sort();
cellFaceResultNames.sort();
// Cell Center result names
for ( const QString& s : cellCenterResultNames )
{
optionList.push_back( caf::PdmOptionItemInfo( s, s ) );
}
if ( addPerCellFaceOptionItems )
{
for ( const QString& s : cellFaceResultNames )
{
if ( showDerivedResultsFirst )
{
optionList.push_front( caf::PdmOptionItemInfo( s, s ) );
}
else
{
optionList.push_back( caf::PdmOptionItemInfo( s, s ) );
}
}
// Ternary Result
if ( enableTernary )
{
bool hasAtLeastOneTernaryComponent = false;
if ( cellCenterResultNames.contains( RiaResultNames::soil() ) )
hasAtLeastOneTernaryComponent = true;
else if ( cellCenterResultNames.contains( RiaResultNames::sgas() ) )
hasAtLeastOneTernaryComponent = true;
else if ( cellCenterResultNames.contains( RiaResultNames::swat() ) )
hasAtLeastOneTernaryComponent = true;
if ( resultCatType == RiaDefines::ResultCatType::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent )
{
optionList.push_front( caf::PdmOptionItemInfo( RiaResultNames::ternarySaturationResultName(),
RiaResultNames::ternarySaturationResultName() ) );
}
}
}
optionList.push_front( caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), RiaResultNames::undefinedResultName() ) );
return optionList;
}

View File

@@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimEclipseResultDefinition.h"
#include <QString>
using RD = RimEclipseResultDefinition;
namespace RimEclipseResultDefinitionTools
{
bool isDivideByCellFaceAreaPossible( const QString& resultName );
RD::FlowTracerSelectionState getFlowTracerSelectionState( bool isInjector,
RD::FlowTracerSelectionType tracerSelectionType,
const RimFlowDiagSolution* flowDiagSolution,
size_t selectedTracerCount );
QStringList getResultNamesForResultType( RiaDefines::ResultCatType resultCatType, const RigCaseCellResultsData* results );
QString timeOfFlightString( RD::FlowTracerSelectionState injectorState, RD::FlowTracerSelectionState producerState, bool shorter );
QString maxFractionTracerString( RD::FlowTracerSelectionState injectorState, RD::FlowTracerSelectionState producerState, bool shorter );
QString selectedTracersString( RD::FlowTracerSelectionState injectorState,
RD::FlowTracerSelectionState producerState,
const std::vector<QString>& selectedInjectors,
const std::vector<QString>& selectedProducers,
int maxTracerStringLength );
QString getInputPropertyFileName( const RimEclipseCase* eclipseCase, const QString& resultName );
void updateTernaryLegend( RigCaseCellResultsData* cellResultsData, RimTernaryLegendConfig* ternaryLegendConfigToUpdate, int timeStep );
void updateLegendForFlowDiagnostics( const RimEclipseResultDefinition* resultDefinition,
RimRegularLegendConfig* legendConfigToUpdate,
int timeStep );
void updateCellResultLegend( const RimEclipseResultDefinition* resultDefinition, RimRegularLegendConfig* legendConfigToUpdate, int timeStep );
QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard( RiaDefines::ResultCatType resultCatType,
const RigCaseCellResultsData* results,
bool showDerivedResultsFirst,
bool addPerCellFaceOptionItems,
bool enableTernary );
}; // namespace RimEclipseResultDefinitionTools

View File

@@ -20,11 +20,14 @@
#include "RimEclipseStatisticsCase.h"
#include "RiaResultNames.h"
#include "RicNewViewFeature.h"
#include "RicfCommandObject.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigSimWellData.h"
#include "RimCaseCollection.h"

View File

@@ -18,6 +18,9 @@
#include "RimMultipleEclipseResults.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"

View File

@@ -23,6 +23,7 @@
#include "RiaStimPlanModelDefines.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigEclipseWellLogExtractor.h"
#include "RigElasticProperties.h"
#include "RigResultAccessor.h"

View File

@@ -22,6 +22,7 @@
#include "RiaStimPlanModelDefines.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigEclipseWellLogExtractor.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"

View File

@@ -23,6 +23,7 @@
#include "RiaStimPlanModelDefines.h"
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigEclipseWellLogExtractor.h"

View File

@@ -27,6 +27,7 @@
#include "RiaWellLogUnitTools.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigEclipseWellLogExtractor.h"
#include "RigFemPartResultsCollection.h"
#include "RigGeoMechCaseData.h"

View File

@@ -22,6 +22,7 @@
#include "RigCaseCellResultsData.h"
#include "RigCellGeometryTools.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigFractureCell.h"
#include "RigFractureTransmissibilityEquations.h"
#include "RigHexIntersectionTools.h"

View File

@@ -26,6 +26,7 @@
#include "RigCombMultResultAccessor.h"
#include "RigCombTransResultAccessor.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigFlowDiagResults.h"
#include "RigGridBase.h"
#include "RigMainGrid.h"

View File

@@ -17,8 +17,10 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RigAllanUtil.h"
#include "RigAllanDiagramData.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "RigFormationNames.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"

View File

@@ -23,8 +23,6 @@
#include "RiaDefines.h"
#include "RiaPorosityModel.h"
#include "RigEclipseResultAddress.h"
#include "cvfCollection.h"
#include <QDateTime>
@@ -42,6 +40,7 @@ class RigEclipseTimeStepInfo;
class RigEclipseCaseData;
class RigFormationNames;
class RigAllanDiagramData;
class RigEclipseResultAddress;
class RimEclipseCase;

View File

@@ -26,6 +26,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "RigNNCData.h"
#include "cvfArray.h"

View File

@@ -24,6 +24,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "RigEquil.h"
#include "RigFormationNames.h"
#include "RigMainGrid.h"

View File

@@ -23,6 +23,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "RigStatisticsCalculator.h"
class RigHistogramCalculator;

View File

@@ -26,6 +26,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "cvfArray.h"

View File

@@ -23,6 +23,7 @@
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigMainGrid.h"
#include "RigResultAccessor.h"
#include "RigWellLogExtractionTools.h"

View File

@@ -27,6 +27,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigFlowDiagInterfaceTools.h"
#include "opm/flowdiagnostics/DerivedQuantities.hpp"

View File

@@ -19,7 +19,10 @@
#include "RigFlowDiagStatCalc.h"
#include "RiaResultNames.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "RigFlowDiagResults.h"
#include "RigStatisticsMath.h"
#include "RigWeightedMeanCalc.h"

View File

@@ -19,8 +19,11 @@
#include "RigFlowDiagVisibleCellsStatCalc.h"
#include "RiaResultNames.h"
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "RigStatisticsMath.h"
#include "RigWeightedMeanCalc.h"

View File

@@ -23,6 +23,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"
#include "RigReservoirBuilderMock.h"

View File

@@ -21,6 +21,7 @@
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigResultModifier.h"
#include <cmath>

View File

@@ -20,6 +20,7 @@
#include "RiaDefines.h"
#include "RiaPorosityModel.h"
#include "RiaResultNames.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"

View File

@@ -21,6 +21,7 @@
#include "RiaDefines.h"
#include "RiaLogging.h"
#include "RiaPorosityModel.h"
#include "RiaResultNames.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"

View File

@@ -18,7 +18,9 @@
#include "RiuPvtPlotUpdater.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"

View File

@@ -23,6 +23,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigGridBase.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"

View File

@@ -22,6 +22,7 @@
#include "RigAllanDiagramData.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultAddress.h"
#include "RigFormationNames.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"

View File

@@ -19,6 +19,8 @@
#include "RiuSelectionChangedHandler.h"
#include "RiaResultNames.h"
#include "RigCaseCellResultsData.h"
#include "RigDepthResultAccessor.h"
#include "RigEclipseCaseData.h"
@@ -26,7 +28,6 @@
#include "RigFemPartResultsCollection.h"
#include "RigGeoMechCaseData.h"
#include "RigTimeHistoryResultAccessor.h"
#include "RiuFemTimeHistoryResultAccessor.h"
#include "Rim2dIntersectionView.h"
#include "RimEclipseCase.h"
@@ -41,6 +42,7 @@
#include "Riu3dSelectionManager.h"
#include "RiuDepthQwtPlot.h"
#include "RiuFemResultTextBuilder.h"
#include "RiuFemTimeHistoryResultAccessor.h"
#include "RiuMainWindow.h"
#include "RiuMohrsCirclePlot.h"
#include "RiuPvtPlotPanel.h"