Working Correlation Plot prototype

This commit is contained in:
Gaute Lindkvist
2020-04-17 09:31:42 +02:00
parent 82ed7bbc81
commit 60419f0985
24 changed files with 1125 additions and 13 deletions

3
.gitmodules vendored
View File

@@ -1,3 +1,6 @@
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg
[submodule "ThirdParty/gsl"]
path = ThirdParty/gsl
url = https://github.com/lindkvis/gsl/

View File

@@ -45,6 +45,8 @@
#include "RimAnnotationTextAppearance.h"
#include "RimCellRangeFilterCollection.h"
#include "RimCommandObject.h"
#include "RimCorrelationPlot.h"
#include "RimCorrelationPlotCollection.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseView.h"
#include "RimFlowPlotCollection.h"
@@ -331,7 +333,7 @@ bool RiaApplication::openFile( const QString& fileName )
}
else if ( fileType & RiaDefines::ANY_ECLIPSE_FILE )
{
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{fileName}, true );
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{ fileName }, true );
lastUsedDialogTag = RiaDefines::defaultDirectoryLabel( fileType );
}
@@ -1546,6 +1548,7 @@ void RiaApplication::loadAndUpdatePlotData()
RimGridCrossPlotCollection* gcpColl = nullptr;
RimSaturationPressurePlotCollection* sppColl = nullptr;
RimAnalysisPlotCollection* alsColl = nullptr;
RimCorrelationPlotCollection* corrColl = nullptr;
RimMultiPlotCollection* gpwColl = nullptr;
if ( m_project->mainPlotCollection() )
@@ -1586,6 +1589,10 @@ void RiaApplication::loadAndUpdatePlotData()
{
alsColl = m_project->mainPlotCollection()->analysisPlotCollection();
}
if ( m_project->mainPlotCollection->correlationPlotCollection() )
{
corrColl = m_project->mainPlotCollection()->correlationPlotCollection();
}
if ( m_project->mainPlotCollection()->multiPlotCollection() )
{
gpwColl = m_project->mainPlotCollection()->multiPlotCollection();
@@ -1602,6 +1609,7 @@ void RiaApplication::loadAndUpdatePlotData()
plotCount += gcpColl ? gcpColl->gridCrossPlots().size() : 0;
plotCount += sppColl ? sppColl->plots().size() : 0;
plotCount += alsColl ? alsColl->plots().size() : 0;
plotCount += corrColl ? corrColl->plots().size() : 0;
plotCount += gpwColl ? gpwColl->multiPlots().size() : 0;
if ( plotCount > 0 )
@@ -1686,6 +1694,15 @@ void RiaApplication::loadAndUpdatePlotData()
}
}
if ( corrColl )
{
for ( const auto& corrPlot : corrColl->plots() )
{
corrPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( gpwColl )
{
for ( const auto& multiPlot : gpwColl->multiPlots() )
@@ -1807,7 +1824,7 @@ bool RiaApplication::generateCode( const QString& fileName, QString* errMsg )
std::vector<std::shared_ptr<const caf::PdmObject>> commandObjects;
QStringList excludedClassNames{"TestCommand1", "TC2"}; // See RifCommandCore-Text.cpp
QStringList excludedClassNames{ "TestCommand1", "TC2" }; // See RifCommandCore-Text.cpp
auto allObjects = caf::PdmMarkdownBuilder::createAllObjects( caf::PdmDefaultObjectFactory::instance() );
for ( auto classObject : allObjects )

View File

@@ -889,6 +889,14 @@ const QString& RiaPreferences::timeFormat() const
return m_timeFormat();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences::dateTimeFormat() const
{
return QString( "%1 %2" ).arg( m_dateFormat() ).arg( m_timeFormat() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -93,6 +93,7 @@ public:
const QString& dateFormat() const;
const QString& timeFormat() const;
QString dateTimeFormat() const;
bool searchPlotTemplateFoldersRecursively() const;
QStringList plotTemplateFolders() const;

View File

@@ -22,6 +22,8 @@
#include "RifEclipseSummaryAddress.h"
#include "gsl/statistics/gsl_statistics_double.h"
#include <QString>
//--------------------------------------------------------------------------------------------------
@@ -49,3 +51,53 @@ const QString RiaStatisticsTools::replacePercentileByPValueText( const QString&
}
return result;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaStatisticsTools::pearsonCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues )
{
#ifdef OWN_IMPLEMENTATION
const double eps = 1.0e-8;
if ( xValues.size() != yValues.size() ) return 0.0;
if ( xValues.empty() ) return 0.0;
size_t sampleSize = xValues.size();
double meanX = 0.0, meanY = 0.0;
for ( size_t i = 0; i < sampleSize; ++i )
{
meanX += xValues[i];
meanY += yValues[i];
}
meanX /= sampleSize;
meanY /= sampleSize;
double sumNumerator = 0.0;
double sumxDiffSquared = 0.0, sumyDiffSquared = 0.0;
for ( size_t i = 0; i < sampleSize; ++i )
{
double xDiff = xValues[i] - meanX;
double yDiff = yValues[i] - meanY;
sumNumerator += xDiff * yDiff;
sumxDiffSquared += xDiff * xDiff;
sumyDiffSquared += yDiff * yDiff;
}
if ( sumxDiffSquared < eps && sumyDiffSquared < eps ) return 1.0;
if ( sumxDiffSquared < eps || sumyDiffSquared < eps ) return 0.0;
return sumNumerator / ( std::sqrt( sumxDiffSquared ) * std::sqrt( sumyDiffSquared ) );
#else
return gsl_stats_correlation( xValues.data(), 1, yValues.data(), 1, xValues.size() );
#endif
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaStatisticsTools::spearmanCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues )
{
std::vector<double> work( 2 * xValues.size() );
return gsl_stats_spearman( xValues.data(), 1, yValues.data(), 1, xValues.size(), work.data() );
}

View File

@@ -21,6 +21,8 @@
#pragma once
#include <cmath>
#include <numeric>
#include <vector>
class QString;
@@ -48,4 +50,8 @@ public:
return true;
}
static double pearsonCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues );
static double spearmanCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues );
};

