Add support for summary cross plot curves in summary plots

This commit is contained in:
Magne Sjaastad
2023-09-20 09:48:03 +02:00
parent b87fa0bc74
commit 146412c600
44 changed files with 970 additions and 440 deletions

View File

@@ -32,6 +32,7 @@ using namespace RifEclipseSummaryAddressDefines;
///
//--------------------------------------------------------------------------------------------------
RiaSummaryAddressAnalyzer::RiaSummaryAddressAnalyzer()
: m_onlyCrossPlotCurves( false )
{
}
@@ -57,6 +58,23 @@ void RiaSummaryAddressAnalyzer::appendAddresses( const std::set<RifEclipseSummar
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryAddressAnalyzer::appendAddresses( const std::vector<RiaSummaryCurveAddress>& addresses )
{
// RiaSummaryCurveAddress can be used to represent cross plot curves. Set the flag m_onlyCrossPlotCurves to true, and this will be set
// to false in analyzeSingleAddress if we detect a time curve
m_onlyCrossPlotCurves = true;
for ( const auto& adr : addresses )
{
analyzeSingleAddress( adr.summaryAddressX() );
analyzeSingleAddress( adr.summaryAddressY() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -100,6 +118,14 @@ bool RiaSummaryAddressAnalyzer::isSingleQuantityIgnoreHistory() const
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaSummaryAddressAnalyzer::onlyCrossPlotCurves() const
{
return m_onlyCrossPlotCurves;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -110,6 +136,20 @@ std::string RiaSummaryAddressAnalyzer::quantityNameForTitle() const
return *quantities().begin();
}
if ( quantities().size() == 2 && m_onlyCrossPlotCurves )
{
// We have a cross plot with only one curve
std::string title;
for ( const auto& quantity : quantities() )
{
if ( !title.empty() ) title += " | ";
title += quantity;
}
return title;
}
if ( quantities().size() == 2 && quantityNamesWithHistory().size() == 1 )
{
return *quantityNamesWithHistory().begin();
@@ -429,6 +469,14 @@ void RiaSummaryAddressAnalyzer::computeQuantityNamesWithHistory() const
//--------------------------------------------------------------------------------------------------
void RiaSummaryAddressAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddress& address )
{
if ( address.category() == SummaryCategory::SUMMARY_TIME )
{
m_onlyCrossPlotCurves = false;
// A time address has no other information than SummaryCategory::SUMMARY_TIME
return;
}
const std::string& wellName = address.wellName();
if ( !wellName.empty() )

View File

@@ -18,6 +18,7 @@
#pragma once
#include "RiaSummaryCurveAddress.h"
#include "RifEclipseSummaryAddress.h"
#include <set>
@@ -39,6 +40,7 @@ public:
void appendAddresses( const std::set<RifEclipseSummaryAddress>& allAddresses );
void appendAddresses( const std::vector<RifEclipseSummaryAddress>& allAddresses );
void appendAddresses( const std::vector<RiaSummaryCurveAddress>& addresses );
void clear();
@@ -48,6 +50,8 @@ public:
bool isSingleQuantityIgnoreHistory() const;
bool onlyCrossPlotCurves() const;
std::string quantityNameForTitle() const;
std::set<std::string> wellNames() const;
@@ -104,4 +108,6 @@ private:
std::multimap<int, RifEclipseSummaryAddress> m_aquifers;
std::map<RifEclipseSummaryAddressDefines::SummaryCategory, std::set<std::string>> m_categories;
bool m_onlyCrossPlotCurves;
};

View File

@@ -354,3 +354,26 @@ QList<caf::PdmOptionItemInfo> RiaSummaryTools::optionsForSummaryCases( const std
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryTools::copyCurveDataSources( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve )
{
curve.setSummaryAddressX( otherCurve.summaryAddressX() );
curve.setSummaryCaseX( otherCurve.summaryCaseX() );
curve.setSummaryAddressY( otherCurve.summaryAddressY() );
curve.setSummaryCaseY( otherCurve.summaryCaseY() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryTools::copyCurveAxisData( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve )
{
curve.setAxisTypeX( otherCurve.axisTypeX() );
curve.setTopOrBottomAxisX( otherCurve.axisX() );
curve.setLeftOrRightAxisY( otherCurve.axisY() );
}

View File

@@ -36,6 +36,7 @@ class RimSummaryCaseCollection;
class RimSummaryTable;
class RimSummaryTableCollection;
class RimObservedDataCollection;
class RimSummaryCurve;
class RifEclipseSummaryAddress;
@@ -88,4 +89,7 @@ public:
static QList<caf::PdmOptionItemInfo> optionsForAllSummaryCases();
static QList<caf::PdmOptionItemInfo> optionsForSummaryCases( const std::vector<RimSummaryCase*>& cases );
static void copyCurveDataSources( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve );
static void copyCurveAxisData( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve );
};