#5274 Add text to Result Info panel for Allen diagram data

Rename result variables to prepare for more Allen results
Rename methods to clarify meaning
This commit is contained in:
Jacob Støren 2020-01-02 12:46:38 +01:00
parent a42d5e9bc8
commit d074964901
6 changed files with 84 additions and 31 deletions

View File

@ -372,17 +372,17 @@ QString RiaDefines::completionTypeResultName()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaDefines::binaryAllenResultName()
QString RiaDefines::formationBinaryAllenResultName()
{
return "Binary Allen";
return "Binary Formation Allen";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaDefines::allCombinationsAllenResultName()
QString RiaDefines::formationAllenResultName()
{
return "All Allen Categories";
return "Formation Allen";
}
//--------------------------------------------------------------------------------------------------

View File

@ -106,8 +106,8 @@ QString mobilePoreVolumeName();
QString completionTypeResultName();
// Fault results
QString binaryAllenResultName();
QString allCombinationsAllenResultName();
QString formationBinaryAllenResultName();
QString formationAllenResultName();
// Mock model text identifiers
QString mockModelBasic();

View File

@ -1391,8 +1391,8 @@ 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() )
if ( this->resultVariable() == RiaDefines::formationAllenResultName() ||
this->resultVariable() == RiaDefines::formationBinaryAllenResultName() )
{
return true;
}
@ -1887,7 +1887,7 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
}
else if ( this->resultType() == RiaDefines::ALLEN_DIAGRAMS )
{
if ( this->resultVariable() == RiaDefines::allCombinationsAllenResultName() )
if ( this->resultVariable() == RiaDefines::formationAllenResultName() )
{
const std::vector<QString>& fnVector = eclipseCaseData->activeFormationNames()->formationNames();
std::vector<int> fnameIdxes;
@ -1931,7 +1931,7 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
legendConfigToUpdate->setCategoryItems( categories );
}
else if ( this->resultVariable() == RiaDefines::binaryAllenResultName() )
else if ( this->resultVariable() == RiaDefines::formationBinaryAllenResultName() )
{
std::vector<std::tuple<QString, int, cvf::Color3ub>> categories;
categories.emplace_back( std::make_tuple( "Same formation", 0, cvf::Color3ub::BROWN ) );

View File

@ -34,6 +34,19 @@ public:
return m_formationCombinationToCategory;
}
std::pair<int, int> formationIndexCombinationFromCategory( int category )
{
for ( auto it : m_formationCombinationToCategory )
{
if ( it.second == category )
{
return it.first;
}
}
return std::make_pair( -1, -1 );
}
void setFormationCombinationToCategorymap( const std::map<std::pair<int, int>, int>& mapping )
{
m_formationCombinationToCategory = mapping;

View File

@ -426,8 +426,8 @@ size_t RigCaseCellResultsData::findOrCreateScalarResultIndex( const RigEclipseRe
QString( "%1K" ).arg( baseName ) ) );
statisticsCalculator = calc;
}
else if ( resultName == RiaDefines::allCombinationsAllenResultName() ||
resultName == RiaDefines::binaryAllenResultName() )
else if ( resultName == RiaDefines::formationAllenResultName() ||
resultName == RiaDefines::formationBinaryAllenResultName() )
{
cvf::ref<RigEclipseAllenFaultsStatCalc> calc = new RigEclipseAllenFaultsStatCalc( m_ownerMainGrid->nncData(),
resVarAddr );
@ -913,11 +913,11 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
// Fault results
{
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ALLEN_DIAGRAMS,
RiaDefines::binaryAllenResultName() ),
RiaDefines::formationBinaryAllenResultName() ),
false );
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ALLEN_DIAGRAMS,
RiaDefines::allCombinationsAllenResultName() ),
RiaDefines::formationAllenResultName() ),
false );
}
@ -1227,8 +1227,8 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
{
computeRiTRANSbyAreaComponent( resultName );
}
else if ( resultName == RiaDefines::allCombinationsAllenResultName() ||
resultName == RiaDefines::binaryAllenResultName() )
else if ( resultName == RiaDefines::formationAllenResultName() ||
resultName == RiaDefines::formationBinaryAllenResultName() )
{
computeAllenResults( this, m_ownerMainGrid );
}
@ -3008,32 +3008,32 @@ void RigCaseCellResultsData::computeAllenResults( RigCaseCellResultsData* cellRe
if ( hasFormationData )
{
auto fnAllenResultResAddr = RigEclipseResultAddress( RiaDefines::ALLEN_DIAGRAMS,
RiaDefines::allCombinationsAllenResultName() );
RiaDefines::formationAllenResultName() );
auto fnBinAllenResAddr = RigEclipseResultAddress( RiaDefines::ALLEN_DIAGRAMS,
RiaDefines::binaryAllenResultName() );
RiaDefines::formationBinaryAllenResultName() );
// Create and retreive nnc result arrays
std::vector<double>& fnAllenNncResults = mainGrid->nncData()->makeStaticConnectionScalarResult(
RiaDefines::allCombinationsAllenResultName() );
RiaDefines::formationAllenResultName() );
std::vector<double>& fnBinAllenNncResults = mainGrid->nncData()->makeStaticConnectionScalarResult(
RiaDefines::binaryAllenResultName() );
RiaDefines::formationBinaryAllenResultName() );
// Associate them with eclipse result address
mainGrid->nncData()->setEclResultAddress( RiaDefines::allCombinationsAllenResultName(), fnAllenResultResAddr );
mainGrid->nncData()->setEclResultAddress( RiaDefines::binaryAllenResultName(), fnBinAllenResAddr );
mainGrid->nncData()->setEclResultAddress( RiaDefines::formationAllenResultName(), fnAllenResultResAddr );
mainGrid->nncData()->setEclResultAddress( RiaDefines::formationBinaryAllenResultName(), fnBinAllenResAddr );
const std::vector<double>& fnData = cellResultsData->cellScalarResults( fnNamesResAddr, 0 );
// Add a result entry for the special allen grid data (used only for the grid cells without nnc coverage)
cellResultsData->addStaticScalarResult( RiaDefines::ALLEN_DIAGRAMS,
RiaDefines::allCombinationsAllenResultName(),
RiaDefines::formationAllenResultName(),
false,
fnData.size() );
cellResultsData->addStaticScalarResult( RiaDefines::ALLEN_DIAGRAMS,
RiaDefines::binaryAllenResultName(),
RiaDefines::formationBinaryAllenResultName(),
false,
fnData.size() );

