mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'dev' of https://github.com/OPM/ResInsight into dev
This commit is contained in:
commit
a536ac2626
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,9 +1,6 @@
|
||||
[submodule "vcpkg"]
|
||||
path = vcpkg
|
||||
url = https://github.com/microsoft/vcpkg
|
||||
[submodule "ThirdParty/gsl"]
|
||||
path = ThirdParty/gsl
|
||||
url = https://github.com/ampl/gsl/
|
||||
[submodule "ThirdParty/qwt"]
|
||||
path = ThirdParty/qwt
|
||||
url = https://github.com/CeetronSolutions/qwt.git
|
||||
|
@ -511,26 +511,10 @@ bool RiaApplication::loadProject( const QString& projectFileName,
|
||||
if ( oilField == nullptr ) continue;
|
||||
if ( oilField->wellPathCollection == nullptr )
|
||||
{
|
||||
// printf("Create well path collection for oil field %i in loadProject.\n", oilFieldIdx);
|
||||
oilField->wellPathCollection = new RimWellPathCollection();
|
||||
}
|
||||
|
||||
if ( oilField->wellPathCollection )
|
||||
{
|
||||
oilField->wellPathCollection->loadDataAndUpdate();
|
||||
oilField->wellPathCollection->readWellPathFormationFiles();
|
||||
for ( RimWellPath* wellPath : oilField->wellPathCollection->wellPaths() )
|
||||
{
|
||||
RimFractureModelCollection* fractureModelCollection = wellPath->fractureModelCollection();
|
||||
if ( fractureModelCollection )
|
||||
{
|
||||
for ( RimFractureModel* fractureModel : fractureModelCollection->allFractureModels() )
|
||||
{
|
||||
fractureModel->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
oilField->wellPathCollection->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
{
|
||||
@ -1645,15 +1629,15 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
|
||||
size_t plotCount = 0;
|
||||
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
|
||||
plotCount += spColl ? spColl->summaryPlots().size() : 0;
|
||||
plotCount += scpColl ? scpColl->summaryPlots().size() : 0;
|
||||
plotCount += spColl ? spColl->plots().size() : 0;
|
||||
plotCount += scpColl ? scpColl->plots().size() : 0;
|
||||
plotCount += flowColl ? flowColl->plotCount() : 0;
|
||||
plotCount += rftColl ? rftColl->rftPlots().size() : 0;
|
||||
plotCount += pltColl ? pltColl->pltPlots().size() : 0;
|
||||
plotCount += gcpColl ? gcpColl->gridCrossPlots().size() : 0;
|
||||
plotCount += sppColl ? sppColl->plots().size() : 0;
|
||||
plotCount += alsColl ? alsColl->plots().size() : 0;
|
||||
plotCount += corrColl ? corrColl->plots().size() + corrColl->reports().size() : 0;
|
||||
plotCount += gcpColl ? gcpColl->plotCount() : 0;
|
||||
plotCount += sppColl ? sppColl->plotCount() : 0;
|
||||
plotCount += alsColl ? alsColl->plotCount() : 0;
|
||||
plotCount += corrColl ? corrColl->plotCount() + corrColl->reports().size() : 0;
|
||||
plotCount += gpwColl ? gpwColl->multiPlots().size() : 0;
|
||||
plotCount += frmColl ? frmColl->fractureModelPlots().size() : 0;
|
||||
|
||||
@ -1671,16 +1655,16 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
|
||||
if ( spColl )
|
||||
{
|
||||
for ( size_t wlpIdx = 0; wlpIdx < spColl->summaryPlots().size(); ++wlpIdx )
|
||||
for ( auto plot : spColl->plots() )
|
||||
{
|
||||
spColl->summaryPlots[wlpIdx]->loadDataAndUpdate();
|
||||
plot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
}
|
||||
|
||||
if ( scpColl )
|
||||
{
|
||||
for ( auto plot : scpColl->summaryPlots() )
|
||||
for ( auto plot : scpColl->plots() )
|
||||
{
|
||||
plot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
@ -1714,7 +1698,7 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
|
||||
if ( gcpColl )
|
||||
{
|
||||
for ( const auto& gcpPlot : gcpColl->gridCrossPlots() )
|
||||
for ( const auto& gcpPlot : gcpColl->plots() )
|
||||
{
|
||||
gcpPlot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
|
@ -114,6 +114,16 @@ void caf::AppEnum<RiaDefines::GridCaseAxis>::setUp()
|
||||
|
||||
setDefault( RiaDefines::GridCaseAxis::AXIS_K );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RiaDefines::ThemeEnum>::setUp()
|
||||
{
|
||||
addItem( RiaDefines::ThemeEnum::DEFAULT, "DEFAULT", "Default theme" );
|
||||
addItem( RiaDefines::ThemeEnum::DARK, "DARK", "Dark theme" );
|
||||
addItem( RiaDefines::ThemeEnum::LIGHT, "LIGHT", "Light theme" );
|
||||
setDefault( RiaDefines::ThemeEnum::DEFAULT );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -215,4 +215,11 @@ enum class GridCaseAxis
|
||||
UNDEFINED_AXIS
|
||||
};
|
||||
|
||||
enum class ThemeEnum
|
||||
{
|
||||
DEFAULT,
|
||||
DARK,
|
||||
LIGHT
|
||||
};
|
||||
|
||||
}; // namespace RiaDefines
|
||||
|
@ -32,6 +32,7 @@ void AppEnum<RiaDefines::CurveProperty>::setUp()
|
||||
addItem( RiaDefines::CurveProperty::INITIAL_PRESSURE, "INITIAL_PRESSURE", "Initial Pressure" );
|
||||
addItem( RiaDefines::CurveProperty::PRESSURE, "PRESSURE", "Pressure" );
|
||||
addItem( RiaDefines::CurveProperty::STRESS, "STRESS", "Stress" );
|
||||
addItem( RiaDefines::CurveProperty::INITIAL_STRESS, "INITIAL_STRESS", "Initial Stress" );
|
||||
addItem( RiaDefines::CurveProperty::STRESS_GRADIENT, "STRESS_GRADIENT", "Stress Gradient" );
|
||||
addItem( RiaDefines::CurveProperty::YOUNGS_MODULUS, "YOUNGS_MODULUS", "Young's Modulus" );
|
||||
addItem( RiaDefines::CurveProperty::POISSONS_RATIO, "POISSONS_RATIO", "Poisson's Ratio" );
|
||||
|
@ -35,6 +35,7 @@ enum class CurveProperty
|
||||
INITIAL_PRESSURE,
|
||||
PRESSURE,
|
||||
STRESS,
|
||||
INITIAL_STRESS,
|
||||
STRESS_GRADIENT,
|
||||
YOUNGS_MODULUS,
|
||||
POISSONS_RATIO,
|
||||
|
@ -93,6 +93,7 @@
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuDockWidgetTools.h"
|
||||
#include "RiuFileDialogTools.h"
|
||||
#include "RiuGuiTheme.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMainWindowTools.h"
|
||||
#include "RiuMdiMaximizeWindowGuard.h"
|
||||
@ -417,6 +418,8 @@ void RiaGuiApplication::initialize()
|
||||
{
|
||||
RiaApplication::initialize();
|
||||
|
||||
RiuGuiTheme::updateGuiTheme( m_preferences->guiTheme() );
|
||||
|
||||
applyGuiPreferences( nullptr );
|
||||
|
||||
// Create main windows
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RifReaderSettings.h"
|
||||
#include "RiuGuiTheme.h"
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmSettings.h"
|
||||
@ -226,6 +227,12 @@ RiaPreferences::RiaPreferences( void )
|
||||
CAF_PDM_InitField( &m_enableFaultsByDefault, "enableFaultsByDefault", true, "Enable Faults By Default", "", "", "" );
|
||||
m_enableFaultsByDefault.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
CAF_PDM_InitField( &m_showInfoBox, "showInfoBox", true, "Show Info Box in New Projects", "", "", "" );
|
||||
m_showInfoBox.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
CAF_PDM_InitField( &m_showGridBox, "showGridBox", true, "Show Grid Box in New Projects", "", "", "" );
|
||||
m_showInfoBox.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &lastUsedProjectFileName, "lastUsedProjectFileName", "Last Used Project File", "", "", "" );
|
||||
lastUsedProjectFileName.uiCapability()->setUiHidden( true );
|
||||
|
||||
@ -378,6 +385,8 @@ RiaPreferences::RiaPreferences( void )
|
||||
"",
|
||||
"Defines preferred minimum distance between surface points in XY-plane",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_guiTheme, "guiTheme", "GUI theme", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -425,7 +434,8 @@ void RiaPreferences::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
field == &m_showProjectChangedDialog || field == &m_searchPlotTemplateFoldersRecursively ||
|
||||
field == &m_showLegendBackground || field == &m_showSummaryTimeAsLongString ||
|
||||
field == &m_showViewIdInProjectTree || field == &m_useMultipleThreadsWhenLoadingSummaryData ||
|
||||
field == &m_enableFaultsByDefault || field == &m_showProgressBar || field == &m_openExportedPdfInViewer )
|
||||
field == &m_enableFaultsByDefault || field == &m_showProgressBar || field == &m_openExportedPdfInViewer ||
|
||||
field == &m_showInfoBox || field == &m_showGridBox )
|
||||
{
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
@ -461,6 +471,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
colorGroup->add( &defaultGridLineColors, false );
|
||||
colorGroup->add( &defaultFaultGridLineColors );
|
||||
colorGroup->add( &defaultWellLabelColor, false );
|
||||
colorGroup->add( &m_guiTheme, {true, 2} );
|
||||
|
||||
caf::PdmUiGroup* fontGroup = uiOrdering.addNewGroup( "Default Font Sizes" );
|
||||
fontGroup->add( &defaultSceneFontSize );
|
||||
@ -472,8 +483,11 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
viewsGroup->add( &m_defaultMeshModeType );
|
||||
viewsGroup->add( &m_navigationPolicy );
|
||||
viewsGroup->add( &m_defaultScaleFactorZ );
|
||||
|
||||
viewsGroup->add( &m_showLegendBackground );
|
||||
viewsGroup->add( &m_enableFaultsByDefault );
|
||||
viewsGroup->add( &m_enableFaultsByDefault, {false, 1} );
|
||||
viewsGroup->add( &m_showInfoBox );
|
||||
viewsGroup->add( &m_showGridBox, {false, 1} );
|
||||
|
||||
caf::PdmUiGroup* otherGroup = uiOrdering.addNewGroup( "Other" );
|
||||
otherGroup->add( &ssihubAddress );
|
||||
@ -671,6 +685,11 @@ void RiaPreferences::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
m_pageTopMargin = defaultMarginSize( m_pageSize() );
|
||||
m_pageBottomMargin = defaultMarginSize( m_pageSize() );
|
||||
}
|
||||
|
||||
if ( changedField == &m_guiTheme )
|
||||
{
|
||||
RiuGuiTheme::updateGuiTheme( m_guiTheme() );
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -981,6 +1000,14 @@ bool RiaPreferences::openExportedPdfInViewer() const
|
||||
return m_openExportedPdfInViewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::ThemeEnum RiaPreferences::guiTheme() const
|
||||
{
|
||||
return m_guiTheme();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1061,6 +1088,22 @@ bool RiaPreferences::showLegendBackground() const
|
||||
return m_showLegendBackground();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaPreferences::showInfoBox() const
|
||||
{
|
||||
return m_showInfoBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaPreferences::showGridBox() const
|
||||
{
|
||||
return m_showGridBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -112,6 +112,8 @@ public:
|
||||
bool showProgressBar() const;
|
||||
bool openExportedPdfInViewer() const;
|
||||
|
||||
RiaDefines::ThemeEnum guiTheme() const;
|
||||
|
||||
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const;
|
||||
|
||||
void writePreferencesToApplicationStore();
|
||||
@ -125,6 +127,8 @@ public:
|
||||
RiaGuiApplication::RINavigationPolicy navigationPolicy() const;
|
||||
int defaultScaleFactorZ() const;
|
||||
bool showLegendBackground() const;
|
||||
bool showInfoBox() const;
|
||||
bool showGridBox() const;
|
||||
|
||||
public: // Pdm Fields
|
||||
caf::PdmField<bool> enableGrpcServer;
|
||||
@ -210,6 +214,8 @@ private:
|
||||
caf::PdmField<bool> m_showProgressBar;
|
||||
caf::PdmField<QString> m_gtestFilter;
|
||||
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::ThemeEnum>> m_guiTheme;
|
||||
|
||||
caf::PdmField<PageSizeEnum> m_pageSize;
|
||||
caf::PdmField<PageOrientationEnum> m_pageOrientation;
|
||||
caf::PdmField<double> m_pageLeftMargin;
|
||||
@ -231,6 +237,8 @@ private:
|
||||
caf::PdmField<int> m_defaultScaleFactorZ;
|
||||
caf::PdmField<bool> m_showLegendBackground;
|
||||
caf::PdmField<bool> m_enableFaultsByDefault;
|
||||
caf::PdmField<bool> m_showInfoBox;
|
||||
caf::PdmField<bool> m_showGridBox;
|
||||
|
||||
QStringList m_tabNames;
|
||||
};
|
||||
|
@ -18,6 +18,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
#include "RiuGuiTheme.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfMath.h"
|
||||
@ -25,6 +26,8 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include <QPalette>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Uses W3.org relative luminance calculation taking into account the different luminance of the different colors
|
||||
/// https://www.w3.org/TR/WCAG20-TECHS/G18.html
|
||||
@ -141,6 +144,22 @@ cvf::Color3f RiaColorTools::fromQColorTo3f( QColor color )
|
||||
return cvf::Color3f( color.redF(), color.greenF(), color.blueF() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QColor RiaColorTools::textColor()
|
||||
{
|
||||
return RiuGuiTheme::getColorByVariableName( "textColor" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RiaColorTools::textColor3f()
|
||||
{
|
||||
return fromQColorTo3f( textColor() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -42,6 +42,9 @@ public:
|
||||
static QColor toQColor( cvf::Color4f color );
|
||||
static cvf::Color3f fromQColorTo3f( QColor );
|
||||
|
||||
static QColor textColor();
|
||||
static cvf::Color3f textColor3f();
|
||||
|
||||
static cvf::Color3f
|
||||
blendCvfColors( const cvf::Color3f& color1, const cvf::Color3f& color2, int weight1 = 1, int weight2 = 1 );
|
||||
static QColor blendQColors( const QColor& color1, const QColor& color2, int weight1 = 1, int weight2 = 1 );
|
||||
|
@ -25,10 +25,6 @@
|
||||
|
||||
#include "cafAssert.h"
|
||||
|
||||
#ifdef USE_GSL
|
||||
#include "gsl/statistics/gsl_statistics_double.h"
|
||||
#endif
|
||||
|
||||
#include <QString>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -68,32 +64,6 @@ double RiaStatisticsTools::pearsonCorrelation( const std::vector<double>& xValue
|
||||
RigStatisticsMath::calculateBasicStatistics( yValues, nullptr, nullptr, nullptr, &rangeY, nullptr, nullptr );
|
||||
if ( rangeX < eps || rangeY < eps ) return 0.0;
|
||||
|
||||
#ifdef USE_GSL
|
||||
return pearsonCorrelationGSL( xValues, yValues );
|
||||
#else
|
||||
return pearsonCorrelationOwn( xValues, yValues );
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaStatisticsTools::pearsonCorrelationGSL( const std::vector<double>& xValues, const std::vector<double>& yValues )
|
||||
{
|
||||
#ifdef USE_GSL
|
||||
return gsl_stats_correlation( xValues.data(), 1, yValues.data(), 1, xValues.size() );
|
||||
#else
|
||||
CAF_ASSERT( false );
|
||||
return std::numeric_limits<double>::infinity();
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaStatisticsTools::pearsonCorrelationOwn( const std::vector<double>& xValues, const std::vector<double>& yValues )
|
||||
{
|
||||
const double eps = 1.0e-8;
|
||||
if ( xValues.size() != yValues.size() ) return 0.0;
|
||||
if ( xValues.empty() ) return 0.0;
|
||||
|
||||
@ -124,22 +94,3 @@ double RiaStatisticsTools::pearsonCorrelationOwn( const std::vector<double>& xVa
|
||||
|
||||
return sumNumerator / ( std::sqrt( sumxDiffSquared ) * std::sqrt( sumyDiffSquared ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaStatisticsTools::spearmanCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues )
|
||||
{
|
||||
const double eps = 1.0e-8;
|
||||
double rangeX = 0.0, rangeY = 0.0;
|
||||
RigStatisticsMath::calculateBasicStatistics( xValues, nullptr, nullptr, nullptr, &rangeX, nullptr, nullptr );
|
||||
RigStatisticsMath::calculateBasicStatistics( yValues, nullptr, nullptr, nullptr, &rangeY, nullptr, nullptr );
|
||||
if ( rangeX < eps || rangeY < eps ) return 0.0;
|
||||
|
||||
#ifdef USE_GSL
|
||||
std::vector<double> work( 2 * xValues.size() );
|
||||
return gsl_stats_spearman( xValues.data(), 1, yValues.data(), 1, xValues.size(), work.data() );
|
||||
#else
|
||||
return 0.0;
|
||||
#endif
|
||||
}
|
||||
|
@ -52,7 +52,4 @@ public:
|
||||
}
|
||||
|
||||
static double pearsonCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues );
|
||||
static double pearsonCorrelationGSL( const std::vector<double>& xValues, const std::vector<double>& yValues );
|
||||
static double pearsonCorrelationOwn( const std::vector<double>& xValues, const std::vector<double>& yValues );
|
||||
static double spearmanCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues );
|
||||
};
|
||||
|
@ -77,7 +77,7 @@ void RiaSummaryTools::notifyCalculatedCurveNameHasChanged( int calculationId, co
|
||||
{
|
||||
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
|
||||
|
||||
for ( RimSummaryPlot* plot : summaryPlotColl->summaryPlots() )
|
||||
for ( RimSummaryPlot* plot : summaryPlotColl->plots() )
|
||||
{
|
||||
for ( RimSummaryCurve* curve : plot->summaryCurves() )
|
||||
{
|
||||
|
@ -47,15 +47,24 @@ public:
|
||||
static std::vector<FloatType> convertDepths( const std::vector<FloatType>& depthsIn,
|
||||
RiaDefines::DepthUnitType unitsIn,
|
||||
RiaDefines::DepthUnitType unitsOut );
|
||||
static bool convertValues( const std::vector<FloatType>& tvdRKBs,
|
||||
const std::vector<FloatType>& valuesIn,
|
||||
std::vector<FloatType>* valuesOut,
|
||||
const QString& unitsIn,
|
||||
const QString& unitsOut );
|
||||
static bool convertValues( std::vector<std::pair<FloatType, FloatType>>* measuredDepthsAndValues,
|
||||
const QString& unitsIn,
|
||||
const QString& unitsOut,
|
||||
const RigWellPath* wellPath );
|
||||
|
||||
static std::vector<std::pair<FloatType, FloatType>>
|
||||
convertDepths( const std::vector<std::pair<FloatType, FloatType>>& depthsIn,
|
||||
RiaDefines::DepthUnitType unitsIn,
|
||||
RiaDefines::DepthUnitType unitsOut );
|
||||
|
||||
static FloatType
|
||||
convertDepth( FloatType depthIn, RiaDefines::DepthUnitType unitsIn, RiaDefines::DepthUnitType unitsOut );
|
||||
|
||||
static bool convertValues( const std::vector<FloatType>& tvdRKBs,
|
||||
const std::vector<FloatType>& valuesIn,
|
||||
std::vector<FloatType>* valuesOut,
|
||||
const QString& unitsIn,
|
||||
const QString& unitsOut );
|
||||
static bool convertValues( std::vector<std::pair<FloatType, FloatType>>* measuredDepthsAndValues,
|
||||
const QString& unitsIn,
|
||||
const QString& unitsOut,
|
||||
const RigWellPath* wellPath );
|
||||
|
||||
static std::vector<FloatType> tvdRKBs( const std::vector<FloatType>& measuredDepths, const RigWellPath* wellPath );
|
||||
|
||||
|
@ -140,15 +140,64 @@ std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertDepths( const std:
|
||||
{
|
||||
if ( unitsOut == RiaDefines::DepthUnitType::UNIT_METER && unitsIn == RiaDefines::DepthUnitType::UNIT_FEET )
|
||||
{
|
||||
return multiply( depthsIn, RiaEclipseUnitTools::feetPerMeter() );
|
||||
return multiply( depthsIn, RiaEclipseUnitTools::meterPerFeet() );
|
||||
}
|
||||
else if ( unitsOut == RiaDefines::DepthUnitType::UNIT_FEET && unitsIn == RiaDefines::DepthUnitType::UNIT_METER )
|
||||
{
|
||||
return multiply( depthsIn, RiaEclipseUnitTools::meterPerFeet() );
|
||||
return multiply( depthsIn, RiaEclipseUnitTools::feetPerMeter() );
|
||||
}
|
||||
return depthsIn;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename FloatType>
|
||||
FloatType RiaWellLogUnitTools<FloatType>::convertDepth( FloatType depthIn,
|
||||
RiaDefines::DepthUnitType unitsIn,
|
||||
RiaDefines::DepthUnitType unitsOut )
|
||||
{
|
||||
FloatType factor = 1.0;
|
||||
if ( unitsOut == RiaDefines::DepthUnitType::UNIT_METER && unitsIn == RiaDefines::DepthUnitType::UNIT_FEET )
|
||||
{
|
||||
factor = RiaEclipseUnitTools::meterPerFeet();
|
||||
}
|
||||
else if ( unitsOut == RiaDefines::DepthUnitType::UNIT_FEET && unitsIn == RiaDefines::DepthUnitType::UNIT_METER )
|
||||
{
|
||||
factor = RiaEclipseUnitTools::feetPerMeter();
|
||||
}
|
||||
return depthIn * factor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename FloatType>
|
||||
std::vector<std::pair<FloatType, FloatType>>
|
||||
RiaWellLogUnitTools<FloatType>::convertDepths( const std::vector<std::pair<FloatType, FloatType>>& depthsIn,
|
||||
RiaDefines::DepthUnitType unitsIn,
|
||||
RiaDefines::DepthUnitType unitsOut )
|
||||
{
|
||||
std::vector<std::pair<FloatType, FloatType>> convertedDepths( depthsIn.size() );
|
||||
double factor = 1.0;
|
||||
if ( unitsOut == RiaDefines::DepthUnitType::UNIT_METER && unitsIn == RiaDefines::DepthUnitType::UNIT_FEET )
|
||||
{
|
||||
factor = RiaEclipseUnitTools::meterPerFeet();
|
||||
}
|
||||
else if ( unitsOut == RiaDefines::DepthUnitType::UNIT_FEET && unitsIn == RiaDefines::DepthUnitType::UNIT_METER )
|
||||
{
|
||||
factor = RiaEclipseUnitTools::feetPerMeter();
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for ( auto& p : depthsIn )
|
||||
{
|
||||
convertedDepths[i++] = std::make_pair( factor * p.first, factor * p.second );
|
||||
}
|
||||
|
||||
return convertedDepths;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -37,6 +37,11 @@ CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/ApplicationCode/Adm/RiaVersionInfo.h.cmake
|
||||
${CMAKE_BINARY_DIR}/Generated/RiaVersionInfo.h
|
||||
)
|
||||
|
||||
|
||||
CONFIGURE_FILE( ${CMAKE_CURRENT_LIST_DIR}/RiuThemesDirectory.h.cmake
|
||||
${CMAKE_BINARY_DIR}/Generated/RiuThemesDirectory.h
|
||||
)
|
||||
|
||||
if (MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
|
||||
# VS 2017 : Disable warnings from from gtest code, using deprecated code related to TR1
|
||||
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
|
||||
|
@ -63,13 +63,17 @@ QString RicfSingleCaseReplace::filePath() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmScriptResponse RicfSingleCaseReplace::execute()
|
||||
{
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
if ( lastProjectPath.isNull() )
|
||||
QString projectPath = RimProject::current()->fileName();
|
||||
if ( projectPath.isEmpty() )
|
||||
{
|
||||
QString errMsg( "replaceCase: 'openProject' must be called before 'replaceCase' to specify project file to "
|
||||
"replace case in." );
|
||||
RiaLogging::error( errMsg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errMsg );
|
||||
QString lastProjectPath = RicfCommandFileExecutor::instance()->getLastProjectPath();
|
||||
if ( lastProjectPath.isNull() )
|
||||
{
|
||||
QString errMsg( "replaceCase: The project must be saved as a file before calling 'replaceCase'." );
|
||||
RiaLogging::error( errMsg );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errMsg );
|
||||
}
|
||||
projectPath = lastProjectPath;
|
||||
}
|
||||
|
||||
cvf::ref<RiaProjectModifier> projectModifier = new RiaProjectModifier;
|
||||
@ -91,7 +95,7 @@ caf::PdmScriptResponse RicfSingleCaseReplace::execute()
|
||||
projectModifier->setReplaceCase( m_caseId(), filePath );
|
||||
}
|
||||
|
||||
if ( !RiaApplication::instance()->loadProject( lastProjectPath,
|
||||
if ( !RiaApplication::instance()->loadProject( projectPath,
|
||||
RiaApplication::ProjectLoadAction::PLA_NONE,
|
||||
projectModifier.p() ) )
|
||||
{
|
||||
|
@ -90,6 +90,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureModelPlotToFileFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicStackSelectedCurvesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicUnstackSelectedCurvesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicThemeColorEditorFeature.h
|
||||
)
|
||||
|
||||
|
||||
@ -184,6 +185,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureModelPlotToFileFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicStackSelectedCurvesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicUnstackSelectedCurvesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicThemeColorEditorFeature.cpp
|
||||
)
|
||||
|
||||
|
||||
|
@ -132,8 +132,18 @@ RimFractureModelPlot*
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Creating stress track", 2 );
|
||||
createStressTrack( plot, fractureModel, eclipseCase, timeStep, RiaDefines::CurveProperty::STRESS );
|
||||
createStressTrack( plot, fractureModel, eclipseCase, timeStep, RiaDefines::CurveProperty::STRESS_GRADIENT );
|
||||
createStressTrack( plot,
|
||||
fractureModel,
|
||||
eclipseCase,
|
||||
timeStep,
|
||||
"Stress",
|
||||
{RiaDefines::CurveProperty::STRESS, RiaDefines::CurveProperty::INITIAL_STRESS} );
|
||||
createStressTrack( plot,
|
||||
fractureModel,
|
||||
eclipseCase,
|
||||
timeStep,
|
||||
"Stress Gradient",
|
||||
{RiaDefines::CurveProperty::STRESS_GRADIENT} );
|
||||
}
|
||||
|
||||
{
|
||||
@ -160,7 +170,7 @@ RimFractureModelPlot*
|
||||
|
||||
{
|
||||
auto task = progInfo.task( "Creating temperature track", 2 );
|
||||
createStressTrack( plot, fractureModel, eclipseCase, timeStep, RiaDefines::CurveProperty::TEMPERATURE );
|
||||
createStressTrack( plot, fractureModel, eclipseCase, timeStep, "Temperature", {RiaDefines::CurveProperty::TEMPERATURE} );
|
||||
}
|
||||
|
||||
{
|
||||
@ -470,13 +480,13 @@ void RicNewFractureModelPlotFeature::createElasticPropertiesTrack( RimFractureMo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewFractureModelPlotFeature::createStressTrack( RimFractureModelPlot* plot,
|
||||
RimFractureModel* fractureModel,
|
||||
RimEclipseCase* eclipseCase,
|
||||
int timeStep,
|
||||
RiaDefines::CurveProperty propertyType )
|
||||
void RicNewFractureModelPlotFeature::createStressTrack( RimFractureModelPlot* plot,
|
||||
RimFractureModel* fractureModel,
|
||||
RimEclipseCase* eclipseCase,
|
||||
int timeStep,
|
||||
const QString& trackName,
|
||||
const std::vector<RiaDefines::CurveProperty>& propertyTypes )
|
||||
{
|
||||
QString trackName = caf::AppEnum<RiaDefines::CurveProperty>::uiText( propertyType );
|
||||
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, trackName, plot );
|
||||
plotTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR );
|
||||
plotTrack->setLogarithmicScale( false );
|
||||
@ -484,34 +494,40 @@ void RicNewFractureModelPlotFeature::createStressTrack( RimFractureModelPlot*
|
||||
plotTrack->setShowWindow( true );
|
||||
plotTrack->setColSpan( RimPlot::TWO );
|
||||
|
||||
caf::ColorTable colors = RiaColorTables::wellLogPlotPaletteColors();
|
||||
caf::ColorTable colors = RiaColorTables::wellLogPlotPaletteColors();
|
||||
int colorIndex = 0;
|
||||
|
||||
RimFractureModelStressCurve* curve = new RimFractureModelStressCurve;
|
||||
curve->setCurveProperty( propertyType );
|
||||
curve->setFractureModel( fractureModel );
|
||||
curve->setCase( eclipseCase );
|
||||
curve->setColor( colors.cycledColor3f( 0 ) );
|
||||
curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
|
||||
curve->setLineThickness( 2 );
|
||||
curve->setUiName( trackName );
|
||||
curve->setAutoNameComponents( false, false, false, false, false );
|
||||
if ( propertyType == RiaDefines::CurveProperty::STRESS_GRADIENT )
|
||||
for ( const RiaDefines::CurveProperty& propertyType : propertyTypes )
|
||||
{
|
||||
curve->setInterpolation( RiuQwtPlotCurve::INTERPOLATION_STEP_LEFT );
|
||||
RimFractureModelStressCurve* curve = new RimFractureModelStressCurve;
|
||||
curve->setCurveProperty( propertyType );
|
||||
curve->setFractureModel( fractureModel );
|
||||
curve->setCase( eclipseCase );
|
||||
curve->setColor( colors.cycledColor3f( colorIndex ) );
|
||||
curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
|
||||
curve->setLineThickness( 2 );
|
||||
curve->setUiName( trackName );
|
||||
curve->setAutoNameComponents( false, false, false, false, false );
|
||||
if ( propertyType == RiaDefines::CurveProperty::STRESS_GRADIENT )
|
||||
{
|
||||
curve->setInterpolation( RiuQwtPlotCurve::INTERPOLATION_STEP_LEFT );
|
||||
}
|
||||
|
||||
plotTrack->addCurve( curve );
|
||||
plotTrack->setAutoScaleXEnabled( true );
|
||||
curve->loadDataAndUpdate( true );
|
||||
|
||||
curve->updateConnectedEditors();
|
||||
|
||||
colorIndex++;
|
||||
}
|
||||
|
||||
plotTrack->addCurve( curve );
|
||||
plotTrack->setAutoScaleXEnabled( true );
|
||||
curve->loadDataAndUpdate( true );
|
||||
|
||||
curve->updateConnectedEditors();
|
||||
plotTrack->updateConnectedEditors();
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
RiaApplication::instance()->project()->updateConnectedEditors();
|
||||
|
||||
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( curve );
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
}
|
||||
|
||||
|
@ -72,11 +72,12 @@ private:
|
||||
int timeStep,
|
||||
RiaDefines::CurveProperty propertyType );
|
||||
|
||||
static void createStressTrack( RimFractureModelPlot* plot,
|
||||
RimFractureModel* fractureModel,
|
||||
RimEclipseCase* eclipseCase,
|
||||
int timeStep,
|
||||
RiaDefines::CurveProperty propertyType );
|
||||
static void createStressTrack( RimFractureModelPlot* plot,
|
||||
RimFractureModel* fractureModel,
|
||||
RimEclipseCase* eclipseCase,
|
||||
int timeStep,
|
||||
const QString& trackName,
|
||||
const std::vector<RiaDefines::CurveProperty>& propertyTypes );
|
||||
|
||||
static RimFractureModelPlot* createFractureModelPlot( bool showAfterCreation, const QString& plotDescription );
|
||||
|
||||
|
@ -93,7 +93,7 @@ void RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection(
|
||||
|
||||
RimSummaryPlotCollection* plotColl = RimProject::current()->mainPlotCollection()->summaryPlotCollection();
|
||||
|
||||
plotColl->summaryPlots.push_back( summaryPlot );
|
||||
plotColl->addPlot( summaryPlot );
|
||||
summaryPlot->resolveReferencesRecursively();
|
||||
summaryPlot->initAfterReadRecursively();
|
||||
|
||||
|
@ -56,7 +56,7 @@ void RicCloseObservedDataFeature::deleteObservedSummaryData( const std::vector<R
|
||||
|
||||
for ( RimObservedSummaryData* observedData : data )
|
||||
{
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
summaryPlot->deleteCurvesAssosiatedWithCase( observedData );
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector<RimSummaryCase*
|
||||
|
||||
for ( RimSummaryCase* summaryCase : cases )
|
||||
{
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
summaryPlot->deleteCurvesAssosiatedWithCase( summaryCase );
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ void RicDeleteSubItemsFeature::onActionTriggered( bool isChecked )
|
||||
auto collection = dynamic_cast<RimSummaryPlotCollection*>( item );
|
||||
if ( collection )
|
||||
{
|
||||
collection->summaryPlots.deleteAllChildObjects();
|
||||
collection->deleteAllPlots();
|
||||
|
||||
collection->updateConnectedEditors();
|
||||
}
|
||||
@ -116,7 +116,7 @@ bool RicDeleteSubItemsFeature::hasDeletableSubItems( caf::PdmUiItem* uiItem )
|
||||
{
|
||||
{
|
||||
auto collection = dynamic_cast<RimSummaryPlotCollection*>( uiItem );
|
||||
if ( collection && !collection->summaryPlots().empty() )
|
||||
if ( collection && !collection->plots().empty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ void RicDeleteSummaryCaseCollectionFeature::deleteSummaryCaseCollection( RimSumm
|
||||
|
||||
for ( RimSummaryCase* summaryCase : caseCollection->allSummaryCases() )
|
||||
{
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
summaryPlot->deleteCurvesAssosiatedWithCase( summaryCase );
|
||||
}
|
||||
|
@ -18,10 +18,14 @@
|
||||
|
||||
#include "RicNewContourMapViewFeature.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseContourMapProjection.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimEclipseContourMapViewCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
@ -49,6 +53,9 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewContourMapViewFeature, "RicNewContourMapViewFeature" );
|
||||
|
||||
const size_t mediumSamplingThresholdCellCount = 500000u;
|
||||
const size_t largeSamplingThresholdCellCount = 5000000u;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -202,6 +209,18 @@ RimEclipseContourMapView* RicNewContourMapViewFeature::createEclipseContourMapFr
|
||||
caf::PdmDefaultObjectFactory::instance() ) );
|
||||
CVF_ASSERT( contourMap );
|
||||
|
||||
const RigActiveCellInfo* activeCellInfo =
|
||||
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
size_t activeCellCount = activeCellInfo->reservoirActiveCellCount();
|
||||
if ( activeCellCount >= largeSamplingThresholdCellCount )
|
||||
{
|
||||
contourMap->contourMapProjection()->setSampleSpacingFactor( 1.5 );
|
||||
}
|
||||
else if ( activeCellCount >= mediumSamplingThresholdCellCount )
|
||||
{
|
||||
contourMap->contourMapProjection()->setSampleSpacingFactor( 1.2 );
|
||||
}
|
||||
|
||||
contourMap->setEclipseCase( eclipseCase );
|
||||
contourMap->setBackgroundColor( cvf::Color3f( 1.0f, 1.0f, 0.98f ) ); // Ignore original view background
|
||||
contourMap->setDefaultCustomName();
|
||||
@ -248,6 +267,22 @@ RimEclipseContourMapView* RicNewContourMapViewFeature::createEclipseContourMap(
|
||||
|
||||
size_t i = eclipseCase->contourMapCollection()->views().size();
|
||||
contourMap->setName( QString( "Contour Map %1" ).arg( i + 1 ) );
|
||||
|
||||
const RigActiveCellInfo* activeCellInfo =
|
||||
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
size_t activeCellCount = activeCellInfo->reservoirActiveCellCount();
|
||||
if ( activeCellCount >= largeSamplingThresholdCellCount )
|
||||
{
|
||||
contourMap->contourMapProjection()->setSampleSpacingFactor( 1.5 );
|
||||
}
|
||||
else if ( activeCellCount >= mediumSamplingThresholdCellCount )
|
||||
{
|
||||
contourMap->contourMapProjection()->setSampleSpacingFactor( 1.2 );
|
||||
}
|
||||
|
||||
contourMap->faultCollection()->showFaultCollection = false;
|
||||
contourMap->wellCollection()->isActive = false;
|
||||
|
||||
eclipseCase->contourMapCollection()->push_back( contourMap );
|
||||
|
||||
contourMap->hasUserRequestedAnimation = true;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSaturationPressurePlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include <QAction>
|
||||
@ -149,7 +150,11 @@ std::vector<RimPlot*> RicNewMultiPlotFeature::selectedPlots()
|
||||
for ( caf::PdmUiItem* uiItem : uiItems )
|
||||
{
|
||||
RimPlot* plotInterface = dynamic_cast<RimPlot*>( uiItem );
|
||||
if ( plotInterface )
|
||||
// Special case for all well log tracks which currently need to be in Well Log Plot for
|
||||
// depth information and cannot be moved into multiplots.
|
||||
// TODO: copy depth information into well log tracks to allow their use separately.
|
||||
RimWellLogTrack* wellLogTrack = dynamic_cast<RimWellLogTrack*>( plotInterface );
|
||||
if ( plotInterface && !wellLogTrack )
|
||||
{
|
||||
plots.push_back( plotInterface );
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void RicReloadSummaryCaseFeature::onActionTriggered( bool isChecked )
|
||||
RiaLogging::info( QString( "Reloaded data for %1" ).arg( summaryCase->summaryHeaderFilename() ) );
|
||||
}
|
||||
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ void RicReplaceCaseFeature::onActionTriggered( bool isChecked )
|
||||
gridSummaryCase->createRftReaderInterface();
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
// Update summary curves on calculated data
|
||||
std::vector<RimSummaryCurve*> summaryCurves = summaryPlot->summaryCurves();
|
||||
@ -118,7 +118,7 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
|
||||
RimSummaryCrossPlotCollection* summaryCrossPlotColl = RiaSummaryTools::summaryCrossPlotCollection();
|
||||
for ( RimSummaryPlot* summaryPlot : summaryCrossPlotColl->summaryPlots() )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryCrossPlotColl->plots() )
|
||||
{
|
||||
// Update summary curves on calculated data
|
||||
std::vector<RimSummaryCurve*> summaryCurves = summaryPlot->summaryCurves();
|
||||
|
181
ApplicationCode/Commands/RicThemeColorEditorFeature.cpp
Normal file
181
ApplicationCode/Commands/RicThemeColorEditorFeature.cpp
Normal file
@ -0,0 +1,181 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicThemeColorEditorFeature.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RiuGuiTheme.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuQssSyntaxHighlighter.h"
|
||||
#include "RiuTextEditWithCompletion.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QColorDialog>
|
||||
#include <QComboBox>
|
||||
#include <QCompleter>
|
||||
#include <QGridLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QStringListModel>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicThemeColorEditorFeature, "RicThemeColorEditorFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicThemeColorEditorFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicThemeColorEditorFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiaDefines::ThemeEnum theme = RiaGuiApplication::instance()->preferences()->guiTheme();
|
||||
|
||||
QDialog* dialog = new QDialog( RiuMainWindow::instance() );
|
||||
connect( dialog, &QDialog::close, [this, theme]() { RiuGuiTheme::updateGuiTheme( theme ); } );
|
||||
dialog->setModal( false );
|
||||
dialog->setWindowTitle( "Theme Color Editor Dialog" );
|
||||
|
||||
QGridLayout* layout = new QGridLayout();
|
||||
|
||||
layout->addWidget( new QLabel( "GUI theme" ), 0, 0 );
|
||||
|
||||
QComboBox* themeSelector = new QComboBox();
|
||||
caf::AppEnum<RiaDefines::ThemeEnum> themes;
|
||||
for ( size_t index = 0; index < themes.size(); index++ )
|
||||
{
|
||||
themeSelector->addItem( themes.uiTextFromIndex( index ), QVariant::fromValue( index ) );
|
||||
if ( static_cast<RiaDefines::ThemeEnum>( index ) == theme )
|
||||
{
|
||||
themeSelector->setCurrentIndex( static_cast<int>( index ) );
|
||||
}
|
||||
}
|
||||
layout->addWidget( themeSelector, 0, 1 );
|
||||
|
||||
QFrame* line = new QFrame();
|
||||
line->setFrameShape( QFrame::HLine );
|
||||
layout->addWidget( line, 1, 0, 1, 2 );
|
||||
QWidget* widget = new QWidget();
|
||||
layout->addWidget( widget, 2, 0, 1, 2 );
|
||||
|
||||
TextEditWithCompletion* editor = new TextEditWithCompletion();
|
||||
editor->setAcceptRichText( false );
|
||||
QCompleter* completer = new QCompleter( RiuMainWindow::instance() );
|
||||
completer->setModel( RiuGuiTheme::getQssCompletionModel( completer ) );
|
||||
completer->setModelSorting( QCompleter::CaseInsensitivelySortedModel );
|
||||
completer->setCaseSensitivity( Qt::CaseInsensitive );
|
||||
completer->setWrapAround( false );
|
||||
editor->setCompleter( completer );
|
||||
QssSyntaxHighligter* highlighter = new QssSyntaxHighligter( editor->document() );
|
||||
|
||||
auto generateColorFields = [themeSelector, widget, editor, completer, this]() -> void {
|
||||
QLayoutItem* item;
|
||||
if ( widget->layout() )
|
||||
{
|
||||
while ( ( item = widget->layout()->takeAt( 0 ) ) != NULL )
|
||||
{
|
||||
delete item->widget();
|
||||
delete item;
|
||||
}
|
||||
delete widget->layout();
|
||||
}
|
||||
QGridLayout* innerLayout = new QGridLayout();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
RiaDefines::ThemeEnum theme = static_cast<RiaDefines::ThemeEnum>( themeSelector->currentData().toInt() );
|
||||
QMap<QString, QString> variableValueMap = RiuGuiTheme::getVariableValueMap( theme );
|
||||
QMap<QString, QString> variableGuiTextMap = RiuGuiTheme::getVariableGuiTextMap( theme );
|
||||
for ( const QString variableName : variableValueMap.keys() )
|
||||
{
|
||||
innerLayout->addWidget( new QLabel( !variableGuiTextMap[variableName].isEmpty() ? variableGuiTextMap[variableName]
|
||||
: variableName ),
|
||||
row,
|
||||
column );
|
||||
QPushButton* colorBox = new QPushButton( "" );
|
||||
colorBox->setStyleSheet( QString( "background-color: %0;" ).arg( variableValueMap.value( variableName ) ) );
|
||||
connect( colorBox,
|
||||
&QPushButton::clicked,
|
||||
[this, variableValueMap, variableName, theme, editor, widget, colorBox]() -> void {
|
||||
QColor color = QColorDialog::getColor( colorBox->palette().color( QPalette::Button ), widget );
|
||||
if ( color.isValid() )
|
||||
{
|
||||
colorBox->setStyleSheet( QString( "background-color: %0;" ).arg( color.name() ) );
|
||||
colorBox->style()->unpolish( colorBox );
|
||||
colorBox->style()->polish( colorBox );
|
||||
RiuGuiTheme::changeVariableValue( theme, variableName, color.name() );
|
||||
editor->setPlainText( RiuGuiTheme::applyVariableValueMapToStyleSheet( theme ) );
|
||||
}
|
||||
} );
|
||||
innerLayout->addWidget( colorBox, row++, column + 1 );
|
||||
if ( row == 10 )
|
||||
{
|
||||
row = 0;
|
||||
column += 2;
|
||||
}
|
||||
}
|
||||
widget->setLayout( innerLayout );
|
||||
};
|
||||
|
||||
// A more elegant way, but not supported in old Qt version.
|
||||
// connect( themeSelector, qOverload<int>( &QComboBox::currentIndexChanged ), [=]() {
|
||||
connect( themeSelector, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), [=]() {
|
||||
generateColorFields();
|
||||
RiaDefines::ThemeEnum theme = static_cast<RiaDefines::ThemeEnum>( themeSelector->currentData().toInt() );
|
||||
RiuGuiTheme::updateGuiTheme( static_cast<RiaDefines::ThemeEnum>( theme ) );
|
||||
editor->setPlainText( RiuGuiTheme::loadStyleSheet( theme ) );
|
||||
} );
|
||||
|
||||
generateColorFields();
|
||||
|
||||
RiuGuiTheme::updateGuiTheme( theme );
|
||||
editor->setPlainText( RiuGuiTheme::loadStyleSheet( theme ) );
|
||||
|
||||
line = new QFrame();
|
||||
line->setFrameShape( QFrame::HLine );
|
||||
layout->addWidget( line, 3, 0, 1, 2 );
|
||||
layout->addWidget( editor, 5, 0, 1, 2 );
|
||||
|
||||
QPushButton* button = new QPushButton( "Apply style sheet changes" );
|
||||
layout->addWidget( button, 6, 1 );
|
||||
connect( button, &QPushButton::clicked, [this, themeSelector, editor, generateColorFields]() {
|
||||
RiaDefines::ThemeEnum theme = static_cast<RiaDefines::ThemeEnum>( themeSelector->currentData().toInt() );
|
||||
RiuGuiTheme::writeStyleSheetToFile( theme, editor->toPlainText() );
|
||||
generateColorFields();
|
||||
} );
|
||||
|
||||
dialog->setLayout( layout );
|
||||
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicThemeColorEditorFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Open Theme Color Editor" );
|
||||
}
|
35
ApplicationCode/Commands/RicThemeColorEditorFeature.h
Normal file
35
ApplicationCode/Commands/RicThemeColorEditorFeature.h
Normal 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 RicThemeColorEditorFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -103,9 +103,9 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
||||
defaultSelectedPlot = dynamic_cast<RimSummaryPlot*>( app->activePlotWindow() );
|
||||
}
|
||||
|
||||
if ( !defaultSelectedPlot && summaryPlotColl->summaryPlots().size() > 0 )
|
||||
if ( !defaultSelectedPlot && !summaryPlotColl->plots().empty() )
|
||||
{
|
||||
defaultSelectedPlot = summaryPlotColl->summaryPlots()[0];
|
||||
defaultSelectedPlot = summaryPlotColl->plots().front();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ void RicNewSummaryCrossPlotFeature::onActionTriggered( bool isChecked )
|
||||
RimSummaryCrossPlotCollection* summaryCrossPlotColl = project->mainPlotCollection()->summaryCrossPlotCollection();
|
||||
RimSummaryPlot* summaryPlot = summaryCrossPlotColl->createSummaryPlot();
|
||||
|
||||
summaryCrossPlotColl->addSummaryPlot( summaryPlot );
|
||||
summaryCrossPlotColl->addPlot( summaryPlot );
|
||||
if ( summaryPlot )
|
||||
{
|
||||
summaryCrossPlotColl->updateConnectedEditors();
|
||||
|
@ -257,7 +257,7 @@ RicPasteAsciiDataToSummaryPlotFeature::CurveType
|
||||
RimSummaryPlot*
|
||||
RicPasteAsciiDataToSummaryPlotFeature::createSummaryPlotAndAddToPlotCollection( RimSummaryPlotCollection* plotCollection )
|
||||
{
|
||||
QString name = QString( "Summary Plot %1" ).arg( plotCollection->summaryPlots.size() + 1 );
|
||||
QString name = QString( "Summary Plot %1" ).arg( plotCollection->plots().size() + 1 );
|
||||
|
||||
return plotCollection->createNamedSummaryPlot( name );
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void RicPasteSummaryCrossPlotFeature::copyPlotAndAddToCollection( RimSummaryCros
|
||||
sourcePlot->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
CVF_ASSERT( newSummaryPlot );
|
||||
|
||||
plotColl->addSummaryPlot( newSummaryPlot );
|
||||
plotColl->addPlot( newSummaryPlot );
|
||||
|
||||
// Resolve references after object has been inserted into the data model
|
||||
newSummaryPlot->resolveReferencesRecursively();
|
||||
|
@ -47,7 +47,7 @@ void RicPasteSummaryPlotFeature::copyPlotAndAddToCollection( RimSummaryPlot* sou
|
||||
sourcePlot->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
CVF_ASSERT( newSummaryPlot );
|
||||
|
||||
plotColl->summaryPlots.push_back( newSummaryPlot );
|
||||
plotColl->addPlot( newSummaryPlot );
|
||||
|
||||
// Resolve references after object has been inserted into the data model
|
||||
newSummaryPlot->resolveReferencesRecursively();
|
||||
|
@ -104,7 +104,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSelectSummaryPlotUI::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
if ( RiaSummaryTools::summaryPlotCollection()->summaryPlots().size() == 0 )
|
||||
if ( RiaSummaryTools::summaryPlotCollection()->plots().empty() )
|
||||
{
|
||||
m_createNewPlot = true;
|
||||
}
|
||||
|
@ -455,11 +455,16 @@ void RicSummaryPlotEditorUi::updatePreviewCurvesFromCurveDefinitions(
|
||||
|
||||
size_t ensembleCurveCnt = ensembleCurveCount( allCurveDefsToDisplay );
|
||||
|
||||
// Disable legends when adding curves
|
||||
m_previewPlot->setLegendsVisible( false );
|
||||
|
||||
// Add new curves
|
||||
for ( const auto& curveDef : curveDefsToAdd )
|
||||
{
|
||||
RimSummaryCase* currentCase = curveDef.summaryCase();
|
||||
RimSummaryCurve* curve = new RimSummaryCurve();
|
||||
curve->setErrorBarsVisible( false );
|
||||
curve->showLegend( false );
|
||||
curve->setSummaryCaseY( currentCase );
|
||||
curve->setSummaryAddressYAndApplyInterpolation( curveDef.summaryAddress() );
|
||||
curve->applyCurveAutoNameSettings( *m_curveNameConfig() );
|
||||
@ -522,6 +527,8 @@ void RicSummaryPlotEditorUi::updatePreviewCurvesFromCurveDefinitions(
|
||||
}
|
||||
}
|
||||
|
||||
// Enable legends if there is not too many curves
|
||||
m_previewPlot->setLegendsVisible( !warningDisplayed );
|
||||
m_previewPlot->loadDataAndUpdate();
|
||||
m_previewPlot->zoomAll();
|
||||
m_previewPlot->updateConnectedEditors();
|
||||
@ -900,7 +907,7 @@ void RicSummaryPlotEditorUi::selectionEditorFieldChanged()
|
||||
void RicSummaryPlotEditorUi::proxyEnablePlotAutoTitle( const bool& enable )
|
||||
{
|
||||
m_previewPlot->enableAutoPlotTitle( enable );
|
||||
m_previewPlot->setShowPlotTitle( enable );
|
||||
m_previewPlot->setPlotTitleVisible( enable );
|
||||
m_previewPlot->updateCurveNames();
|
||||
m_previewPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void RicSummaryPlotFeatureImpl::ensureAtLeastOnePlot( RimSummaryPlotCollection*
|
||||
{
|
||||
if ( summaryPlotCollection && summaryCase )
|
||||
{
|
||||
if ( summaryPlotCollection->summaryPlots.empty() )
|
||||
if ( summaryPlotCollection->plots().empty() )
|
||||
{
|
||||
auto objectToSelect = createDefaultSummaryPlot( summaryCase );
|
||||
if ( objectToSelect )
|
||||
|
@ -8,13 +8,13 @@ set ( SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcServiceInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCaseService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcSimulationWellService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcGridService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcGridService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcProjectService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCommandService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcAppService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcPropertiesService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcNNCPropertiesService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcPdmObjectService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcPropertiesService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcNNCPropertiesService.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcPdmObjectService.h
|
||||
)
|
||||
|
||||
set ( SOURCE_GROUP_SOURCE_FILES
|
||||
@ -23,13 +23,13 @@ set ( SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcServiceInterface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCaseService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcSimulationWellService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcGridService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcGridService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcProjectService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcCommandService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcAppService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcPropertiesService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcNNCPropertiesService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcPdmObjectService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcPropertiesService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcNNCPropertiesService.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcPdmObjectService.cpp
|
||||
)
|
||||
|
||||
add_definitions(-DENABLE_GRPC)
|
||||
@ -41,10 +41,10 @@ if (MSVC)
|
||||
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
|
||||
set(protobuf_MODULE_COMPATIBLE ON)
|
||||
find_package(Protobuf CONFIG 3.0 QUIET)
|
||||
if (Protobuf_FOUND)
|
||||
message(STATUS "Using protobuf ${protobuf_VERSION}")
|
||||
else()
|
||||
message(FATAL_ERROR "Protocol Buffers not found. This is required to build with gRPC")
|
||||
if (Protobuf_FOUND)
|
||||
message(STATUS "Using protobuf ${protobuf_VERSION}")
|
||||
else()
|
||||
message(FATAL_ERROR "Protocol Buffers not found. This is required to build with gRPC")
|
||||
endif()
|
||||
|
||||
# Find gRPC installation
|
||||
@ -65,29 +65,29 @@ if (MSVC)
|
||||
)
|
||||
|
||||
else()
|
||||
find_package(gRPC CONFIG)
|
||||
if(gRPC_FOUND)
|
||||
message(STATUS "Found GRPC using find_package(gRPC CONFIG) ")
|
||||
message(STATUS "Using gRPC ${gRPC_VERSION}")
|
||||
set(GRPC_PACKAGE_LIBRARIES gRPC::gpr gRPC::grpc_unsecure gRPC::grpc++_unsecure)
|
||||
find_package(gRPC CONFIG)
|
||||
if(gRPC_FOUND)
|
||||
message(STATUS "Found GRPC using find_package(gRPC CONFIG) ")
|
||||
message(STATUS "Using gRPC ${gRPC_VERSION}")
|
||||
set(GRPC_PACKAGE_LIBRARIES gRPC::gpr gRPC::grpc_unsecure gRPC::grpc++_unsecure)
|
||||
|
||||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
|
||||
message(STATUS "_PROTOBUF_PROTOC : ${_PROTOBUF_PROTOC}")
|
||||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
|
||||
message(STATUS "_PROTOBUF_PROTOC : ${_PROTOBUF_PROTOC}")
|
||||
|
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
|
||||
message(STATUS "_GRPC_CPP_PLUGIN_EXECUTABLE : ${_GRPC_CPP_PLUGIN_EXECUTABLE}")
|
||||
else()
|
||||
set(RESINSIGHT_GRPC_INSTALL_PREFIX "" CACHE PATH "gRPC : Install prefix for gRPC")
|
||||
if (NOT DEFINED RESINSIGHT_GRPC_INSTALL_PREFIX OR NOT EXISTS ${RESINSIGHT_GRPC_INSTALL_PREFIX})
|
||||
message(FATAL_ERROR "You need a valid RESINSIGHT_GRPC_INSTALL_PREFIX set to build with gRPC")
|
||||
endif()
|
||||
set(ENV{PKG_CONFIG_PATH} "${RESINSIGHT_GRPC_INSTALL_PREFIX}/lib/pkgconfig")
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GRPC REQUIRED grpc++_unsecure>=1.20 grpc_unsecure gpr protobuf)
|
||||
set(_PROTOBUF_PROTOC "${RESINSIGHT_GRPC_INSTALL_PREFIX}/bin/protoc")
|
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE "${RESINSIGHT_GRPC_INSTALL_PREFIX}/bin/grpc_cpp_plugin")
|
||||
include_directories(AFTER ${GRPC_INCLUDE_DIRS})
|
||||
endif()
|
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
|
||||
message(STATUS "_GRPC_CPP_PLUGIN_EXECUTABLE : ${_GRPC_CPP_PLUGIN_EXECUTABLE}")
|
||||
else()
|
||||
set(RESINSIGHT_GRPC_INSTALL_PREFIX "" CACHE PATH "gRPC : Install prefix for gRPC")
|
||||
if (NOT DEFINED RESINSIGHT_GRPC_INSTALL_PREFIX OR NOT EXISTS ${RESINSIGHT_GRPC_INSTALL_PREFIX})
|
||||
message(FATAL_ERROR "You need a valid RESINSIGHT_GRPC_INSTALL_PREFIX set to build with gRPC")
|
||||
endif()
|
||||
set(ENV{PKG_CONFIG_PATH} "${RESINSIGHT_GRPC_INSTALL_PREFIX}/lib/pkgconfig")
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GRPC REQUIRED grpc++_unsecure>=1.20 grpc_unsecure gpr protobuf)
|
||||
set(_PROTOBUF_PROTOC "${RESINSIGHT_GRPC_INSTALL_PREFIX}/bin/protoc")
|
||||
set(_GRPC_CPP_PLUGIN_EXECUTABLE "${RESINSIGHT_GRPC_INSTALL_PREFIX}/bin/grpc_cpp_plugin")
|
||||
include_directories(AFTER ${GRPC_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Cannot use the nice new FindPackage modules for python since that is CMake 3.12+
|
||||
@ -98,15 +98,15 @@ endif(RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
|
||||
# Proto files
|
||||
set(PROTO_FILES
|
||||
"Definitions"
|
||||
"PdmObject"
|
||||
"PdmObject"
|
||||
"Case"
|
||||
"SimulationWell"
|
||||
"Project"
|
||||
"Commands"
|
||||
"NNCProperties"
|
||||
"App"
|
||||
"Properties"
|
||||
"Grid"
|
||||
"Properties"
|
||||
"Grid"
|
||||
)
|
||||
|
||||
set(GRPC_PYTHON_SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}/Python")
|
||||
@ -115,7 +115,7 @@ foreach(proto_file ${PROTO_FILES})
|
||||
get_filename_component(rips_proto "${CMAKE_CURRENT_LIST_DIR}/GrpcProtos/${proto_file}.proto" ABSOLUTE)
|
||||
get_filename_component(rips_proto_path "${rips_proto}" PATH)
|
||||
|
||||
list(APPEND GRPC_PROTO_FILES_FULL_PATH ${rips_proto})
|
||||
list(APPEND GRPC_PROTO_FILES_FULL_PATH ${rips_proto})
|
||||
|
||||
set(rips_proto_srcs "${CMAKE_BINARY_DIR}/Generated/${proto_file}.pb.cc")
|
||||
set(rips_proto_hdrs "${CMAKE_BINARY_DIR}/Generated/${proto_file}.pb.h")
|
||||
@ -134,28 +134,28 @@ foreach(proto_file ${PROTO_FILES})
|
||||
)
|
||||
|
||||
if (RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
|
||||
set(rips_proto_python "rips/generated/${proto_file}_pb2.py")
|
||||
set(rips_grpc_python "rips/generated/${proto_file}_pb2_grpc.py")
|
||||
set(rips_proto_python "rips/generated/${proto_file}_pb2.py")
|
||||
set(rips_grpc_python "rips/generated/${proto_file}_pb2_grpc.py")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${GRPC_PYTHON_SOURCE_PATH}/${rips_proto_python}" "${GRPC_PYTHON_SOURCE_PATH}/${rips_grpc_python}"
|
||||
COMMAND ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE}
|
||||
ARGS -m grpc_tools.protoc
|
||||
-I "${rips_proto_path}"
|
||||
--python_out "${GRPC_PYTHON_SOURCE_PATH}/rips/generated"
|
||||
--grpc_python_out "${GRPC_PYTHON_SOURCE_PATH}/rips/generated"
|
||||
"${rips_proto}"
|
||||
DEPENDS "${rips_proto}"
|
||||
COMMENT "Generating ${rips_proto_python} and ${rips_grpc_python}"
|
||||
VERBATIM
|
||||
)
|
||||
list (APPEND GRPC_PYTHON_GENERATED_SOURCES
|
||||
${rips_proto_python}
|
||||
${rips_grpc_python}
|
||||
)
|
||||
else()
|
||||
message(STATUS "RESINSIGHT_GRPC_PYTHON_EXECUTABLE not specified. Will not generate GRPC Python code.")
|
||||
endif(RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
|
||||
add_custom_command(
|
||||
OUTPUT "${GRPC_PYTHON_SOURCE_PATH}/${rips_proto_python}" "${GRPC_PYTHON_SOURCE_PATH}/${rips_grpc_python}"
|
||||
COMMAND ${RESINSIGHT_GRPC_PYTHON_EXECUTABLE}
|
||||
ARGS -m grpc_tools.protoc
|
||||
-I "${rips_proto_path}"
|
||||
--python_out "${GRPC_PYTHON_SOURCE_PATH}/rips/generated"
|
||||
--grpc_python_out "${GRPC_PYTHON_SOURCE_PATH}/rips/generated"
|
||||
"${rips_proto}"
|
||||
DEPENDS "${rips_proto}"
|
||||
COMMENT "Generating ${rips_proto_python} and ${rips_grpc_python}"
|
||||
VERBATIM
|
||||
)
|
||||
list (APPEND GRPC_PYTHON_GENERATED_SOURCES
|
||||
${rips_proto_python}
|
||||
${rips_grpc_python}
|
||||
)
|
||||
else()
|
||||
message(STATUS "RESINSIGHT_GRPC_PYTHON_EXECUTABLE not specified. Will not generate GRPC Python code.")
|
||||
endif(RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
|
||||
|
||||
list( APPEND GRPC_HEADER_FILES
|
||||
${rips_proto_hdrs}
|
||||
@ -170,74 +170,75 @@ foreach(proto_file ${PROTO_FILES})
|
||||
endforeach(proto_file)
|
||||
|
||||
if (RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
|
||||
CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/ApplicationCode/Adm/RiaVersionInfo.py.cmake
|
||||
${GRPC_PYTHON_SOURCE_PATH}/rips/generated/RiaVersionInfo.py)
|
||||
CONFIGURE_FILE( ${GRPC_PYTHON_SOURCE_PATH}/setup.py.cmake
|
||||
CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/ApplicationCode/Adm/RiaVersionInfo.py.cmake
|
||||
${GRPC_PYTHON_SOURCE_PATH}/rips/generated/RiaVersionInfo.py)
|
||||
CONFIGURE_FILE( ${GRPC_PYTHON_SOURCE_PATH}/setup.py.cmake
|
||||
${GRPC_PYTHON_SOURCE_PATH}/setup.py)
|
||||
|
||||
list(APPEND GRPC_PYTHON_SOURCES
|
||||
"rips/generated/RiaVersionInfo.py"
|
||||
"rips/__init__.py"
|
||||
"rips/case.py"
|
||||
"rips/contour_map.py"
|
||||
"rips/grid.py"
|
||||
"rips/gridcasegroup.py"
|
||||
"rips/instance.py"
|
||||
"rips/pdmobject.py"
|
||||
"rips/plot.py"
|
||||
"rips/project.py"
|
||||
"rips/simulation_well.py"
|
||||
"rips/view.py"
|
||||
"rips/well_log_plot.py"
|
||||
"rips/PythonExamples/instance_example.py"
|
||||
"rips/PythonExamples/command_example.py"
|
||||
"rips/PythonExamples/case_grid_group.py"
|
||||
"rips/PythonExamples/case_info_streaming_example.py"
|
||||
"rips/PythonExamples/create_wbs_plot.py"
|
||||
"rips/PythonExamples/export_plots.py"
|
||||
"rips/PythonExamples/export_snapshots.py"
|
||||
"rips/PythonExamples/error_handling.py"
|
||||
"rips/PythonExamples/import_well_paths_and_logs.py"
|
||||
"rips/PythonExamples/soil_porv_async.py"
|
||||
"rips/PythonExamples/soil_porv_sync.py"
|
||||
"rips/PythonExamples/selected_cases.py"
|
||||
"rips/PythonExamples/all_cases.py"
|
||||
"rips/PythonExamples/set_grid_properties.py"
|
||||
"rips/PythonExamples/set_cell_result.py"
|
||||
"rips/PythonExamples/set_flow_diagnostics_result.py"
|
||||
"rips/PythonExamples/grid_information.py"
|
||||
"rips/PythonExamples/input_prop_test_sync.py"
|
||||
"rips/PythonExamples/input_prop_test_async.py"
|
||||
"rips/PythonExamples/soil_average_async.py"
|
||||
"rips/PythonExamples/soil_average_sync.py"
|
||||
"rips/PythonExamples/view_example.py"
|
||||
"rips/tests/test_cases.py"
|
||||
"rips/tests/test_grids.py"
|
||||
"rips/tests/test_properties.py"
|
||||
"rips/tests/test_project.py"
|
||||
"rips/tests/conftest.py"
|
||||
"rips/tests/dataroot.py"
|
||||
"rips/tests/test_nnc_properties.py"
|
||||
"rips/tests/test_simulation_wells.py"
|
||||
"rips/tests/test_summary_cases.py"
|
||||
"rips/tests/test_wells.py"
|
||||
"requirements.txt"
|
||||
"setup.py"
|
||||
"README.md"
|
||||
"LICENSE"
|
||||
)
|
||||
|
||||
list(APPEND GRPC_PYTHON_SOURCES ${GRPC_PYTHON_GENERATED_SOURCES})
|
||||
list(APPEND GRPC_PYTHON_SOURCES
|
||||
"rips/generated/RiaVersionInfo.py"
|
||||
"rips/__init__.py"
|
||||
"rips/case.py"
|
||||
"rips/contour_map.py"
|
||||
"rips/grid.py"
|
||||
"rips/gridcasegroup.py"
|
||||
"rips/instance.py"
|
||||
"rips/pdmobject.py"
|
||||
"rips/plot.py"
|
||||
"rips/project.py"
|
||||
"rips/simulation_well.py"
|
||||
"rips/view.py"
|
||||
"rips/well_log_plot.py"
|
||||
"rips/PythonExamples/instance_example.py"
|
||||
"rips/PythonExamples/command_example.py"
|
||||
"rips/PythonExamples/case_grid_group.py"
|
||||
"rips/PythonExamples/case_info_streaming_example.py"
|
||||
"rips/PythonExamples/create_wbs_plot.py"
|
||||
"rips/PythonExamples/export_plots.py"
|
||||
"rips/PythonExamples/export_snapshots.py"
|
||||
"rips/PythonExamples/error_handling.py"
|
||||
"rips/PythonExamples/import_well_paths_and_logs.py"
|
||||
"rips/PythonExamples/soil_porv_async.py"
|
||||
"rips/PythonExamples/soil_porv_sync.py"
|
||||
"rips/PythonExamples/selected_cases.py"
|
||||
"rips/PythonExamples/all_cases.py"
|
||||
"rips/PythonExamples/replace_case.py"
|
||||
"rips/PythonExamples/set_grid_properties.py"
|
||||
"rips/PythonExamples/set_cell_result.py"
|
||||
"rips/PythonExamples/set_flow_diagnostics_result.py"
|
||||
"rips/PythonExamples/grid_information.py"
|
||||
"rips/PythonExamples/input_prop_test_sync.py"
|
||||
"rips/PythonExamples/input_prop_test_async.py"
|
||||
"rips/PythonExamples/soil_average_async.py"
|
||||
"rips/PythonExamples/soil_average_sync.py"
|
||||
"rips/PythonExamples/view_example.py"
|
||||
"rips/tests/test_cases.py"
|
||||
"rips/tests/test_grids.py"
|
||||
"rips/tests/test_properties.py"
|
||||
"rips/tests/test_project.py"
|
||||
"rips/tests/conftest.py"
|
||||
"rips/tests/dataroot.py"
|
||||
"rips/tests/test_nnc_properties.py"
|
||||
"rips/tests/test_simulation_wells.py"
|
||||
"rips/tests/test_summary_cases.py"
|
||||
"rips/tests/test_wells.py"
|
||||
"requirements.txt"
|
||||
"setup.py"
|
||||
"README.md"
|
||||
"LICENSE"
|
||||
)
|
||||
|
||||
list(APPEND GRPC_PYTHON_SOURCES ${GRPC_PYTHON_GENERATED_SOURCES})
|
||||
|
||||
foreach(PYTHON_SCRIPT ${GRPC_PYTHON_SOURCES})
|
||||
list(APPEND GRPC_PYTHON_SOURCES_FULL_PATH "${GRPC_PYTHON_SOURCE_PATH}/${PYTHON_SCRIPT}")
|
||||
endforeach()
|
||||
foreach(PYTHON_SCRIPT ${GRPC_PYTHON_SOURCES})
|
||||
list(APPEND GRPC_PYTHON_SOURCES_FULL_PATH "${GRPC_PYTHON_SOURCE_PATH}/${PYTHON_SCRIPT}")
|
||||
endforeach()
|
||||
|
||||
if (MSVC)
|
||||
source_group(TREE ${GRPC_PYTHON_SOURCE_PATH} FILES ${GRPC_PYTHON_SOURCES_FULL_PATH} PREFIX "GrpcInterface\\Python")
|
||||
endif(MSVC)
|
||||
if (MSVC)
|
||||
source_group(TREE ${GRPC_PYTHON_SOURCE_PATH} FILES ${GRPC_PYTHON_SOURCES_FULL_PATH} PREFIX "GrpcInterface\\Python")
|
||||
endif(MSVC)
|
||||
else()
|
||||
message(STATUS "RESINSIGHT_GRPC_PYTHON_EXECUTABLE not specified. Will not copy grpc Python code to build folder")
|
||||
message(STATUS "RESINSIGHT_GRPC_PYTHON_EXECUTABLE not specified. Will not copy grpc Python code to build folder")
|
||||
endif(RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
|
||||
|
||||
list ( APPEND GRPC_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
@ -0,0 +1,9 @@
|
||||
# Load ResInsight Processing Server Client Library
|
||||
import rips
|
||||
# Connect to ResInsight instance
|
||||
resinsight = rips.Instance.find()
|
||||
# Example code
|
||||
print("ResInsight version: " + resinsight.version_string())
|
||||
|
||||
case = resinsight.project.case(case_id=0)
|
||||
case.replace(new_grid_file='C:/Users/lindkvis/Projects/ResInsight/TestModels/Case_with_10_timesteps/Real0/BRUGGE_0000.EGRID')
|
@ -0,0 +1,14 @@
|
||||
# Load ResInsight Processing Server Client Library
|
||||
import rips
|
||||
# Connect to ResInsight instance
|
||||
resinsight = rips.Instance.find()
|
||||
# Example code
|
||||
|
||||
# Specific summary case with case_id = 1
|
||||
summary_case = resinsight.project.summary_case(case_id=1)
|
||||
summary_case.print_object_info()
|
||||
|
||||
# All summary cases
|
||||
summary_cases = resinsight.project.summary_cases()
|
||||
for summary_case in summary_cases:
|
||||
print("Summary case found: ", summary_case.short_name)
|
@ -17,7 +17,7 @@ from Definitions_pb2 import Empty
|
||||
import Project_pb2_grpc
|
||||
import Project_pb2
|
||||
import PdmObject_pb2
|
||||
from resinsight_classes import Project, PlotWindow, WellPath
|
||||
from resinsight_classes import Project, PlotWindow, WellPath, SummaryCase
|
||||
|
||||
|
||||
@add_method(Project)
|
||||
@ -63,7 +63,7 @@ def close(self):
|
||||
|
||||
@add_method(Project)
|
||||
def load_case(self, path):
|
||||
"""Load a new case from the given file path
|
||||
"""Load a new grid case from the given file path
|
||||
|
||||
Arguments:
|
||||
path(str): file path to case
|
||||
@ -77,7 +77,7 @@ def load_case(self, path):
|
||||
|
||||
@add_method(Project)
|
||||
def selected_cases(self):
|
||||
"""Get a list of all cases selected in the project tree
|
||||
"""Get a list of all grid cases selected in the project tree
|
||||
|
||||
Returns:
|
||||
A list of :class:`rips.generated.resinsight_classes.Case`
|
||||
@ -91,7 +91,7 @@ def selected_cases(self):
|
||||
|
||||
@add_method(Project)
|
||||
def cases(self):
|
||||
"""Get a list of all cases in the project
|
||||
"""Get a list of all grid cases in the project
|
||||
|
||||
Returns:
|
||||
A list of :class:`rips.generated.resinsight_classes.Case`
|
||||
@ -101,7 +101,7 @@ def cases(self):
|
||||
|
||||
@add_method(Project)
|
||||
def case(self, case_id):
|
||||
"""Get a specific case from the provided case Id
|
||||
"""Get a specific grid case from the provided case Id
|
||||
|
||||
Arguments:
|
||||
id(int): case id
|
||||
@ -117,7 +117,7 @@ def case(self, case_id):
|
||||
|
||||
@add_method(Project)
|
||||
def replace_source_cases(self, grid_list_file, case_group_id=0):
|
||||
"""Replace all source cases within a case group
|
||||
"""Replace all source grid cases within a case group
|
||||
|
||||
Arguments:
|
||||
grid_list_file (str): path to file containing a list of cases
|
||||
@ -143,6 +143,13 @@ def create_grid_case_group(self, case_paths):
|
||||
return self.grid_case_group(
|
||||
command_reply.createGridCaseGroupResult.groupId)
|
||||
|
||||
@add_method(Project)
|
||||
def summary_cases(self):
|
||||
"""Get a list of all summary cases in the Project
|
||||
|
||||
Returns: A list of :class:`rips.generated.resinsight_classes.SummaryCase`
|
||||
"""
|
||||
return self.descendants(SummaryCase)
|
||||
|
||||
@add_method(Project)
|
||||
def views(self):
|
||||
|
@ -114,10 +114,6 @@ RimAnalysisPlot::RimAnalysisPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_referenceCase, "ReferenceCase", "Reference Case", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Title", "", "", "" );
|
||||
m_showPlotTitle.xmlCapability()->setIOWritable( false );
|
||||
m_showPlotTitle.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
CAF_PDM_InitField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto", "", "", "" );
|
||||
m_useAutoPlotTitle.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
@ -202,7 +198,6 @@ RimPlotDataFilterCollection* RimAnalysisPlot::plotDataFilterCollection() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
|
||||
{
|
||||
disconnectAllCaseSignals();
|
||||
m_analysisPlotDataSelection.deleteAllChildObjects();
|
||||
for ( auto curveDef : curveDefinitions )
|
||||
{
|
||||
@ -460,7 +455,6 @@ void RimAnalysisPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> summaryVectorDefinitions = dlg.curveSelection();
|
||||
|
||||
disconnectAllCaseSignals();
|
||||
m_analysisPlotDataSelection.deleteAllChildObjects();
|
||||
for ( const RiaSummaryCurveDefinition& vectorDef : summaryVectorDefinitions )
|
||||
{
|
||||
@ -1138,8 +1132,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
{
|
||||
std::pair<double, double> minMax = filter->filterRangeMinMax();
|
||||
|
||||
if ( filter->useAbsoluteValues() ) value = fabs( value );
|
||||
|
||||
if ( minMax.first <= value && value <= minMax.second )
|
||||
{
|
||||
casesToKeep.insert( sumCase );
|
||||
@ -1148,7 +1140,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
else if ( filter->filterOperation() == RimPlotDataFilterItem::TOP_N ||
|
||||
filter->filterOperation() == RimPlotDataFilterItem::BOTTOM_N )
|
||||
{
|
||||
if ( filter->useAbsoluteValues() ) value = fabs( value );
|
||||
bool useLargest = filter->filterOperation() == RimPlotDataFilterItem::TOP_N;
|
||||
|
||||
auto itIsInsertedPair = casesToKeepWithValue.insert( {sumCase, value} );
|
||||
@ -1288,8 +1279,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
// clang-format off
|
||||
storeResultCoreLambda = [&]( double value ) // clang-format on
|
||||
{
|
||||
if ( filter->useAbsoluteValues() ) value = fabs( value );
|
||||
|
||||
if ( minMax.first <= value && value <= minMax.second )
|
||||
{
|
||||
casesToKeep.insert( sumCaseInEvaluation );
|
||||
@ -1302,7 +1291,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
// clang-format off
|
||||
storeResultCoreLambda = [&]( double value ) // clang-format on
|
||||
{
|
||||
if ( filter->useAbsoluteValues() ) value = fabs( value );
|
||||
bool useLargest = filter->filterOperation() == RimPlotDataFilterItem::TOP_N;
|
||||
|
||||
auto itIsInsertedPair = casesToKeepWithValue.insert( {sumCaseInEvaluation, value} );
|
||||
@ -1342,8 +1330,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
// clang-format off
|
||||
storeResultCoreLambda = [&]( double value ) // clang-format on
|
||||
{
|
||||
if ( filter->useAbsoluteValues() ) value = fabs( value );
|
||||
|
||||
if ( minMax.first <= value && value <= minMax.second )
|
||||
{
|
||||
sumItemsToKeep.insert( sumItem );
|
||||
@ -1356,7 +1342,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
// clang-format off
|
||||
storeResultCoreLambda = [&]( double value ) // clang-format on
|
||||
{
|
||||
if ( filter->useAbsoluteValues() ) value = fabs( value );
|
||||
bool useLargest = filter->filterOperation() == RimPlotDataFilterItem::TOP_N;
|
||||
|
||||
auto itIsInsertedPair = sumItemsToKeepWithValue.insert( {sumItem, value} );
|
||||
@ -1652,7 +1637,7 @@ void RimAnalysisPlot::updatePlotTitle()
|
||||
{
|
||||
QString plotTitle = description();
|
||||
m_plotWidget->setPlotTitle( plotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
@ -1816,17 +1801,3 @@ void RimAnalysisPlot::connectAllCaseSignals()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::disconnectAllCaseSignals()
|
||||
{
|
||||
for ( auto dataEntry : m_analysisPlotDataSelection )
|
||||
{
|
||||
if ( dataEntry->ensemble() )
|
||||
{
|
||||
dataEntry->ensemble()->caseRemoved.disconnect( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,6 @@ private:
|
||||
void detachAllCurves() override;
|
||||
|
||||
void reattachAllCurves() override {}
|
||||
void doRemoveFromCollection() override {}
|
||||
void updateAxes() override;
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
void updateZoomInQwt() override {}
|
||||
@ -176,12 +175,11 @@ private:
|
||||
void buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder );
|
||||
|
||||
int barTextFontSize() const;
|
||||
void initAfterRead();
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
void onCaseRemoved( const SignalEmitter* emitter, RimSummaryCase* summaryCase );
|
||||
void connectAllCaseSignals();
|
||||
void disconnectAllCaseSignals();
|
||||
|
||||
private:
|
||||
std::unique_ptr<RiaSummaryCurveDefinitionAnalyser> m_analyserOfSelectedCurveDefs;
|
||||
@ -200,7 +198,6 @@ private:
|
||||
|
||||
caf::PdmPtrField<RimSummaryCase*> m_referenceCase;
|
||||
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
caf::PdmField<bool> m_useAutoPlotTitle;
|
||||
caf::PdmField<QString> m_description;
|
||||
|
||||
|
@ -53,7 +53,7 @@ RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot()
|
||||
applyFirstEnsembleFieldAddressesToPlot( plot, "FOPT" );
|
||||
|
||||
// plot->enableAutoPlotTitle( true );
|
||||
m_analysisPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
@ -79,7 +79,7 @@ RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot( RimSummaryCaseCo
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityName.toStdString(), timeStep );
|
||||
|
||||
// plot->enableAutoPlotTitle( true );
|
||||
m_analysisPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
@ -106,15 +106,7 @@ void RimAnalysisPlotCollection::updateSummaryNameHasChanged()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::removeSummaryPlot( RimAnalysisPlot* analysisPlot )
|
||||
{
|
||||
m_analysisPlots.removeChildObject( analysisPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimAnalysisPlot*> RimAnalysisPlotCollection::plots()
|
||||
std::vector<RimAnalysisPlot*> RimAnalysisPlotCollection::plots() const
|
||||
{
|
||||
return m_analysisPlots.childObjects();
|
||||
}
|
||||
@ -122,9 +114,9 @@ std::vector<RimAnalysisPlot*> RimAnalysisPlotCollection::plots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::deleteAllChildObjects()
|
||||
size_t RimAnalysisPlotCollection::plotCount() const
|
||||
{
|
||||
m_analysisPlots.deleteAllChildObjects();
|
||||
return m_analysisPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -156,6 +148,9 @@ void RimAnalysisPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAnaly
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAnalysisPlot* plot,
|
||||
RimSummaryCaseCollection* ensemble,
|
||||
const std::string& quantityName,
|
||||
@ -182,3 +177,20 @@ void RimAnalysisPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAnalysis
|
||||
plot->setTimeSteps( {timeStep} );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::insertPlot( RimAnalysisPlot* analysisPlot, size_t index )
|
||||
{
|
||||
m_analysisPlots.insert( index, analysisPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::removePlot( RimAnalysisPlot* analysisPlot )
|
||||
{
|
||||
m_analysisPlots.removeChildObject( analysisPlot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
@ -18,19 +18,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimAnalysisPlot.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
class RimAnalysisPlot;
|
||||
class RimSummaryCaseCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnalysisPlotCollection : public caf::PdmObject
|
||||
class RimAnalysisPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimAnalysisPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -43,11 +45,11 @@ public:
|
||||
createAnalysisPlot( RimSummaryCaseCollection* ensemble, const QString& quantityName, std::time_t timeStep );
|
||||
|
||||
void updateSummaryNameHasChanged();
|
||||
void removeSummaryPlot( RimAnalysisPlot* analysisPlot );
|
||||
|
||||
std::vector<RimAnalysisPlot*> plots();
|
||||
|
||||
void deleteAllChildObjects();
|
||||
std::vector<RimAnalysisPlot*> plots() const final;
|
||||
size_t plotCount() const final;
|
||||
void insertPlot( RimAnalysisPlot* analysisPlot, size_t index ) final;
|
||||
void removePlot( RimAnalysisPlot* analysisPlot ) final;
|
||||
|
||||
private:
|
||||
void applyFirstEnsembleFieldAddressesToPlot( RimAnalysisPlot* plot, const std::string& quantityName = "" );
|
||||
|
@ -56,8 +56,6 @@ RimPlotDataFilterItem* RimPlotDataFilterCollection::addFilter()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotDataFilterCollection::removeFilter( RimPlotDataFilterItem* filter )
|
||||
{
|
||||
filter->filterChanged.disconnect( this );
|
||||
|
||||
m_filters.removeChildObject( filter );
|
||||
delete filter;
|
||||
|
||||
|
@ -103,7 +103,6 @@ RimPlotDataFilterItem::RimPlotDataFilterItem()
|
||||
caf::PdmUiActionPushButtonEditor::configureEditorForField( &m_filterQuantitySelectButton );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filterOperation, "FilterOperation", "is", "", "", "" );
|
||||
CAF_PDM_InitField( &m_useAbsoluteValue, "UseAbsoluteValue", true, "using absolute values", "", "", "" );
|
||||
CAF_PDM_InitField( &m_topBottomN, "MinTopN", 20, "N", "", "", "" );
|
||||
m_topBottomN.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
@ -237,10 +236,6 @@ void RimPlotDataFilterItem::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( true );
|
||||
}
|
||||
else if ( changedField == &m_useAbsoluteValue )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( false );
|
||||
}
|
||||
else if ( changedField == &m_filterOperation )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( false );
|
||||
@ -361,15 +356,12 @@ void RimPlotDataFilterItem::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
||||
|
||||
if ( m_filterOperation() == RANGE )
|
||||
{
|
||||
uiOrdering.add( &m_useAbsoluteValue, {false} );
|
||||
|
||||
uiOrdering.add( &m_max, {true, -1, 1} );
|
||||
uiOrdering.add( &m_min, {true, -1, 1} );
|
||||
}
|
||||
else if ( m_filterOperation == TOP_N || m_filterOperation == BOTTOM_N )
|
||||
{
|
||||
uiOrdering.add( &m_topBottomN, {false} );
|
||||
uiOrdering.add( &m_useAbsoluteValue, {true} );
|
||||
}
|
||||
}
|
||||
|
||||
@ -432,16 +424,16 @@ void RimPlotDataFilterItem::updateMaxMinAndDefaultValues( bool forceDefault )
|
||||
if ( RiaCurveDataTools::isValidValue( eParam.minValue, false ) )
|
||||
{
|
||||
m_lowerLimit = eParam.minValue;
|
||||
if ( m_useAbsoluteValue ) m_lowerLimit = fabs( eParam.minValue );
|
||||
}
|
||||
if ( RiaCurveDataTools::isValidValue( eParam.maxValue, false ) )
|
||||
{
|
||||
m_upperLimit = eParam.maxValue;
|
||||
if ( m_useAbsoluteValue ) m_upperLimit = fabs( eParam.maxValue );
|
||||
}
|
||||
|
||||
// Make sure max is > min after doing abs
|
||||
if ( m_upperLimit < m_lowerLimit ) std::swap( m_upperLimit, m_lowerLimit );
|
||||
if ( m_upperLimit < m_lowerLimit )
|
||||
{
|
||||
std::swap( m_upperLimit, m_lowerLimit );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -449,7 +441,7 @@ void RimPlotDataFilterItem::updateMaxMinAndDefaultValues( bool forceDefault )
|
||||
parentPlot->maxMinValueFromAddress( m_filterQuantityUiField,
|
||||
m_consideredTimestepsType(),
|
||||
m_explicitlySelectedTimeSteps(),
|
||||
m_useAbsoluteValue(),
|
||||
false,
|
||||
&m_lowerLimit,
|
||||
&m_upperLimit );
|
||||
}
|
||||
|
@ -96,7 +96,6 @@ public:
|
||||
QString ensembleParameterName() const;
|
||||
|
||||
FilterOperation filterOperation() const { return m_filterOperation(); }
|
||||
bool useAbsoluteValues() const { return m_useAbsoluteValue(); }
|
||||
std::pair<double, double> filterRangeMinMax() const;
|
||||
int topBottomN() const;
|
||||
|
||||
@ -135,7 +134,6 @@ private:
|
||||
// Operation and parameters
|
||||
|
||||
caf::PdmField<caf::AppEnum<FilterOperation>> m_filterOperation;
|
||||
caf::PdmField<bool> m_useAbsoluteValue;
|
||||
caf::PdmField<int> m_topBottomN;
|
||||
caf::PdmField<double> m_max;
|
||||
caf::PdmField<double> m_min;
|
||||
|
@ -164,6 +164,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimElasticProperties.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertiesCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimLayerCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureModelStressCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAbstractPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureModelPropertyCurve.h
|
||||
)
|
||||
|
||||
|
@ -18,36 +18,34 @@
|
||||
|
||||
#include "RimFractureModel.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaCompletionTypeCalculationScheduler.h"
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
#include "RiaFractureDefines.h"
|
||||
#include "RiaFractureModelDefines.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigSimulationWellCoordsAndMD.h"
|
||||
#include "RigWellPath.h"
|
||||
#include "RigWellPathIntersectionTools.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimColorLegend.h"
|
||||
#include "RimColorLegendCollection.h"
|
||||
#include "RimColorLegendItem.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimElasticProperties.h"
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
#include "RimFractureModelPlot.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimStimPlanColors.h"
|
||||
#include "RimStimPlanFractureTemplate.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
@ -235,15 +233,23 @@ RimFractureModel::RimFractureModel()
|
||||
m_formationDip.uiCapability()->setUiReadOnly( true );
|
||||
m_formationDip.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_autoComputeBarrier, "AutoComputeBarrier", true, "Auto Compute Barrier", "", "", "" );
|
||||
CAF_PDM_InitScriptableField( &m_hasBarrier, "Barrier", true, "Barrier", "", "", "" );
|
||||
CAF_PDM_InitScriptableField( &m_distanceToBarrier, "DistanceToBarrier", 0.0, "Distance To Barrier [m]", "", "", "" );
|
||||
m_distanceToBarrier.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() );
|
||||
m_distanceToBarrier.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_barrierDip, "BarrierDip", 0.0, "Barrier Dip", "", "", "" );
|
||||
m_barrierDip.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() );
|
||||
m_barrierDip.uiCapability()->setUiReadOnly( true );
|
||||
CAF_PDM_InitScriptableField( &m_wellPenetrationLayer, "WellPenetrationLayer", 0, "Well Penetration Layer", "", "", "" );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_elasticProperties, "ElasticProperties", "Elastic Properties", "", "", "" );
|
||||
m_elasticProperties.uiCapability()->setUiHidden( true );
|
||||
m_elasticProperties.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_barrierAnnotation, "BarrierAnnotation", "Barrier Annotation", "", "", "" );
|
||||
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
@ -252,6 +258,8 @@ RimFractureModel::RimFractureModel()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFractureModel::~RimFractureModel()
|
||||
{
|
||||
clearBarrierAnnotation();
|
||||
|
||||
RimWellPath* wellPath = m_thicknessDirectionWellPath.value();
|
||||
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
||||
|
||||
@ -294,9 +302,25 @@ void RimFractureModel::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
}
|
||||
|
||||
if ( changedField == &m_MD || changedField == &m_extractionType || changedField == &m_boundingBoxVertical ||
|
||||
changedField == &m_boundingBoxHorizontal )
|
||||
changedField == &m_boundingBoxHorizontal || changedField == &m_fractureOrientation ||
|
||||
changedField == &m_autoComputeBarrier )
|
||||
{
|
||||
updateThicknessDirection();
|
||||
|
||||
if ( m_autoComputeBarrier )
|
||||
{
|
||||
updateDistanceToBarrierAndDip();
|
||||
}
|
||||
else
|
||||
{
|
||||
clearBarrierAnnotation();
|
||||
}
|
||||
}
|
||||
|
||||
if ( changedField == &m_autoComputeBarrier || changedField == &m_hasBarrier )
|
||||
{
|
||||
m_barrierDip.uiCapability()->setUiReadOnly( m_autoComputeBarrier || !m_hasBarrier );
|
||||
m_distanceToBarrier.uiCapability()->setUiReadOnly( m_autoComputeBarrier || !m_hasBarrier );
|
||||
}
|
||||
|
||||
if ( changedField == &m_extractionType || changedField == &m_thicknessDirectionWellPath )
|
||||
@ -552,6 +576,189 @@ cvf::Vec3d RimFractureModel::calculateTSTDirection() const
|
||||
return ( direction / static_cast<double>( numContributingCells ) ).getNormalized();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureModel::updateDistanceToBarrierAndDip()
|
||||
{
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( this );
|
||||
if ( !objHandle ) return;
|
||||
|
||||
RimWellPath* wellPath = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( wellPath );
|
||||
if ( !wellPath ) return;
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = getEclipseCaseData();
|
||||
if ( !eclipseCaseData ) return;
|
||||
|
||||
const cvf::Vec3d& position = anchorPosition();
|
||||
|
||||
RiaLogging::info( "Computing distance to barrier." );
|
||||
RiaLogging::info( QString( "Anchor position: %1" ).arg( RimFractureModel::vecToString( position ) ) );
|
||||
|
||||
RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
|
||||
|
||||
// Find the well path points closest to the anchor position
|
||||
cvf::Vec3d p1;
|
||||
cvf::Vec3d p2;
|
||||
wellPathGeometry->twoClosestPoints( position, &p1, &p2 );
|
||||
RiaLogging::info( QString( "Closest points on well path: %1 %2" )
|
||||
.arg( RimFractureModel::vecToString( p1 ) )
|
||||
.arg( RimFractureModel::vecToString( p2 ) ) );
|
||||
|
||||
// Create a well direction based on the two points
|
||||
cvf::Vec3d wellDirection = ( p2 - p1 ).getNormalized();
|
||||
RiaLogging::info( QString( "Well direction: %1" ).arg( RimFractureModel::vecToString( wellDirection ) ) );
|
||||
|
||||
cvf::Vec3d fractureDirection = wellDirection;
|
||||
if ( m_fractureOrientation == FractureOrientation::ALONG_WELL_PATH )
|
||||
{
|
||||
cvf::Mat3d azimuthRotation = cvf::Mat3d::fromRotation( cvf::Vec3d::Z_AXIS, cvf::Math::toRadians( 90.0 ) );
|
||||
fractureDirection.transformVector( azimuthRotation );
|
||||
}
|
||||
|
||||
// The direction to the barrier is normal to the TST
|
||||
cvf::Vec3d directionToBarrier = ( thicknessDirection() ^ fractureDirection ).getNormalized();
|
||||
RiaLogging::info( QString( "Direction to barrier: %1" ).arg( RimFractureModel::vecToString( directionToBarrier ) ) );
|
||||
|
||||
std::vector<WellPathCellIntersectionInfo> intersections =
|
||||
generateBarrierIntersections( eclipseCaseData, position, directionToBarrier );
|
||||
|
||||
RiaLogging::info( QString( "Intersections: %1" ).arg( intersections.size() ) );
|
||||
|
||||
double shortestDistance = std::numeric_limits<double>::max();
|
||||
|
||||
RigMainGrid* mainGrid = eclipseCaseData->mainGrid();
|
||||
bool foundFault = false;
|
||||
cvf::Vec3d barrierPosition;
|
||||
double barrierDip = 0.0;
|
||||
for ( const WellPathCellIntersectionInfo& intersection : intersections )
|
||||
{
|
||||
// Find the closest cell face which is a fault
|
||||
double distance = position.pointDistance( intersection.startPoint );
|
||||
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace( intersection.globCellIndex,
|
||||
intersection.intersectedCellFaceIn );
|
||||
if ( fault && distance < shortestDistance )
|
||||
{
|
||||
foundFault = true;
|
||||
shortestDistance = distance;
|
||||
barrierPosition = intersection.startPoint;
|
||||
|
||||
const RigCell& cell = mainGrid->globalCellArray()[intersection.globCellIndex];
|
||||
cvf::Vec3d faceNormal = cell.faceNormalWithAreaLength( intersection.intersectedCellFaceIn );
|
||||
barrierDip = calculateFormationDip( faceNormal );
|
||||
}
|
||||
}
|
||||
|
||||
if ( foundFault )
|
||||
{
|
||||
RiaLogging::info( QString( "Found barrier distance: %1 Dip: %2" ).arg( shortestDistance ).arg( barrierDip ) );
|
||||
clearBarrierAnnotation();
|
||||
addBarrierAnnotation( position, barrierPosition );
|
||||
|
||||
m_hasBarrier = true;
|
||||
m_barrierDip = barrierDip;
|
||||
m_distanceToBarrier = shortestDistance;
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::info( "No barrier found." );
|
||||
clearBarrierAnnotation();
|
||||
m_hasBarrier = false;
|
||||
m_barrierDip = 0.0;
|
||||
m_distanceToBarrier = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<WellPathCellIntersectionInfo>
|
||||
RimFractureModel::generateBarrierIntersections( RigEclipseCaseData* eclipseCaseData,
|
||||
const cvf::Vec3d& position,
|
||||
const cvf::Vec3d& directionToBarrier )
|
||||
{
|
||||
double randoDistance = 10000.0;
|
||||
cvf::Vec3d forwardPosition = position + ( directionToBarrier * randoDistance );
|
||||
cvf::Vec3d backwardPosition = position + ( directionToBarrier * -randoDistance );
|
||||
std::vector<WellPathCellIntersectionInfo> intersections =
|
||||
generateBarrierIntersectionsBetweenPoints( eclipseCaseData, position, forwardPosition );
|
||||
std::vector<WellPathCellIntersectionInfo> backwardIntersections =
|
||||
generateBarrierIntersectionsBetweenPoints( eclipseCaseData, position, backwardPosition );
|
||||
|
||||
// Merge the intersections for the search for closest
|
||||
intersections.insert( intersections.end(), backwardIntersections.begin(), backwardIntersections.end() );
|
||||
return intersections;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<WellPathCellIntersectionInfo>
|
||||
RimFractureModel::generateBarrierIntersectionsBetweenPoints( RigEclipseCaseData* eclipseCaseData,
|
||||
const cvf::Vec3d& startPosition,
|
||||
const cvf::Vec3d& endPosition )
|
||||
{
|
||||
// Create a fake well path from the anchor point to
|
||||
// a point far away in the direction barrier direction
|
||||
std::vector<cvf::Vec3d> pathCoords;
|
||||
pathCoords.push_back( startPosition );
|
||||
pathCoords.push_back( endPosition );
|
||||
|
||||
RigSimulationWellCoordsAndMD helper( pathCoords );
|
||||
return RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath( eclipseCaseData,
|
||||
helper.wellPathPoints(),
|
||||
helper.measuredDepths() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureModel::clearBarrierAnnotation()
|
||||
{
|
||||
auto existingAnnotation = m_barrierAnnotation.value();
|
||||
if ( existingAnnotation )
|
||||
{
|
||||
delete existingAnnotation;
|
||||
m_barrierAnnotation = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureModel::addBarrierAnnotation( const cvf::Vec3d& startPosition, const cvf::Vec3d& endPosition )
|
||||
{
|
||||
RimAnnotationCollection* coll = annotationCollection();
|
||||
if ( !coll ) return;
|
||||
|
||||
auto newAnnotation = new RimUserDefinedPolylinesAnnotation();
|
||||
|
||||
RimPolylineTarget* startTarget = new RimPolylineTarget();
|
||||
startTarget->setAsPointXYZ( startPosition );
|
||||
newAnnotation->insertTarget( nullptr, startTarget );
|
||||
|
||||
RimPolylineTarget* endTarget = new RimPolylineTarget();
|
||||
endTarget->setAsPointXYZ( endPosition );
|
||||
newAnnotation->insertTarget( nullptr, endTarget );
|
||||
|
||||
m_barrierAnnotation = newAnnotation;
|
||||
|
||||
coll->addAnnotation( newAnnotation );
|
||||
coll->scheduleRedrawOfRelevantViews();
|
||||
coll->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollection* RimFractureModel::annotationCollection()
|
||||
{
|
||||
const auto project = RimProject::current();
|
||||
auto oilField = project->activeOilField();
|
||||
return oilField ? oilField->annotationCollection() : nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -559,6 +766,7 @@ void RimFractureModel::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
|
||||
{
|
||||
m_thicknessDirectionWellPath.uiCapability()->setUiHidden( true );
|
||||
m_elasticProperties.uiCapability()->setUiHidden( false );
|
||||
m_barrierAnnotation.uiCapability()->setUiHidden( true );
|
||||
|
||||
uiOrdering.add( nameField() );
|
||||
uiOrdering.add( &m_MD );
|
||||
@ -613,6 +821,7 @@ void RimFractureModel::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
|
||||
caf::PdmUiOrdering* asymmetricGroup = uiOrdering.addNewGroup( "Asymmetric" );
|
||||
asymmetricGroup->add( &m_formationDip );
|
||||
asymmetricGroup->add( &m_hasBarrier );
|
||||
asymmetricGroup->add( &m_autoComputeBarrier );
|
||||
asymmetricGroup->add( &m_distanceToBarrier );
|
||||
asymmetricGroup->add( &m_barrierDip );
|
||||
asymmetricGroup->add( &m_wellPenetrationLayer );
|
||||
@ -625,7 +834,8 @@ void RimFractureModel::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_stressDepth || field == &m_verticalStress || field == &m_formationDip )
|
||||
if ( field == &m_stressDepth || field == &m_verticalStress || field == &m_formationDip || field == &m_barrierDip ||
|
||||
field == &m_distanceToBarrier )
|
||||
{
|
||||
auto doubleAttr = dynamic_cast<caf::PdmUiDoubleValueEditorAttribute*>( attribute );
|
||||
if ( doubleAttr )
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "RimCheckableNamedObject.h"
|
||||
#include "RimWellPathComponentInterface.h"
|
||||
|
||||
#include "RigWellLogExtractor.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
@ -34,6 +36,8 @@ class RimWellPath;
|
||||
class RimModeledWellPath;
|
||||
class RimElasticProperties;
|
||||
class RigEclipseCaseData;
|
||||
class RimAnnotationCollection;
|
||||
class RimUserDefinedPolylinesAnnotation;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -143,11 +147,13 @@ protected:
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
void updatePositionFromMeasuredDepth();
|
||||
void updateThicknessDirection();
|
||||
cvf::Vec3d calculateTSTDirection() const;
|
||||
void findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::Vec3d& bottomPosition );
|
||||
static double calculateFormationDip( const cvf::Vec3d& direction );
|
||||
void updatePositionFromMeasuredDepth();
|
||||
void updateThicknessDirection();
|
||||
void updateDistanceToBarrierAndDip();
|
||||
cvf::Vec3d calculateTSTDirection() const;
|
||||
void findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::Vec3d& bottomPosition );
|
||||
static double calculateFormationDip( const cvf::Vec3d& direction );
|
||||
|
||||
static QString vecToString( const cvf::Vec3d& vec );
|
||||
void updateThicknessDirectionWellPathName();
|
||||
static double computeDefaultStressDepth();
|
||||
@ -155,6 +161,19 @@ private:
|
||||
static RigEclipseCaseData* getEclipseCaseData();
|
||||
static RimEclipseCase* getEclipseCase();
|
||||
|
||||
void addBarrierAnnotation( const cvf::Vec3d& startPosition, const cvf::Vec3d& endPosition );
|
||||
void clearBarrierAnnotation();
|
||||
RimAnnotationCollection* annotationCollection();
|
||||
|
||||
static std::vector<WellPathCellIntersectionInfo> generateBarrierIntersections( RigEclipseCaseData* eclipseCaseData,
|
||||
const cvf::Vec3d& position,
|
||||
const cvf::Vec3d& directionToBarrier );
|
||||
|
||||
static std::vector<WellPathCellIntersectionInfo>
|
||||
generateBarrierIntersectionsBetweenPoints( RigEclipseCaseData* eclipseCaseData,
|
||||
const cvf::Vec3d& startPosition,
|
||||
const cvf::Vec3d& endPosition );
|
||||
|
||||
protected:
|
||||
caf::PdmField<double> m_MD;
|
||||
caf::PdmField<caf::AppEnum<ExtractionType>> m_extractionType;
|
||||
@ -192,9 +211,11 @@ protected:
|
||||
caf::PdmField<caf::AppEnum<FractureOrientation>> m_fractureOrientation;
|
||||
caf::PdmField<double> m_perforationLength;
|
||||
|
||||
caf::PdmField<double> m_formationDip;
|
||||
caf::PdmField<bool> m_hasBarrier;
|
||||
caf::PdmField<double> m_distanceToBarrier;
|
||||
caf::PdmField<double> m_barrierDip;
|
||||
caf::PdmField<int> m_wellPenetrationLayer;
|
||||
caf::PdmField<double> m_formationDip;
|
||||
caf::PdmField<bool> m_autoComputeBarrier;
|
||||
caf::PdmField<bool> m_hasBarrier;
|
||||
caf::PdmField<double> m_distanceToBarrier;
|
||||
caf::PdmField<double> m_barrierDip;
|
||||
caf::PdmField<int> m_wellPenetrationLayer;
|
||||
caf::PdmPtrField<RimUserDefinedPolylinesAnnotation*> m_barrierAnnotation;
|
||||
};
|
||||
|
@ -50,7 +50,6 @@ RimAbstractCorrelationPlot::RimAbstractCorrelationPlot()
|
||||
CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStep", "Time Step", "", "", "" );
|
||||
m_timeStep.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
|
||||
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", "", "", "" );
|
||||
|
||||
@ -76,7 +75,6 @@ RimAbstractCorrelationPlot::~RimAbstractCorrelationPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAbstractCorrelationPlot::setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
|
||||
{
|
||||
disconnectAllCaseSignals();
|
||||
m_analysisPlotDataSelection.deleteAllChildObjects();
|
||||
for ( auto curveDef : curveDefinitions )
|
||||
{
|
||||
@ -127,7 +125,6 @@ void RimAbstractCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
if ( !curveSelection.empty() )
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> summaryVectorDefinitions = dlg.curveSelection();
|
||||
disconnectAllCaseSignals();
|
||||
m_analysisPlotDataSelection.deleteAllChildObjects();
|
||||
for ( const RiaSummaryCurveDefinition& vectorDef : summaryVectorDefinitions )
|
||||
{
|
||||
@ -613,17 +610,3 @@ void RimAbstractCorrelationPlot::connectAllCaseSignals()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAbstractCorrelationPlot::disconnectAllCaseSignals()
|
||||
{
|
||||
for ( auto dataEntry : m_analysisPlotDataSelection )
|
||||
{
|
||||
if ( dataEntry->ensemble() )
|
||||
{
|
||||
dataEntry->ensemble()->caseRemoved.disconnect( this );
|
||||
}
|
||||
}
|
||||
}
|
@ -60,9 +60,10 @@ public:
|
||||
int axisTitleFontSize() const;
|
||||
int axisValueFontSize() const;
|
||||
|
||||
void setLabelFontSize( caf::FontTools::RelativeSize fontSize );
|
||||
void setAxisTitleFontSize( caf::FontTools::RelativeSize fontSize );
|
||||
void setAxisValueFontSize( caf::FontTools::RelativeSize fontSize );
|
||||
void setLabelFontSize( caf::FontTools::RelativeSize fontSize );
|
||||
void setAxisTitleFontSize( caf::FontTools::RelativeSize fontSize );
|
||||
void setAxisValueFontSize( caf::FontTools::RelativeSize fontSize );
|
||||
std::set<time_t> allAvailableTimeSteps();
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
@ -76,7 +77,6 @@ protected:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
std::set<time_t> allAvailableTimeSteps();
|
||||
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
|
||||
|
||||
std::set<RifEclipseSummaryAddress> addresses();
|
||||
@ -98,7 +98,6 @@ protected:
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
|
||||
void reattachAllCurves() override {}
|
||||
void doRemoveFromCollection() override {}
|
||||
void updateZoomInQwt() override {}
|
||||
void updateZoomFromQwt() override {}
|
||||
void setAutoScaleXEnabled( bool enabled ) override {}
|
||||
@ -120,7 +119,6 @@ protected:
|
||||
private:
|
||||
void onCaseRemoved( const SignalEmitter* emitter, RimSummaryCase* summaryCase );
|
||||
void connectAllCaseSignals();
|
||||
void disconnectAllCaseSignals();
|
||||
|
||||
protected:
|
||||
std::unique_ptr<RiaSummaryCurveDefinitionAnalyser> m_analyserOfSelectedCurveDefs;
|
||||
@ -136,7 +134,6 @@ protected:
|
||||
caf::PdmField<TimeStepFilterEnum> m_timeStepFilter;
|
||||
caf::PdmField<QDateTime> m_timeStep;
|
||||
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
caf::PdmField<bool> m_useAutoPlotTitle;
|
||||
caf::PdmField<QString> m_description;
|
||||
|
||||
|
@ -152,8 +152,6 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Correlation Plot", ":/CorrelationMatrixPlot16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_correlationFactor, "CorrelationFactor", "Correlation Factor", "", "", "" );
|
||||
m_correlationFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_sortByValues, "CorrelationSorting", "Sort Matrix by Values", "", "", "" );
|
||||
CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values", "", "", "" );
|
||||
@ -164,8 +162,8 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", false, "Show Only Top Correlations", "", "", "" );
|
||||
CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 15, "Number rows/columns", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", true, "Show Only Top Correlations", "", "", "" );
|
||||
CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 20, "Number rows/columns", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedParametersList, "SelectedParameters", "Select Parameters", "", "", "" );
|
||||
m_selectedParametersList.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
@ -174,7 +172,9 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
|
||||
m_legendConfig = new RimRegularLegendConfig();
|
||||
m_legendConfig->setAutomaticRanges( -1.0, 1.0, -1.0, 1.0 );
|
||||
m_legendConfig->setColorLegend(
|
||||
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::ColorRangesType::CORRELATION ) );
|
||||
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::ColorRangesType::RED_WHITE_BLUE ) );
|
||||
|
||||
setLegendsVisible( false );
|
||||
|
||||
this->uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_selectMultipleVectors = true;
|
||||
@ -190,14 +190,6 @@ RimCorrelationMatrixPlot::~RimCorrelationMatrixPlot()
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCorrelationMatrixPlot::CorrelationFactor RimCorrelationMatrixPlot::correlationFactor() const
|
||||
{
|
||||
return m_correlationFactor();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -262,10 +254,10 @@ void RimCorrelationMatrixPlot::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimAbstractCorrelationPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
if ( changedField == &m_correlationFactor || changedField == &m_showAbsoluteValues ||
|
||||
changedField == &m_sortByValues || changedField == &m_sortByAbsoluteValues ||
|
||||
changedField == &m_showOnlyTopNCorrelations || changedField == &m_topNFilterCount ||
|
||||
changedField == &m_excludeParametersWithoutVariation || changedField == &m_selectedParametersList )
|
||||
if ( changedField == &m_showAbsoluteValues || changedField == &m_sortByValues ||
|
||||
changedField == &m_sortByAbsoluteValues || changedField == &m_showOnlyTopNCorrelations ||
|
||||
changedField == &m_topNFilterCount || changedField == &m_excludeParametersWithoutVariation ||
|
||||
changedField == &m_selectedParametersList )
|
||||
{
|
||||
if ( changedField == &m_excludeParametersWithoutVariation )
|
||||
{
|
||||
@ -282,8 +274,7 @@ void RimCorrelationMatrixPlot::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationMatrixPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Factor Settings" );
|
||||
correlationGroup->add( &m_correlationFactor );
|
||||
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Settings" );
|
||||
correlationGroup->add( &m_excludeParametersWithoutVariation );
|
||||
correlationGroup->add( &m_selectedParametersList );
|
||||
correlationGroup->add( &m_showAbsoluteValues );
|
||||
@ -551,14 +542,7 @@ void RimCorrelationMatrixPlot::createMatrix()
|
||||
|
||||
if ( parameterValues.empty() ) continue;
|
||||
|
||||
if ( m_correlationFactor == CorrelationFactor::PEARSON )
|
||||
{
|
||||
correlation = RiaStatisticsTools::pearsonCorrelation( parameterValues, caseValuesAtTimestep );
|
||||
}
|
||||
else
|
||||
{
|
||||
correlation = RiaStatisticsTools::spearmanCorrelation( parameterValues, caseValuesAtTimestep );
|
||||
}
|
||||
correlation = RiaStatisticsTools::pearsonCorrelation( parameterValues, caseValuesAtTimestep );
|
||||
|
||||
bool validResult = RiaCurveDataTools::isValidValue( correlation, false );
|
||||
if ( validResult )
|
||||
@ -653,15 +637,13 @@ void RimCorrelationMatrixPlot::updatePlotTitle()
|
||||
{
|
||||
if ( m_useAutoPlotTitle )
|
||||
{
|
||||
m_description = QString( "%1 Matrix for Parameters vs Result Vectors at %2" )
|
||||
.arg( m_correlationFactor().uiText() )
|
||||
.arg( timeStepString() );
|
||||
m_description = QString( "Correlation Matrix for Parameters vs Result Vectors at %2" ).arg( timeStepString() );
|
||||
}
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->setPlotTitle( m_description );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||
|
@ -39,9 +39,6 @@ public:
|
||||
caf::Signal<std::pair<QString, RiaSummaryCurveDefinition>> matrixCellSelected;
|
||||
|
||||
public:
|
||||
using CorrelationFactor = RimCorrelationPlot::CorrelationFactor;
|
||||
using CorrelationFactorEnum = RimCorrelationPlot::CorrelationFactorEnum;
|
||||
|
||||
enum class Sorting
|
||||
{
|
||||
NO_SORTING,
|
||||
@ -55,7 +52,6 @@ public:
|
||||
RimCorrelationMatrixPlot();
|
||||
~RimCorrelationMatrixPlot() override;
|
||||
|
||||
CorrelationFactor correlationFactor() const;
|
||||
bool showAbsoluteValues() const;
|
||||
bool sortByAbsoluteValues() const;
|
||||
RimRegularLegendConfig* legendConfig();
|
||||
@ -85,14 +81,13 @@ private:
|
||||
void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<CorrelationFactorEnum> m_correlationFactor;
|
||||
caf::PdmField<bool> m_showAbsoluteValues;
|
||||
caf::PdmField<SortingEnum> m_sortByValues;
|
||||
caf::PdmField<bool> m_sortByAbsoluteValues;
|
||||
caf::PdmField<bool> m_excludeParametersWithoutVariation;
|
||||
caf::PdmField<bool> m_showOnlyTopNCorrelations;
|
||||
caf::PdmField<int> m_topNFilterCount;
|
||||
caf::PdmField<std::vector<QString>> m_selectedParametersList;
|
||||
caf::PdmField<bool> m_showAbsoluteValues;
|
||||
caf::PdmField<SortingEnum> m_sortByValues;
|
||||
caf::PdmField<bool> m_sortByAbsoluteValues;
|
||||
caf::PdmField<bool> m_excludeParametersWithoutVariation;
|
||||
caf::PdmField<bool> m_showOnlyTopNCorrelations;
|
||||
caf::PdmField<int> m_topNFilterCount;
|
||||
caf::PdmField<std::vector<QString>> m_selectedParametersList;
|
||||
|
||||
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
|
||||
|
||||
|
@ -47,19 +47,6 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RimCorrelationPlot::CorrelationFactor>::setUp()
|
||||
{
|
||||
addItem( RimCorrelationPlot::CorrelationFactor::PEARSON, "PEARSON", "Pearson Correlation Coefficient" );
|
||||
#ifdef USE_GSL
|
||||
addItem( RimCorrelationPlot::CorrelationFactor::SPEARMAN, "SPEARMAN", "Spearman's Rank Correlation Coefficient" );
|
||||
#endif
|
||||
setDefault( RimCorrelationPlot::CorrelationFactor::PEARSON );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimCorrelationPlot, "CorrelationPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -71,8 +58,6 @@ RimCorrelationPlot::RimCorrelationPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Correlation Tornado Plot", ":/CorrelationTornadoPlot16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_correlationFactor, "CorrelationFactor", "Correlation Factor", "", "", "" );
|
||||
m_correlationFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values", "", "", "" );
|
||||
CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values", "", "", "" );
|
||||
CAF_PDM_InitField( &m_excludeParametersWithoutVariation,
|
||||
@ -82,13 +67,14 @@ RimCorrelationPlot::RimCorrelationPlot()
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", false, "Show Only Top Correlations", "", "", "" );
|
||||
CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 15, "Number rows/columns", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", true, "Show Only Top Correlations", "", "", "" );
|
||||
CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 20, "Number rows/columns", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedParametersList, "SelectedParameters", "Select Parameters", "", "", "" );
|
||||
m_selectedParametersList.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
m_selectedParametersList.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||
|
||||
setLegendsVisible( false );
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
@ -110,10 +96,9 @@ void RimCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimAbstractCorrelationPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
if ( changedField == &m_correlationFactor || changedField == &m_showAbsoluteValues ||
|
||||
changedField == &m_sortByAbsoluteValues || changedField == &m_excludeParametersWithoutVariation ||
|
||||
changedField == &m_selectedParametersList || changedField == &m_showOnlyTopNCorrelations ||
|
||||
changedField == &m_topNFilterCount )
|
||||
if ( changedField == &m_showAbsoluteValues || changedField == &m_sortByAbsoluteValues ||
|
||||
changedField == &m_excludeParametersWithoutVariation || changedField == &m_selectedParametersList ||
|
||||
changedField == &m_showOnlyTopNCorrelations || changedField == &m_topNFilterCount )
|
||||
{
|
||||
if ( changedField == &m_excludeParametersWithoutVariation )
|
||||
{
|
||||
@ -129,8 +114,7 @@ void RimCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Factor Settings" );
|
||||
correlationGroup->add( &m_correlationFactor );
|
||||
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Settings" );
|
||||
correlationGroup->add( &m_excludeParametersWithoutVariation );
|
||||
correlationGroup->add( &m_selectedParametersList );
|
||||
|
||||
@ -263,10 +247,7 @@ void RimCorrelationPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chart
|
||||
auto address = *addresses().begin();
|
||||
|
||||
std::vector<std::pair<EnsembleParameter, double>> correlations =
|
||||
ensemble->parameterCorrelations( address,
|
||||
selectedTimestep,
|
||||
m_correlationFactor == CorrelationFactor::SPEARMAN,
|
||||
m_selectedParametersList() );
|
||||
ensemble->parameterCorrelations( address, selectedTimestep, m_selectedParametersList() );
|
||||
|
||||
QString timestepString = m_timeStep().toString( RiaPreferences::current()->dateTimeFormat() );
|
||||
|
||||
@ -289,19 +270,12 @@ void RimCorrelationPlot::updatePlotTitle()
|
||||
if ( m_useAutoPlotTitle && !ensembles().empty() )
|
||||
{
|
||||
auto ensemble = *ensembles().begin();
|
||||
m_description = QString( "%1 for %2, %3 at %4" )
|
||||
.arg( m_correlationFactor().uiText() )
|
||||
.arg( ensemble->name() )
|
||||
.arg( m_selectedVarsUiField )
|
||||
.arg( timeStepString() );
|
||||
m_description =
|
||||
QString( "Correlations for %2, %3 at %4" ).arg( ensemble->name() ).arg( m_selectedVarsUiField ).arg( timeStepString() );
|
||||
}
|
||||
m_plotWidget->setPlotTitle( m_description );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
||||
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||
}
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
|
||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -324,22 +298,6 @@ void RimCorrelationPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle,
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCorrelationPlot::CorrelationFactor RimCorrelationPlot::correlationFactor() const
|
||||
{
|
||||
return m_correlationFactor();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationPlot::setCorrelationFactor( CorrelationFactor factor )
|
||||
{
|
||||
m_correlationFactor = factor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -40,21 +40,10 @@ class RimCorrelationPlot : public RimAbstractCorrelationPlot
|
||||
public:
|
||||
caf::Signal<std::pair<QString, RiaSummaryCurveDefinition>> tornadoItemSelected;
|
||||
|
||||
public:
|
||||
enum class CorrelationFactor
|
||||
{
|
||||
PEARSON,
|
||||
SPEARMAN
|
||||
};
|
||||
using CorrelationFactorEnum = caf::AppEnum<CorrelationFactor>;
|
||||
|
||||
public:
|
||||
RimCorrelationPlot();
|
||||
~RimCorrelationPlot() override;
|
||||
|
||||
CorrelationFactor correlationFactor() const;
|
||||
void setCorrelationFactor( CorrelationFactor factor );
|
||||
|
||||
bool showAbsoluteValues() const;
|
||||
void setShowAbsoluteValues( bool showAbsoluteValues );
|
||||
|
||||
@ -84,11 +73,10 @@ private:
|
||||
void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<CorrelationFactorEnum> m_correlationFactor;
|
||||
caf::PdmField<bool> m_showAbsoluteValues;
|
||||
caf::PdmField<bool> m_sortByAbsoluteValues;
|
||||
caf::PdmField<bool> m_excludeParametersWithoutVariation;
|
||||
caf::PdmField<bool> m_showOnlyTopNCorrelations;
|
||||
caf::PdmField<int> m_topNFilterCount;
|
||||
caf::PdmField<std::vector<QString>> m_selectedParametersList;
|
||||
caf::PdmField<bool> m_showAbsoluteValues;
|
||||
caf::PdmField<bool> m_sortByAbsoluteValues;
|
||||
caf::PdmField<bool> m_excludeParametersWithoutVariation;
|
||||
caf::PdmField<bool> m_showOnlyTopNCorrelations;
|
||||
caf::PdmField<int> m_topNFilterCount;
|
||||
caf::PdmField<std::vector<QString>> m_selectedParametersList;
|
||||
};
|
||||
|
@ -59,7 +59,7 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( bool de
|
||||
if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, {"FOPT"} );
|
||||
plot->selectAllParameters();
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
@ -77,7 +77,7 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( RimSumm
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, {quantityName}, timeStep );
|
||||
plot->selectAllParameters();
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
@ -92,7 +92,7 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP
|
||||
if ( defaultToFirstEnsembleField ) applyFirstEnsembleFieldAddressesToPlot( plot, {"FOPT", "FWPT", "FGPT"} );
|
||||
plot->selectAllParameters();
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
@ -109,7 +109,7 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityNames, timeStep );
|
||||
plot->selectAllParameters();
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
@ -123,7 +123,7 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult
|
||||
plot->setAsPlotMdiWindow();
|
||||
if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, {"FOPT"} );
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
return plot;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, {quantityName}, timeStep );
|
||||
plot->setEnsembleParameter( paramName );
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
return plot;
|
||||
}
|
||||
|
||||
@ -181,15 +181,24 @@ RimCorrelationReportPlot*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationPlotCollection::removePlot( RimAbstractCorrelationPlot* correlationPlot )
|
||||
void RimCorrelationPlotCollection::insertPlot( RimAbstractCorrelationPlot* plot, size_t index )
|
||||
{
|
||||
m_correlationPlots.removeChildObject( correlationPlot );
|
||||
m_correlationPlots.insert( index, plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimAbstractCorrelationPlot*> RimCorrelationPlotCollection::plots()
|
||||
void RimCorrelationPlotCollection::removePlot( RimAbstractCorrelationPlot* plot )
|
||||
{
|
||||
m_correlationPlots.removeChildObject( plot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimAbstractCorrelationPlot*> RimCorrelationPlotCollection::plots() const
|
||||
{
|
||||
return m_correlationPlots.childObjects();
|
||||
}
|
||||
@ -197,7 +206,15 @@ std::vector<RimAbstractCorrelationPlot*> RimCorrelationPlotCollection::plots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCorrelationReportPlot*> RimCorrelationPlotCollection::reports()
|
||||
size_t RimCorrelationPlotCollection::plotCount() const
|
||||
{
|
||||
return m_correlationPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCorrelationReportPlot*> RimCorrelationPlotCollection::reports() const
|
||||
{
|
||||
return m_correlationReports.childObjects();
|
||||
}
|
||||
@ -205,9 +222,9 @@ std::vector<RimCorrelationReportPlot*> RimCorrelationPlotCollection::reports()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationPlotCollection::deleteAllChildObjects()
|
||||
void RimCorrelationPlotCollection::deleteAllPlots()
|
||||
{
|
||||
m_correlationPlots.deleteAllChildObjects();
|
||||
RimTypedPlotCollection<RimAbstractCorrelationPlot>::deleteAllPlots();
|
||||
m_correlationReports.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
@ -253,16 +270,26 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAbstr
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> allAddresses = ensemble->ensembleSummaryAddresses();
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefs;
|
||||
std::vector<QString> highestCorrelationParameters;
|
||||
for ( auto address : allAddresses )
|
||||
{
|
||||
auto it = std::find( quantityNames.begin(), quantityNames.end(), QString::fromStdString( address.uiText() ) );
|
||||
if ( it != quantityNames.end() || quantityNames.empty() )
|
||||
{
|
||||
curveDefs.push_back( RiaSummaryCurveDefinition( ensemble, address ) );
|
||||
auto correlationSortedEnsembleParameters =
|
||||
ensemble->correlationSortedEnsembleParameters( address, timeStep );
|
||||
highestCorrelationParameters.push_back( correlationSortedEnsembleParameters.front().first.name );
|
||||
}
|
||||
}
|
||||
plot->setCurveDefinitions( curveDefs );
|
||||
plot->setTimeStep( timeStep );
|
||||
|
||||
auto crossPlot = dynamic_cast<RimParameterResultCrossPlot*>( plot );
|
||||
if ( crossPlot && !highestCorrelationParameters.empty() )
|
||||
{
|
||||
crossPlot->setEnsembleParameter( highestCorrelationParameters.front() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,7 +327,17 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToReport( Rim
|
||||
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
|
||||
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||
plot->crossPlot()->setEnsembleParameter( ensembles.front()->variationSortedEnsembleParameters().front().name );
|
||||
|
||||
time_t timeStep = *( plot->matrixPlot()->allAvailableTimeSteps().rbegin() );
|
||||
auto correlationSortedEnsembleParameters =
|
||||
ensembles.front()->correlationSortedEnsembleParameters( curveDefsTornadoAndCrossPlot.front().summaryAddress(),
|
||||
timeStep );
|
||||
if ( !correlationSortedEnsembleParameters.empty() )
|
||||
{
|
||||
QString crossPlotEnsembleParameterName = correlationSortedEnsembleParameters.front().first.name;
|
||||
plot->crossPlot()->setEnsembleParameter( crossPlotEnsembleParameterName );
|
||||
}
|
||||
plot->matrixPlot()->setTimeStep( timeStep );
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,12 +371,17 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToReport( RimCor
|
||||
curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( ensemble, address ) );
|
||||
}
|
||||
}
|
||||
|
||||
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
|
||||
plot->matrixPlot()->setTimeStep( timeStep );
|
||||
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||
plot->correlationPlot()->setTimeStep( timeStep );
|
||||
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||
plot->crossPlot()->setTimeStep( timeStep );
|
||||
plot->crossPlot()->setEnsembleParameter( ensemble->variationSortedEnsembleParameters().front().name );
|
||||
|
||||
auto correlationSortedEnsembleParameters =
|
||||
ensemble->correlationSortedEnsembleParameters( curveDefsTornadoAndCrossPlot.front().summaryAddress(), timeStep );
|
||||
QString crossPlotEnsembleParameterName = correlationSortedEnsembleParameters.front().first.name;
|
||||
plot->crossPlot()->setEnsembleParameter( crossPlotEnsembleParameterName );
|
||||
}
|
||||
}
|
||||
|
@ -18,13 +18,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimAbstractCorrelationPlot.h"
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
|
||||
class RimAbstractCorrelationPlot;
|
||||
class RimCorrelationPlot;
|
||||
class RimCorrelationMatrixPlot;
|
||||
class RimCorrelationReportPlot;
|
||||
@ -35,7 +37,7 @@ class RimSummaryCaseCollection;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimCorrelationPlotCollection : public caf::PdmObject
|
||||
class RimCorrelationPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimAbstractCorrelationPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -64,13 +66,15 @@ public:
|
||||
const QString& tornadoAndCrossPlotQuantityName,
|
||||
std::time_t timeStep );
|
||||
|
||||
void removePlot( RimAbstractCorrelationPlot* correlationPlot );
|
||||
void removeReport( RimCorrelationReportPlot* correlationReport );
|
||||
|
||||
std::vector<RimAbstractCorrelationPlot*> plots();
|
||||
std::vector<RimCorrelationReportPlot*> reports();
|
||||
std::vector<RimAbstractCorrelationPlot*> plots() const final;
|
||||
size_t plotCount() const final;
|
||||
void insertPlot( RimAbstractCorrelationPlot* plot, size_t index ) final;
|
||||
void removePlot( RimAbstractCorrelationPlot* correlationPlot ) final;
|
||||
void deleteAllPlots() final;
|
||||
|
||||
void deleteAllChildObjects();
|
||||
std::vector<RimCorrelationReportPlot*> reports() const;
|
||||
|
||||
private:
|
||||
void applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot,
|
||||
|
@ -84,7 +84,7 @@ RimCorrelationReportPlot::RimCorrelationReportPlot()
|
||||
m_correlationPlot->setLegendsVisible( false );
|
||||
|
||||
m_parameterResultCrossPlot = new RimParameterResultCrossPlot;
|
||||
m_parameterResultCrossPlot->setLegendsVisible( false );
|
||||
m_parameterResultCrossPlot->setLegendsVisible( true );
|
||||
|
||||
this->uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
@ -320,7 +320,6 @@ void RimCorrelationReportPlot::onLoadDataAndUpdate()
|
||||
m_parameterResultCrossPlot->setAxisTitleFontSize( m_axisTitleFontSize() );
|
||||
m_parameterResultCrossPlot->setAxisValueFontSize( m_axisValueFontSize() );
|
||||
|
||||
m_correlationPlot->setCorrelationFactor( m_correlationMatrixPlot->correlationFactor() );
|
||||
m_correlationPlot->setShowAbsoluteValues( m_correlationMatrixPlot->showAbsoluteValues() );
|
||||
m_correlationPlot->setSortByAbsoluteValues( m_correlationMatrixPlot->sortByAbsoluteValues() );
|
||||
|
||||
|
@ -38,8 +38,6 @@ class RiuMultiPlotPage;
|
||||
class RimCorrelationReportPlot : public QObject, public RimPlotWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
using CorrelationFactor = RimCorrelationPlot::CorrelationFactor;
|
||||
using CorrelationFactorEnum = RimCorrelationPlot::CorrelationFactorEnum;
|
||||
|
||||
public:
|
||||
RimCorrelationReportPlot();
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
#include "RiaStatisticsTools.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuSummaryVectorSelectionDialog.h"
|
||||
@ -30,6 +32,7 @@
|
||||
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
#include "RimPlotDataFilterCollection.h"
|
||||
@ -166,10 +169,13 @@ void RimParameterResultCrossPlot::onLoadDataAndUpdate()
|
||||
if ( m_plotWidget && m_analyserOfSelectedCurveDefs )
|
||||
{
|
||||
createPoints();
|
||||
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
||||
m_plotWidget->insertLegend( legend, QwtPlot::RightLegend );
|
||||
m_plotWidget->setLegendFontSize( legendFontSize() );
|
||||
m_plotWidget->updateLegend();
|
||||
if ( m_showPlotLegends && !isSubPlot<RimMultiPlot>() )
|
||||
{
|
||||
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
||||
m_plotWidget->insertLegend( legend, QwtPlot::RightLegend );
|
||||
m_plotWidget->setLegendFontSize( legendFontSize() );
|
||||
m_plotWidget->updateLegend();
|
||||
}
|
||||
|
||||
this->updateAxes();
|
||||
this->updatePlotTitle();
|
||||
@ -199,6 +205,21 @@ void RimParameterResultCrossPlot::updateAxes()
|
||||
m_plotWidget->setAxisRange( QwtPlot::xBottom, m_xRange.first - xRangeWidth * 0.1, m_xRange.second + xRangeWidth * 0.1 );
|
||||
}
|
||||
|
||||
QStringList caseNamesOfValidEnsembleCases( const RimSummaryCaseCollection* ensemble )
|
||||
{
|
||||
QStringList caseNames;
|
||||
for ( auto summaryCase : ensemble->allSummaryCases() )
|
||||
{
|
||||
RifSummaryReaderInterface* reader = summaryCase->summaryReader();
|
||||
|
||||
if ( !reader ) continue;
|
||||
if ( !summaryCase->caseRealizationParameters() ) continue;
|
||||
|
||||
caseNames.push_back( summaryCase->displayCaseName() );
|
||||
}
|
||||
return caseNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -228,6 +249,9 @@ void RimParameterResultCrossPlot::createPoints()
|
||||
EnsembleParameter parameter = ensembleParameter( m_ensembleParameter );
|
||||
if ( !( parameter.isNumeric() && parameter.isValid() ) ) return;
|
||||
|
||||
QStringList caseNames = caseNamesOfValidEnsembleCases( ensemble );
|
||||
QString commonCaseRoot = RiaTextStringTools::findCommonRoot( caseNames );
|
||||
|
||||
for ( size_t caseIdx = 0u; caseIdx < ensemble->allSummaryCases().size(); ++caseIdx )
|
||||
{
|
||||
auto summaryCase = ensemble->allSummaryCases()[caseIdx];
|
||||
@ -278,7 +302,7 @@ void RimParameterResultCrossPlot::createPoints()
|
||||
plotCurve->setSymbol( symbol );
|
||||
QStringList curveName;
|
||||
if ( showEnsembleName ) curveName += ensemble->name();
|
||||
curveName += summaryCase->displayCaseName();
|
||||
curveName += summaryCase->displayCaseName().replace( commonCaseRoot, "" );
|
||||
if ( showAddressName ) curveName += QString::fromStdString( address.uiText() );
|
||||
|
||||
plotCurve->setTitle( curveName.join( " - " ) );
|
||||
@ -307,10 +331,6 @@ void RimParameterResultCrossPlot::updatePlotTitle()
|
||||
.arg( timeStepString() );
|
||||
}
|
||||
m_plotWidget->setPlotTitle( m_description );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
||||
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||
}
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
|
||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||
}
|
||||
|
@ -282,14 +282,6 @@ void RimWellDistributionPlot::zoomAll()
|
||||
// cvf::Trace::show("RimWellDistributionPlot::zoomAll()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::doRemoveFromCollection()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::doRemoveFromCollection()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -71,9 +71,6 @@ public:
|
||||
void zoomAll() override;
|
||||
|
||||
private:
|
||||
// RimPlot implementations
|
||||
void doRemoveFromCollection() override;
|
||||
|
||||
// RimViewWindow implementations
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
@ -100,9 +100,6 @@ RimWellPltPlot::RimWellPltPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Well Allocation Plot", ":/WellFlowPlot16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "" );
|
||||
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "WellLog", "", "", "" );
|
||||
m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden( true );
|
||||
m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
@ -117,6 +114,7 @@ RimWellPltPlot::RimWellPltPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedSourcesForIo, "Sources", "Sources", "", "", "" );
|
||||
m_selectedSourcesForIo.uiCapability()->setUiHidden( true );
|
||||
m_selectedSourcesForIo.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "Time Steps", "", "", "" );
|
||||
m_selectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||
@ -128,7 +126,7 @@ RimWellPltPlot::RimWellPltPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_phases, "Phases", "Phases", "", "", "" );
|
||||
m_phases.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||
m_phases = std::vector<caf::AppEnum<FlowPhase>>( {FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER} );
|
||||
m_phases = std::vector<caf::AppEnum<FlowPhase>>( { FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER } );
|
||||
m_phases.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
m_nameConfig->setCustomName( "PLT Plot" );
|
||||
@ -138,7 +136,8 @@ RimWellPltPlot::RimWellPltPlot()
|
||||
m_isOnLoad = true;
|
||||
m_plotLegendsHorizontal = false;
|
||||
|
||||
setAvailableDepthTypes( {RiaDefines::DepthTypeEnum::MEASURED_DEPTH} );
|
||||
setAvailableDepthTypes( { RiaDefines::DepthTypeEnum::MEASURED_DEPTH } );
|
||||
setPlotTitleVisible( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -961,7 +960,7 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
||||
{
|
||||
// uiTreeOrdering.skipRemainingChildren( true );
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1034,11 +1033,6 @@ void RimWellPltPlot::initAfterRead()
|
||||
m_wellLogPlot_OBSOLETE = nullptr;
|
||||
}
|
||||
|
||||
if ( m_showPlotTitle_OBSOLETE() && !m_showPlotWindowTitle() )
|
||||
{
|
||||
m_showPlotWindowTitle = m_showPlotTitle_OBSOLETE();
|
||||
}
|
||||
|
||||
RimWellLogPlot::initAfterRead();
|
||||
|
||||
// Postpone init until data has been loaded
|
||||
|
@ -114,8 +114,6 @@ private:
|
||||
void updateFormationsOnPlot() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
|
||||
|
||||
caf::PdmField<QString> m_wellPathName;
|
||||
|
||||
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;
|
||||
|
@ -83,9 +83,6 @@ RimWellRftPlot::RimWellRftPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "RFT Plot", ":/RFTPlot16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "" );
|
||||
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
|
||||
CAF_PDM_InitField( &m_showStatisticsCurves, "ShowStatisticsCurves", true, "Show Statistics Curves", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showEnsembleCurves, "ShowEnsembleCurves", true, "Show Ensemble Curves", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showErrorInObservedData, "ShowErrorObserved", true, "Show Observed Data Error", "", "", "" );
|
||||
@ -127,11 +124,13 @@ RimWellRftPlot::RimWellRftPlot()
|
||||
|
||||
// TODO: may want to support TRUE_VERTICAL_DEPTH_RKB in the future
|
||||
// It was developed for regular well log plots and requires some more work for RFT plots.
|
||||
setAvailableDepthTypes( {RiaDefines::DepthTypeEnum::MEASURED_DEPTH, RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH} );
|
||||
setAvailableDepthTypes( { RiaDefines::DepthTypeEnum::MEASURED_DEPTH, RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH } );
|
||||
|
||||
m_nameConfig->setCustomName( "RFT Plot" );
|
||||
m_plotLegendsHorizontal = false;
|
||||
|
||||
setPlotTitleVisible( true );
|
||||
|
||||
this->setAsPlotMdiWindow();
|
||||
m_isOnLoad = true;
|
||||
}
|
||||
@ -382,7 +381,7 @@ void RimWellRftPlot::updateEditorsFromCurves()
|
||||
selectedSources.insert( curveDef.address() );
|
||||
|
||||
auto newTimeStepMap = std::map<QDateTime, std::set<RifDataSourceForRftPlt>>{
|
||||
{curveDef.timeStep(), std::set<RifDataSourceForRftPlt>{curveDef.address()}}};
|
||||
{ curveDef.timeStep(), std::set<RifDataSourceForRftPlt>{ curveDef.address() } } };
|
||||
RimWellPlotTools::addTimeStepsToMap( selectedTimeStepsMap, newTimeStepMap );
|
||||
selectedTimeSteps.insert( curveDef.timeStep() );
|
||||
}
|
||||
@ -911,11 +910,6 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
updateFormationsOnPlot();
|
||||
syncCurvesFromUiSelection();
|
||||
}
|
||||
|
||||
else if ( changedField == &m_showPlotWindowTitle )
|
||||
{
|
||||
// m_wellLogPlot->setShowDescription(m_showPlotTitle);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1108,10 +1102,6 @@ void RimWellRftPlot::initAfterRead()
|
||||
delete m_wellLogPlot_OBSOLETE;
|
||||
m_wellLogPlot_OBSOLETE = nullptr;
|
||||
}
|
||||
if ( m_showPlotTitle_OBSOLETE() && !m_showPlotWindowTitle() )
|
||||
{
|
||||
m_showPlotWindowTitle = m_showPlotTitle_OBSOLETE();
|
||||
}
|
||||
|
||||
RimWellLogPlot::initAfterRead();
|
||||
}
|
||||
@ -1286,12 +1276,12 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
|
||||
std::vector<cvf::Color3f> colorTable;
|
||||
RiaColorTables::summaryCurveDefaultPaletteColors().color3fArray().toStdVector( &colorTable );
|
||||
|
||||
std::vector<RiuQwtSymbol::PointSymbolEnum> symbolTable = {RiuQwtSymbol::SYMBOL_ELLIPSE,
|
||||
RiuQwtSymbol::SYMBOL_RECT,
|
||||
RiuQwtSymbol::SYMBOL_DIAMOND,
|
||||
RiuQwtSymbol::SYMBOL_CROSS,
|
||||
RiuQwtSymbol::SYMBOL_XCROSS,
|
||||
RiuQwtSymbol::SYMBOL_STAR1};
|
||||
std::vector<RiuQwtSymbol::PointSymbolEnum> symbolTable = { RiuQwtSymbol::SYMBOL_ELLIPSE,
|
||||
RiuQwtSymbol::SYMBOL_RECT,
|
||||
RiuQwtSymbol::SYMBOL_DIAMOND,
|
||||
RiuQwtSymbol::SYMBOL_CROSS,
|
||||
RiuQwtSymbol::SYMBOL_XCROSS,
|
||||
RiuQwtSymbol::SYMBOL_STAR1 };
|
||||
|
||||
// Add new curves
|
||||
for ( const RiaRftPltCurveDefinition& curveDefToAdd : allCurveDefs )
|
||||
|
@ -161,6 +161,5 @@ private:
|
||||
std::map<QDateTime, RiuQwtSymbol::PointSymbolEnum> m_timeStepSymbols;
|
||||
bool m_isOnLoad;
|
||||
|
||||
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
|
||||
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
|
||||
};
|
||||
|
@ -391,20 +391,6 @@ void RimGridCrossPlot::onAxisSelected( int axis, bool toggle )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::doRemoveFromCollection()
|
||||
{
|
||||
RimGridCrossPlotCollection* crossPlotCollection = nullptr;
|
||||
this->firstAncestorOrThisOfType( crossPlotCollection );
|
||||
if ( crossPlotCollection )
|
||||
{
|
||||
crossPlotCollection->removeGridCrossPlot( this );
|
||||
crossPlotCollection->updateAllRequiredEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -648,7 +634,7 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
|
||||
{
|
||||
QString plotTitle = this->createAutoName();
|
||||
m_plotWidget->setPlotTitle( plotTitle );
|
||||
m_plotWidget->setPlotTitleEnabled( isMdiWindow() );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
|
||||
}
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
@ -774,7 +760,7 @@ void RimGridCrossPlot::updateLegend()
|
||||
{
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() && isMdiWindow() );
|
||||
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() );
|
||||
m_plotWidget->setLegendFontSize( legendFontSize() );
|
||||
for ( auto dataSet : m_crossPlotDataSets )
|
||||
{
|
||||
|
@ -141,7 +141,6 @@ private:
|
||||
void doUpdateLayout() override;
|
||||
void cleanupBeforeClose();
|
||||
|
||||
void doRemoveFromCollection() override;
|
||||
QString generateInfoBoxText() const;
|
||||
|
||||
void connectAxisSignals( RimPlotAxisProperties* axis );
|
||||
|
@ -43,17 +43,17 @@ RimGridCrossPlotCollection::~RimGridCrossPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCollection::deleteAllChildObjects()
|
||||
std::vector<RimGridCrossPlot*> RimGridCrossPlotCollection::plots() const
|
||||
{
|
||||
m_gridCrossPlots.deleteAllChildObjects();
|
||||
return m_gridCrossPlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridCrossPlot*> RimGridCrossPlotCollection::gridCrossPlots() const
|
||||
size_t RimGridCrossPlotCollection::plotCount() const
|
||||
{
|
||||
return m_gridCrossPlots.childObjects();
|
||||
return m_gridCrossPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -65,22 +65,23 @@ RimGridCrossPlot* RimGridCrossPlotCollection::createGridCrossPlot()
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
// plot->setDescription(QString("Summary Cross Plot %1").arg(m_gridCrossPlots.size()));
|
||||
addGridCrossPlot( plot );
|
||||
addPlot( plot );
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCollection::addGridCrossPlot( RimGridCrossPlot* plot )
|
||||
void RimGridCrossPlotCollection::insertPlot( RimGridCrossPlot* plot, size_t index )
|
||||
{
|
||||
m_gridCrossPlots().push_back( plot );
|
||||
m_gridCrossPlots.insert( index, plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCollection::removeGridCrossPlot( RimGridCrossPlot* plot )
|
||||
void RimGridCrossPlotCollection::removePlot( RimGridCrossPlot* plot )
|
||||
{
|
||||
m_gridCrossPlots.removeChildObject( plot );
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
@ -17,16 +17,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimGridCrossPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGridCrossPlotCollection : public caf::PdmObject
|
||||
class RimGridCrossPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimGridCrossPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -34,12 +35,12 @@ public:
|
||||
RimGridCrossPlotCollection();
|
||||
~RimGridCrossPlotCollection() override;
|
||||
|
||||
void deleteAllChildObjects();
|
||||
std::vector<RimGridCrossPlot*> plots() const final;
|
||||
size_t plotCount() const final;
|
||||
void insertPlot( RimGridCrossPlot* plot, size_t index ) final;
|
||||
void removePlot( RimGridCrossPlot* plot ) final;
|
||||
|
||||
std::vector<RimGridCrossPlot*> gridCrossPlots() const;
|
||||
RimGridCrossPlot* createGridCrossPlot();
|
||||
void addGridCrossPlot( RimGridCrossPlot* plot );
|
||||
void removeGridCrossPlot( RimGridCrossPlot* plot );
|
||||
RimGridCrossPlot* createGridCrossPlot();
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimGridCrossPlot*> m_gridCrossPlots;
|
||||
|
@ -108,11 +108,19 @@ std::vector<RimSaturationPressurePlot*>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSaturationPressurePlot*> RimSaturationPressurePlotCollection::plots()
|
||||
std::vector<RimSaturationPressurePlot*> RimSaturationPressurePlotCollection::plots() const
|
||||
{
|
||||
return m_saturationPressurePlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimSaturationPressurePlotCollection::plotCount() const
|
||||
{
|
||||
return m_saturationPressurePlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -38,7 +38,8 @@ public:
|
||||
std::vector<RimSaturationPressurePlot*> createSaturationPressurePlots( RimEclipseResultCase* eclipseResultCase,
|
||||
int timeStep );
|
||||
|
||||
std::vector<RimSaturationPressurePlot*> plots();
|
||||
std::vector<RimSaturationPressurePlot*> plots() const;
|
||||
size_t plotCount() const;
|
||||
void deleteAllChildObjects();
|
||||
|
||||
private:
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include "RicGridStatisticsDialog.h"
|
||||
@ -105,6 +106,7 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
|
||||
|
||||
CAF_PDM_InitField( &m_active, "Active", true, "Active", "", "", "" );
|
||||
m_active.uiCapability()->setUiHidden( true );
|
||||
m_active = RiaPreferences::current()->showInfoBox();
|
||||
|
||||
CAF_PDM_InitField( &m_showAnimProgress, "ShowAnimProgress", true, "Animation progress", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showCaseInfo, "ShowInfoText", true, "Case Info", "", "", "" );
|
||||
|
@ -136,7 +136,13 @@ Rim3dView::Rim3dView( void )
|
||||
CAF_PDM_InitField( &meshMode, "MeshMode", defaultMeshType, "Grid Lines", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &surfaceMode, "SurfaceMode", "Grid Surface", "", "", "" );
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_showGridBox, "ShowGridBox", true, "Show Grid Box", "", "", "" );
|
||||
CAF_PDM_InitScriptableField( &m_showGridBox,
|
||||
"ShowGridBox",
|
||||
RiaPreferences::current()->showGridBox(),
|
||||
"Show Grid Box",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_disableLighting,
|
||||
"DisableLighting",
|
||||
|
68
ApplicationCode/ProjectDataModel/RimAbstractPlotCollection.h
Normal file
68
ApplicationCode/ProjectDataModel/RimAbstractPlotCollection.h
Normal file
@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimPlot.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimAbstractPlotCollection
|
||||
{
|
||||
public:
|
||||
virtual ~RimAbstractPlotCollection() = default;
|
||||
|
||||
virtual size_t plotCount() const = 0;
|
||||
virtual void deleteAllPlots() = 0;
|
||||
virtual void removeRimPlot( RimPlot* plot ) = 0;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
/// Templated Base class of all plot collections.
|
||||
/// Specialize on plot type (has to derive from RimPlot) and the base class of the collection.
|
||||
//==================================================================================================
|
||||
template <typename RimPlotType>
|
||||
class RimTypedPlotCollection : public RimAbstractPlotCollection
|
||||
{
|
||||
static_assert( std::is_base_of<RimPlot, RimPlotType>::value, "RimPlotType must inherit from RimPlot" );
|
||||
|
||||
public:
|
||||
~RimTypedPlotCollection() override = default;
|
||||
|
||||
virtual std::vector<RimPlotType*> plots() const = 0;
|
||||
|
||||
void deleteAllPlots() override
|
||||
{
|
||||
for ( auto plot : plots() )
|
||||
{
|
||||
removePlot( plot );
|
||||
delete plot;
|
||||
}
|
||||
}
|
||||
|
||||
void addPlot( RimPlotType* plot ) { insertPlot( plot, plotCount() ); }
|
||||
virtual void insertPlot( RimPlotType* plot, size_t index ) = 0;
|
||||
virtual void removePlot( RimPlotType* plot ) = 0;
|
||||
void removeRimPlot( RimPlot* rimPlot )
|
||||
{
|
||||
auto typedPlot = dynamic_cast<RimPlotType*>( rimPlot );
|
||||
if ( typedPlot )
|
||||
{
|
||||
removePlot( typedPlot );
|
||||
}
|
||||
}
|
||||
};
|
@ -79,14 +79,13 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimContourMapProjection, "RimContourMapProjection"
|
||||
RimContourMapProjection::RimContourMapProjection()
|
||||
: m_pickPoint( cvf::Vec2d::UNDEFINED )
|
||||
, m_mapSize( cvf::Vec2ui( 0u, 0u ) )
|
||||
, m_sampleSpacing( -1.0 )
|
||||
, m_currentResultTimestep( -1 )
|
||||
, m_minResultAllTimeSteps( std::numeric_limits<double>::infinity() )
|
||||
, m_maxResultAllTimeSteps( -std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_relativeSampleSpacing, "SampleSpacing", 0.8, "Sample Spacing Factor", "", "", "" );
|
||||
CAF_PDM_InitField( &m_relativeSampleSpacing, "SampleSpacing", 0.9, "Sample Spacing Factor", "", "", "" );
|
||||
m_relativeSampleSpacing.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_resultAggregation, "ResultAggregation", "Result Aggregation", "", "", "" );
|
||||
@ -169,23 +168,23 @@ std::vector<cvf::Vec3d> RimContourMapProjection::generatePickPointPolygon()
|
||||
{
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
cvf::Vec2d cellDiagonal( m_sampleSpacing * 0.5, m_sampleSpacing * 0.5 );
|
||||
cvf::Vec2d cellDiagonal( sampleSpacing() * 0.5, sampleSpacing() * 0.5 );
|
||||
cvf::Vec2ui pickedCell = ijFromLocalPos( m_pickPoint );
|
||||
cvf::Vec2d cellCenter = cellCenterPosition( pickedCell.x(), pickedCell.y() );
|
||||
cvf::Vec2d cellCorner = cellCenter - cellDiagonal;
|
||||
points.push_back( cvf::Vec3d( cellCorner, 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( m_sampleSpacing, 0.0 ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( m_sampleSpacing, 0.0 ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( m_sampleSpacing, m_sampleSpacing ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( m_sampleSpacing, m_sampleSpacing ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, m_sampleSpacing ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, m_sampleSpacing ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), 0.0 ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), 0.0 ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), sampleSpacing() ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), sampleSpacing() ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing() ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing() ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( cellCorner, 0.0 ) );
|
||||
#endif
|
||||
points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.5 * m_sampleSpacing, 0.0 ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.5 * m_sampleSpacing, 0.0 ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.0, 0.5 * m_sampleSpacing ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.0, 0.5 * m_sampleSpacing ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.5 * sampleSpacing(), 0.0 ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.5 * sampleSpacing(), 0.0 ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.0, 0.5 * sampleSpacing() ), 0.0 ) );
|
||||
points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.0, 0.5 * sampleSpacing() ), 0.0 ) );
|
||||
}
|
||||
}
|
||||
return points;
|
||||
@ -219,17 +218,17 @@ const std::vector<cvf::Vec4d>& RimContourMapProjection::trianglesWithVertexValue
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimContourMapProjection::sampleSpacing() const
|
||||
double RimContourMapProjection::sampleSpacingFactor() const
|
||||
{
|
||||
return m_sampleSpacing;
|
||||
return m_relativeSampleSpacing();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimContourMapProjection::sampleSpacingFactor() const
|
||||
void RimContourMapProjection::setSampleSpacingFactor( double spacingFactor )
|
||||
{
|
||||
return m_relativeSampleSpacing();
|
||||
m_relativeSampleSpacing = spacingFactor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -845,7 +844,7 @@ void RimContourMapProjection::generateTrianglesWithVertexValues()
|
||||
}
|
||||
}
|
||||
|
||||
const double cellArea = m_sampleSpacing * m_sampleSpacing;
|
||||
const double cellArea = sampleSpacing() * sampleSpacing();
|
||||
const double areaThreshold = 1.0e-5 * 0.5 * cellArea;
|
||||
|
||||
std::vector<std::vector<std::vector<cvf::Vec3d>>> subtractPolygons;
|
||||
@ -977,11 +976,11 @@ void RimContourMapProjection::generateTrianglesWithVertexValues()
|
||||
std::vector<cvf::Vec3d> clippedTriangle;
|
||||
if ( v == clippedPolygon.size() - 1 )
|
||||
{
|
||||
clippedTriangle = {clippedPolygon[v], clippedPolygon[0], baryCenter};
|
||||
clippedTriangle = { clippedPolygon[v], clippedPolygon[0], baryCenter };
|
||||
}
|
||||
else
|
||||
{
|
||||
clippedTriangle = {clippedPolygon[v], clippedPolygon[v + 1], baryCenter};
|
||||
clippedTriangle = { clippedPolygon[v], clippedPolygon[v + 1], baryCenter };
|
||||
}
|
||||
polygonTriangles.push_back( clippedTriangle );
|
||||
}
|
||||
@ -1005,7 +1004,7 @@ void RimContourMapProjection::generateTrianglesWithVertexValues()
|
||||
{
|
||||
for ( size_t n = 0; n < 3; ++n )
|
||||
{
|
||||
if ( ( triangle[n] - localVertex ).length() < m_sampleSpacing * 0.01 &&
|
||||
if ( ( triangle[n] - localVertex ).length() < sampleSpacing() * 0.01 &&
|
||||
triangleWithValues[n].w() != std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
value = triangleWithValues[n].w();
|
||||
@ -1077,8 +1076,8 @@ std::vector<cvf::Vec3d> RimContourMapProjection::generateVertices() const
|
||||
cvf::Vec2ui ij = ijFromVertexIndex( index );
|
||||
cvf::Vec2d mapPos = cellCenterPosition( ij.x(), ij.y() );
|
||||
// Shift away from sample point to vertex
|
||||
mapPos.x() -= m_sampleSpacing * 0.5;
|
||||
mapPos.y() -= m_sampleSpacing * 0.5;
|
||||
mapPos.x() -= sampleSpacing() * 0.5;
|
||||
mapPos.y() -= sampleSpacing() * 0.5;
|
||||
|
||||
cvf::Vec3d vertexPos( mapPos, 0.0 );
|
||||
vertices[index] = vertexPos;
|
||||
@ -1114,7 +1113,7 @@ void RimContourMapProjection::generateContourPolygons()
|
||||
contourLevels.front() *= 0.5;
|
||||
}
|
||||
|
||||
double simplifyEpsilon = m_smoothContourLines() ? 5.0e-2 * m_sampleSpacing : 1.0e-3 * m_sampleSpacing;
|
||||
double simplifyEpsilon = m_smoothContourLines() ? 5.0e-2 * sampleSpacing() : 1.0e-3 * sampleSpacing();
|
||||
|
||||
if ( nContourLevels >= 10 )
|
||||
{
|
||||
@ -1175,7 +1174,7 @@ RimContourMapProjection::ContourPolygons
|
||||
double contourValue )
|
||||
{
|
||||
const double areaThreshold =
|
||||
1.5 * ( m_sampleSpacing * m_sampleSpacing ) / ( sampleSpacingFactor() * sampleSpacingFactor() );
|
||||
1.5 * ( sampleSpacing() * sampleSpacing() ) / ( sampleSpacingFactor() * sampleSpacingFactor() );
|
||||
|
||||
ContourPolygons contourPolygons;
|
||||
|
||||
@ -1253,7 +1252,7 @@ void RimContourMapProjection::smoothContourPolygons( ContourPolygons* contourPol
|
||||
maxChange = std::max( maxChange, ( modifiedVertex - v ).length() );
|
||||
}
|
||||
polygon.vertices.swap( newVertices );
|
||||
if ( maxChange < m_sampleSpacing * 1.0e-2 ) break;
|
||||
if ( maxChange < sampleSpacing() * 1.0e-2 ) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1317,7 +1316,7 @@ std::vector<RimContourMapProjection::CellIndexAndResult>
|
||||
{
|
||||
cvf::Vec3d top2dElementCentroid( globalPos2d, m_expandedBoundingBox.max().z() );
|
||||
cvf::Vec3d bottom2dElementCentroid( globalPos2d, m_expandedBoundingBox.min().z() );
|
||||
cvf::Vec3d planarDiagonalVector( 0.5 * m_sampleSpacing, 0.5 * m_sampleSpacing, 0.0 );
|
||||
cvf::Vec3d planarDiagonalVector( 0.5 * sampleSpacing(), 0.5 * sampleSpacing(), 0.0 );
|
||||
cvf::Vec3d topNECorner = top2dElementCentroid + planarDiagonalVector;
|
||||
cvf::Vec3d bottomSWCorner = bottom2dElementCentroid - planarDiagonalVector;
|
||||
|
||||
@ -1455,10 +1454,10 @@ double RimContourMapProjection::interpolateValue( const cvf::Vec2d& gridPos2d )
|
||||
cvf::Vec2d cellCenter = cellCenterPosition( cellContainingPoint.x(), cellContainingPoint.y() );
|
||||
|
||||
std::array<cvf::Vec3d, 4> x;
|
||||
x[0] = cvf::Vec3d( cellCenter + cvf::Vec2d( -m_sampleSpacing * 0.5, -m_sampleSpacing * 0.5 ), 0.0 );
|
||||
x[1] = cvf::Vec3d( cellCenter + cvf::Vec2d( m_sampleSpacing * 0.5, -m_sampleSpacing * 0.5 ), 0.0 );
|
||||
x[2] = cvf::Vec3d( cellCenter + cvf::Vec2d( m_sampleSpacing * 0.5, m_sampleSpacing * 0.5 ), 0.0 );
|
||||
x[3] = cvf::Vec3d( cellCenter + cvf::Vec2d( -m_sampleSpacing * 0.5, m_sampleSpacing * 0.5 ), 0.0 );
|
||||
x[0] = cvf::Vec3d( cellCenter + cvf::Vec2d( -sampleSpacing() * 0.5, -sampleSpacing() * 0.5 ), 0.0 );
|
||||
x[1] = cvf::Vec3d( cellCenter + cvf::Vec2d( sampleSpacing() * 0.5, -sampleSpacing() * 0.5 ), 0.0 );
|
||||
x[2] = cvf::Vec3d( cellCenter + cvf::Vec2d( sampleSpacing() * 0.5, sampleSpacing() * 0.5 ), 0.0 );
|
||||
x[3] = cvf::Vec3d( cellCenter + cvf::Vec2d( -sampleSpacing() * 0.5, sampleSpacing() * 0.5 ), 0.0 );
|
||||
|
||||
cvf::Vec4d baryCentricCoords =
|
||||
cvf::GeometryTools::barycentricCoords( x[0], x[1], x[2], x[3], cvf::Vec3d( gridPos2d, 0.0 ) );
|
||||
@ -1615,8 +1614,8 @@ cvf::Vec2ui RimContourMapProjection::ijFromCellIndex( size_t cellIndex ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec2ui RimContourMapProjection::ijFromLocalPos( const cvf::Vec2d& localPos2d ) const
|
||||
{
|
||||
uint i = localPos2d.x() / m_sampleSpacing;
|
||||
uint j = localPos2d.y() / m_sampleSpacing;
|
||||
uint i = localPos2d.x() / sampleSpacing();
|
||||
uint j = localPos2d.y() / sampleSpacing();
|
||||
return cvf::Vec2ui( i, j );
|
||||
}
|
||||
|
||||
@ -1629,7 +1628,7 @@ cvf::Vec2d RimContourMapProjection::cellCenterPosition( uint i, uint j ) const
|
||||
cvf::Vec2d cellCorner =
|
||||
cvf::Vec2d( ( i * gridExtent.x() ) / ( m_mapSize.x() ), ( j * gridExtent.y() ) / ( m_mapSize.y() ) );
|
||||
|
||||
return cellCorner + cvf::Vec2d( m_sampleSpacing * 0.5, m_sampleSpacing * 0.5 );
|
||||
return cellCorner + cvf::Vec2d( sampleSpacing() * 0.5, sampleSpacing() * 0.5 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1683,8 +1682,8 @@ cvf::Vec2ui RimContourMapProjection::calculateMapSize() const
|
||||
{
|
||||
cvf::Vec3d gridExtent = m_expandedBoundingBox.extent();
|
||||
|
||||
uint projectionSizeX = static_cast<uint>( std::ceil( gridExtent.x() / m_sampleSpacing ) );
|
||||
uint projectionSizeY = static_cast<uint>( std::ceil( gridExtent.y() / m_sampleSpacing ) );
|
||||
uint projectionSizeX = static_cast<uint>( std::ceil( gridExtent.x() / sampleSpacing() ) );
|
||||
uint projectionSizeY = static_cast<uint>( std::ceil( gridExtent.y() / sampleSpacing() ) );
|
||||
|
||||
return cvf::Vec2ui( projectionSizeX, projectionSizeY );
|
||||
}
|
||||
@ -1694,7 +1693,7 @@ cvf::Vec2ui RimContourMapProjection::calculateMapSize() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimContourMapProjection::gridEdgeOffset() const
|
||||
{
|
||||
return m_sampleSpacing * 2.0;
|
||||
return sampleSpacing() * 2.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
@ -83,8 +84,10 @@ public:
|
||||
const std::vector<ContourPolygons>& contourPolygons() const;
|
||||
const std::vector<cvf::Vec4d>& trianglesWithVertexValues();
|
||||
|
||||
double sampleSpacing() const;
|
||||
virtual double sampleSpacing() const = 0;
|
||||
|
||||
double sampleSpacingFactor() const;
|
||||
void setSampleSpacingFactor( double spacingFactor );
|
||||
bool showContourLines() const;
|
||||
|
||||
QString resultAggregationText() const;
|
||||
@ -209,7 +212,8 @@ protected:
|
||||
void initAfterRead() override;
|
||||
|
||||
protected:
|
||||
caf::PdmField<double> m_relativeSampleSpacing;
|
||||
caf::PdmField<double> m_relativeSampleSpacing;
|
||||
|
||||
caf::PdmField<ResultAggregation> m_resultAggregation;
|
||||
caf::PdmField<bool> m_showContourLines;
|
||||
caf::PdmField<bool> m_showContourLabels;
|
||||
@ -224,7 +228,6 @@ protected:
|
||||
cvf::Vec2ui m_mapSize;
|
||||
cvf::BoundingBox m_expandedBoundingBox;
|
||||
cvf::BoundingBox m_gridBoundingBox;
|
||||
double m_sampleSpacing;
|
||||
std::vector<ContourPolygons> m_contourPolygons;
|
||||
std::vector<double> m_contourLevelCumulativeAreas;
|
||||
std::vector<cvf::Vec4d> m_trianglesWithVertexValues;
|
||||
|
@ -26,8 +26,12 @@
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
@ -86,7 +90,8 @@ RimDepthTrackPlot::RimDepthTrackPlot()
|
||||
m_commonDataSource.xmlCapability()->disableIO();
|
||||
m_commonDataSource = new RimWellLogCurveCommonDataSource;
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_showPlotWindowTitle, "ShowTitleInPlot", true, "Show Title", "", "", "" );
|
||||
CAF_PDM_InitScriptableField( &m_showPlotWindowTitle_OBSOLETE, "ShowTitleInPlot", false, "Show Title", "", "", "" );
|
||||
m_showPlotWindowTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
|
||||
CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name", "", "", "" );
|
||||
m_plotWindowTitle.xmlCapability()->setIOWritable( false );
|
||||
@ -120,10 +125,10 @@ RimDepthTrackPlot::RimDepthTrackPlot()
|
||||
auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots );
|
||||
reorderability->orderChanged.connect( this, &RimDepthTrackPlot::onPlotsReordered );
|
||||
|
||||
m_availableDepthUnits = {RiaDefines::DepthUnitType::UNIT_METER, RiaDefines::DepthUnitType::UNIT_FEET};
|
||||
m_availableDepthTypes = {RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
|
||||
RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH,
|
||||
RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB};
|
||||
m_availableDepthUnits = { RiaDefines::DepthUnitType::UNIT_METER, RiaDefines::DepthUnitType::UNIT_FEET };
|
||||
m_availableDepthTypes = { RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
|
||||
RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH,
|
||||
RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB };
|
||||
|
||||
m_minAvailableDepth = HUGE_VAL;
|
||||
m_maxAvailableDepth = -HUGE_VAL;
|
||||
@ -148,6 +153,46 @@ RimDepthTrackPlot::~RimDepthTrackPlot()
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Move-assignment operator. Argument has to be passed with std::move()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDepthTrackPlot& RimDepthTrackPlot::operator=( RimDepthTrackPlot&& rhs )
|
||||
{
|
||||
RimPlotWindow::operator=( std::move( rhs ) );
|
||||
|
||||
// Move all tracks
|
||||
std::vector<RimPlot*> plots = rhs.m_plots.childObjects();
|
||||
rhs.m_plots.clear();
|
||||
for ( RimPlot* plot : plots )
|
||||
{
|
||||
m_plots.push_back( plot );
|
||||
}
|
||||
|
||||
// Deliberately don't set m_plotWindowTitle and m_nameConfig. This operator is used for copying parameters from
|
||||
// children. This only happens for some plots that used to own a plot but now inherits the plot.
|
||||
// They had their own description at top level which we don't want to overwrite.
|
||||
|
||||
auto dataSource = rhs.m_commonDataSource();
|
||||
rhs.m_commonDataSource.removeChildObject( dataSource );
|
||||
m_commonDataSource = dataSource;
|
||||
m_commonDataSourceEnabled = rhs.m_commonDataSourceEnabled;
|
||||
|
||||
m_depthType = rhs.m_depthType();
|
||||
m_depthUnit = rhs.m_depthUnit();
|
||||
m_minVisibleDepth = rhs.m_minVisibleDepth();
|
||||
m_maxVisibleDepth = rhs.m_maxVisibleDepth();
|
||||
m_depthAxisGridVisibility = rhs.m_depthAxisGridVisibility();
|
||||
m_isAutoScaleDepthEnabled = rhs.m_isAutoScaleDepthEnabled();
|
||||
|
||||
m_subTitleFontSize = rhs.m_subTitleFontSize();
|
||||
m_axisTitleFontSize = rhs.m_axisTitleFontSize();
|
||||
m_axisValueFontSize = rhs.m_axisValueFontSize();
|
||||
|
||||
m_minAvailableDepth = rhs.m_minAvailableDepth;
|
||||
m_maxAvailableDepth = rhs.m_maxAvailableDepth;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -172,68 +217,6 @@ QString RimDepthTrackPlot::description() const
|
||||
return m_plotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimDepthTrackPlot::isPlotTitleVisible() const
|
||||
{
|
||||
return m_showPlotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::setPlotTitleVisible( bool visible )
|
||||
{
|
||||
m_showPlotWindowTitle = visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::addPlot( RimPlot* plot )
|
||||
{
|
||||
insertPlot( plot, m_plots.size() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::insertPlot( RimPlot* plot, size_t index )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
m_plots.insert( index, plot );
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
plot->createPlotWidget();
|
||||
m_viewer->insertPlot( plot->viewer(), index );
|
||||
}
|
||||
plot->setShowWindow( true );
|
||||
plot->setLegendsVisible( false );
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::removePlot( RimPlot* plot )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->removePlot( plot->viewer() );
|
||||
}
|
||||
m_plots.removeChildObject( plot );
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -400,6 +383,38 @@ void RimDepthTrackPlot::visibleDepthRange( double* minimumDepth, double* maximum
|
||||
*maximumDepth = m_maxVisibleDepth;
|
||||
}
|
||||
|
||||
RiaDefines::DepthUnitType RimDepthTrackPlot::caseDepthUnit() const
|
||||
{
|
||||
RimEclipseResultCase* thecase = dynamic_cast<RimEclipseResultCase*>( commonDataSource()->caseToApply() );
|
||||
if ( thecase == nullptr )
|
||||
{
|
||||
// no suitable case found, look in the project to see if there is a eclipse case with units defined loaded
|
||||
RimProject* p = RiaApplication::instance()->project();
|
||||
for ( RimEclipseCase* aCase : p->activeOilField()->analysisModels()->cases() )
|
||||
{
|
||||
thecase = dynamic_cast<RimEclipseResultCase*>( aCase );
|
||||
if ( thecase ) break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( thecase )
|
||||
{
|
||||
switch ( thecase->unitSystem() )
|
||||
{
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_FIELD:
|
||||
return RiaDefines::DepthUnitType::UNIT_FEET;
|
||||
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_METRIC:
|
||||
return RiaDefines::DepthUnitType::UNIT_METER;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return RiaDefines::DepthUnitType::UNIT_NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -425,7 +440,7 @@ void RimDepthTrackPlot::uiOrderingForDepthAxis( QString uiConfigName, caf::PdmUi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::uiOrderingForAutoName( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_showPlotWindowTitle );
|
||||
uiOrdering.add( &m_showPlotTitle );
|
||||
m_nameConfig->uiOrdering( uiConfigName, uiOrdering );
|
||||
}
|
||||
|
||||
@ -559,7 +574,7 @@ void RimDepthTrackPlot::performAutoNameUpdate()
|
||||
m_plotWindowTitle = createAutoName();
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->setTitleVisible( m_showPlotWindowTitle() );
|
||||
m_viewer->setTitleVisible( m_showPlotTitle() );
|
||||
m_viewer->setPlotTitle( m_plotWindowTitle );
|
||||
}
|
||||
updateMdiWindowTitle();
|
||||
@ -692,7 +707,7 @@ void RimDepthTrackPlot::onPlotAdditionOrRemoval()
|
||||
calculateAvailableDepthRange();
|
||||
updateZoom();
|
||||
updateSubPlotNames();
|
||||
updateConnectedEditors();
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -729,7 +744,6 @@ void RimDepthTrackPlot::onPlotsReordered( const SignalEmitter* emitter )
|
||||
recreatePlotWidgets();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -819,14 +833,14 @@ void RimDepthTrackPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
else if ( changedField == &m_depthUnit )
|
||||
{
|
||||
m_isAutoScaleDepthEnabled = true;
|
||||
updateZoom();
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
else if ( changedField == &m_subTitleFontSize || changedField == &m_axisTitleFontSize ||
|
||||
changedField == &m_axisValueFontSize )
|
||||
{
|
||||
updateFonts();
|
||||
}
|
||||
else if ( changedField == &m_showPlotWindowTitle )
|
||||
else if ( changedField == &m_showPlotTitle )
|
||||
{
|
||||
performAutoNameUpdate();
|
||||
}
|
||||
@ -910,11 +924,15 @@ void RimDepthTrackPlot::initAfterRead()
|
||||
m_depthAxisGridVisibility = AXIS_GRID_MAJOR_AND_MINOR;
|
||||
}
|
||||
|
||||
if ( m_showPlotWindowTitle_OBSOLETE() )
|
||||
{
|
||||
m_showPlotTitle = true;
|
||||
}
|
||||
|
||||
if ( !m_plotWindowTitle().isEmpty() )
|
||||
{
|
||||
m_nameConfig->setCustomName( m_plotWindowTitle );
|
||||
}
|
||||
|
||||
performAutoNameUpdate();
|
||||
}
|
||||
|
||||
@ -970,6 +988,42 @@ caf::PdmFieldHandle* RimDepthTrackPlot::userDescriptionField()
|
||||
return &m_plotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::insertPlot( RimPlot* plot, size_t index )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
m_plots.insert( index, plot );
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
plot->createPlotWidget();
|
||||
m_viewer->insertPlot( plot->viewer(), index );
|
||||
}
|
||||
plot->setShowWindow( true );
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::removePlot( RimPlot* plot )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->removePlot( plot->viewer() );
|
||||
}
|
||||
m_plots.removeChildObject( plot );
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1098,6 +1152,9 @@ void RimDepthTrackPlot::setDepthUnit( RiaDefines::DepthUnitType depthUnit )
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
|
@ -19,6 +19,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
@ -26,10 +31,6 @@
|
||||
#include "cafPdmFieldHandle.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <set>
|
||||
@ -43,7 +44,7 @@ class QKeyEvent;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimDepthTrackPlot : public RimPlotWindow, public RimNameConfigHolderInterface
|
||||
class RimDepthTrackPlot : public RimTypedPlotCollection<RimPlot>, public RimPlotWindow, public RimNameConfigHolderInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -63,23 +64,20 @@ public:
|
||||
RimDepthTrackPlot();
|
||||
~RimDepthTrackPlot() override;
|
||||
|
||||
RimDepthTrackPlot& operator=( RimDepthTrackPlot&& rhs );
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
QWidget* createPlotWidget( QWidget* mainWindowParent = nullptr );
|
||||
QString description() const override;
|
||||
|
||||
bool isPlotTitleVisible() const;
|
||||
void setPlotTitleVisible( bool visible );
|
||||
|
||||
void addPlot( RimPlot* plot );
|
||||
void insertPlot( RimPlot* plot, size_t index );
|
||||
void removePlot( RimPlot* plot );
|
||||
|
||||
size_t plotCount() const;
|
||||
size_t plotCount() const override;
|
||||
size_t plotIndex( const RimPlot* plot ) const;
|
||||
RimPlot* plotByIndex( size_t index ) const;
|
||||
|
||||
std::vector<RimPlot*> plots() const;
|
||||
std::vector<RimPlot*> plots() const override;
|
||||
std::vector<RimPlot*> visiblePlots() const;
|
||||
void insertPlot( RimPlot* plot, size_t index ) final;
|
||||
void removePlot( RimPlot* plot ) final;
|
||||
|
||||
DepthTypeEnum depthType() const;
|
||||
void setDepthType( DepthTypeEnum depthType );
|
||||
@ -127,6 +125,8 @@ public:
|
||||
int axisTitleFontSize() const;
|
||||
int axisValueFontSize() const;
|
||||
|
||||
RiaDefines::DepthUnitType caseDepthUnit() const;
|
||||
|
||||
protected:
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
@ -155,13 +155,13 @@ private:
|
||||
void onPlotAdditionOrRemoval();
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
void doUpdateLayout() override;
|
||||
void onPlotsReordered( const SignalEmitter* emitter );
|
||||
void onPlotsReordered( const caf::SignalEmitter* emitter );
|
||||
|
||||
protected:
|
||||
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
|
||||
bool m_commonDataSourceEnabled;
|
||||
|
||||
caf::PdmField<bool> m_showPlotWindowTitle;
|
||||
caf::PdmField<bool> m_showPlotWindowTitle_OBSOLETE;
|
||||
caf::PdmField<QString> m_plotWindowTitle;
|
||||
caf::PdmField<caf::AppEnum<DepthTypeEnum>> m_depthType;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::DepthUnitType>> m_depthUnit;
|
||||
|
@ -147,6 +147,18 @@ void RimEclipseContourMapProjection::updateLegend()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimEclipseContourMapProjection::sampleSpacing() const
|
||||
{
|
||||
if ( m_mainGrid.notNull() )
|
||||
{
|
||||
return m_relativeSampleSpacing * m_mainGrid->characteristicIJCellSize();
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -324,8 +336,8 @@ std::vector<double> RimEclipseContourMapProjection::calculateColumnResult( Resul
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseContourMapProjection::updateGridInformation()
|
||||
{
|
||||
m_mainGrid = eclipseCase()->eclipseCaseData()->mainGrid();
|
||||
m_sampleSpacing = m_relativeSampleSpacing * m_mainGrid->characteristicIJCellSize();
|
||||
m_mainGrid = eclipseCase()->eclipseCaseData()->mainGrid();
|
||||
|
||||
m_gridBoundingBox = eclipseCase()->activeCellsBoundingBox();
|
||||
cvf::Vec3d minExpandedPoint = m_gridBoundingBox.min() - cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 );
|
||||
cvf::Vec3d maxExpandedPoint = m_gridBoundingBox.max() + cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 );
|
||||
@ -336,8 +348,8 @@ void RimEclipseContourMapProjection::updateGridInformation()
|
||||
// Re-jig max point to be an exact multiple of cell size
|
||||
cvf::Vec3d minPoint = m_expandedBoundingBox.min();
|
||||
cvf::Vec3d maxPoint = m_expandedBoundingBox.max();
|
||||
maxPoint.x() = minPoint.x() + m_mapSize.x() * m_sampleSpacing;
|
||||
maxPoint.y() = minPoint.y() + m_mapSize.y() * m_sampleSpacing;
|
||||
maxPoint.x() = minPoint.x() + m_mapSize.x() * sampleSpacing();
|
||||
maxPoint.y() = minPoint.y() + m_mapSize.y() * sampleSpacing();
|
||||
m_expandedBoundingBox = cvf::BoundingBox( minPoint, maxPoint );
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,8 @@ public:
|
||||
RimRegularLegendConfig* legendConfig() const override;
|
||||
void updateLegend() override;
|
||||
|
||||
double sampleSpacing() const override;
|
||||
|
||||
protected:
|
||||
typedef RimContourMapProjection::CellIndexAndResult CellIndexAndResult;
|
||||
|
||||
|
@ -315,6 +315,14 @@ bool RimEclipseResultCase::openAndReadActiveCellData( RigEclipseCaseData* mainEc
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaEclipseUnitTools::UnitSystemType RimEclipseResultCase::unitSystem()
|
||||
{
|
||||
return m_unitSystem();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
bool openAndReadActiveCellData( RigEclipseCaseData* mainEclipseCase );
|
||||
void readGridDimensions( std::vector<std::vector<int>>& gridDimensions );
|
||||
|
||||
RiaEclipseUnitTools::UnitSystemType unitSystem();
|
||||
|
||||
// Overrides from RimCase
|
||||
QString locationOnDisc() const override;
|
||||
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override;
|
||||
|
@ -703,9 +703,11 @@ void RimExtrudedCurveIntersection::setPushButtonText( bool buttonEnable, caf::Pd
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimExtrudedCurveIntersection::setBaseColor( bool enable, caf::PdmUiListEditorAttribute* attribute )
|
||||
{
|
||||
if ( attribute && enable )
|
||||
// if ( attribute && enable )
|
||||
if ( attribute )
|
||||
{
|
||||
attribute->m_baseColor.setRgb( 255, 220, 255 );
|
||||
attribute->m_qssState = enable ? "ExternalInput" : QString();
|
||||
// attribute->m_baseColor.setRgb( 255, 220, 255 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -379,10 +379,23 @@ std::vector<double> RimFractureModelPlot::calculateStress() const
|
||||
{
|
||||
std::vector<double> stress;
|
||||
std::vector<double> stressGradients;
|
||||
calculateStressWithGradients( stress, stressGradients );
|
||||
std::vector<double> initialStress;
|
||||
calculateStressWithGradients( stress, stressGradients, initialStress );
|
||||
return stress;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimFractureModelPlot::calculateInitialStress() const
|
||||
{
|
||||
std::vector<double> stress;
|
||||
std::vector<double> stressGradients;
|
||||
std::vector<double> initialStress;
|
||||
calculateStressWithGradients( stress, stressGradients, initialStress );
|
||||
return initialStress;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -402,7 +415,8 @@ std::vector<double> RimFractureModelPlot::findCurveXValuesByProperty( RiaDefines
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFractureModelPlot::calculateStressWithGradients( std::vector<double>& stress,
|
||||
std::vector<double>& stressGradients ) const
|
||||
std::vector<double>& stressGradients,
|
||||
std::vector<double>& initialStress ) const
|
||||
{
|
||||
// Reference stress
|
||||
const double verticalStressRef = m_fractureModel->verticalStress();
|
||||
@ -468,6 +482,8 @@ bool RimFractureModelPlot::calculateStressWithGradients( std::vector<double>& st
|
||||
double depletionStress = Sh_init + deltaHorizontalStress;
|
||||
stress.push_back( RiaEclipseUnitTools::barToPsi( depletionStress ) );
|
||||
|
||||
initialStress.push_back( RiaEclipseUnitTools::barToPsi( Sh_init ) );
|
||||
|
||||
// Cache some results for the gradients calculation
|
||||
stressForGradients.push_back( Sv );
|
||||
pressureForGradients.push_back( initialPressure );
|
||||
@ -493,12 +509,12 @@ bool RimFractureModelPlot::calculateStressWithGradients( std::vector<double>& st
|
||||
// Second pass to calculate the stress gradients
|
||||
for ( size_t i = 0; i < layerBoundaryDepths.size(); i++ )
|
||||
{
|
||||
double diffStress = stressForGradients[i + 1] - stressForGradients[i];
|
||||
double diffPressure = pressureForGradients[i + 1] - pressureForGradients[i];
|
||||
double diffDepth = depthForGradients[i + 1] - depthForGradients[i];
|
||||
double k0 = findValueAtTopOfLayer( k0Data, layerBoundaryIndexes, i );
|
||||
double gradient = ( diffStress * k0 + diffPressure * ( 1.0 - k0 ) ) / diffDepth;
|
||||
stressGradients.push_back( RiaEclipseUnitTools::barPerMeterToPsiPerFeet( gradient ) );
|
||||
double diffStress = stressForGradients[i + 1] - stressForGradients[i];
|
||||
double diffPressure = pressureForGradients[i + 1] - pressureForGradients[i];
|
||||
double diffDepth = depthForGradients[i + 1] - depthForGradients[i];
|
||||
double k0 = findValueAtTopOfLayer( k0Data, layerBoundaryIndexes, i );
|
||||
double stressGradient = ( diffStress * k0 + diffPressure * ( 1.0 - k0 ) ) / diffDepth;
|
||||
stressGradients.push_back( RiaEclipseUnitTools::barPerMeterToPsiPerFeet( stressGradient ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -511,7 +527,8 @@ std::vector<double> RimFractureModelPlot::calculateStressGradient() const
|
||||
{
|
||||
std::vector<double> stress;
|
||||
std::vector<double> stressGradients;
|
||||
calculateStressWithGradients( stress, stressGradients );
|
||||
std::vector<double> initialStress;
|
||||
calculateStressWithGradients( stress, stressGradients, initialStress );
|
||||
return stressGradients;
|
||||
}
|
||||
|
||||
|
@ -34,26 +34,6 @@ class RimFractureModelPlot : public RimDepthTrackPlot
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum class PropertyType
|
||||
{
|
||||
FACIES,
|
||||
LAYERS,
|
||||
POROSITY,
|
||||
PERMEABILITY_X,
|
||||
PERMEABILITY_Z,
|
||||
INITIAL_PRESSURE,
|
||||
PRESSURE,
|
||||
STRESS,
|
||||
STRESS_GRADIENT,
|
||||
YOUNGS_MODULUS,
|
||||
POISSONS_RATIO,
|
||||
K_IC,
|
||||
PROPPANT_EMBEDMENT,
|
||||
BIOT_COEFFICIENT,
|
||||
K0,
|
||||
FLUID_LOSS_COEFFICIENT,
|
||||
};
|
||||
|
||||
RimFractureModelPlot();
|
||||
|
||||
void setFractureModel( RimFractureModel* fractureModel );
|
||||
@ -69,6 +49,7 @@ public:
|
||||
std::vector<double> calculateHorizontalPermeability() const;
|
||||
std::vector<double> calculateReservoirPressure() const;
|
||||
std::vector<double> calculateStress() const;
|
||||
std::vector<double> calculateInitialStress() const;
|
||||
std::vector<double> calculateStressGradient() const;
|
||||
std::vector<double> calculateYoungsModulus() const;
|
||||
std::vector<double> calculatePoissonsRatio() const;
|
||||
@ -93,7 +74,9 @@ protected:
|
||||
void calculateLayers( std::vector<std::pair<double, double>>& layerBoundaryDepths,
|
||||
std::vector<std::pair<size_t, size_t>>& layerBoundaryIndexes ) const;
|
||||
RimWellLogExtractionCurve* findCurveByProperty( RiaDefines::CurveProperty curveProperty ) const;
|
||||
bool calculateStressWithGradients( std::vector<double>& stress, std::vector<double>& stressGradients ) const;
|
||||
bool calculateStressWithGradients( std::vector<double>& stress,
|
||||
std::vector<double>& stressGradients,
|
||||
std::vector<double>& initialStress ) const;
|
||||
|
||||
static double findValueAtTopOfLayer( const std::vector<double>& values,
|
||||
const std::vector<std::pair<size_t, size_t>>& layerBoundaryIndexes,
|
||||
|
@ -128,6 +128,12 @@ void RimFractureModelStressCurve::performDataExtraction( bool* isUsingPseudoLeng
|
||||
std::vector<double> stressGradients = fractureModelPlot->calculateStressGradient();
|
||||
addDatapointsForBottomOfLayers( tvDepthValues, values, stressGradients );
|
||||
}
|
||||
else if ( m_curveProperty() == RiaDefines::CurveProperty::INITIAL_STRESS )
|
||||
{
|
||||
values = fractureModelPlot->calculateInitialStress();
|
||||
std::vector<double> stressGradients = fractureModelPlot->calculateStressGradient();
|
||||
addDatapointsForBottomOfLayers( tvDepthValues, values, stressGradients );
|
||||
}
|
||||
else if ( m_curveProperty() == RiaDefines::CurveProperty::STRESS_GRADIENT )
|
||||
{
|
||||
values = fractureModelPlot->calculateStressGradient();
|
||||
|
@ -41,12 +41,6 @@ class RimFractureModelStressCurve : public RimWellLogExtractionCurve, public Rim
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum class PropertyType
|
||||
{
|
||||
STRESS,
|
||||
STRESS_GRADIENT
|
||||
};
|
||||
|
||||
RimFractureModelStressCurve();
|
||||
~RimFractureModelStressCurve() override;
|
||||
|
||||
|
@ -130,6 +130,19 @@ void RimGeoMechContourMapProjection::updateLegend()
|
||||
legendConfig()->setTitle( projectionLegendText );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimGeoMechContourMapProjection::sampleSpacing() const
|
||||
{
|
||||
RimGeoMechCase* geoMechCase = this->geoMechCase();
|
||||
if ( geoMechCase )
|
||||
{
|
||||
return m_relativeSampleSpacing * geoMechCase->characteristicCellSize();
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -205,7 +218,6 @@ void RimGeoMechContourMapProjection::updateGridInformation()
|
||||
RimGeoMechCase* geoMechCase = this->geoMechCase();
|
||||
m_femPart = geoMechCase->geoMechData()->femParts()->part( 0 );
|
||||
m_femPartGrid = m_femPart->getOrCreateStructGrid();
|
||||
m_sampleSpacing = m_relativeSampleSpacing * geoMechCase->characteristicCellSize();
|
||||
m_femPart->ensureIntersectionSearchTreeIsBuilt();
|
||||
|
||||
m_gridBoundingBox = geoMechCase->activeCellsBoundingBox();
|
||||
@ -232,8 +244,8 @@ void RimGeoMechContourMapProjection::updateGridInformation()
|
||||
// Re-jig max point to be an exact multiple of cell size
|
||||
cvf::Vec3d minPoint = m_expandedBoundingBox.min();
|
||||
cvf::Vec3d maxPoint = m_expandedBoundingBox.max();
|
||||
maxPoint.x() = minPoint.x() + m_mapSize.x() * m_sampleSpacing;
|
||||
maxPoint.y() = minPoint.y() + m_mapSize.y() * m_sampleSpacing;
|
||||
maxPoint.x() = minPoint.x() + m_mapSize.x() * sampleSpacing();
|
||||
maxPoint.y() = minPoint.y() + m_mapSize.y() * sampleSpacing();
|
||||
m_expandedBoundingBox = cvf::BoundingBox( minPoint, maxPoint );
|
||||
}
|
||||
|
||||
@ -281,7 +293,7 @@ std::vector<bool> RimGeoMechContourMapProjection::getMapCellVisibility()
|
||||
cvf::Vec3d porExtent = validResBoundingBox.extent();
|
||||
double radius = std::max( porExtent.x(), porExtent.y() ) * 0.25;
|
||||
double expansion = m_paddingAroundPorePressureRegion * radius;
|
||||
size_t cellPadding = std::ceil( expansion / m_sampleSpacing );
|
||||
size_t cellPadding = std::ceil( expansion / sampleSpacing() );
|
||||
for ( size_t cellIndex = 0; cellIndex < cellResults.size(); ++cellIndex )
|
||||
{
|
||||
if ( !mapCellVisibility[cellIndex] )
|
||||
@ -583,13 +595,13 @@ QList<caf::PdmOptionItemInfo>
|
||||
|
||||
if ( fieldNeedingOptions == &m_resultAggregation )
|
||||
{
|
||||
std::vector<ResultAggregationEnum> validOptions = {RESULTS_TOP_VALUE,
|
||||
RESULTS_MEAN_VALUE,
|
||||
RESULTS_GEOM_VALUE,
|
||||
RESULTS_HARM_VALUE,
|
||||
RESULTS_MIN_VALUE,
|
||||
RESULTS_MAX_VALUE,
|
||||
RESULTS_SUM};
|
||||
std::vector<ResultAggregationEnum> validOptions = { RESULTS_TOP_VALUE,
|
||||
RESULTS_MEAN_VALUE,
|
||||
RESULTS_GEOM_VALUE,
|
||||
RESULTS_HARM_VALUE,
|
||||
RESULTS_MIN_VALUE,
|
||||
RESULTS_MAX_VALUE,
|
||||
RESULTS_SUM };
|
||||
|
||||
for ( ResultAggregationEnum option : validOptions )
|
||||
{
|
||||
|
@ -56,6 +56,8 @@ public:
|
||||
RimRegularLegendConfig* legendConfig() const override;
|
||||
void updateLegend() override;
|
||||
|
||||
double sampleSpacing() const override;
|
||||
|
||||
protected:
|
||||
typedef RimContourMapProjection::CellIndexAndResult CellIndexAndResult;
|
||||
|
||||
|
@ -551,7 +551,7 @@ void RimGridView::updateSurfacesInViewTreeItems()
|
||||
RimProject* proj = RimProject::current();
|
||||
RimSurfaceCollection* surfColl = proj->activeOilField()->surfaceCollection();
|
||||
|
||||
if ( surfColl && surfColl->surfaces().size() )
|
||||
if ( surfColl && surfColl->containsSurface() )
|
||||
{
|
||||
if ( !m_surfaceCollection() )
|
||||
{
|
||||
|
@ -240,14 +240,14 @@ void RimMainPlotCollection::deleteAllContainedObjects()
|
||||
m_wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
|
||||
m_rftPlotCollection()->deleteAllPlots();
|
||||
m_pltPlotCollection()->deleteAllPlots();
|
||||
m_summaryPlotCollection()->summaryPlots.deleteAllChildObjects();
|
||||
m_summaryCrossPlotCollection()->deleteAllChildObjects();
|
||||
m_gridCrossPlotCollection->deleteAllChildObjects();
|
||||
m_summaryPlotCollection()->deleteAllPlots();
|
||||
m_summaryCrossPlotCollection()->deleteAllPlots();
|
||||
m_gridCrossPlotCollection->deleteAllPlots();
|
||||
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
|
||||
m_saturationPressurePlotCollection()->deleteAllChildObjects();
|
||||
m_multiPlotCollection()->deleteAllChildObjects();
|
||||
m_analysisPlotCollection()->deleteAllChildObjects();
|
||||
m_correlationPlotCollection()->deleteAllChildObjects();
|
||||
m_analysisPlotCollection()->deleteAllPlots();
|
||||
m_correlationPlotCollection()->deleteAllPlots();
|
||||
m_fractureModelPlotCollection()->deleteAllPlots();
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ void RimMainPlotCollection::updatePlotsWithFormations()
|
||||
|
||||
if ( m_gridCrossPlotCollection )
|
||||
{
|
||||
for ( RimGridCrossPlot* crossPlot : m_gridCrossPlotCollection->gridCrossPlots() )
|
||||
for ( RimGridCrossPlot* crossPlot : m_gridCrossPlotCollection->plots() )
|
||||
{
|
||||
crossPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafPdmFieldReorderCapability.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiToolButtonEditor.h"
|
||||
|
||||
@ -74,6 +75,8 @@ RimMultiPlot::RimMultiPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plots, "Plots", "", "", "", "" );
|
||||
m_plots.uiCapability()->setUiHidden( true );
|
||||
auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots );
|
||||
reorderability->orderChanged.connect( this, &RimMultiPlot::onPlotsReordered );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_columnCount, "NumberOfColumns", "Number of Columns", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_rowsPerPage, "RowsPerPage", "Rows per Page", "", "", "" );
|
||||
@ -180,14 +183,6 @@ void RimMultiPlot::setMultiPlotTitle( const QString& title )
|
||||
m_plotWindowTitle = title;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlot::addPlot( RimPlot* plot )
|
||||
{
|
||||
insertPlot( plot, m_plots.size() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -479,11 +474,32 @@ void RimMultiPlot::onPlotAdditionOrRemoval()
|
||||
updateSubPlotNames();
|
||||
updatePlotWindowTitle();
|
||||
applyPlotWindowTitleToWidgets();
|
||||
updateConnectedEditors();
|
||||
updateAllRequiredEditors();
|
||||
updateLayout();
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlot::onPlotsReordered( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
updateSubPlotNames();
|
||||
recreatePlotWidgets();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
updateSubPlotNames();
|
||||
recreatePlotWidgets();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -704,6 +720,7 @@ void RimMultiPlot::onLoadDataAndUpdate()
|
||||
applyPlotWindowTitleToWidgets();
|
||||
updatePlots();
|
||||
updateLayout();
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -760,6 +777,8 @@ void RimMultiPlot::recreatePlotWidgets()
|
||||
{
|
||||
CVF_ASSERT( m_viewer );
|
||||
|
||||
m_viewer->removeAllPlots();
|
||||
|
||||
auto plotVector = plots();
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
#include "RimPlotWindow.h"
|
||||
|
||||
@ -37,7 +38,7 @@
|
||||
|
||||
class RimPlot;
|
||||
|
||||
class RimMultiPlot : public RimPlotWindow
|
||||
class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection<RimPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -69,16 +70,15 @@ public:
|
||||
QString multiPlotTitle() const;
|
||||
void setMultiPlotTitle( const QString& title );
|
||||
|
||||
void addPlot( RimPlot* plot );
|
||||
void insertPlot( RimPlot* plot, size_t index );
|
||||
void removePlot( RimPlot* plot );
|
||||
void insertPlot( RimPlot* plot, size_t index ) override;
|
||||
void removePlot( RimPlot* plot ) override;
|
||||
void movePlotsToThis( const std::vector<RimPlot*>& plots, int insertAtPosition );
|
||||
|
||||
size_t plotCount() const;
|
||||
size_t plotCount() const override;
|
||||
size_t plotIndex( const RimPlot* plot ) const;
|
||||
RimPlot* plotByIndex( size_t index ) const;
|
||||
|
||||
std::vector<RimPlot*> plots() const;
|
||||
std::vector<RimPlot*> plots() const override;
|
||||
std::vector<RimPlot*> visiblePlots() const;
|
||||
|
||||
void updatePlotOrderFromGridWidget();
|
||||
@ -135,6 +135,9 @@ private:
|
||||
void updatePlotWindowTitle();
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
void onPlotAdditionOrRemoval();
|
||||
void onPlotsReordered( const caf::SignalEmitter* emitter );
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_showPlotWindowTitle;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user