mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9671 summary calculations for summary items
* Summary Calculation: use shorter name in title * Sort summary addresses to group calculated results last. * Summary Calculation: add option to distribute calculation to other items. * Add support for summary calculation for RimGridSummaryCase. * Use short name for calculations in plot titles. * Update ensembles in Data Sources when calculation is added. * Summary Calculation: allow drag-and-drop of ensembles * Summary Plot: fix axis range aggregation for calculated ensemble addresses. --------- Co-authored-by: Kristian Bendiksen <kristian.bendiksen@gmail.com>
This commit is contained in:
@@ -18,7 +18,6 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedSummaryData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryObservedDataFile.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedEclipseUserData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCalculatedSummaryCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCalculatedSummaryCurveReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddress.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryCrossPlot.h
|
||||
@@ -70,7 +69,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedSummaryData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryObservedDataFile.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedEclipseUserData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCalculatedSummaryCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCalculatedSummaryCurveReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddress.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryCrossPlot.cpp
|
||||
|
||||
@@ -1,88 +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 "RimCalculatedSummaryCase.h"
|
||||
|
||||
#include "RiaSummaryDefines.h"
|
||||
|
||||
#include "RimSummaryCalculation.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimCalculatedSummaryCase, "CalculatedSummaryCase" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCalculatedSummaryCase::RimCalculatedSummaryCase()
|
||||
{
|
||||
CAF_PDM_InitObject( "Calculated", ":/SummaryCase.svg" );
|
||||
|
||||
m_calculatedCurveReader = nullptr;
|
||||
m_displayName = RiaDefines::summaryCalculated();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCalculatedSummaryCase::~RimCalculatedSummaryCase()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCalculatedSummaryCase::caseName() const
|
||||
{
|
||||
return RiaDefines::summaryCalculated();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCalculatedSummaryCase::createSummaryReaderInterface()
|
||||
{
|
||||
if ( !m_calculatedCurveReader )
|
||||
{
|
||||
RimSummaryCalculationCollection* calculationCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( calculationCollection );
|
||||
|
||||
m_calculatedCurveReader.reset( new RifCalculatedSummaryCurveReader( calculationCollection ) );
|
||||
|
||||
m_calculatedCurveReader->buildMetaData();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifSummaryReaderInterface* RimCalculatedSummaryCase::summaryReader()
|
||||
{
|
||||
if ( !m_calculatedCurveReader ) createSummaryReaderInterface();
|
||||
|
||||
return m_calculatedCurveReader.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCalculatedSummaryCase::buildMetaData()
|
||||
{
|
||||
if ( !m_calculatedCurveReader ) createSummaryReaderInterface();
|
||||
|
||||
m_calculatedCurveReader->buildMetaData();
|
||||
}
|
||||
@@ -1,50 +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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
#include "RimCalculatedSummaryCurveReader.h"
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class RifCalculatedSummaryCurveReader;
|
||||
class RimSummaryCalculation;
|
||||
class RimSummaryCalculationCollection;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimCalculatedSummaryCase : public RimSummaryCase
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimCalculatedSummaryCase();
|
||||
~RimCalculatedSummaryCase() override;
|
||||
|
||||
QString caseName() const override;
|
||||
void createSummaryReaderInterface() override;
|
||||
RifSummaryReaderInterface* summaryReader() override;
|
||||
|
||||
void buildMetaData();
|
||||
|
||||
private:
|
||||
std::unique_ptr<RifCalculatedSummaryCurveReader> m_calculatedCurveReader;
|
||||
};
|
||||
@@ -18,15 +18,20 @@
|
||||
|
||||
#include "RimCalculatedSummaryCurveReader.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RimSummaryCalculation.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
#include "RimUserDefinedCalculation.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifCalculatedSummaryCurveReader::RifCalculatedSummaryCurveReader( RimSummaryCalculationCollection* calculationCollection )
|
||||
RifCalculatedSummaryCurveReader::RifCalculatedSummaryCurveReader( RimSummaryCalculationCollection* calculationCollection,
|
||||
RimSummaryCase* summaryCase )
|
||||
: m_calculationCollection( calculationCollection )
|
||||
, m_summaryCase( summaryCase )
|
||||
{
|
||||
CAF_ASSERT( summaryCase );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -35,9 +40,10 @@ RifCalculatedSummaryCurveReader::RifCalculatedSummaryCurveReader( RimSummaryCalc
|
||||
std::vector<time_t> RifCalculatedSummaryCurveReader::timeSteps( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
RimSummaryCalculation* calc = findCalculationByName( resultAddress );
|
||||
if ( calc )
|
||||
if ( calc && m_summaryCase )
|
||||
{
|
||||
return calc->timeSteps();
|
||||
RimSummaryCalculationAddress address( resultAddress );
|
||||
return calc->timeSteps( m_summaryCase, address );
|
||||
}
|
||||
|
||||
return {};
|
||||
@@ -49,9 +55,10 @@ std::vector<time_t> RifCalculatedSummaryCurveReader::timeSteps( const RifEclipse
|
||||
bool RifCalculatedSummaryCurveReader::values( const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values ) const
|
||||
{
|
||||
RimSummaryCalculation* calc = findCalculationByName( resultAddress );
|
||||
if ( calc )
|
||||
if ( calc && m_summaryCase )
|
||||
{
|
||||
*values = calc->values();
|
||||
RimSummaryCalculationAddress address( resultAddress );
|
||||
*values = calc->values( m_summaryCase, address );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -82,8 +89,17 @@ void RifCalculatedSummaryCurveReader::buildMetaData()
|
||||
|
||||
for ( RimUserDefinedCalculation* calc : m_calculationCollection->calculations() )
|
||||
{
|
||||
m_allResultAddresses.insert(
|
||||
RifEclipseSummaryAddress::calculatedAddress( calc->description().toStdString(), calc->id() ) );
|
||||
RimSummaryCalculation* sumCalc = dynamic_cast<RimSummaryCalculation*>( calc );
|
||||
CAF_ASSERT( sumCalc );
|
||||
|
||||
const auto& allAddresses = sumCalc->allAddressesForSummaryCase( m_summaryCase );
|
||||
for ( auto calculationAddress : allAddresses )
|
||||
{
|
||||
if ( calculationAddress.address().isValid() )
|
||||
{
|
||||
m_allResultAddresses.insert( calculationAddress.address() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,12 +109,9 @@ void RifCalculatedSummaryCurveReader::buildMetaData()
|
||||
RimSummaryCalculation*
|
||||
RifCalculatedSummaryCurveReader::findCalculationByName( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
if ( m_calculationCollection && resultAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
|
||||
{
|
||||
return dynamic_cast<RimSummaryCalculation*>( m_calculationCollection->findCalculationById( resultAddress.id() ) );
|
||||
}
|
||||
if ( !m_calculationCollection || !resultAddress.isCalculated() ) return nullptr;
|
||||
|
||||
return nullptr;
|
||||
return dynamic_cast<RimSummaryCalculation*>( m_calculationCollection->findCalculationById( resultAddress.id() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -33,7 +33,8 @@ class RimSummaryCalculationCollection;
|
||||
class RifCalculatedSummaryCurveReader : public RifSummaryReaderInterface
|
||||
{
|
||||
public:
|
||||
explicit RifCalculatedSummaryCurveReader( RimSummaryCalculationCollection* calculationCollection );
|
||||
explicit RifCalculatedSummaryCurveReader( RimSummaryCalculationCollection* calculationCollection,
|
||||
RimSummaryCase* summaryCase );
|
||||
|
||||
std::vector<time_t> timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
bool values( const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values ) const override;
|
||||
@@ -48,4 +49,5 @@ private:
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimSummaryCalculationCollection> m_calculationCollection;
|
||||
caf::PdmPointer<RimSummaryCase> m_summaryCase;
|
||||
};
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
#include "RiaTimeTTools.h"
|
||||
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
#include "SummaryPlotCommands/RicSummaryPlotEditorUi.h"
|
||||
|
||||
#include "RifEnsembleStatisticsReader.h"
|
||||
@@ -46,6 +47,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
|
||||
@@ -32,8 +32,10 @@
|
||||
#include "RifReaderOpmRft.h"
|
||||
#include "RifSummaryReaderMultipleFiles.h"
|
||||
|
||||
#include "RimCalculatedSummaryCurveReader.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRftCase.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
@@ -116,14 +118,20 @@ void RimFileSummaryCase::createSummaryReaderInterfaceThreadSafe( RiaThreadSafeLo
|
||||
void RimFileSummaryCase::createSummaryReaderInterface()
|
||||
{
|
||||
RiaThreadSafeLogger threadSafeLogger;
|
||||
m_fileSummaryReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(),
|
||||
m_fileSummaryReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(),
|
||||
m_includeRestartFiles,
|
||||
&threadSafeLogger );
|
||||
|
||||
RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection();
|
||||
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( calcColl, this );
|
||||
|
||||
m_multiSummaryReader = new RifMultipleSummaryReaders;
|
||||
m_multiSummaryReader->addReader( m_fileSummaryReader.p() );
|
||||
|
||||
openAndAttachAdditionalReader();
|
||||
|
||||
m_multiSummaryReader->addReader( m_calculatedSummaryReader.p() );
|
||||
|
||||
auto messages = threadSafeLogger.messages();
|
||||
for ( const auto& m : messages )
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ class RifOpmCommonEclipseSummary;
|
||||
class RifEclipseSummaryAddress;
|
||||
class RifMultipleSummaryReaders;
|
||||
class RimRftCase;
|
||||
class RifCalculatedSummaryCurveReader;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@@ -77,10 +78,11 @@ private:
|
||||
static RifReaderOpmRft* findRftDataAndCreateReader( const QString& rftFileName, const QString& dataDeckFileName );
|
||||
|
||||
private:
|
||||
cvf::ref<RifSummaryReaderInterface> m_fileSummaryReader;
|
||||
cvf::ref<RifMultipleSummaryReaders> m_multiSummaryReader;
|
||||
cvf::ref<RifReaderOpmRft> m_summaryEclipseRftReader;
|
||||
caf::PdmField<bool> m_includeRestartFiles;
|
||||
cvf::ref<RifSummaryReaderInterface> m_fileSummaryReader;
|
||||
cvf::ref<RifCalculatedSummaryCurveReader> m_calculatedSummaryReader;
|
||||
cvf::ref<RifMultipleSummaryReaders> m_multiSummaryReader;
|
||||
cvf::ref<RifReaderOpmRft> m_summaryEclipseRftReader;
|
||||
caf::PdmField<bool> m_includeRestartFiles;
|
||||
|
||||
caf::PdmField<caf::FilePath> m_additionalSummaryFilePath;
|
||||
cvf::ref<RifOpmCommonEclipseSummary> m_additionalSummaryFileReader;
|
||||
|
||||
@@ -20,11 +20,14 @@
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "RifMultipleSummaryReaders.h"
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
#include "RimCalculatedSummaryCurveReader.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimFileSummaryCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
|
||||
@@ -179,9 +182,16 @@ QString RimGridSummaryCase::eclipseGridFileName() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridSummaryCase::createSummaryReaderInterface()
|
||||
{
|
||||
m_summaryFileReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(),
|
||||
m_fileSummaryReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(),
|
||||
m_includeRestartFiles,
|
||||
nullptr );
|
||||
|
||||
m_multiSummaryReader = new RifMultipleSummaryReaders;
|
||||
m_multiSummaryReader->addReader( m_fileSummaryReader.p() );
|
||||
|
||||
RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection();
|
||||
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( calcColl, this );
|
||||
m_multiSummaryReader->addReader( m_calculatedSummaryReader.p() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -189,11 +199,11 @@ void RimGridSummaryCase::createSummaryReaderInterface()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifSummaryReaderInterface* RimGridSummaryCase::summaryReader()
|
||||
{
|
||||
if ( m_summaryFileReader.isNull() )
|
||||
if ( m_multiSummaryReader.isNull() )
|
||||
{
|
||||
createSummaryReaderInterface();
|
||||
}
|
||||
return m_summaryFileReader.p();
|
||||
return m_multiSummaryReader.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RifMultipleSummaryReaders.h"
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
#include "cafPdmProxyValueField.h"
|
||||
@@ -27,6 +28,8 @@
|
||||
class RimEclipseCase;
|
||||
class RifSummaryReaderInterface;
|
||||
class RimFileSummaryCase;
|
||||
class RifCalculatedSummaryCurveReader;
|
||||
class RifMultipleSummaryReaders;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@@ -63,6 +66,8 @@ private:
|
||||
mutable caf::PdmField<QString> m_cachedCaseName;
|
||||
caf::PdmProxyValueField<QString> m_eclipseGridFileName;
|
||||
|
||||
cvf::ref<RifSummaryReaderInterface> m_summaryFileReader;
|
||||
caf::PdmField<bool> m_includeRestartFiles;
|
||||
cvf::ref<RifSummaryReaderInterface> m_fileSummaryReader;
|
||||
cvf::ref<RifCalculatedSummaryCurveReader> m_calculatedSummaryReader;
|
||||
cvf::ref<RifMultipleSummaryReaders> m_multiSummaryReader;
|
||||
caf::PdmField<bool> m_includeRestartFiles;
|
||||
};
|
||||
|
||||
@@ -47,7 +47,6 @@ void caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::setUp()
|
||||
addItem( RifAdr::SUMMARY_WELL_SEGMENT, "SUMMARY_SEGMENT", RiaDefines::summarySegment() );
|
||||
addItem( RifAdr::SUMMARY_BLOCK, "SUMMARY_BLOCK", RiaDefines::summaryBlock() );
|
||||
addItem( RifAdr::SUMMARY_BLOCK_LGR, "SUMMARY_BLOCK_LGR", RiaDefines::summaryLgrBlock() );
|
||||
addItem( RifAdr::SUMMARY_CALCULATED, "SUMMARY_CALCULATED", RiaDefines::summaryCalculated() );
|
||||
addItem( RifAdr::SUMMARY_IMPORTED, "SUMMARY_IMPORTED", "Imported" );
|
||||
addItem( RifAdr::SUMMARY_ENSEMBLE_STATISTICS, "SUMMARY_ENSEMBLE_STATISTICS", "Ensemble Statistics" );
|
||||
setDefault( RifAdr::SUMMARY_FIELD );
|
||||
@@ -137,6 +136,7 @@ void RimSummaryAddress::setAddress( const RifEclipseSummaryAddress& addr )
|
||||
m_calculationId = addr.id();
|
||||
|
||||
setUiName( m_vectorName );
|
||||
setUiIconFromResourceString( iconResourceText() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -160,27 +160,6 @@ RifEclipseSummaryAddress RimSummaryAddress::address() const
|
||||
m_calculationId );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryAddress::ensureCalculationIdIsAssigned()
|
||||
{
|
||||
if ( m_category == RifEclipseSummaryAddress::SUMMARY_CALCULATED && m_calculationId == -1 )
|
||||
{
|
||||
RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection();
|
||||
|
||||
for ( const RimUserDefinedCalculation* c : calcColl->calculations() )
|
||||
{
|
||||
QString description = c->description();
|
||||
|
||||
if ( description == m_vectorName )
|
||||
{
|
||||
m_calculationId = c->id();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Return phase type if the current result is known to be of a particular
|
||||
/// fluid phase type. Otherwise the method will return PHASE_NOT_APPLICABLE.
|
||||
@@ -271,3 +250,13 @@ bool RimSummaryAddress::isEnsemble() const
|
||||
{
|
||||
return m_ensembleId >= 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryAddress::iconResourceText() const
|
||||
{
|
||||
if ( m_calculationId != -1 ) return ":/summary/components/images/calculated.svg";
|
||||
|
||||
return ":/DataVector.png";
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ public:
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
QString iconResourceText() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_category;
|
||||
|
||||
|
||||
@@ -180,10 +180,22 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::set<RifEclip
|
||||
auto* lgrwell = getOrCreateSubfolder( CollectionContentType::WELL_LGR );
|
||||
auto* lgrcompletion = getOrCreateSubfolder( CollectionContentType::WELL_COMPLETION_LGR );
|
||||
auto* lgrblock = getOrCreateSubfolder( CollectionContentType::BLOCK_LGR );
|
||||
auto* calculated = getOrCreateSubfolder( CollectionContentType::CALCULATED );
|
||||
auto* imported = getOrCreateSubfolder( CollectionContentType::IMPORTED );
|
||||
|
||||
for ( const auto& address : addresses )
|
||||
// Sort addresses to have calculated results last per category
|
||||
std::vector<RifEclipseSummaryAddress> sortedAddresses( addresses.size() );
|
||||
std::copy( addresses.begin(), addresses.end(), sortedAddresses.begin() );
|
||||
std::sort( sortedAddresses.begin(),
|
||||
sortedAddresses.end(),
|
||||
[]( const RifEclipseSummaryAddress& a, const RifEclipseSummaryAddress& b ) -> bool {
|
||||
if ( a.category() < b.category() ) return false;
|
||||
// Calculated results are sorted last.
|
||||
if ( a.isCalculated() && !b.isCalculated() ) return false;
|
||||
if ( !a.isCalculated() && b.isCalculated() ) return true;
|
||||
return a.vectorName() < b.vectorName();
|
||||
} );
|
||||
|
||||
for ( const auto& address : sortedAddresses )
|
||||
{
|
||||
switch ( address.category() )
|
||||
{
|
||||
@@ -301,14 +313,6 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::set<RifEclip
|
||||
ensembleId );
|
||||
break;
|
||||
|
||||
case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_CALCULATED:
|
||||
calculated->addToSubfolder( QString::fromStdString( address.itemUiText() ),
|
||||
CollectionContentType::CALCULATED,
|
||||
address,
|
||||
caseId,
|
||||
ensembleId );
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryAddressCollection.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
@@ -244,7 +245,8 @@ void RimSummaryCase::buildChildNodes()
|
||||
RifSummaryReaderInterface* reader = summaryReader();
|
||||
if ( !reader ) return;
|
||||
|
||||
m_dataVectorFolders->updateFolderStructure( reader->allResultAddresses(), m_caseId );
|
||||
auto addresses = reader->allResultAddresses();
|
||||
m_dataVectorFolders->updateFolderStructure( addresses, m_caseId );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "RimGridSummaryCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryAddressCollection.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
#include "RifReaderEclipseRft.h"
|
||||
@@ -328,6 +329,7 @@ std::set<RifEclipseSummaryAddress> RimSummaryCaseCollection::ensembleSummaryAddr
|
||||
const std::set<RifEclipseSummaryAddress>& addrs = m_cases[maxAddrIndex]->summaryReader()->allResultAddresses();
|
||||
addresses.insert( addrs.begin(), addrs.end() );
|
||||
}
|
||||
|
||||
return addresses;
|
||||
}
|
||||
|
||||
|
||||
@@ -475,20 +475,25 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions( const caf:
|
||||
QList<caf::PdmOptionItemInfo> options = this->RimPlotCurve::calculateValueOptions( fieldNeedingOptions );
|
||||
if ( !options.isEmpty() ) return options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_yValuesSummaryCase || fieldNeedingOptions == &m_xValuesSummaryCase )
|
||||
{
|
||||
RimProject* proj = RimProject::current();
|
||||
|
||||
auto createOptionsForSummaryCase = []( RimSummaryCase* summaryCase, QList<caf::PdmOptionItemInfo>& options ) {
|
||||
RimProject* proj = RimProject::current();
|
||||
std::vector<RimSummaryCase*> cases = proj->allSummaryCases();
|
||||
|
||||
cases.push_back( proj->calculationCollection->calculationSummaryCase() );
|
||||
|
||||
options = RiaSummaryTools::optionsForSummaryCases( cases );
|
||||
|
||||
if ( options.size() > 0 )
|
||||
{
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
}
|
||||
};
|
||||
|
||||
if ( fieldNeedingOptions == &m_yValuesSummaryCase )
|
||||
{
|
||||
createOptionsForSummaryCase( m_yValuesSummaryCase, options );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_xValuesSummaryCase )
|
||||
{
|
||||
createOptionsForSummaryCase( m_xValuesSummaryCase, options );
|
||||
}
|
||||
else if ( &m_yValuesSummaryAddressUiField == fieldNeedingOptions )
|
||||
{
|
||||
|
||||
@@ -214,7 +214,7 @@ QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress&
|
||||
{
|
||||
text = summaryAddress.vectorName();
|
||||
}
|
||||
else if ( summaryAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
|
||||
else if ( summaryAddress.isCalculated() )
|
||||
{
|
||||
// Need to add case name for calculated summary
|
||||
RimProject* proj = RimProject::current();
|
||||
@@ -223,7 +223,7 @@ QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress&
|
||||
RimUserDefinedCalculation* calculation = calcColl->findCalculationById( summaryAddress.id() );
|
||||
if ( calculation )
|
||||
{
|
||||
text = calculation->description().toStdString();
|
||||
text = calculation->shortName().toStdString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress&
|
||||
|
||||
appendAddressDetails( text, summaryAddress, plotNameHelper );
|
||||
|
||||
if ( !caseName.empty() )
|
||||
if ( !caseName.empty() && !summaryAddress.isCalculated() )
|
||||
{
|
||||
bool skipSubString = plotNameHelper && plotNameHelper->isCaseInTitle();
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ void RimSummaryCurvesData::populateSummaryCurvesData( std::vector<RimSummaryCurv
|
||||
|
||||
auto curveDataList = std::vector<CurveData>( { curveData } );
|
||||
if ( hasErrorData ) curveDataList.push_back( errorCurveData );
|
||||
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
|
||||
if ( curve->summaryAddressY().isCalculated() )
|
||||
{
|
||||
// We have calculated data, and it we cannot assume identical time axis
|
||||
curvesData->addCurveDataNoSearch( curveCaseName, ensembleName, curve->timeStepsY(), curveDataList );
|
||||
|
||||
@@ -1000,10 +1000,10 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
|
||||
auto addressesForCurve = []( RimSummaryCurve* curve, AxisRangeAggregation axisRangeAggregation ) {
|
||||
std::vector<RifEclipseSummaryAddress> addresses;
|
||||
|
||||
auto addr = curve->summaryAddressY();
|
||||
if ( axisRangeAggregation == AxisRangeAggregation::REALIZATIONS )
|
||||
{
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fieldAddress( curve->summaryAddressY().vectorName() );
|
||||
addresses = { addr };
|
||||
addresses = { RifEclipseSummaryAddress::fieldAddress( addr.vectorName(), addr.id() ) };
|
||||
}
|
||||
else if ( axisRangeAggregation == AxisRangeAggregation::WELLS ||
|
||||
axisRangeAggregation == AxisRangeAggregation::REGIONS )
|
||||
@@ -1032,7 +1032,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
|
||||
for ( const auto& wellName : analyzer->wellNames() )
|
||||
{
|
||||
addresses.push_back(
|
||||
RifEclipseSummaryAddress::wellAddress( curve->summaryAddressY().vectorName(), wellName ) );
|
||||
RifEclipseSummaryAddress::wellAddress( addr.vectorName(), wellName, addr.id() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1040,8 +1040,8 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
|
||||
{
|
||||
for ( auto regionNumber : analyzer->regionNumbers() )
|
||||
{
|
||||
addresses.push_back( RifEclipseSummaryAddress::regionAddress( curve->summaryAddressY().vectorName(),
|
||||
regionNumber ) );
|
||||
addresses.push_back(
|
||||
RifEclipseSummaryAddress::regionAddress( addr.vectorName(), regionNumber, addr.id() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryAddressCollection.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
@@ -640,8 +641,11 @@ void RimSummaryPlot::copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSu
|
||||
{
|
||||
QString data = ap->writeObjectToXmlString();
|
||||
|
||||
axisPropertiesForPlotAxis( ap->plotAxisType() )
|
||||
->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
|
||||
auto axisProperty = axisPropertiesForPlotAxis( ap->plotAxisType() );
|
||||
if ( axisProperty )
|
||||
{
|
||||
axisProperty->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2755,7 +2759,7 @@ void RimSummaryPlot::updateNameHelperWithCurveData( RimSummaryPlotNameHelper* na
|
||||
{
|
||||
for ( RimSummaryCurve* curve : m_summaryCurveCollection->curves() )
|
||||
{
|
||||
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
|
||||
if ( curve->summaryAddressY().isCalculated() )
|
||||
{
|
||||
RiaSummaryTools::getSummaryCasesAndAddressesForCalculation( curve->summaryAddressY().id(),
|
||||
sumCases,
|
||||
|
||||
@@ -219,7 +219,7 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
||||
std::string titleText;
|
||||
const std::string& quantityName = sumAddress.vectorName().substr( cutPos + 1 );
|
||||
|
||||
if ( sumAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
|
||||
if ( sumAddress.isCalculated() )
|
||||
{
|
||||
titleText = shortCalculationName( quantityName );
|
||||
}
|
||||
@@ -352,7 +352,7 @@ QString RimSummaryPlotAxisFormatter::createAxisObjectName() const
|
||||
std::string name;
|
||||
const std::string& quantityName = sumAddress.vectorName().substr( cutPos + 1 );
|
||||
|
||||
if ( sumAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
|
||||
if ( sumAddress.isCalculated() )
|
||||
{
|
||||
name = shortCalculationName( quantityName );
|
||||
}
|
||||
|
||||
@@ -400,9 +400,6 @@ std::vector<SummarySource*> RimSummaryPlotFilterTextCurveSetEditor::selectedSumm
|
||||
sources.push_back( source );
|
||||
}
|
||||
|
||||
// Always add the summary case for calculated curves as this case is not displayed in UI
|
||||
sources.push_back( RimProject::current()->calculationCollection()->calculationSummaryCase() );
|
||||
|
||||
return sources;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user