#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

@@ -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;
}