View File

@@ -76,6 +76,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/AnalysisPlots
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/CorrelationPlots
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Annotations
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Completions
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Flow
@@ -143,6 +144,7 @@ list( APPEND REFERENCED_CMAKE_FILES
ProjectDataModel/CMakeLists_files.cmake
ProjectDataModel/AnalysisPlots/CMakeLists_files.cmake
ProjectDataModel/CorrelationPlots/CMakeLists_files.cmake
ProjectDataModel/GridCrossPlots/CMakeLists_files.cmake
ProjectDataModel/GridCrossPlots/CellFilters/CMakeLists_files.cmake
ProjectDataModel/Summary/CMakeLists_files.cmake
@@ -170,6 +172,7 @@ list( APPEND REFERENCED_CMAKE_FILES
Commands/AnnotationCommands/CMakeLists_files.cmake
Commands/CompletionCommands/CMakeLists_files.cmake
Commands/CompletionExportCommands/CMakeLists_files.cmake
Commands/CorrelationPlotCommands/CMakeLists_files.cmake
Commands/CrossSectionCommands/CMakeLists_files.cmake
Commands/EclipseCommands/CMakeLists_files.cmake
Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake

View File

@@ -0,0 +1,18 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewCorrelationPlotFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewCorrelationPlotFeature.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "CommandFeature\\CorrelationPlotCommands" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@@ -0,0 +1,81 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicNewCorrelationPlotFeature.h"
#include "RimCorrelationPlot.h"
#include "RimCorrelationPlotCollection.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicNewCorrelationPlotFeature, "RicNewCorrelationPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewCorrelationPlotFeature::isCommandEnabled()
{
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
if ( selObj )
{
selObj->firstAncestorOrThisOfType( correlationPlotColl );
}
if ( correlationPlotColl ) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewCorrelationPlotFeature::onActionTriggered( bool isChecked )
{
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
if ( selObj )
{
selObj->firstAncestorOrThisOfType( correlationPlotColl );
}
if ( !correlationPlotColl ) return;
auto newPlot = correlationPlotColl->createCorrelationPlot();
newPlot->loadDataAndUpdate();
correlationPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::setExpanded( newPlot );
RiuPlotMainWindowTools::selectAsCurrentItem( newPlot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewCorrelationPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "New Correlation Plot" );
actionToSetup->setIcon( QIcon( ":/AnalysisPlot16x16.png" ) );
}

View File

@@ -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 RicNewCorrelationPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -24,10 +24,12 @@
#include "Rim2dIntersectionViewCollection.h"
#include "Rim3dView.h"
#include "RimAnalysisPlot.h"
#include "RimAnnotationCollection.h"
#include "RimAnnotationInViewCollection.h"
#include "RimCase.h"
#include "RimCellRangeFilterCollection.h"
#include "RimCorrelationPlot.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseView.h"
#include "RimEnsembleCurveFilterCollection.h"
@@ -53,7 +55,6 @@
#include "RiuPlotMainWindow.h"
#include "RimAnalysisPlot.h"
#include "cafNotificationCenter.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmDocument.h"
@@ -348,6 +349,15 @@ void RicDeleteItemExec::redo()
analysisPlot->loadDataAndUpdate();
}
}
{
RimCorrelationPlot* corrPlot;
parentObj->firstAncestorOrThisOfType( corrPlot );
if ( corrPlot )
{
corrPlot->loadDataAndUpdate();
}
}
}
}

