mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add derived summary case (#5496)
* #5488 Derived Summary Case : Refactor ensemble summary case - Refactor ensemble summary case to be able to us as standalone derived summary case - rename to RimDerivedSummaryCase - allow negative values in well disk visualization * #5488 Derived Summary Case : Add feature to create derived case * #5487 Well Disks : Add scaling factor
This commit is contained in:
parent
51991fd4c4
commit
dfe6d0b94e
@ -42,6 +42,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingSummaryCurveFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicClearSourceSteppingEnsembleCurveSetFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -87,6 +88,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingSummaryCurveFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicClearSourceSteppingEnsembleCurveSetFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,70 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicNewDerivedSummaryFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewDerivedSummaryFeature, "RicNewDerivedSummaryFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewDerivedSummaryFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimSummaryCaseMainCollection*> mainColls = caf::selectedObjectsByTypeStrict<RimSummaryCaseMainCollection*>();
|
||||
|
||||
return mainColls.size() == 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewDerivedSummaryFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
if ( isCommandEnabled() )
|
||||
{
|
||||
auto project = RiaApplication::instance()->project();
|
||||
auto mainColl = project->firstSummaryCaseMainCollection();
|
||||
|
||||
auto derivedCase = new RimDerivedSummaryCase;
|
||||
mainColl->addCase( derivedCase );
|
||||
|
||||
mainColl->updateConnectedEditors();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( derivedCase );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewDerivedSummaryFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New Derived Summary" );
|
||||
// actionToSetup->setIcon( QIcon( ":/SummaryEnsemble16x16.png" ) );
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewDerivedSummaryFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -18,17 +18,12 @@
|
||||
|
||||
#include "RifDerivedEnsembleReader.h"
|
||||
|
||||
#include "RimDerivedEnsembleCase.h"
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<time_t> RifDerivedEnsembleReader::EMPTY_TIME_STEPS_VECTOR;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifDerivedEnsembleReader::RifDerivedEnsembleReader( RimDerivedEnsembleCase* derivedCase,
|
||||
RifDerivedEnsembleReader::RifDerivedEnsembleReader( RimDerivedSummaryCase* derivedCase,
|
||||
RifSummaryReaderInterface* sourceSummaryReader1 )
|
||||
{
|
||||
CVF_ASSERT( derivedCase );
|
||||
@ -48,11 +43,17 @@ RifDerivedEnsembleReader::RifDerivedEnsembleReader( RimDerivedEnsembleCase* d
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<time_t>& RifDerivedEnsembleReader::timeSteps( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
if ( !resultAddress.isValid() ) return EMPTY_TIME_STEPS_VECTOR;
|
||||
if ( !resultAddress.isValid() )
|
||||
{
|
||||
static std::vector<time_t> empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
if ( m_derivedCase->needsCalculation( resultAddress ) )
|
||||
{
|
||||
m_derivedCase->calculate( resultAddress );
|
||||
}
|
||||
|
||||
return m_derivedCase->timeSteps( resultAddress );
|
||||
}
|
||||
|
||||
@ -90,3 +91,18 @@ RiaEclipseUnitTools::UnitSystem RifDerivedEnsembleReader::unitSystem() const
|
||||
{
|
||||
return RiaEclipseUnitTools::UNITS_UNKNOWN;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifDerivedEnsembleReader::updateData( RimSummaryCase* sumCase1, RimSummaryCase* sumCase2 )
|
||||
{
|
||||
m_allErrorAddresses.clear();
|
||||
m_allResultAddresses.clear();
|
||||
|
||||
if ( sumCase1 && sumCase1->summaryReader() )
|
||||
{
|
||||
m_allErrorAddresses = sumCase1->summaryReader()->allErrorAddresses();
|
||||
m_allResultAddresses = sumCase1->summaryReader()->allResultAddresses();
|
||||
}
|
||||
}
|
||||
|
@ -21,23 +21,24 @@
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
class RimDerivedEnsembleCase;
|
||||
class RimDerivedSummaryCase;
|
||||
class RimSummaryCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RifDerivedEnsembleReader : public RifSummaryReaderInterface
|
||||
{
|
||||
static const std::vector<time_t> EMPTY_TIME_STEPS_VECTOR;
|
||||
|
||||
public:
|
||||
RifDerivedEnsembleReader( RimDerivedEnsembleCase* derivedCase, RifSummaryReaderInterface* sourceSummaryReader1 );
|
||||
RifDerivedEnsembleReader( RimDerivedSummaryCase* derivedCase, RifSummaryReaderInterface* sourceSummaryReader1 );
|
||||
|
||||
const std::vector<time_t>& timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
bool values( const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values ) const override;
|
||||
std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
RiaEclipseUnitTools::UnitSystem unitSystem() const override;
|
||||
|
||||
void updateData( RimSummaryCase* sumCase1, RimSummaryCase* sumCase2 );
|
||||
|
||||
private:
|
||||
RimDerivedEnsembleCase* m_derivedCase;
|
||||
RimDerivedSummaryCase* m_derivedCase;
|
||||
};
|
||||
|
@ -113,6 +113,7 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
|
||||
textPosition.z() += 0.1;
|
||||
|
||||
double ijScaleFactor = arrowLength / 6;
|
||||
ijScaleFactor *= simWellInViewCollection()->wellDiskScaleFactor();
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo1 = new cvf::DrawableGeo;
|
||||
{
|
||||
@ -210,10 +211,11 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
|
||||
|
||||
if ( simWellInViewCollection()->showWellDiskQuantityLables() )
|
||||
{
|
||||
const double singleProperty = diskData.singlePropertyValue();
|
||||
if ( singleProperty > valueThresholdForLabel )
|
||||
|
||||
if ( diskData.singlePropertyValue() > valueThresholdForLabel )
|
||||
{
|
||||
const double singleProperty = diskData.singlePropertyValueSigned();
|
||||
labelText += QString( "\n%2" ).arg( singleProperty, 0, 'g', numberPrecision );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -235,7 +237,11 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
|
||||
|
||||
if ( oilFraction > valueThresholdForLabel )
|
||||
{
|
||||
auto p = createTextAndLocation( oilFraction / 2.0, diskPosition, ijScaleFactor, oil, numberPrecision );
|
||||
auto p = createTextAndLocation( oilFraction / 2.0,
|
||||
diskPosition,
|
||||
ijScaleFactor,
|
||||
diskData.oilSigned(),
|
||||
numberPrecision );
|
||||
labelsWithPosition.push_back( p );
|
||||
aggregatedFraction += oilFraction;
|
||||
}
|
||||
@ -245,7 +251,7 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
|
||||
auto p = createTextAndLocation( aggregatedFraction + gasFraction / 2.0,
|
||||
diskPosition,
|
||||
ijScaleFactor,
|
||||
gas,
|
||||
diskData.gasSigned(),
|
||||
numberPrecision );
|
||||
labelsWithPosition.push_back( p );
|
||||
aggregatedFraction += gasFraction;
|
||||
@ -256,7 +262,7 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ
|
||||
auto p = createTextAndLocation( aggregatedFraction + waterFraction / 2.0,
|
||||
diskPosition,
|
||||
ijScaleFactor,
|
||||
water,
|
||||
diskData.waterSigned(),
|
||||
numberPrecision );
|
||||
|
||||
labelsWithPosition.push_back( p );
|
||||
|
@ -641,6 +641,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicImportSummaryGroupFeature";
|
||||
menuBuilder << "RicImportEnsembleFeature";
|
||||
menuBuilder << "RicNewDerivedEnsembleFeature";
|
||||
menuBuilder << "RicNewDerivedSummaryFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimSummaryCaseCollection*>( firstUiItem ) )
|
||||
{
|
||||
|
@ -649,10 +649,9 @@ double RimSimWellInView::calculateInjectionProductionFractions( const RimWellDis
|
||||
|
||||
RifSummaryReaderInterface* summaryReader = nullptr;
|
||||
{
|
||||
RimGridSummaryCase* gridSummaryCase = RimSimWellInViewTools::gridSummaryCaseForWell( this );
|
||||
if ( gridSummaryCase )
|
||||
if ( wellDiskConfig.sourceCase() )
|
||||
{
|
||||
summaryReader = gridSummaryCase->summaryReader();
|
||||
summaryReader = wellDiskConfig.sourceCase()->summaryReader();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,6 +257,8 @@ RimSimWellInViewCollection::RimSimWellInViewCollection()
|
||||
m_showWellCellFence.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() );
|
||||
m_showWellCellFence.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellDiskSummaryCase, "WellDiskSummaryCase", "Summary Case", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_wellDiskQuantity, "WellDiskQuantity", QString( "WOPT" ), "Disk Quantity", "", "", "" );
|
||||
m_wellDiskQuantity.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
||||
m_wellDiskQuantity.uiCapability()->setAutoAddingOptionFromValue( false );
|
||||
@ -277,6 +279,7 @@ RimSimWellInViewCollection::RimSimWellInViewCollection()
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitField( &m_wellDiskScaleFactor, "WellDiskScaleFactor", 1.0, "Scale Factor", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &obsoleteField_wellPipeVisibility,
|
||||
"GlobalWellPipeVisibility",
|
||||
@ -504,7 +507,8 @@ void RimSimWellInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
}
|
||||
else if ( &m_wellDiskQuantity == changedField || &m_wellDiskPropertyType == changedField ||
|
||||
&m_wellDiskPropertyConfigType == changedField || &m_wellDiskshowLabelsBackground == changedField ||
|
||||
&m_wellDiskShowQuantityLabels == changedField )
|
||||
&m_wellDiskShowQuantityLabels == changedField || &m_wellDiskSummaryCase == changedField ||
|
||||
&m_wellDiskScaleFactor == changedField )
|
||||
{
|
||||
RimWellDiskConfig wellDiskConfig = getActiveWellDiskConfig();
|
||||
updateWellDisks( wellDiskConfig );
|
||||
@ -587,14 +591,13 @@ QList<caf::PdmOptionItemInfo>
|
||||
RimSimWellInViewCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_wellDiskQuantity )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
if ( !wells.empty() )
|
||||
auto summaryCase = m_wellDiskSummaryCase();
|
||||
if ( summaryCase )
|
||||
{
|
||||
// Assume that the wells share the grid summary case
|
||||
RimGridSummaryCase* summaryCase = RimSimWellInViewTools::gridSummaryCaseForWell( wells[0] );
|
||||
|
||||
std::set<std::string> summaries;
|
||||
if ( summaryCase && summaryCase->summaryReader() )
|
||||
{
|
||||
@ -631,11 +634,18 @@ QList<caf::PdmOptionItemInfo>
|
||||
}
|
||||
|
||||
if ( useOptionsOnly ) *useOptionsOnly = true;
|
||||
|
||||
return options;
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_wellDiskSummaryCase )
|
||||
{
|
||||
auto cases = RimSimWellInViewTools::summaryCases();
|
||||
for ( auto c : cases )
|
||||
{
|
||||
auto optionItem = caf::PdmOptionItemInfo( c->displayCaseName(), c );
|
||||
options.push_back( optionItem );
|
||||
}
|
||||
}
|
||||
|
||||
return QList<caf::PdmOptionItemInfo>();
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -674,6 +684,21 @@ void RimSimWellInViewCollection::updateWellAllocationPlots()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInViewCollection::setDefaultSourceCaseForWellDisks()
|
||||
{
|
||||
if ( m_wellDiskSummaryCase == nullptr && !wells.empty() )
|
||||
{
|
||||
RimGridSummaryCase* gridSummaryCase = RimSimWellInViewTools::gridSummaryCaseForWell( wells[0] );
|
||||
if ( gridSummaryCase )
|
||||
{
|
||||
m_wellDiskSummaryCase = gridSummaryCase;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -741,6 +766,12 @@ void RimSimWellInViewCollection::defineUiOrdering( QString uiConfigName, caf::Pd
|
||||
{
|
||||
caf::PdmUiGroup* wellDiskGroup = uiOrdering.addNewGroup( "Disks" );
|
||||
|
||||
if ( !m_wellDiskSummaryCase() )
|
||||
{
|
||||
setDefaultSourceCaseForWellDisks();
|
||||
}
|
||||
wellDiskGroup->add( &m_wellDiskSummaryCase );
|
||||
|
||||
wellDiskGroup->add( &m_wellDiskPropertyType );
|
||||
if ( m_wellDiskPropertyType() == PROPERTY_TYPE_PREDEFINED )
|
||||
{
|
||||
@ -752,14 +783,17 @@ void RimSimWellInViewCollection::defineUiOrdering( QString uiConfigName, caf::Pd
|
||||
}
|
||||
wellDiskGroup->add( &m_wellDiskShowQuantityLabels );
|
||||
wellDiskGroup->add( &m_wellDiskshowLabelsBackground );
|
||||
wellDiskGroup->add( &m_wellDiskScaleFactor );
|
||||
|
||||
bool isReadOnly = m_showWellDisks().isFalse();
|
||||
|
||||
m_wellDiskPropertyType.uiCapability()->setUiReadOnly( isReadOnly );
|
||||
m_wellDiskPropertyConfigType.uiCapability()->setUiReadOnly( isReadOnly );
|
||||
m_wellDiskSummaryCase.uiCapability()->setUiReadOnly( isReadOnly );
|
||||
m_wellDiskQuantity.uiCapability()->setUiReadOnly( isReadOnly );
|
||||
m_wellDiskShowQuantityLabels.uiCapability()->setUiReadOnly( isReadOnly );
|
||||
m_wellDiskshowLabelsBackground.uiCapability()->setUiReadOnly( isReadOnly );
|
||||
m_wellDiskScaleFactor.uiCapability()->setUiReadOnly( isReadOnly );
|
||||
}
|
||||
|
||||
RimEclipseResultCase* ownerCase = nullptr;
|
||||
@ -1040,12 +1074,23 @@ void RimSimWellInViewCollection::updateWellDisks( const RimWellDiskConfig& wellD
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimSimWellInViewCollection::wellDiskScaleFactor() const
|
||||
{
|
||||
return m_wellDiskScaleFactor();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDiskConfig RimSimWellInViewCollection::getActiveWellDiskConfig() const
|
||||
{
|
||||
RimWellDiskConfig wellDiskConfig;
|
||||
|
||||
wellDiskConfig.setSourceCase( m_wellDiskSummaryCase() );
|
||||
|
||||
if ( m_wellDiskPropertyType() == RimSimWellInViewCollection::PROPERTY_TYPE_PREDEFINED )
|
||||
{
|
||||
WellDiskPropertyConfigType configType = m_wellDiskPropertyConfigType();
|
||||
|
@ -26,11 +26,13 @@
|
||||
#include "cafPdmFieldCvfColor.h" // Include to make Pdm work for cvf::Color
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cafTristate.h"
|
||||
|
||||
class RimEclipseView;
|
||||
class RimSimWellInView;
|
||||
class RimWellDiskConfig;
|
||||
class RimSummaryCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -156,7 +158,9 @@ public:
|
||||
|
||||
static void updateWellAllocationPlots();
|
||||
|
||||
void updateWellDisks();
|
||||
void setDefaultSourceCaseForWellDisks();
|
||||
void updateWellDisks();
|
||||
double wellDiskScaleFactor() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
@ -198,9 +202,11 @@ private:
|
||||
// Well Discs
|
||||
caf::PdmField<caf::AppEnum<WellDiskPropertyType>> m_wellDiskPropertyType;
|
||||
caf::PdmField<caf::AppEnum<WellDiskPropertyConfigType>> m_wellDiskPropertyConfigType;
|
||||
caf::PdmPtrField<RimSummaryCase*> m_wellDiskSummaryCase;
|
||||
caf::PdmField<QString> m_wellDiskQuantity;
|
||||
caf::PdmField<bool> m_wellDiskShowQuantityLabels;
|
||||
caf::PdmField<bool> m_wellDiskshowLabelsBackground;
|
||||
caf::PdmField<double> m_wellDiskScaleFactor;
|
||||
|
||||
// Obsolete fields
|
||||
caf::PdmField<WellVisibilityEnum> obsoleteField_wellPipeVisibility;
|
||||
|
@ -66,6 +66,28 @@ RimGridSummaryCase* RimSimWellInViewTools::gridSummaryCaseForWell( RimSimWellInV
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCase*> RimSimWellInViewTools::summaryCases()
|
||||
{
|
||||
std::vector<RimSummaryCase*> cases;
|
||||
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
if ( project )
|
||||
{
|
||||
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField()
|
||||
? project->activeOilField()->summaryCaseMainCollection()
|
||||
: nullptr;
|
||||
if ( sumCaseColl )
|
||||
{
|
||||
cases = sumCaseColl->allSummaryCases();
|
||||
}
|
||||
}
|
||||
|
||||
return cases;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class QString;
|
||||
class QDateTime;
|
||||
@ -26,6 +27,7 @@ class QDateTime;
|
||||
class RimSimWellInView;
|
||||
class RimGridSummaryCase;
|
||||
class RifSummaryReaderInterface;
|
||||
class RimSummaryCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -34,8 +36,9 @@ class RifSummaryReaderInterface;
|
||||
class RimSimWellInViewTools
|
||||
{
|
||||
public:
|
||||
static RimGridSummaryCase* gridSummaryCaseForWell( RimSimWellInView* well );
|
||||
static bool isInjector( RimSimWellInView* well );
|
||||
static RimGridSummaryCase* gridSummaryCaseForWell( RimSimWellInView* well );
|
||||
static std::vector<RimSummaryCase*> summaryCases();
|
||||
static bool isInjector( RimSimWellInView* well );
|
||||
|
||||
static double extractValueForTimeStep( RifSummaryReaderInterface* summaryReader,
|
||||
const QString& wellName,
|
||||
|
@ -18,58 +18,108 @@
|
||||
|
||||
#include "RimWellDiskConfig.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDiskConfig::RimWellDiskConfig()
|
||||
: m_isSingleProperty( false )
|
||||
, m_summaryCase( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDiskConfig::~RimWellDiskConfig() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellDiskConfig::isSingleProperty() const
|
||||
{
|
||||
return m_isSingleProperty;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RimWellDiskConfig::getSingleProperty() const
|
||||
{
|
||||
return m_singleProperty;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDiskConfig::setSingleProperty( const std::string& singleProperty )
|
||||
{
|
||||
m_isSingleProperty = true;
|
||||
m_singleProperty = singleProperty;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDiskConfig::setOilProperty( const std::string& oilProperty )
|
||||
{
|
||||
m_isSingleProperty = false;
|
||||
m_oilProperty = oilProperty;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RimWellDiskConfig::getOilProperty() const
|
||||
{
|
||||
return m_oilProperty;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDiskConfig::setGasProperty( const std::string& gasProperty )
|
||||
{
|
||||
m_isSingleProperty = false;
|
||||
m_gasProperty = gasProperty;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RimWellDiskConfig::getGasProperty() const
|
||||
{
|
||||
return m_gasProperty;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDiskConfig::setWaterProperty( const std::string& waterProperty )
|
||||
{
|
||||
m_isSingleProperty = false;
|
||||
m_waterProperty = waterProperty;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RimWellDiskConfig::getWaterProperty() const
|
||||
{
|
||||
return m_waterProperty;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCase* RimWellDiskConfig::sourceCase() const
|
||||
{
|
||||
return m_summaryCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDiskConfig::setSourceCase( RimSummaryCase* summaryCase )
|
||||
{
|
||||
m_summaryCase = summaryCase;
|
||||
}
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
class RimSummaryCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@ -43,10 +45,14 @@ public:
|
||||
void setWaterProperty( const std::string& waterProperty );
|
||||
std::string getWaterProperty() const;
|
||||
|
||||
RimSummaryCase* sourceCase() const;
|
||||
void setSourceCase( RimSummaryCase* summaryCase );
|
||||
|
||||
private:
|
||||
bool m_isSingleProperty;
|
||||
std::string m_singleProperty;
|
||||
std::string m_oilProperty;
|
||||
std::string m_gasProperty;
|
||||
std::string m_waterProperty;
|
||||
bool m_isSingleProperty;
|
||||
std::string m_singleProperty;
|
||||
std::string m_oilProperty;
|
||||
std::string m_gasProperty;
|
||||
std::string m_waterProperty;
|
||||
RimSummaryCase* m_summaryCase;
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveFilterCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatistics.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatisticsCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedSummaryCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCaseCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotFilterTextCurveSetEditor.h
|
||||
)
|
||||
@ -74,7 +74,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveFilterCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatistics.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatisticsCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedSummaryCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDerivedEnsembleCaseCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotFilterTextCurveSetEditor.cpp
|
||||
)
|
||||
|
@ -20,8 +20,8 @@
|
||||
|
||||
#include "SummaryPlotCommands/RicNewDerivedEnsembleFeature.h"
|
||||
|
||||
#include "RimDerivedEnsembleCase.h"
|
||||
#include "RimDerivedEnsembleCaseCollection.h"
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
@ -32,17 +32,6 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<DerivedEnsembleOperator>::setUp()
|
||||
{
|
||||
addItem( DERIVED_ENSEMBLE_SUB, "Sub", "-" );
|
||||
addItem( DERIVED_ENSEMBLE_ADD, "Add", "+" );
|
||||
setDefault( DERIVED_ENSEMBLE_SUB );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimDerivedEnsembleCaseCollection, "RimDerivedEnsembleCaseCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -150,6 +139,7 @@ void RimDerivedEnsembleCaseCollection::updateDerivedEnsembleCases()
|
||||
|
||||
auto derivedCase = firstCaseNotInUse();
|
||||
derivedCase->setSummaryCases( sumCase1, sumCase2 );
|
||||
derivedCase->setOperator( m_operator() );
|
||||
derivedCase->createSummaryReaderInterface();
|
||||
derivedCase->setCaseRealizationParameters( crp );
|
||||
derivedCase->setInUse( true );
|
||||
@ -326,12 +316,12 @@ void RimDerivedEnsembleCaseCollection::setAllCasesNotInUse()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::deleteCasesNoInUse()
|
||||
{
|
||||
std::vector<RimDerivedEnsembleCase*> inactiveCases;
|
||||
auto allCases = allDerivedCases( false );
|
||||
std::vector<RimDerivedSummaryCase*> inactiveCases;
|
||||
auto allCases = allDerivedCases( false );
|
||||
std::copy_if( allCases.begin(),
|
||||
allCases.end(),
|
||||
std::back_inserter( inactiveCases ),
|
||||
[]( RimDerivedEnsembleCase* derCase ) { return !derCase->isInUse(); } );
|
||||
[]( RimDerivedSummaryCase* derCase ) { return !derCase->isInUse(); } );
|
||||
|
||||
for ( auto derCase : inactiveCases )
|
||||
{
|
||||
@ -343,10 +333,10 @@ void RimDerivedEnsembleCaseCollection::deleteCasesNoInUse()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDerivedEnsembleCase* RimDerivedEnsembleCaseCollection::firstCaseNotInUse()
|
||||
RimDerivedSummaryCase* RimDerivedEnsembleCaseCollection::firstCaseNotInUse()
|
||||
{
|
||||
auto allCases = allDerivedCases( false );
|
||||
auto itr = std::find_if( allCases.begin(), allCases.end(), []( RimDerivedEnsembleCase* derCase ) {
|
||||
auto itr = std::find_if( allCases.begin(), allCases.end(), []( RimDerivedSummaryCase* derCase ) {
|
||||
return !derCase->isInUse();
|
||||
} );
|
||||
if ( itr != allCases.end() )
|
||||
@ -355,7 +345,7 @@ RimDerivedEnsembleCase* RimDerivedEnsembleCaseCollection::firstCaseNotInUse()
|
||||
}
|
||||
|
||||
// If no active case was found, add a new case to the collection
|
||||
auto newCase = new RimDerivedEnsembleCase();
|
||||
auto newCase = new RimDerivedSummaryCase();
|
||||
m_cases.push_back( newCase );
|
||||
return newCase;
|
||||
}
|
||||
@ -363,12 +353,12 @@ RimDerivedEnsembleCase* RimDerivedEnsembleCaseCollection::firstCaseNotInUse()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimDerivedEnsembleCase*> RimDerivedEnsembleCaseCollection::allDerivedCases( bool activeOnly ) const
|
||||
std::vector<RimDerivedSummaryCase*> RimDerivedEnsembleCaseCollection::allDerivedCases( bool activeOnly ) const
|
||||
{
|
||||
std::vector<RimDerivedEnsembleCase*> activeCases;
|
||||
std::vector<RimDerivedSummaryCase*> activeCases;
|
||||
for ( auto sumCase : RimSummaryCaseCollection::allSummaryCases() )
|
||||
{
|
||||
auto derivedCase = dynamic_cast<RimDerivedEnsembleCase*>( sumCase );
|
||||
auto derivedCase = dynamic_cast<RimDerivedSummaryCase*>( sumCase );
|
||||
if ( derivedCase && ( !activeOnly || derivedCase->isInUse() ) )
|
||||
{
|
||||
activeCases.push_back( derivedCase );
|
||||
@ -382,7 +372,7 @@ std::vector<RimDerivedEnsembleCase*> RimDerivedEnsembleCaseCollection::allDerive
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCaseCollection::updateAutoName()
|
||||
{
|
||||
QString op = caf::AppEnum<DerivedEnsembleOperator>::uiText( m_operator() );
|
||||
QString op = caf::AppEnum<DerivedSummaryOperator>::uiText( m_operator() );
|
||||
|
||||
auto derivedEnsemble1 = dynamic_cast<RimDerivedEnsembleCaseCollection*>( m_ensemble1() );
|
||||
auto derivedEnsemble2 = dynamic_cast<RimDerivedEnsembleCaseCollection*>( m_ensemble2() );
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimDerivedEnsembleCase.h"
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
@ -52,7 +52,7 @@ public:
|
||||
{
|
||||
return m_ensemble2;
|
||||
}
|
||||
DerivedEnsembleOperator op() const
|
||||
DerivedSummaryOperator op() const
|
||||
{
|
||||
return m_operator();
|
||||
}
|
||||
@ -82,11 +82,11 @@ private:
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
void setAllCasesNotInUse();
|
||||
void deleteCasesNoInUse();
|
||||
RimDerivedEnsembleCase* firstCaseNotInUse();
|
||||
std::vector<RimDerivedEnsembleCase*> allDerivedCases( bool activeOnly ) const;
|
||||
void updateAutoName();
|
||||
void setAllCasesNotInUse();
|
||||
void deleteCasesNoInUse();
|
||||
RimDerivedSummaryCase* firstCaseNotInUse();
|
||||
std::vector<RimDerivedSummaryCase*> allDerivedCases( bool activeOnly ) const;
|
||||
void updateAutoName();
|
||||
RimSummaryCase* findCaseByParametersHash( const std::vector<RimSummaryCase*>& cases, size_t hash ) const;
|
||||
std::vector<RimDerivedEnsembleCaseCollection*> findReferringEnsembles() const;
|
||||
|
||||
@ -94,9 +94,9 @@ private:
|
||||
std::vector<RimSummaryCaseCollection*> allEnsembles() const;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble1;
|
||||
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble2;
|
||||
caf::PdmField<caf::AppEnum<DerivedEnsembleOperator>> m_operator;
|
||||
caf::PdmField<bool> m_swapEnsemblesButton;
|
||||
caf::PdmField<QString> m_caseCount;
|
||||
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble1;
|
||||
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble2;
|
||||
caf::PdmField<caf::AppEnum<DerivedSummaryOperator>> m_operator;
|
||||
caf::PdmField<bool> m_swapEnsemblesButton;
|
||||
caf::PdmField<QString> m_caseCount;
|
||||
};
|
||||
|
@ -16,44 +16,41 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimDerivedEnsembleCase.h"
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaCurveMerger.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RifDerivedEnsembleReader.h"
|
||||
|
||||
#include "RimDerivedEnsembleCaseCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<DerivedSummaryOperator>::setUp()
|
||||
{
|
||||
addItem( DerivedSummaryOperator::DERIVED_OPERATOR_SUB, "Sub", "-" );
|
||||
addItem( DerivedSummaryOperator::DERIVED_OPERATOR_ADD, "Add", "+" );
|
||||
setDefault( DerivedSummaryOperator::DERIVED_OPERATOR_SUB );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_ABSTRACT_SOURCE_INIT( RimDerivedEnsembleCase, "RimDerivedEnsembleCase" );
|
||||
CAF_PDM_SOURCE_INIT( RimDerivedSummaryCase, "RimDerivedEnsembleCase" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<time_t> RimDerivedEnsembleCase::EMPTY_TIME_STEPS_VECTOR;
|
||||
const std::vector<double> RimDerivedEnsembleCase::EMPTY_VALUES_VECTOR;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDerivedEnsembleCase::RimDerivedEnsembleCase()
|
||||
RimDerivedSummaryCase::RimDerivedSummaryCase()
|
||||
: m_summaryCase1( nullptr )
|
||||
, m_summaryCase2( nullptr )
|
||||
{
|
||||
CAF_PDM_InitObject( "Summary Case", ":/SummaryCase16x16.png", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_summaryCase1, "SummaryCase1", "SummaryCase1", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_summaryCase2, "SummaryCase2", "SummaryCase2", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_operator, "Operator", "Operator", "", "", "" );
|
||||
|
||||
m_inUse = false;
|
||||
}
|
||||
@ -61,12 +58,12 @@ RimDerivedEnsembleCase::RimDerivedEnsembleCase()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDerivedEnsembleCase::~RimDerivedEnsembleCase() {}
|
||||
RimDerivedSummaryCase::~RimDerivedSummaryCase() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCase::setInUse( bool inUse )
|
||||
void RimDerivedSummaryCase::setInUse( bool inUse )
|
||||
{
|
||||
m_inUse = inUse;
|
||||
|
||||
@ -74,14 +71,14 @@ void RimDerivedEnsembleCase::setInUse( bool inUse )
|
||||
{
|
||||
m_summaryCase1 = nullptr;
|
||||
m_summaryCase2 = nullptr;
|
||||
m_data.clear();
|
||||
m_dataCache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimDerivedEnsembleCase::isInUse() const
|
||||
bool RimDerivedSummaryCase::isInUse() const
|
||||
{
|
||||
return m_inUse;
|
||||
}
|
||||
@ -89,7 +86,7 @@ bool RimDerivedEnsembleCase::isInUse() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCase::setSummaryCases( RimSummaryCase* sumCase1, RimSummaryCase* sumCase2 )
|
||||
void RimDerivedSummaryCase::setSummaryCases( RimSummaryCase* sumCase1, RimSummaryCase* sumCase2 )
|
||||
{
|
||||
if ( !sumCase1 || !sumCase2 ) return;
|
||||
m_summaryCase1 = sumCase1;
|
||||
@ -99,39 +96,49 @@ void RimDerivedEnsembleCase::setSummaryCases( RimSummaryCase* sumCase1, RimSumma
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimDerivedEnsembleCase::needsCalculation( const RifEclipseSummaryAddress& address ) const
|
||||
bool RimDerivedSummaryCase::needsCalculation( const RifEclipseSummaryAddress& address ) const
|
||||
{
|
||||
return m_data.count( address ) == 0;
|
||||
return m_dataCache.count( address ) == 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<time_t>& RimDerivedEnsembleCase::timeSteps( const RifEclipseSummaryAddress& address ) const
|
||||
const std::vector<time_t>& RimDerivedSummaryCase::timeSteps( const RifEclipseSummaryAddress& address ) const
|
||||
{
|
||||
if ( m_data.count( address ) == 0 ) return EMPTY_TIME_STEPS_VECTOR;
|
||||
return m_data.at( address ).first;
|
||||
if ( m_dataCache.count( address ) == 0 )
|
||||
{
|
||||
static std::vector<time_t> empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
return m_dataCache.at( address ).first;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RimDerivedEnsembleCase::values( const RifEclipseSummaryAddress& address ) const
|
||||
const std::vector<double>& RimDerivedSummaryCase::values( const RifEclipseSummaryAddress& address ) const
|
||||
{
|
||||
if ( m_data.count( address ) == 0 ) return EMPTY_VALUES_VECTOR;
|
||||
return m_data.at( address ).second;
|
||||
if ( m_dataCache.count( address ) == 0 )
|
||||
{
|
||||
static std::vector<double> empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
return m_dataCache.at( address ).second;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCase::calculate( const RifEclipseSummaryAddress& address )
|
||||
void RimDerivedSummaryCase::calculate( const RifEclipseSummaryAddress& address )
|
||||
{
|
||||
clearData( address );
|
||||
|
||||
RifSummaryReaderInterface* reader1 = m_summaryCase1 ? m_summaryCase1->summaryReader() : nullptr;
|
||||
RifSummaryReaderInterface* reader2 = m_summaryCase2 ? m_summaryCase2->summaryReader() : nullptr;
|
||||
if ( !reader1 || !reader2 || !parentEnsemble() ) return;
|
||||
if ( !reader1 || !reader2 ) return;
|
||||
|
||||
if ( !reader1->hasAddress( address ) || !reader2->hasAddress( address ) )
|
||||
{
|
||||
@ -147,7 +154,6 @@ void RimDerivedEnsembleCase::calculate( const RifEclipseSummaryAddress& address
|
||||
RiaTimeHistoryCurveMerger merger;
|
||||
std::vector<double> values1;
|
||||
std::vector<double> values2;
|
||||
DerivedEnsembleOperator op = parentEnsemble()->op();
|
||||
|
||||
reader1->values( address, &values1 );
|
||||
reader2->values( address, &values2 );
|
||||
@ -164,17 +170,17 @@ void RimDerivedEnsembleCase::calculate( const RifEclipseSummaryAddress& address
|
||||
calculatedValues.reserve( sampleCount );
|
||||
for ( size_t i = 0; i < sampleCount; i++ )
|
||||
{
|
||||
if ( op == DERIVED_ENSEMBLE_SUB )
|
||||
if ( m_operator() == DerivedSummaryOperator::DERIVED_OPERATOR_SUB )
|
||||
{
|
||||
calculatedValues.push_back( allValues1[i] - allValues2[i] );
|
||||
}
|
||||
else if ( op == DERIVED_ENSEMBLE_ADD )
|
||||
else if ( m_operator() == DerivedSummaryOperator::DERIVED_OPERATOR_ADD )
|
||||
{
|
||||
calculatedValues.push_back( allValues1[i] + allValues2[i] );
|
||||
}
|
||||
}
|
||||
|
||||
auto& dataItem = m_data[address];
|
||||
auto& dataItem = m_dataCache[address];
|
||||
dataItem.first = merger.allXValues();
|
||||
dataItem.second = calculatedValues;
|
||||
}
|
||||
@ -182,21 +188,26 @@ void RimDerivedEnsembleCase::calculate( const RifEclipseSummaryAddress& address
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimDerivedEnsembleCase::caseName() const
|
||||
QString RimDerivedSummaryCase::caseName() const
|
||||
{
|
||||
auto case1Name = m_summaryCase1->displayCaseName();
|
||||
auto case2Name = m_summaryCase2->displayCaseName();
|
||||
if ( m_summaryCase1 && m_summaryCase2 )
|
||||
{
|
||||
auto case1Name = m_summaryCase1->displayCaseName();
|
||||
auto case2Name = m_summaryCase2->displayCaseName();
|
||||
|
||||
if ( case1Name == case2Name )
|
||||
return case1Name;
|
||||
else
|
||||
return QString( "%1/%2" ).arg( case1Name ).arg( case2Name );
|
||||
if ( case1Name == case2Name )
|
||||
return case1Name;
|
||||
else
|
||||
return QString( "%1/%2" ).arg( case1Name ).arg( case2Name );
|
||||
}
|
||||
|
||||
return m_shortName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCase::createSummaryReaderInterface()
|
||||
void RimDerivedSummaryCase::createSummaryReaderInterface()
|
||||
{
|
||||
RifSummaryReaderInterface* summaryCase1Reader = nullptr;
|
||||
if ( m_summaryCase1 )
|
||||
@ -215,7 +226,7 @@ void RimDerivedEnsembleCase::createSummaryReaderInterface()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifSummaryReaderInterface* RimDerivedEnsembleCase::summaryReader()
|
||||
RifSummaryReaderInterface* RimDerivedSummaryCase::summaryReader()
|
||||
{
|
||||
return m_reader.get();
|
||||
}
|
||||
@ -223,7 +234,7 @@ RifSummaryReaderInterface* RimDerivedEnsembleCase::summaryReader()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
void RimDerivedSummaryCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
// NOP
|
||||
}
|
||||
@ -231,17 +242,110 @@ void RimDerivedEnsembleCase::updateFilePathsFromProjectPath( const QString& newP
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDerivedEnsembleCaseCollection* RimDerivedEnsembleCase::parentEnsemble() const
|
||||
void RimDerivedSummaryCase::setOperator( DerivedSummaryOperator oper )
|
||||
{
|
||||
RimDerivedEnsembleCaseCollection* ensemble;
|
||||
firstAncestorOrThisOfType( ensemble );
|
||||
return ensemble;
|
||||
m_operator = oper;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedEnsembleCase::clearData( const RifEclipseSummaryAddress& address )
|
||||
void RimDerivedSummaryCase::clearData( const RifEclipseSummaryAddress& address )
|
||||
{
|
||||
m_data.erase( address );
|
||||
m_dataCache.erase( address );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
// Base class
|
||||
uiOrdering.add( &m_shortName );
|
||||
|
||||
// This class
|
||||
uiOrdering.add( &m_summaryCase1 );
|
||||
uiOrdering.add( &m_operator );
|
||||
uiOrdering.add( &m_summaryCase2 );
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimDerivedSummaryCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
auto summaryCases = proj->allSummaryCases();
|
||||
|
||||
if ( fieldNeedingOptions == &m_summaryCase1 || fieldNeedingOptions == &m_summaryCase2 )
|
||||
{
|
||||
for ( auto c : summaryCases )
|
||||
{
|
||||
if ( c != this ) options.push_back( caf::PdmOptionItemInfo( c->displayCaseName(), c ) );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDerivedSummaryCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
bool reloadData = false;
|
||||
if ( changedField == &m_summaryCase2 || changedField == &m_summaryCase1 )
|
||||
{
|
||||
if ( !m_reader )
|
||||
{
|
||||
createSummaryReaderInterface();
|
||||
}
|
||||
|
||||
if ( m_reader )
|
||||
{
|
||||
m_reader->updateData( m_summaryCase1(), m_summaryCase2() );
|
||||
}
|
||||
|
||||
reloadData = true;
|
||||
}
|
||||
else if ( changedField == &m_operator )
|
||||
{
|
||||
reloadData = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RimSummaryCase::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
}
|
||||
|
||||
if ( reloadData )
|
||||
{
|
||||
m_dataCache.clear();
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> referringObjects;
|
||||
this->objectsWithReferringPtrFields( referringObjects );
|
||||
|
||||
std::set<RimSummaryPlot*> plotsToUpdate;
|
||||
for ( auto o : referringObjects )
|
||||
{
|
||||
RimSummaryPlot* sumPlot = nullptr;
|
||||
o->firstAncestorOrThisOfType( sumPlot );
|
||||
|
||||
if ( sumPlot )
|
||||
{
|
||||
plotsToUpdate.insert( sumPlot );
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto p : plotsToUpdate )
|
||||
{
|
||||
p->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
@ -28,55 +28,63 @@
|
||||
class RifEclipseSummaryAddress;
|
||||
class RifSummaryReaderInterface;
|
||||
class RifDerivedEnsembleReader;
|
||||
class RimDerivedEnsembleCaseCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
enum DerivedEnsembleOperator
|
||||
enum class DerivedSummaryOperator
|
||||
{
|
||||
DERIVED_ENSEMBLE_SUB,
|
||||
DERIVED_ENSEMBLE_ADD
|
||||
DERIVED_OPERATOR_SUB,
|
||||
DERIVED_OPERATOR_ADD
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
class RimDerivedEnsembleCase : public RimSummaryCase
|
||||
class RimDerivedSummaryCase : public RimSummaryCase
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
static const std::vector<time_t> EMPTY_TIME_STEPS_VECTOR;
|
||||
static const std::vector<double> EMPTY_VALUES_VECTOR;
|
||||
|
||||
public:
|
||||
RimDerivedEnsembleCase();
|
||||
~RimDerivedEnsembleCase() override;
|
||||
RimDerivedSummaryCase();
|
||||
~RimDerivedSummaryCase() override;
|
||||
|
||||
void setInUse( bool inUse );
|
||||
bool isInUse() const;
|
||||
void setSummaryCases( RimSummaryCase* sumCase1, RimSummaryCase* sumCase2 );
|
||||
void setOperator( DerivedSummaryOperator oper );
|
||||
|
||||
void setInUse( bool inUse );
|
||||
bool isInUse() const;
|
||||
void setSummaryCases( RimSummaryCase* sumCase1, RimSummaryCase* sumCase2 );
|
||||
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 );
|
||||
|
||||
QString caseName() const override;
|
||||
void createSummaryReaderInterface() override;
|
||||
RifSummaryReaderInterface* summaryReader() override;
|
||||
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override;
|
||||
|
||||
RimDerivedEnsembleCaseCollection* parentEnsemble() const;
|
||||
protected:
|
||||
QString caseName() const override;
|
||||
|
||||
private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
void clearData( const RifEclipseSummaryAddress& address );
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimSummaryCase*> m_summaryCase1;
|
||||
caf::PdmPtrField<RimSummaryCase*> m_summaryCase2;
|
||||
caf::PdmField<caf::AppEnum<DerivedSummaryOperator>> m_operator;
|
||||
|
||||
bool m_inUse;
|
||||
std::unique_ptr<RifDerivedEnsembleReader> m_reader;
|
||||
|
||||
bool m_inUse;
|
||||
caf::PdmPtrField<RimSummaryCase*> m_summaryCase1;
|
||||
caf::PdmPtrField<RimSummaryCase*> m_summaryCase2;
|
||||
std::map<RifEclipseSummaryAddress, std::pair<std::vector<time_t>, std::vector<double>>> m_data;
|
||||
std::map<RifEclipseSummaryAddress, std::pair<std::vector<time_t>, std::vector<double>>> m_dataCache;
|
||||
};
|
@ -195,7 +195,7 @@ void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase )
|
||||
|
||||
if ( m_isEnsemble && m_cases.size() != caseCountBeforeRemove )
|
||||
{
|
||||
if ( dynamic_cast<RimDerivedEnsembleCase*>( summaryCase ) == nullptr )
|
||||
if ( dynamic_cast<RimDerivedSummaryCase*>( summaryCase ) == nullptr )
|
||||
calculateEnsembleParametersIntersectionHash();
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include "RigWellDiskData.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -58,11 +60,11 @@ double RigWellDiskData::total() const
|
||||
{
|
||||
if ( m_isSingleProperty )
|
||||
{
|
||||
return m_singlePropertyValue;
|
||||
return singlePropertyValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_oilValue + m_gasValue + m_waterValue;
|
||||
return oil() + gas() + water();
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,6 +72,14 @@ double RigWellDiskData::total() const
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellDiskData::oil() const
|
||||
{
|
||||
return std::fabs( m_oilValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellDiskData::oilSigned() const
|
||||
{
|
||||
return m_oilValue;
|
||||
}
|
||||
@ -78,6 +88,14 @@ double RigWellDiskData::oil() const
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellDiskData::gas() const
|
||||
{
|
||||
return std::fabs( m_gasValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellDiskData::gasSigned() const
|
||||
{
|
||||
return m_gasValue;
|
||||
}
|
||||
@ -86,6 +104,14 @@ double RigWellDiskData::gas() const
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellDiskData::water() const
|
||||
{
|
||||
return std::fabs( m_waterValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellDiskData::waterSigned() const
|
||||
{
|
||||
return m_waterValue;
|
||||
}
|
||||
@ -94,6 +120,14 @@ double RigWellDiskData::water() const
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellDiskData::singlePropertyValue() const
|
||||
{
|
||||
return std::fabs( m_singlePropertyValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellDiskData::singlePropertyValueSigned() const
|
||||
{
|
||||
return m_singlePropertyValue;
|
||||
}
|
||||
|
@ -31,10 +31,18 @@ public:
|
||||
void setOilGasWater( double oil, double gas, double water );
|
||||
|
||||
double total() const;
|
||||
|
||||
double oil() const;
|
||||
double oilSigned() const;
|
||||
|
||||
double gas() const;
|
||||
double gasSigned() const;
|
||||
|
||||
double water() const;
|
||||
double waterSigned() const;
|
||||
|
||||
double singlePropertyValue() const;
|
||||
double singlePropertyValueSigned() const;
|
||||
bool isSingleProperty() const;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user