mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Rename delta ensemble and case
Rename to RimDeltaSummaryCase and inherit RifSummaryReaderInterface Rename to RimDeltaSummaryEnsemble Remove obsolete RifDerivedEnsembleReader
This commit is contained in:
parent
11a3c66a0b
commit
7550b8702c
@ -22,7 +22,7 @@
|
||||
|
||||
#include "RicCloseSummaryCaseFeature.h"
|
||||
|
||||
#include "RimDerivedEnsembleCaseCollection.h"
|
||||
#include "RimDeltaSummaryEnsemble.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
@ -64,7 +64,7 @@ bool RicCloseSummaryCaseInCollectionFeature::isCommandEnabled() const
|
||||
summaryCaseCollections.erase( std::remove_if( summaryCaseCollections.begin(),
|
||||
summaryCaseCollections.end(),
|
||||
[]( RimSummaryEnsemble* coll )
|
||||
{ return dynamic_cast<RimDerivedEnsembleCaseCollection*>( coll ) != nullptr; } ),
|
||||
{ return dynamic_cast<RimDeltaSummaryEnsemble*>( coll ) != nullptr; } ),
|
||||
summaryCaseCollections.end() );
|
||||
|
||||
return ( !summaryCaseMainCollections.empty() || !summaryCaseCollections.empty() );
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "Summary/RiaSummaryTools.h"
|
||||
|
||||
#include "RimDerivedEnsembleCaseCollection.h"
|
||||
#include "RimDeltaSummaryEnsemble.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
@ -70,8 +70,7 @@ bool RicDeleteSummaryCaseCollectionFeature::isCommandEnabled() const
|
||||
|
||||
selection.erase( std::remove_if( selection.begin(),
|
||||
selection.end(),
|
||||
[]( RimSummaryEnsemble* coll )
|
||||
{ return dynamic_cast<RimDerivedEnsembleCaseCollection*>( coll ) != nullptr; } ),
|
||||
[]( RimSummaryEnsemble* coll ) { return dynamic_cast<RimDeltaSummaryEnsemble*>( coll ) != nullptr; } ),
|
||||
selection.end() );
|
||||
return ( !selection.empty() );
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicNewDerivedEnsembleFeature.h"
|
||||
|
||||
#include "RimDerivedEnsembleCaseCollection.h"
|
||||
#include "RimDeltaSummaryEnsemble.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
|
||||
@ -78,8 +78,8 @@ void RicNewDerivedEnsembleFeature::onActionTriggered( bool isChecked )
|
||||
auto project = RimProject::current();
|
||||
auto mainColl = project->firstSummaryCaseMainCollection();
|
||||
|
||||
auto newColl = mainColl->addEnsemble( {}, "", true, []() { return new RimDerivedEnsembleCaseCollection(); } );
|
||||
auto newEnsemble = dynamic_cast<RimDerivedEnsembleCaseCollection*>( newColl );
|
||||
auto newColl = mainColl->addEnsemble( {}, "", true, []() { return new RimDeltaSummaryEnsemble(); } );
|
||||
auto newEnsemble = dynamic_cast<RimDeltaSummaryEnsemble*>( newColl );
|
||||
|
||||
{
|
||||
std::vector<RimSummaryEnsemble*> ensembles = caf::selectedObjectsByType<RimSummaryEnsemble*>();
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicNewDerivedSummaryFeature.h"
|
||||
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimDeltaSummaryCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
|
||||
@ -46,7 +46,7 @@ void RicNewDerivedSummaryFeature::onActionTriggered( bool isChecked )
|
||||
auto mainColl = mainCollection();
|
||||
if ( mainColl )
|
||||
{
|
||||
auto derivedCase = new RimDerivedSummaryCase;
|
||||
auto derivedCase = new RimDeltaSummaryCase;
|
||||
|
||||
auto selectedCases = twoSelectedSummaryCases();
|
||||
if ( selectedCases.empty() )
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "RiuSummaryCurveDefinitionKeywords.h"
|
||||
|
||||
#include "RimDerivedEnsembleCaseCollection.h"
|
||||
#include "RimDeltaSummaryEnsemble.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
#include "RimEnsembleCurveSetColorManager.h"
|
||||
|
@ -47,7 +47,6 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifCaseRealizationParametersReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFileParseTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderEnsembleStatisticsRft.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifDerivedEnsembleReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifActiveCellsReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifCsvDataTableFormatter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifEclipseInputPropertyLoader.h
|
||||
@ -149,7 +148,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSummaryCaseRestartSelector.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifCaseRealizationParametersReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFileParseTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifDerivedEnsembleReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifActiveCellsReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifCsvDataTableFormatter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderEnsembleStatisticsRft.cpp
|
||||
|
@ -1,105 +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 "RifDerivedEnsembleReader.h"
|
||||
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifDerivedEnsembleReader::RifDerivedEnsembleReader( RimDerivedSummaryCase* derivedCase,
|
||||
RifSummaryReaderInterface* sourceSummaryReader1,
|
||||
RifSummaryReaderInterface* sourceSummaryReader2 )
|
||||
{
|
||||
CVF_ASSERT( derivedCase );
|
||||
|
||||
m_derivedCase = derivedCase;
|
||||
|
||||
if ( sourceSummaryReader1 )
|
||||
{
|
||||
m_allResultAddresses = sourceSummaryReader1->allResultAddresses();
|
||||
m_allErrorAddresses = sourceSummaryReader1->allErrorAddresses();
|
||||
}
|
||||
if ( sourceSummaryReader2 )
|
||||
{
|
||||
for ( auto a : sourceSummaryReader2->allResultAddresses() )
|
||||
{
|
||||
m_allResultAddresses.insert( a );
|
||||
}
|
||||
for ( auto a : sourceSummaryReader2->allErrorAddresses() )
|
||||
{
|
||||
m_allErrorAddresses.insert( a );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<time_t> RifDerivedEnsembleReader::timeSteps( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
if ( !resultAddress.isValid() )
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
if ( m_derivedCase->needsCalculation( resultAddress ) )
|
||||
{
|
||||
m_derivedCase->calculate( resultAddress );
|
||||
}
|
||||
|
||||
return m_derivedCase->timeSteps( resultAddress );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<bool, std::vector<double>> RifDerivedEnsembleReader::values( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
if ( !resultAddress.isValid() ) return { false, {} };
|
||||
|
||||
if ( m_derivedCase->needsCalculation( resultAddress ) )
|
||||
{
|
||||
m_derivedCase->calculate( resultAddress );
|
||||
}
|
||||
|
||||
auto dataValues = m_derivedCase->values( resultAddress );
|
||||
|
||||
std::vector<double> values;
|
||||
values.reserve( dataValues.size() );
|
||||
for ( auto val : dataValues )
|
||||
values.push_back( val );
|
||||
return { true, values };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifDerivedEnsembleReader::unitName( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::EclipseUnitSystem RifDerivedEnsembleReader::unitSystem() const
|
||||
{
|
||||
return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
|
||||
}
|
@ -1,44 +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"
|
||||
|
||||
class RimDerivedSummaryCase;
|
||||
class RimSummaryCase;
|
||||
class RifEclipseSummaryAddress;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RifDerivedEnsembleReader : public RifSummaryReaderInterface
|
||||
{
|
||||
public:
|
||||
RifDerivedEnsembleReader( RimDerivedSummaryCase* derivedCase,
|
||||
RifSummaryReaderInterface* sourceSummaryReader1,
|
||||
RifSummaryReaderInterface* sourceSummaryReader2 );
|
||||
|
||||
std::vector<time_t> timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
std::pair<bool, std::vector<double>> values( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
RiaDefines::EclipseUnitSystem unitSystem() const override;
|
||||
|
||||
private:
|
||||
RimDerivedSummaryCase* m_derivedCase;
|
||||
};
|
@ -28,7 +28,7 @@
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RimAnalysisPlotDataEntry.h"
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimDeltaSummaryCase.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
#include "RimPlotDataFilterCollection.h"
|
||||
@ -1442,7 +1442,7 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
||||
if ( referenceCaseReader )
|
||||
{
|
||||
std::pair<std::vector<time_t>, std::vector<double>> timeAndValues =
|
||||
RimDerivedSummaryCase::calculateDerivedValues( reader,
|
||||
RimDeltaSummaryCase::calculateDerivedValues( reader,
|
||||
-1,
|
||||
referenceCaseReader,
|
||||
-1,
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "RigEnsembleParameter.h"
|
||||
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimDeltaSummaryCase.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimDeltaSummaryCase.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "RigEnsembleParameter.h"
|
||||
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimDeltaSummaryCase.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
|
@ -31,8 +31,8 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveFilterCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatistics.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatisticsCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedSummaryCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCaseCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDeltaSummaryCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDeltaSummaryEnsemble.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunction.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunctionTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotManager.h
|
||||
@ -89,8 +89,8 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveFilterCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatistics.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatisticsCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedSummaryCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCaseCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDeltaSummaryCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDeltaSummaryEnsemble.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunction.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunctionTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotManager.cpp
|
||||
|
@ -16,14 +16,12 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimDeltaSummaryCase.h"
|
||||
|
||||
#include "RiaCurveMerger.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include "RifDerivedEnsembleReader.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryEnsemble.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
@ -46,21 +44,80 @@ void caf::AppEnum<DerivedSummaryOperator>::setUp()
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimDerivedSummaryCase::FixedTimeStepMode>::setUp()
|
||||
void caf::AppEnum<RimDeltaSummaryCase::FixedTimeStepMode>::setUp()
|
||||
{
|
||||
addItem( RimDerivedSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_NONE, "FIXED_TIME_STEP_NONE", "None" );
|
||||
addItem( RimDerivedSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_CASE_1, "FIXED_TIME_STEP_CASE_1", "Summary Case 1" );
|
||||
addItem( RimDerivedSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_CASE_2, "FIXED_TIME_STEP_CASE_2", "Summary Case 2" );
|
||||
setDefault( RimDerivedSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_NONE );
|
||||
addItem( RimDeltaSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_NONE, "FIXED_TIME_STEP_NONE", "None" );
|
||||
addItem( RimDeltaSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_CASE_1, "FIXED_TIME_STEP_CASE_1", "Summary Case 1" );
|
||||
addItem( RimDeltaSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_CASE_2, "FIXED_TIME_STEP_CASE_2", "Summary Case 2" );
|
||||
setDefault( RimDeltaSummaryCase::FixedTimeStepMode::FIXED_TIME_STEP_NONE );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimDerivedSummaryCase, "RimDerivedEnsembleCase" );
|
||||
CAF_PDM_SOURCE_INIT( RimDeltaSummaryCase, "RimDeltaSummaryCase", "RimDerivedEnsembleCase" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDerivedSummaryCase::RimDerivedSummaryCase()
|
||||
std::string RimDeltaSummaryCase::unitName( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<time_t> RimDeltaSummaryCase::timeSteps( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
if ( !resultAddress.isValid() )
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
if ( needsCalculation( resultAddress ) )
|
||||
{
|
||||
calculate( resultAddress );
|
||||
}
|
||||
|
||||
if ( m_dataCache.count( resultAddress ) == 0 )
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
return m_dataCache.at( resultAddress ).first;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<bool, std::vector<double>> RimDeltaSummaryCase::values( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
if ( !resultAddress.isValid() ) return { false, {} };
|
||||
|
||||
if ( needsCalculation( resultAddress ) )
|
||||
{
|
||||
calculate( resultAddress );
|
||||
}
|
||||
|
||||
if ( m_dataCache.count( resultAddress ) == 0 )
|
||||
{
|
||||
return { false, {} };
|
||||
}
|
||||
|
||||
return { true, m_dataCache.at( resultAddress ).second };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::EclipseUnitSystem RimDeltaSummaryCase::unitSystem() const
|
||||
{
|
||||
return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDeltaSummaryCase::RimDeltaSummaryCase()
|
||||
: m_summaryCase1( nullptr )
|
||||
, m_summaryCase2( nullptr )
|
||||
{
|
||||
@ -81,14 +138,7 @@ RimDerivedSummaryCase::RimDerivedSummaryCase()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDerivedSummaryCase::~RimDerivedSummaryCase()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::setInUse( bool inUse )
|
||||
void RimDeltaSummaryCase::setInUse( bool inUse )
|
||||
{
|
||||
m_inUse = inUse;
|
||||
|
||||
@ -103,7 +153,7 @@ void RimDerivedSummaryCase::setInUse( bool inUse )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimDerivedSummaryCase::isInUse() const
|
||||
bool RimDeltaSummaryCase::isInUse() const
|
||||
{
|
||||
return m_inUse;
|
||||
}
|
||||
@ -111,7 +161,7 @@ bool RimDerivedSummaryCase::isInUse() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::setSummaryCases( RimSummaryCase* sumCase1, RimSummaryCase* sumCase2 )
|
||||
void RimDeltaSummaryCase::setSummaryCases( RimSummaryCase* sumCase1, RimSummaryCase* sumCase2 )
|
||||
{
|
||||
m_summaryCase1 = sumCase1;
|
||||
m_summaryCase2 = sumCase2;
|
||||
@ -120,7 +170,7 @@ void RimDerivedSummaryCase::setSummaryCases( RimSummaryCase* sumCase1, RimSummar
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimDerivedSummaryCase::needsCalculation( const RifEclipseSummaryAddress& address ) const
|
||||
bool RimDeltaSummaryCase::needsCalculation( const RifEclipseSummaryAddress& address ) const
|
||||
{
|
||||
return m_dataCache.count( address ) == 0;
|
||||
}
|
||||
@ -128,35 +178,7 @@ bool RimDerivedSummaryCase::needsCalculation( const RifEclipseSummaryAddress& ad
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<time_t>& RimDerivedSummaryCase::timeSteps( const RifEclipseSummaryAddress& address ) const
|
||||
{
|
||||
if ( m_dataCache.count( address ) == 0 )
|
||||
{
|
||||
static std::vector<time_t> empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
return m_dataCache.at( address ).first;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RimDerivedSummaryCase::values( const RifEclipseSummaryAddress& address ) const
|
||||
{
|
||||
if ( m_dataCache.count( address ) == 0 )
|
||||
{
|
||||
static std::vector<double> empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
return m_dataCache.at( address ).second;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::calculate( const RifEclipseSummaryAddress& address )
|
||||
void RimDeltaSummaryCase::calculate( const RifEclipseSummaryAddress& address ) const
|
||||
{
|
||||
clearData( address );
|
||||
|
||||
@ -188,11 +210,11 @@ void RimDerivedSummaryCase::calculate( const RifEclipseSummaryAddress& address )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<std::vector<time_t>, std::vector<double>> RimDerivedSummaryCase::calculateDerivedValues( RifSummaryReaderInterface* reader1,
|
||||
std::pair<std::vector<time_t>, std::vector<double>> RimDeltaSummaryCase::calculateDerivedValues( RifSummaryReaderInterface* reader1,
|
||||
int fixedTimeStepCase1,
|
||||
RifSummaryReaderInterface* reader2,
|
||||
int fixedTimeStepCase2,
|
||||
DerivedSummaryOperator m_operator,
|
||||
DerivedSummaryOperator summaryOperator,
|
||||
const RifEclipseSummaryAddress& address )
|
||||
{
|
||||
using ResultPair = std::pair<std::vector<time_t>, std::vector<double>>;
|
||||
@ -212,7 +234,7 @@ std::pair<std::vector<time_t>, std::vector<double>> RimDerivedSummaryCase::calcu
|
||||
else if ( !reader1->hasAddress( address ) && reader2->hasAddress( address ) )
|
||||
{
|
||||
auto [isOk, summaryValues] = reader2->values( address );
|
||||
if ( m_operator == DerivedSummaryOperator::DERIVED_OPERATOR_SUB )
|
||||
if ( summaryOperator == DerivedSummaryOperator::DERIVED_OPERATOR_SUB )
|
||||
{
|
||||
for ( auto& v : summaryValues )
|
||||
{
|
||||
@ -251,11 +273,11 @@ std::pair<std::vector<time_t>, std::vector<double>> RimDerivedSummaryCase::calcu
|
||||
{
|
||||
double valueCase1 = clampedIndexCase1 >= 0 ? values1[clampedIndexCase1] : allValues1[i];
|
||||
double valueCase2 = clampedIndexCase2 >= 0 ? values2[clampedIndexCase2] : allValues2[i];
|
||||
if ( m_operator == DerivedSummaryOperator::DERIVED_OPERATOR_SUB )
|
||||
if ( summaryOperator == DerivedSummaryOperator::DERIVED_OPERATOR_SUB )
|
||||
{
|
||||
calculatedValues.push_back( valueCase1 - valueCase2 );
|
||||
}
|
||||
else if ( m_operator == DerivedSummaryOperator::DERIVED_OPERATOR_ADD )
|
||||
else if ( summaryOperator == DerivedSummaryOperator::DERIVED_OPERATOR_ADD )
|
||||
{
|
||||
calculatedValues.push_back( valueCase1 + valueCase2 );
|
||||
}
|
||||
@ -267,7 +289,7 @@ std::pair<std::vector<time_t>, std::vector<double>> RimDerivedSummaryCase::calcu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimDerivedSummaryCase::caseName() const
|
||||
QString RimDeltaSummaryCase::caseName() const
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
@ -275,18 +297,14 @@ QString RimDerivedSummaryCase::caseName() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::createSummaryReaderInterface()
|
||||
void RimDeltaSummaryCase::createSummaryReaderInterface()
|
||||
{
|
||||
RifSummaryReaderInterface* summaryCase1Reader1 = nullptr;
|
||||
RifSummaryReaderInterface* summaryCase1Reader2 = nullptr;
|
||||
if ( m_summaryCase1 )
|
||||
{
|
||||
if ( !m_summaryCase1->summaryReader() )
|
||||
{
|
||||
m_summaryCase1->createSummaryReaderInterface();
|
||||
}
|
||||
|
||||
summaryCase1Reader1 = m_summaryCase1->summaryReader();
|
||||
}
|
||||
if ( m_summaryCase2 )
|
||||
{
|
||||
@ -294,29 +312,21 @@ void RimDerivedSummaryCase::createSummaryReaderInterface()
|
||||
{
|
||||
m_summaryCase2->createSummaryReaderInterface();
|
||||
}
|
||||
|
||||
summaryCase1Reader2 = m_summaryCase2->summaryReader();
|
||||
}
|
||||
|
||||
m_reader = std::make_unique<RifDerivedEnsembleReader>( this, summaryCase1Reader1, summaryCase1Reader2 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifSummaryReaderInterface* RimDerivedSummaryCase::summaryReader()
|
||||
RifSummaryReaderInterface* RimDeltaSummaryCase::summaryReader()
|
||||
{
|
||||
if ( !m_reader )
|
||||
{
|
||||
createSummaryReaderInterface();
|
||||
}
|
||||
return m_reader.get();
|
||||
return this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::setOperator( DerivedSummaryOperator oper )
|
||||
void RimDeltaSummaryCase::setOperator( DerivedSummaryOperator oper )
|
||||
{
|
||||
m_operator = oper;
|
||||
}
|
||||
@ -324,7 +334,7 @@ void RimDerivedSummaryCase::setOperator( DerivedSummaryOperator oper )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::setFixedTimeSteps( int fixedTimeStepCase1, int fixedTimeStepCase2 )
|
||||
void RimDeltaSummaryCase::setFixedTimeSteps( int fixedTimeStepCase1, int fixedTimeStepCase2 )
|
||||
{
|
||||
m_useFixedTimeStep = FixedTimeStepMode::FIXED_TIME_STEP_NONE;
|
||||
|
||||
@ -343,7 +353,7 @@ void RimDerivedSummaryCase::setFixedTimeSteps( int fixedTimeStepCase1, int fixed
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::clearData( const RifEclipseSummaryAddress& address )
|
||||
void RimDeltaSummaryCase::clearData( const RifEclipseSummaryAddress& address ) const
|
||||
{
|
||||
m_dataCache.erase( address );
|
||||
}
|
||||
@ -351,7 +361,7 @@ void RimDerivedSummaryCase::clearData( const RifEclipseSummaryAddress& address )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::updateDisplayNameFromCases()
|
||||
void RimDeltaSummaryCase::updateDisplayNameFromCases()
|
||||
{
|
||||
QString timeStepString;
|
||||
{
|
||||
@ -422,7 +432,7 @@ void RimDerivedSummaryCase::updateDisplayNameFromCases()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCase* RimDerivedSummaryCase::summaryCase1() const
|
||||
RimSummaryCase* RimDeltaSummaryCase::summaryCase1() const
|
||||
{
|
||||
return m_summaryCase1;
|
||||
}
|
||||
@ -430,7 +440,7 @@ RimSummaryCase* RimDerivedSummaryCase::summaryCase1() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCase* RimDerivedSummaryCase::summaryCase2() const
|
||||
RimSummaryCase* RimDeltaSummaryCase::summaryCase2() const
|
||||
{
|
||||
return m_summaryCase2;
|
||||
}
|
||||
@ -438,7 +448,7 @@ RimSummaryCase* RimDerivedSummaryCase::summaryCase2() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
void RimDeltaSummaryCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
// Base class
|
||||
uiOrdering.add( &m_displayName );
|
||||
@ -459,7 +469,7 @@ void RimDerivedSummaryCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimDerivedSummaryCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
QList<caf::PdmOptionItemInfo> RimDeltaSummaryCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
@ -501,7 +511,7 @@ QList<caf::PdmOptionItemInfo> RimDerivedSummaryCase::calculateValueOptions( cons
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
void RimDeltaSummaryCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
bool reloadData = false;
|
||||
if ( changedField == &m_summaryCase2 || changedField == &m_summaryCase1 )
|
||||
@ -552,7 +562,7 @@ void RimDerivedSummaryCase::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
void RimDeltaSummaryCase::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( &m_fixedTimeStepIndex == field )
|
||||
{
|
@ -17,6 +17,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
@ -26,8 +28,6 @@
|
||||
#include <memory>
|
||||
|
||||
class RifEclipseSummaryAddress;
|
||||
class RifSummaryReaderInterface;
|
||||
class RifDerivedEnsembleReader;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -41,7 +41,7 @@ enum class DerivedSummaryOperator
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimDerivedSummaryCase : public RimSummaryCase
|
||||
class RimDeltaSummaryCase : public RimSummaryCase, public RifSummaryReaderInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -54,8 +54,7 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
RimDerivedSummaryCase();
|
||||
~RimDerivedSummaryCase() override;
|
||||
RimDeltaSummaryCase();
|
||||
|
||||
void setInUse( bool inUse );
|
||||
bool isInUse() const;
|
||||
@ -64,10 +63,12 @@ public:
|
||||
void setFixedTimeSteps( int fixedTimeStepCase1, int fixedTimeStepCase2 );
|
||||
|
||||
bool needsCalculation( const RifEclipseSummaryAddress& address ) const;
|
||||
const std::vector<time_t>& timeSteps( const RifEclipseSummaryAddress& address ) const;
|
||||
const std::vector<double>& values( const RifEclipseSummaryAddress& address ) const;
|
||||
|
||||
void calculate( const RifEclipseSummaryAddress& address );
|
||||
std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
|
||||
std::vector<time_t> timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
std::pair<bool, std::vector<double>> values( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
RiaDefines::EclipseUnitSystem unitSystem() const override;
|
||||
|
||||
static std::pair<std::vector<time_t>, std::vector<double>> calculateDerivedValues( RifSummaryReaderInterface* reader1,
|
||||
int fixedTimeStepCase1,
|
||||
@ -94,7 +95,8 @@ private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
void clearData( const RifEclipseSummaryAddress& address );
|
||||
void calculate( const RifEclipseSummaryAddress& address ) const;
|
||||
void clearData( const RifEclipseSummaryAddress& address ) const;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimSummaryCase*> m_summaryCase1;
|
||||
@ -106,7 +108,7 @@ private:
|
||||
caf::PdmField<int> m_fixedTimeStepIndex;
|
||||
|
||||
caf::PdmField<bool> m_inUse;
|
||||
std::unique_ptr<RifDerivedEnsembleReader> m_reader;
|
||||
|
||||
std::map<RifEclipseSummaryAddress, std::pair<std::vector<time_t>, std::vector<double>>> m_dataCache;
|
||||
// Local cache considered mutable
|
||||
mutable std::map<RifEclipseSummaryAddress, std::pair<std::vector<time_t>, std::vector<double>>> m_dataCache;
|
||||
};
|
@ -20,8 +20,8 @@
|
||||
|
||||
#include "SummaryPlotCommands/RicNewDerivedEnsembleFeature.h"
|
||||
|
||||
#include "RimDerivedEnsembleCaseCollection.h"
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimDeltaSummaryCase.h"
|
||||
#include "RimDeltaSummaryEnsemble.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryEnsemble.h"
|
||||
@ -38,21 +38,21 @@
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RimDerivedEnsembleCaseCollection::FixedTimeStepMode>::setUp()
|
||||
void caf::AppEnum<RimDeltaSummaryEnsemble::FixedTimeStepMode>::setUp()
|
||||
{
|
||||
addItem( RimDerivedEnsembleCaseCollection::FixedTimeStepMode::FIXED_TIME_STEP_NONE, "FIXED_TIME_STEP_NONE", "None" );
|
||||
addItem( RimDerivedEnsembleCaseCollection::FixedTimeStepMode::FIXED_TIME_STEP_CASE_1, "FIXED_TIME_STEP_CASE_1", "Ensemble 1" );
|
||||
addItem( RimDerivedEnsembleCaseCollection::FixedTimeStepMode::FIXED_TIME_STEP_CASE_2, "FIXED_TIME_STEP_CASE_2", "Ensemble 2" );
|
||||
setDefault( RimDerivedEnsembleCaseCollection::FixedTimeStepMode::FIXED_TIME_STEP_NONE );
|
||||
addItem( RimDeltaSummaryEnsemble::FixedTimeStepMode::FIXED_TIME_STEP_NONE, "FIXED_TIME_STEP_NONE", "None" );
|
||||
addItem( RimDeltaSummaryEnsemble::FixedTimeStepMode::FIXED_TIME_STEP_CASE_1, "FIXED_TIME_STEP_CASE_1", "Ensemble 1" );
|
||||
addItem( RimDeltaSummaryEnsemble::FixedTimeStepMode::FIXED_TIME_STEP_CASE_2, "FIXED_TIME_STEP_CASE_2", "Ensemble 2" );
|
||||
setDefault( RimDeltaSummaryEnsemble::FixedTimeStepMode::FIXED_TIME_STEP_NONE );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimDerivedEnsembleCaseCollection, "RimDerivedEnsembleCaseCollection" );
|
||||
CAF_PDM_SOURCE_INIT( RimDeltaSummaryEnsemble, "RimDeltaSummaryEnsemble", "RimDerivedEnsembleCaseCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDerivedEnsembleCaseCollection::RimDerivedEnsembleCaseCollection()
|
||||
RimDeltaSummaryEnsemble::RimDeltaSummaryEnsemble()
|
||||
{
|
||||
CAF_PDM_InitObject( "Delta Ensemble", ":/SummaryEnsemble.svg" );
|
||||
|
||||
@ -89,14 +89,14 @@ RimDerivedEnsembleCaseCollection::RimDerivedEnsembleCaseCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDerivedEnsembleCaseCollection::~RimDerivedEnsembleCaseCollection()
|
||||
RimDeltaSummaryEnsemble::~RimDeltaSummaryEnsemble()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::setEnsemble1( RimSummaryEnsemble* ensemble )
|
||||
void RimDeltaSummaryEnsemble::setEnsemble1( RimSummaryEnsemble* ensemble )
|
||||
{
|
||||
m_ensemble1 = ensemble;
|
||||
updateAutoName();
|
||||
@ -105,7 +105,7 @@ void RimDerivedEnsembleCaseCollection::setEnsemble1( RimSummaryEnsemble* ensembl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::setEnsemble2( RimSummaryEnsemble* ensemble )
|
||||
void RimDeltaSummaryEnsemble::setEnsemble2( RimSummaryEnsemble* ensemble )
|
||||
{
|
||||
m_ensemble2 = ensemble;
|
||||
updateAutoName();
|
||||
@ -114,7 +114,7 @@ void RimDerivedEnsembleCaseCollection::setEnsemble2( RimSummaryEnsemble* ensembl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCase*> RimDerivedEnsembleCaseCollection::allSummaryCases() const
|
||||
std::vector<RimSummaryCase*> RimDeltaSummaryEnsemble::allSummaryCases() const
|
||||
{
|
||||
std::vector<RimSummaryCase*> cases;
|
||||
for ( auto sumCase : allDerivedCases( true ) )
|
||||
@ -125,7 +125,7 @@ std::vector<RimSummaryCase*> RimDerivedEnsembleCaseCollection::allSummaryCases()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseSummaryAddress> RimDerivedEnsembleCaseCollection::ensembleSummaryAddresses() const
|
||||
std::set<RifEclipseSummaryAddress> RimDeltaSummaryEnsemble::ensembleSummaryAddresses() const
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> addresses;
|
||||
if ( !m_ensemble1 || !m_ensemble2 ) return addresses;
|
||||
@ -139,7 +139,7 @@ std::set<RifEclipseSummaryAddress> RimDerivedEnsembleCaseCollection::ensembleSum
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::createDerivedEnsembleCases()
|
||||
void RimDeltaSummaryEnsemble::createDerivedEnsembleCases()
|
||||
{
|
||||
if ( !m_ensemble1 || !m_ensemble2 ) return;
|
||||
|
||||
@ -198,7 +198,7 @@ void RimDerivedEnsembleCaseCollection::createDerivedEnsembleCases()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimDerivedEnsembleCaseCollection::hasCaseReference( const RimSummaryCase* sumCase ) const
|
||||
bool RimDeltaSummaryEnsemble::hasCaseReference( const RimSummaryCase* sumCase ) const
|
||||
{
|
||||
if ( m_ensemble1 )
|
||||
{
|
||||
@ -222,17 +222,18 @@ bool RimDerivedEnsembleCaseCollection::hasCaseReference( const RimSummaryCase* s
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::onLoadDataAndUpdate()
|
||||
void RimDeltaSummaryEnsemble::onLoadDataAndUpdate()
|
||||
{
|
||||
updateDerivedEnsembleCases();
|
||||
updateReferringCurveSets();
|
||||
updateAutoName();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimDerivedEnsembleCaseCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
QList<caf::PdmOptionItemInfo> RimDeltaSummaryEnsemble::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
@ -280,7 +281,7 @@ QList<caf::PdmOptionItemInfo> RimDerivedEnsembleCaseCollection::calculateValueOp
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
void RimDeltaSummaryEnsemble::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimSummaryEnsemble::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
@ -292,7 +293,7 @@ void RimDerivedEnsembleCaseCollection::defineUiOrdering( QString uiConfigName, c
|
||||
uiOrdering.add( &m_matchOnParameters );
|
||||
|
||||
uiOrdering.add( &m_useFixedTimeStep );
|
||||
if ( m_useFixedTimeStep() != RimDerivedEnsembleCaseCollection::FixedTimeStepMode::FIXED_TIME_STEP_NONE )
|
||||
if ( m_useFixedTimeStep() != RimDeltaSummaryEnsemble::FixedTimeStepMode::FIXED_TIME_STEP_NONE )
|
||||
{
|
||||
uiOrdering.add( &m_fixedTimeStepIndex );
|
||||
}
|
||||
@ -306,7 +307,7 @@ void RimDerivedEnsembleCaseCollection::defineUiOrdering( QString uiConfigName, c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
void RimDeltaSummaryEnsemble::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
bool doUpdate = false;
|
||||
bool doUpdateCases = false;
|
||||
@ -364,9 +365,7 @@ void RimDerivedEnsembleCaseCollection::fieldChangedByUi( const caf::PdmFieldHand
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
void RimDeltaSummaryEnsemble::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_swapEnsemblesButton )
|
||||
{
|
||||
@ -390,7 +389,7 @@ void RimDerivedEnsembleCaseCollection::defineEditorAttribute( const caf::PdmFiel
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::setAllCasesNotInUse()
|
||||
void RimDeltaSummaryEnsemble::setAllCasesNotInUse()
|
||||
{
|
||||
for ( auto derCase : allDerivedCases( true ) )
|
||||
derCase->setInUse( false );
|
||||
@ -399,14 +398,14 @@ void RimDerivedEnsembleCaseCollection::setAllCasesNotInUse()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::deleteCasesNoInUse()
|
||||
void RimDeltaSummaryEnsemble::deleteCasesNoInUse()
|
||||
{
|
||||
std::vector<RimDerivedSummaryCase*> inactiveCases;
|
||||
std::vector<RimDeltaSummaryCase*> inactiveCases;
|
||||
auto allCases = allDerivedCases( false );
|
||||
std::copy_if( allCases.begin(),
|
||||
allCases.end(),
|
||||
std::back_inserter( inactiveCases ),
|
||||
[]( RimDerivedSummaryCase* derCase ) { return !derCase->isInUse(); } );
|
||||
[]( RimDeltaSummaryCase* derCase ) { return !derCase->isInUse(); } );
|
||||
|
||||
for ( auto derCase : inactiveCases )
|
||||
{
|
||||
@ -418,17 +417,17 @@ void RimDerivedEnsembleCaseCollection::deleteCasesNoInUse()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDerivedSummaryCase* RimDerivedEnsembleCaseCollection::firstCaseNotInUse()
|
||||
RimDeltaSummaryCase* RimDeltaSummaryEnsemble::firstCaseNotInUse()
|
||||
{
|
||||
auto allCases = allDerivedCases( false );
|
||||
auto itr = std::find_if( allCases.begin(), allCases.end(), []( RimDerivedSummaryCase* derCase ) { return !derCase->isInUse(); } );
|
||||
auto itr = std::find_if( allCases.begin(), allCases.end(), []( RimDeltaSummaryCase* derCase ) { return !derCase->isInUse(); } );
|
||||
if ( itr != allCases.end() )
|
||||
{
|
||||
return *itr;
|
||||
}
|
||||
|
||||
// If no active case was found, add a new case to the collection
|
||||
auto newCase = new RimDerivedSummaryCase();
|
||||
auto newCase = new RimDeltaSummaryCase();
|
||||
|
||||
// Show realization data source for the first case. If we create for all, the performance will be bad
|
||||
newCase->setShowVectorItemsInProjectTree( m_cases.empty() );
|
||||
@ -440,12 +439,12 @@ RimDerivedSummaryCase* RimDerivedEnsembleCaseCollection::firstCaseNotInUse()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimDerivedSummaryCase*> RimDerivedEnsembleCaseCollection::allDerivedCases( bool activeOnly ) const
|
||||
std::vector<RimDeltaSummaryCase*> RimDeltaSummaryEnsemble::allDerivedCases( bool activeOnly ) const
|
||||
{
|
||||
std::vector<RimDerivedSummaryCase*> activeCases;
|
||||
std::vector<RimDeltaSummaryCase*> activeCases;
|
||||
for ( auto sumCase : RimSummaryEnsemble::allSummaryCases() )
|
||||
{
|
||||
auto derivedCase = dynamic_cast<RimDerivedSummaryCase*>( sumCase );
|
||||
auto derivedCase = dynamic_cast<RimDeltaSummaryCase*>( sumCase );
|
||||
if ( derivedCase && ( !activeOnly || derivedCase->isInUse() ) )
|
||||
{
|
||||
activeCases.push_back( derivedCase );
|
||||
@ -457,7 +456,7 @@ std::vector<RimDerivedSummaryCase*> RimDerivedEnsembleCaseCollection::allDerived
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::updateAutoName()
|
||||
void RimDeltaSummaryEnsemble::updateAutoName()
|
||||
{
|
||||
QString timeStepString;
|
||||
{
|
||||
@ -525,7 +524,7 @@ void RimDerivedEnsembleCaseCollection::updateAutoName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::updateDerivedEnsembleCases()
|
||||
void RimDeltaSummaryEnsemble::updateDerivedEnsembleCases()
|
||||
{
|
||||
for ( auto& derivedCase : allDerivedCases( true ) )
|
||||
{
|
||||
@ -546,7 +545,15 @@ void RimDerivedEnsembleCaseCollection::updateDerivedEnsembleCases()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCase* RimDerivedEnsembleCaseCollection::findCaseByParametersHash( const std::vector<RimSummaryCase*>& cases, size_t hash ) const
|
||||
bool RimDeltaSummaryEnsemble::isValid() const
|
||||
{
|
||||
return m_ensemble1 != nullptr && m_ensemble2 != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCase* RimDeltaSummaryEnsemble::findCaseByParametersHash( const std::vector<RimSummaryCase*>& cases, size_t hash )
|
||||
{
|
||||
for ( auto sumCase : cases )
|
||||
{
|
||||
@ -559,8 +566,7 @@ RimSummaryCase* RimDerivedEnsembleCaseCollection::findCaseByParametersHash( cons
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCase* RimDerivedEnsembleCaseCollection::findCaseByRealizationNumber( const std::vector<RimSummaryCase*>& cases,
|
||||
int realizationNumber ) const
|
||||
RimSummaryCase* RimDeltaSummaryEnsemble::findCaseByRealizationNumber( const std::vector<RimSummaryCase*>& cases, int realizationNumber )
|
||||
{
|
||||
for ( auto sumCase : cases )
|
||||
{
|
||||
@ -573,16 +579,16 @@ RimSummaryCase* RimDerivedEnsembleCaseCollection::findCaseByRealizationNumber( c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimDerivedEnsembleCaseCollection*> RimDerivedEnsembleCaseCollection::findReferringEnsembles() const
|
||||
std::vector<RimDeltaSummaryEnsemble*> RimDeltaSummaryEnsemble::findReferringEnsembles() const
|
||||
{
|
||||
std::vector<RimDerivedEnsembleCaseCollection*> referringEnsembles;
|
||||
std::vector<RimDeltaSummaryEnsemble*> referringEnsembles;
|
||||
|
||||
auto mainColl = firstAncestorOrThisOfType<RimSummaryCaseMainCollection>();
|
||||
if ( mainColl )
|
||||
{
|
||||
for ( auto group : mainColl->summaryCaseCollections() )
|
||||
{
|
||||
auto derivedEnsemble = dynamic_cast<RimDerivedEnsembleCaseCollection*>( group );
|
||||
auto derivedEnsemble = dynamic_cast<RimDeltaSummaryEnsemble*>( group );
|
||||
if ( derivedEnsemble )
|
||||
{
|
||||
if ( derivedEnsemble->m_ensemble1() == this || derivedEnsemble->m_ensemble2() == this )
|
||||
@ -598,7 +604,7 @@ std::vector<RimDerivedEnsembleCaseCollection*> RimDerivedEnsembleCaseCollection:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryEnsemble*> RimDerivedEnsembleCaseCollection::allEnsembles() const
|
||||
std::vector<RimSummaryEnsemble*> RimDeltaSummaryEnsemble::allEnsembles() const
|
||||
{
|
||||
std::vector<RimSummaryEnsemble*> ensembles;
|
||||
|
||||
@ -610,7 +616,7 @@ std::vector<RimSummaryEnsemble*> RimDerivedEnsembleCaseCollection::allEnsembles(
|
||||
|
||||
if ( !group->isEnsemble() ) continue;
|
||||
|
||||
auto derivedEnsemble = dynamic_cast<const RimDerivedEnsembleCaseCollection*>( group );
|
||||
auto derivedEnsemble = dynamic_cast<const RimDeltaSummaryEnsemble*>( group );
|
||||
if ( derivedEnsemble && !derivedEnsemble->isValid() ) continue;
|
||||
|
||||
ensembles.push_back( group );
|
@ -18,7 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimDeltaSummaryCase.h"
|
||||
#include "RimSummaryEnsemble.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
@ -34,7 +34,7 @@ class RimSummaryCase;
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimDerivedEnsembleCaseCollection : public RimSummaryEnsemble
|
||||
class RimDeltaSummaryEnsemble : public RimSummaryEnsemble
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -47,26 +47,21 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
RimDerivedEnsembleCaseCollection();
|
||||
~RimDerivedEnsembleCaseCollection() override;
|
||||
|
||||
RimSummaryEnsemble* ensemble1() const { return m_ensemble1; }
|
||||
RimSummaryEnsemble* ensemble2() const { return m_ensemble2; }
|
||||
DerivedSummaryOperator op() const { return m_operator(); }
|
||||
bool isValid() const { return m_ensemble1 != nullptr && m_ensemble2 != nullptr; }
|
||||
RimDeltaSummaryEnsemble();
|
||||
~RimDeltaSummaryEnsemble() override;
|
||||
|
||||
void setEnsemble1( RimSummaryEnsemble* ensemble );
|
||||
void setEnsemble2( RimSummaryEnsemble* ensemble );
|
||||
|
||||
std::vector<RimSummaryCase*> allSummaryCases() const override;
|
||||
std::set<RifEclipseSummaryAddress> ensembleSummaryAddresses() const override;
|
||||
void createDerivedEnsembleCases();
|
||||
void updateDerivedEnsembleCases();
|
||||
|
||||
bool hasCaseReference( const RimSummaryCase* sumCase ) const;
|
||||
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
void createDerivedEnsembleCases();
|
||||
|
||||
private:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
@ -75,16 +70,18 @@ private:
|
||||
|
||||
void setAllCasesNotInUse();
|
||||
void deleteCasesNoInUse();
|
||||
RimDerivedSummaryCase* firstCaseNotInUse();
|
||||
std::vector<RimDerivedSummaryCase*> allDerivedCases( bool activeOnly ) const;
|
||||
RimDeltaSummaryCase* firstCaseNotInUse();
|
||||
std::vector<RimDeltaSummaryCase*> allDerivedCases( bool activeOnly ) const;
|
||||
void updateAutoName();
|
||||
|
||||
RimSummaryCase* findCaseByParametersHash( const std::vector<RimSummaryCase*>& cases, size_t hash ) const;
|
||||
RimSummaryCase* findCaseByRealizationNumber( const std::vector<RimSummaryCase*>& cases, int realizationNumber ) const;
|
||||
void updateDerivedEnsembleCases();
|
||||
bool isValid() const;
|
||||
|
||||
std::vector<RimDerivedEnsembleCaseCollection*> findReferringEnsembles() const;
|
||||
static RimSummaryCase* findCaseByParametersHash( const std::vector<RimSummaryCase*>& cases, size_t hash );
|
||||
static RimSummaryCase* findCaseByRealizationNumber( const std::vector<RimSummaryCase*>& cases, int realizationNumber );
|
||||
|
||||
std::vector<RimDeltaSummaryEnsemble*> findReferringEnsembles() const;
|
||||
|
||||
private:
|
||||
std::vector<RimSummaryEnsemble*> allEnsembles() const;
|
||||
|
||||
private:
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include "RimCustomObjectiveFunction.h"
|
||||
#include "RimCustomObjectiveFunctionCollection.h"
|
||||
#include "RimDerivedEnsembleCaseCollection.h"
|
||||
#include "RimDeltaSummaryEnsemble.h"
|
||||
#include "RimEnsembleCurveFilter.h"
|
||||
#include "RimEnsembleCurveFilterCollection.h"
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#include "RimCaseDisplayNameTools.h"
|
||||
#include "RimCsvSummaryCase.h"
|
||||
#include "RimDerivedEnsembleCaseCollection.h"
|
||||
#include "RimDeltaSummaryEnsemble.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFileSummaryCase.h"
|
||||
#include "RimOilField.h"
|
||||
@ -158,12 +158,12 @@ void RimSummaryCaseMainCollection::addCase( RimSummaryCase* summaryCase )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCaseMainCollection::removeCase( RimSummaryCase* summaryCase, bool notifyChange )
|
||||
{
|
||||
std::vector<RimDerivedEnsembleCaseCollection*> derivedEnsembles;
|
||||
std::vector<RimDeltaSummaryEnsemble*> derivedEnsembles;
|
||||
|
||||
// Build a list of derived ensembles that must be updated after delete
|
||||
for ( auto group : summaryCaseCollections() )
|
||||
{
|
||||
auto derEnsemble = dynamic_cast<RimDerivedEnsembleCaseCollection*>( group );
|
||||
auto derEnsemble = dynamic_cast<RimDeltaSummaryEnsemble*>( group );
|
||||
if ( derEnsemble )
|
||||
{
|
||||
if ( derEnsemble->hasCaseReference( summaryCase ) )
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RimDerivedEnsembleCaseCollection.h"
|
||||
#include "RimDeltaSummaryEnsemble.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryAddressCollection.h"
|
||||
@ -108,7 +108,7 @@ void RimSummaryEnsemble::removeCase( RimSummaryCase* summaryCase, bool notifyCha
|
||||
|
||||
if ( m_isEnsemble && m_cases.size() != caseCountBeforeRemove )
|
||||
{
|
||||
if ( dynamic_cast<RimDerivedSummaryCase*>( summaryCase ) == nullptr ) calculateEnsembleParametersIntersectionHash();
|
||||
if ( dynamic_cast<RimDeltaSummaryCase*>( summaryCase ) == nullptr ) calculateEnsembleParametersIntersectionHash();
|
||||
}
|
||||
|
||||
clearChildNodes();
|
||||
@ -128,7 +128,7 @@ void RimSummaryEnsemble::addCase( RimSummaryCase* summaryCase )
|
||||
m_analyzer.reset();
|
||||
|
||||
// Update derived ensemble cases (if any)
|
||||
std::vector<RimDerivedEnsembleCaseCollection*> referringObjects = objectsWithReferringPtrFieldsOfType<RimDerivedEnsembleCaseCollection>();
|
||||
std::vector<RimDeltaSummaryEnsemble*> referringObjects = objectsWithReferringPtrFieldsOfType<RimDeltaSummaryEnsemble>();
|
||||
for ( auto derivedEnsemble : referringObjects )
|
||||
{
|
||||
if ( !derivedEnsemble ) continue;
|
||||
@ -223,7 +223,7 @@ void RimSummaryEnsemble::setAsEnsemble( bool isEnsemble )
|
||||
m_isEnsemble = isEnsemble;
|
||||
updateIcon();
|
||||
|
||||
if ( m_isEnsemble && dynamic_cast<RimDerivedEnsembleCaseCollection*>( this ) == nullptr )
|
||||
if ( m_isEnsemble && dynamic_cast<RimDeltaSummaryEnsemble*>( this ) == nullptr )
|
||||
{
|
||||
validateEnsembleCases( allSummaryCases() );
|
||||
calculateEnsembleParametersIntersectionHash();
|
||||
|
Loading…
Reference in New Issue
Block a user