#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

@ -26,8 +26,6 @@
#include <QString>
#include <set>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -125,6 +123,50 @@ std::set<int> RiaSummaryCurveAnalyzer::regionNumbers() const
return m_regionNumbers;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RiaSummaryCurveAnalyzer::wellCompletions(const std::string& wellName) const
{
std::set<std::string> connections;
for (const auto& conn : m_wellCompletions)
{
if (conn.first == wellName)
{
connections.insert(conn.second);
}
}
return connections;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<int> RiaSummaryCurveAnalyzer::wellSegmentNumbers(const std::string& wellName) const
{
std::set<int> segmentNumberForWell;
for (const auto& wellSegment : m_wellSegmentNumbers)
{
if (wellName.empty() || std::get<0>(wellSegment) == wellName)
{
segmentNumberForWell.insert(std::get<1>(wellSegment));
}
}
return segmentNumberForWell;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RiaSummaryCurveAnalyzer::blocks() const
{
return m_blocks;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -136,33 +178,57 @@ std::set<RifEclipseSummaryAddress::SummaryVarCategory> RiaSummaryCurveAnalyzer::
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RiaSummaryCurveAnalyzer::identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const
std::vector<QString> RiaSummaryCurveAnalyzer::identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category,
const std::string& secondaryIdentifier) const
{
std::vector<QString> stringSet;
std::vector<QString> identifierStrings;
if (category == RifEclipseSummaryAddress::SUMMARY_REGION)
{
for (const auto& regionNumber : m_regionNumbers)
{
stringSet.push_back(QString::number(regionNumber));
identifierStrings.push_back(QString::number(regionNumber));
}
}
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL)
{
for (const auto& wellName : m_wellNames)
{
stringSet.push_back(QString::fromStdString(wellName));
identifierStrings.push_back(QString::fromStdString(wellName));
}
}
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
{
for (const auto& wellGroupName : m_wellGroupNames)
{
stringSet.push_back(QString::fromStdString(wellGroupName));
identifierStrings.push_back(QString::fromStdString(wellGroupName));
}
}
else if (category == RifEclipseSummaryAddress::SUMMARY_BLOCK)
{
for (const auto& ijkBlock : m_blocks)
{
identifierStrings.push_back(QString::fromStdString(ijkBlock));
}
}
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT)
{
auto segmentNumbers = wellSegmentNumbers(secondaryIdentifier);
for (const auto& segment : segmentNumbers)
{
identifierStrings.push_back(QString::number(segment));
}
}
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION)
{
auto connections = wellCompletions(secondaryIdentifier);
for (const auto& conn : connections)
{
identifierStrings.push_back(QString::fromStdString(conn));
}
}
return stringSet;
return identifierStrings;
}
//--------------------------------------------------------------------------------------------------
@ -213,6 +279,9 @@ void RiaSummaryCurveAnalyzer::clear()
m_wellGroupNames.clear();
m_regionNumbers.clear();
m_categories.clear();
m_wellCompletions.clear();
m_wellSegmentNumbers.clear();
m_blocks.clear();
}
//--------------------------------------------------------------------------------------------------
@ -267,9 +336,11 @@ void RiaSummaryCurveAnalyzer::computeQuantityNamesWithHistory() const
//--------------------------------------------------------------------------------------------------
void RiaSummaryCurveAnalyzer::analyzeSingleAddress(const RifEclipseSummaryAddress& address)
{
if (!address.wellName().empty())
const std::string& wellName = address.wellName();
if (!wellName.empty())
{
m_wellNames.insert(address.wellName());
m_wellNames.insert(wellName);
}
if (!address.quantityName().empty())
@ -287,6 +358,22 @@ void RiaSummaryCurveAnalyzer::analyzeSingleAddress(const RifEclipseSummaryAddres
m_regionNumbers.insert(address.regionNumber());
}
if (address.category() == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION)
{
auto wellNameAndCompletion = std::make_pair(wellName, address.blockAsString());
m_wellCompletions.insert(wellNameAndCompletion);
}
else if (address.category() == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT)
{
auto wellNameAndSegment = std::make_pair(wellName, address.wellSegmentNumber());
m_wellSegmentNumbers.insert(wellNameAndSegment);
}
else if (address.category() == RifEclipseSummaryAddress::SUMMARY_BLOCK)
{
auto text = address.blockAsString();
m_blocks.insert(text);
}
if (address.category() != RifEclipseSummaryAddress::SUMMARY_INVALID)
{
m_categories.insert(address.category());

View File

@ -22,6 +22,7 @@
#include <set>
#include <string>
#include <tuple>
#include <vector>
class RimSummaryCurveCollection;
@ -44,18 +45,23 @@ public:
std::set<std::string> quantities() const;
std::set<std::string> quantityNamesWithHistory() const;
std::set<std::string> quantityNamesNoHistory() const;
std::string quantityNameForTitle() const;
std::set<std::string> wellNames() const;
std::set<std::string> wellGroupNames() const;
std::set<int> regionNumbers() const;
std::set<std::string> wellCompletions(const std::string& wellName) const;
std::set<int> wellSegmentNumbers(const std::string& wellName) const;
std::set<std::string> blocks() const;
std::set<RifEclipseSummaryAddress::SummaryVarCategory> categories() const;
std::vector<QString> identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const;
std::vector<QString> identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category,
const std::string& secondaryIdentifier) const;
static std::vector<RifEclipseSummaryAddress> addressesForCategory(const std::set<RifEclipseSummaryAddress>& addresses,
static std::vector<RifEclipseSummaryAddress> addressesForCategory(const std::set<RifEclipseSummaryAddress>& addresses,
RifEclipseSummaryAddress::SummaryVarCategory category);
static std::string correspondingHistorySummaryCurveName(const std::string& curveName);
@ -67,13 +73,16 @@ private:
void analyzeSingleAddress(const RifEclipseSummaryAddress& address);
private:
std::set<std::string> m_quantities;
std::set<std::string> m_quantities;
mutable std::set<std::string> m_quantitiesWithMatchingHistory;
mutable std::set<std::string> m_quantitiesNoMatchingHistory;
std::set<std::string> m_wellNames;
std::set<std::string> m_wellGroupNames;
std::set<int> m_regionNumbers;
std::set<std::string> m_wellNames;
std::set<std::string> m_wellGroupNames;
std::set<int> m_regionNumbers;
std::set<std::pair<std::string, std::string>> m_wellCompletions;
std::set<std::pair<std::string, int>> m_wellSegmentNumbers;
std::set<std::string> m_blocks;
std::set<RifEclipseSummaryAddress::SummaryVarCategory> m_categories;
};

View File

@ -581,7 +581,7 @@ std::string RifEclipseSummaryAddress::uiText() const
case SUMMARY_WELL_COMPLETION:
{
text += ":" + this->wellName();
text += ":" + formatUiTextIJK();
text += ":" + blockAsString();
}
break;
case SUMMARY_WELL_LGR:
@ -594,7 +594,7 @@ std::string RifEclipseSummaryAddress::uiText() const
{
text += ":" + this->lgrName();
text += ":" + this->wellName();
text += ":" + formatUiTextIJK();
text += ":" + blockAsString();
}
break;
case SUMMARY_WELL_SEGMENT:
@ -605,13 +605,13 @@ std::string RifEclipseSummaryAddress::uiText() const
break;
case SUMMARY_BLOCK:
{
text += ":" + formatUiTextIJK();
text += ":" + blockAsString();
}
break;
case SUMMARY_BLOCK_LGR:
{
text += ":" + this->lgrName();
text += ":" + formatUiTextIJK();
text += ":" + blockAsString();
}
break;
case SUMMARY_AQUIFER:
@ -635,7 +635,7 @@ std::string RifEclipseSummaryAddress::uiText(RifEclipseSummaryAddress::SummaryId
case INPUT_REGION_2_REGION: return formatUiTextRegionToRegion();
case INPUT_WELL_NAME: return wellName();
case INPUT_WELL_GROUP_NAME: return wellGroupName();
case INPUT_CELL_IJK: return formatUiTextIJK();
case INPUT_CELL_IJK: return blockAsString();
case INPUT_LGR_NAME: return lgrName();
case INPUT_SEGMENT_NUMBER: return std::to_string(wellSegmentNumber());
case INPUT_AQUIFER_NUMBER: return std::to_string(aquiferNumber());
@ -719,6 +719,18 @@ bool RifEclipseSummaryAddress::isValid() const
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseSummaryAddress::setCellIjk(const std::string& uiText)
{
auto vec = RifEclipseSummaryAddress::ijkTupleFromUiText(uiText);
m_cellI = std::get<0>(vec);
m_cellJ = std::get<1>(vec);
m_cellK = std::get<2>(vec);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -770,7 +782,7 @@ std::string RifEclipseSummaryAddress::baseQuantityName(const std::string& quanti
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RifEclipseSummaryAddress::formatUiTextIJK() const
std::string RifEclipseSummaryAddress::blockAsString() const
{
return std::to_string(this->cellI()) + ", "
+ std::to_string(this->cellJ()) + ", "

View File

@ -162,6 +162,7 @@ public:
int cellJ() const { return m_cellJ; }
int cellK() const { return m_cellK; }
int aquiferNumber() const { return m_aquiferNumber; }
std::string blockAsString() const;
const std::string ensembleStatisticsQuantityName() const;
@ -176,6 +177,8 @@ public:
void setWellGroupName(const std::string& wellGroupName) { m_wellGroupName = wellGroupName; }
void setRegion(int region) { m_regionNumber = (int16_t)region; }
void setAquiferNumber(int aquiferNumber) { m_aquiferNumber = (int16_t)aquiferNumber; }
void setCellIjk(const std::string& uiText);
void setWellSegmentNumber(int segment) { m_wellSegmentNumber = (int16_t)segment; }
void setAsErrorResult() { m_isErrorResult = true; }
bool isErrorResult() const { return m_isErrorResult; }
@ -184,7 +187,6 @@ public:
private:
bool isValidEclipseCategory() const;
static std::string baseQuantityName(const std::string& quantityName);
std::string formatUiTextIJK() const;
static std::tuple<int32_t, int32_t, int32_t> ijkTupleFromUiText(const std::string &s);
std::string formatUiTextRegionToRegion() const;
std::pair<int16_t, int16_t> regionToRegionPairFromUiText(const std::string &s);

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;

View File

@ -57,6 +57,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellPathCompletions-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSummaryCaseCollection-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifActiveCellsReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifCsvDataTableFormatter-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer-Test.cpp
)
if (RESINSIGHT_ENABLE_GRPC)

View File

@ -0,0 +1,134 @@
#include "gtest/gtest.h"
#include "RiaSummaryCurveAnalyzer.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RiaSummaryCurveAnalyzer, WellCompletions)
{
std::vector<RifEclipseSummaryAddress> addresses;
// Well A
std::string wellNameA = "well_name_a";
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellCompletionAddress("quantity_name", wellNameA, 1, 2, 3);
addresses.push_back(adr);
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellCompletionAddress("quantity_name", wellNameA, 1, 2, 3);
addresses.push_back(adr);
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellCompletionAddress("quantity_name", wellNameA, 5, 2, 3);
addresses.push_back(adr);
}
// Well B
std::string wellNameB = "well_name_b";
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellCompletionAddress("quantity_name", wellNameB, 5, 2, 3);
addresses.push_back(adr);
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellCompletionAddress("quantity_name", wellNameB, 5, 4, 3);
addresses.push_back(adr);
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellCompletionAddress("quantity_name", wellNameB, 5, 4, 30);
addresses.push_back(adr);
}
RiaSummaryCurveAnalyzer analyzer;
analyzer.appendAdresses(addresses);
EXPECT_EQ(2u, analyzer.wellNames().size());
auto completionsForA = analyzer.wellCompletions(wellNameA);
EXPECT_EQ(2u, completionsForA.size());
auto completionsForB = analyzer.wellCompletions(wellNameB);
EXPECT_EQ(3u, completionsForB.size());
std::string tupleToFind = "5, 4, 30";
EXPECT_TRUE(completionsForB.find(tupleToFind) != completionsForB.end());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RiaSummaryCurveAnalyzer, WellSegments)
{
std::vector<RifEclipseSummaryAddress> addresses;
// Well A
std::string wellNameA = "well_name_a";
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress("quantity_name", wellNameA, 1);
addresses.push_back(adr);
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress("quantity_name", wellNameA, 1);
addresses.push_back(adr);
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress("quantity_name", wellNameA, 30);
addresses.push_back(adr);
}
// Well B
std::string wellNameB = "well_name_b";
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress("quantity_name", wellNameB, 1);
addresses.push_back(adr);
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress("quantity_name", wellNameB, 3);
addresses.push_back(adr);
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress("quantity_name", wellNameB, 10);
addresses.push_back(adr);
}
RiaSummaryCurveAnalyzer analyzer;
analyzer.appendAdresses(addresses);
EXPECT_EQ(2u, analyzer.wellNames().size());
auto segmentsForA = analyzer.wellSegmentNumbers(wellNameA);
EXPECT_EQ(2u, segmentsForA.size());
auto segmentsForB = analyzer.wellSegmentNumbers(wellNameB);
EXPECT_EQ(3u, segmentsForB.size());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RiaSummaryCurveAnalyzer, CellBlocks)
{
std::vector<RifEclipseSummaryAddress> addresses;
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::blockAddress("quantity_name", 1, 2, 3);
addresses.push_back(adr);
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::blockAddress("quantity_name", 1, 2, 3);
addresses.push_back(adr);
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::blockAddress("quantity_name", 2, 2, 3);
addresses.push_back(adr);
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::blockAddress("quantity_name", 5, 2, 3);
addresses.push_back(adr);
}
RiaSummaryCurveAnalyzer analyzer;
analyzer.appendAdresses(addresses);
auto blocks = analyzer.blocks();
EXPECT_EQ(3u, blocks.size());
}