View File

@@ -21,9 +21,11 @@
#include "RicDeleteItemExec.h"
#include "RicDeleteItemExecData.h"
#include "RimAnalysisPlot.h"
#include "RimAsciiDataCurve.h"
#include "RimBoxIntersection.h"
#include "RimCellRangeFilter.h"
#include "RimCorrelationPlot.h"
#include "RimDerivedEnsembleCaseCollection.h"
#include "RimEclipseInputProperty.h"
#include "RimEclipsePropertyFilter.h"
@@ -75,7 +77,6 @@
#include "cafPdmReferenceHelper.h"
#include "cafSelectionManager.h"
#include "RimAnalysisPlot.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicDeleteItemFeature, "RicDeleteItemFeature" );
@@ -154,6 +155,7 @@ bool isDeletable( caf::PdmUiItem* uiItem )
if ( dynamic_cast<RimGridCrossPlotDataSet*>( uiItem ) ) return true;
if ( dynamic_cast<RimAnalysisPlot*>( uiItem ) ) return true;
if ( dynamic_cast<RimCorrelationPlot*>( uiItem ) ) return true;
if ( dynamic_cast<RimPlotDataFilterItem*>( uiItem ) ) return true;
if ( dynamic_cast<RimMultiPlot*>( uiItem ) ) return true;

View File

