mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2168 Summary Plot : Improve identifier stepping
This commit is contained in:
parent
5e3467a5f6
commit
a04c42313f
@ -21,7 +21,7 @@ ${CEE_CURRENT_LIST_DIR}RiaQDateTimeTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaWellNameComparer.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaStdStringTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveDefTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveAnalyzer.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -40,7 +40,7 @@ ${CEE_CURRENT_LIST_DIR}RiaQDateTimeTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaWellNameComparer.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaStdStringTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveDefTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveAnalyzer.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
207
ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp
Normal file
207
ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp
Normal file
@ -0,0 +1,207 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaSummaryCurveAnalyzer.h"
|
||||
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <set>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveAnalyzer::RiaSummaryCurveAnalyzer() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::analyzeCurves(RimSummaryCurveCollection* sumCurveCollection)
|
||||
{
|
||||
clearAllSets();
|
||||
|
||||
if (!sumCurveCollection)
|
||||
return;
|
||||
|
||||
for (auto curve : sumCurveCollection->curves())
|
||||
{
|
||||
m_summaryCases.insert(curve->summaryCaseY());
|
||||
|
||||
auto adr = curve->summaryAddressY();
|
||||
analyzeAddress(adr);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::analyzeAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses)
|
||||
{
|
||||
clearAllSets();
|
||||
|
||||
for (const auto& adr : allAddresses)
|
||||
{
|
||||
analyzeAddress(adr);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveAnalyzer::quantities() const
|
||||
{
|
||||
return m_quantities;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveAnalyzer::wellNames() const
|
||||
{
|
||||
return m_wellNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveAnalyzer::wellGroupNames() const
|
||||
{
|
||||
return m_wellGroupNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<int> RiaSummaryCurveAnalyzer::regionNumbers() const
|
||||
{
|
||||
return m_regionNumbers;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimSummaryCase*> RiaSummaryCurveAnalyzer::summaryCases() const
|
||||
{
|
||||
return m_summaryCases;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> RiaSummaryCurveAnalyzer::categories() const
|
||||
{
|
||||
return m_categories;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QString> RiaSummaryCurveAnalyzer::identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const
|
||||
{
|
||||
std::set<QString> stringSet;
|
||||
|
||||
if (category == RifEclipseSummaryAddress::SUMMARY_REGION)
|
||||
{
|
||||
for (const auto& regionNumber : m_regionNumbers)
|
||||
{
|
||||
stringSet.insert(QString::number(regionNumber));
|
||||
}
|
||||
}
|
||||
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL)
|
||||
{
|
||||
for (const auto& wellName : m_wellNames)
|
||||
{
|
||||
stringSet.insert(QString::fromStdString(wellName));
|
||||
}
|
||||
}
|
||||
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
|
||||
{
|
||||
for (const auto& wellGroupName : m_wellGroupNames)
|
||||
{
|
||||
stringSet.insert(QString::fromStdString(wellGroupName));
|
||||
}
|
||||
}
|
||||
|
||||
return stringSet;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RifEclipseSummaryAddress> RiaSummaryCurveAnalyzer::addressesForCategory(const std::vector<RifEclipseSummaryAddress>& addresses, RifEclipseSummaryAddress::SummaryVarCategory category)
|
||||
{
|
||||
std::vector<RifEclipseSummaryAddress> filteredAddresses;
|
||||
|
||||
for (const auto& adr : addresses)
|
||||
{
|
||||
if (adr.category() == category)
|
||||
{
|
||||
filteredAddresses.push_back(adr);
|
||||
}
|
||||
}
|
||||
|
||||
return filteredAddresses;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::clearAllSets()
|
||||
{
|
||||
m_quantities.clear();
|
||||
m_wellNames.clear();
|
||||
m_wellGroupNames.clear();
|
||||
m_regionNumbers.clear();
|
||||
m_summaryCases.clear();
|
||||
m_categories.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::analyzeAddress(const RifEclipseSummaryAddress& address)
|
||||
{
|
||||
if (!address.wellName().empty())
|
||||
{
|
||||
m_wellNames.insert(address.wellName());
|
||||
}
|
||||
|
||||
if (!address.quantityName().empty())
|
||||
{
|
||||
m_quantities.insert(address.quantityName());
|
||||
}
|
||||
|
||||
if (!address.wellGroupName().empty())
|
||||
{
|
||||
m_wellGroupNames.insert(address.wellGroupName());
|
||||
}
|
||||
|
||||
if (address.regionNumber() != -1)
|
||||
{
|
||||
m_regionNumbers.insert(address.regionNumber());
|
||||
}
|
||||
|
||||
if (address.category() != RifEclipseSummaryAddress::SUMMARY_INVALID)
|
||||
{
|
||||
m_categories.insert(address.category());
|
||||
}
|
||||
}
|
@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -25,15 +27,18 @@
|
||||
class RimSummaryCurveCollection;
|
||||
class RimSummaryCase;
|
||||
|
||||
class QString;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaSummaryCurveDefTools
|
||||
class RiaSummaryCurveAnalyzer
|
||||
{
|
||||
public:
|
||||
RiaSummaryCurveDefTools();
|
||||
RiaSummaryCurveAnalyzer();
|
||||
|
||||
void findIdentifiers(RimSummaryCurveCollection* sumCurveCollection);
|
||||
void analyzeCurves(RimSummaryCurveCollection* sumCurveCollection);
|
||||
void analyzeAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses);
|
||||
|
||||
std::set<std::string> quantities() const;
|
||||
std::set<std::string> wellNames() const;
|
||||
@ -41,9 +46,16 @@ public:
|
||||
|
||||
std::set<int> regionNumbers() const;
|
||||
std::set<RimSummaryCase*> summaryCases() const;
|
||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> categories() const;
|
||||
|
||||
std::set<QString> identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const;
|
||||
|
||||
static std::vector<RifEclipseSummaryAddress> addressesForCategory(const std::vector<RifEclipseSummaryAddress>& addresses,
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category);
|
||||
|
||||
private:
|
||||
void clearAllSets();
|
||||
void analyzeAddress(const RifEclipseSummaryAddress& address);
|
||||
|
||||
private:
|
||||
std::set<std::string> m_quantities;
|
||||
@ -51,4 +63,6 @@ private:
|
||||
std::set<std::string> m_wellGroupNames;
|
||||
std::set<int> m_regionNumbers;
|
||||
std::set<RimSummaryCase*> m_summaryCases;
|
||||
|
||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> m_categories;
|
||||
};
|
@ -1,118 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaSummaryCurveDefTools.h"
|
||||
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveDefTools::RiaSummaryCurveDefTools() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveDefTools::findIdentifiers(RimSummaryCurveCollection* sumCurveCollection)
|
||||
{
|
||||
if (!sumCurveCollection) return;
|
||||
|
||||
for (auto curve : sumCurveCollection->curves())
|
||||
{
|
||||
m_summaryCases.insert(curve->summaryCaseY());
|
||||
|
||||
auto adr = curve->summaryAddressY();
|
||||
|
||||
if (!adr.wellName().empty())
|
||||
{
|
||||
m_wellNames.insert(adr.wellName());
|
||||
}
|
||||
|
||||
if (!adr.quantityName().empty())
|
||||
{
|
||||
m_quantities.insert(adr.quantityName());
|
||||
}
|
||||
|
||||
if (!adr.wellGroupName().empty())
|
||||
{
|
||||
m_wellGroupNames.insert(adr.wellGroupName());
|
||||
}
|
||||
|
||||
if (adr.regionNumber() != -1)
|
||||
{
|
||||
m_regionNumbers.insert(adr.regionNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveDefTools::quantities() const
|
||||
{
|
||||
return m_quantities;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveDefTools::wellNames() const
|
||||
{
|
||||
return m_wellNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveDefTools::wellGroupNames() const
|
||||
{
|
||||
return m_wellGroupNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<int> RiaSummaryCurveDefTools::regionNumbers() const
|
||||
{
|
||||
return m_regionNumbers;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimSummaryCase*> RiaSummaryCurveDefTools::summaryCases() const
|
||||
{
|
||||
return m_summaryCases;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveDefTools::clearAllSets()
|
||||
{
|
||||
m_quantities.clear();
|
||||
m_wellNames.clear();
|
||||
m_wellGroupNames.clear();
|
||||
m_regionNumbers.clear();
|
||||
m_summaryCases.clear();
|
||||
}
|
@ -131,6 +131,7 @@ public:
|
||||
std::string uiText(RifEclipseSummaryAddress::SummaryIdentifierType itemTypeInput) const;
|
||||
|
||||
bool isValid() const;
|
||||
void setQuantityName(const std::string& quantity) { m_quantityName = quantity; }
|
||||
void setWellName(const std::string& wellName) { m_wellName = wellName; }
|
||||
void setWellGroupName(const std::string& wellGroupName) { m_wellGroupName = wellGroupName; }
|
||||
void setRegion(int region) { m_regionNumber = region; }
|
||||
|
@ -18,14 +18,14 @@
|
||||
|
||||
#include "RifEclipseSummaryTools.h"
|
||||
|
||||
#include "RiaSummaryCurveAnalyzer.h"
|
||||
#include "RifReaderEclipseSummary.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include "ert/ecl/ecl_util.h"
|
||||
|
||||
#include <iostream>
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -35,7 +35,6 @@ void RifEclipseSummaryTools::findSummaryHeaderFile(const std::string& inputFile,
|
||||
findSummaryHeaderFileInfo(inputFile, headerFile, NULL, NULL, isFormatted);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -136,7 +135,7 @@ void RifEclipseSummaryTools::dumpMetaData(RifSummaryReaderInterface* readerEclip
|
||||
{
|
||||
RifEclipseSummaryAddress::SummaryVarCategory categoryEnum = RifEclipseSummaryAddress::SummaryVarCategory(category);
|
||||
|
||||
std::vector<RifEclipseSummaryAddress> catAddresses = addressesForCategory(addresses, categoryEnum);
|
||||
std::vector<RifEclipseSummaryAddress> catAddresses = RiaSummaryCurveAnalyzer::addressesForCategory(addresses, categoryEnum);
|
||||
|
||||
if (catAddresses.size() > 0)
|
||||
{
|
||||
@ -192,20 +191,3 @@ void RifEclipseSummaryTools::findSummaryHeaderFileInfo(const std::string& inputF
|
||||
util_safe_free(myPath);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RifEclipseSummaryAddress> RifEclipseSummaryTools::addressesForCategory(const std::vector<RifEclipseSummaryAddress>& addresses, RifEclipseSummaryAddress::SummaryVarCategory category)
|
||||
{
|
||||
std::vector<RifEclipseSummaryAddress> filteredAddresses;
|
||||
|
||||
for (size_t i = 0; i < addresses.size(); i++)
|
||||
{
|
||||
if (addresses[i].category() == category)
|
||||
{
|
||||
filteredAddresses.push_back(addresses[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return filteredAddresses;
|
||||
}
|
||||
|
@ -42,5 +42,4 @@ public:
|
||||
|
||||
private:
|
||||
static void findSummaryHeaderFileInfo(const std::string& inputFile, std::string* headerFile, std::string* path, std::string* base, bool* isFormatted);
|
||||
static std::vector<RifEclipseSummaryAddress> addressesForCategory(const std::vector<RifEclipseSummaryAddress>& addresses, RifEclipseSummaryAddress::SummaryVarCategory category);
|
||||
};
|
||||
|
@ -18,14 +18,18 @@
|
||||
|
||||
#include "RimSummaryCurvesModifier.h"
|
||||
|
||||
#include "RiaSummaryCurveDefTools.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaSummaryCurveAnalyzer.h"
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "cafPdmUiItem.h"
|
||||
@ -42,46 +46,79 @@ RimSummaryCurvesModifier::RimSummaryCurvesModifier()
|
||||
CAF_PDM_InitObject("Summary Curves Modifier", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_summaryCase, "CurveCase", "Case", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_quantity, "Quantities", "Quantity", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "Well Name", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_groupName, "GroupName", "Group Name", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellGroupName, "GroupName", "Group Name", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_region, "Region", "Region", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellNameProxy, "WellNameProxy", "WellNameProxy", "", "", "");
|
||||
m_wellNameProxy.registerGetMethod(this, &RimSummaryCurvesModifier::wellName);
|
||||
m_wellNameProxy.registerSetMethod(this, &RimSummaryCurvesModifier::setWellName);
|
||||
m_wellNameProxy.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
m_wellNameProxy.uiCapability()->setUiHidden(false);
|
||||
m_wellNameProxy.uiCapability()->setUiHidden(true);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QString> findAvailableIdentifierTexts(const std::vector<RifEclipseSummaryAddress>& allAddresses,
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category)
|
||||
void RimSummaryCurvesModifier::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
std::set<QString> mySet;
|
||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
||||
|
||||
for (const auto& adr : allAddresses)
|
||||
RiaSummaryCurveAnalyzer analyzer;
|
||||
analyzer.analyzeCurves(curveCollection);
|
||||
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID;
|
||||
{
|
||||
if (adr.category() == category)
|
||||
if (analyzer.categories().size() == 1)
|
||||
{
|
||||
if (category == RifEclipseSummaryAddress::SUMMARY_REGION)
|
||||
{
|
||||
mySet.insert(QString::number(adr.regionNumber()));
|
||||
}
|
||||
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL)
|
||||
{
|
||||
mySet.insert(QString::fromStdString(adr.wellName()));
|
||||
}
|
||||
else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
|
||||
{
|
||||
mySet.insert(QString::fromStdString(adr.wellGroupName()));
|
||||
}
|
||||
category = *(analyzer.categories().begin());
|
||||
}
|
||||
}
|
||||
|
||||
return mySet;
|
||||
m_summaryCase.uiCapability()->setUiHidden(true);
|
||||
m_wellName.uiCapability()->setUiHidden(true);
|
||||
m_wellGroupName.uiCapability()->setUiHidden(true);
|
||||
m_region.uiCapability()->setUiHidden(true);
|
||||
m_quantity.uiCapability()->setUiHidden(true);
|
||||
|
||||
if (category != RifEclipseSummaryAddress::SUMMARY_INVALID)
|
||||
{
|
||||
if (analyzer.summaryCases().size() == 1)
|
||||
{
|
||||
m_summaryCase = *(analyzer.summaryCases().begin());
|
||||
m_summaryCase.uiCapability()->setUiHidden(false);
|
||||
}
|
||||
|
||||
if (analyzer.wellNames().size() == 1)
|
||||
{
|
||||
QString txt = QString::fromStdString(*(analyzer.wellNames().begin()));
|
||||
m_wellName = txt;
|
||||
m_wellName.uiCapability()->setUiHidden(false);
|
||||
}
|
||||
|
||||
if (analyzer.wellGroupNames().size() == 1)
|
||||
{
|
||||
QString txt = QString::fromStdString(*(analyzer.wellGroupNames().begin()));
|
||||
m_wellGroupName = txt;
|
||||
m_wellGroupName.uiCapability()->setUiHidden(false);
|
||||
}
|
||||
|
||||
if (analyzer.regionNumbers().size() == 1)
|
||||
{
|
||||
m_region = *(analyzer.regionNumbers().begin());
|
||||
m_region.uiCapability()->setUiHidden(false);
|
||||
}
|
||||
|
||||
if (analyzer.quantities().size() == 1)
|
||||
{
|
||||
QString txt = QString::fromStdString(*(analyzer.quantities().begin()));
|
||||
m_quantity = txt;
|
||||
m_quantity.uiCapability()->setUiHidden(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -90,6 +127,25 @@ std::set<QString> findAvailableIdentifierTexts(const std::vector<RifEclipseSumma
|
||||
QList<caf::PdmOptionItemInfo> RimSummaryCurvesModifier::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly)
|
||||
{
|
||||
if (fieldNeedingOptions == &m_summaryCase)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
RimSummaryCaseMainCollection* sumCaseColl =
|
||||
proj->activeOilField() ? proj->activeOilField()->summaryCaseMainCollection() : nullptr;
|
||||
if (sumCaseColl)
|
||||
{
|
||||
for (auto sumCase : sumCaseColl->allSummaryCases())
|
||||
{
|
||||
options.append(caf::PdmOptionItemInfo(sumCase->caseName(), sumCase));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
std::set<QString> identifierTexts;
|
||||
|
||||
RifSummaryReaderInterface* reader = summaryReader();
|
||||
@ -97,17 +153,42 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurvesModifier::calculateValueOptions(co
|
||||
{
|
||||
const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
|
||||
|
||||
RiaSummaryCurveAnalyzer analyzer;
|
||||
analyzer.analyzeAdresses(allAddresses);
|
||||
|
||||
if (fieldNeedingOptions == &m_wellName || fieldNeedingOptions == &m_wellNameProxy)
|
||||
{
|
||||
identifierTexts = findAvailableIdentifierTexts(allAddresses, RifEclipseSummaryAddress::SUMMARY_WELL);
|
||||
identifierTexts = analyzer.identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL);
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_region)
|
||||
{
|
||||
identifierTexts = findAvailableIdentifierTexts(allAddresses, RifEclipseSummaryAddress::SUMMARY_REGION);
|
||||
identifierTexts = analyzer.identifierTexts(RifEclipseSummaryAddress::SUMMARY_REGION);
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_groupName)
|
||||
else if (fieldNeedingOptions == &m_wellGroupName)
|
||||
{
|
||||
identifierTexts = findAvailableIdentifierTexts(allAddresses, RifEclipseSummaryAddress::SUMMARY_WELL_GROUP);
|
||||
identifierTexts = analyzer.identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL_GROUP);
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_quantity)
|
||||
{
|
||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
||||
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_FIELD;
|
||||
|
||||
if (curveCollection->curves().size() > 0)
|
||||
{
|
||||
category = curveCollection->curves()[0]->summaryAddressY().category();
|
||||
}
|
||||
|
||||
RiaSummaryCurveAnalyzer quantityAnalyzer;
|
||||
|
||||
auto subset = RiaSummaryCurveAnalyzer::addressesForCategory(allAddresses, category);
|
||||
quantityAnalyzer.analyzeAdresses(subset);
|
||||
|
||||
for (const auto& quantity : quantityAnalyzer.quantities())
|
||||
{
|
||||
identifierTexts.insert(QString::fromStdString(quantity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,6 +208,97 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurvesModifier::calculateValueOptions(co
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurvesModifier::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
||||
|
||||
bool triggerLoadDataAndUpdate = false;
|
||||
|
||||
if (changedField == &m_summaryCase)
|
||||
{
|
||||
if (m_summaryCase())
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
{
|
||||
curve->setSummaryCaseY(m_summaryCase);
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
}
|
||||
else if (changedField == &m_wellName || changedField == &m_wellNameProxy)
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
{
|
||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL)
|
||||
{
|
||||
adr.setWellName(m_wellName().toStdString());
|
||||
|
||||
curve->setSummaryAddressY(adr);
|
||||
}
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
else if (changedField == &m_region)
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
{
|
||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_REGION)
|
||||
{
|
||||
adr.setRegion(m_region());
|
||||
|
||||
curve->setSummaryAddressY(adr);
|
||||
}
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
else if (changedField == &m_quantity)
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
{
|
||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||
adr.setQuantityName(m_quantity().toStdString());
|
||||
curve->setSummaryAddressY(adr);
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
else if (changedField == &m_wellGroupName)
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
{
|
||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
|
||||
{
|
||||
adr.setWellGroupName(m_wellGroupName().toStdString());
|
||||
|
||||
curve->setSummaryAddressY(adr);
|
||||
}
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
|
||||
if (triggerLoadDataAndUpdate)
|
||||
{
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(summaryPlot);
|
||||
|
||||
summaryPlot->updatePlotTitle();
|
||||
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -178,128 +350,3 @@ void RimSummaryCurvesModifier::setWellName(const QString& wellName)
|
||||
{
|
||||
m_wellName.setValueWithFieldChanged(wellName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurvesModifier::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
||||
|
||||
bool triggerLoadDataAndUpdate = false;
|
||||
if (changedField == &m_wellName || changedField == &m_wellNameProxy)
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
{
|
||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL)
|
||||
{
|
||||
adr.setWellName(m_wellName().toStdString());
|
||||
|
||||
curve->setSummaryAddressY(adr);
|
||||
}
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
else if (changedField == &m_region)
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
{
|
||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_REGION)
|
||||
{
|
||||
adr.setRegion(m_region());
|
||||
|
||||
curve->setSummaryAddressY(adr);
|
||||
}
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
else if (changedField == &m_groupName)
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
{
|
||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
|
||||
{
|
||||
adr.setWellGroupName(m_groupName().toStdString());
|
||||
|
||||
curve->setSummaryAddressY(adr);
|
||||
}
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
|
||||
if (triggerLoadDataAndUpdate)
|
||||
{
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(summaryPlot);
|
||||
|
||||
summaryPlot->updatePlotTitle();
|
||||
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurvesModifier::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
||||
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefinitions;
|
||||
for (auto curve : curveCollection->curves())
|
||||
{
|
||||
curveDefinitions.push_back(RiaSummaryCurveDefinition(curve->summaryCaseY(), curve->summaryAddressY()));
|
||||
}
|
||||
|
||||
// m_summaryCase.uiCapability()->setUiReadOnly(true);
|
||||
// m_wellName.uiCapability()->setUiReadOnly(true);
|
||||
// m_groupName.uiCapability()->setUiReadOnly(true);
|
||||
// m_region.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
/*
|
||||
if (tools.uniqueSummaryCases().size() > 1)
|
||||
{
|
||||
m_summaryCase.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_summaryCase.uiCapability()->setUiReadOnly(false);
|
||||
}
|
||||
|
||||
if (tools.uniqueWellNames().size() < 2)
|
||||
{
|
||||
m_wellName.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_wellName.uiCapability()->setUiReadOnly(false);
|
||||
}
|
||||
|
||||
if (tools.uniqueGroupNames().size() < 2)
|
||||
{
|
||||
m_groupName.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_groupName.uiCapability()->setUiReadOnly(false);
|
||||
}
|
||||
|
||||
if (tools.uniqueRegions().size() < 2)
|
||||
{
|
||||
m_region.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_region.uiCapability()->setUiReadOnly(false);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -39,13 +39,14 @@ public:
|
||||
RimSummaryCurvesModifier();
|
||||
|
||||
private:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue,
|
||||
const QVariant& newValue) override;
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly) override;
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue,
|
||||
const QVariant& newValue) override;
|
||||
|
||||
private:
|
||||
RifSummaryReaderInterface* summaryReader() const;
|
||||
RimSummaryCase* singleSummaryCase() const;
|
||||
@ -55,8 +56,9 @@ private:
|
||||
private:
|
||||
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<QString> m_groupName;
|
||||
caf::PdmField<QString> m_wellGroupName;
|
||||
caf::PdmField<int> m_region;
|
||||
caf::PdmField<QString> m_quantity;
|
||||
|
||||
caf::PdmProxyValueField<QString> m_wellNameProxy;
|
||||
caf::PdmProxyValueField<QString> m_wellNameProxy; // TODO: This is a test field for a list editor
|
||||
};
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaSummaryCurveDefTools.h"
|
||||
#include "RiaSummaryCurveAnalyzer.h"
|
||||
|
||||
#include "RimAsciiDataCurve.h"
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
@ -1226,24 +1226,24 @@ void RimSummaryPlot::setZoomIntervalsInQwtPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryPlot::extractPlotTitleFromCurves() const
|
||||
{
|
||||
RiaSummaryCurveDefTools nameHelper;
|
||||
RiaSummaryCurveAnalyzer analyzer;
|
||||
|
||||
nameHelper.findIdentifiers(m_summaryCurveCollection());
|
||||
analyzer.analyzeCurves(m_summaryCurveCollection());
|
||||
|
||||
auto quantities = nameHelper.quantities();
|
||||
auto wellNames = nameHelper.wellNames();
|
||||
auto wellGroupNames = nameHelper.wellGroupNames();
|
||||
auto regions = nameHelper.regionNumbers();
|
||||
auto quantities = analyzer.quantities();
|
||||
auto wellNames = analyzer.wellNames();
|
||||
auto wellGroupNames = analyzer.wellGroupNames();
|
||||
auto regions = analyzer.regionNumbers();
|
||||
|
||||
QString title;
|
||||
|
||||
if (wellNames.size() == 1)
|
||||
{
|
||||
title = "Well : " + QString::fromStdString(*(wellNames.begin()));
|
||||
title = QString::fromStdString(*(wellNames.begin()));
|
||||
}
|
||||
else if (wellGroupNames.size() == 1)
|
||||
{
|
||||
title = "Well Group : " + QString::fromStdString(*(wellGroupNames.begin()));
|
||||
title = QString::fromStdString(*(wellGroupNames.begin()));
|
||||
}
|
||||
else if (regions.size() == 1)
|
||||
{
|
||||
@ -1251,7 +1251,7 @@ QString RimSummaryPlot::extractPlotTitleFromCurves() const
|
||||
}
|
||||
else if (quantities.size() == 1)
|
||||
{
|
||||
title = "Quantity : " + QString::fromStdString(*(quantities.begin()));
|
||||
title = QString::fromStdString(*(quantities.begin()));
|
||||
}
|
||||
|
||||
return title;
|
||||
|
Loading…
Reference in New Issue
Block a user