mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Implement proxy field python methods
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "RimEclipseCellColors.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RicfCommandObject.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
@@ -50,7 +51,7 @@ CAF_PDM_SOURCE_INIT( RimEclipseCellColors, "ResultSlot" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCellColors::RimEclipseCellColors()
|
||||
{
|
||||
CAF_PDM_InitObject( "Cell Result", ":/CellResult.png", "", "" );
|
||||
RICF_InitObjectWithScriptNameAndComment( "Cell Result", ":/CellResult.png", "", "", "CellColors", "Eclipse Cell Colors class" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &obsoleteField_legendConfig, "LegendDefinition", "Color Legend", "", "", "" );
|
||||
this->obsoleteField_legendConfig.xmlCapability()->setIOWritable( false );
|
||||
|
||||
@@ -95,7 +95,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe
|
||||
, m_labelPosition( labelPosition )
|
||||
, m_ternaryEnabled( true )
|
||||
{
|
||||
CAF_PDM_InitObject( "Result Definition", "", "", "" );
|
||||
RICF_InitObjectWithScriptNameAndComment( "Result Definition", "", "", "", "EclipseResult", "An eclipse result definition" );
|
||||
|
||||
RICF_InitFieldNoDefault( &m_resultType, "ResultType", "Type", "", "", "" );
|
||||
m_resultType.uiCapability()->setUiHidden( true );
|
||||
|
||||
@@ -172,8 +172,12 @@ RimEclipseView::RimEclipseView()
|
||||
CAF_PDM_InitField( &m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showInvalidCells, "ShowInvalidCells", false, "Show Invalid Cells", "", "", "" );
|
||||
|
||||
this->cellResult()->setReservoirView( this );
|
||||
RICF_InitFieldNoDefault( &m_cellResultData, "CellResultData", "", "", "", "Current Eclipse Cell Result" );
|
||||
m_cellResultData.xmlCapability()->disableIO();
|
||||
m_cellResultData.registerGetMethod( this, &RimEclipseView::currentCellResultData );
|
||||
m_cellResultData.registerSetMethod( this, &RimEclipseView::setCurrentCellResultData );
|
||||
|
||||
this->cellResult()->setReservoirView( this );
|
||||
this->cellEdgeResult()->setReservoirView( this );
|
||||
this->cellEdgeResult()->legendConfig()->setColorRange( RimRegularLegendConfig::PINK_WHITE );
|
||||
|
||||
@@ -351,6 +355,12 @@ void RimEclipseView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
|
||||
scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if ( changedField == &m_cellResultData )
|
||||
{
|
||||
currentGridCellResults()->recalculateStatistics( m_cellResult->eclipseResultAddress() );
|
||||
setCurrentTimeStepAndUpdate( currentTimeStep() );
|
||||
createDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1120,7 +1130,7 @@ void RimEclipseView::onUpdateDisplayModelVisibility()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Convenience for quick access to results
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigCaseCellResultsData* RimEclipseView::currentGridCellResults()
|
||||
RigCaseCellResultsData* RimEclipseView::currentGridCellResults() const
|
||||
{
|
||||
if ( m_eclipseCase )
|
||||
{
|
||||
@@ -1894,6 +1904,45 @@ RimEclipseCellColors* RimEclipseView::currentFaultResultColors()
|
||||
return faultResultColors;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimEclipseView::currentCellResultData() const
|
||||
{
|
||||
std::vector<double> resultData;
|
||||
if ( currentGridCellResults() && cellResult() )
|
||||
{
|
||||
int timeStep = 0;
|
||||
if ( cellResult()->hasDynamicResult() )
|
||||
{
|
||||
timeStep = this->currentTimeStep();
|
||||
}
|
||||
resultData = currentGridCellResults()->cellScalarResults( cellResult()->eclipseResultAddress() )[timeStep];
|
||||
}
|
||||
return resultData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::setCurrentCellResultData( const std::vector<double>& values )
|
||||
{
|
||||
if ( currentGridCellResults() && cellResult() )
|
||||
{
|
||||
int timeStep = 0;
|
||||
if ( cellResult()->hasDynamicResult() )
|
||||
{
|
||||
timeStep = this->currentTimeStep();
|
||||
}
|
||||
std::vector<double>* modResult =
|
||||
currentGridCellResults()->modifiableCellScalarResult( cellResult()->eclipseResultAddress(), timeStep );
|
||||
if ( modResult->size() == values.size() )
|
||||
{
|
||||
*modResult = values;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
|
||||
@@ -101,10 +102,13 @@ public:
|
||||
const RimEclipsePropertyFilterCollection* eclipsePropertyFilterCollection() const;
|
||||
void setOverridePropertyFilterCollection( RimEclipsePropertyFilterCollection* pfc );
|
||||
|
||||
RigCaseCellResultsData* currentGridCellResults();
|
||||
RigCaseCellResultsData* currentGridCellResults() const;
|
||||
const RigActiveCellInfo* currentActiveCellInfo() const;
|
||||
RimEclipseCellColors* currentFaultResultColors();
|
||||
|
||||
std::vector<double> currentCellResultData() const;
|
||||
void setCurrentCellResultData( const std::vector<double>& values );
|
||||
|
||||
void setEclipseCase( RimEclipseCase* reservoir );
|
||||
RimEclipseCase* eclipseCase() const;
|
||||
RimCase* ownerCase() const override;
|
||||
@@ -206,6 +210,8 @@ private:
|
||||
caf::PdmChildField<RimStimPlanColors*> m_fractureColors;
|
||||
caf::PdmChildField<RimVirtualPerforationResults*> m_virtualPerforationResult;
|
||||
|
||||
caf::PdmProxyValueField<std::vector<double>> m_cellResultData;
|
||||
|
||||
caf::PdmChildField<RimSimWellInViewCollection*> m_wellCollection;
|
||||
caf::PdmChildField<RimFaultInViewCollection*> m_faultCollection;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user