#7151 Flow Diagnostics: Filter legend based on visible wells/regions. (#7182)

* #7151 Flow Diagnostics: Filter legend based on visible wells/regions.
* #7151 Flow Diagnostics: Show only visible tracers by default.
This commit is contained in:
Kristian Bendiksen
2021-01-12 20:55:20 +01:00
committed by GitHub
parent 3e7412802e
commit 70a96c21de
5 changed files with 123 additions and 2 deletions

View File

@@ -35,6 +35,7 @@
#include "RigFlowDiagResultAddress.h"
#include "RigFlowDiagResults.h"
#include "RigFormationNames.h"
#include "RigVisibleTracerFilter.h"
#include "Rim3dView.h"
#include "Rim3dWellLogCurve.h"
@@ -145,6 +146,15 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe
CAF_PDM_InitScriptableFieldNoDefault( &m_flowTracerSelectionMode, "FlowTracerSelectionMode", "Tracers", "", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_phaseSelection, "PhaseSelection", "Phases", "", "", "" );
m_phaseSelection.uiCapability()->setUiLabelPosition( m_labelPosition );
CAF_PDM_InitScriptableField( &m_showOnlyVisibleTracersInLegend,
"ShowOnlyVisibleTracersInLegend",
true,
"Show Only Visible Tracers In Legend",
"",
"",
"" );
// Ui only fields
CAF_PDM_InitFieldNoDefault( &m_resultTypeUiField, "MResultType", "Type", "", "", "" );
@@ -1539,6 +1549,13 @@ void RimEclipseResultDefinition::defineUiOrdering( QString uiConfigName, caf::Pd
uiOrdering.add( &m_inputPropertyFileName );
}
caf::PdmUiGroup* legendGroup = uiOrdering.addNewGroup( "Legend" );
legendGroup->add( &m_showOnlyVisibleTracersInLegend );
bool showOnlyVisibleTracesOption = ( m_resultTypeUiField() == RiaDefines::ResultCatType::FLOW_DIAGNOSTICS &&
m_resultVariableUiField() == RIG_FLD_MAX_FRACTION_TRACER_RESNAME );
legendGroup->setUiHidden( !showOnlyVisibleTracesOption );
if ( isCaseDiffResultAvailable() || isTimeDiffResultAvailable() )
{
caf::PdmUiGroup* differenceGroup = uiOrdering.addNewGroup( "Difference Options" );
@@ -1886,10 +1903,28 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
}
std::vector<std::tuple<QString, int, cvf::Color3ub>> categoryVector;
if ( m_showOnlyVisibleTracersInLegend )
{
std::set<int> visibleTracers;
RigVisibleTracerFilter::filterByVisibility( *eclView,
*flowResultsData,
resAddr,
currentTimeStep,
visibleTracers );
for ( auto tupIt : categories )
{
int tracerIndex = std::get<1>( tupIt );
if ( visibleTracers.count( tracerIndex ) ) categoryVector.push_back( tupIt );
}
}
else
{
for ( auto tupIt : categories )
{
categoryVector.push_back( tupIt );
}
}
legendConfigToUpdate->setCategoryItems( categoryVector );
}

View File

@@ -188,6 +188,7 @@ protected:
caf::PdmField<caf::AppEnum<FlowTracerSelectionType>> m_flowTracerSelectionMode;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowSolutionUiField;
caf::PdmField<RigFlowDiagResultAddress::PhaseSelectionEnum> m_phaseSelection;
caf::PdmField<bool> m_showOnlyVisibleTracersInLegend;
caf::PdmField<bool> m_syncInjectorToProducerSelection;
caf::PdmField<bool> m_syncProducerToInjectorSelection;

View File

@@ -82,6 +82,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigWellDiskData.h
${CMAKE_CURRENT_LIST_DIR}/RigGocadData.h
${CMAKE_CURRENT_LIST_DIR}/RigElasticProperties.h
${CMAKE_CURRENT_LIST_DIR}/RigHistogramData.h
${CMAKE_CURRENT_LIST_DIR}/RigVisibleTracerFilter.h
)
@@ -161,6 +162,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigWellDiskData.cpp
${CMAKE_CURRENT_LIST_DIR}/RigGocadData.cpp
${CMAKE_CURRENT_LIST_DIR}/RigElasticProperties.cpp
${CMAKE_CURRENT_LIST_DIR}/RigHistogramData.cpp
${CMAKE_CURRENT_LIST_DIR}/RigVisibleTracerFilter.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RigVisibleTracerFilter.h"
#include "RigFlowDiagResults.h"
#include "RigFlowDiagVisibleCellsStatCalc.h"
//#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "cvfArray.h"
#include <cmath>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigVisibleTracerFilter::filterByVisibility( RimEclipseView& eclView,
RigFlowDiagResults& flowDiagResults,
const RigFlowDiagResultAddress& resVarAddr,
size_t timeStepIndex,
std::set<int>& visibleTracers )
{
cvf::ref<cvf::UByteArray> cellVisibilities = eclView.currentTotalCellVisibility();
cvf::ref<RigFlowDiagVisibleCellsStatCalc> calculator =
cvf::make_ref<RigFlowDiagVisibleCellsStatCalc>( &flowDiagResults, resVarAddr, cellVisibilities.p() );
calculator->uniqueValues( timeStepIndex, visibleTracers );
}

View File

@@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 <set>
class RimEclipseView;
class RigFlowDiagResults;
class RigFlowDiagResultAddress;
//==================================================================================================
///
//==================================================================================================
class RigVisibleTracerFilter
{
public:
static void filterByVisibility( RimEclipseView& eclView,
RigFlowDiagResults& flowDiagResults,
const RigFlowDiagResultAddress& resVarAddr,
size_t timeStepIndex,
std::set<int>& visibleTracers );
};