View File

@ -40,6 +40,7 @@
#include "RivExtrudedCurveIntersectionPartMgr.h"
#include "RigAllenDiagramData.h"
#include "RimIntersectionResultDefinition.h"
#include "cafDisplayCoordTransform.h"
@ -321,13 +322,17 @@ QString RiuResultTextBuilder::faultResultDetails()
if ( m_viewWithFaultsSettings && m_viewWithFaultsSettings->faultResultSettings()->hasValidCustomResult() )
{
text += "Fault result data:\n";
this->appendTextFromResultColors( eclipseCaseData,
m_gridIndex,
m_cellIndex,
m_timeStepIndex,
m_viewWithFaultsSettings->currentFaultResultColors(),
&text );
if ( m_viewWithFaultsSettings->faultResultSettings()->customFaultResult()->resultType() !=
RiaDefines::ALLEN_DIAGRAMS )
{
text += "Fault result data:\n";
this->appendTextFromResultColors( eclipseCaseData,
m_gridIndex,
m_cellIndex,
m_timeStepIndex,
m_viewWithFaultsSettings->currentFaultResultColors(),
&text );
}
}
}
}
@ -472,6 +477,41 @@ QString RiuResultTextBuilder::nncResultText()
text = QString( "%1 : %2" ).arg( resultVar ).arg( scalarValue );
}
if ( resultType == RiaDefines::ALLEN_DIAGRAMS )
{
nncValues = nncData->staticConnectionScalarResult( eclipseResultAddress );
QString resultValueText;
if ( m_viewWithFaultsSettings->currentFaultResultColors()->resultVariable() ==
RiaDefines::formationAllenResultName() )
{
std::pair<int, int> fmIndexPair =
eclipseCase->allenDiagramData()->formationIndexCombinationFromCategory(
( *nncValues )[m_nncIndex] );
RigFormationNames* fmNames = eclipseCase->activeFormationNames();
// clang-format off
if ( fmNames &&
fmIndexPair.first >= 0 &&
fmIndexPair.second >= 0 &&
fmNames->formationNames().size() > fmIndexPair.first &&
fmNames->formationNames().size() > fmIndexPair.second )
{
resultValueText = fmNames->formationNames()[fmIndexPair.first] + " - " +
fmNames->formationNames()[fmIndexPair.second];
}
// clang-format on
}
else if ( m_viewWithFaultsSettings->currentFaultResultColors()->resultVariable() ==
RiaDefines::formationBinaryAllenResultName() )
{
resultValueText = ( *nncValues )[m_nncIndex] == 0 ? "Same formation" : "Different formation";
}
QString resultVar = m_viewWithFaultsSettings->currentFaultResultColors()->resultVariableUiName();
text = QString( "%1 : %2" ).arg( resultVar ).arg( resultValueText );
}
}
}
}