(#2168) Summary Plot : Add support for modifying identifier for curves

This commit is contained in:
Magne Sjaastad
2017-11-23 09:15:29 +01:00
parent f8f4fbc332
commit b46c19d90f
9 changed files with 552 additions and 5 deletions

View File

@@ -21,6 +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
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -39,6 +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
)
list(APPEND CODE_HEADER_FILES

View File

@@ -0,0 +1,111 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 <set>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaSummaryCurveDefTools::RiaSummaryCurveDefTools(const std::vector<RiaSummaryCurveDefinition>& curveDefinitions)
: m_curveDefinitions(curveDefinitions), m_isEvaluated(false)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::string> RiaSummaryCurveDefTools::uniqueWellNames() const
{
computeUniqueValues();
return std::vector<std::string>(m_wellNames.begin(), m_wellNames.end());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::string> RiaSummaryCurveDefTools::uniqueGroupNames() const
{
computeUniqueValues();
return std::vector<std::string>(m_groupName.begin(), m_groupName.end());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<int> RiaSummaryCurveDefTools::uniqueRegions() const
{
computeUniqueValues();
return std::vector<int>(m_regionNumbers.begin(), m_regionNumbers.end());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSummaryCase*> RiaSummaryCurveDefTools::uniqueSummaryCases() const
{
computeUniqueValues();
return std::vector<RimSummaryCase*>(m_summaryCases.begin(), m_summaryCases.end());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryCurveDefTools::computeUniqueValues() const
{
if (m_isEvaluated)
{
return;
}
// m_wellNames.clear();
// m_groupName.clear();
// m_summaryCases.clear();
for (const auto& curveDef : m_curveDefinitions)
{
if (curveDef.summaryCase() != nullptr)
{
m_summaryCases.insert(curveDef.summaryCase());
}
if (!curveDef.summaryAddress().wellName().empty())
{
m_wellNames.insert(curveDef.summaryAddress().wellName());
}
if (!curveDef.summaryAddress().wellGroupName().empty())
{
m_groupName.insert(curveDef.summaryAddress().wellGroupName());
}
if (curveDef.summaryAddress().regionNumber() != -1)
{
m_regionNumbers.insert(curveDef.summaryAddress().regionNumber());
}
}
m_isEvaluated = true;
}

View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <set>
#include <string>
#include <vector>
class RiaSummaryCurveDefinition;
class RimSummaryCase;
//==================================================================================================
//
//==================================================================================================
class RiaSummaryCurveDefTools
{
public:
RiaSummaryCurveDefTools(const std::vector<RiaSummaryCurveDefinition>& curveDefinitions);
std::vector<std::string> uniqueWellNames() const;
std::vector<std::string> uniqueGroupNames() const;
std::vector<int> uniqueRegions() const;
std::vector<RimSummaryCase*> uniqueSummaryCases() const;
private:
void computeUniqueValues() const;
private:
const std::vector<RiaSummaryCurveDefinition>& m_curveDefinitions;
mutable bool m_isEvaluated;
mutable std::set<std::string> m_wellNames;
mutable std::set<std::string> m_groupName;
mutable std::set<int> m_regionNumbers;
mutable std::set<RimSummaryCase*> m_summaryCases;
};