mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2170 Summary Cross Plot : Improve computation of summary case set
This commit is contained in:
parent
b8f8b2bc16
commit
7f31c245ae
@ -32,25 +32,6 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiaSummaryCurveAnalyzer::RiaSummaryCurveAnalyzer() {}
|
RiaSummaryCurveAnalyzer::RiaSummaryCurveAnalyzer() {}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RiaSummaryCurveAnalyzer::analyzeCurves(const RimSummaryCurveCollection* sumCurveCollection)
|
|
||||||
{
|
|
||||||
clearAllSets();
|
|
||||||
|
|
||||||
if (!sumCurveCollection)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (auto curve : sumCurveCollection->curves())
|
|
||||||
{
|
|
||||||
m_summaryCases.insert(curve->summaryCaseY());
|
|
||||||
|
|
||||||
auto adr = curve->summaryAddressY();
|
|
||||||
analyzeAddress(adr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -65,7 +46,7 @@ void RiaSummaryCurveAnalyzer::analyzeAdresses(const std::vector<RifEclipseSummar
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaSummaryCurveAnalyzer::analyzeAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses)
|
void RiaSummaryCurveAnalyzer::analyzeAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses)
|
||||||
{
|
{
|
||||||
@ -112,14 +93,6 @@ std::set<int> RiaSummaryCurveAnalyzer::regionNumbers() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::set<RimSummaryCase*> RiaSummaryCurveAnalyzer::summaryCases() const
|
|
||||||
{
|
|
||||||
return m_summaryCases;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> RiaSummaryCurveAnalyzer::categories() const
|
std::set<RifEclipseSummaryAddress::SummaryVarCategory> RiaSummaryCurveAnalyzer::categories() const
|
||||||
{
|
{
|
||||||
return m_categories;
|
return m_categories;
|
||||||
@ -158,9 +131,11 @@ std::set<QString> RiaSummaryCurveAnalyzer::identifierTexts(RifEclipseSummaryAddr
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RifEclipseSummaryAddress> RiaSummaryCurveAnalyzer::addressesForCategory(const std::vector<RifEclipseSummaryAddress>& addresses, RifEclipseSummaryAddress::SummaryVarCategory category)
|
std::vector<RifEclipseSummaryAddress>
|
||||||
|
RiaSummaryCurveAnalyzer::addressesForCategory(const std::vector<RifEclipseSummaryAddress>& addresses,
|
||||||
|
RifEclipseSummaryAddress::SummaryVarCategory category)
|
||||||
{
|
{
|
||||||
std::vector<RifEclipseSummaryAddress> filteredAddresses;
|
std::vector<RifEclipseSummaryAddress> filteredAddresses;
|
||||||
|
|
||||||
@ -184,7 +159,6 @@ void RiaSummaryCurveAnalyzer::clearAllSets()
|
|||||||
m_wellNames.clear();
|
m_wellNames.clear();
|
||||||
m_wellGroupNames.clear();
|
m_wellGroupNames.clear();
|
||||||
m_regionNumbers.clear();
|
m_regionNumbers.clear();
|
||||||
m_summaryCases.clear();
|
|
||||||
m_categories.clear();
|
m_categories.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class RimSummaryCurveCollection;
|
class RimSummaryCurveCollection;
|
||||||
class RimSummaryCase;
|
|
||||||
|
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
@ -37,7 +36,6 @@ class RiaSummaryCurveAnalyzer
|
|||||||
public:
|
public:
|
||||||
RiaSummaryCurveAnalyzer();
|
RiaSummaryCurveAnalyzer();
|
||||||
|
|
||||||
void analyzeCurves(const RimSummaryCurveCollection* sumCurveCollection);
|
|
||||||
void analyzeAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses);
|
void analyzeAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses);
|
||||||
void analyzeAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses);
|
void analyzeAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses);
|
||||||
|
|
||||||
@ -46,7 +44,6 @@ public:
|
|||||||
std::set<std::string> wellGroupNames() const;
|
std::set<std::string> wellGroupNames() const;
|
||||||
|
|
||||||
std::set<int> regionNumbers() const;
|
std::set<int> regionNumbers() const;
|
||||||
std::set<RimSummaryCase*> summaryCases() const;
|
|
||||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> categories() const;
|
std::set<RifEclipseSummaryAddress::SummaryVarCategory> categories() const;
|
||||||
|
|
||||||
std::set<QString> identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const;
|
std::set<QString> identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const;
|
||||||
@ -63,7 +60,6 @@ private:
|
|||||||
std::set<std::string> m_wellNames;
|
std::set<std::string> m_wellNames;
|
||||||
std::set<std::string> m_wellGroupNames;
|
std::set<std::string> m_wellGroupNames;
|
||||||
std::set<int> m_regionNumbers;
|
std::set<int> m_regionNumbers;
|
||||||
std::set<RimSummaryCase*> m_summaryCases;
|
|
||||||
|
|
||||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> m_categories;
|
std::set<RifEclipseSummaryAddress::SummaryVarCategory> m_categories;
|
||||||
};
|
};
|
||||||
|
@ -281,7 +281,16 @@ QString RimSummaryCurveCollection::compileAutoPlotTitle() const
|
|||||||
{
|
{
|
||||||
RiaSummaryCurveAnalyzer analyzer;
|
RiaSummaryCurveAnalyzer analyzer;
|
||||||
|
|
||||||
analyzer.analyzeCurves(this);
|
std::set<RifEclipseSummaryAddress> addresses;
|
||||||
|
for (auto c : m_curves)
|
||||||
|
{
|
||||||
|
addresses.insert(c->summaryAddressY());
|
||||||
|
|
||||||
|
// TODO : Improve how cross plot curves contribute to title
|
||||||
|
// Suggestion : Delegate to RimSummaryPlotSourceStepping to find title
|
||||||
|
}
|
||||||
|
|
||||||
|
analyzer.analyzeAdresses(addresses);
|
||||||
|
|
||||||
auto quantities = analyzer.quantities();
|
auto quantities = analyzer.quantities();
|
||||||
auto wellNames = analyzer.wellNames();
|
auto wellNames = analyzer.wellNames();
|
||||||
|
@ -169,10 +169,8 @@ std::vector<caf::PdmFieldHandle*> RimSummaryPlotSourceStepping::fieldsToShowInTo
|
|||||||
{
|
{
|
||||||
std::vector<caf::PdmFieldHandle*> fields;
|
std::vector<caf::PdmFieldHandle*> fields;
|
||||||
|
|
||||||
RiaSummaryCurveAnalyzer analyzer;
|
auto sumCases = allSummaryCasesUsedInCurveCollection();
|
||||||
analyzer.analyzeAdresses(allAddressesUsedInCurveCollection());
|
if (sumCases.size() == 1)
|
||||||
|
|
||||||
if (analyzer.summaryCases().size() == 1)
|
|
||||||
{
|
{
|
||||||
RimProject* proj = RiaApplication::instance()->project();
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
if (proj->allSummaryCases().size() > 1)
|
if (proj->allSummaryCases().size() > 1)
|
||||||
@ -181,6 +179,9 @@ std::vector<caf::PdmFieldHandle*> RimSummaryPlotSourceStepping::fieldsToShowInTo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RiaSummaryCurveAnalyzer analyzer;
|
||||||
|
analyzer.analyzeAdresses(allAddressesUsedInCurveCollection());
|
||||||
|
|
||||||
if (analyzer.wellNames().size() == 1)
|
if (analyzer.wellNames().size() == 1)
|
||||||
{
|
{
|
||||||
fields.push_back(&m_wellName);
|
fields.push_back(&m_wellName);
|
||||||
@ -237,22 +238,19 @@ QList<caf::PdmOptionItemInfo> RimSummaryPlotSourceStepping::calculateValueOption
|
|||||||
RifSummaryReaderInterface* reader = summaryReader();
|
RifSummaryReaderInterface* reader = summaryReader();
|
||||||
if (reader)
|
if (reader)
|
||||||
{
|
{
|
||||||
const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
|
RiaSummaryCurveAnalyzer* analyzer = analyzerForReader(reader);
|
||||||
|
|
||||||
RiaSummaryCurveAnalyzer analyzer;
|
|
||||||
analyzer.analyzeAdresses(allAddresses);
|
|
||||||
|
|
||||||
if (fieldNeedingOptions == &m_wellName)
|
if (fieldNeedingOptions == &m_wellName)
|
||||||
{
|
{
|
||||||
identifierTexts = analyzer.identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL);
|
identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL);
|
||||||
}
|
}
|
||||||
else if (fieldNeedingOptions == &m_region)
|
else if (fieldNeedingOptions == &m_region)
|
||||||
{
|
{
|
||||||
identifierTexts = analyzer.identifierTexts(RifEclipseSummaryAddress::SUMMARY_REGION);
|
identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_REGION);
|
||||||
}
|
}
|
||||||
else if (fieldNeedingOptions == &m_wellGroupName)
|
else if (fieldNeedingOptions == &m_wellGroupName)
|
||||||
{
|
{
|
||||||
identifierTexts = analyzer.identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL_GROUP);
|
identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL_GROUP);
|
||||||
}
|
}
|
||||||
else if (fieldNeedingOptions == &m_quantity)
|
else if (fieldNeedingOptions == &m_quantity)
|
||||||
{
|
{
|
||||||
@ -268,7 +266,7 @@ QList<caf::PdmOptionItemInfo> RimSummaryPlotSourceStepping::calculateValueOption
|
|||||||
|
|
||||||
RiaSummaryCurveAnalyzer quantityAnalyzer;
|
RiaSummaryCurveAnalyzer quantityAnalyzer;
|
||||||
|
|
||||||
auto subset = RiaSummaryCurveAnalyzer::addressesForCategory(allAddresses, category);
|
auto subset = RiaSummaryCurveAnalyzer::addressesForCategory(reader->allResultAddresses(), category);
|
||||||
quantityAnalyzer.analyzeAdresses(subset);
|
quantityAnalyzer.analyzeAdresses(subset);
|
||||||
|
|
||||||
for (const auto& quantity : quantityAnalyzer.quantities())
|
for (const auto& quantity : quantityAnalyzer.quantities())
|
||||||
@ -502,16 +500,9 @@ void RimSummaryPlotSourceStepping::updateUiFromCurves()
|
|||||||
m_region.uiCapability()->setUiHidden(true);
|
m_region.uiCapability()->setUiHidden(true);
|
||||||
m_quantity.uiCapability()->setUiHidden(true);
|
m_quantity.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
auto sumCases = allSummaryCasesUsedInCurveCollection();
|
||||||
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
if (sumCases.size() == 1)
|
||||||
|
|
||||||
RiaSummaryCurveAnalyzer analyzer;
|
|
||||||
analyzer.analyzeAdresses(allAddressesUsedInCurveCollection());
|
|
||||||
|
|
||||||
if (analyzer.summaryCases().size() == 1)
|
|
||||||
{
|
{
|
||||||
std::set<RimSummaryCase*> sumCases = analyzer.summaryCases();
|
|
||||||
|
|
||||||
if (sumCases.find(m_summaryCase) == sumCases.end())
|
if (sumCases.find(m_summaryCase) == sumCases.end())
|
||||||
{
|
{
|
||||||
m_summaryCase = *(sumCases.begin());
|
m_summaryCase = *(sumCases.begin());
|
||||||
@ -524,6 +515,9 @@ void RimSummaryPlotSourceStepping::updateUiFromCurves()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RiaSummaryCurveAnalyzer analyzer;
|
||||||
|
analyzer.analyzeAdresses(allAddressesUsedInCurveCollection());
|
||||||
|
|
||||||
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID;
|
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID;
|
||||||
{
|
{
|
||||||
if (analyzer.categories().size() == 1)
|
if (analyzer.categories().size() == 1)
|
||||||
@ -593,7 +587,8 @@ caf::PdmFieldHandle* RimSummaryPlotSourceStepping::fieldToModify()
|
|||||||
|
|
||||||
// A pointer field is no a value field, so this must be improved
|
// A pointer field is no a value field, so this must be improved
|
||||||
// to be able to step between summary cases
|
// to be able to step between summary cases
|
||||||
if (analyzer.summaryCases().size() == 1)
|
auto sumCases = allSummaryCasesUsedInCurveCollection();
|
||||||
|
if (sumCases.size() == 1)
|
||||||
{
|
{
|
||||||
RimProject* proj = RiaApplication::instance()->project();
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
if (proj->allSummaryCases().size() > 1)
|
if (proj->allSummaryCases().size() > 1)
|
||||||
@ -616,7 +611,7 @@ caf::PdmValueField* RimSummaryPlotSourceStepping::valueFieldToModify()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::set<RifEclipseSummaryAddress> RimSummaryPlotSourceStepping::allAddressesUsedInCurveCollection() const
|
std::set<RifEclipseSummaryAddress> RimSummaryPlotSourceStepping::allAddressesUsedInCurveCollection() const
|
||||||
{
|
{
|
||||||
@ -642,6 +637,33 @@ std::set<RifEclipseSummaryAddress> RimSummaryPlotSourceStepping::allAddressesUse
|
|||||||
return addresses;
|
return addresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<RimSummaryCase*> RimSummaryPlotSourceStepping::allSummaryCasesUsedInCurveCollection() const
|
||||||
|
{
|
||||||
|
std::set<RimSummaryCase*> sumCases;
|
||||||
|
|
||||||
|
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
||||||
|
|
||||||
|
auto curves = curveCollection->curves();
|
||||||
|
for (auto c : curves)
|
||||||
|
{
|
||||||
|
if (isYAxisStepping())
|
||||||
|
{
|
||||||
|
sumCases.insert(c->summaryCaseY());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isXAxisStepping())
|
||||||
|
{
|
||||||
|
sumCases.insert(c->summaryCaseX());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sumCases;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -670,6 +692,25 @@ bool RimSummaryPlotSourceStepping::isYAxisStepping() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiaSummaryCurveAnalyzer* RimSummaryPlotSourceStepping::analyzerForReader(RifSummaryReaderInterface* reader)
|
||||||
|
{
|
||||||
|
if (!reader)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if (m_curveAnalyzerForReader.first != reader)
|
||||||
|
{
|
||||||
|
RiaSummaryCurveAnalyzer analyzer;
|
||||||
|
m_curveAnalyzerForReader = std::make_pair(reader, analyzer);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_curveAnalyzerForReader.second.analyzeAdresses(reader->allResultAddresses());
|
||||||
|
|
||||||
|
return &m_curveAnalyzerForReader.second;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "RiaSummaryCurveAnalyzer.h"
|
||||||
#include "RifEclipseSummaryAddress.h"
|
#include "RifEclipseSummaryAddress.h"
|
||||||
|
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
@ -77,10 +78,13 @@ private:
|
|||||||
caf::PdmValueField* valueFieldToModify();
|
caf::PdmValueField* valueFieldToModify();
|
||||||
|
|
||||||
std::set<RifEclipseSummaryAddress> allAddressesUsedInCurveCollection() const;
|
std::set<RifEclipseSummaryAddress> allAddressesUsedInCurveCollection() const;
|
||||||
|
std::set<RimSummaryCase*> allSummaryCasesUsedInCurveCollection() const;
|
||||||
|
|
||||||
bool isXAxisStepping() const;
|
bool isXAxisStepping() const;
|
||||||
bool isYAxisStepping() const;
|
bool isYAxisStepping() const;
|
||||||
|
|
||||||
|
RiaSummaryCurveAnalyzer* analyzerForReader(RifSummaryReaderInterface* reader);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
|
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
|
||||||
caf::PdmField<QString> m_wellName;
|
caf::PdmField<QString> m_wellName;
|
||||||
@ -88,4 +92,6 @@ private:
|
|||||||
caf::PdmField<int> m_region;
|
caf::PdmField<int> m_region;
|
||||||
caf::PdmField<QString> m_quantity;
|
caf::PdmField<QString> m_quantity;
|
||||||
SourceSteppingType m_sourceSteppingType;
|
SourceSteppingType m_sourceSteppingType;
|
||||||
|
|
||||||
|
std::pair<RifSummaryReaderInterface*, RiaSummaryCurveAnalyzer> m_curveAnalyzerForReader;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user