@@ -0,0 +1,23 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationPlotCollection.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationPlotCollection.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
list(APPEND QT_MOC_HEADERS
)
source_group( "ProjectDataModel\\CorrelationPlots" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@@ -0,0 +1,525 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimCorrelationPlot.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaPreferences.h"
#include "RiaStatisticsTools.h"
#include "RiuGroupedBarChartBuilder.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuSummaryQwtPlot.h"
#include "RiuSummaryVectorSelectionDialog.h"
#include "RifSummaryReaderInterface.h"
#include "RimDerivedSummaryCase.h"
#include "RimEnsembleCurveSet.h"
#include "RimPlotAxisProperties.h"
#include "RimPlotAxisPropertiesInterface.h"
#include "RimPlotDataFilterCollection.h"
#include "RimProject.h"
#include "RimSummaryAddress.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryPlotAxisFormatter.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiPushButtonEditor.h"
#include "qwt_column_symbol.h"
#include "qwt_legend.h"
#include "qwt_painter.h"
#include "qwt_scale_draw.h"
#include <limits>
#include <map>
#include <set>
namespace caf
{
template <>
void caf::AppEnum<RimCorrelationPlot::CorrelationFactor>::setUp()
{
addItem( RimCorrelationPlot::CorrelationFactor::PEARSON, "PEARSON", "Pearson Correlation Coefficient" );
addItem( RimCorrelationPlot::CorrelationFactor::SPEARMAN, "SPEARMAN", "Spearman's Rank Correlation Coefficient" );
setDefault( RimCorrelationPlot::CorrelationFactor::PEARSON );
}
} // namespace caf
CAF_PDM_SOURCE_INIT( RimCorrelationPlot, "CorrelationPlot" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCorrelationPlot::RimCorrelationPlot()
: RimPlot()
{
CAF_PDM_InitObject( "Correlation Plot", ":/CorrelationPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_summaryAddressUiField, "SelectedVariableDisplayVar", "Vector", "", "", "" );
m_summaryAddressUiField.xmlCapability()->disableIO();
m_summaryAddressUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &m_summaryAddress, "SummaryAddress", "Summary Address", "", "", "" );
m_summaryAddress.uiCapability()->setUiHidden( true );
m_summaryAddress.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitFieldNoDefault( &m_pushButtonSelectSummaryAddress, "SelectAddress", "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_pushButtonSelectSummaryAddress );
m_pushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
m_pushButtonSelectSummaryAddress = false;
m_summaryAddress = new RimSummaryAddress;
CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStep", "Time Step", "", "", "" );
m_timeStep.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &m_correlationFactor, "CorrelationFactor", "Correlation Factor", "", "", "" );
m_correlationFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", true, "Show Absolute Values", "", "", "" );
CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values", "", "", "" );
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
CAF_PDM_InitField( &m_useAutoPlotTitle, "AutoTitle", true, "Automatic Plot Title", "", "", "" );
CAF_PDM_InitField( &m_description, "PlotTitle", QString( "Correlation Plot" ), "Custom Plot Title", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCorrelationPlot::~RimCorrelationPlot()
{
removeMdiWindowFromMdiArea();
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimPlot::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_pushButtonSelectSummaryAddress )
{
RiuSummaryVectorSelectionDialog dlg( nullptr );
RimSummaryCaseCollection* candidateEnsemble = m_ensemble;
RifEclipseSummaryAddress candicateAddress = m_summaryAddress->address();
dlg.hideSummaryCases();
dlg.setEnsembleAndAddress( candidateEnsemble, candicateAddress );
if ( dlg.exec() == QDialog::Accepted )
{
auto curveSelection = dlg.curveSelection();
if ( !curveSelection.empty() )
{
m_summaryAddress->setAddress( curveSelection[0].summaryAddress() );
this->loadDataAndUpdate();
this->updateConnectedEditors();
}
}
m_pushButtonSelectSummaryAddress = false;
}
else if ( changedField == &m_timeStep )
{
this->loadDataAndUpdate();
this->updateConnectedEditors();
}
else if ( changedField == &m_ensemble )
{
this->loadDataAndUpdate();
this->updateConnectedEditors();
}
else if ( changedField == &m_correlationFactor || changedField == &m_showAbsoluteValues ||
changedField == &m_sortByAbsoluteValues )
{
this->loadDataAndUpdate();
this->updateConnectedEditors();
}
else if ( changedField == &m_showPlotTitle || changedField == &m_useAutoPlotTitle || changedField == &m_description )
{
this->updatePlotTitle();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector" );
curveDataGroup->add( &m_ensemble );
curveDataGroup->add( &m_summaryAddressUiField );
curveDataGroup->add( &m_pushButtonSelectSummaryAddress, { false, 1, 0 } );
curveDataGroup->add( &m_timeStep );
caf::PdmUiGroup* plotGroup = uiOrdering.addNewGroup( "Plot Settings" );
plotGroup->add( &m_correlationFactor );
plotGroup->add( &m_showAbsoluteValues );
if ( !m_showAbsoluteValues() )
{
plotGroup->add( &m_sortByAbsoluteValues );
}
plotGroup->add( &m_showPlotTitle );
plotGroup->add( &m_useAutoPlotTitle );
plotGroup->add( &m_description );
m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle() );
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
if ( attrib )
{
attrib->m_buttonText = "...";
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimCorrelationPlot::userDescriptionField()
{
return &m_description;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimCorrelationPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options = RimPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
if ( fieldNeedingOptions == &m_ensemble )
{
RimProject* project = RiaApplication::instance()->project();
std::vector<RimSummaryCaseCollection*> summaryCaseCollections;
project->descendantsIncludingThisOfType( summaryCaseCollections );
for ( auto summaryCaseCollection : summaryCaseCollections )
{
if ( summaryCaseCollection->isEnsemble() )
{
options.push_back( caf::PdmOptionItemInfo( summaryCaseCollection->name(), summaryCaseCollection ) );
}
}
}
else if ( fieldNeedingOptions == &m_summaryAddressUiField )
{
if ( m_ensemble )
{
RimEnsembleCurveSet::appendOptionItemsForSummaryAddresses( &options, m_ensemble );
}
}
else if ( fieldNeedingOptions == &m_timeStep )
{
QString dateTimeFormat = RiaApplication::instance()->preferences()->dateTimeFormat();
if ( m_ensemble )
{
std::set<time_t> allTimeSteps = allAvailableTimeSteps();
for ( time_t timeStep : allTimeSteps )
{
QDateTime dateTime = QDateTime::fromTime_t( timeStep );
options.push_back( caf::PdmOptionItemInfo( dateTime.toString( dateTimeFormat ), dateTime ) );
}
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<time_t> RimCorrelationPlot::allAvailableTimeSteps()
{
std::set<time_t> timeStepUnion;
for ( RimSummaryCase* sumCase : m_ensemble->allSummaryCases() )
{
const std::vector<time_t>& timeSteps = sumCase->summaryReader()->timeSteps( m_summaryAddress->address() );
for ( time_t t : timeSteps )
{
timeStepUnion.insert( t );
}
}
return timeStepUnion;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimCorrelationPlot::viewWidget()
{
return m_plotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::deleteViewWidget()
{
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::onLoadDataAndUpdate()
{
updateMdiWindowVisibility();
m_summaryAddressUiField = m_summaryAddress->address();
if ( m_plotWidget )
{
m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotBarChart );
m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotScale );
RiuGroupedBarChartBuilder chartBuilder;
// buildTestPlot( chartBuilder );
addDataToChartBuilder( chartBuilder );
chartBuilder.addBarChartToPlot( m_plotWidget, Qt::Horizontal );
m_plotWidget->insertLegend( nullptr );
m_plotWidget->updateLegend();
this->updateAxes();
this->updatePlotTitle();
m_plotWidget->scheduleReplot();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimCorrelationPlot::snapshotWindowContent()
{
QImage image;
if ( m_plotWidget )
{
QPixmap pix = m_plotWidget->grab();
image = pix.toImage();
}
return image;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimCorrelationPlot::applyFontSize( RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange /*= false */ )
{
bool anyChange = false;
return anyChange;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimCorrelationPlot::description() const
{
return m_description();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget* RimCorrelationPlot::doCreatePlotViewWidget( QWidget* mainWindowParent /*= nullptr */ )
{
if ( !m_plotWidget )
{
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
// updatePlotTitle();
}
return m_plotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget* RimCorrelationPlot::viewer()
{
return m_plotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::detachAllCurves()
{
if ( m_plotWidget ) m_plotWidget->detachItems();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::updateAxes()
{
if ( !m_plotWidget ) return;
m_plotWidget->setAxisTitle( QwtPlot::yLeft, "Parameter" );
m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true );
m_plotWidget->setAxisTitle( QwtPlot::xBottom, "Pearson Correlation Coefficient" );
m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true );
m_plotWidget->setAxisRange( QwtPlot::xBottom, -1.0, 1.0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::onAxisSelected( int axis, bool toggle )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::cleanupBeforeClose()
{
detachAllCurves();
if ( m_plotWidget )
{
m_plotWidget->setParent( nullptr );
delete m_plotWidget;
m_plotWidget = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder )
{
time_t selectedTimestep = m_timeStep().toTime_t();
if ( !m_ensemble ) return;
if ( !m_summaryAddress ) return;
std::vector<EnsembleParameter> ensembleParameters = m_ensemble->variationSortedEnsembleParameters();
std::vector<double> caseValuesAtTimestep;
std::map<QString, std::vector<double>> parameterValues;
for ( size_t caseIdx = 0u; caseIdx < m_ensemble->allSummaryCases().size(); ++caseIdx )
{
auto summaryCase = m_ensemble->allSummaryCases()[caseIdx];
RifSummaryReaderInterface* reader = summaryCase->summaryReader();
if ( !reader ) continue;
if ( !summaryCase->caseRealizationParameters() ) continue;
std::vector<double> values;
double closestValue = std::numeric_limits<double>::infinity();
time_t closestTimeStep = 0;
if ( reader->values( m_summaryAddress->address(), &values ) )
{
const std::vector<time_t>& timeSteps = reader->timeSteps( m_summaryAddress->address() );
for ( size_t i = 0; i < timeSteps.size(); ++i )
{
if ( timeSteps[i] >= selectedTimestep && timeSteps[i] - selectedTimestep < selectedTimestep - closestTimeStep )
{
closestValue = values[i];
closestTimeStep = timeSteps[i];
}
}
}
if ( closestValue != std::numeric_limits<double>::infinity() )
{
caseValuesAtTimestep.push_back( closestValue );
for ( auto parameter : ensembleParameters )
{
if ( parameter.isNumeric() && parameter.isValid() )
{
double paramValue = parameter.values[caseIdx].toDouble();
parameterValues[parameter.name].push_back( paramValue );
}
}
}
}
std::vector<std::pair<QString, double>> correlationResults;
for ( auto parameterValuesPair : parameterValues )
{
double correlation = 0.0;
if ( m_correlationFactor == CorrelationFactor::PEARSON )
{
correlation = RiaStatisticsTools::pearsonCorrelation( parameterValuesPair.second, caseValuesAtTimestep );
}
else
{
correlation = RiaStatisticsTools::spearmanCorrelation( parameterValuesPair.second, caseValuesAtTimestep );
}
correlationResults.push_back( std::make_pair( parameterValuesPair.first, correlation ) );
}
QString timestepString = m_timeStep().toString( RiaApplication::instance()->preferences()->dateTimeFormat() );
for ( auto parameterCorrPair : correlationResults )
{
double value = m_showAbsoluteValues() ? std::abs( parameterCorrPair.second ) : parameterCorrPair.second;
double sortValue = m_sortByAbsoluteValues() ? std::abs( value ) : value;
QString barText = parameterCorrPair.first;
QString majorText = "", medText = "", minText = "", legendText = barText;
chartBuilder.addBarEntry( majorText, medText, minText, sortValue, legendText, barText, value );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::updatePlotTitle()
{
if ( m_useAutoPlotTitle )
{
m_description = QString( "%1 for %2" )
.arg( m_correlationFactor().uiText() )
.arg( QString::fromStdString( m_summaryAddressUiField().uiText() ) );
}
m_plotWidget->setPlotTitle( m_description );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
}

View File

@@ -0,0 +1,124 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RifEclipseSummaryAddress.h"
#include "RifEclipseSummaryAddressQMetaType.h"
#include "RimPlot.h"
#include "RimSummaryCaseCollection.h"
#include "cafAppEnum.h"
#include "cafPdmPtrField.h"
#include <QDateTime>
class RimSummaryAddress;
class RiuGroupedBarChartBuilder;
//==================================================================================================
///
///
//==================================================================================================
class RimCorrelationPlot : public RimPlot
{
CAF_PDM_HEADER_INIT;
public:
enum class CorrelationFactor
{
PEARSON,
SPEARMAN
};
using CorrelationFactorEnum = caf::AppEnum<CorrelationFactor>;
public:
RimCorrelationPlot();
~RimCorrelationPlot() override;
private:
// Overridden PDM methods
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
caf::PdmFieldHandle* userDescriptionField() override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
std::set<time_t> allAvailableTimeSteps();
// RimViewWindow overrides
QWidget* viewWidget() override;
void deleteViewWidget() override;
void onLoadDataAndUpdate() override;
void zoomAll() override {}
QImage snapshotWindowContent() override;
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange = false ) override;
// RimPlotWindow overrides
QString description() const override;
void doUpdateLayout() override {}
// RimPlot Overrides
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
RiuQwtPlotWidget* viewer() override;
void detachAllCurves() override;
void reattachAllCurves() override {}
void doRemoveFromCollection() override {}
void updateAxes() override;
void onAxisSelected( int axis, bool toggle ) override;
void updateZoomInQwt() override {}
void updateZoomFromQwt() override {}
void setAutoScaleXEnabled( bool enabled ) override {}
void setAutoScaleYEnabled( bool enabled ) override {}
void updateLegend() override{};
QString asciiDataForPlotExport() const override { return ""; }
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override { return nullptr; }
// Private methods
void cleanupBeforeClose();
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder );
void updatePlotTitle();
private:
QPointer<RiuQwtPlotWidget> m_plotWidget;
// Fields
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
caf::PdmChildField<RimSummaryAddress*> m_summaryAddress;
caf::PdmField<RifEclipseSummaryAddress> m_summaryAddressUiField;
caf::PdmField<bool> m_pushButtonSelectSummaryAddress;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<CorrelationFactorEnum> m_correlationFactor;
caf::PdmField<bool> m_showAbsoluteValues;
caf::PdmField<bool> m_sortByAbsoluteValues;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_useAutoPlotTitle;
caf::PdmField<QString> m_description;
};

View File

@@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimCorrelationPlotCollection.h"
#include "RimCorrelationPlot.h"
CAF_PDM_SOURCE_INIT( RimCorrelationPlotCollection, "CorrelationPlotCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCorrelationPlotCollection::RimCorrelationPlotCollection()
{
CAF_PDM_InitObject( "Correlation Plots", ":/AnalysisPlots16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_correlationPlots, "CorrelationPlots", "Correlation Plots", "", "", "" );
m_correlationPlots.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCorrelationPlotCollection::~RimCorrelationPlotCollection()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot()
{
RimCorrelationPlot* plot = new RimCorrelationPlot();
plot->setAsPlotMdiWindow();
// plot->enableAutoPlotTitle( true );
m_correlationPlots.push_back( plot );
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlotCollection::updateSummaryNameHasChanged()
{
for ( RimCorrelationPlot* plot : m_correlationPlots )
{
plot->loadDataAndUpdate();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlotCollection::removeSummaryPlot( RimCorrelationPlot* CorrelationPlot )
{
m_correlationPlots.removeChildObject( CorrelationPlot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimCorrelationPlot*> RimCorrelationPlotCollection::plots()
{
return m_correlationPlots.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlotCollection::deleteAllChildObjects()
{
m_correlationPlots.deleteAllChildObjects();
}

View File

@@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
class RimCorrelationPlot;
//==================================================================================================
///
///
//==================================================================================================
class RimCorrelationPlotCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimCorrelationPlotCollection();
~RimCorrelationPlotCollection() override;
RimCorrelationPlot* createCorrelationPlot();
void updateSummaryNameHasChanged();
void removeSummaryPlot( RimCorrelationPlot* CorrelationPlot );
std::vector<RimCorrelationPlot*> plots();
void deleteAllChildObjects();
private:
caf::PdmChildArrayField<RimCorrelationPlot*> m_correlationPlots;
};

View File

@@ -28,6 +28,8 @@
#include "Rim3dWellLogExtractionCurve.h"
#include "Rim3dWellLogFileCurve.h"
#include "Rim3dWellLogRftCurve.h"
#include "RimAnalysisPlot.h"
#include "RimAnalysisPlotCollection.h"
#include "RimAnnotationCollection.h"
#include "RimAnnotationGroupCollection.h"
#include "RimAnnotationInViewCollection.h"
@@ -37,6 +39,8 @@
#include "RimCellEdgeColors.h"
#include "RimCellRangeFilter.h"
#include "RimCellRangeFilterCollection.h"
#include "RimCorrelationPlot.h"
#include "RimCorrelationPlotCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseCellColors.h"
@@ -85,6 +89,8 @@
#include "RimObservedSummaryData.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimPlotDataFilterCollection.h"
#include "RimPlotDataFilterItem.h"
#include "RimPltPlotCollection.h"
#include "RimProject.h"
#include "RimRftPlotCollection.h"
@@ -148,10 +154,6 @@
#include <QString>
#include <QStringList>
#include "RimAnalysisPlot.h"
#include "RimAnalysisPlotCollection.h"
#include "RimPlotDataFilterCollection.h"
#include "RimPlotDataFilterItem.h"
#include <vector>
//--------------------------------------------------------------------------------------------------
@@ -524,6 +526,14 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicNewAnalysisPlotFeature";
menuBuilder << "RicNewPlotDataFilterFeature";
}
else if ( dynamic_cast<RimCorrelationPlotCollection*>( firstUiItem ) )
{
menuBuilder << "RicNewCorrelationPlotFeature";
}
else if ( dynamic_cast<RimCorrelationPlot*>( firstUiItem ) )
{
menuBuilder << "RicNewCorrelationPlotFeature";
}
else if ( dynamic_cast<RimPlotDataFilterCollection*>( firstUiItem ) )
{
menuBuilder << "RicNewPlotDataFilterFeature";

View File

@@ -19,6 +19,7 @@
#include "RimMainPlotCollection.h"
#include "RimCorrelationPlotCollection.h"
#include "RimFlowCharacteristicsPlot.h"
#include "RimFlowPlotCollection.h"
#include "RimGridCrossPlot.h"
@@ -38,9 +39,9 @@
#include "RimWellPltPlot.h"
#include "RimWellRftPlot.h"
#include "RimAnalysisPlotCollection.h"
#include "RiuMainWindow.h"
#include "RiuProjectPropertyView.h"
#include "RimAnalysisPlotCollection.h"
CAF_PDM_SOURCE_INIT( RimMainPlotCollection, "MainPlotCollection" );
@@ -69,6 +70,9 @@ RimMainPlotCollection::RimMainPlotCollection()
CAF_PDM_InitFieldNoDefault( &m_analysisPlotCollection, "AnalysisPlotCollection", "Analysis Plots", "", "", "" );
m_analysisPlotCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_correlationPlotCollection, "CorrelationPlotCollection", "Correlation Plots", "", "", "" );
m_correlationPlotCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_summaryCrossPlotCollection, "SummaryCrossPlotCollection", "Summary Cross Plots", "", "", "" );
m_summaryCrossPlotCollection.uiCapability()->setUiHidden( true );
@@ -99,6 +103,7 @@ RimMainPlotCollection::RimMainPlotCollection()
m_saturationPressurePlotCollection = new RimSaturationPressurePlotCollection;
m_multiPlotCollection = new RimMultiPlotCollection;
m_analysisPlotCollection = new RimAnalysisPlotCollection;
m_correlationPlotCollection = new RimCorrelationPlotCollection;
}
//--------------------------------------------------------------------------------------------------
@@ -198,13 +203,21 @@ RimMultiPlotCollection* RimMainPlotCollection::multiPlotCollection()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimAnalysisPlotCollection* RimMainPlotCollection::analysisPlotCollection()
{
return m_analysisPlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCorrelationPlotCollection* RimMainPlotCollection::correlationPlotCollection()
{
return m_correlationPlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -220,6 +233,7 @@ void RimMainPlotCollection::deleteAllContainedObjects()
m_saturationPressurePlotCollection()->deleteAllChildObjects();
m_multiPlotCollection()->deleteAllChildObjects();
m_analysisPlotCollection()->deleteAllChildObjects();
m_correlationPlotCollection()->deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -27,6 +27,7 @@
#include <QPointer>
class RimAnalysisPlotCollection;
class RimCorrelationPlotCollection;
class RimWellLogPlotCollection;
class RimRftPlotCollection;
class RimPltPlotCollection;
@@ -58,6 +59,7 @@ public:
RimSummaryPlotCollection* summaryPlotCollection();
RimSummaryCrossPlotCollection* summaryCrossPlotCollection();
RimAnalysisPlotCollection* analysisPlotCollection();
RimCorrelationPlotCollection* correlationPlotCollection();
RimFlowPlotCollection* flowPlotCollection();
RimGridCrossPlotCollection* gridCrossPlotCollection();
RimSaturationPressurePlotCollection* saturationPressurePlotCollection();
@@ -83,6 +85,7 @@ private:
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
caf::PdmChildField<RimSummaryCrossPlotCollection*> m_summaryCrossPlotCollection;
caf::PdmChildField<RimAnalysisPlotCollection*> m_analysisPlotCollection;
caf::PdmChildField<RimCorrelationPlotCollection*> m_correlationPlotCollection;
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
caf::PdmChildField<RimGridCrossPlotCollection*> m_gridCrossPlotCollection;
caf::PdmChildField<RimSaturationPressurePlotCollection*> m_saturationPressurePlotCollection;

View File

@@ -42,6 +42,7 @@
#include "RimCommandObject.h"
#include "RimCompletionTemplateCollection.h"
#include "RimContextCommandBuilder.h"
#include "RimCorrelationPlotCollection.h"
#include "RimDialogData.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
@@ -1365,6 +1366,11 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
itemCollection->add( mainPlotCollection->analysisPlotCollection() );
}
if ( mainPlotCollection->correlationPlotCollection() )
{
itemCollection->add( mainPlotCollection->correlationPlotCollection() );
}
if ( mainPlotCollection->summaryCrossPlotCollection() )
{
itemCollection->add( mainPlotCollection->summaryCrossPlotCollection() );

View File

@@ -131,6 +131,9 @@ public:
void appendColorGroup( caf::PdmUiOrdering& uiOrdering );
static void appendOptionItemsForSummaryAddresses( QList<caf::PdmOptionItemInfo>* options,
RimSummaryCaseCollection* summaryCaseGroup );
private:
void updateEnsembleCurves( const std::vector<RimSummaryCase*>& sumCases );
void updateStatisticsCurves( const std::vector<RimSummaryCase*>& sumCases );
@@ -149,9 +152,6 @@ private:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void appendOptionItemsForSummaryAddresses( QList<caf::PdmOptionItemInfo>* options,
RimSummaryCaseCollection* summaryCaseGroup );
void updateCurveColors();
void updateQwtPlotAxis();

View File

@@ -160,6 +160,24 @@ else()
endif(RESINSIGHT_ERT_EXTERNAL_LIB_ROOT OR RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT)
###############################################
# Init GIT submodules if they haven't already #
###############################################
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
set (SUBDIR "${PROJECT_SOURCE_DIR}/ThirdParty/${SUBMODULE}")
message(STATUS "Initializing GIT submodules")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()
################################################################################
# HDF5
@@ -305,6 +323,20 @@ list(APPEND THIRD_PARTY_LIBRARIES
clipper
)
################################################################################
# GNU GSL
################################################################################
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/ThirdParty/gsl/CMakeLists.txt")
message(FATAL_ERROR "The GSL submodule was not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()
add_subdirectory(ThirdParty/gsl)
list(APPEND THIRD_PARTY_LIBRARIES
gsl
)
################################################################################
# Thirdparty libraries are put in ThirdParty solution folder
################################################################################

1
ThirdParty/gsl vendored Submodule

Submodule ThirdParty/gsl added at f4564b1ffe