#4483 Summary Plot: Data source for well segment number and completions

This commit is contained in:
Magne Sjaastad
2019-08-05 21:53:48 +02:00
parent a9ee69587d
commit ec1cf83b4e
10 changed files with 488 additions and 121 deletions

View File

@@ -117,6 +117,24 @@ QString RimSummaryPlotNameHelper::plotTitle() const
title += "Region : " + QString::fromStdString(m_titleRegion);
}
if (!m_titleBlock.empty())
{
if (!title.isEmpty()) title += ", ";
title += "Block : " + QString::fromStdString(m_titleBlock);
}
if (!m_titleSegment.empty())
{
if (!title.isEmpty()) title += ", ";
title += "Segment : " + QString::fromStdString(m_titleSegment);
}
if (!m_titleCompletion.empty())
{
if (!title.isEmpty()) title += ", ";
title += "Completion : " + QString::fromStdString(m_titleCompletion);
}
if (!m_titleQuantity.empty())
{
if (!title.isEmpty()) title += ", ";
@@ -171,6 +189,30 @@ bool RimSummaryPlotNameHelper::isCaseInTitle() const
return !m_titleCaseName.isEmpty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSummaryPlotNameHelper::isBlockInTitle() const
{
return !m_titleBlock.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSummaryPlotNameHelper::isSegmentInTitle() const
{
return !m_titleSegment.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSummaryPlotNameHelper::isCompletionInTitle() const
{
return !m_titleCompletion.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -180,6 +222,9 @@ void RimSummaryPlotNameHelper::clearTitleSubStrings()
m_titleRegion.clear();
m_titleWellName.clear();
m_titleRegion.clear();
m_titleBlock.clear();
m_titleSegment.clear();
m_titleCompletion.clear();
m_titleCaseName.clear();
}
@@ -195,6 +240,7 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings()
auto wellNames = m_analyzer.wellNames();
auto wellGroupNames = m_analyzer.wellGroupNames();
auto regions = m_analyzer.regionNumbers();
auto blocks = m_analyzer.blocks();
auto categories = m_analyzer.categories();
if (categories.size() == 1)
@@ -207,6 +253,22 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings()
if (wellNames.size() == 1)
{
m_titleWellName = *(wellNames.begin());
{
auto segments = m_analyzer.wellSegmentNumbers(m_titleWellName);
if (segments.size() == 1)
{
m_titleSegment = std::to_string(*(segments.begin()));
}
}
{
auto completions = m_analyzer.wellCompletions(m_titleWellName);
if (completions.size() == 1)
{
m_titleCompletion = *(completions.begin());
}
}
}
if (wellGroupNames.size() == 1)
@@ -218,9 +280,14 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings()
{
m_titleRegion = std::to_string(*(regions.begin()));
}
if (blocks.size() == 1)
{
m_titleBlock = *(blocks.begin());
}
}
auto summaryCases = setOfSummaryCases();
auto summaryCases = setOfSummaryCases();
auto ensembleCases = setOfEnsembleCases();
if (summaryCases.size() == 1 && ensembleCases.empty())
@@ -243,7 +310,7 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::set<RimSummaryCase*> RimSummaryPlotNameHelper::setOfSummaryCases() const
{
@@ -258,7 +325,7 @@ std::set<RimSummaryCase*> RimSummaryPlotNameHelper::setOfSummaryCases() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::set<RimSummaryCaseCollection*> RimSummaryPlotNameHelper::setOfEnsembleCases() const
{

View File

@@ -54,6 +54,9 @@ public:
bool isWellGroupNameInTitle() const;
bool isRegionInTitle() const;
bool isCaseInTitle() const;
bool isBlockInTitle() const;
bool isSegmentInTitle() const;
bool isCompletionInTitle() const;
private:
void clearTitleSubStrings();
@@ -73,6 +76,9 @@ private:
std::string m_titleWellName;
std::string m_titleWellGroupName;
std::string m_titleRegion;
std::string m_titleBlock;
std::string m_titleSegment;
std::string m_titleCompletion;
QString m_titleCaseName;
};

View File

@@ -67,7 +67,11 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping()
CAF_PDM_InitFieldNoDefault(&m_wellGroupName, "GroupName", "Group Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_region, "Region", "Region", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_quantity, "Quantities", "Quantity", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_cellBlock, "CellBlock", "Block", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_segment, "Segment", "Segment", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_completion, "Completion", "Completion", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_ensemble, "Ensemble", "Ensemble", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_placeholderForLabel, "Placeholder", "", "", "", "");
@@ -284,6 +288,7 @@ QList<caf::PdmOptionItemInfo> RimSummaryPlotSourceStepping::calculateValueOption
else
{
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID;
std::string secondaryIdentifier;
if (fieldNeedingOptions == &m_wellName)
{
@@ -297,8 +302,22 @@ QList<caf::PdmOptionItemInfo> RimSummaryPlotSourceStepping::calculateValueOption
{
category = RifEclipseSummaryAddress::SUMMARY_WELL_GROUP;
}
else if (fieldNeedingOptions == &m_cellBlock)
{
category = RifEclipseSummaryAddress::SUMMARY_BLOCK;
}
else if (fieldNeedingOptions == &m_segment)
{
secondaryIdentifier = m_wellName().toStdString();
category = RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT;
}
else if (fieldNeedingOptions == &m_completion)
{
secondaryIdentifier = m_wellName().toStdString();
category = RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION;
}
std::set<QString> identifierTexts;
std::vector<QString> identifierTexts;
if (category != RifEclipseSummaryAddress::SUMMARY_INVALID)
{
@@ -308,10 +327,7 @@ QList<caf::PdmOptionItemInfo> RimSummaryPlotSourceStepping::calculateValueOption
if (analyzer)
{
for (const auto& t : analyzer->identifierTexts(category))
{
identifierTexts.insert(t);
}
identifierTexts = analyzer->identifierTexts(category, secondaryIdentifier);
}
}
}
@@ -432,68 +448,6 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c
m_region.uiCapability()->updateConnectedEditors();
m_quantity.uiCapability()->updateConnectedEditors();
}
else if (changedField == &m_wellName)
{
for (auto curve : curves)
{
if (isYAxisStepping())
{
RifEclipseSummaryAddress adr = curve->summaryAddressY();
updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL, &adr);
curve->setSummaryAddressY(adr);
}
if (isXAxisStepping())
{
RifEclipseSummaryAddress adr = curve->summaryAddressX();
updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL, &adr);
curve->setSummaryAddressX(adr);
}
}
if (ensembleCurveColl)
{
for (auto curveSet : ensembleCurveColl->curveSets())
{
auto adr = curveSet->summaryAddress();
updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL, &adr);
curveSet->setSummaryAddress(adr);
}
}
triggerLoadDataAndUpdate = true;
}
else if (changedField == &m_region)
{
for (auto curve : curves)
{
if (isYAxisStepping())
{
RifEclipseSummaryAddress adr = curve->summaryAddressY();
updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_REGION, &adr);
curve->setSummaryAddressY(adr);
}
if (isXAxisStepping())
{
RifEclipseSummaryAddress adr = curve->summaryAddressX();
updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_REGION, &adr);
curve->setSummaryAddressX(adr);
}
}
if (ensembleCurveColl)
{
for (auto curveSet : ensembleCurveColl->curveSets())
{
auto adr = curveSet->summaryAddress();
updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_REGION, &adr);
curveSet->setSummaryAddress(adr);
}
}
triggerLoadDataAndUpdate = true;
}
else if (changedField == &m_quantity)
{
for (auto curve : curves)
@@ -525,36 +479,65 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c
triggerLoadDataAndUpdate = true;
}
else if (changedField == &m_wellGroupName)
{
for (auto curve : curves)
RifEclipseSummaryAddress::SummaryVarCategory summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_INVALID;
if (changedField == &m_wellName)
{
if (isYAxisStepping())
{
RifEclipseSummaryAddress adr = curve->summaryAddressY();
updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL_GROUP, &adr);
curve->setSummaryAddressY(adr);
}
if (isXAxisStepping())
{
RifEclipseSummaryAddress adr = curve->summaryAddressX();
updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL_GROUP, &adr);
curve->setSummaryAddressX(adr);
}
summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_WELL;
}
else if (changedField == &m_region)
{
summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_REGION;
}
else if (changedField == &m_wellGroupName)
{
summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_WELL_GROUP;
}
else if (changedField == &m_cellBlock)
{
summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_BLOCK;
}
else if (changedField == &m_segment)
{
summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT;
}
else if (changedField == &m_completion)
{
summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION;
}
if (ensembleCurveColl)
if (summaryCategoryToModify != RifEclipseSummaryAddress::SUMMARY_INVALID)
{
for (auto curveSet : ensembleCurveColl->curveSets())
for (auto curve : curves)
{
auto adr = curveSet->summaryAddress();
updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL_GROUP, &adr);
curveSet->setSummaryAddress(adr);
}
}
if (isYAxisStepping())
{
RifEclipseSummaryAddress adr = curve->summaryAddressY();
updateAddressIfMatching(oldValue, newValue, summaryCategoryToModify, &adr);
curve->setSummaryAddressY(adr);
}
triggerLoadDataAndUpdate = true;
if (isXAxisStepping())
{
RifEclipseSummaryAddress adr = curve->summaryAddressX();
updateAddressIfMatching(oldValue, newValue, summaryCategoryToModify, &adr);
curve->setSummaryAddressX(adr);
}
}
if (ensembleCurveColl)
{
for (auto curveSet : ensembleCurveColl->curveSets())
{
auto adr = curveSet->summaryAddress();
updateAddressIfMatching(oldValue, newValue, summaryCategoryToModify, &adr);
curveSet->setSummaryAddress(adr);
}
}
triggerLoadDataAndUpdate = true;
}
}
if (triggerLoadDataAndUpdate)
@@ -654,6 +637,21 @@ caf::PdmValueField* RimSummaryPlotSourceStepping::fieldToModify()
return &m_region;
}
if (analyzer.blocks().size() == 1)
{
return &m_cellBlock;
}
if (analyzer.wellNames().size() == 1)
{
auto wellName = *(analyzer.wellNames().begin());
if (analyzer.wellSegmentNumbers(wellName).size() == 1)
{
return &m_segment;
}
}
return nullptr;
}
@@ -833,6 +831,30 @@ std::vector<caf::PdmFieldHandle*> RimSummaryPlotSourceStepping::computeVisibleFi
fieldsCommonForAllCurves.push_back(&m_region);
}
if (analyzer.wellSegmentNumbers(m_wellName().toStdString()).size() == 1)
{
QString txt = QString::number(*(analyzer.wellSegmentNumbers(m_wellName().toStdString()).begin()));
m_segment = txt;
fieldsCommonForAllCurves.push_back(&m_segment);
}
if (analyzer.blocks().size() == 1)
{
QString txt = QString::fromStdString(*(analyzer.blocks().begin()));
m_cellBlock = txt;
fieldsCommonForAllCurves.push_back(&m_cellBlock);
}
if (analyzer.wellCompletions(m_wellName().toStdString()).size() == 1)
{
QString txt = QString::fromStdString(*(analyzer.wellCompletions(m_wellName().toStdString()).begin()));
m_completion = txt;
fieldsCommonForAllCurves.push_back(&m_completion);
}
if (!analyzer.quantityNameForTitle().empty())
{
QString txt = QString::fromStdString(analyzer.quantityNameForTitle());
@@ -959,7 +981,7 @@ bool RimSummaryPlotSourceStepping::updateAddressIfMatching(const QVariant&
return true;
}
}
else if (RifEclipseSummaryAddress::isDependentOnWellName(category))
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL)
{
std::string oldString = oldValue.toString().toStdString();
std::string newString = newValue.toString().toStdString();
@@ -971,6 +993,28 @@ bool RimSummaryPlotSourceStepping::updateAddressIfMatching(const QVariant&
return true;
}
}
else if (category == RifEclipseSummaryAddress::SUMMARY_BLOCK || RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION)
{
std::string oldString = oldValue.toString().toStdString();
std::string newString = newValue.toString().toStdString();
if (adr->blockAsString() == oldString)
{
adr->setCellIjk(newString);
return true;
}
}
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT)
{
int oldInt = oldValue.toInt();
int newInt = newValue.toInt();
if (adr->wellSegmentNumber() == oldInt)
{
adr->setWellSegmentNumber(newInt);
return true;
}
}
return false;
}

View File

@@ -18,6 +18,7 @@
#pragma once
#include "RiaSummaryCurveAnalyzer.h"
#include "RifEclipseSummaryAddress.h"
@@ -114,7 +115,11 @@ private:
caf::PdmField<int> m_region;
caf::PdmField<QString> m_quantity;
caf::PdmField<QString> m_placeholderForLabel;
caf::PdmField<QString> m_cellBlock;
caf::PdmField<QString> m_segment;
caf::PdmField<QString> m_completion;
caf::PdmField<bool> m_includeEnsembleCasesForCaseStepping;
SourceSteppingType m_sourceSteppingType;