mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add support for summary cross plot curves in summary plots
This commit is contained in:
@@ -34,6 +34,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryDefines.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaLasDefines.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaWellFlowDefines.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAddress.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -72,6 +73,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaSeismicDefines.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaLasDefines.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaWellFlowDefines.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAddress.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
53
ApplicationLibCode/Application/RiaSummaryCurveAddress.cpp
Normal file
53
ApplicationLibCode/Application/RiaSummaryCurveAddress.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor 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 "RiaSummaryCurveAddress.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveAddress::RiaSummaryCurveAddress( const RifEclipseSummaryAddress& summaryAddressX, const RifEclipseSummaryAddress& summaryAddressY )
|
||||
: m_summaryAddressX( summaryAddressX )
|
||||
, m_summaryAddressY( summaryAddressY )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveAddress::RiaSummaryCurveAddress( const RifEclipseSummaryAddress& summaryAddressY )
|
||||
: m_summaryAddressX( RifEclipseSummaryAddress::timeAddress() )
|
||||
, m_summaryAddressY( summaryAddressY )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RiaSummaryCurveAddress::summaryAddressX() const
|
||||
{
|
||||
return m_summaryAddressX;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RiaSummaryCurveAddress::summaryAddressY() const
|
||||
{
|
||||
return m_summaryAddressY;
|
||||
}
|
||||
40
ApplicationLibCode/Application/RiaSummaryCurveAddress.h
Normal file
40
ApplicationLibCode/Application/RiaSummaryCurveAddress.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor 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 "RifEclipseSummaryAddress.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiaSummaryCurveAddress
|
||||
{
|
||||
public:
|
||||
explicit RiaSummaryCurveAddress( const RifEclipseSummaryAddress& summaryAddressY );
|
||||
explicit RiaSummaryCurveAddress( const RifEclipseSummaryAddress& summaryAddressX, const RifEclipseSummaryAddress& summaryAddressY );
|
||||
|
||||
RifEclipseSummaryAddress summaryAddressX() const;
|
||||
RifEclipseSummaryAddress summaryAddressY() const;
|
||||
|
||||
auto operator<=>( const RiaSummaryCurveAddress& rhs ) const = default;
|
||||
|
||||
private:
|
||||
RifEclipseSummaryAddress m_summaryAddressX;
|
||||
RifEclipseSummaryAddress m_summaryAddressY;
|
||||
};
|
||||
@@ -17,6 +17,18 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaSummaryDefines.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RiaDefines::HorizontalAxisType>::setUp()
|
||||
{
|
||||
addItem( RiaDefines::HorizontalAxisType::TIME, "TIME", "Time" );
|
||||
addItem( RiaDefines::HorizontalAxisType::SUMMARY_VECTOR, "SUMMARY_VECTOR", "Summary Vector" );
|
||||
setDefault( RiaDefines::HorizontalAxisType::SUMMARY_VECTOR );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
||||
@@ -29,6 +29,12 @@ enum class FileType
|
||||
STIMPLAN_SUMMARY
|
||||
};
|
||||
|
||||
enum class HorizontalAxisType
|
||||
{
|
||||
TIME,
|
||||
SUMMARY_VECTOR
|
||||
};
|
||||
|
||||
QString summaryField();
|
||||
QString summaryAquifer();
|
||||
QString summaryNetwork();
|
||||
|
||||
@@ -32,6 +32,7 @@ using namespace RifEclipseSummaryAddressDefines;
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryAddressAnalyzer::RiaSummaryAddressAnalyzer()
|
||||
: m_onlyCrossPlotCurves( false )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -57,6 +58,23 @@ void RiaSummaryAddressAnalyzer::appendAddresses( const std::set<RifEclipseSummar
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryAddressAnalyzer::appendAddresses( const std::vector<RiaSummaryCurveAddress>& addresses )
|
||||
{
|
||||
// RiaSummaryCurveAddress can be used to represent cross plot curves. Set the flag m_onlyCrossPlotCurves to true, and this will be set
|
||||
// to false in analyzeSingleAddress if we detect a time curve
|
||||
|
||||
m_onlyCrossPlotCurves = true;
|
||||
|
||||
for ( const auto& adr : addresses )
|
||||
{
|
||||
analyzeSingleAddress( adr.summaryAddressX() );
|
||||
analyzeSingleAddress( adr.summaryAddressY() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -100,6 +118,14 @@ bool RiaSummaryAddressAnalyzer::isSingleQuantityIgnoreHistory() const
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaSummaryAddressAnalyzer::onlyCrossPlotCurves() const
|
||||
{
|
||||
return m_onlyCrossPlotCurves;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -110,6 +136,20 @@ std::string RiaSummaryAddressAnalyzer::quantityNameForTitle() const
|
||||
return *quantities().begin();
|
||||
}
|
||||
|
||||
if ( quantities().size() == 2 && m_onlyCrossPlotCurves )
|
||||
{
|
||||
// We have a cross plot with only one curve
|
||||
|
||||
std::string title;
|
||||
for ( const auto& quantity : quantities() )
|
||||
{
|
||||
if ( !title.empty() ) title += " | ";
|
||||
title += quantity;
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
if ( quantities().size() == 2 && quantityNamesWithHistory().size() == 1 )
|
||||
{
|
||||
return *quantityNamesWithHistory().begin();
|
||||
@@ -429,6 +469,14 @@ void RiaSummaryAddressAnalyzer::computeQuantityNamesWithHistory() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryAddressAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddress& address )
|
||||
{
|
||||
if ( address.category() == SummaryCategory::SUMMARY_TIME )
|
||||
{
|
||||
m_onlyCrossPlotCurves = false;
|
||||
|
||||
// A time address has no other information than SummaryCategory::SUMMARY_TIME
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string& wellName = address.wellName();
|
||||
|
||||
if ( !wellName.empty() )
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaSummaryCurveAddress.h"
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include <set>
|
||||
@@ -39,6 +40,7 @@ public:
|
||||
|
||||
void appendAddresses( const std::set<RifEclipseSummaryAddress>& allAddresses );
|
||||
void appendAddresses( const std::vector<RifEclipseSummaryAddress>& allAddresses );
|
||||
void appendAddresses( const std::vector<RiaSummaryCurveAddress>& addresses );
|
||||
|
||||
void clear();
|
||||
|
||||
@@ -48,6 +50,8 @@ public:
|
||||
|
||||
bool isSingleQuantityIgnoreHistory() const;
|
||||
|
||||
bool onlyCrossPlotCurves() const;
|
||||
|
||||
std::string quantityNameForTitle() const;
|
||||
|
||||
std::set<std::string> wellNames() const;
|
||||
@@ -104,4 +108,6 @@ private:
|
||||
std::multimap<int, RifEclipseSummaryAddress> m_aquifers;
|
||||
|
||||
std::map<RifEclipseSummaryAddressDefines::SummaryCategory, std::set<std::string>> m_categories;
|
||||
|
||||
bool m_onlyCrossPlotCurves;
|
||||
};
|
||||
|
||||
@@ -354,3 +354,26 @@ QList<caf::PdmOptionItemInfo> RiaSummaryTools::optionsForSummaryCases( const std
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryTools::copyCurveDataSources( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve )
|
||||
{
|
||||
curve.setSummaryAddressX( otherCurve.summaryAddressX() );
|
||||
curve.setSummaryCaseX( otherCurve.summaryCaseX() );
|
||||
|
||||
curve.setSummaryAddressY( otherCurve.summaryAddressY() );
|
||||
curve.setSummaryCaseY( otherCurve.summaryCaseY() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryTools::copyCurveAxisData( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve )
|
||||
{
|
||||
curve.setAxisTypeX( otherCurve.axisTypeX() );
|
||||
curve.setTopOrBottomAxisX( otherCurve.axisX() );
|
||||
|
||||
curve.setLeftOrRightAxisY( otherCurve.axisY() );
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ class RimSummaryCaseCollection;
|
||||
class RimSummaryTable;
|
||||
class RimSummaryTableCollection;
|
||||
class RimObservedDataCollection;
|
||||
class RimSummaryCurve;
|
||||
|
||||
class RifEclipseSummaryAddress;
|
||||
|
||||
@@ -88,4 +89,7 @@ public:
|
||||
|
||||
static QList<caf::PdmOptionItemInfo> optionsForAllSummaryCases();
|
||||
static QList<caf::PdmOptionItemInfo> optionsForSummaryCases( const std::vector<RimSummaryCase*>& cases );
|
||||
|
||||
static void copyCurveDataSources( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve );
|
||||
static void copyCurveAxisData( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve );
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user