mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'origin/2018.11.01-patch' into dev
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaSummaryCurveAnalyzer.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
@@ -62,6 +63,44 @@ std::set<std::string> RiaSummaryCurveAnalyzer::quantities() const
|
||||
return m_quantities;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveAnalyzer::quantityNamesWithHistory() const
|
||||
{
|
||||
assignCategoryToQuantities();
|
||||
|
||||
return m_quantitiesWithMatchingHistory;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RiaSummaryCurveAnalyzer::quantityNamesNoHistory() const
|
||||
{
|
||||
assignCategoryToQuantities();
|
||||
|
||||
return m_quantitiesNoMatchingHistory;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaSummaryCurveAnalyzer::quantityNameForTitle() const
|
||||
{
|
||||
if (quantityNamesWithHistory().size() == 1 && quantityNamesNoHistory().empty())
|
||||
{
|
||||
return *quantityNamesWithHistory().begin();
|
||||
}
|
||||
|
||||
if (quantityNamesNoHistory().size() == 1 && quantityNamesWithHistory().empty())
|
||||
{
|
||||
return *quantityNamesNoHistory().begin();
|
||||
}
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -130,7 +169,7 @@ std::vector<QString> RiaSummaryCurveAnalyzer::identifierTexts(RifEclipseSummaryA
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RifEclipseSummaryAddress>
|
||||
RiaSummaryCurveAnalyzer::addressesForCategory(const std::set<RifEclipseSummaryAddress>& addresses,
|
||||
RiaSummaryCurveAnalyzer::addressesForCategory(const std::set<RifEclipseSummaryAddress>& addresses,
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category)
|
||||
{
|
||||
std::vector<RifEclipseSummaryAddress> filteredAddresses;
|
||||
@@ -146,6 +185,24 @@ std::vector<RifEclipseSummaryAddress>
|
||||
return filteredAddresses;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName(const std::string& curveName)
|
||||
{
|
||||
static std::string historyIdentifier = "H";
|
||||
|
||||
if (RiaStdStringTools::endsWith(curveName, historyIdentifier))
|
||||
{
|
||||
std::string candidate = curveName.substr(0, curveName.size() - 1);
|
||||
return candidate;
|
||||
}
|
||||
else
|
||||
{
|
||||
return curveName + historyIdentifier;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -158,6 +215,53 @@ void RiaSummaryCurveAnalyzer::clear()
|
||||
m_categories.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::assignCategoryToQuantities() const
|
||||
{
|
||||
if (!m_quantities.empty())
|
||||
{
|
||||
if (m_quantitiesWithMatchingHistory.empty() && m_quantitiesNoMatchingHistory.empty())
|
||||
{
|
||||
computeQuantityNamesWithHistory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::computeQuantityNamesWithHistory() const
|
||||
{
|
||||
m_quantitiesNoMatchingHistory.clear();
|
||||
m_quantitiesWithMatchingHistory.clear();
|
||||
|
||||
const std::string historyIdentifier("H");
|
||||
|
||||
for (const auto& s : m_quantities)
|
||||
{
|
||||
std::string correspondingHistoryCurve = correspondingHistorySummaryCurveName(s);
|
||||
|
||||
if (m_quantities.find(correspondingHistoryCurve) != m_quantities.end())
|
||||
{
|
||||
// Insert the curve name without H
|
||||
if (RiaStdStringTools::endsWith(s, historyIdentifier))
|
||||
{
|
||||
m_quantitiesWithMatchingHistory.insert(correspondingHistoryCurve);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_quantitiesWithMatchingHistory.insert(s);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_quantitiesNoMatchingHistory.insert(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -42,6 +42,11 @@ public:
|
||||
void clear();
|
||||
|
||||
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;
|
||||
@@ -53,11 +58,19 @@ public:
|
||||
static std::vector<RifEclipseSummaryAddress> addressesForCategory(const std::set<RifEclipseSummaryAddress>& addresses,
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category);
|
||||
|
||||
static std::string correspondingHistorySummaryCurveName(const std::string& curveName);
|
||||
|
||||
private:
|
||||
void assignCategoryToQuantities() const;
|
||||
void computeQuantityNamesWithHistory() const;
|
||||
|
||||
void analyzeSingleAddress(const RifEclipseSummaryAddress& address);
|
||||
|
||||
private:
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user