mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve grid cell calculator
* Use full name for grid case view * FIx signed / unsigned issue * Support drag/drop of file names into Main Window * Add function to check if two grid cases are of equal size * Result Info: Show cell result text for all linked views * Improve how to specify cells to be included in calculation - move view filter to calculation - improve how to assign values to non-visible cells - avoid computation between grids of different size Closes #9482
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include "RimIntersectionResultDefinition.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
||||
|
||||
@@ -287,17 +288,18 @@ QString RiuResultTextBuilder::gridResultDetails()
|
||||
|
||||
std::vector<std::unique_ptr<RimEclipseResultDefinition>> tmp;
|
||||
|
||||
QStringList additionalCellResultText;
|
||||
resultDefinitions.push_back( m_eclResDef );
|
||||
if ( m_eclipseView )
|
||||
{
|
||||
auto additionalResults = m_eclipseView->additionalResultsForResultInfo();
|
||||
std::vector<RigEclipseResultAddress> resultAddresses = m_eclipseView->additionalResultsForResultInfo();
|
||||
|
||||
for ( const auto& resultName : additionalResults )
|
||||
for ( const auto& result : resultAddresses )
|
||||
{
|
||||
auto myResDef = std::make_unique<RimEclipseResultDefinition>();
|
||||
myResDef->setEclipseCase( m_eclResDef->eclipseCase() );
|
||||
myResDef->simpleCopy( m_eclResDef );
|
||||
myResDef->setFromEclipseResultAddress( resultName );
|
||||
myResDef->setFromEclipseResultAddress( result );
|
||||
myResDef->loadResult();
|
||||
|
||||
resultDefinitions.push_back( myResDef.get() );
|
||||
@@ -305,7 +307,19 @@ QString RiuResultTextBuilder::gridResultDetails()
|
||||
}
|
||||
}
|
||||
|
||||
QString text = cellResultText( resultDefinitions );
|
||||
const auto [hasMultipleCases, linkedViewText] = resultTextFromLinkedViews();
|
||||
QString text = cellResultText( resultDefinitions, hasMultipleCases );
|
||||
|
||||
for ( const auto& txt : additionalCellResultText )
|
||||
{
|
||||
text += "\n" + txt;
|
||||
}
|
||||
|
||||
for ( const auto& txt : linkedViewText )
|
||||
{
|
||||
text += "\n" + txt;
|
||||
}
|
||||
|
||||
if ( !text.isEmpty() )
|
||||
{
|
||||
text.prepend( "-- Grid cell result details --\n" );
|
||||
@@ -740,6 +754,44 @@ void RiuResultTextBuilder::appendTextFromResultColors( RigEclipseCaseData*
|
||||
resultInfoText->append( cellResultText( { resultColors } ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<bool, QStringList> RiuResultTextBuilder::resultTextFromLinkedViews() const
|
||||
{
|
||||
if ( !m_eclipseView || !m_eclipseView->assosiatedViewLinker() ) return {};
|
||||
|
||||
QStringList additionalCellResultText;
|
||||
bool hasMultipleCases = false;
|
||||
RimEclipseCase* primaryEclipseCase = m_eclipseView->eclipseCase();
|
||||
|
||||
auto views = m_eclipseView->assosiatedViewLinker()->allViews();
|
||||
for ( auto view : views )
|
||||
{
|
||||
auto eclView = dynamic_cast<RimEclipseView*>( view );
|
||||
if ( !eclView || eclView == m_eclipseView ) continue;
|
||||
|
||||
// Match on IJK size, as the cell index is used to identify the grid cell to extract the result from
|
||||
auto otherEclipseCase = eclView->eclipseCase();
|
||||
if ( !primaryEclipseCase->isGridSizeEqualTo( otherEclipseCase ) ) continue;
|
||||
|
||||
RiuResultTextBuilder textBuilder( eclView, eclView->cellResult(), m_cellIndex, m_timeStepIndex );
|
||||
auto text = textBuilder.gridResultText();
|
||||
|
||||
if ( primaryEclipseCase != otherEclipseCase )
|
||||
{
|
||||
hasMultipleCases = true;
|
||||
|
||||
auto caseName = otherEclipseCase->caseUserDescription();
|
||||
text += "( " + caseName + " )";
|
||||
}
|
||||
|
||||
additionalCellResultText.push_back( text );
|
||||
}
|
||||
|
||||
return { hasMultipleCases, additionalCellResultText };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -895,7 +947,8 @@ void RiuResultTextBuilder::appendDetails( QString& text, const QString& details
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuResultTextBuilder::cellResultText( const std::vector<RimEclipseResultDefinition*>& resultDefinitions )
|
||||
QString RiuResultTextBuilder::cellResultText( const std::vector<RimEclipseResultDefinition*>& resultDefinitions,
|
||||
bool appendCaseName )
|
||||
{
|
||||
std::map<QString, QString> keyValues;
|
||||
|
||||
@@ -915,6 +968,12 @@ QString RiuResultTextBuilder::cellResultText( const std::vector<RimEclipseResult
|
||||
{
|
||||
if ( !text.isEmpty() ) text += "\n";
|
||||
text += QString( "%1 : %2" ).arg( key, -maxKeyLength ).arg( value );
|
||||
|
||||
if ( appendCaseName && m_eclipseView && m_eclipseView->eclipseCase() )
|
||||
{
|
||||
auto caseName = m_eclipseView->eclipseCase()->caseUserDescription();
|
||||
text += "( " + caseName + " )";
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
@@ -1070,7 +1129,8 @@ QString RiuResultTextBuilder::wellResultText()
|
||||
wellResultFrame->findResultCellWellHeadIncluded( m_gridIndex, m_cellIndex );
|
||||
if ( wellResultCell )
|
||||
{
|
||||
text += QString( "-- Well-cell connection info --\n Well Name: %1\n Branch Id: %2\n Segment Id: %3\n" )
|
||||
text += QString( "-- Well-cell connection info --\n Well Name: %1\n Branch Id: %2\n Segment "
|
||||
"Id: %3\n" )
|
||||
.arg( singleWellResultData->m_wellName )
|
||||
.arg( wellResultCell->m_ertBranchId )
|
||||
.arg( wellResultCell->m_ertSegmentId );
|
||||
|
||||
Reference in New Issue
Block a user