mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Rename ApplicationCode to ApplicationLibCode
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotDataSet.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlotCollection.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotDataSet.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlotCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
list(APPEND QT_MOC_HEADERS
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlot.h
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel\\GridCrossPlots" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilterCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellPropertyFilter.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilterCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellPropertyFilter.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel\\GridCrossPlots\\CellFilters" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
@@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimPlotCellFilter.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RimPlotCellFilter::FilterModeType>::setUp()
|
||||
{
|
||||
addItem( RimPlotCellFilter::INCLUDE, "INCLUDE", "Include" );
|
||||
addItem( RimPlotCellFilter::EXCLUDE, "EXCLUDE", "Exclude" );
|
||||
setDefault( RimPlotCellFilter::INCLUDE );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_ABSTRACT_SOURCE_INIT( RimPlotCellFilter, "RimPlotCellFilter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellFilter::RimPlotCellFilter()
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault( &m_filterMode, "FilterMode", "Filter Mode", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellFilter::updateCellVisibility( size_t timeStepIndex, cvf::UByteArray* cellVisibility )
|
||||
{
|
||||
if ( isChecked() )
|
||||
{
|
||||
updateCellVisibilityFromFilter( timeStepIndex, cellVisibility );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellFilter::FilterModeType RimPlotCellFilter::filterMode() const
|
||||
{
|
||||
return m_filterMode();
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimCheckableNamedObject.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPlotCellFilter : public RimCheckableNamedObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum FilterModeType
|
||||
{
|
||||
INCLUDE,
|
||||
EXCLUDE
|
||||
};
|
||||
|
||||
public:
|
||||
RimPlotCellFilter();
|
||||
|
||||
void updateCellVisibility( size_t timeStepIndex, cvf::UByteArray* cellVisibility );
|
||||
FilterModeType filterMode() const;
|
||||
|
||||
protected:
|
||||
virtual void updateCellVisibilityFromFilter( size_t timeStepIndex, cvf::UByteArray* cellVisibility ) = 0;
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum<FilterModeType>> m_filterMode;
|
||||
};
|
||||
@@ -0,0 +1,96 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimPlotCellFilterCollection.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPlotCellFilterCollection, "RimPlotCellFilterCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellFilterCollection::RimPlotCellFilterCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Plot Cell Filters", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_cellFilters, "CellFilters", "Cell Filters", "", "", "" );
|
||||
m_cellFilters.uiCapability()->setUiHidden( true );
|
||||
|
||||
setName( "Filter Collection" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellFilterCollection::addCellFilter( RimPlotCellFilter* cellFilter )
|
||||
{
|
||||
m_cellFilters.push_back( cellFilter );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimPlotCellFilterCollection::cellFilterCount() const
|
||||
{
|
||||
return m_cellFilters.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellFilterCollection::computeCellVisibilityFromFilter( size_t timeStepIndex, cvf::UByteArray* cellVisibility )
|
||||
{
|
||||
if ( isChecked() )
|
||||
{
|
||||
updateCellVisibilityFromFilter( timeStepIndex, cellVisibility );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellFilterCollection::setCase( RimCase* gridCase )
|
||||
{
|
||||
RimEclipseResultCase* eclipseResultCase = dynamic_cast<RimEclipseResultCase*>( gridCase );
|
||||
if ( eclipseResultCase )
|
||||
{
|
||||
std::vector<RimEclipseResultDefinition*> resultDefinitions;
|
||||
|
||||
this->descendantsIncludingThisOfType( resultDefinitions );
|
||||
for ( auto r : resultDefinitions )
|
||||
{
|
||||
r->setEclipseCase( eclipseResultCase );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellFilterCollection::updateCellVisibilityFromFilter( size_t timeStepIndex, cvf::UByteArray* cellVisibility )
|
||||
{
|
||||
for ( RimPlotCellFilter* f : m_cellFilters() )
|
||||
{
|
||||
if ( f->isChecked() )
|
||||
{
|
||||
f->updateCellVisibility( timeStepIndex, cellVisibility );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimPlotCellFilter.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
|
||||
class RimCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPlotCellFilterCollection : public RimPlotCellFilter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPlotCellFilterCollection();
|
||||
|
||||
void addCellFilter( RimPlotCellFilter* cellFilter );
|
||||
size_t cellFilterCount() const;
|
||||
|
||||
void computeCellVisibilityFromFilter( size_t timeStepIndex, cvf::UByteArray* cellVisibility );
|
||||
|
||||
void setCase( RimCase* gridCase );
|
||||
|
||||
protected:
|
||||
void updateCellVisibilityFromFilter( size_t timeStepIndex, cvf::UByteArray* cellVisibility ) override;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimPlotCellFilter*> m_cellFilters;
|
||||
};
|
||||
@@ -0,0 +1,247 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimPlotCellPropertyFilter.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPlotCellPropertyFilter, "RimPlotCellPropertyFilter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellPropertyFilter::RimPlotCellPropertyFilter()
|
||||
{
|
||||
CAF_PDM_InitObject( "Plot Cell Property Filter", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition", "", "", "" );
|
||||
|
||||
// Set to hidden to avoid this item to been displayed as a child item
|
||||
// Fields in this object are displayed using defineUiOrdering()
|
||||
m_resultDefinition.uiCapability()->setUiHidden( true );
|
||||
m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_lowerBound, "LowerBound", 0.0, "Min", "", "", "" );
|
||||
m_lowerBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_upperBound, "UpperBound", 0.0, "Max", "", "", "" );
|
||||
m_upperBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::setResultDefinition( caf::PdmObject* resultDefinition )
|
||||
{
|
||||
m_resultDefinition = resultDefinition;
|
||||
|
||||
updateName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::setValueRange( double lowerBound, double upperBound )
|
||||
{
|
||||
m_lowerBound = lowerBound;
|
||||
m_upperBound = upperBound;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::updatePointerAfterCopy( RimPlotCellPropertyFilter* other )
|
||||
{
|
||||
if ( eclipseResultDefinition() && eclipseResultDefinition()->eclipseCase() )
|
||||
{
|
||||
auto eclipseCase = eclipseResultDefinition()->eclipseCase();
|
||||
|
||||
other->eclipseResultDefinition()->setEclipseCase( eclipseCase );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseResultDefinition* RimPlotCellPropertyFilter::eclipseResultDefinition()
|
||||
{
|
||||
caf::PdmObject* pdmObj = m_resultDefinition;
|
||||
|
||||
return dynamic_cast<RimEclipseResultDefinition*>( pdmObj );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::findOrComputeMinMaxResultValues( double& minimumValue, double& maximumValue )
|
||||
{
|
||||
RimEclipseResultDefinition* resDef = eclipseResultDefinition();
|
||||
if ( resDef )
|
||||
{
|
||||
RimEclipseCase* eclCase = resDef->eclipseCase();
|
||||
if ( !eclCase ) return;
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = eclCase->eclipseCaseData();
|
||||
if ( !eclipseCaseData ) return;
|
||||
|
||||
resDef->loadResult();
|
||||
|
||||
RigCaseCellResultsData* cellResultsData = resDef->currentGridCellResults();
|
||||
if ( !cellResultsData ) return;
|
||||
|
||||
cellResultsData->minMaxCellScalarValues( resDef->eclipseResultAddress(), minimumValue, maximumValue );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::updateName()
|
||||
{
|
||||
QString name = "Property filter - ";
|
||||
|
||||
RimEclipseResultDefinition* resDef = eclipseResultDefinition();
|
||||
if ( resDef )
|
||||
{
|
||||
name += resDef->resultVariableUiName();
|
||||
}
|
||||
|
||||
setName( name );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::updateCellVisibilityFromFilter( size_t timeStepIndex, cvf::UByteArray* visibleCells )
|
||||
{
|
||||
CVF_ASSERT( visibleCells );
|
||||
|
||||
RimEclipseResultDefinition* resDef = eclipseResultDefinition();
|
||||
if ( resDef )
|
||||
{
|
||||
RimEclipseCase* eclCase = resDef->eclipseCase();
|
||||
if ( !eclCase ) return;
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = eclCase->eclipseCaseData();
|
||||
if ( !eclipseCaseData ) return;
|
||||
|
||||
resDef->loadResult();
|
||||
|
||||
RigCaseCellResultsData* cellResultsData = resDef->currentGridCellResults();
|
||||
if ( !cellResultsData ) return;
|
||||
|
||||
RigEclipseResultAddress rigEclipseAddress = resDef->eclipseResultAddress();
|
||||
|
||||
if ( !resDef->currentGridCellResults()->hasResultEntry( rigEclipseAddress ) ) return;
|
||||
|
||||
size_t clampedIndex = std::min( timeStepIndex, cellResultsData->timeStepCount( rigEclipseAddress ) - 1 );
|
||||
const std::vector<double>& cellResultValues = cellResultsData->cellScalarResults( rigEclipseAddress, clampedIndex );
|
||||
if ( cellResultValues.empty() ) return;
|
||||
|
||||
const RigActiveCellInfo* actCellInfo = cellResultsData->activeCellInfo();
|
||||
size_t totalReservoirCellCount = actCellInfo->reservoirCellCount();
|
||||
|
||||
if ( visibleCells->size() < totalReservoirCellCount )
|
||||
{
|
||||
QString message = QString( "Size of visible Cells (%1) is less than total cell count (%2)" )
|
||||
.arg( visibleCells->size() )
|
||||
.arg( totalReservoirCellCount );
|
||||
|
||||
RiaLogging::error( message );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool isUsingGlobalActiveIndex = cellResultsData->isUsingGlobalActiveIndex( rigEclipseAddress );
|
||||
double lowerBound = m_lowerBound;
|
||||
double upperBound = m_upperBound;
|
||||
size_t cellResultIndex = 0;
|
||||
double scalarValue = 0.0;
|
||||
FilterModeType currentFilterMode = filterMode();
|
||||
|
||||
for ( size_t reservoirCellIndex = 0; reservoirCellIndex < totalReservoirCellCount; ++reservoirCellIndex )
|
||||
{
|
||||
if ( !actCellInfo->isActive( reservoirCellIndex ) ) continue;
|
||||
|
||||
cellResultIndex = reservoirCellIndex;
|
||||
if ( isUsingGlobalActiveIndex )
|
||||
{
|
||||
cellResultIndex = actCellInfo->cellResultIndex( reservoirCellIndex );
|
||||
}
|
||||
|
||||
if ( cellResultIndex != cvf::UNDEFINED_SIZE_T && cellResultIndex < cellResultValues.size() )
|
||||
{
|
||||
if ( ( *visibleCells )[reservoirCellIndex] )
|
||||
{
|
||||
scalarValue = cellResultValues[cellResultIndex];
|
||||
if ( lowerBound <= scalarValue && scalarValue <= upperBound )
|
||||
{
|
||||
if ( currentFilterMode == RimPlotCellFilter::EXCLUDE )
|
||||
{
|
||||
( *visibleCells )[reservoirCellIndex] = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( currentFilterMode == RimPlotCellFilter::INCLUDE )
|
||||
{
|
||||
( *visibleCells )[reservoirCellIndex] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCellPropertyFilter::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_lowerBound || field == &m_upperBound )
|
||||
{
|
||||
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
|
||||
if ( !myAttr )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double minimumValue = 0.0;
|
||||
double maximumValue = 0.0;
|
||||
|
||||
findOrComputeMinMaxResultValues( minimumValue, maximumValue );
|
||||
|
||||
myAttr->m_minimum = minimumValue;
|
||||
myAttr->m_maximum = maximumValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimPlotCellFilter.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
|
||||
class RimEclipseResultDefinition;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPlotCellPropertyFilter : public RimPlotCellFilter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPlotCellPropertyFilter();
|
||||
|
||||
// Currently supported result definition is RimEclipseResultDefinition, but the interface is designed to also
|
||||
// support RimGeoMechResultDefinition
|
||||
void setResultDefinition( caf::PdmObject* resultDefinition );
|
||||
|
||||
void setValueRange( double lowerBound, double upperBound );
|
||||
|
||||
void updatePointerAfterCopy( RimPlotCellPropertyFilter* other );
|
||||
|
||||
protected:
|
||||
void updateCellVisibilityFromFilter( size_t timeStepIndex, cvf::UByteArray* visibleCells ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
RimEclipseResultDefinition* eclipseResultDefinition();
|
||||
void findOrComputeMinMaxResultValues( double& minimumValue, double& maximumValue );
|
||||
void updateName();
|
||||
|
||||
private:
|
||||
caf::PdmChildField<caf::PdmObject*> m_resultDefinition;
|
||||
caf::PdmField<double> m_lowerBound;
|
||||
caf::PdmField<double> m_upperBound;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,165 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimNameConfig.h"
|
||||
#include "RimPlot.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <set>
|
||||
|
||||
class RimPlotAxisPropertiesInterface;
|
||||
class RimPlotAxisProperties;
|
||||
class RimGridCrossPlotDataSet;
|
||||
class RiuDraggableOverlayFrame;
|
||||
class RiuGridCrossQwtPlot;
|
||||
|
||||
class RimGridCrossPlotNameConfig : public RimNameConfig
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimGridCrossPlotNameConfig();
|
||||
|
||||
public:
|
||||
caf::PdmField<bool> addDataSetNames;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
private:
|
||||
void doEnableAllAutoNameTags( bool enable ) override;
|
||||
};
|
||||
|
||||
class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface
|
||||
{
|
||||
Q_OBJECT;
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimGridCrossPlot();
|
||||
~RimGridCrossPlot();
|
||||
|
||||
QString description() const override;
|
||||
|
||||
RimGridCrossPlotDataSet* createDataSet();
|
||||
int indexOfDataSet( const RimGridCrossPlotDataSet* dataSet ) const;
|
||||
void addDataSet( RimGridCrossPlotDataSet* dataSet );
|
||||
|
||||
std::vector<RimGridCrossPlotDataSet*> dataSets() const;
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
RiuQwtPlotWidget* viewer() override;
|
||||
|
||||
QImage snapshotWindowContent() override;
|
||||
void zoomAll() override;
|
||||
void calculateZoomRangeAndUpdateQwt();
|
||||
QString createAutoName() const override;
|
||||
|
||||
bool showInfoBox() const;
|
||||
void updateInfoBox();
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
void detachAllCurves() override;
|
||||
void reattachAllCurves() override;
|
||||
|
||||
void performAutoNameUpdate() override;
|
||||
void updateCurveNamesAndPlotTitle();
|
||||
void swapAxes();
|
||||
|
||||
QString asciiDataForPlotExport() const override;
|
||||
QString asciiTitleForPlotExport( int dataSetIndex ) const;
|
||||
QString asciiDataForGridCrossPlotExport( int dataSetIndex ) const;
|
||||
|
||||
bool isXAxisLogarithmic() const;
|
||||
bool isYAxisLogarithmic() const;
|
||||
void setYAxisInverted( bool inverted );
|
||||
|
||||
void updateLegend() override;
|
||||
|
||||
void updateZoomInQwt() override;
|
||||
void updateZoomFromQwt() override;
|
||||
|
||||
void setAutoScaleXEnabled( bool enabled ) override;
|
||||
void setAutoScaleYEnabled( bool enabled ) override;
|
||||
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
|
||||
bool isDeletable() const override;
|
||||
|
||||
protected:
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void initAfterRead() override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
void updateAxes() override;
|
||||
void updatePlot();
|
||||
|
||||
virtual QString xAxisParameterString() const;
|
||||
QString yAxisParameterString() const;
|
||||
|
||||
void updateAxisInQwt( RiaDefines::PlotAxis axisType );
|
||||
void updateAxisFromQwt( RiaDefines::PlotAxis axisType );
|
||||
std::vector<const QwtPlotCurve*> visibleQwtCurves() const;
|
||||
|
||||
RimPlotAxisProperties* xAxisProperties();
|
||||
RimPlotAxisProperties* yAxisProperties();
|
||||
|
||||
RimGridCrossPlotNameConfig* nameConfig();
|
||||
void setShowInfoBox( bool enable );
|
||||
|
||||
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
||||
|
||||
private:
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
|
||||
void doUpdateLayout() override;
|
||||
void cleanupBeforeClose();
|
||||
|
||||
QString generateInfoBoxText() const;
|
||||
|
||||
void connectAxisSignals( RimPlotAxisProperties* axis );
|
||||
void axisSettingsChanged( const caf::SignalEmitter* emitter );
|
||||
void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic );
|
||||
|
||||
private slots:
|
||||
void onPlotZoomed();
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showInfoBox;
|
||||
caf::PdmField<bool> m_showLegend_OBSOLETE;
|
||||
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
|
||||
|
||||
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
|
||||
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;
|
||||
|
||||
caf::PdmChildArrayField<RimGridCrossPlotDataSet*> m_crossPlotDataSets;
|
||||
|
||||
QPointer<RiuGridCrossQwtPlot> m_plotWidget;
|
||||
QPointer<RiuDraggableOverlayFrame> m_infoBox;
|
||||
};
|
||||
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimGridCrossPlotCollection.h"
|
||||
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimGridCrossPlotCollection, "RimGridCrossPlotCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridCrossPlotCollection::RimGridCrossPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Grid Cross Plots", ":/SummaryXPlotsLight16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_gridCrossPlots, "GridCrossPlots", "Grid Cross Plots", "", "", "" );
|
||||
m_gridCrossPlots.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridCrossPlotCollection::~RimGridCrossPlotCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridCrossPlot*> RimGridCrossPlotCollection::plots() const
|
||||
{
|
||||
return m_gridCrossPlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimGridCrossPlotCollection::plotCount() const
|
||||
{
|
||||
return m_gridCrossPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridCrossPlot* RimGridCrossPlotCollection::createGridCrossPlot()
|
||||
{
|
||||
RimGridCrossPlot* plot = new RimGridCrossPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
// plot->setDescription(QString("Summary Cross Plot %1").arg(m_gridCrossPlots.size()));
|
||||
addPlot( plot );
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCollection::insertPlot( RimGridCrossPlot* plot, size_t index )
|
||||
{
|
||||
m_gridCrossPlots.insert( index, plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCollection::removePlot( RimGridCrossPlot* plot )
|
||||
{
|
||||
m_gridCrossPlots.removeChildObject( plot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimAbstractPlotCollection.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGridCrossPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimGridCrossPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimGridCrossPlotCollection();
|
||||
~RimGridCrossPlotCollection() override;
|
||||
|
||||
std::vector<RimGridCrossPlot*> plots() const final;
|
||||
size_t plotCount() const final;
|
||||
void insertPlot( RimGridCrossPlot* plot, size_t index ) final;
|
||||
void removePlot( RimGridCrossPlot* plot ) final;
|
||||
|
||||
RimGridCrossPlot* createGridCrossPlot();
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimGridCrossPlot*> m_gridCrossPlots;
|
||||
};
|
||||
@@ -0,0 +1,193 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimGridCrossPlotCurve.h"
|
||||
|
||||
#include "RigCaseCellResultCalculator.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuQwtSymbol.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QPointF>
|
||||
#include <QVector>
|
||||
|
||||
#include "qwt_graphic.h"
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_plot_curve.h"
|
||||
|
||||
#include <random>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimGridCrossPlotCurve, "GridCrossPlotCurve" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridCrossPlotCurve::RimGridCrossPlotCurve()
|
||||
: m_dataSetIndex( 0 )
|
||||
, m_groupIndex( 0 )
|
||||
{
|
||||
CAF_PDM_InitObject( "Cross Plot Points", ":/WellLogCurve16x16.png", "", "" );
|
||||
|
||||
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
|
||||
setSymbol( RiuQwtSymbol::SYMBOL_NONE );
|
||||
setSymbolSize( 4 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::setGroupingInformation( int dataSetIndex, int groupIndex )
|
||||
{
|
||||
m_dataSetIndex = dataSetIndex;
|
||||
m_groupIndex = groupIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::setSamples( const std::vector<double>& xValues, const std::vector<double>& yValues )
|
||||
{
|
||||
CVF_ASSERT( xValues.size() == yValues.size() );
|
||||
|
||||
if ( xValues.empty() || yValues.empty() || !m_qwtPlotCurve ) return;
|
||||
|
||||
m_qwtPlotCurve->setSamples( &xValues[0], &yValues[0], static_cast<int>( xValues.size() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::setCurveAutoAppearance()
|
||||
{
|
||||
determineSymbol();
|
||||
updateCurveAppearance();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimGridCrossPlotCurve::groupIndex() const
|
||||
{
|
||||
return m_groupIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimGridCrossPlotCurve::sampleCount() const
|
||||
{
|
||||
return m_qwtPlotCurve ? m_qwtPlotCurve->dataSize() : 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::determineLegendIcon()
|
||||
{
|
||||
if ( !m_qwtPlotCurve ) return;
|
||||
|
||||
RimGridCrossPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
int fontSize = plot->legendFontSize();
|
||||
m_qwtPlotCurve->setLegendIconSize( QSize( fontSize, fontSize ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::setBlackAndWhiteLegendIcons( bool blackAndWhite )
|
||||
{
|
||||
if ( m_qwtPlotCurve )
|
||||
{
|
||||
m_qwtPlotCurve->setBlackAndWhiteLegendIcon( blackAndWhite );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::determineSymbol()
|
||||
{
|
||||
RiuQwtSymbol::PointSymbolEnum symbol = RiuQwtSymbol::cycledSymbolStyle( m_dataSetIndex );
|
||||
setSymbol( symbol );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::updateZoomInParentPlot()
|
||||
{
|
||||
RimGridCrossPlot* plot;
|
||||
this->firstAncestorOrThisOfTypeAsserted( plot );
|
||||
plot->calculateZoomRangeAndUpdateQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::updateLegendsInPlot()
|
||||
{
|
||||
RimGridCrossPlot* plot = nullptr;
|
||||
this->firstAncestorOrThisOfType( plot );
|
||||
if ( plot )
|
||||
{
|
||||
plot->reattachAllCurves();
|
||||
}
|
||||
RimPlotCurve::updateLegendsInPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridCrossPlotCurve::createCurveAutoName()
|
||||
{
|
||||
return m_customCurveName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
m_parentQwtPlot->replot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
||||
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );
|
||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
|
||||
nameGroup->add( &m_curveName );
|
||||
nameGroup->add( &m_showLegend );
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimPlotCurve.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointF>
|
||||
#include <QVector>
|
||||
|
||||
class RimCase;
|
||||
class RimEclipseResultDefinition;
|
||||
class QwtPlotCurve;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGridCrossPlotCurve : public RimPlotCurve
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimGridCrossPlotCurve();
|
||||
~RimGridCrossPlotCurve() override = default;
|
||||
void setGroupingInformation( int dataSetIndex, int groupIndex );
|
||||
void setSamples( const std::vector<double>& xValues, const std::vector<double>& yValues );
|
||||
|
||||
void setCurveAutoAppearance();
|
||||
int groupIndex() const;
|
||||
size_t sampleCount() const;
|
||||
void determineLegendIcon();
|
||||
void setBlackAndWhiteLegendIcons( bool blackAndWhite );
|
||||
|
||||
protected:
|
||||
void determineSymbol();
|
||||
void updateZoomInParentPlot() override;
|
||||
void updateLegendsInPlot() override;
|
||||
QString createCurveAutoName() override;
|
||||
void onLoadDataAndUpdate( bool updateParentPlot ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
private:
|
||||
int m_dataSetIndex;
|
||||
int m_groupIndex;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,195 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RigEclipseCrossPlotDataExtractor.h"
|
||||
#include "RigGridCrossPlotCurveGrouping.h"
|
||||
|
||||
#include "RimCheckableNamedObject.h"
|
||||
#include "RimNameConfig.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
// Include to make Pdm work for cvf::Color
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
|
||||
#include <cvfArray.h>
|
||||
|
||||
#include <QList>
|
||||
#include <QPointer>
|
||||
#include <map>
|
||||
|
||||
class RifTextDataTableFormatter;
|
||||
class RimCase;
|
||||
class RimGridCrossPlotCurve;
|
||||
class RimGridView;
|
||||
class RimEclipseCase;
|
||||
class RimEclipseResultCase;
|
||||
class RimEclipseCellColors;
|
||||
class RimEclipseResultDefinition;
|
||||
class RimRegularLegendConfig;
|
||||
class RimPlotCellFilterCollection;
|
||||
class RimPlotCellFilter;
|
||||
class RiuDraggableOverlayFrame;
|
||||
class QwtPlot;
|
||||
class QwtPlotCurve;
|
||||
class QString;
|
||||
|
||||
class RimGridCrossPlotDataSetNameConfig : public RimNameConfig
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimGridCrossPlotDataSetNameConfig();
|
||||
|
||||
caf::PdmField<bool> addCaseName;
|
||||
caf::PdmField<bool> addAxisVariables;
|
||||
caf::PdmField<bool> addTimestep;
|
||||
caf::PdmField<bool> addGrouping;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
private:
|
||||
void doEnableAllAutoNameTags( bool enable ) override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGridCrossPlotDataSet : public RimCheckableNamedObject, public RimNameConfigHolderInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
typedef caf::AppEnum<RigGridCrossPlotCurveGrouping> CurveGroupingEnum;
|
||||
|
||||
enum NameComponents
|
||||
{
|
||||
GCP_CASE_NAME,
|
||||
GCP_AXIS_VARIABLES,
|
||||
GCP_TIME_STEP,
|
||||
GCP_GROUP_NAME
|
||||
};
|
||||
|
||||
public:
|
||||
RimGridCrossPlotDataSet();
|
||||
~RimGridCrossPlotDataSet();
|
||||
|
||||
void setCellFilterView( RimGridView* cellFilterView );
|
||||
void loadDataAndUpdate( bool updateParentPlot );
|
||||
void setParentQwtPlotNoReplot( QwtPlot* parent );
|
||||
QString xAxisName() const;
|
||||
QString yAxisName() const;
|
||||
QString infoText() const;
|
||||
|
||||
int indexInPlot() const;
|
||||
QString createAutoName() const override;
|
||||
QString groupTitle() const;
|
||||
QString groupParameter() const;
|
||||
void detachAllCurves();
|
||||
void cellFilterViewUpdated();
|
||||
|
||||
RimRegularLegendConfig* legendConfig() const;
|
||||
|
||||
std::vector<RimGridCrossPlotCurve*> curves() const;
|
||||
|
||||
QString caseNameString() const;
|
||||
QString axisVariableString() const;
|
||||
QString timeStepString() const;
|
||||
|
||||
std::map<NameComponents, QString> nameComponents() const;
|
||||
|
||||
void updateCurveNames( size_t dataSetIndex, size_t dataSetCount );
|
||||
void updateLegendRange();
|
||||
void updateLegendIcons();
|
||||
bool groupingByCategoryResult() const;
|
||||
bool groupingEnabled() const;
|
||||
void swapAxisProperties( bool updatePlot );
|
||||
void exportFormattedData( RifTextDataTableFormatter& formatter ) const;
|
||||
|
||||
bool isXAxisLogarithmic() const;
|
||||
bool isYAxisLogarithmic() const;
|
||||
|
||||
void configureForPressureSaturationCurves( RimEclipseResultCase* eclipseResultCase,
|
||||
const QString& dynamicResultName,
|
||||
int timeStep );
|
||||
void addCellFilter( RimPlotCellFilter* cellFilter );
|
||||
void setCustomColor( const cvf::Color3f color );
|
||||
void destroyCurves();
|
||||
|
||||
size_t visibleCurveCount() const;
|
||||
size_t sampleCount() const;
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
void onLoadDataAndUpdate( bool updateParentPlot );
|
||||
|
||||
void assignCurveDataGroups( const RigEclipseCrossPlotResult& result );
|
||||
void createCurves( const RigEclipseCrossPlotResult& result );
|
||||
void fillCurveDataInExistingCurves( const RigEclipseCrossPlotResult& result );
|
||||
QString createGroupName( size_t curveIndex ) const;
|
||||
|
||||
std::map<int, cvf::UByteArray> calculateCellVisibility( RimEclipseCase* eclipseCase ) const;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
void triggerPlotNameUpdateAndReplot();
|
||||
void updateDataSetName();
|
||||
void performAutoNameUpdate() override;
|
||||
void setDefaults();
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
|
||||
bool hasMultipleTimeSteps() const;
|
||||
void filterInvalidCurveValues( RigEclipseCrossPlotResult* result );
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimCase*> m_case;
|
||||
caf::PdmField<int> m_timeStep;
|
||||
caf::PdmPtrField<RimGridView*> m_cellFilterView;
|
||||
caf::PdmField<CurveGroupingEnum> m_grouping;
|
||||
caf::PdmChildField<RimEclipseResultDefinition*> m_xAxisProperty;
|
||||
caf::PdmChildField<RimEclipseResultDefinition*> m_yAxisProperty;
|
||||
caf::PdmChildField<RimEclipseCellColors*> m_groupingProperty;
|
||||
|
||||
caf::PdmChildField<RimGridCrossPlotDataSetNameConfig*> m_nameConfig;
|
||||
|
||||
caf::PdmChildArrayField<RimGridCrossPlotCurve*> m_crossPlotCurves;
|
||||
|
||||
std::map<int, RigEclipseCrossPlotResult> m_groupedResults;
|
||||
|
||||
caf::PdmField<bool> m_useCustomColor;
|
||||
caf::PdmField<cvf::Color3f> m_customColor;
|
||||
caf::PdmChildField<RimPlotCellFilterCollection*> m_plotCellFilterCollection;
|
||||
|
||||
QPointer<RiuDraggableOverlayFrame> m_legendOverlayFrame;
|
||||
};
|
||||
@@ -0,0 +1,275 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimSaturationPressurePlot.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEquil.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEquilibriumAxisAnnotation.h"
|
||||
#include "RimGridCrossPlotDataSet.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
|
||||
#include "CellFilters/RimPlotCellPropertyFilter.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSaturationPressurePlot, "RimSaturationPressurePlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSaturationPressurePlot::RimSaturationPressurePlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Saturation Pressure Plot", ":/SummaryXPlotLight16x16.png", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSaturationPressurePlot::assignCaseAndEquilibriumRegion( RiaDefines::PorosityModelType porosityModel,
|
||||
RimEclipseResultCase* eclipseResultCase,
|
||||
int zeroBasedEquilRegionIndex,
|
||||
int timeStep )
|
||||
{
|
||||
CVF_ASSERT( eclipseResultCase && eclipseResultCase->eclipseCaseData() );
|
||||
|
||||
auto equilData = eclipseResultCase->eclipseCaseData()->equilData();
|
||||
if ( zeroBasedEquilRegionIndex >= (int)equilData.size() )
|
||||
{
|
||||
RiaLogging::error( "Invalid equilibrium region index" );
|
||||
return;
|
||||
}
|
||||
|
||||
setShowInfoBox( false );
|
||||
nameConfig()->addDataSetNames = false;
|
||||
|
||||
QString caseName = eclipseResultCase->caseUserDescription();
|
||||
QString plotTitle = QString( "%1 - EQLNUM %2" ).arg( caseName ).arg( zeroBasedEquilRegionIndex + 1 );
|
||||
|
||||
nameConfig()->setCustomName( plotTitle );
|
||||
|
||||
auto eq = equilData[zeroBasedEquilRegionIndex];
|
||||
|
||||
double gasOilContactDepth = eq.gasOilContactDepth();
|
||||
double waterOilContactDepth = eq.waterOilContactDepth();
|
||||
|
||||
{
|
||||
// Blue PRESSURE curve with data for specified EQLNUM value
|
||||
|
||||
RimGridCrossPlotDataSet* curveSet = createDataSet();
|
||||
curveSet->configureForPressureSaturationCurves( eclipseResultCase, "PRESSURE", timeStep );
|
||||
|
||||
cvf::Color3f curveColor = RiaColorTables::summaryCurveBluePaletteColors().cycledColor3f( 0 );
|
||||
curveSet->setCustomColor( curveColor );
|
||||
|
||||
RimPlotCellPropertyFilter* cellFilter =
|
||||
createEquilibriumRegionPropertyFilter( eclipseResultCase, zeroBasedEquilRegionIndex );
|
||||
|
||||
curveSet->addCellFilter( cellFilter );
|
||||
}
|
||||
|
||||
{
|
||||
// Red dew pressure (PDEW) curve with data for specified EQLNUM value, filtered on depth by gasOilContact
|
||||
|
||||
RimGridCrossPlotDataSet* curveSet = createDataSet();
|
||||
curveSet->configureForPressureSaturationCurves( eclipseResultCase, "PDEW", timeStep );
|
||||
|
||||
cvf::Color3f curveColor = RiaColorTables::summaryCurveRedPaletteColors().cycledColor3f( 0 );
|
||||
curveSet->setCustomColor( curveColor );
|
||||
|
||||
RimPlotCellPropertyFilter* cellFilter =
|
||||
createEquilibriumRegionPropertyFilter( eclipseResultCase, zeroBasedEquilRegionIndex );
|
||||
curveSet->addCellFilter( cellFilter );
|
||||
|
||||
{
|
||||
RigCaseCellResultsData* caseCellResultsData = eclipseResultCase->eclipseCaseData()->results( porosityModel );
|
||||
if ( caseCellResultsData )
|
||||
{
|
||||
RigEclipseResultAddress depthResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "DEPTH" );
|
||||
|
||||
double minDepth = 0.0;
|
||||
double maxDepth = 0.0;
|
||||
caseCellResultsData->minMaxCellScalarValues( depthResultAddress, minDepth, maxDepth );
|
||||
|
||||
maxDepth = gasOilContactDepth;
|
||||
|
||||
RimPlotCellPropertyFilter* depthCellFilter =
|
||||
createDepthPropertyFilter( eclipseResultCase, minDepth, maxDepth );
|
||||
|
||||
curveSet->addCellFilter( depthCellFilter );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Green bubble point pressure (PBUB) curve with data for specified EQLNUM value, filtered on depth between
|
||||
// gasOilContact and waterOilContactDepth
|
||||
|
||||
RimGridCrossPlotDataSet* curveSet = createDataSet();
|
||||
curveSet->configureForPressureSaturationCurves( eclipseResultCase, "PBUB", timeStep );
|
||||
|
||||
cvf::Color3f curveColor = RiaColorTables::summaryCurveGreenPaletteColors().cycledColor3f( 0 );
|
||||
curveSet->setCustomColor( curveColor );
|
||||
|
||||
{
|
||||
RimPlotCellPropertyFilter* cellFilter = new RimPlotCellPropertyFilter();
|
||||
{
|
||||
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
|
||||
resultDefinition->setEclipseCase( eclipseResultCase );
|
||||
resultDefinition->setResultType( RiaDefines::ResultCatType::STATIC_NATIVE );
|
||||
resultDefinition->setResultVariable( RiaDefines::eqlnumResultName() );
|
||||
|
||||
cellFilter->setResultDefinition( resultDefinition );
|
||||
}
|
||||
|
||||
cellFilter->setValueRange( zeroBasedEquilRegionIndex + 1, zeroBasedEquilRegionIndex + 1 );
|
||||
|
||||
curveSet->addCellFilter( cellFilter );
|
||||
}
|
||||
|
||||
{
|
||||
RigCaseCellResultsData* caseCellResultsData = eclipseResultCase->eclipseCaseData()->results( porosityModel );
|
||||
if ( caseCellResultsData )
|
||||
{
|
||||
RigEclipseResultAddress depthResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "DEPTH" );
|
||||
|
||||
double minDepth = 0.0;
|
||||
double maxDepth = 0.0;
|
||||
caseCellResultsData->minMaxCellScalarValues( depthResultAddress, minDepth, maxDepth );
|
||||
|
||||
minDepth = gasOilContactDepth;
|
||||
maxDepth = waterOilContactDepth;
|
||||
|
||||
RimPlotCellPropertyFilter* depthCellFilter =
|
||||
createDepthPropertyFilter( eclipseResultCase, minDepth, maxDepth );
|
||||
|
||||
curveSet->addCellFilter( depthCellFilter );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimPlotAxisProperties* yAxisProps = yAxisProperties();
|
||||
yAxisProps->setInvertedAxis( true );
|
||||
|
||||
{
|
||||
RimEquilibriumAxisAnnotation* annotation = new RimEquilibriumAxisAnnotation;
|
||||
annotation->setEquilibriumData( eclipseResultCase,
|
||||
zeroBasedEquilRegionIndex,
|
||||
RimEquilibriumAxisAnnotation::PlotAxisAnnotationType::PL_EQUIL_GAS_OIL_CONTACT );
|
||||
|
||||
yAxisProps->appendAnnotation( annotation );
|
||||
}
|
||||
{
|
||||
RimEquilibriumAxisAnnotation* annotation = new RimEquilibriumAxisAnnotation;
|
||||
annotation->setEquilibriumData( eclipseResultCase,
|
||||
zeroBasedEquilRegionIndex,
|
||||
RimEquilibriumAxisAnnotation::PlotAxisAnnotationType::PL_EQUIL_WATER_OIL_CONTACT );
|
||||
|
||||
yAxisProps->appendAnnotation( annotation );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSaturationPressurePlot::fixPointersAfterCopy( RimSaturationPressurePlot* source, RimSaturationPressurePlot* copy )
|
||||
{
|
||||
CAF_ASSERT( source && copy );
|
||||
|
||||
std::vector<RimPlotCellPropertyFilter*> sourceFilters;
|
||||
source->descendantsIncludingThisOfType( sourceFilters );
|
||||
|
||||
std::vector<RimPlotCellPropertyFilter*> copyFilters;
|
||||
copy->descendantsIncludingThisOfType( copyFilters );
|
||||
|
||||
if ( !sourceFilters.empty() && ( sourceFilters.size() == copyFilters.size() ) )
|
||||
{
|
||||
for ( size_t i = 0; i < sourceFilters.size(); i++ )
|
||||
{
|
||||
auto sourceFilter = sourceFilters[i];
|
||||
auto copyFilter = copyFilters[i];
|
||||
|
||||
sourceFilter->updatePointerAfterCopy( copyFilter );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSaturationPressurePlot::initAfterRead()
|
||||
{
|
||||
yAxisProperties()->showAnnotationObjectsInProjectTree();
|
||||
|
||||
RimGridCrossPlot::initAfterRead();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSaturationPressurePlot::xAxisParameterString() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellPropertyFilter*
|
||||
RimSaturationPressurePlot::createEquilibriumRegionPropertyFilter( RimEclipseResultCase* eclipseResultCase,
|
||||
int zeroBasedEquilRegionIndex )
|
||||
{
|
||||
RimPlotCellPropertyFilter* cellFilter = new RimPlotCellPropertyFilter();
|
||||
|
||||
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
|
||||
resultDefinition->setEclipseCase( eclipseResultCase );
|
||||
resultDefinition->setResultType( RiaDefines::ResultCatType::STATIC_NATIVE );
|
||||
resultDefinition->setResultVariable( RiaDefines::eqlnumResultName() );
|
||||
|
||||
cellFilter->setResultDefinition( resultDefinition );
|
||||
|
||||
cellFilter->setValueRange( zeroBasedEquilRegionIndex + 1, zeroBasedEquilRegionIndex + 1 );
|
||||
|
||||
return cellFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCellPropertyFilter* RimSaturationPressurePlot::createDepthPropertyFilter( RimEclipseResultCase* eclipseResultCase,
|
||||
double minDepth,
|
||||
double maxDepth )
|
||||
{
|
||||
RimPlotCellPropertyFilter* depthCellFilter = new RimPlotCellPropertyFilter();
|
||||
|
||||
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
|
||||
resultDefinition->setEclipseCase( eclipseResultCase );
|
||||
resultDefinition->setResultType( RiaDefines::ResultCatType::STATIC_NATIVE );
|
||||
resultDefinition->setResultVariable( "DEPTH" );
|
||||
|
||||
depthCellFilter->setResultDefinition( resultDefinition );
|
||||
|
||||
depthCellFilter->setValueRange( minDepth, maxDepth );
|
||||
|
||||
return depthCellFilter;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RiaPorosityModel.h"
|
||||
|
||||
#include "RimGridCrossPlot.h"
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RimPlotCellPropertyFilter;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimSaturationPressurePlot : public RimGridCrossPlot
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimSaturationPressurePlot();
|
||||
|
||||
void assignCaseAndEquilibriumRegion( RiaDefines::PorosityModelType porosityModel,
|
||||
RimEclipseResultCase* eclipseResultCase,
|
||||
int zeroBasedEquilRegionIndex,
|
||||
int timeStep );
|
||||
|
||||
static void fixPointersAfterCopy( RimSaturationPressurePlot* source, RimSaturationPressurePlot* copy );
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
QString xAxisParameterString() const override;
|
||||
|
||||
private:
|
||||
RimPlotCellPropertyFilter* createEquilibriumRegionPropertyFilter( RimEclipseResultCase* eclipseResultCase,
|
||||
int zeroBasedEquilRegionIndex );
|
||||
|
||||
RimPlotCellPropertyFilter*
|
||||
createDepthPropertyFilter( RimEclipseResultCase* eclipseResultCase, double minDepth, double maxDepth );
|
||||
};
|
||||
@@ -0,0 +1,130 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimSaturationPressurePlotCollection.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigEquil.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSaturationPressurePlot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSaturationPressurePlotCollection, "RimSaturationPressurePlotCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSaturationPressurePlotCollection::RimSaturationPressurePlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Saturation Pressure Plots", ":/SummaryXPlotsLight16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_saturationPressurePlots, "SaturationPressurePlots", "Saturation Pressure Plots", "", "", "" );
|
||||
m_saturationPressurePlots.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSaturationPressurePlotCollection::~RimSaturationPressurePlotCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSaturationPressurePlot*>
|
||||
RimSaturationPressurePlotCollection::createSaturationPressurePlots( RimEclipseResultCase* eclipseResultCase,
|
||||
int timeStep )
|
||||
{
|
||||
std::vector<RimSaturationPressurePlot*> generatedPlots;
|
||||
|
||||
if ( !eclipseResultCase ) return generatedPlots;
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = eclipseResultCase->eclipseCaseData();
|
||||
if ( !eclipseCaseData ) return generatedPlots;
|
||||
|
||||
auto results = eclipseCaseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
|
||||
std::set<int> eqlnumRegionIdsFound;
|
||||
{
|
||||
RigEclipseResultAddress resAdr( RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::eqlnumResultName() );
|
||||
if ( results->hasResultEntry( resAdr ) )
|
||||
{
|
||||
results->ensureKnownResultLoaded( resAdr );
|
||||
|
||||
auto vals = results->uniqueCellScalarValues( resAdr );
|
||||
for ( auto v : vals )
|
||||
{
|
||||
eqlnumRegionIdsFound.insert( v );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eclipseResultCase->ensureDeckIsParsedForEquilData();
|
||||
std::vector<RigEquil> equilData = eclipseCaseData->equilData();
|
||||
for ( size_t i = 0; i < equilData.size(); i++ )
|
||||
{
|
||||
int zeroBasedEquilibriumRegion = static_cast<int>( i );
|
||||
|
||||
if ( eqlnumRegionIdsFound.find( zeroBasedEquilibriumRegion + 1 ) != eqlnumRegionIdsFound.end() )
|
||||
{
|
||||
RimSaturationPressurePlot* plot = new RimSaturationPressurePlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
// As discussed with Liv Merete, it is not any use for creation of different plots for matrix/fracture. For
|
||||
// now, use hardcoded value for MATRIX
|
||||
plot->assignCaseAndEquilibriumRegion( RiaDefines::PorosityModelType::MATRIX_MODEL,
|
||||
eclipseResultCase,
|
||||
zeroBasedEquilibriumRegion,
|
||||
timeStep );
|
||||
|
||||
m_saturationPressurePlots.push_back( plot );
|
||||
|
||||
generatedPlots.push_back( plot );
|
||||
}
|
||||
}
|
||||
|
||||
return generatedPlots;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSaturationPressurePlot*> RimSaturationPressurePlotCollection::plots() const
|
||||
{
|
||||
return m_saturationPressurePlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimSaturationPressurePlotCollection::plotCount() const
|
||||
{
|
||||
return m_saturationPressurePlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSaturationPressurePlotCollection::deleteAllChildObjects()
|
||||
{
|
||||
m_saturationPressurePlots.deleteAllChildObjects();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimSaturationPressurePlot;
|
||||
class RimEclipseResultCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSaturationPressurePlotCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimSaturationPressurePlotCollection();
|
||||
~RimSaturationPressurePlotCollection() override;
|
||||
|
||||
std::vector<RimSaturationPressurePlot*> createSaturationPressurePlots( RimEclipseResultCase* eclipseResultCase,
|
||||
int timeStep );
|
||||
|
||||
std::vector<RimSaturationPressurePlot*> plots() const;
|
||||
size_t plotCount() const;
|
||||
void deleteAllChildObjects();
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimSaturationPressurePlot*> m_saturationPressurePlots;
|
||||
};
|
||||
Reference in New Issue
Block a user