mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #5266 from OPM/feature-allen-diagram-results-on-faults
Feature allen diagram results on faults
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigAllenDiagramData.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseResultInfo.h"
|
||||
@@ -62,6 +63,7 @@
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
|
||||
#include "cafCategoryMapper.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiToolButtonEditor.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
@@ -644,32 +646,44 @@ QList<caf::PdmOptionItemInfo>
|
||||
RimGridTimeHistoryCurve* timeHistoryCurve;
|
||||
this->firstAncestorOrThisOfType( timeHistoryCurve );
|
||||
|
||||
// Do not include flow diagnostics results if it is a time history curve
|
||||
// Do not include SourSimRL if no SourSim file is loaded
|
||||
if ( timeHistoryCurve != nullptr || !hasSourSimRLFile || !enableSouring )
|
||||
bool isSeparateFaultResult = false;
|
||||
{
|
||||
using ResCatEnum = caf::AppEnum<RiaDefines::ResultCatType>;
|
||||
for ( size_t i = 0; i < ResCatEnum::size(); ++i )
|
||||
RimEclipseFaultColors* sepFaultResult;
|
||||
this->firstAncestorOrThisOfType( sepFaultResult );
|
||||
if ( sepFaultResult ) isSeparateFaultResult = true;
|
||||
}
|
||||
|
||||
using ResCatEnum = caf::AppEnum<RiaDefines::ResultCatType>;
|
||||
for ( size_t i = 0; i < ResCatEnum::size(); ++i )
|
||||
{
|
||||
RiaDefines::ResultCatType resType = ResCatEnum::fromIndex( i );
|
||||
|
||||
// Do not include flow diagnostics results if it is a time history curve
|
||||
|
||||
if ( resType == RiaDefines::FLOW_DIAGNOSTICS && ( timeHistoryCurve ) )
|
||||
{
|
||||
RiaDefines::ResultCatType resType = ResCatEnum::fromIndex( i );
|
||||
if ( resType == RiaDefines::FLOW_DIAGNOSTICS && ( timeHistoryCurve ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( resType == RiaDefines::SOURSIMRL && ( !hasSourSimRLFile ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( resType == RiaDefines::INJECTION_FLOODING && !enableSouring )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QString uiString = ResCatEnum::uiTextFromIndex( i );
|
||||
options.push_back( caf::PdmOptionItemInfo( uiString, resType ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
// Do not include SourSimRL if no SourSim file is loaded
|
||||
|
||||
if ( resType == RiaDefines::SOURSIMRL && ( !hasSourSimRLFile ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( resType == RiaDefines::INJECTION_FLOODING && !enableSouring )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( resType == RiaDefines::ALLEN_DIAGRAMS && !isSeparateFaultResult )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QString uiString = ResCatEnum::uiTextFromIndex( i );
|
||||
options.push_back( caf::PdmOptionItemInfo( uiString, resType ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1377,6 +1391,12 @@ bool RimEclipseResultDefinition::hasCategoryResult() const
|
||||
if ( this->m_resultType() == RiaDefines::FLOW_DIAGNOSTICS && m_resultVariable() == RIG_FLD_MAX_FRACTION_TRACER_RESNAME )
|
||||
return true;
|
||||
|
||||
if ( this->resultVariable() == RiaDefines::allCombinationsAllenResultName() ||
|
||||
this->resultVariable() == RiaDefines::binaryAllenResultName() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !this->hasStaticResult() ) return false;
|
||||
|
||||
return RiaDefines::isNativeCategoryResult( this->resultVariable() );
|
||||
@@ -1865,6 +1885,61 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
|
||||
const std::vector<QString>& fnVector = eclipseCaseData->activeFormationNames()->formationNames();
|
||||
legendConfigToUpdate->setNamedCategoriesInverse( fnVector );
|
||||
}
|
||||
else if ( this->resultType() == RiaDefines::ALLEN_DIAGRAMS )
|
||||
{
|
||||
if ( this->resultVariable() == RiaDefines::allCombinationsAllenResultName() )
|
||||
{
|
||||
const std::vector<QString>& fnVector = eclipseCaseData->activeFormationNames()->formationNames();
|
||||
std::vector<int> fnameIdxes;
|
||||
for ( int i = static_cast<int>( fnVector.size() ); i > 0; --i )
|
||||
fnameIdxes.push_back( i - 1 );
|
||||
|
||||
cvf::Color3ubArray legendBaseColors = RiaColorTables::categoryPaletteColors().color3ubArray();
|
||||
|
||||
cvf::ref<caf::CategoryMapper> formationColorMapper = new caf::CategoryMapper;
|
||||
formationColorMapper->setCategories( fnameIdxes );
|
||||
formationColorMapper->setInterpolateColors( legendBaseColors );
|
||||
|
||||
const std::map<std::pair<int, int>, int>& formationCombToCathegory =
|
||||
eclipseCaseData->allenDiagramData()->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 ) );
|
||||
}
|
||||
|
||||
for ( auto it = formationCombToCathegory.rbegin(); it != formationCombToCathegory.rend(); ++it )
|
||||
{
|
||||
int frmIdx1 = it->first.first;
|
||||
int frmIdx2 = it->first.second;
|
||||
int combIndex = it->second;
|
||||
|
||||
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(
|
||||
cvf::Color3f( 0.5f * ( formationColor1.r() + formationColor2.r() ),
|
||||
0.5f * ( formationColor1.g() + formationColor2.g() ),
|
||||
0.5f * ( formationColor1.b() + formationColor2.b() ) ) );
|
||||
categories.emplace_back( std::make_tuple( frmName1 + "-" + frmName2, combIndex, blendColor ) );
|
||||
}
|
||||
|
||||
legendConfigToUpdate->setCategoryItems( categories );
|
||||
}
|
||||
else if ( this->resultVariable() == RiaDefines::binaryAllenResultName() )
|
||||
{
|
||||
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::DYNAMIC_NATIVE &&
|
||||
this->resultVariable() == RiaDefines::completionTypeResultName() )
|
||||
{
|
||||
|
||||
@@ -958,6 +958,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
if ( rftCurveSet ) hasRftPlotParent = true;
|
||||
|
||||
bool isCategoryResult = false;
|
||||
bool isAllenDiagram = false;
|
||||
{
|
||||
RimEclipseCellColors* eclCellColors = nullptr;
|
||||
this->firstAncestorOrThisOfType( eclCellColors );
|
||||
@@ -978,6 +979,11 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
isCategoryResult = true;
|
||||
}
|
||||
|
||||
if ( eclCellColors && eclCellColors->resultType() == RiaDefines::ALLEN_DIAGRAMS )
|
||||
{
|
||||
isAllenDiagram = true;
|
||||
}
|
||||
}
|
||||
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
@@ -986,14 +992,17 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
// This is an app enum field, see cafInternalPdmFieldTypeSpecializations.h for the default specialization of this type
|
||||
std::vector<MappingType> mappingTypes;
|
||||
mappingTypes.push_back( LINEAR_DISCRETE );
|
||||
|
||||
if ( !crossPlotCurveSet )
|
||||
if ( !isAllenDiagram )
|
||||
{
|
||||
mappingTypes.push_back( LINEAR_CONTINUOUS );
|
||||
mappingTypes.push_back( LOG10_CONTINUOUS );
|
||||
mappingTypes.push_back( LINEAR_DISCRETE );
|
||||
|
||||
if ( !crossPlotCurveSet )
|
||||
{
|
||||
mappingTypes.push_back( LINEAR_CONTINUOUS );
|
||||
mappingTypes.push_back( LOG10_CONTINUOUS );
|
||||
}
|
||||
mappingTypes.push_back( LOG10_DISCRETE );
|
||||
}
|
||||
mappingTypes.push_back( LOG10_DISCRETE );
|
||||
|
||||
if ( isCategoryResult )
|
||||
{
|
||||
@@ -1009,27 +1018,30 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
// This is an app enum field, see cafInternalPdmFieldTypeSpecializations.h for the default specialization of this type
|
||||
std::vector<ColorRangesType> rangeTypes;
|
||||
if ( !hasEnsembleCurveSetParent && !hasRftPlotParent )
|
||||
if ( !isAllenDiagram )
|
||||
{
|
||||
rangeTypes.push_back( NORMAL );
|
||||
rangeTypes.push_back( OPPOSITE_NORMAL );
|
||||
rangeTypes.push_back( WHITE_PINK );
|
||||
rangeTypes.push_back( PINK_WHITE );
|
||||
rangeTypes.push_back( BLUE_WHITE_RED );
|
||||
rangeTypes.push_back( RED_WHITE_BLUE );
|
||||
rangeTypes.push_back( WHITE_BLACK );
|
||||
rangeTypes.push_back( BLACK_WHITE );
|
||||
rangeTypes.push_back( ANGULAR );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( const auto& col : ColorManager::EnsembleColorRanges() )
|
||||
if ( !hasEnsembleCurveSetParent && !hasRftPlotParent )
|
||||
{
|
||||
rangeTypes.push_back( col.first );
|
||||
rangeTypes.push_back( NORMAL );
|
||||
rangeTypes.push_back( OPPOSITE_NORMAL );
|
||||
rangeTypes.push_back( WHITE_PINK );
|
||||
rangeTypes.push_back( PINK_WHITE );
|
||||
rangeTypes.push_back( BLUE_WHITE_RED );
|
||||
rangeTypes.push_back( RED_WHITE_BLUE );
|
||||
rangeTypes.push_back( WHITE_BLACK );
|
||||
rangeTypes.push_back( BLACK_WHITE );
|
||||
rangeTypes.push_back( ANGULAR );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( const auto& col : ColorManager::EnsembleColorRanges() )
|
||||
{
|
||||
rangeTypes.push_back( col.first );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( hasStimPlanParent ) rangeTypes.push_back( STIMPLAN );
|
||||
if ( hasStimPlanParent ) rangeTypes.push_back( STIMPLAN );
|
||||
}
|
||||
|
||||
if ( isCategoryResult )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user