Ensemble curve set. Speed up calculate value options

This commit is contained in:
Bjørn Erik Jensen
2018-06-14 10:18:09 +02:00
parent eb8cba5e31
commit 114c746342
2 changed files with 12 additions and 13 deletions

View File

@@ -446,7 +446,7 @@ void RimEnsembleCurveSet::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
else if (changedField == &m_yValuesSummaryGroup) else if (changedField == &m_yValuesSummaryGroup)
{ {
// Empty address cache // Empty address cache
m_allAddressesCache.clear(); //m_allAddressesCache.clear();
updateAllCurves(); updateAllCurves();
updateTextInPlot = true; updateTextInPlot = true;
@@ -720,23 +720,24 @@ void RimEnsembleCurveSet::appendOptionItemsForSummaryAddresses(QList<caf::PdmOpt
{ {
if (!summaryCaseGroup) return; if (!summaryCaseGroup) return;
if (m_allAddressesCache.empty()) std::set<RifEclipseSummaryAddress> addrSet;
for (RimSummaryCase* summaryCase : summaryCaseGroup->allSummaryCases())
{ {
for (RimSummaryCase* summaryCase : summaryCaseGroup->allSummaryCases()) RifSummaryReaderInterface* reader = summaryCase->summaryReader();
const std::vector<RifEclipseSummaryAddress>& addrs = reader ? reader->allResultAddresses() : std::vector<RifEclipseSummaryAddress>();
for (auto& addr : addrs)
{ {
RifSummaryReaderInterface* reader = summaryCase->summaryReader(); if (summaryFilter && !summaryFilter->isIncludedByFilter(addr)) continue;
const std::vector<RifEclipseSummaryAddress> addrs = reader ? reader->allResultAddresses() : std::vector<RifEclipseSummaryAddress>(); addrSet.insert(addr);
m_allAddressesCache.insert(addrs.begin(), addrs.end());
} }
} }
for (auto& address : m_allAddressesCache) for (auto& addr : addrSet)
{ {
if (summaryFilter && !summaryFilter->isIncludedByFilter(address)) continue; std::string name = addr.uiText();
std::string name = address.uiText();
QString s = QString::fromStdString(name); QString s = QString::fromStdString(name);
options->push_back(caf::PdmOptionItemInfo(s, QVariant::fromValue(address))); options->push_back(caf::PdmOptionItemInfo(s, QVariant::fromValue(addr)));
} }
options->push_front(caf::PdmOptionItemInfo(RiaDefines::undefinedResultName(), QVariant::fromValue(RifEclipseSummaryAddress()))); options->push_front(caf::PdmOptionItemInfo(RiaDefines::undefinedResultName(), QVariant::fromValue(RifEclipseSummaryAddress())));

View File

@@ -162,8 +162,6 @@ private:
caf::PdmProxyValueField<QString> m_autoGeneratedName; caf::PdmProxyValueField<QString> m_autoGeneratedName;
caf::PdmChildField<RimSummaryCurveAutoName*> m_summaryAddressNameTools; caf::PdmChildField<RimSummaryCurveAutoName*> m_summaryAddressNameTools;
std::set<RifEclipseSummaryAddress> m_allAddressesCache;
QwtPlotCurve* m_qwtPlotCurveForLegendText; QwtPlotCurve* m_qwtPlotCurveForLegendText;
std::unique_ptr<RimEnsembleStatisticsCase> m_ensembleStatCase; std::unique_ptr<RimEnsembleStatisticsCase> m_ensembleStatCase;