mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Copy changes from dev-branch into main
History of main branch was difficult to merge. Take a copy of dev-branch, and merge both ways between dev and main after the release.
This commit is contained in:
@@ -25,12 +25,6 @@
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "RiuGroupedBarChartBuilder.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuSummaryVectorSelectionDialog.h"
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RimAnalysisPlotDataEntry.h"
|
||||
@@ -43,12 +37,20 @@
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryPlotAxisFormatter.h"
|
||||
|
||||
#include "RiuContextMenuLauncher.h"
|
||||
#include "RiuGroupedBarChartBuilder.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuSummaryVectorSelectionDialog.h"
|
||||
|
||||
#include "qwt_column_symbol.h"
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_painter.h"
|
||||
#include "qwt_plot_barchart.h"
|
||||
#include "qwt_scale_draw.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiActionPushButtonEditor.h"
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
@@ -64,25 +66,25 @@ namespace caf
|
||||
template <>
|
||||
void caf::AppEnum<RimAnalysisPlot::SortGroupType>::setUp()
|
||||
{
|
||||
addItem( RimAnalysisPlot::NONE, "NONE", "None" );
|
||||
addItem( RimAnalysisPlot::SUMMARY_ITEM, "SUMMARY_ITEM", "Summary Item" );
|
||||
addItem( RimAnalysisPlot::VECTOR, "VECTOR", "Vector" );
|
||||
addItem( RimAnalysisPlot::CASE, "CASE", "Case" );
|
||||
addItem( RimAnalysisPlot::ENSEMBLE, "ENSEMBLE", "Ensemble" );
|
||||
addItem( RimAnalysisPlot::VALUE, "VALUE", "Value" );
|
||||
addItem( RimAnalysisPlot::ABS_VALUE, "ABS_VALUE", "abs(Value)" );
|
||||
addItem( RimAnalysisPlot::OTHER_VALUE, "OTHER_VALUE", "Other Value" );
|
||||
addItem( RimAnalysisPlot::ABS_OTHER_VALUE, "ABS_OTHER_VALUE", "abs(Other Value)" );
|
||||
addItem( RimAnalysisPlot::TIME_STEP, "TIME_STEP", "Time Step" );
|
||||
setDefault( RimAnalysisPlot::NONE );
|
||||
addItem( RimAnalysisPlot::SortGroupType::NONE, "NONE", "None" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::SUMMARY_ITEM, "SUMMARY_ITEM", "Summary Item" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::VECTOR, "VECTOR", "Vector" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::CASE, "CASE", "Case" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::ENSEMBLE, "ENSEMBLE", "Ensemble" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::VALUE, "VALUE", "Value" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::ABS_VALUE, "ABS_VALUE", "abs(Value)" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::OTHER_VALUE, "OTHER_VALUE", "Other Value" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::ABS_OTHER_VALUE, "ABS_OTHER_VALUE", "abs(Other Value)" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::TIME_STEP, "TIME_STEP", "Time Step" );
|
||||
setDefault( RimAnalysisPlot::SortGroupType::NONE );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimAnalysisPlot::BarOrientation>::setUp()
|
||||
{
|
||||
addItem( RimAnalysisPlot::BARS_HORIZONTAL, "BARS_HORIZONTAL", "Horizontal" );
|
||||
addItem( RimAnalysisPlot::BARS_VERTICAL, "BARS_VERTICAL", "Vertical" );
|
||||
setDefault( RimAnalysisPlot::BARS_VERTICAL );
|
||||
addItem( RimAnalysisPlot::BarOrientation::BARS_HORIZONTAL, "BARS_HORIZONTAL", "Horizontal" );
|
||||
addItem( RimAnalysisPlot::BarOrientation::BARS_VERTICAL, "BARS_VERTICAL", "Vertical" );
|
||||
setDefault( RimAnalysisPlot::BarOrientation::BARS_VERTICAL );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
@@ -92,7 +94,6 @@ CAF_PDM_SOURCE_INIT( RimAnalysisPlot, "AnalysisPlot" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnalysisPlot::RimAnalysisPlot()
|
||||
: RimPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Analysis Plot", ":/AnalysisPlot16x16.png" );
|
||||
|
||||
@@ -137,7 +138,7 @@ RimAnalysisPlot::RimAnalysisPlot()
|
||||
CAF_PDM_InitFieldNoDefault( &m_valueSortOperation, "ValueSortOperation", "Sort by Value" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_sortGroupForColors, "groupForColors", "Coloring Using" );
|
||||
m_sortGroupForColors = RimAnalysisPlot::CASE;
|
||||
m_sortGroupForColors = RimAnalysisPlot::SortGroupType::CASE;
|
||||
m_showPlotLegends = false;
|
||||
|
||||
CAF_PDM_InitField( &m_useTopBarsFilter, "UseTopBarsFilter", false, "Show Only Top" );
|
||||
@@ -172,6 +173,8 @@ RimAnalysisPlot::RimAnalysisPlot()
|
||||
connectAxisSignals( m_valueAxisProperties() );
|
||||
m_plotDataFilterCollection->filtersChanged.connect( this, &RimAnalysisPlot::onFiltersChanged );
|
||||
setDeletable( true );
|
||||
|
||||
m_analyserOfSelectedCurveDefs = std::make_unique<RiaSummaryCurveDefinitionAnalyser>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -188,7 +191,7 @@ RimAnalysisPlot::~RimAnalysisPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::updateCaseNameHasChanged()
|
||||
{
|
||||
this->onLoadDataAndUpdate();
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -205,7 +208,7 @@ RimPlotDataFilterCollection* RimAnalysisPlot::plotDataFilterCollection() const
|
||||
void RimAnalysisPlot::setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
|
||||
{
|
||||
m_analysisPlotDataSelection.deleteChildren();
|
||||
for ( auto curveDef : curveDefinitions )
|
||||
for ( const auto& curveDef : curveDefinitions )
|
||||
{
|
||||
auto dataEntry = new RimAnalysisPlotDataEntry();
|
||||
dataEntry->setFromCurveDefinition( curveDef );
|
||||
@@ -235,11 +238,11 @@ void RimAnalysisPlot::setTimeSteps( const std::vector<time_t>& timeSteps )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseSummaryAddress> RimAnalysisPlot::unfilteredAddresses()
|
||||
std::set<RifEclipseSummaryAddress> RimAnalysisPlot::unfilteredAddresses() const
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> addresses;
|
||||
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = updateAndGetCurveAnalyzer();
|
||||
|
||||
for ( RimSummaryCase* sumCase : analyserOfSelectedCurveDefs->m_singleSummaryCases )
|
||||
{
|
||||
@@ -253,11 +256,11 @@ std::set<RifEclipseSummaryAddress> RimAnalysisPlot::unfilteredAddresses()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RigEnsembleParameter> RimAnalysisPlot::ensembleParameters()
|
||||
std::set<RigEnsembleParameter> RimAnalysisPlot::ensembleParameters() const
|
||||
{
|
||||
std::set<RigEnsembleParameter> ensembleParms;
|
||||
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = updateAndGetCurveAnalyzer();
|
||||
|
||||
std::set<RimSummaryCaseCollection*> ensembles;
|
||||
|
||||
@@ -281,7 +284,7 @@ std::set<RigEnsembleParameter> RimAnalysisPlot::ensembleParameters()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigEnsembleParameter RimAnalysisPlot::ensembleParameter( const QString& ensembleParameterName )
|
||||
RigEnsembleParameter RimAnalysisPlot::ensembleParameter( const QString& ensembleParameterName ) const
|
||||
{
|
||||
std::set<RigEnsembleParameter> ensembleParms = ensembleParameters();
|
||||
for ( const RigEnsembleParameter& eParam : ensembleParms )
|
||||
@@ -289,7 +292,7 @@ RigEnsembleParameter RimAnalysisPlot::ensembleParameter( const QString& ensemble
|
||||
if ( eParam.name == ensembleParameterName ) return eParam;
|
||||
}
|
||||
|
||||
return RigEnsembleParameter();
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -300,7 +303,7 @@ void RimAnalysisPlot::maxMinValueFromAddress( const RifEclipseSummaryAddress&
|
||||
const std::vector<QDateTime>& timeRangeOrSelection,
|
||||
bool useAbsValue,
|
||||
double* minVal,
|
||||
double* maxVal )
|
||||
double* maxVal ) const
|
||||
{
|
||||
double min = std::numeric_limits<double>::infinity();
|
||||
double max = useAbsValue ? 0.0 : -std::numeric_limits<double>::infinity();
|
||||
@@ -341,12 +344,10 @@ void RimAnalysisPlot::maxMinValueFromAddress( const RifEclipseSummaryAddress&
|
||||
|
||||
if ( reader->hasAddress( address ) )
|
||||
{
|
||||
std::vector<double> values;
|
||||
reader->values( address, &values );
|
||||
|
||||
auto [isOk, values] = reader->values( address );
|
||||
const std::vector<time_t>& timesteps = reader->timeSteps( address );
|
||||
|
||||
if ( timesteps.size() && values.size() )
|
||||
if ( !timesteps.empty() && !values.empty() )
|
||||
{
|
||||
if ( timeStepSourceType == RimPlotDataFilterItem::LAST_TIMESTEP )
|
||||
{
|
||||
@@ -392,13 +393,13 @@ void RimAnalysisPlot::maxMinValueFromAddress( const RifEclipseSummaryAddress&
|
||||
if ( !historyAddr.isHistoryVector() ) historyAddr.setVectorName( address.vectorName() + "H" );
|
||||
|
||||
const std::vector<time_t>& historyTimesteps = reader->timeSteps( historyAddr );
|
||||
if ( historyTimesteps.size() )
|
||||
if ( !historyTimesteps.empty() )
|
||||
{
|
||||
min = minOrAbsMin( min, values[historyTimesteps.size() - 1] );
|
||||
max = maxOrAbsMax( max, values[historyTimesteps.size() - 1] );
|
||||
}
|
||||
}
|
||||
else if ( selectedTimesteps.size() )
|
||||
else if ( !selectedTimesteps.empty() )
|
||||
{
|
||||
std::vector<size_t> selectedTimestepIndices = RimAnalysisPlot::findTimestepIndices( selectedTimesteps, timesteps );
|
||||
|
||||
@@ -421,13 +422,13 @@ void RimAnalysisPlot::maxMinValueFromAddress( const RifEclipseSummaryAddress&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::onFiltersChanged( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<time_t> RimAnalysisPlot::selectedTimeSteps()
|
||||
std::vector<time_t> RimAnalysisPlot::selectedTimeSteps() const
|
||||
{
|
||||
std::vector<time_t> selectedTimeTTimeSteps;
|
||||
for ( const QDateTime& dateTime : m_selectedTimeSteps.v() )
|
||||
@@ -453,7 +454,7 @@ void RimAnalysisPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
dlg.enableMultiSelect( true );
|
||||
dlg.enableIndividualEnsembleCaseSelection( true );
|
||||
dlg.hideEnsembles();
|
||||
dlg.setCurveSelection( this->curveDefinitions() );
|
||||
dlg.setCurveSelection( curveDefinitions() );
|
||||
|
||||
if ( dlg.exec() == QDialog::Accepted )
|
||||
{
|
||||
@@ -475,10 +476,10 @@ void RimAnalysisPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
{
|
||||
m_selectedTimeSteps.v().clear();
|
||||
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
this->loadDataAndUpdate();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -492,9 +493,9 @@ void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
selVectorsGrp->add( &m_referenceCase, { true, 3, 2 } );
|
||||
|
||||
QString vectorNames;
|
||||
if ( getOrCreateSelectedCurveDefAnalyser() )
|
||||
if ( updateAndGetCurveAnalyzer() )
|
||||
{
|
||||
for ( const std::string& vectorName : getOrCreateSelectedCurveDefAnalyser()->m_vectorNames )
|
||||
for ( const std::string& vectorName : updateAndGetCurveAnalyzer()->m_vectorNames )
|
||||
{
|
||||
vectorNames += QString::fromStdString( vectorName ) + ", ";
|
||||
}
|
||||
@@ -634,16 +635,16 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_valueSortOperation )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( NONE ), NONE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( VALUE ), VALUE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( ABS_VALUE ), ABS_VALUE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::NONE ), SortGroupType::NONE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::VALUE ), SortGroupType::VALUE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::ABS_VALUE ), SortGroupType::ABS_VALUE ) );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_majorGroupType || fieldNeedingOptions == &m_mediumGroupType ||
|
||||
fieldNeedingOptions == &m_minorGroupType || fieldNeedingOptions == &m_sortGroupForColors )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( NONE ), NONE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::NONE ), SortGroupType::NONE ) );
|
||||
QStringList currentSummaryItems;
|
||||
for ( auto summaryAddr : getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses )
|
||||
for ( const auto& summaryAddr : updateAndGetCurveAnalyzer()->m_summaryAdresses )
|
||||
{
|
||||
currentSummaryItems.push_back( QString::fromStdString( summaryAddr.itemUiText() ) );
|
||||
}
|
||||
@@ -656,13 +657,13 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
||||
exampleString = exampleString.left( 13 ) + "...";
|
||||
}
|
||||
|
||||
QString summaryItemText = QString( "%1 (%2)" ).arg( SortGroupAppEnum::uiText( SUMMARY_ITEM ) ).arg( exampleString );
|
||||
options.push_back( caf::PdmOptionItemInfo( summaryItemText, SUMMARY_ITEM ) );
|
||||
QString summaryItemText = QString( "%1 (%2)" ).arg( SortGroupAppEnum::uiText( SortGroupType::SUMMARY_ITEM ) ).arg( exampleString );
|
||||
options.push_back( caf::PdmOptionItemInfo( summaryItemText, SortGroupType::SUMMARY_ITEM ) );
|
||||
}
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( VECTOR ), VECTOR ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( CASE ), CASE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( ENSEMBLE ), ENSEMBLE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( TIME_STEP ), TIME_STEP ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::VECTOR ), SortGroupType::VECTOR ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::CASE ), SortGroupType::CASE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::ENSEMBLE ), SortGroupType::ENSEMBLE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::TIME_STEP ), SortGroupType::TIME_STEP ) );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_referenceCase )
|
||||
{
|
||||
@@ -693,7 +694,7 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<time_t> RimAnalysisPlot::allAvailableTimeSteps()
|
||||
std::set<time_t> RimAnalysisPlot::allAvailableTimeSteps() const
|
||||
{
|
||||
std::set<time_t> timeStepUnion;
|
||||
|
||||
@@ -715,9 +716,9 @@ std::set<time_t> RimAnalysisPlot::allAvailableTimeSteps()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimSummaryCase*> RimAnalysisPlot::timestepDefiningSourceCases()
|
||||
std::set<RimSummaryCase*> RimAnalysisPlot::timestepDefiningSourceCases() const
|
||||
{
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = updateAndGetCurveAnalyzer();
|
||||
std::set<RimSummaryCase*> timeStepDefiningSumCases = analyserOfSelectedCurveDefs->m_singleSummaryCases;
|
||||
for ( auto ensemble : analyserOfSelectedCurveDefs->m_ensembles )
|
||||
{
|
||||
@@ -731,9 +732,9 @@ std::set<RimSummaryCase*> RimAnalysisPlot::timestepDefiningSourceCases()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimSummaryCase*> RimAnalysisPlot::allSourceCases()
|
||||
std::set<RimSummaryCase*> RimAnalysisPlot::allSourceCases() const
|
||||
{
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = updateAndGetCurveAnalyzer();
|
||||
std::set<RimSummaryCase*> allSumCases = analyserOfSelectedCurveDefs->m_singleSummaryCases;
|
||||
|
||||
return allSumCases;
|
||||
@@ -762,7 +763,7 @@ void RimAnalysisPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
getOrCreateSelectedCurveDefAnalyser();
|
||||
updateAndGetCurveAnalyzer();
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
@@ -775,12 +776,12 @@ void RimAnalysisPlot::onLoadDataAndUpdate()
|
||||
addDataToChartBuilder( chartBuilder );
|
||||
|
||||
chartBuilder.addBarChartToPlot( m_plotWidget->qwtPlot(),
|
||||
m_barOrientation == BARS_HORIZONTAL ? Qt::Horizontal : Qt::Vertical,
|
||||
m_barOrientation == BarOrientation::BARS_HORIZONTAL ? Qt::Horizontal : Qt::Vertical,
|
||||
m_useTopBarsFilter() ? m_maxBarCount : -1 );
|
||||
|
||||
if ( m_showPlotLegends && m_plotWidget->qwtPlot()->legend() == nullptr )
|
||||
{
|
||||
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
||||
auto* legend = new QwtLegend( m_plotWidget );
|
||||
m_plotWidget->qwtPlot()->insertLegend( legend, QwtPlot::RightLegend );
|
||||
}
|
||||
else if ( !m_showPlotLegends )
|
||||
@@ -792,8 +793,8 @@ void RimAnalysisPlot::onLoadDataAndUpdate()
|
||||
m_plotWidget->updateLegend();
|
||||
}
|
||||
|
||||
this->updateAxes();
|
||||
this->updatePlotTitle();
|
||||
updateAxes();
|
||||
updatePlotTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -828,6 +829,8 @@ RiuPlotWidget* RimAnalysisPlot::doCreatePlotViewWidget( QWidget* mainWindowParen
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||
|
||||
new RiuContextMenuLauncher( m_plotWidget, { "RicShowPlotDataFeature" } );
|
||||
}
|
||||
|
||||
return m_plotWidget;
|
||||
@@ -865,7 +868,7 @@ void RimAnalysisPlot::updateAxes()
|
||||
if ( !m_plotWidget ) return;
|
||||
|
||||
RiuPlotAxis axis = RiuPlotAxis::defaultLeft();
|
||||
if ( m_barOrientation == BARS_HORIZONTAL )
|
||||
if ( m_barOrientation == BarOrientation::BARS_HORIZONTAL )
|
||||
{
|
||||
axis = RiuPlotAxis::defaultBottom();
|
||||
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), false );
|
||||
@@ -900,7 +903,7 @@ void RimAnalysisPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
||||
caf::PdmObject* itemToSelect = nullptr;
|
||||
if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
||||
{
|
||||
if ( m_barOrientation == BARS_VERTICAL )
|
||||
if ( m_barOrientation == BarOrientation::BARS_VERTICAL )
|
||||
{
|
||||
itemToSelect = m_valueAxisProperties;
|
||||
}
|
||||
@@ -911,7 +914,7 @@ void RimAnalysisPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
||||
}
|
||||
else if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
||||
{
|
||||
if ( m_barOrientation == BARS_HORIZONTAL )
|
||||
if ( m_barOrientation == BarOrientation::BARS_HORIZONTAL )
|
||||
{
|
||||
itemToSelect = m_valueAxisProperties;
|
||||
}
|
||||
@@ -924,6 +927,17 @@ void RimAnalysisPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
||||
RiuPlotMainWindowTools::selectOrToggleObject( itemToSelect, toggle );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimAnalysisPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
RiuGroupedBarChartBuilder chartBuilder;
|
||||
addDataToChartBuilder( chartBuilder );
|
||||
|
||||
return chartBuilder.plotContentAsText();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -950,21 +964,21 @@ QString RimAnalysisPlot::assignGroupingText( RimAnalysisPlot::SortGroupType sor
|
||||
|
||||
switch ( sortGroup )
|
||||
{
|
||||
case RimAnalysisPlot::SUMMARY_ITEM:
|
||||
case RimAnalysisPlot::SortGroupType::SUMMARY_ITEM:
|
||||
{
|
||||
RifEclipseSummaryAddress addr = dataEntry.summaryAddress();
|
||||
RifEclipseSummaryAddress addr = dataEntry.summaryAddressY();
|
||||
groupingText = QString::fromStdString( addr.itemUiText() );
|
||||
}
|
||||
break;
|
||||
case RimAnalysisPlot::CASE:
|
||||
case RimAnalysisPlot::SortGroupType::CASE:
|
||||
{
|
||||
if ( dataEntry.summaryCase() )
|
||||
if ( dataEntry.summaryCaseY() )
|
||||
{
|
||||
groupingText = dataEntry.summaryCase()->displayCaseName();
|
||||
groupingText = dataEntry.summaryCaseY()->displayCaseName();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RimAnalysisPlot::ENSEMBLE:
|
||||
case RimAnalysisPlot::SortGroupType::ENSEMBLE:
|
||||
{
|
||||
if ( dataEntry.ensemble() )
|
||||
{
|
||||
@@ -972,14 +986,14 @@ QString RimAnalysisPlot::assignGroupingText( RimAnalysisPlot::SortGroupType sor
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RimAnalysisPlot::VECTOR:
|
||||
case RimAnalysisPlot::SortGroupType::VECTOR:
|
||||
{
|
||||
RifEclipseSummaryAddress addr = dataEntry.summaryAddress();
|
||||
RifEclipseSummaryAddress addr = dataEntry.summaryAddressY();
|
||||
|
||||
groupingText = QString::fromStdString( addr.vectorName() );
|
||||
}
|
||||
break;
|
||||
case RimAnalysisPlot::TIME_STEP:
|
||||
case RimAnalysisPlot::SortGroupType::TIME_STEP:
|
||||
{
|
||||
groupingText = timestepString;
|
||||
}
|
||||
@@ -1019,7 +1033,7 @@ std::vector<size_t> RimAnalysisPlot::findTimestepIndices( std::vector<time_t> se
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::filteredCurveDefs()
|
||||
std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::filteredCurveDefs() const
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> dataDefinitions = curveDefinitions();
|
||||
|
||||
@@ -1030,11 +1044,11 @@ std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::filteredCurveDefs()
|
||||
|
||||
for ( const auto& curveDef : dataDefinitions )
|
||||
{
|
||||
if ( curveDef.summaryCase() )
|
||||
if ( curveDef.summaryCaseY() )
|
||||
{
|
||||
filteredSumCases.insert( curveDef.summaryCase() );
|
||||
filteredSumCases.insert( curveDef.summaryCaseY() );
|
||||
|
||||
RifEclipseSummaryAddress address = curveDef.summaryAddress();
|
||||
RifEclipseSummaryAddress address = curveDef.summaryAddressY();
|
||||
|
||||
address.setVectorName( "" ); // Vector name set to "" in order to store only unique summary items
|
||||
filteredSummaryItems.insert( address );
|
||||
@@ -1054,8 +1068,8 @@ std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::filteredCurveDefs()
|
||||
|
||||
for ( const RiaSummaryCurveDefinition& curveDefCandidate : dataDefinitions )
|
||||
{
|
||||
RimSummaryCase* sumCase = curveDefCandidate.summaryCase();
|
||||
RifEclipseSummaryAddress addr = curveDefCandidate.summaryAddress();
|
||||
RimSummaryCase* sumCase = curveDefCandidate.summaryCaseY();
|
||||
RifEclipseSummaryAddress addr = curveDefCandidate.summaryAddressY();
|
||||
addr.setVectorName( "" );
|
||||
|
||||
if ( filteredSumCases.count( sumCase ) && filteredSummaryItems.count( addr ) )
|
||||
@@ -1073,7 +1087,7 @@ std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::filteredCurveDefs()
|
||||
|
||||
void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
std::set<RimSummaryCase*>* filteredSumCases,
|
||||
std::set<RifEclipseSummaryAddress>* filteredSummaryItems )
|
||||
std::set<RifEclipseSummaryAddress>* filteredSummaryItems ) const
|
||||
{
|
||||
if ( !filter->isActive() || !filter->isValid() ) return;
|
||||
|
||||
@@ -1089,7 +1103,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
{
|
||||
sumItemsToKeep = ( *filteredSummaryItems ); // Not filtering items
|
||||
|
||||
RigEnsembleParameter eParam = this->ensembleParameter( filter->ensembleParameterName() );
|
||||
RigEnsembleParameter eParam = ensembleParameter( filter->ensembleParameterName() );
|
||||
|
||||
for ( auto sumCase : ( *filteredSumCases ) )
|
||||
{
|
||||
@@ -1154,7 +1168,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
}
|
||||
else if ( filter->consideredTimeStepsType() == RimPlotDataFilterItem::PLOT_SOURCE_TIMESTEPS )
|
||||
{
|
||||
selectedTimesteps = this->selectedTimeSteps();
|
||||
selectedTimesteps = selectedTimeSteps();
|
||||
}
|
||||
|
||||
std::function<void( double )> storeResultCoreLambda;
|
||||
@@ -1174,8 +1188,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
|
||||
if ( reader->hasAddress( addrToFilterValue ) )
|
||||
{
|
||||
std::vector<double> values;
|
||||
reader->values( addrToFilterValue, &values );
|
||||
auto [isOk, values] = reader->values( addrToFilterValue );
|
||||
const std::vector<time_t>& timesteps = reader->timeSteps( addrToFilterValue );
|
||||
|
||||
if ( filter->consideredTimeStepsType() == RimPlotDataFilterItem::ALL_TIMESTEPS )
|
||||
@@ -1187,7 +1200,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
storeResultCoreLambda( value );
|
||||
}
|
||||
}
|
||||
else if ( timesteps.size() )
|
||||
else if ( !timesteps.empty() )
|
||||
{
|
||||
std::vector<size_t> selectedTimestepIndices;
|
||||
|
||||
@@ -1200,7 +1213,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
size_t timeStepIdx = timesteps.size() - 1;
|
||||
selectedTimestepIndices.push_back( timeStepIdx );
|
||||
}
|
||||
else if ( selectedTimesteps.size() )
|
||||
else if ( !selectedTimesteps.empty() )
|
||||
{
|
||||
selectedTimestepIndices = RimAnalysisPlot::findTimestepIndices( selectedTimesteps, timesteps );
|
||||
}
|
||||
@@ -1211,7 +1224,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
if ( !historyAddr.isHistoryVector() ) historyAddr.setVectorName( addrToFilterValue.vectorName() + "H" );
|
||||
|
||||
std::vector<time_t> historyTimesteps = reader->timeSteps( historyAddr );
|
||||
if ( historyTimesteps.size() )
|
||||
if ( !historyTimesteps.empty() )
|
||||
{
|
||||
selectedTimestepIndices = RimAnalysisPlot::findTimestepIndices( { historyTimesteps.back() }, timesteps );
|
||||
}
|
||||
@@ -1402,7 +1415,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder )
|
||||
void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder ) const
|
||||
{
|
||||
std::vector<time_t> selectedTimesteps;
|
||||
for ( const QDateTime& dateTime : m_selectedTimeSteps.v() )
|
||||
@@ -1421,8 +1434,8 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
||||
|
||||
for ( const RiaSummaryCurveDefinition& curveDef : barDataDefinitions )
|
||||
{
|
||||
if ( !curveDef.summaryCase() ) continue;
|
||||
RifSummaryReaderInterface* reader = curveDef.summaryCase()->summaryReader();
|
||||
if ( !curveDef.summaryCaseY() ) continue;
|
||||
RifSummaryReaderInterface* reader = curveDef.summaryCaseY()->summaryReader();
|
||||
|
||||
if ( !reader ) continue;
|
||||
|
||||
@@ -1437,18 +1450,19 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
||||
referenceCaseReader,
|
||||
-1,
|
||||
DerivedSummaryOperator::DERIVED_OPERATOR_SUB,
|
||||
curveDef.summaryAddress() );
|
||||
curveDef.summaryAddressY() );
|
||||
timeSteps.swap( timeAndValues.first );
|
||||
values.swap( timeAndValues.second );
|
||||
}
|
||||
else
|
||||
{
|
||||
timeSteps = reader->timeSteps( curveDef.summaryAddress() );
|
||||
timeSteps = reader->timeSteps( curveDef.summaryAddressY() );
|
||||
|
||||
reader->values( curveDef.summaryAddress(), &values );
|
||||
auto [isOk, readValues] = reader->values( curveDef.summaryAddressY() );
|
||||
values.swap( readValues );
|
||||
}
|
||||
|
||||
if ( !( timeSteps.size() && values.size() ) ) continue;
|
||||
if ( timeSteps.empty() || values.empty() ) continue;
|
||||
|
||||
// Find selected timestep indices
|
||||
|
||||
@@ -1484,10 +1498,10 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
||||
|
||||
switch ( m_valueSortOperation() )
|
||||
{
|
||||
case VALUE:
|
||||
case SortGroupType::VALUE:
|
||||
sortValue = value;
|
||||
break;
|
||||
case ABS_VALUE:
|
||||
case SortGroupType::ABS_VALUE:
|
||||
sortValue = fabs( value );
|
||||
break;
|
||||
}
|
||||
@@ -1500,17 +1514,17 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
||||
QStringList barTextComponents;
|
||||
if ( m_useVectorNameInBarText )
|
||||
{
|
||||
barTextComponents += QString::fromStdString( curveDef.summaryAddress().vectorName() );
|
||||
barTextComponents += QString::fromStdString( curveDef.summaryAddressY().vectorName() );
|
||||
}
|
||||
|
||||
if ( m_useSummaryItemInBarText )
|
||||
{
|
||||
barTextComponents += QString::fromStdString( curveDef.summaryAddress().itemUiText() );
|
||||
barTextComponents += QString::fromStdString( curveDef.summaryAddressY().itemUiText() );
|
||||
}
|
||||
|
||||
if ( m_useCaseInBarText && curveDef.summaryCase() )
|
||||
if ( m_useCaseInBarText && curveDef.summaryCaseY() )
|
||||
{
|
||||
barTextComponents += curveDef.summaryCase()->displayCaseName();
|
||||
barTextComponents += curveDef.summaryCaseY()->displayCaseName();
|
||||
}
|
||||
|
||||
if ( m_useEnsembleInBarText && curveDef.ensemble() )
|
||||
@@ -1540,22 +1554,22 @@ void RimAnalysisPlot::updatePlotTitle()
|
||||
QString autoTitle;
|
||||
QString separator = ", ";
|
||||
|
||||
if ( getOrCreateSelectedCurveDefAnalyser()->m_ensembles.size() == 1 )
|
||||
if ( updateAndGetCurveAnalyzer()->m_ensembles.size() == 1 )
|
||||
{
|
||||
autoTitle += ( *getOrCreateSelectedCurveDefAnalyser()->m_ensembles.begin() )->name();
|
||||
autoTitle += ( *updateAndGetCurveAnalyzer()->m_ensembles.begin() )->name();
|
||||
}
|
||||
|
||||
if ( getOrCreateSelectedCurveDefAnalyser()->m_singleSummaryCases.size() == 1 )
|
||||
if ( updateAndGetCurveAnalyzer()->m_singleSummaryCases.size() == 1 )
|
||||
{
|
||||
if ( !autoTitle.isEmpty() ) autoTitle += separator;
|
||||
autoTitle += ( *getOrCreateSelectedCurveDefAnalyser()->m_singleSummaryCases.begin() )->displayCaseName();
|
||||
autoTitle += ( *updateAndGetCurveAnalyzer()->m_singleSummaryCases.begin() )->displayCaseName();
|
||||
}
|
||||
else if ( getOrCreateSelectedCurveDefAnalyser()->m_singleSummaryCases.size() > 1 )
|
||||
else if ( updateAndGetCurveAnalyzer()->m_singleSummaryCases.size() > 1 )
|
||||
{
|
||||
if ( !autoTitle.isEmpty() ) autoTitle += separator;
|
||||
|
||||
QStringList caseNameList;
|
||||
for ( auto summaryCase : getOrCreateSelectedCurveDefAnalyser()->m_singleSummaryCases )
|
||||
for ( auto summaryCase : updateAndGetCurveAnalyzer()->m_singleSummaryCases )
|
||||
{
|
||||
caseNameList.push_back( summaryCase->displayCaseName() );
|
||||
}
|
||||
@@ -1572,13 +1586,13 @@ void RimAnalysisPlot::updatePlotTitle()
|
||||
}
|
||||
}
|
||||
|
||||
if ( getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses.size() == 1 )
|
||||
if ( updateAndGetCurveAnalyzer()->m_summaryAdresses.size() == 1 )
|
||||
{
|
||||
if ( !autoTitle.isEmpty() ) autoTitle += separator;
|
||||
autoTitle += QString::fromStdString( getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses.begin()->itemUiText() );
|
||||
autoTitle += QString::fromStdString( updateAndGetCurveAnalyzer()->m_summaryAdresses.begin()->itemUiText() );
|
||||
}
|
||||
|
||||
for ( std::string quantName : getOrCreateSelectedCurveDefAnalyser()->m_vectorNames )
|
||||
for ( const std::string& quantName : updateAndGetCurveAnalyzer()->m_vectorNames )
|
||||
{
|
||||
if ( !autoTitle.isEmpty() ) autoTitle += separator;
|
||||
autoTitle += QString::fromStdString( quantName );
|
||||
@@ -1620,13 +1634,10 @@ void RimAnalysisPlot::updatePlotTitle()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveDefinitionAnalyser* RimAnalysisPlot::getOrCreateSelectedCurveDefAnalyser()
|
||||
RiaSummaryCurveDefinitionAnalyser* RimAnalysisPlot::updateAndGetCurveAnalyzer() const
|
||||
{
|
||||
if ( !m_analyserOfSelectedCurveDefs )
|
||||
{
|
||||
m_analyserOfSelectedCurveDefs = std::unique_ptr<RiaSummaryCurveDefinitionAnalyser>( new RiaSummaryCurveDefinitionAnalyser );
|
||||
}
|
||||
m_analyserOfSelectedCurveDefs->setCurveDefinitions( this->curveDefinitions() );
|
||||
m_analyserOfSelectedCurveDefs->setCurveDefinitions( curveDefinitions() );
|
||||
|
||||
return m_analyserOfSelectedCurveDefs.get();
|
||||
}
|
||||
|
||||
@@ -1636,7 +1647,7 @@ RiaSummaryCurveDefinitionAnalyser* RimAnalysisPlot::getOrCreateSelectedCurveDefA
|
||||
std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::curveDefinitions() const
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefs;
|
||||
for ( auto dataEntry : m_analysisPlotDataSelection )
|
||||
for ( const auto& dataEntry : m_analysisPlotDataSelection )
|
||||
{
|
||||
curveDefs.push_back( dataEntry->curveDefinition() );
|
||||
}
|
||||
@@ -1680,7 +1691,7 @@ void RimAnalysisPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder )
|
||||
void RimAnalysisPlot::buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder ) const
|
||||
{
|
||||
chartBuilder.addBarEntry( "T1_The_red_Fox", "", "", std::numeric_limits<double>::infinity(), "R1", "", 0.4 );
|
||||
chartBuilder.addBarEntry( "T1_The_red_Fox", "", "", std::numeric_limits<double>::infinity(), "R2", "", 0.45 );
|
||||
@@ -1749,7 +1760,7 @@ void RimAnalysisPlot::initAfterRead()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::onCaseRemoved( const SignalEmitter* emitter, RimSummaryCase* summaryCase )
|
||||
{
|
||||
for ( auto existingEntry : m_analysisPlotDataSelection )
|
||||
for ( const auto& existingEntry : m_analysisPlotDataSelection )
|
||||
{
|
||||
if ( existingEntry->summaryCase() == summaryCase )
|
||||
{
|
||||
@@ -1767,7 +1778,7 @@ void RimAnalysisPlot::onCaseRemoved( const SignalEmitter* emitter, RimSummaryCas
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::connectAllCaseSignals()
|
||||
{
|
||||
for ( auto dataEntry : m_analysisPlotDataSelection )
|
||||
for ( const auto& dataEntry : m_analysisPlotDataSelection )
|
||||
{
|
||||
if ( dataEntry->ensemble() )
|
||||
{
|
||||
|
||||
@@ -48,13 +48,13 @@ class RimAnalysisPlot : public RimPlot
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum BarOrientation
|
||||
enum class BarOrientation
|
||||
{
|
||||
BARS_HORIZONTAL,
|
||||
BARS_VERTICAL
|
||||
};
|
||||
|
||||
enum SortGroupType
|
||||
enum class SortGroupType
|
||||
{
|
||||
NONE,
|
||||
SUMMARY_ITEM,
|
||||
@@ -82,18 +82,20 @@ public:
|
||||
void setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions );
|
||||
void setTimeSteps( const std::vector<time_t>& timeSteps );
|
||||
|
||||
std::set<RifEclipseSummaryAddress> unfilteredAddresses();
|
||||
std::set<RigEnsembleParameter> ensembleParameters();
|
||||
RigEnsembleParameter ensembleParameter( const QString& ensembleParameterName );
|
||||
std::set<RifEclipseSummaryAddress> unfilteredAddresses() const;
|
||||
std::set<RigEnsembleParameter> ensembleParameters() const;
|
||||
RigEnsembleParameter ensembleParameter( const QString& ensembleParameterName ) const;
|
||||
|
||||
void maxMinValueFromAddress( const RifEclipseSummaryAddress& address,
|
||||
RimPlotDataFilterItem::TimeStepSourceType timeStepSourceType,
|
||||
const std::vector<QDateTime>& timeRangeOrSelection,
|
||||
bool useAbsValue,
|
||||
double* min,
|
||||
double* max );
|
||||
double* max ) const;
|
||||
|
||||
std::vector<time_t> selectedTimeSteps();
|
||||
std::vector<time_t> selectedTimeSteps() const;
|
||||
QString description() const override;
|
||||
QString asciiDataForPlotExport() const override;
|
||||
|
||||
private:
|
||||
// Overridden PDM methods
|
||||
@@ -104,10 +106,10 @@ private:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
std::set<time_t> allAvailableTimeSteps();
|
||||
std::set<time_t> allAvailableTimeSteps() const;
|
||||
|
||||
std::set<RimSummaryCase*> timestepDefiningSourceCases();
|
||||
std::set<RimSummaryCase*> allSourceCases();
|
||||
std::set<RimSummaryCase*> timestepDefiningSourceCases() const;
|
||||
std::set<RimSummaryCase*> allSourceCases() const;
|
||||
|
||||
void onFiltersChanged( const caf::SignalEmitter* emitter );
|
||||
|
||||
@@ -121,8 +123,7 @@ private:
|
||||
|
||||
// RimPlotWindow overrides
|
||||
|
||||
QString description() const override;
|
||||
void doUpdateLayout() override {}
|
||||
void doUpdateLayout() override {}
|
||||
|
||||
// RimPlot Overrides
|
||||
|
||||
@@ -139,24 +140,22 @@ private:
|
||||
void setAutoScaleYEnabled( bool enabled ) override {}
|
||||
void updateLegend() override{};
|
||||
|
||||
QString asciiDataForPlotExport() const override { return ""; }
|
||||
|
||||
// Private methods
|
||||
|
||||
void cleanupBeforeClose();
|
||||
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder );
|
||||
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder ) const;
|
||||
void updatePlotTitle();
|
||||
|
||||
QString assignGroupingText( RimAnalysisPlot::SortGroupType sortGroup,
|
||||
const RiaSummaryCurveDefinition dataEntry,
|
||||
const QString& timestepString ) const;
|
||||
|
||||
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* updateAndGetCurveAnalyzer() const;
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefinitions() const;
|
||||
std::vector<RiaSummaryCurveDefinition> filteredCurveDefs();
|
||||
std::vector<RiaSummaryCurveDefinition> filteredCurveDefs() const;
|
||||
void applyFilter( const RimPlotDataFilterItem* filter,
|
||||
std::set<RimSummaryCase*>* filteredSumCases,
|
||||
std::set<RifEclipseSummaryAddress>* filteredSummaryItems );
|
||||
std::set<RifEclipseSummaryAddress>* filteredSummaryItems ) const;
|
||||
|
||||
static std::vector<size_t> findTimestepIndices( std::vector<time_t> selectedTimesteps, const std::vector<time_t>& timesteps );
|
||||
|
||||
@@ -166,7 +165,7 @@ private:
|
||||
void axisSettingsChanged( const caf::SignalEmitter* emitter );
|
||||
void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic );
|
||||
|
||||
void buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder );
|
||||
void buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder ) const;
|
||||
|
||||
int barTextFontSize() const;
|
||||
void initAfterRead() override;
|
||||
|
||||
@@ -201,7 +201,7 @@ void RimAnalysisPlotCollection::applySummaryCaseCollectionAndFieldAddressToPlot(
|
||||
{
|
||||
for ( auto address : allAddresses )
|
||||
{
|
||||
if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD )
|
||||
if ( address.category() == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_FIELD )
|
||||
{
|
||||
if ( quantityName.empty() || quantityName == address.vectorName() )
|
||||
{
|
||||
|
||||
@@ -63,12 +63,12 @@ RimAnalysisPlotDataEntry::~RimAnalysisPlotDataEntry()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotDataEntry::setFromCurveDefinition( const RiaSummaryCurveDefinition& curveDef )
|
||||
{
|
||||
m_summaryAddress->setAddress( curveDef.summaryAddress() );
|
||||
m_summaryAddress->setAddress( curveDef.summaryAddressY() );
|
||||
if ( curveDef.ensemble() )
|
||||
{
|
||||
m_ensemble = curveDef.ensemble();
|
||||
}
|
||||
m_summaryCase = curveDef.summaryCase();
|
||||
m_summaryCase = curveDef.summaryCaseY();
|
||||
m_isEnsembleCurve = curveDef.isEnsembleCurve();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
@@ -28,6 +27,7 @@ class RimSummaryCase;
|
||||
class RimSummaryAddress;
|
||||
class RimSummaryCaseCollection;
|
||||
class RiaSummaryCurveDefinition;
|
||||
class RifEclipseSummaryAddress;
|
||||
|
||||
class RimAnalysisPlotDataEntry : public caf::PdmObject
|
||||
{
|
||||
|
||||
@@ -243,24 +243,24 @@ void RimPlotDataFilterItem::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
{
|
||||
if ( changedField == &m_filterTarget )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( true );
|
||||
updateMaxMinAndDefaultValues( true );
|
||||
}
|
||||
else if ( changedField == &m_filterQuantityUiField )
|
||||
{
|
||||
m_filterAddress->setAddress( m_filterQuantityUiField );
|
||||
this->updateMaxMinAndDefaultValues( true );
|
||||
updateMaxMinAndDefaultValues( true );
|
||||
}
|
||||
else if ( changedField == &m_filterEnsembleParameter )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( true );
|
||||
updateMaxMinAndDefaultValues( true );
|
||||
}
|
||||
else if ( changedField == &m_filterOperation )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( false );
|
||||
updateMaxMinAndDefaultValues( false );
|
||||
}
|
||||
else if ( changedField == &m_consideredTimestepsType || changedField == &m_explicitlySelectedTimeSteps )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( false );
|
||||
updateMaxMinAndDefaultValues( false );
|
||||
}
|
||||
filterChanged.send();
|
||||
}
|
||||
@@ -458,8 +458,8 @@ void RimPlotDataFilterItem::updateMaxMinAndDefaultValues( bool forceDefault )
|
||||
&m_upperLimit );
|
||||
}
|
||||
|
||||
if ( forceDefault || !( m_min >= m_lowerLimit && m_min <= m_upperLimit ) ) m_min = m_lowerLimit;
|
||||
if ( forceDefault || !( m_max >= m_lowerLimit && m_max <= m_upperLimit ) ) m_max = m_upperLimit;
|
||||
if ( forceDefault || m_min < m_lowerLimit || m_min > m_upperLimit ) m_min = m_lowerLimit;
|
||||
if ( forceDefault || m_max < m_lowerLimit || m_max > m_upperLimit ) m_max = m_upperLimit;
|
||||
|
||||
m_min.uiCapability()->setUiName( QString( "Min (%1)" ).arg( m_lowerLimit ) );
|
||||
m_max.uiCapability()->setUiName( QString( "Max (%1)" ).arg( m_upperLimit ) );
|
||||
|
||||
@@ -209,7 +209,7 @@ size_t RimAnnotationCollection::lineBasedAnnotationsCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::updateViewAnnotationCollections()
|
||||
{
|
||||
auto views = gridViewsContainingAnnotations();
|
||||
auto views = viewsContainingAnnotations();
|
||||
|
||||
for ( const auto* view : views )
|
||||
{
|
||||
|
||||
@@ -115,9 +115,7 @@ void RimAnnotationCollectionBase::onAnnotationDeleted()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollectionBase::scheduleRedrawOfRelevantViews()
|
||||
{
|
||||
// Todo: Do a Bounding Box check to see if this annotation actually is relevant for the view
|
||||
|
||||
auto views = gridViewsContainingAnnotations();
|
||||
auto views = viewsContainingAnnotations();
|
||||
if ( !views.empty() )
|
||||
{
|
||||
for ( auto& view : views )
|
||||
@@ -130,19 +128,13 @@ void RimAnnotationCollectionBase::scheduleRedrawOfRelevantViews()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridView*> RimAnnotationCollectionBase::gridViewsContainingAnnotations() const
|
||||
std::vector<Rim3dView*> RimAnnotationCollectionBase::viewsContainingAnnotations() const
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
if ( !project ) return {};
|
||||
|
||||
std::vector<RimGridView*> views;
|
||||
std::vector<RimGridView*> visibleGridViews;
|
||||
project->allVisibleGridViews( visibleGridViews );
|
||||
|
||||
for ( auto& gridView : visibleGridViews )
|
||||
{
|
||||
views.push_back( gridView );
|
||||
}
|
||||
std::vector<Rim3dView*> views;
|
||||
project->allViews( views );
|
||||
return views;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
class QString;
|
||||
class RimTextAnnotation;
|
||||
class RimAnnotationGroupCollection;
|
||||
class RimGridView;
|
||||
class Rim3dView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -51,8 +51,8 @@ public:
|
||||
virtual void updateViewAnnotationCollections();
|
||||
virtual void onAnnotationDeleted();
|
||||
|
||||
void scheduleRedrawOfRelevantViews();
|
||||
std::vector<RimGridView*> gridViewsContainingAnnotations() const;
|
||||
void scheduleRedrawOfRelevantViews();
|
||||
std::vector<Rim3dView*> viewsContainingAnnotations() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
@@ -112,9 +112,7 @@ void RimAnnotationGroupCollection::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
if ( changedField == &m_isActive )
|
||||
{
|
||||
updateUiIconFromToggleField();
|
||||
|
||||
auto coll = firstAncestorOrThisOfType<RimAnnotationCollectionBase>();
|
||||
if ( coll ) coll->scheduleRedrawOfRelevantViews();
|
||||
updateViews();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,3 +123,21 @@ caf::PdmFieldHandle* RimAnnotationGroupCollection::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationGroupCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
updateViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationGroupCollection::updateViews()
|
||||
{
|
||||
auto coll = firstAncestorOrThisOfType<RimAnnotationCollectionBase>();
|
||||
if ( coll ) coll->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
@@ -58,6 +58,10 @@ public:
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
private:
|
||||
void updateViews();
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
|
||||
@@ -203,10 +203,10 @@ void RimPolylinesFromFileAnnotation::fieldChangedByUi( const caf::PdmFieldHandle
|
||||
if ( changedField == &m_polyLinesFileName )
|
||||
{
|
||||
QString errorMessage;
|
||||
this->readPolyLinesFile( &errorMessage );
|
||||
readPolyLinesFile( &errorMessage );
|
||||
if ( !errorMessage.isEmpty() )
|
||||
{
|
||||
QString totalError = "\nError in: " + this->fileName() + "\n\t" + errorMessage;
|
||||
QString totalError = "\nError in: " + fileName() + "\n\t" + errorMessage;
|
||||
RiaLogging::errorInMessageBox( nullptr, "Import Polylines", totalError );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,11 +145,11 @@ void RimReachCircleAnnotation::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
if ( changedField == &m_centerPointXyd )
|
||||
{
|
||||
m_centerPointPickEnabled = false;
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
if ( changedField == &m_centerPointPickEnabled )
|
||||
{
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
auto annColl = firstAncestorOrThisOfTypeAsserted<RimAnnotationCollection>();
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "RicVec3dPickEventHandler.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiPickableLineEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTextEditor.h"
|
||||
@@ -44,8 +45,8 @@ CAF_PDM_SOURCE_INIT( RimTextAnnotation, "RimTextAnnotation" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTextAnnotation::RimTextAnnotation()
|
||||
{
|
||||
CAF_PDM_InitObject( "TextAnnotation", ":/TextAnnotation16x16.png" );
|
||||
this->setUi3dEditorTypeName( RicTextAnnotation3dEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitScriptableObject( "TextAnnotation", ":/TextAnnotation16x16.png" );
|
||||
setUi3dEditorTypeName( RicTextAnnotation3dEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_anchorPointXyd, "AnchorPointXyd", Vec3d::ZERO, "Anchor Point" );
|
||||
m_anchorPointXyd.uiCapability()->setUiEditorTypeName( caf::PdmUiPickableLineEditor::uiEditorTypeName() );
|
||||
@@ -172,16 +173,16 @@ void RimTextAnnotation::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
{
|
||||
m_labelPointXyd = m_anchorPointXyd;
|
||||
}
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
if ( changedField == &m_labelPointXyd )
|
||||
{
|
||||
m_labelPointPickEnabledButtonField = false;
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
if ( changedField == &m_anchorPointPickEnabledButtonField || changedField == &m_labelPointPickEnabledButtonField )
|
||||
{
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
auto annColl = firstAncestorOrThisOfTypeAsserted<RimAnnotationCollectionBase>();
|
||||
|
||||
@@ -59,7 +59,7 @@ RimUserDefinedPolylinesAnnotation::RimUserDefinedPolylinesAnnotation()
|
||||
m_targets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
m_targets.uiCapability()->setCustomContextMenuEnabled( true );
|
||||
|
||||
this->setUi3dEditorTypeName( RicPolyline3dEditor::uiEditorTypeName() );
|
||||
setUi3dEditorTypeName( RicPolyline3dEditor::uiEditorTypeName() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -259,7 +259,7 @@ void RimUserDefinedPolylinesAnnotation::fieldChangedByUi( const caf::PdmFieldHan
|
||||
{
|
||||
if ( changedField == &m_enablePicking )
|
||||
{
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
else if ( changedField == &m_showLines )
|
||||
{
|
||||
|
||||
@@ -132,6 +132,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPressureDepthData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultDefinitionTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimResultSelectionUi.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotRectAnnotation.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -263,6 +264,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPressureDepthData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultDefinitionTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimResultSelectionUi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotRectAnnotation.cpp
|
||||
)
|
||||
|
||||
if(RESINSIGHT_USE_QT_CHARTS)
|
||||
|
||||
@@ -11,6 +11,8 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolygonFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellFilterIntervalTool.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellIndexFilter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedIndexFilter.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -26,6 +28,8 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolygonFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellFilterIntervalTool.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCellIndexFilter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedIndexFilter.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -21,8 +21,13 @@
|
||||
#include "RigReservoirGridTools.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimViewController.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
|
||||
namespace caf
|
||||
@@ -42,8 +47,9 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimCellFilter, "CellFilter", "CellFilter" ); /
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellFilter::RimCellFilter()
|
||||
RimCellFilter::RimCellFilter( FilterDefinitionType defType )
|
||||
: filterChanged( this )
|
||||
, m_filterDefinitionType( defType )
|
||||
{
|
||||
CAF_PDM_InitObject( "Cell Filter" );
|
||||
|
||||
@@ -51,9 +57,14 @@ RimCellFilter::RimCellFilter()
|
||||
CAF_PDM_InitField( &m_isActive, "Active", true, "Active" );
|
||||
m_isActive.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_srcCase, "Case", "Case" );
|
||||
m_srcCase.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filterMode, "FilterType", "Filter Type" );
|
||||
|
||||
CAF_PDM_InitField( &m_gridIndex, "GridIndex", 0, "Grid" );
|
||||
m_gridIndex.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_propagateToSubGrids, "PropagateToSubGrids", true, "Apply to Subgrids" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy" );
|
||||
@@ -130,6 +141,46 @@ bool RimCellFilter::isFilterEnabled() const
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilter::isRangeFilter() const
|
||||
{
|
||||
return m_filterDefinitionType == FilterDefinitionType::RANGE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilter::isIndexFilter() const
|
||||
{
|
||||
return m_filterDefinitionType == FilterDefinitionType::INDEX;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::setCase( RimCase* srcCase )
|
||||
{
|
||||
m_srcCase = srcCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimCellFilter::eclipseCase() const
|
||||
{
|
||||
return dynamic_cast<RimEclipseCase*>( m_srcCase() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimCellFilter::geoMechCase() const
|
||||
{
|
||||
return dynamic_cast<RimGeoMechCase*>( m_srcCase() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -175,7 +226,7 @@ bool RimCellFilter::propagateToSubGrids() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::updateIconState()
|
||||
{
|
||||
caf::IconProvider iconProvider = this->uiIconProvider();
|
||||
caf::IconProvider iconProvider = uiIconProvider();
|
||||
|
||||
if ( !iconProvider.valid() ) return;
|
||||
|
||||
@@ -190,7 +241,7 @@ void RimCellFilter::updateIconState()
|
||||
|
||||
iconProvider.setActive( m_isActive && !m_isActive.uiCapability()->isUiReadOnly() );
|
||||
|
||||
this->setUiIcon( iconProvider );
|
||||
setUiIcon( iconProvider );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -209,6 +260,11 @@ void RimCellFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
uiOrdering.add( &m_name );
|
||||
auto group = uiOrdering.addNewGroup( "General" );
|
||||
group->add( &m_filterMode );
|
||||
|
||||
if ( geoMechCase() != nullptr )
|
||||
{
|
||||
m_gridIndex.uiCapability()->setUiName( "Part" );
|
||||
}
|
||||
group->add( &m_gridIndex );
|
||||
|
||||
bool readOnlyState = isFilterControlled();
|
||||
@@ -252,27 +308,12 @@ QList<caf::PdmOptionItemInfo> RimCellFilter::calculateValueOptions( const caf::P
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( &m_gridIndex == fieldNeedingOptions )
|
||||
if ( fieldNeedingOptions == &m_gridIndex )
|
||||
{
|
||||
auto rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
for ( int gIdx = 0; gIdx < RigReservoirGridTools::gridCount( rimCase ); ++gIdx )
|
||||
{
|
||||
QString gridName;
|
||||
|
||||
gridName += RigReservoirGridTools::gridName( rimCase, gIdx );
|
||||
if ( gIdx == 0 )
|
||||
{
|
||||
if ( gridName.isEmpty() )
|
||||
gridName += "Main Grid";
|
||||
else
|
||||
gridName += " (Main Grid)";
|
||||
}
|
||||
|
||||
caf::PdmOptionItemInfo item( gridName, (int)gIdx );
|
||||
options.push_back( item );
|
||||
}
|
||||
RimTools::eclipseGridOptionItems( &options, eclipseCase() );
|
||||
RimTools::geoMechPartOptionItems( &options, geoMechCase() );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,14 +22,21 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cafSignal.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class StructGridInterface;
|
||||
class CellRangeFilter;
|
||||
} // namespace cvf
|
||||
|
||||
class RimGeoMechCase;
|
||||
class RimEclipseCase;
|
||||
class RimCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@@ -45,9 +52,16 @@ public:
|
||||
EXCLUDE
|
||||
};
|
||||
|
||||
enum FilterDefinitionType
|
||||
{
|
||||
RANGE,
|
||||
INDEX,
|
||||
PROPERTY
|
||||
};
|
||||
|
||||
caf::Signal<> filterChanged;
|
||||
|
||||
RimCellFilter();
|
||||
RimCellFilter( FilterDefinitionType defType );
|
||||
~RimCellFilter() override;
|
||||
|
||||
QString name() const;
|
||||
@@ -56,6 +70,11 @@ public:
|
||||
bool isActive() const;
|
||||
void setActive( bool active );
|
||||
|
||||
virtual void setCase( RimCase* srcCase );
|
||||
|
||||
bool isRangeFilter() const;
|
||||
bool isIndexFilter() const;
|
||||
|
||||
virtual bool isFilterEnabled() const;
|
||||
|
||||
caf::AppEnum<FilterModeType> filterMode() const;
|
||||
@@ -69,7 +88,8 @@ public:
|
||||
void updateIconState();
|
||||
void updateActiveState( bool isControlled );
|
||||
|
||||
virtual void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter, int gridIndex ) = 0;
|
||||
virtual void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter, int gridIndex ){};
|
||||
virtual void updateCellIndexFilter( cvf::UByteArray* includeVisibility, cvf::UByteArray* excludeVisibility, int gridIndex ){};
|
||||
virtual QString fullName() const;
|
||||
|
||||
protected:
|
||||
@@ -78,6 +98,9 @@ protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
bool isFilterControlled() const;
|
||||
|
||||
RimGeoMechCase* geoMechCase() const;
|
||||
RimEclipseCase* eclipseCase() const;
|
||||
|
||||
const cvf::StructGridInterface* selectedGrid() const;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
@@ -88,4 +111,8 @@ protected:
|
||||
caf::PdmField<caf::AppEnum<FilterModeType>> m_filterMode;
|
||||
caf::PdmField<int> m_gridIndex;
|
||||
caf::PdmField<bool> m_propagateToSubGrids;
|
||||
caf::PdmPtrField<RimCase*> m_srcCase;
|
||||
|
||||
private:
|
||||
FilterDefinitionType m_filterDefinitionType;
|
||||
};
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilter.h"
|
||||
#include "RimCellIndexFilter.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimPolygonFilter.h"
|
||||
#include "RimUserDefinedFilter.h"
|
||||
#include "RimUserDefinedIndexFilter.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
@@ -67,7 +69,7 @@ RimCellFilterCollection::~RimCellFilterCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilterCollection::isEmpty() const
|
||||
{
|
||||
return m_cellFilters.size() > 0;
|
||||
return !m_cellFilters.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -94,8 +96,7 @@ void RimCellFilterCollection::setCase( RimCase* theCase )
|
||||
{
|
||||
for ( RimCellFilter* filter : m_cellFilters )
|
||||
{
|
||||
RimPolygonFilter* polyFilter = dynamic_cast<RimPolygonFilter*>( filter );
|
||||
if ( polyFilter ) polyFilter->setCase( theCase );
|
||||
filter->setCase( theCase );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,8 +126,14 @@ void RimCellFilterCollection::initAfterRead()
|
||||
m_cellFilters.push_back( filter );
|
||||
}
|
||||
|
||||
// Copy by xml serialization does not give a RimCase parent the first time initAfterRead is called here when creating a new a contour
|
||||
// view from a 3d view. The second time we get called it is ok, so just skip setting up the filter connections if we have no case.
|
||||
auto rimCase = firstAncestorOrThisOfType<RimCase>();
|
||||
if ( rimCase == nullptr ) return;
|
||||
|
||||
for ( const auto& filter : m_cellFilters )
|
||||
{
|
||||
filter->setCase( rimCase );
|
||||
filter->filterChanged.connect( this, &RimCellFilterCollection::onFilterUpdated );
|
||||
}
|
||||
}
|
||||
@@ -220,13 +227,28 @@ bool RimCellFilterCollection::hasActiveFilters() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilterCollection::hasActiveIncludeFilters() const
|
||||
bool RimCellFilterCollection::hasActiveIncludeIndexFilters() const
|
||||
{
|
||||
if ( !isActive() ) return false;
|
||||
|
||||
for ( const auto& filter : m_cellFilters )
|
||||
{
|
||||
if ( filter->isFilterEnabled() && filter->filterMode() == RimCellFilter::INCLUDE ) return true;
|
||||
if ( filter->isFilterEnabled() && filter->isIndexFilter() && filter->filterMode() == RimCellFilter::INCLUDE ) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilterCollection::hasActiveIncludeRangeFilters() const
|
||||
{
|
||||
if ( !isActive() ) return false;
|
||||
|
||||
for ( const auto& filter : m_cellFilters )
|
||||
{
|
||||
if ( filter->isFilterEnabled() && filter->isRangeFilter() && filter->filterMode() == RimCellFilter::INCLUDE ) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -251,6 +273,19 @@ RimPolygonFilter* RimCellFilterCollection::addNewPolygonFilter( RimCase* srcCase
|
||||
RimUserDefinedFilter* RimCellFilterCollection::addNewUserDefinedFilter( RimCase* srcCase )
|
||||
{
|
||||
RimUserDefinedFilter* pFilter = new RimUserDefinedFilter();
|
||||
pFilter->setCase( srcCase );
|
||||
addFilter( pFilter );
|
||||
onFilterUpdated( pFilter );
|
||||
return pFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedIndexFilter* RimCellFilterCollection::addNewUserDefinedIndexFilter( RimCase* srcCase )
|
||||
{
|
||||
RimUserDefinedIndexFilter* pFilter = new RimUserDefinedIndexFilter();
|
||||
pFilter->setCase( srcCase );
|
||||
addFilter( pFilter );
|
||||
onFilterUpdated( pFilter );
|
||||
return pFilter;
|
||||
@@ -262,6 +297,7 @@ RimUserDefinedFilter* RimCellFilterCollection::addNewUserDefinedFilter( RimCase*
|
||||
RimCellRangeFilter* RimCellFilterCollection::addNewCellRangeFilter( RimCase* srcCase, int gridIndex, int sliceDirection, int defaultSlice )
|
||||
{
|
||||
RimCellRangeFilter* pFilter = new RimCellRangeFilter();
|
||||
pFilter->setCase( srcCase );
|
||||
addFilter( pFilter );
|
||||
pFilter->setGridIndex( gridIndex );
|
||||
pFilter->setDefaultValues( sliceDirection, defaultSlice );
|
||||
@@ -269,6 +305,18 @@ RimCellRangeFilter* RimCellFilterCollection::addNewCellRangeFilter( RimCase* src
|
||||
return pFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellIndexFilter* RimCellFilterCollection::addNewCellIndexFilter( RimCase* srcCase )
|
||||
{
|
||||
RimCellIndexFilter* pFilter = new RimCellIndexFilter();
|
||||
pFilter->setCase( srcCase );
|
||||
addFilter( pFilter );
|
||||
onFilterUpdated( pFilter );
|
||||
return pFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -277,7 +325,7 @@ void RimCellFilterCollection::addFilter( RimCellFilter* pFilter )
|
||||
setAutoName( pFilter );
|
||||
m_cellFilters.push_back( pFilter );
|
||||
connectToFilterUpdates( pFilter );
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -288,12 +336,14 @@ void RimCellFilterCollection::setAutoName( RimCellFilter* pFilter )
|
||||
int nPolyFilters = 1;
|
||||
int nRangeFilters = 1;
|
||||
int nUserFilters = 1;
|
||||
int nIndexFilters = 1;
|
||||
|
||||
for ( RimCellFilter* filter : m_cellFilters )
|
||||
{
|
||||
if ( dynamic_cast<RimCellRangeFilter*>( filter ) ) nRangeFilters++;
|
||||
if ( dynamic_cast<RimUserDefinedFilter*>( filter ) ) nUserFilters++;
|
||||
if ( dynamic_cast<RimPolygonFilter*>( filter ) ) nPolyFilters++;
|
||||
if ( dynamic_cast<RimCellIndexFilter*>( filter ) ) nIndexFilters++;
|
||||
}
|
||||
if ( dynamic_cast<RimCellRangeFilter*>( pFilter ) )
|
||||
{
|
||||
@@ -301,12 +351,20 @@ void RimCellFilterCollection::setAutoName( RimCellFilter* pFilter )
|
||||
}
|
||||
else if ( dynamic_cast<RimUserDefinedFilter*>( pFilter ) )
|
||||
{
|
||||
pFilter->setName( QString( "User Defined Filter %1" ).arg( QString::number( nUserFilters ) ) );
|
||||
pFilter->setName( QString( "User Defined IJK Filter %1" ).arg( QString::number( nUserFilters ) ) );
|
||||
}
|
||||
else if ( dynamic_cast<RimPolygonFilter*>( pFilter ) )
|
||||
{
|
||||
pFilter->setName( QString( "Polygon Filter %1" ).arg( QString::number( nPolyFilters ) ) );
|
||||
}
|
||||
else if ( dynamic_cast<RimCellIndexFilter*>( pFilter ) )
|
||||
{
|
||||
pFilter->setName( QString( "Index Filter %1" ).arg( QString::number( nIndexFilters ) ) );
|
||||
}
|
||||
else if ( dynamic_cast<RimUserDefinedIndexFilter*>( pFilter ) )
|
||||
{
|
||||
pFilter->setName( QString( "User Defined Index Filter %1" ).arg( QString::number( nIndexFilters ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -360,7 +418,7 @@ void RimCellFilterCollection::onFilterUpdated( const SignalEmitter* emitter )
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Populate the given view filter with info from our filters
|
||||
/// Populate the given view filter with info from our range filters
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::compoundCellRangeFilter( cvf::CellRangeFilter* cellRangeFilter, size_t gridIndex ) const
|
||||
{
|
||||
@@ -370,9 +428,40 @@ void RimCellFilterCollection::compoundCellRangeFilter( cvf::CellRangeFilter* cel
|
||||
|
||||
for ( RimCellFilter* filter : m_cellFilters )
|
||||
{
|
||||
if ( filter->isFilterEnabled() )
|
||||
if ( filter->isFilterEnabled() && filter->isRangeFilter() )
|
||||
{
|
||||
filter->updateCompundFilter( cellRangeFilter, gIndx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Populate the given view filter with info from our cell index filters
|
||||
/// - includeCellVisibility is set to the visibility from the include filters,
|
||||
/// - excludeCellVisibility is set to the visibility from the exclude filters
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilterCollection::updateCellVisibilityByIndex( cvf::UByteArray* includeCellVisibility,
|
||||
cvf::UByteArray* excludeCellVisibility,
|
||||
size_t gridIndex ) const
|
||||
{
|
||||
CVF_ASSERT( includeCellVisibility );
|
||||
CVF_ASSERT( excludeCellVisibility );
|
||||
|
||||
bool needIncludeVisibilityReset = true;
|
||||
|
||||
excludeCellVisibility->setAll( 1 );
|
||||
|
||||
for ( RimCellFilter* filter : m_cellFilters )
|
||||
{
|
||||
if ( filter->isFilterEnabled() && filter->isIndexFilter() )
|
||||
{
|
||||
if ( ( filter->filterMode() == RimCellFilter::INCLUDE ) && needIncludeVisibilityReset )
|
||||
{
|
||||
includeCellVisibility->setAll( 0 );
|
||||
needIncludeVisibilityReset = false;
|
||||
}
|
||||
|
||||
filter->updateCellIndexFilter( includeCellVisibility, excludeCellVisibility, (int)gridIndex );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +23,14 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafSignal.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
|
||||
class RimCellFilter;
|
||||
class RimCellIndexFilter;
|
||||
class RimCellRangeFilter;
|
||||
class RimPolygonFilter;
|
||||
class RimUserDefinedFilter;
|
||||
class RimUserDefinedIndexFilter;
|
||||
class RimCase;
|
||||
|
||||
namespace cvf
|
||||
@@ -48,9 +52,11 @@ public:
|
||||
|
||||
caf::Signal<> filtersChanged;
|
||||
|
||||
RimPolygonFilter* addNewPolygonFilter( RimCase* srcCase );
|
||||
RimUserDefinedFilter* addNewUserDefinedFilter( RimCase* srcCase );
|
||||
RimCellRangeFilter* addNewCellRangeFilter( RimCase* srcCase, int gridIndex, int sliceDirection = -1, int defaultSlice = -1 );
|
||||
RimPolygonFilter* addNewPolygonFilter( RimCase* srcCase );
|
||||
RimCellRangeFilter* addNewCellRangeFilter( RimCase* srcCase, int gridIndex, int sliceDirection = -1, int defaultSlice = -1 );
|
||||
RimCellIndexFilter* addNewCellIndexFilter( RimCase* srcCase );
|
||||
RimUserDefinedFilter* addNewUserDefinedFilter( RimCase* srcCase );
|
||||
RimUserDefinedIndexFilter* addNewUserDefinedIndexFilter( RimCase* srcCase );
|
||||
|
||||
void removeFilter( RimCellFilter* filter );
|
||||
|
||||
@@ -59,11 +65,13 @@ public:
|
||||
void setActive( bool bActive );
|
||||
|
||||
void compoundCellRangeFilter( cvf::CellRangeFilter* cellRangeFilter, size_t gridIndex ) const;
|
||||
void updateCellVisibilityByIndex( cvf::UByteArray* cellsIncluded, cvf::UByteArray* cellsExcluded, size_t gridIndex ) const;
|
||||
|
||||
std::vector<RimCellFilter*> filters() const;
|
||||
|
||||
bool hasActiveFilters() const;
|
||||
bool hasActiveIncludeFilters() const;
|
||||
bool hasActiveIncludeIndexFilters() const;
|
||||
bool hasActiveIncludeRangeFilters() const;
|
||||
|
||||
void updateIconState();
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
@@ -59,9 +59,7 @@ bool RimCellFilterInterval::isIncluded( size_t val ) const
|
||||
|
||||
size_t tmp = val - m_minIncludeVal;
|
||||
|
||||
if ( m_valid && ( tmp % m_step == 0 ) ) return true;
|
||||
|
||||
return false;
|
||||
return m_valid && ( tmp % m_step == 0 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -84,7 +82,7 @@ RimCellFilterIntervalTool::~RimCellFilterIntervalTool()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellFilterIntervalTool::isNumberIncluded( size_t number ) const
|
||||
{
|
||||
if ( m_intervals.size() == 0 ) return m_includeAllByDefault;
|
||||
if ( m_intervals.empty() ) return m_includeAllByDefault;
|
||||
|
||||
number = number + 1;
|
||||
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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 "RimCellIndexFilter.h"
|
||||
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "RigFemPart.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimCellIndexFilter, "CellIndexFilter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellIndexFilter::RimCellIndexFilter()
|
||||
: RimCellFilter( RimCellFilter::INDEX )
|
||||
{
|
||||
CAF_PDM_InitObject( "Cell Index Filter", ":/CellFilter_UserDefined.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_setId, "ElementSetId", 0, "Element Set" );
|
||||
m_setId.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
|
||||
m_propagateToSubGrids = true;
|
||||
|
||||
updateIconState();
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellIndexFilter::~RimCellIndexFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellIndexFilter::fullName() const
|
||||
{
|
||||
return QString( "%1 [%2 cells]" ).arg( RimCellFilter::fullName(), QString::number( m_cells.size() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellIndexFilter::updateCellIndexFilter( cvf::UByteArray* includeVisibility, cvf::UByteArray* excludeVisibility, int gridIndex )
|
||||
{
|
||||
if ( gridIndex != m_gridIndex() ) return;
|
||||
|
||||
if ( m_cells.empty() )
|
||||
{
|
||||
updateCells();
|
||||
}
|
||||
|
||||
if ( m_filterMode == FilterModeType::INCLUDE )
|
||||
{
|
||||
for ( auto cellIdx : m_cells )
|
||||
{
|
||||
( *includeVisibility )[cellIdx] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( auto cellIdx : m_cells )
|
||||
{
|
||||
( *excludeVisibility )[cellIdx] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellIndexFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_gridIndex )
|
||||
{
|
||||
m_setId = 0;
|
||||
}
|
||||
|
||||
if ( changedField != &m_name )
|
||||
{
|
||||
updateCells();
|
||||
filterChanged.send();
|
||||
updateIconState();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellIndexFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
m_gridIndex.uiCapability()->setUiName( "Part" );
|
||||
|
||||
auto group = uiOrdering.addNewGroup( "General" );
|
||||
group->add( &m_gridIndex );
|
||||
group->add( &m_setId );
|
||||
group->add( &m_filterMode );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
|
||||
bool readOnlyState = isFilterControlled();
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> objFields = fields();
|
||||
for ( auto& objField : objFields )
|
||||
{
|
||||
objField->uiCapability()->setUiReadOnly( readOnlyState );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimCellIndexFilter::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimCellFilter::calculateValueOptions( fieldNeedingOptions );
|
||||
|
||||
if ( fieldNeedingOptions == &m_setId )
|
||||
{
|
||||
RimTools::geoMechElementSetOptionItems( &options, geoMechCase(), m_gridIndex() );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellIndexFilter::updateCells()
|
||||
{
|
||||
m_cells.clear();
|
||||
|
||||
auto gCase = geoMechCase();
|
||||
|
||||
if ( gCase && gCase->geoMechData() && gCase->geoMechData()->femParts() )
|
||||
{
|
||||
auto parts = gCase->geoMechData()->femParts();
|
||||
|
||||
auto part = parts->part( m_gridIndex() );
|
||||
|
||||
auto setNames = part->elementSetNames();
|
||||
if ( m_setId() < (int)setNames.size() )
|
||||
{
|
||||
m_name = QString::fromStdString( part->elementSetNames()[m_setId] );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_name = QString::fromStdString( part->name() );
|
||||
}
|
||||
|
||||
auto cells = part->elementSet( m_setId() );
|
||||
|
||||
for ( auto c : cells )
|
||||
{
|
||||
m_cells.push_back( c );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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 "RimCellFilter.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimCase;
|
||||
class RimGeoMechCase;
|
||||
|
||||
class RimCellIndexFilter : public RimCellFilter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimCellIndexFilter();
|
||||
~RimCellIndexFilter() override;
|
||||
|
||||
void updateCellIndexFilter( cvf::UByteArray* includeVisibility, cvf::UByteArray* excludeVisibility, int gridIndex ) override;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
QString fullName() const override;
|
||||
|
||||
void updateCells();
|
||||
|
||||
private:
|
||||
std::vector<size_t> m_cells;
|
||||
|
||||
caf::PdmField<int> m_setId;
|
||||
};
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "RigReservoirGridTools.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafPdmUiLabelEditor.h"
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
@@ -38,6 +39,7 @@ CAF_PDM_SOURCE_INIT( RimCellRangeFilter, "CellRangeFilter" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellRangeFilter::RimCellRangeFilter()
|
||||
: RimCellFilter( RimCellFilter::RANGE )
|
||||
{
|
||||
CAF_PDM_InitObject( "Cell Range Filter", ":/CellFilter_Range.png" );
|
||||
|
||||
@@ -163,7 +165,7 @@ void RimCellRangeFilter::computeAndSetValidValues()
|
||||
cellCountK = std::clamp( cellCountK.v(), 1, static_cast<int>( grid->cellCountK() ) );
|
||||
startIndexK = std::clamp( startIndexK.v(), 1, static_cast<int>( grid->cellCountK() ) );
|
||||
}
|
||||
this->updateIconState();
|
||||
updateIconState();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -177,9 +179,8 @@ void RimCellRangeFilter::setDefaultValues( int sliceDirection, int defaultSlice
|
||||
|
||||
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
|
||||
auto actCellInfo = RigReservoirGridTools::activeCellInfo( rimView );
|
||||
auto rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
const cvf::StructGridInterface* mainGrid = RigReservoirGridTools::mainGrid( rimCase );
|
||||
const cvf::StructGridInterface* mainGrid = RigReservoirGridTools::mainGrid( m_srcCase );
|
||||
|
||||
if ( grid == mainGrid && actCellInfo )
|
||||
{
|
||||
@@ -270,12 +271,9 @@ void RimCellRangeFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
|
||||
{
|
||||
RimCellFilter::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
m_gridIndex.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
const cvf::StructGridInterface* grid = selectedGrid();
|
||||
|
||||
auto rimCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
const cvf::StructGridInterface* mainGrid = RigReservoirGridTools::mainGrid( rimCase );
|
||||
const cvf::StructGridInterface* mainGrid = RigReservoirGridTools::mainGrid( m_srcCase );
|
||||
|
||||
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
|
||||
auto actCellInfo = RigReservoirGridTools::activeCellInfo( rimView );
|
||||
|
||||
@@ -60,10 +60,11 @@ public:
|
||||
void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter, int gridIndex ) override;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
|
||||
QString fullName() const override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -125,8 +125,8 @@ RimEclipseResultDefinition* RimEclipsePropertyFilter::resultDefinition() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilter::rangeValues( double* lower, double* upper ) const
|
||||
{
|
||||
*lower = this->m_lowerBound;
|
||||
*upper = this->m_upperBound;
|
||||
*lower = m_lowerBound;
|
||||
*upper = m_upperBound;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -134,12 +134,7 @@ void RimEclipsePropertyFilter::rangeValues( double* lower, double* upper ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipsePropertyFilter::isCategorySelectionActive() const
|
||||
{
|
||||
if ( m_resultDefinition->hasCategoryResult() && m_useCategorySelection )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return m_resultDefinition->hasCategoryResult() && m_useCategorySelection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -171,11 +166,11 @@ void RimEclipsePropertyFilter::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
{
|
||||
m_isDuplicatedFromLinkedView = false;
|
||||
|
||||
this->m_resultDefinition->loadResult();
|
||||
this->computeResultValueRange();
|
||||
m_resultDefinition->loadResult();
|
||||
computeResultValueRange();
|
||||
updateFilterName();
|
||||
this->updateIconState();
|
||||
this->uiCapability()->updateConnectedEditors();
|
||||
updateIconState();
|
||||
uiCapability()->updateConnectedEditors();
|
||||
|
||||
parentContainer()->updateDisplayModelNotifyManagedViews( this );
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ void RimGeoMechPropertyFilter::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
if ( &lowerBound == changedField || &upperBound == changedField || &m_isActive == changedField || &m_filterMode == changedField ||
|
||||
&m_selectedCategoryValues == changedField )
|
||||
{
|
||||
this->updateIconState();
|
||||
this->updateFilterName();
|
||||
this->uiCapability()->updateConnectedEditors();
|
||||
updateIconState();
|
||||
updateFilterName();
|
||||
uiCapability()->updateConnectedEditors();
|
||||
|
||||
parentContainer()->updateDisplayModelNotifyManagedViews( this );
|
||||
}
|
||||
@@ -118,7 +118,7 @@ void RimGeoMechPropertyFilter::setToDefaultValues()
|
||||
|
||||
m_selectedCategoryValues = m_categoryValues;
|
||||
|
||||
this->updateFilterName();
|
||||
updateFilterName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -213,12 +213,7 @@ void RimGeoMechPropertyFilter::updateActiveState()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGeoMechPropertyFilter::isActiveAndHasResult()
|
||||
{
|
||||
if ( this->isActive() && this->resultDefinition->hasResult() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return isActive() && resultDefinition->hasResult();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -119,7 +119,8 @@ CAF_PDM_SOURCE_INIT( RimPolygonFilter, "PolygonFilter", "PolyLineFilter" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolygonFilter::RimPolygonFilter()
|
||||
: m_pickTargetsEventHandler( new RicPolylineTargetsPickEventHandler( this ) )
|
||||
: RimCellFilter( RimCellFilter::INDEX )
|
||||
, m_pickTargetsEventHandler( new RicPolylineTargetsPickEventHandler( this ) )
|
||||
, m_intervalTool( true )
|
||||
{
|
||||
CAF_PDM_InitObject( "Polyline Filter", ":/CellFilter_Polygon.png" );
|
||||
@@ -138,9 +139,6 @@ RimPolygonFilter::RimPolygonFilter()
|
||||
m_targets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
m_targets.uiCapability()->setCustomContextMenuEnabled( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_srcCase, "Case", "Case" );
|
||||
m_srcCase.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_showLines, "ShowLines", true, "Show Lines" );
|
||||
CAF_PDM_InitField( &m_showSpheres, "ShowSpheres", false, "Show Spheres" );
|
||||
|
||||
@@ -161,8 +159,8 @@ RimPolygonFilter::RimPolygonFilter()
|
||||
m_polygonPlaneDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
m_polygonPlaneDepth.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::TOP );
|
||||
|
||||
this->setUi3dEditorTypeName( RicPolyline3dEditor::uiEditorTypeName() );
|
||||
this->uiCapability()->setUiTreeChildrenHidden( true );
|
||||
setUi3dEditorTypeName( RicPolyline3dEditor::uiEditorTypeName() );
|
||||
uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
m_propagateToSubGrids = false;
|
||||
|
||||
@@ -186,14 +184,6 @@ void RimPolygonFilter::updateVisualization()
|
||||
filterChanged.send();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygonFilter::initAfterRead()
|
||||
{
|
||||
resolveReferencesRecursively();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -203,14 +193,6 @@ void RimPolygonFilter::updateEditorsAndVisualization()
|
||||
updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygonFilter::setCase( RimCase* srcCase )
|
||||
{
|
||||
m_srcCase = srcCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -412,7 +394,7 @@ void RimPolygonFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
|
||||
|
||||
bool readOnlyState = isFilterControlled();
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> objFields = this->fields();
|
||||
std::vector<caf::PdmFieldHandle*> objFields = fields();
|
||||
for ( auto& objField : objFields )
|
||||
{
|
||||
objField->uiCapability()->setUiReadOnly( readOnlyState );
|
||||
@@ -426,16 +408,22 @@ void RimPolygonFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
{
|
||||
if ( changedField == &m_enablePicking )
|
||||
{
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
|
||||
enableFilter( !m_enablePicking() );
|
||||
filterChanged.send();
|
||||
}
|
||||
else if ( ( changedField == &m_showLines ) || ( changedField == &m_showSpheres ) || ( changedField == &m_sphereColor ) ||
|
||||
( changedField == &m_sphereRadiusFactor ) || ( changedField == &m_lineThickness ) || ( changedField == &m_lineColor ) ||
|
||||
( changedField == &m_lockPolygonToPlane ) || ( changedField == &m_polygonPlaneDepth ) )
|
||||
{
|
||||
filterChanged.send();
|
||||
}
|
||||
else if ( changedField != &m_name )
|
||||
{
|
||||
updateCells();
|
||||
filterChanged.send();
|
||||
this->updateIconState();
|
||||
updateIconState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,10 +455,8 @@ caf::PickEventHandler* RimPolygonFilter::pickEventHandler() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygonFilter::updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter, int gridIndex )
|
||||
void RimPolygonFilter::updateCellIndexFilter( cvf::UByteArray* includeVisibility, cvf::UByteArray* excludeVisibility, int gridIndex )
|
||||
{
|
||||
CVF_ASSERT( cellRangeFilter );
|
||||
|
||||
if ( !m_enableFiltering ) return;
|
||||
|
||||
const int noofgrids = static_cast<int>( m_cells.size() );
|
||||
@@ -481,19 +467,18 @@ void RimPolygonFilter::updateCompundFilter( cvf::CellRangeFilter* cellRangeFilte
|
||||
|
||||
if ( gridIndex >= static_cast<int>( m_cells.size() ) ) return;
|
||||
|
||||
const auto grid = RigReservoirGridTools::gridByIndex( m_srcCase, gridIndex );
|
||||
size_t i, j, k;
|
||||
|
||||
for ( size_t cellidx : m_cells[gridIndex] )
|
||||
if ( m_filterMode == FilterModeType::INCLUDE )
|
||||
{
|
||||
grid->ijkFromCellIndex( cellidx, &i, &j, &k );
|
||||
if ( this->filterMode() == RimCellFilter::INCLUDE )
|
||||
for ( auto cellIdx : m_cells[gridIndex] )
|
||||
{
|
||||
cellRangeFilter->addCellInclude( i, j, k, propagateToSubGrids() );
|
||||
( *includeVisibility )[cellIdx] = true;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( auto cellIdx : m_cells[gridIndex] )
|
||||
{
|
||||
cellRangeFilter->addCellExclude( i, j, k, propagateToSubGrids() );
|
||||
( *excludeVisibility )[cellIdx] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -539,7 +524,8 @@ void RimPolygonFilter::updateCellsDepthEclipse( const std::vector<cvf::Vec3d>& p
|
||||
// we should look in depth using Z coordinate
|
||||
const int gIdx = static_cast<int>( grid->gridIndex() );
|
||||
// loop over all cells
|
||||
for ( size_t n = 0; n < grid->cellCount(); n++ )
|
||||
#pragma omp parallel for
|
||||
for ( int n = 0; n < (int)grid->cellCount(); n++ )
|
||||
{
|
||||
// valid cell?
|
||||
RigCell cell = grid->cell( n );
|
||||
@@ -557,6 +543,7 @@ void RimPolygonFilter::updateCellsDepthEclipse( const std::vector<cvf::Vec3d>& p
|
||||
// check if the polygon includes the cell
|
||||
if ( cellInsidePolygon2D( cell.center(), hexCorners, points ) )
|
||||
{
|
||||
#pragma omp critical
|
||||
m_cells[gIdx].push_back( n );
|
||||
}
|
||||
}
|
||||
@@ -574,8 +561,9 @@ void RimPolygonFilter::updateCellsKIndexEclipse( const std::vector<cvf::Vec3d>&
|
||||
|
||||
std::list<size_t> foundCells;
|
||||
|
||||
#pragma omp parallel for
|
||||
// find all cells in the K layer that matches the polygon
|
||||
for ( size_t i = 0; i < grid->cellCountI(); i++ )
|
||||
for ( int i = 0; i < (int)grid->cellCountI(); i++ )
|
||||
{
|
||||
for ( size_t j = 0; j < grid->cellCountJ(); j++ )
|
||||
{
|
||||
@@ -591,6 +579,7 @@ void RimPolygonFilter::updateCellsKIndexEclipse( const std::vector<cvf::Vec3d>&
|
||||
// check if the polygon includes the cell
|
||||
if ( cellInsidePolygon2D( cell.center(), hexCorners, points ) )
|
||||
{
|
||||
#pragma omp critical
|
||||
foundCells.push_back( cellIdx );
|
||||
}
|
||||
}
|
||||
@@ -653,7 +642,8 @@ void RimPolygonFilter::updateCellsDepthGeoMech( const std::vector<cvf::Vec3d>& p
|
||||
{
|
||||
// we should look in depth using Z coordinate
|
||||
// loop over all cells
|
||||
for ( size_t i = 0; i < grid->cellCountI(); i++ )
|
||||
#pragma omp parallel for
|
||||
for ( int i = 0; i < (int)grid->cellCountI(); i++ )
|
||||
{
|
||||
for ( size_t j = 0; j < grid->cellCountJ(); j++ )
|
||||
{
|
||||
@@ -675,6 +665,7 @@ void RimPolygonFilter::updateCellsDepthGeoMech( const std::vector<cvf::Vec3d>& p
|
||||
// check if the polygon includes the cell
|
||||
if ( cellInsidePolygon2D( center, corners, points ) )
|
||||
{
|
||||
#pragma omp critical
|
||||
m_cells[partId].push_back( cellIdx );
|
||||
}
|
||||
}
|
||||
@@ -740,7 +731,9 @@ void RimPolygonFilter::updateCellsKIndexGeoMech( const std::vector<cvf::Vec3d>&
|
||||
|
||||
// find all cells in this K layer that matches the polygon
|
||||
std::list<size_t> foundCells;
|
||||
for ( size_t i = 0; i < grid->cellCountI(); i++ )
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int i = 0; i < (int)grid->cellCountI(); i++ )
|
||||
{
|
||||
for ( size_t j = 0; j < grid->cellCountJ(); j++ )
|
||||
{
|
||||
@@ -755,6 +748,7 @@ void RimPolygonFilter::updateCellsKIndexGeoMech( const std::vector<cvf::Vec3d>&
|
||||
// check if the polygon includes the cell
|
||||
if ( cellInsidePolygon2D( center, hexCorners, points ) )
|
||||
{
|
||||
#pragma omp critical
|
||||
foundCells.push_back( cellIdx );
|
||||
}
|
||||
}
|
||||
@@ -827,8 +821,8 @@ void RimPolygonFilter::updateCells()
|
||||
// make sure first and last point is the same (req. by polygon methods used later)
|
||||
points.push_back( points.front() );
|
||||
|
||||
RimEclipseCase* eCase = dynamic_cast<RimEclipseCase*>( m_srcCase() );
|
||||
RimGeoMechCase* gCase = dynamic_cast<RimGeoMechCase*>( m_srcCase() );
|
||||
RimEclipseCase* eCase = eclipseCase();
|
||||
RimGeoMechCase* gCase = geoMechCase();
|
||||
|
||||
if ( eCase )
|
||||
{
|
||||
|
||||
@@ -73,7 +73,6 @@ public:
|
||||
RimPolygonFilter();
|
||||
~RimPolygonFilter() override;
|
||||
|
||||
void setCase( RimCase* srcCase );
|
||||
void enableFilter( bool bEnable );
|
||||
void enableKFilter( bool bEnable );
|
||||
|
||||
@@ -89,14 +88,13 @@ public:
|
||||
bool pickingEnabled() const override;
|
||||
caf::PickEventHandler* pickEventHandler() const override;
|
||||
|
||||
void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter, int gridIndex ) override;
|
||||
void updateCellIndexFilter( cvf::UByteArray* includeVisibility, cvf::UByteArray* excludeVisibility, int gridIndex ) override;
|
||||
|
||||
cvf::ref<RigPolyLinesData> polyLinesData() const override;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void initAfterRead() override;
|
||||
|
||||
QString fullName() const override;
|
||||
|
||||
@@ -123,7 +121,6 @@ private:
|
||||
caf::PdmChildArrayField<RimPolylineTarget*> m_targets;
|
||||
caf::PdmField<caf::AppEnum<PolygonFilterModeType>> m_polyFilterMode;
|
||||
caf::PdmField<caf::AppEnum<PolygonIncludeType>> m_polyIncludeType;
|
||||
caf::PdmPtrField<RimCase*> m_srcCase;
|
||||
caf::PdmField<bool> m_enableFiltering;
|
||||
caf::PdmField<bool> m_showLines;
|
||||
caf::PdmField<bool> m_showSpheres;
|
||||
|
||||
@@ -26,6 +26,7 @@ CAF_PDM_SOURCE_INIT( RimPropertyFilter, "PropertyFilter" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPropertyFilter::RimPropertyFilter()
|
||||
: RimCellFilter( RimCellFilter::PROPERTY )
|
||||
{
|
||||
CAF_PDM_InitObject( "Property Filter" );
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ CAF_PDM_SOURCE_INIT( RimUserDefinedFilter, "UserDefinedFilter" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedFilter::RimUserDefinedFilter()
|
||||
: RimCellFilter( RimCellFilter::RANGE )
|
||||
{
|
||||
CAF_PDM_InitObject( "User Defined Filter", ":/CellFilter_UserDefined.png" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_individualCellIndices, "IndividualCellIndices", "Cells", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" );
|
||||
@@ -85,7 +86,7 @@ void RimUserDefinedFilter::updateCompundFilter( cvf::CellRangeFilter* cellRangeF
|
||||
|
||||
if ( gridIndex != m_gridIndex ) return;
|
||||
|
||||
if ( this->filterMode() == RimCellFilter::INCLUDE )
|
||||
if ( filterMode() == RimCellFilter::INCLUDE )
|
||||
{
|
||||
for ( const auto& cellIndex : m_individualCellIndices() )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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 "RimUserDefinedIndexFilter.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimUserDefinedIndexFilter, "RimUserDefinedIndexFilter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedIndexFilter::RimUserDefinedIndexFilter()
|
||||
: RimCellFilter( RimCellFilter::INDEX )
|
||||
{
|
||||
CAF_PDM_InitObject( "User Defined Index Filter", ":/CellFilter_UserDefined.png" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_individualCellIndexes, "IndividualCellIndexes", "Cells", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" );
|
||||
m_individualCellIndexes.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
||||
|
||||
m_propagateToSubGrids = true;
|
||||
|
||||
updateIconState();
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimUserDefinedIndexFilter::~RimUserDefinedIndexFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimUserDefinedIndexFilter::fullName() const
|
||||
{
|
||||
return QString( "%1 [%2 cells]" ).arg( RimCellFilter::fullName(), QString::number( m_individualCellIndexes().size() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedIndexFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimCellFilter::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
auto group = uiOrdering.addNewGroup( QString( "Cell Indexes to " ) + modeString() );
|
||||
group->add( &m_individualCellIndexes );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedIndexFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
if ( changedField != &m_name )
|
||||
{
|
||||
filterChanged.send();
|
||||
updateIconState();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedIndexFilter::updateCellIndexFilter( cvf::UByteArray* includeVisibility, cvf::UByteArray* excludeVisibility, int gridIndex )
|
||||
{
|
||||
if ( gridIndex != m_gridIndex() ) return;
|
||||
|
||||
if ( m_filterMode == FilterModeType::INCLUDE )
|
||||
{
|
||||
for ( auto cellIdx : m_individualCellIndexes() )
|
||||
{
|
||||
( *includeVisibility )[cellIdx] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( auto cellIdx : m_individualCellIndexes() )
|
||||
{
|
||||
( *excludeVisibility )[cellIdx] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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 "RimCellFilter.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimUserDefinedIndexFilter : public RimCellFilter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimUserDefinedIndexFilter();
|
||||
~RimUserDefinedIndexFilter() override;
|
||||
|
||||
void updateCellIndexFilter( cvf::UByteArray* includeVisibility, cvf::UByteArray* excludeVisibility, int gridIndex ) override;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
QString fullName() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<int>> m_individualCellIndexes;
|
||||
};
|
||||
@@ -154,7 +154,7 @@ void RimEllipseFractureTemplate::changeUnits()
|
||||
convertToUnitSystem( RiaDefines::EclipseUnitSystem::UNITS_METRIC );
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -303,7 +303,7 @@ void RimEllipseFractureTemplate::setDefaultValuesFromUnit()
|
||||
// Default to 1/3 of height
|
||||
m_wellPathDepthAtFracture = m_height / 3.0;
|
||||
|
||||
this->setDefaultWellDiameterFromUnit();
|
||||
setDefaultWellDiameterFromUnit();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -444,7 +444,7 @@ void RimEllipseFractureTemplate::defineUiOrdering( QString uiConfigName, caf::Pd
|
||||
m_width.uiCapability()->setUiName( "Width [inches]" );
|
||||
}
|
||||
|
||||
if ( conductivityType() == FINITE_CONDUCTIVITY )
|
||||
if ( useFiniteConductivityInFracture() )
|
||||
{
|
||||
m_permeability.uiCapability()->setUiHidden( false );
|
||||
m_width.uiCapability()->setUiHidden( false );
|
||||
|
||||
@@ -290,7 +290,7 @@ void RimEnsembleFractureStatistics::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
// Update referring plots
|
||||
std::vector<caf::PdmObjectHandle*> referringObjects = this->objectsWithReferringPtrFields();
|
||||
std::vector<caf::PdmObjectHandle*> referringObjects = objectsWithReferringPtrFields();
|
||||
for ( caf::PdmObjectHandle* obj : referringObjects )
|
||||
{
|
||||
auto plot = dynamic_cast<RimEnsembleFractureStatisticsPlot*>( obj );
|
||||
|
||||
@@ -152,7 +152,7 @@ bool RimFishbones::isActive() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFishbones::generatedName() const
|
||||
{
|
||||
caf::PdmChildArrayField<RimFishbones*>* container = dynamic_cast<caf::PdmChildArrayField<RimFishbones*>*>( this->parentField() );
|
||||
caf::PdmChildArrayField<RimFishbones*>* container = dynamic_cast<caf::PdmChildArrayField<RimFishbones*>*>( parentField() );
|
||||
CVF_ASSERT( container );
|
||||
|
||||
size_t index = container->indexOf( this ) + 1;
|
||||
@@ -171,6 +171,18 @@ void RimFishbones::setMeasuredDepthAndCount( double startMD, double spacing, int
|
||||
computeRotationAngles();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFishbones::setSystemParameters( int lateralsPerSub, double lateralLength, double holeDiameter, double buildAngle, int icdsPerSub )
|
||||
{
|
||||
m_lateralCountPerSub = lateralsPerSub;
|
||||
m_lateralLength = QString::number( lateralLength );
|
||||
m_pipeProperties->setHoleDiameter( holeDiameter );
|
||||
m_lateralBuildAngle = buildAngle;
|
||||
m_icdCount = icdsPerSub;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -73,6 +73,8 @@ public:
|
||||
|
||||
void setMeasuredDepthAndCount( double startMD, double spacing, int subCount );
|
||||
|
||||
void setSystemParameters( int lateralsPerSub, double lateralLength, double holeDiameter, double buildAngle, int icdsPerSub );
|
||||
|
||||
double measuredDepth( size_t subIndex ) const;
|
||||
double rotationAngle( size_t subIndex ) const;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ RimFishbonesCollection::RimFishbonesCollection()
|
||||
CAF_PDM_InitObject( "Fishbones", ":/FishBones16x16.png" );
|
||||
|
||||
nameField()->uiCapability()->setUiHidden( true );
|
||||
this->setName( "Fishbones" );
|
||||
setName( "Fishbones" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_fishbones, "FishbonesSubs", "fishbonesSubs" );
|
||||
m_fishbones.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
@@ -44,6 +44,14 @@ RimFishbonesPipeProperties::~RimFishbonesPipeProperties()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFishbonesPipeProperties::setHoleDiameter( double diameter )
|
||||
{
|
||||
m_lateralHoleDiameter = diameter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -41,6 +41,8 @@ public:
|
||||
RimFishbonesPipeProperties();
|
||||
~RimFishbonesPipeProperties() override;
|
||||
|
||||
void setHoleDiameter( double diameter );
|
||||
|
||||
double skinFactor() const { return m_skinFactor(); }
|
||||
double holeDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const;
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ std::vector<size_t> RimFracture::getPotentiallyFracturedCells( const RigMainGrid
|
||||
std::vector<size_t> cellindecies;
|
||||
if ( !mainGrid ) return cellindecies;
|
||||
|
||||
cvf::BoundingBox fractureBBox = this->boundingBoxInDomainCoords();
|
||||
cvf::BoundingBox fractureBBox = boundingBoxInDomainCoords();
|
||||
|
||||
mainGrid->findIntersectingCells( fractureBBox, &cellindecies );
|
||||
|
||||
@@ -279,7 +279,7 @@ void RimFracture::fieldChangedByUi( const caf::PdmFieldHandle* changedField, con
|
||||
}
|
||||
|
||||
if ( changedField == &m_azimuth || changedField == &m_fractureTemplate || changedField == &m_stimPlanTimeIndexToPlot ||
|
||||
changedField == this->objectToggleField() || changedField == &m_dip || changedField == &m_tilt || changedField == &m_perforationLength )
|
||||
changedField == objectToggleField() || changedField == &m_dip || changedField == &m_tilt || changedField == &m_perforationLength )
|
||||
{
|
||||
clearCachedNonDarcyProperties();
|
||||
|
||||
@@ -461,7 +461,7 @@ cvf::BoundingBox RimFracture::boundingBoxInDomainCoords() const
|
||||
std::vector<cvf::Vec3f> nodeCoordVec;
|
||||
std::vector<cvf::uint> triangleIndices;
|
||||
|
||||
this->triangleGeometryTransformed( &triangleIndices, &nodeCoordVec, true );
|
||||
triangleGeometryTransformed( &triangleIndices, &nodeCoordVec, true );
|
||||
|
||||
cvf::BoundingBox fractureBBox;
|
||||
for ( const auto& nodeCoord : nodeCoordVec )
|
||||
@@ -755,7 +755,7 @@ void RimFracture::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& ui
|
||||
m_perforationLength.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
if ( fractureTemplate()->conductivityType() == RimFractureTemplate::FINITE_CONDUCTIVITY )
|
||||
if ( fractureTemplate()->useFiniteConductivityInFracture() )
|
||||
{
|
||||
m_wellDiameter.uiCapability()->setUiHidden( false );
|
||||
}
|
||||
@@ -902,10 +902,10 @@ void RimFracture::setFractureTemplate( RimFractureTemplate* fractureTemplate )
|
||||
}
|
||||
else
|
||||
{
|
||||
this->updateAzimuthBasedOnWellAzimuthAngle();
|
||||
updateAzimuthBasedOnWellAzimuthAngle();
|
||||
}
|
||||
this->m_wellDiameter = fractureTemplate->wellDiameter();
|
||||
this->m_perforationLength = fractureTemplate->perforationLength();
|
||||
m_wellDiameter = fractureTemplate->wellDiameter();
|
||||
m_perforationLength = fractureTemplate->perforationLength();
|
||||
|
||||
clearCachedNonDarcyProperties();
|
||||
|
||||
|
||||
@@ -56,7 +56,9 @@ void caf::AppEnum<RimFractureTemplate::FracConductivityEnum>::setUp()
|
||||
{
|
||||
addItem( RimFractureTemplate::INFINITE_CONDUCTIVITY, "InfiniteConductivity", "Infinite Conductivity" );
|
||||
addItem( RimFractureTemplate::FINITE_CONDUCTIVITY, "FiniteConductivity", "Finite Conductivity" );
|
||||
|
||||
addItem( RimFractureTemplate::FINITE_CONDUCTIVITY_INFINITE_WELL_PI,
|
||||
"FiniteConductivityInfiniteWellPI",
|
||||
"Finite Conductivity, Infinite Well PI" );
|
||||
setDefault( RimFractureTemplate::INFINITE_CONDUCTIVITY );
|
||||
}
|
||||
|
||||
@@ -505,7 +507,7 @@ void RimFractureTemplate::prepareFieldsForUiDisplay()
|
||||
m_perforationLength.uiCapability()->setUiHidden( hidePerforationLength );
|
||||
}
|
||||
|
||||
if ( m_conductivityType == FINITE_CONDUCTIVITY )
|
||||
if ( useFiniteConductivityInFracture() )
|
||||
{
|
||||
m_wellDiameter.uiCapability()->setUiHidden( false );
|
||||
}
|
||||
@@ -877,7 +879,7 @@ void RimFractureTemplate::loadDataAndUpdateGeometryHasChanged()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimFracture*> RimFractureTemplate::fracturesUsingThisTemplate() const
|
||||
{
|
||||
return this->objectsWithReferringPtrFieldsOfType<RimFracture>();
|
||||
return objectsWithReferringPtrFieldsOfType<RimFracture>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -949,6 +951,15 @@ RimFractureTemplate::FracConductivityEnum RimFractureTemplate::conductivityType(
|
||||
return m_conductivityType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFractureTemplate::useFiniteConductivityInFracture() const
|
||||
{
|
||||
return conductivityType() == RimFractureTemplate::FINITE_CONDUCTIVITY ||
|
||||
conductivityType() == RimFractureTemplate::FINITE_CONDUCTIVITY_INFINITE_WELL_PI;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -94,6 +94,7 @@ public:
|
||||
{
|
||||
INFINITE_CONDUCTIVITY,
|
||||
FINITE_CONDUCTIVITY,
|
||||
FINITE_CONDUCTIVITY_INFINITE_WELL_PI,
|
||||
};
|
||||
|
||||
enum PermeabilityEnum
|
||||
@@ -139,6 +140,7 @@ public:
|
||||
FracConductivityEnum conductivityType() const;
|
||||
double perforationLength() const;
|
||||
bool useUserDefinedPerforationLength() const;
|
||||
bool useFiniteConductivityInFracture() const;
|
||||
|
||||
double wellPathDepthAtFracture() const;
|
||||
virtual std::pair<double, double> wellPathDepthAtFractureRange() const = 0;
|
||||
|
||||
@@ -85,7 +85,7 @@ RimMeshFractureTemplate::~RimMeshFractureTemplate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimMeshFractureTemplate::activeTimeStepIndex()
|
||||
int RimMeshFractureTemplate::activeTimeStepIndex() const
|
||||
{
|
||||
return m_activeTimeStepIndex;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
RimMeshFractureTemplate();
|
||||
~RimMeshFractureTemplate() override;
|
||||
|
||||
int activeTimeStepIndex();
|
||||
int activeTimeStepIndex() const;
|
||||
|
||||
virtual void setDefaultsBasedOnFile() = 0;
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ void RimMswCompletionParameters::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
if ( changedField == &m_refMDType )
|
||||
{
|
||||
m_refMD.uiCapability()->setUiHidden( m_refMDType == ReferenceMDType::AUTO_REFERENCE_MD );
|
||||
this->updateAllRequiredEditors();
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
if ( changedField == &m_enforceMaxSegmentLength )
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPerforationCollection, "PerforationCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -40,12 +43,12 @@ CAF_PDM_SOURCE_INIT( RimPerforationCollection, "PerforationCollection" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPerforationCollection::RimPerforationCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Perforations", ":/PerforationIntervals16x16.png" );
|
||||
CAF_PDM_InitScriptableObject( "Perforations", ":/PerforationIntervals16x16.png" );
|
||||
|
||||
nameField()->uiCapability()->setUiHidden( true );
|
||||
this->setName( "Perforations" );
|
||||
setName( "Perforations" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_perforations, "Perforations", "Perforations" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_perforations, "Perforations", "Perforations" );
|
||||
m_perforations.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_nonDarcyParameters, "NonDarcyParameters", "Non-Darcy Parameters" );
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathValve.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiDateEditor.h"
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
||||
@@ -42,12 +44,12 @@ CAF_PDM_SOURCE_INIT( RimPerforationInterval, "Perforation" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPerforationInterval::RimPerforationInterval()
|
||||
{
|
||||
CAF_PDM_InitObject( "Perforation", ":/PerforationInterval16x16.png" );
|
||||
CAF_PDM_InitScriptableObject( "Perforation", ":/PerforationInterval16x16.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_startMD, "StartMeasuredDepth", 0.0, "Start MD" );
|
||||
CAF_PDM_InitField( &m_endMD, "EndMeasuredDepth", 0.0, "End MD" );
|
||||
CAF_PDM_InitField( &m_diameter, "Diameter", 0.216, "Diameter" );
|
||||
CAF_PDM_InitField( &m_skinFactor, "SkinFactor", 0.0, "Skin Factor" );
|
||||
CAF_PDM_InitScriptableField( &m_startMD, "StartMeasuredDepth", 0.0, "Start MD" );
|
||||
CAF_PDM_InitScriptableField( &m_endMD, "EndMeasuredDepth", 0.0, "End MD" );
|
||||
CAF_PDM_InitScriptableField( &m_diameter, "Diameter", 0.216, "Diameter" );
|
||||
CAF_PDM_InitScriptableField( &m_skinFactor, "SkinFactor", 0.0, "Skin Factor" );
|
||||
|
||||
CAF_PDM_InitField( &m_startOfHistory_OBSOLETE, "StartOfHistory", true, "All Timesteps" );
|
||||
m_startOfHistory_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
@@ -238,7 +240,7 @@ void RimPerforationInterval::updateAllReferringTracks()
|
||||
{
|
||||
track->loadDataAndUpdate();
|
||||
}
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -320,7 +322,7 @@ void RimPerforationInterval::fieldChangedByUi( const caf::PdmFieldHandle* change
|
||||
}
|
||||
}
|
||||
|
||||
this->updateAllReferringTracks();
|
||||
updateAllReferringTracks();
|
||||
|
||||
RimProject* proj = RimProject::current();
|
||||
proj->reloadCompletionTypeResultsInAllViews();
|
||||
@@ -331,7 +333,7 @@ void RimPerforationInterval::fieldChangedByUi( const caf::PdmFieldHandle* change
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPerforationInterval::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
||||
{
|
||||
this->setName( QString( "%1 - %2" ).arg( m_startMD ).arg( m_endMD ) );
|
||||
setName( QString( "%1 - %2" ).arg( m_startMD ).arg( m_endMD ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -208,11 +208,11 @@ void RimSimWellFracture::updateFracturePositionFromLocation()
|
||||
{
|
||||
computeSimWellBranchesIfRequired();
|
||||
|
||||
if ( m_branchCenterLines.size() > 0 )
|
||||
if ( !m_branchCenterLines.empty() )
|
||||
{
|
||||
cvf::Vec3d interpolated = m_branchCenterLines[m_branchIndex()].interpolatedPointAlongWellPath( m_location() );
|
||||
|
||||
this->setAnchorPosition( interpolated );
|
||||
setAnchorPosition( interpolated );
|
||||
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( proj ) proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
@@ -266,7 +266,7 @@ void RimSimWellFracture::defineEditorAttribute( const caf::PdmFieldHandle* field
|
||||
{
|
||||
computeSimWellBranchesIfRequired();
|
||||
|
||||
if ( m_branchCenterLines.size() > 0 )
|
||||
if ( !m_branchCenterLines.empty() )
|
||||
{
|
||||
const RigSimulationWellCoordsAndMD& pointAndMd = m_branchCenterLines[m_branchIndex];
|
||||
|
||||
@@ -287,12 +287,12 @@ QList<caf::PdmOptionItemInfo> RimSimWellFracture::calculateValueOptions( const c
|
||||
|
||||
if ( fieldNeedingOptions == &m_branchIndex )
|
||||
{
|
||||
if ( m_branchCenterLines.size() == 0 )
|
||||
if ( m_branchCenterLines.empty() )
|
||||
{
|
||||
computeSimWellBranchesIfRequired();
|
||||
}
|
||||
|
||||
if ( m_branchCenterLines.size() > 0 )
|
||||
if ( !m_branchCenterLines.empty() )
|
||||
{
|
||||
size_t branchCount = m_branchCenterLines.size();
|
||||
|
||||
@@ -324,7 +324,7 @@ RigMainGrid* RimSimWellFracture::ownerCaseMainGrid() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellFracture::computeSimWellBranchesIfRequired()
|
||||
{
|
||||
if ( m_branchCenterLines.size() == 0 )
|
||||
if ( m_branchCenterLines.empty() )
|
||||
{
|
||||
computeSimWellBranchCenterLines();
|
||||
}
|
||||
|
||||
@@ -603,12 +603,7 @@ std::vector<double>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimStimPlanFractureTemplate::hasConductivity() const
|
||||
{
|
||||
if ( m_stimPlanFractureDefinitionData.notNull() && !m_stimPlanFractureDefinitionData->conductivityResultNames().isEmpty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return m_stimPlanFractureDefinitionData.notNull() && !m_stimPlanFractureDefinitionData->conductivityResultNames().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include "opm/input/eclipse/Parser/ParserKeywords/W.hpp"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimValveTemplate, "ValveTemplate" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -42,7 +44,7 @@ RimValveTemplate::RimValveTemplate()
|
||||
m_type = RiaDefines::WellPathComponentType::ICD;
|
||||
CAF_PDM_InitField( &m_userLabel, "UserLabel", QString( "Template" ), "Name" );
|
||||
|
||||
this->setName( fullLabel() );
|
||||
setName( fullLabel() );
|
||||
|
||||
CAF_PDM_InitField( &m_orificeDiameter, "OrificeDiameter", 8.0, "Orifice Diameter [mm]" );
|
||||
CAF_PDM_InitField( &m_flowCoefficient, "FlowCoefficient", 0.7, "Flow Coefficient" );
|
||||
@@ -166,6 +168,65 @@ void RimValveTemplate::setUserLabel( const QString& userLabel )
|
||||
m_userLabel = userLabel;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimValveTemplate::setAicdParameter( AICDParameters parameter, double value )
|
||||
{
|
||||
if ( m_aicdParameters() )
|
||||
{
|
||||
m_aicdParameters()->setValue( parameter, value );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimValveTemplate* RimValveTemplate::createAicdTemplate( const RiaOpmParserTools::AicdTemplateValues& aicdParameters, int templateNumber )
|
||||
{
|
||||
RimValveTemplate* aicdTemplate = new RimValveTemplate;
|
||||
aicdTemplate->setType( RiaDefines::WellPathComponentType::AICD );
|
||||
|
||||
QString name;
|
||||
if ( aicdParameters.contains( RiaOpmParserTools::aicdTemplateId() ) )
|
||||
{
|
||||
auto id = aicdParameters.at( RiaOpmParserTools::aicdTemplateId() );
|
||||
name = QString::number( id );
|
||||
}
|
||||
else
|
||||
{
|
||||
name = QString::number( templateNumber );
|
||||
}
|
||||
|
||||
aicdTemplate->setUserLabel( name );
|
||||
|
||||
using namespace Opm::ParserKeywords;
|
||||
std::map<std::string, AICDParameters> parameterMap = { { WSEGAICD::STRENGTH::itemName, AICD_STRENGTH },
|
||||
{ WSEGAICD::DENSITY_CALI::itemName, AICD_DENSITY_CALIB_FLUID },
|
||||
{ WSEGAICD::VISCOSITY_CALI::itemName, AICD_VISCOSITY_CALIB_FLUID },
|
||||
{ WSEGAICD::FLOW_RATE_EXPONENT::itemName, AICD_VOL_FLOW_EXP },
|
||||
{ WSEGAICD::VISC_EXPONENT::itemName, AICD_VISOSITY_FUNC_EXP },
|
||||
{ WSEGAICD::CRITICAL_VALUE::itemName, AICD_CRITICAL_WATER_IN_LIQUID_FRAC },
|
||||
{ WSEGAICD::MAX_ABS_RATE::itemName, AICD_MAX_FLOW_RATE },
|
||||
{ WSEGAICD::OIL_FLOW_FRACTION::itemName, AICD_EXP_OIL_FRAC_DENSITY },
|
||||
{ WSEGAICD::WATER_FLOW_FRACTION::itemName, AICD_EXP_WATER_FRAC_DENSITY },
|
||||
{ WSEGAICD::GAS_FLOW_FRACTION::itemName, AICD_EXP_GAS_FRAC_DENSITY },
|
||||
{ WSEGAICD::OIL_VISC_FRACTION::itemName, AICD_EXP_OIL_FRAC_VISCOSITY },
|
||||
{ WSEGAICD::WATER_VISC_FRACTION::itemName, AICD_EXP_WATER_FRAC_VISCOSITY },
|
||||
{ WSEGAICD::GAS_VISC_FRACTION::itemName, AICD_EXP_GAS_FRAC_VISCOSITY } };
|
||||
|
||||
for ( const auto& parameter : parameterMap )
|
||||
{
|
||||
if ( aicdParameters.contains( parameter.first ) )
|
||||
{
|
||||
auto incomingValue = aicdParameters.at( parameter.first );
|
||||
aicdTemplate->setAicdParameter( parameter.second, incomingValue );
|
||||
}
|
||||
}
|
||||
|
||||
return aicdTemplate;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -234,7 +295,7 @@ void RimValveTemplate::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
{
|
||||
if ( changedField == &m_type || changedField == &m_userLabel )
|
||||
{
|
||||
this->setName( fullLabel() );
|
||||
setName( fullLabel() );
|
||||
}
|
||||
if ( changedField == &m_type )
|
||||
{
|
||||
@@ -252,17 +313,17 @@ void RimValveTemplate::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimValveTemplate::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
||||
{
|
||||
this->setName( fullLabel() );
|
||||
setName( fullLabel() );
|
||||
if ( m_type() == RiaDefines::WellPathComponentType::ICV )
|
||||
{
|
||||
this->setUiIconFromResourceString( ":/ICVValve16x16.png" );
|
||||
setUiIconFromResourceString( ":/ICVValve16x16.png" );
|
||||
}
|
||||
else if ( m_type() == RiaDefines::WellPathComponentType::ICD )
|
||||
{
|
||||
this->setUiIconFromResourceString( ":/ICDValve16x16.png" );
|
||||
setUiIconFromResourceString( ":/ICDValve16x16.png" );
|
||||
}
|
||||
else if ( m_type() == RiaDefines::WellPathComponentType::AICD )
|
||||
{
|
||||
this->setUiIconFromResourceString( ":/AICDValve16x16.png" );
|
||||
setUiIconFromResourceString( ":/AICDValve16x16.png" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaOpmParserTools.h"
|
||||
|
||||
#include "RimCheckableNamedObject.h"
|
||||
#include "RimWellPathAicdParameters.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
|
||||
@@ -48,6 +50,10 @@ public:
|
||||
QString fullLabel() const;
|
||||
void setUserLabel( const QString& userLabel );
|
||||
|
||||
void setAicdParameter( AICDParameters parameter, double value );
|
||||
|
||||
static RimValveTemplate* createAicdTemplate( const RiaOpmParserTools::AicdTemplateValues& aicdParameters, int templateNumber );
|
||||
|
||||
protected:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
@@ -114,6 +114,14 @@ bool RimWellPathAicdParameters::isValid() const
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathAicdParameters::setValue( AICDParameters parameter, double value )
|
||||
{
|
||||
m_aicdParameterFields[parameter].setValue( QString::number( value ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -53,6 +53,8 @@ public:
|
||||
~RimWellPathAicdParameters() override;
|
||||
bool isValid() const;
|
||||
|
||||
void setValue( AICDParameters parameter, double value );
|
||||
|
||||
bool isOpen() const;
|
||||
std::array<double, AICD_NUM_PARAMS> doubleValues() const;
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include "cafPdmDoubleStringValidator.h"
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiDoubleValueEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
@@ -49,9 +51,9 @@ CAF_PDM_SOURCE_INIT( RimWellPathCompletions, "WellPathCompletions" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathCompletions::RimWellPathCompletions()
|
||||
{
|
||||
CAF_PDM_InitObject( "Completions", ":/CompletionsSymbol16x16.png" );
|
||||
CAF_PDM_InitScriptableObject( "Completions", ":/CompletionsSymbol16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_perforationCollection, "Perforations", "Perforations" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_perforationCollection, "Perforations", "Perforations" );
|
||||
m_perforationCollection = new RimPerforationCollection;
|
||||
m_perforationCollection.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathFractureCollection.h"
|
||||
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellPathFracture, "WellPathFracture" );
|
||||
@@ -35,7 +36,7 @@ CAF_PDM_SOURCE_INIT( RimWellPathFracture, "WellPathFracture" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathFracture::RimWellPathFracture()
|
||||
{
|
||||
CAF_PDM_InitObject( "Fracture", ":/FractureSymbol16x16.png" );
|
||||
CAF_PDM_InitScriptableObject( "Fracture", ":/FractureSymbol16x16.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_measuredDepth, "MeasuredDepth", 0.0f, "Measured Depth Location" );
|
||||
m_measuredDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
@@ -246,7 +247,7 @@ void RimWellPathFracture::updatePositionFromMeasuredDepth()
|
||||
positionAlongWellpath = wellPathGeometry->interpolatedPointAlongWellPath( m_measuredDepth() );
|
||||
}
|
||||
|
||||
this->setAnchorPosition( positionAlongWellpath );
|
||||
setAnchorPosition( positionAlongWellpath );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -181,33 +181,33 @@ void RimWellPathValve::applyValveLabelAndIcon()
|
||||
{
|
||||
if ( componentType() == RiaDefines::WellPathComponentType::ICV )
|
||||
{
|
||||
this->setUiIconFromResourceString( ":/ICVValve16x16.png" );
|
||||
setUiIconFromResourceString( ":/ICVValve16x16.png" );
|
||||
QString fullName = QString( "%1: %2" ).arg( componentLabel() ).arg( m_measuredDepth() );
|
||||
this->setName( fullName );
|
||||
setName( fullName );
|
||||
}
|
||||
else if ( componentType() == RiaDefines::WellPathComponentType::ICD )
|
||||
{
|
||||
this->setUiIconFromResourceString( ":/ICDValve16x16.png" );
|
||||
setUiIconFromResourceString( ":/ICDValve16x16.png" );
|
||||
QString fullName = QString( "%1 %2: %3 - %4" )
|
||||
.arg( m_multipleValveLocations->valveLocations().size() )
|
||||
.arg( componentLabel() )
|
||||
.arg( m_multipleValveLocations->rangeStart() )
|
||||
.arg( m_multipleValveLocations->rangeEnd() );
|
||||
this->setName( fullName );
|
||||
setName( fullName );
|
||||
}
|
||||
else if ( componentType() == RiaDefines::WellPathComponentType::AICD )
|
||||
{
|
||||
this->setUiIconFromResourceString( ":/AICDValve16x16.png" );
|
||||
setUiIconFromResourceString( ":/AICDValve16x16.png" );
|
||||
QString fullName = QString( "%1 %2: %3 - %4" )
|
||||
.arg( m_multipleValveLocations->valveLocations().size() )
|
||||
.arg( componentLabel() )
|
||||
.arg( m_multipleValveLocations->rangeStart() )
|
||||
.arg( m_multipleValveLocations->rangeEnd() );
|
||||
this->setName( fullName );
|
||||
setName( fullName );
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setName( "Unspecified Valve" );
|
||||
setName( "Unspecified Valve" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ void RimWellPathValve::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
if ( changedField == &m_valveTemplate )
|
||||
{
|
||||
applyValveLabelAndIcon();
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
else if ( changedField == &m_createValveTemplate )
|
||||
{
|
||||
|
||||
@@ -33,10 +33,12 @@
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "RiuContextMenuLauncher.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
#include "RiuSummaryVectorSelectionDialog.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
@@ -53,7 +55,7 @@ RimAbstractCorrelationPlot::RimAbstractCorrelationPlot()
|
||||
: m_selectMultipleVectors( false )
|
||||
{
|
||||
CAF_PDM_InitObject( "Abstract Correlation Plot", ":/CorrelationPlot16x16.png" );
|
||||
this->setDeletable( true );
|
||||
setDeletable( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedVarsUiField, "SelectedVariableDisplayVar", "Vector" );
|
||||
m_selectedVarsUiField.xmlCapability()->disableIO();
|
||||
@@ -91,6 +93,8 @@ RimAbstractCorrelationPlot::RimAbstractCorrelationPlot()
|
||||
CAF_PDM_InitField( &m_editCaseFilter, "EditCaseFilter", false, "Edit" );
|
||||
m_editCaseFilter.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() );
|
||||
m_editCaseFilter.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
m_analyserOfSelectedCurveDefs = std::make_unique<RiaSummaryCurveDefinitionAnalyser>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -161,8 +165,8 @@ void RimAbstractCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
m_dataSources.push_back( plotEntry );
|
||||
}
|
||||
connectAllCaseSignals();
|
||||
this->loadDataAndUpdate();
|
||||
this->updateConnectedEditors();
|
||||
loadDataAndUpdate();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,17 +174,17 @@ void RimAbstractCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
}
|
||||
else if ( changedField == &m_timeStep )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
this->updateConnectedEditors();
|
||||
loadDataAndUpdate();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
else if ( changedField == &m_showPlotTitle || changedField == &m_useAutoPlotTitle || changedField == &m_description )
|
||||
{
|
||||
this->updatePlotTitle();
|
||||
updatePlotTitle();
|
||||
}
|
||||
else if ( changedField == &m_labelFontSize || changedField == &m_axisTitleFontSize || changedField == &m_axisValueFontSize ||
|
||||
changedField == &m_legendFontSize || changedField == &m_titleFontSize )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
else if ( changedField == &m_timeStepFilter )
|
||||
{
|
||||
@@ -196,17 +200,17 @@ void RimAbstractCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
|
||||
m_timeStep = allDateTimes[filteredTimeStepIndices.back()];
|
||||
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
else if ( changedField == &m_curveSetForFiltering )
|
||||
{
|
||||
connectCurveFilterSignals();
|
||||
|
||||
this->loadDataAndUpdate();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
else if ( changedField == &m_useCaseFilter )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
else if ( changedField == &m_editCaseFilter )
|
||||
{
|
||||
@@ -363,21 +367,16 @@ std::vector<RiaSummaryCurveDefinition> RimAbstractCorrelationPlot::curveDefiniti
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveDefinitionAnalyser* RimAbstractCorrelationPlot::getOrCreateSelectedCurveDefAnalyser()
|
||||
RiaSummaryCurveDefinitionAnalyser* RimAbstractCorrelationPlot::getOrCreateSelectedCurveDefAnalyser() const
|
||||
{
|
||||
if ( !m_analyserOfSelectedCurveDefs )
|
||||
{
|
||||
m_analyserOfSelectedCurveDefs = std::unique_ptr<RiaSummaryCurveDefinitionAnalyser>( new RiaSummaryCurveDefinitionAnalyser );
|
||||
}
|
||||
|
||||
m_analyserOfSelectedCurveDefs->setCurveDefinitions( this->curveDefinitions() );
|
||||
m_analyserOfSelectedCurveDefs->setCurveDefinitions( curveDefinitions() );
|
||||
return m_analyserOfSelectedCurveDefs.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseSummaryAddress> RimAbstractCorrelationPlot::addresses()
|
||||
std::set<RifEclipseSummaryAddress> RimAbstractCorrelationPlot::addresses() const
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> addresses;
|
||||
|
||||
@@ -392,7 +391,7 @@ std::set<RifEclipseSummaryAddress> RimAbstractCorrelationPlot::addresses()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimSummaryCaseCollection*> RimAbstractCorrelationPlot::ensembles()
|
||||
std::set<RimSummaryCaseCollection*> RimAbstractCorrelationPlot::ensembles() const
|
||||
{
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
return analyserOfSelectedCurveDefs->m_ensembles;
|
||||
@@ -554,6 +553,8 @@ RiuPlotWidget* RimAbstractCorrelationPlot::doCreatePlotViewWidget( QWidget* main
|
||||
{
|
||||
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||
updatePlotTitle();
|
||||
|
||||
new RiuContextMenuLauncher( m_plotWidget, { "RicShowPlotDataFeature" } );
|
||||
}
|
||||
|
||||
return m_plotWidget;
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefinitions() const;
|
||||
void setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions );
|
||||
void setTimeStep( std::time_t timeStep );
|
||||
std::set<RimSummaryCaseCollection*> ensembles();
|
||||
std::set<RimSummaryCaseCollection*> ensembles() const;
|
||||
|
||||
// Get summary cases filtered by attached ensemble parameter filter
|
||||
std::set<RimSummaryCase*> filterEnsembleCases( RimSummaryCaseCollection* ensemble ) const;
|
||||
@@ -85,7 +85,7 @@ protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
std::set<RifEclipseSummaryAddress> addresses();
|
||||
std::set<RifEclipseSummaryAddress> addresses() const;
|
||||
std::set<RigEnsembleParameter> ensembleParameters();
|
||||
std::set<RigEnsembleParameter> variationSortedEnsembleParameters();
|
||||
RigEnsembleParameter ensembleParameter( const QString& ensembleParameterName );
|
||||
@@ -128,7 +128,7 @@ private:
|
||||
void connectCurveFilterSignals();
|
||||
void onFilterSourceChanged( const caf::SignalEmitter* emitter );
|
||||
|
||||
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser() const;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<RiaSummaryCurveDefinitionAnalyser> m_analyserOfSelectedCurveDefs;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "RiaStatisticsTools.h"
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
#include "RifCsvDataTableFormatter.h"
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RigEnsembleParameter.h"
|
||||
@@ -108,44 +109,6 @@ private:
|
||||
std::map<size_t, QString> m_tickLabels;
|
||||
};
|
||||
|
||||
template <typename KeyType, typename ValueType>
|
||||
class CorrelationMatrixRowOrColumn
|
||||
{
|
||||
public:
|
||||
CorrelationMatrixRowOrColumn( const KeyType& key, const std::vector<double>& correlations, const std::vector<ValueType>& values )
|
||||
: m_key( key )
|
||||
, m_correlations( correlations )
|
||||
, m_values( values )
|
||||
, m_correlationSum( 0.0 )
|
||||
, m_correlationAbsSum( 0.0 )
|
||||
{
|
||||
bool anyValid = false;
|
||||
for ( auto value : correlations )
|
||||
{
|
||||
if ( RiaCurveDataTools::isValidValue( value, false ) )
|
||||
{
|
||||
m_correlationSum += value;
|
||||
m_correlationAbsSum += std::abs( value );
|
||||
anyValid = true;
|
||||
}
|
||||
}
|
||||
if ( !anyValid )
|
||||
{
|
||||
m_correlationSum = std::numeric_limits<double>::infinity();
|
||||
m_correlationAbsSum = std::numeric_limits<double>::infinity();
|
||||
}
|
||||
}
|
||||
|
||||
KeyType m_key;
|
||||
std::vector<double> m_correlations;
|
||||
std::vector<ValueType> m_values;
|
||||
double m_correlationSum;
|
||||
double m_correlationAbsSum;
|
||||
};
|
||||
|
||||
using CorrelationMatrixColumn = CorrelationMatrixRowOrColumn<QString, RiaSummaryCurveDefinition>;
|
||||
using CorrelationMatrixRow = CorrelationMatrixRowOrColumn<RiaSummaryCurveDefinition, QString>;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -171,7 +134,7 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
|
||||
|
||||
setLegendsVisible( false );
|
||||
|
||||
this->uiCapability()->setUiTreeChildrenHidden( true );
|
||||
uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_selectMultipleVectors = true;
|
||||
}
|
||||
|
||||
@@ -249,6 +212,45 @@ bool RimCorrelationMatrixPlot::isCurveHighlightSupported() const
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCorrelationMatrixPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
QString text;
|
||||
|
||||
QTextStream stream( &text );
|
||||
QString fieldSeparator = "\t";
|
||||
RifCsvDataTableFormatter formatter( stream, fieldSeparator );
|
||||
formatter.setUseQuotes( false );
|
||||
|
||||
std::vector<RifTextDataTableColumn> header;
|
||||
header.emplace_back( RifTextDataTableColumn( "Vector" ) );
|
||||
|
||||
for ( const auto& param : m_paramLabels )
|
||||
{
|
||||
header.emplace_back( RifTextDataTableColumn( param.second ) );
|
||||
}
|
||||
|
||||
formatter.header( header );
|
||||
|
||||
for ( const auto& row : m_valuesForTextReport )
|
||||
{
|
||||
formatter.add( QString::fromStdString( row.m_key.summaryAddressY().uiText() ) );
|
||||
|
||||
for ( const auto& corr : row.m_correlations )
|
||||
{
|
||||
formatter.add( corr );
|
||||
}
|
||||
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
|
||||
formatter.tableCompleted();
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -376,8 +378,8 @@ void RimCorrelationMatrixPlot::onLoadDataAndUpdate()
|
||||
|
||||
m_plotWidget->qwtPlot()->insertLegend( nullptr );
|
||||
|
||||
this->updateAxes();
|
||||
this->updatePlotTitle();
|
||||
updateAxes();
|
||||
updatePlotTitle();
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
@@ -387,7 +389,7 @@ void RimCorrelationMatrixPlot::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationMatrixPlot::childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -511,7 +513,7 @@ void RimCorrelationMatrixPlot::createMatrix()
|
||||
for ( auto curveDef : curveDefs )
|
||||
{
|
||||
auto ensemble = curveDef.ensemble();
|
||||
auto address = curveDef.summaryAddress();
|
||||
auto address = curveDef.summaryAddressY();
|
||||
|
||||
if ( ensemble )
|
||||
{
|
||||
@@ -534,10 +536,10 @@ void RimCorrelationMatrixPlot::createMatrix()
|
||||
RifSummaryReaderInterface* reader = summaryCase->summaryReader();
|
||||
if ( reader )
|
||||
{
|
||||
std::vector<double> values;
|
||||
double closestValue = std::numeric_limits<double>::infinity();
|
||||
time_t closestTimeStep = 0;
|
||||
if ( reader->values( address, &values ) )
|
||||
double closestValue = std::numeric_limits<double>::infinity();
|
||||
time_t closestTimeStep = 0;
|
||||
auto [isOk, values] = reader->values( address );
|
||||
if ( isOk )
|
||||
{
|
||||
const std::vector<time_t>& timeSteps = reader->timeSteps( address );
|
||||
for ( size_t i = 0; i < timeSteps.size(); ++i )
|
||||
@@ -645,6 +647,8 @@ void RimCorrelationMatrixPlot::createMatrix()
|
||||
|
||||
m_resultLabels[rowIdx] = resultLabel;
|
||||
}
|
||||
|
||||
m_valuesForTextReport = correlationMatrixRows;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
#include "RimAbstractCorrelationPlot.h"
|
||||
|
||||
#include "RiaCurveDataTools.h"
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
class RimRegularLegendConfig;
|
||||
@@ -28,6 +31,48 @@ class RimSummaryAddress;
|
||||
class RiuGroupedBarChartBuilder;
|
||||
class RiuPlotItem;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
template <typename KeyType, typename ValueType>
|
||||
class CorrelationMatrixRowOrColumn
|
||||
{
|
||||
public:
|
||||
CorrelationMatrixRowOrColumn( const KeyType& key, const std::vector<double>& correlations, const std::vector<ValueType>& values )
|
||||
: m_key( key )
|
||||
, m_correlations( correlations )
|
||||
, m_values( values )
|
||||
, m_correlationSum( 0.0 )
|
||||
, m_correlationAbsSum( 0.0 )
|
||||
{
|
||||
bool anyValid = false;
|
||||
for ( auto value : correlations )
|
||||
{
|
||||
if ( RiaCurveDataTools::isValidValue( value, false ) )
|
||||
{
|
||||
m_correlationSum += value;
|
||||
m_correlationAbsSum += std::abs( value );
|
||||
anyValid = true;
|
||||
}
|
||||
}
|
||||
if ( !anyValid )
|
||||
{
|
||||
m_correlationSum = std::numeric_limits<double>::infinity();
|
||||
m_correlationAbsSum = std::numeric_limits<double>::infinity();
|
||||
}
|
||||
}
|
||||
|
||||
KeyType m_key;
|
||||
std::vector<double> m_correlations;
|
||||
std::vector<ValueType> m_values;
|
||||
double m_correlationSum;
|
||||
double m_correlationAbsSum;
|
||||
};
|
||||
|
||||
using CorrelationMatrixColumn = CorrelationMatrixRowOrColumn<QString, RiaSummaryCurveDefinition>;
|
||||
using CorrelationMatrixRow = CorrelationMatrixRowOrColumn<RiaSummaryCurveDefinition, QString>;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@@ -60,6 +105,7 @@ public:
|
||||
bool showTopNCorrelations() const;
|
||||
int topNFilterCount() const;
|
||||
bool isCurveHighlightSupported() const override;
|
||||
QString asciiDataForPlotExport() const override;
|
||||
|
||||
private:
|
||||
// Overridden PDM methods
|
||||
@@ -94,4 +140,6 @@ private:
|
||||
|
||||
std::map<size_t, QString> m_paramLabels;
|
||||
std::map<size_t, QString> m_resultLabels;
|
||||
|
||||
std::vector<CorrelationMatrixRow> m_valuesForTextReport;
|
||||
};
|
||||
|
||||
@@ -195,8 +195,8 @@ void RimCorrelationPlot::onLoadDataAndUpdate()
|
||||
m_plotWidget->qwtPlot()->insertLegend( nullptr );
|
||||
m_plotWidget->updateLegend();
|
||||
|
||||
this->updateAxes();
|
||||
this->updatePlotTitle();
|
||||
updateAxes();
|
||||
updatePlotTitle();
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ void RimCorrelationPlot::updateAxes()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder )
|
||||
void RimCorrelationPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder ) const
|
||||
{
|
||||
time_t selectedTimestep = m_timeStep().toSecsSinceEpoch();
|
||||
|
||||
@@ -295,6 +295,17 @@ void RimCorrelationPlot::onPlotItemSelected( std::shared_ptr<RiuPlotItem> plotIt
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCorrelationPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
RiuGroupedBarChartBuilder chartBuilder;
|
||||
addDataToChartBuilder( chartBuilder );
|
||||
|
||||
return chartBuilder.plotContentAsText();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -61,15 +61,14 @@ private:
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
void updateAxes() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void updateAxes() override;
|
||||
QString asciiDataForPlotExport() const override;
|
||||
|
||||
// Private methods
|
||||
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder );
|
||||
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder ) const;
|
||||
void updatePlotTitle() override;
|
||||
void onPlotItemSelected( std::shared_ptr<RiuPlotItem> plotItem, bool toggle, int sampleIndex ) override;
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToReport( Rim
|
||||
|
||||
time_t timeStep = *( plot->matrixPlot()->allAvailableTimeSteps().rbegin() );
|
||||
auto correlationSortedEnsembleParameters =
|
||||
ensembles.front()->correlationSortedEnsembleParameters( curveDefsTornadoAndCrossPlot.front().summaryAddress(), timeStep );
|
||||
ensembles.front()->correlationSortedEnsembleParameters( curveDefsTornadoAndCrossPlot.front().summaryAddressY(), timeStep );
|
||||
if ( !correlationSortedEnsembleParameters.empty() )
|
||||
{
|
||||
QString crossPlotEnsembleParameterName = correlationSortedEnsembleParameters.front().first.name;
|
||||
@@ -369,7 +369,7 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToReport( RimCor
|
||||
plot->crossPlot()->setTimeStep( timeStep );
|
||||
|
||||
auto correlationSortedEnsembleParameters =
|
||||
ensemble->correlationSortedEnsembleParameters( curveDefsTornadoAndCrossPlot.front().summaryAddress(), timeStep );
|
||||
ensemble->correlationSortedEnsembleParameters( curveDefsTornadoAndCrossPlot.front().summaryAddressY(), timeStep );
|
||||
QString crossPlotEnsembleParameterName = correlationSortedEnsembleParameters.front().first.name;
|
||||
plot->crossPlot()->setEnsembleParameter( crossPlotEnsembleParameterName );
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ CAF_PDM_SOURCE_INIT( RimCorrelationReportPlot, "CorrelationReportPlot" );
|
||||
RimCorrelationReportPlot::RimCorrelationReportPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Correlation Report Plot", ":/CorrelationReportPlot16x16.png" );
|
||||
this->setDeletable( true );
|
||||
setDeletable( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plotWindowTitle, "PlotWindowTitle", "Title" );
|
||||
m_plotWindowTitle.registerGetMethod( this, &RimCorrelationReportPlot::createPlotWindowTitle );
|
||||
@@ -91,7 +91,7 @@ RimCorrelationReportPlot::RimCorrelationReportPlot()
|
||||
m_parameterResultCrossPlot = new RimParameterResultCrossPlot;
|
||||
m_parameterResultCrossPlot->setLegendsVisible( true );
|
||||
|
||||
this->uiCapability()->setUiTreeChildrenHidden( true );
|
||||
uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
m_correlationMatrixPlot->matrixCellSelected.connect( this, &RimCorrelationReportPlot::onDataSelection );
|
||||
m_correlationPlot->tornadoItemSelected.connect( this, &RimCorrelationReportPlot::onDataSelection );
|
||||
@@ -367,7 +367,7 @@ void RimCorrelationReportPlot::defineUiOrdering( QString uiConfigName, caf::PdmU
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationReportPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -375,7 +375,7 @@ void RimCorrelationReportPlot::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationReportPlot::childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -106,8 +106,8 @@ void RimParameterResultCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* c
|
||||
RimAbstractCorrelationPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
if ( changedField == &m_ensembleParameter )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
this->updateConnectedEditors();
|
||||
loadDataAndUpdate();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +171,8 @@ void RimParameterResultCrossPlot::onLoadDataAndUpdate()
|
||||
m_plotWidget->updateLegend();
|
||||
}
|
||||
|
||||
this->updateAxes();
|
||||
this->updatePlotTitle();
|
||||
updateAxes();
|
||||
updatePlotTitle();
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
@@ -223,6 +223,7 @@ QStringList caseNamesOfValidEnsembleCases( const RimSummaryCaseCollection* ensem
|
||||
void RimParameterResultCrossPlot::createPoints()
|
||||
{
|
||||
detachAllCurves();
|
||||
m_valuesForTextReport.clear();
|
||||
|
||||
time_t selectedTimestep = m_timeStep().toSecsSinceEpoch();
|
||||
|
||||
@@ -261,11 +262,10 @@ void RimParameterResultCrossPlot::createPoints()
|
||||
|
||||
if ( !summaryCase->caseRealizationParameters() ) continue;
|
||||
|
||||
std::vector<double> values;
|
||||
|
||||
double closestValue = std::numeric_limits<double>::infinity();
|
||||
time_t closestTimeStep = 0;
|
||||
if ( reader->values( address, &values ) )
|
||||
auto [isOk, values] = reader->values( address );
|
||||
if ( isOk )
|
||||
{
|
||||
const std::vector<time_t>& timeSteps = reader->timeSteps( address );
|
||||
for ( size_t i = 0; i < timeSteps.size(); ++i )
|
||||
@@ -286,6 +286,8 @@ void RimParameterResultCrossPlot::createPoints()
|
||||
double paramValue = parameter.values[caseIdx].toDouble();
|
||||
parameterValues.push_back( paramValue );
|
||||
|
||||
m_valuesForTextReport.push_back( { paramValue, closestValue } );
|
||||
|
||||
m_xRange.first = std::min( m_xRange.first, paramValue );
|
||||
m_xRange.second = std::max( m_xRange.second, paramValue );
|
||||
|
||||
@@ -315,6 +317,22 @@ void RimParameterResultCrossPlot::createPoints()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimParameterResultCrossPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
QString asciiData;
|
||||
|
||||
asciiData += "Parameter\tResult\n";
|
||||
for ( const auto& valuePair : m_valuesForTextReport )
|
||||
{
|
||||
asciiData += QString( "%1\t%2\n" ).arg( valuePair.first ).arg( valuePair.second );
|
||||
}
|
||||
|
||||
return asciiData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -41,9 +41,9 @@ private:
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
void updateAxes() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void updateAxes() override;
|
||||
QString asciiDataForPlotExport() const override;
|
||||
|
||||
// Private methods
|
||||
void updatePlotTitle() override;
|
||||
@@ -54,4 +54,6 @@ private:
|
||||
|
||||
std::pair<double, double> m_xRange;
|
||||
std::pair<double, double> m_yRange;
|
||||
|
||||
std::vector<std::pair<double, double>> m_valuesForTextReport;
|
||||
};
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModel.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModelCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationDataAccess.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationEnums.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModel.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModelCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationDataAccess.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -65,7 +65,7 @@ caf::PdmFieldHandle* RimFaultInView::userDescriptionField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
this->updateUiIconFromToggleField();
|
||||
updateUiIconFromToggleField();
|
||||
|
||||
if ( &faultColor == changedField || &showFault == changedField )
|
||||
{
|
||||
@@ -83,7 +83,7 @@ void RimFaultInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultInView::initAfterRead()
|
||||
{
|
||||
this->updateUiIconFromToggleField();
|
||||
updateUiIconFromToggleField();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -101,7 +101,7 @@ void RimFaultInView::setFaultGeometry( const RigFault* faultGeometry )
|
||||
{
|
||||
m_rigFault = faultGeometry;
|
||||
|
||||
this->name = faultGeometry->name();
|
||||
name = faultGeometry->name();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -190,7 +190,7 @@ bool RimFaultInViewCollection::hideNNCsWhenNoResultIsAvailable() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
this->updateUiIconFromToggleField();
|
||||
updateUiIconFromToggleField();
|
||||
|
||||
if ( &m_faultLabelColor == changedField )
|
||||
{
|
||||
@@ -307,7 +307,7 @@ void RimFaultInViewCollection::syncronizeFaults()
|
||||
// Find corresponding fault from data model, or create a new
|
||||
for ( size_t fIdx = 0; fIdx < rigFaults.size(); ++fIdx )
|
||||
{
|
||||
RimFaultInView* rimFault = this->findFaultByName( rigFaults[fIdx]->name() );
|
||||
RimFaultInView* rimFault = findFaultByName( rigFaults[fIdx]->name() );
|
||||
|
||||
if ( !rimFault )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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 "RimFaultReactivationDataAccess.h"
|
||||
|
||||
#include "RiaPorosityModel.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigFault.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationDataAccess::RimFaultReactivationDataAccess( RimEclipseCase* thecase, size_t timeStepIndex )
|
||||
: m_case( thecase )
|
||||
, m_caseData( nullptr )
|
||||
, m_mainGrid( nullptr )
|
||||
, m_timeStepIndex( timeStepIndex )
|
||||
{
|
||||
if ( m_case )
|
||||
{
|
||||
m_caseData = m_case->eclipseCaseData();
|
||||
m_mainGrid = m_case->mainGrid();
|
||||
}
|
||||
if ( m_caseData )
|
||||
{
|
||||
RigEclipseResultAddress resVarAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "PRESSURE" );
|
||||
|
||||
m_case->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->ensureKnownResultLoaded( resVarAddress );
|
||||
|
||||
m_resultAccessor = RigResultAccessorFactory::createFromResultAddress( m_caseData,
|
||||
0,
|
||||
RiaDefines::PorosityModelType::MATRIX_MODEL,
|
||||
timeStepIndex,
|
||||
resVarAddress );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationDataAccess::~RimFaultReactivationDataAccess()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationDataAccess::useCellIndexAdjustment( std::map<size_t, size_t> adjustments )
|
||||
{
|
||||
m_cellIndexAdjustment = adjustments;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimFaultReactivationDataAccess::findAdjustedCellIndex( const cvf::Vec3d& position,
|
||||
const RigMainGrid* grid,
|
||||
const std::map<size_t, size_t>& cellIndexAdjustmentMap )
|
||||
{
|
||||
CAF_ASSERT( grid != nullptr );
|
||||
|
||||
size_t cellIdx = grid->findReservoirCellIndexFromPoint( position );
|
||||
|
||||
// adjust cell index if present in the map
|
||||
if ( auto search = cellIndexAdjustmentMap.find( cellIdx ); search != cellIndexAdjustmentMap.end() )
|
||||
{
|
||||
cellIdx = search->second;
|
||||
}
|
||||
|
||||
return cellIdx;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimFaultReactivationDataAccess::porePressureAtPosition( const cvf::Vec3d& position, double defaultPorePressureGradient ) const
|
||||
{
|
||||
if ( ( m_mainGrid != nullptr ) && m_resultAccessor.notNull() )
|
||||
{
|
||||
auto cellIdx = findAdjustedCellIndex( position, m_mainGrid, m_cellIndexAdjustment );
|
||||
|
||||
if ( ( cellIdx != cvf::UNDEFINED_SIZE_T ) )
|
||||
{
|
||||
double value = m_resultAccessor->cellScalar( cellIdx );
|
||||
if ( !std::isinf( value ) )
|
||||
{
|
||||
return 100000.0 * m_resultAccessor->cellScalar( cellIdx ); // return in pascal, not bar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return calculatePorePressure( std::abs( position.z() ), defaultPorePressureGradient );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimFaultReactivationDataAccess::calculatePorePressure( double depth, double gradient )
|
||||
{
|
||||
return gradient * 9.81 * depth * 1000.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimFaultReactivationDataAccess::timeStepIndex() const
|
||||
{
|
||||
return m_timeStepIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationDataAccess::elementHasValidData( std::vector<cvf::Vec3d> elementCorners ) const
|
||||
{
|
||||
int nValid = 0;
|
||||
for ( auto& p : elementCorners )
|
||||
{
|
||||
auto cellIdx = findAdjustedCellIndex( p, m_mainGrid, m_cellIndexAdjustment );
|
||||
|
||||
if ( ( cellIdx != cvf::UNDEFINED_SIZE_T ) )
|
||||
{
|
||||
double value = m_resultAccessor->cellScalar( cellIdx );
|
||||
if ( !std::isinf( value ) )
|
||||
{
|
||||
nValid++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if more than half of the nodes have valid data, we're ok
|
||||
return nValid > 4;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021 - 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 "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
class RimEclipseCase;
|
||||
class RigEclipseCaseData;
|
||||
class RigResultAccessor;
|
||||
class RigMainGrid;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimFaultReactivationDataAccess
|
||||
{
|
||||
public:
|
||||
RimFaultReactivationDataAccess( RimEclipseCase* thecase, size_t timeStepIndex );
|
||||
~RimFaultReactivationDataAccess();
|
||||
|
||||
void useCellIndexAdjustment( std::map<size_t, size_t> adjustments );
|
||||
|
||||
double porePressureAtPosition( const cvf::Vec3d& position, double defaultPorePressureGradient ) const;
|
||||
|
||||
size_t timeStepIndex() const;
|
||||
|
||||
static size_t
|
||||
findAdjustedCellIndex( const cvf::Vec3d& position, const RigMainGrid* grid, const std::map<size_t, size_t>& cellIndexAdjustmentMap );
|
||||
|
||||
bool elementHasValidData( std::vector<cvf::Vec3d> elementCorners ) const;
|
||||
|
||||
protected:
|
||||
static double calculatePorePressure( double depth, double gradient );
|
||||
|
||||
private:
|
||||
RimEclipseCase* m_case;
|
||||
RigEclipseCaseData* m_caseData;
|
||||
const RigMainGrid* m_mainGrid;
|
||||
size_t m_timeStepIndex;
|
||||
cvf::ref<RigResultAccessor> m_resultAccessor;
|
||||
std::map<size_t, size_t> m_cellIndexAdjustment;
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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
|
||||
|
||||
namespace RimFaultReactivation
|
||||
{
|
||||
|
||||
enum class ModelParts
|
||||
{
|
||||
HiPart1,
|
||||
MidPart1,
|
||||
LowPart1,
|
||||
HiPart2,
|
||||
MidPart2,
|
||||
LowPart2
|
||||
};
|
||||
|
||||
enum class GridPart
|
||||
{
|
||||
PART1,
|
||||
PART2
|
||||
};
|
||||
|
||||
enum class BorderSurface
|
||||
{
|
||||
UpperSurface,
|
||||
FaultSurface,
|
||||
LowerSurface
|
||||
};
|
||||
|
||||
enum class Boundary
|
||||
{
|
||||
FarSide,
|
||||
Bottom
|
||||
};
|
||||
|
||||
enum class ElementSets
|
||||
{
|
||||
OverBurden,
|
||||
UnderBurden,
|
||||
Reservoir,
|
||||
IntraReservoir
|
||||
};
|
||||
|
||||
} // namespace RimFaultReactivation
|
||||
@@ -0,0 +1,768 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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 "RimFaultReactivationModel.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaPreferencesGeoMech.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include "RifJsonEncodeDecode.h"
|
||||
#include "RifParameterXmlReader.h"
|
||||
|
||||
#include "RigBasicPlane.h"
|
||||
#include "RigFaultReactivationModel.h"
|
||||
#include "RigPolyLinesData.h"
|
||||
|
||||
#include "WellPathCommands/PointTangentManipulator/RicPolyline3dEditor.h"
|
||||
#include "WellPathCommands/RicPolylineTargetsPickEventHandler.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "RivFaultReactivationModelPartMgr.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimDoubleParameter.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFaultInView.h"
|
||||
#include "RimFaultInViewCollection.h"
|
||||
#include "RimFaultReactivationDataAccess.h"
|
||||
#include "RimFaultReactivationTools.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimParameterGroup.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimTimeStepFilter.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
#include "cafPdmUiTableViewEditor.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
|
||||
#include "cvfPlane.h"
|
||||
#include "cvfTextureImage.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimFaultReactivationModel, "FaultReactivationModel" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationModel::RimFaultReactivationModel()
|
||||
: m_pickTargetsEventHandler( new RicPolylineTargetsPickEventHandler( this ) )
|
||||
{
|
||||
CAF_PDM_InitObject( "Fault Reactivation Model", ":/fault_react_24x24.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_userDescription, "UserDescription", QString( "Model" ), "Name" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_geomechCase, "GeoMechCase", "Global GeoMech Model" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDirectory", "Working folder" );
|
||||
CAF_PDM_InitField( &m_modelThickness, "ModelThickness", 100.0, "Model Cell Thickness" );
|
||||
CAF_PDM_InitField( &m_extentHorizontal, "HorizontalExtent", 1000.0, "Horizontal Extent" );
|
||||
CAF_PDM_InitField( &m_extentVerticalAbove, "VerticalExtentAbove", 200.0, "Vertical Extent Above Anchor" );
|
||||
m_extentVerticalAbove.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
m_extentVerticalAbove.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::TOP );
|
||||
|
||||
CAF_PDM_InitField( &m_extentVerticalBelow, "VerticalExtentBelow", 200.0, "Vertical Extent Below Anchor" );
|
||||
m_extentVerticalBelow.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
m_extentVerticalBelow.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::TOP );
|
||||
|
||||
CAF_PDM_InitField( &m_modelExtentFromAnchor, "ModelExtentFromAnchor", 1000.0, "Horz. Extent from Anchor" );
|
||||
CAF_PDM_InitField( &m_modelMinZ, "ModelMinZ", 0.0, "Start Depth" );
|
||||
CAF_PDM_InitField( &m_modelBelowSize, "ModelBelowSize", 500.0, "Depth Below Fault" );
|
||||
|
||||
CAF_PDM_InitField( &m_showFaultPlane, "ShowFaultPlane", true, "Show Fault Plane" );
|
||||
CAF_PDM_InitField( &m_showModelPlane, "ShowModelPlane", false, "Show 2D Model" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_fault, "Fault", "Fault" );
|
||||
m_fault.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitField( &m_faultPlaneColor, "FaultPlaneColor", cvf::Color3f( cvf::Color3f::GRAY ), "Plane Color" );
|
||||
CAF_PDM_InitField( &m_modelPart1Color, "ModelPart1Color", cvf::Color3f( cvf::Color3f::GREEN ), "Part 1 Color" );
|
||||
CAF_PDM_InitField( &m_modelPart2Color, "ModelPart2Color", cvf::Color3f( cvf::Color3f::BLUE ), "Part 2 Color" );
|
||||
|
||||
CAF_PDM_InitField( &m_numberOfCellsHorzPart1, "NumberOfCellsHorzPart1", 20, "Horizontal Number of Cells, Part 1" );
|
||||
CAF_PDM_InitField( &m_numberOfCellsHorzPart2, "NumberOfCellsHorzPart2", 20, "Horizontal Number of Cells, Part 2" );
|
||||
CAF_PDM_InitField( &m_numberOfCellsVertUp, "NumberOfCellsVertUp", 20, "Vertical Number of Cells, Upper Part" );
|
||||
CAF_PDM_InitField( &m_numberOfCellsVertMid, "NumberOfCellsVertMid", 20, "Vertical Number of Cells, Middle Part" );
|
||||
CAF_PDM_InitField( &m_numberOfCellsVertLow, "NumberOfCellsVertLow", 20, "Vertical Number of Cells, Lower Part" );
|
||||
|
||||
CAF_PDM_InitField( &m_useLocalCoordinates, "UseLocalCoordinates", false, "Export Using Local Coordinates" );
|
||||
|
||||
// Time Step Selection
|
||||
CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Available Time Steps" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "Select Time Steps" );
|
||||
m_selectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||
m_selectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_targets, "Targets", "Targets" );
|
||||
m_targets.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
|
||||
m_targets.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_targets.uiCapability()->setUiTreeHidden( true );
|
||||
m_targets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
m_targets.uiCapability()->setCustomContextMenuEnabled( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_materialParameters, "MaterialParameters", "Materials", ":/Bullet.png" );
|
||||
|
||||
this->setUi3dEditorTypeName( RicPolyline3dEditor::uiEditorTypeName() );
|
||||
|
||||
setDeletable( true );
|
||||
|
||||
m_faultPlane = new RigBasicPlane();
|
||||
m_modelPlane = new RigFaultReactivationModel();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationModel::~RimFaultReactivationModel()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::initAfterRead()
|
||||
{
|
||||
updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModel::initSettings( QString& outErrmsg )
|
||||
{
|
||||
RifParameterXmlReader basicreader( RiaPreferencesGeoMech::current()->geomechFRMDefaultXML() );
|
||||
if ( !basicreader.parseFile( outErrmsg ) ) return false;
|
||||
|
||||
m_materialParameters.deleteChildren();
|
||||
for ( auto group : basicreader.parameterGroups() )
|
||||
{
|
||||
m_materialParameters.push_back( group );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultReactivationModel::userDescription()
|
||||
{
|
||||
return m_userDescription;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::setUserDescription( QString description )
|
||||
{
|
||||
m_userDescription = description;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimFaultReactivationModel::userDescriptionField()
|
||||
{
|
||||
return &m_userDescription;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<bool, std::string> RimFaultReactivationModel::validateBeforeRun() const
|
||||
{
|
||||
if ( fault() == nullptr )
|
||||
{
|
||||
return std::make_pair( false, "A fault has not been selected. Please check your model settings." );
|
||||
}
|
||||
|
||||
if ( selectedTimeSteps().size() < 2 )
|
||||
{
|
||||
return std::make_pair( false, "You need at least 2 selected timesteps. Please check your model settings." );
|
||||
}
|
||||
|
||||
if ( selectedTimeSteps()[0] != m_availableTimeSteps[0] )
|
||||
{
|
||||
return std::make_pair( false, "The first available timestep must always be selected. Please check your model settings." );
|
||||
}
|
||||
|
||||
return std::make_pair( true, "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::setFault( RimFaultInView* fault )
|
||||
{
|
||||
m_fault = fault;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultInView* RimFaultReactivationModel::fault() const
|
||||
{
|
||||
return m_fault();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::setTargets( cvf::Vec3d target1, cvf::Vec3d target2 )
|
||||
{
|
||||
m_targets.deleteChildren();
|
||||
|
||||
RimPolylineTarget* planeCenter = new RimPolylineTarget();
|
||||
planeCenter->setAsPointXYZ( target1 );
|
||||
|
||||
m_targets.push_back( planeCenter );
|
||||
|
||||
RimPolylineTarget* steeringTarget = new RimPolylineTarget();
|
||||
steeringTarget->setAsPointXYZ( target2 );
|
||||
|
||||
m_targets.push_back( steeringTarget );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylineTarget*> RimFaultReactivationModel::activeTargets() const
|
||||
{
|
||||
return m_targets.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert )
|
||||
{
|
||||
// do nothing, we should only have 2 predefined targets
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::deleteTarget( RimPolylineTarget* targetToDelete )
|
||||
{
|
||||
// do nothing, we should always have 2 predefined targets
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModel::pickingEnabled() const
|
||||
{
|
||||
// never pick, we only have our 2 predefined targets
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PickEventHandler* RimFaultReactivationModel::pickEventHandler() const
|
||||
{
|
||||
return m_pickTargetsEventHandler.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::updateVisualization()
|
||||
{
|
||||
auto view = firstAncestorOrThisOfType<Rim3dView>();
|
||||
if ( !view ) return;
|
||||
|
||||
auto normal = m_targets[1]->targetPointXYZ() - m_targets[0]->targetPointXYZ();
|
||||
normal.z() = normal.z() * view->scaleZ() * view->scaleZ();
|
||||
normal.normalize();
|
||||
|
||||
m_faultPlane->setPlane( m_targets[0]->targetPointXYZ(), normal );
|
||||
m_faultPlane->setMaxExtentFromAnchor( m_extentHorizontal, m_extentVerticalAbove, m_extentVerticalBelow );
|
||||
m_faultPlane->setColor( m_faultPlaneColor );
|
||||
m_faultPlane->updateRect();
|
||||
|
||||
double maxZ = m_faultPlane->maxDepth();
|
||||
auto [topInt, bottomInt] = m_faultPlane->intersectTopBottomLine();
|
||||
|
||||
cvf::Vec3d zdir( 0, 0, 1 );
|
||||
auto modelNormal = normal ^ zdir;
|
||||
modelNormal.normalize();
|
||||
|
||||
m_modelPlane->setPlane( m_targets[0]->targetPointXYZ(), modelNormal );
|
||||
m_modelPlane->setFaultPlaneIntersect( topInt, bottomInt );
|
||||
m_modelPlane->setMaxExtentFromAnchor( m_modelExtentFromAnchor, m_modelMinZ, maxZ + m_modelBelowSize );
|
||||
m_modelPlane->setPartColors( m_modelPart1Color, m_modelPart2Color );
|
||||
m_modelPlane->setCellCounts( m_numberOfCellsHorzPart1,
|
||||
m_numberOfCellsHorzPart2,
|
||||
m_numberOfCellsVertUp,
|
||||
m_numberOfCellsVertMid,
|
||||
m_numberOfCellsVertLow );
|
||||
m_modelPlane->setThickness( m_modelThickness );
|
||||
|
||||
// set up transform to local coordinate system
|
||||
{
|
||||
auto [xVec, yVec] = localCoordSysNormalsXY();
|
||||
cvf::Mat4d transform = cvf::Mat4d::fromCoordSystemAxes( &xVec, &yVec, &cvf::Vec3d::Z_AXIS );
|
||||
cvf::Vec3d center = m_targets[0]->targetPointXYZ() * -1.0;
|
||||
center.z() = 0.0;
|
||||
center.transformPoint( transform );
|
||||
transform.setTranslation( center );
|
||||
m_modelPlane->setLocalCoordTransformation( transform );
|
||||
m_modelPlane->setUseLocalCoordinates( m_useLocalCoordinates );
|
||||
}
|
||||
|
||||
m_modelPlane->updateGeometry();
|
||||
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::updateEditorsAndVisualization()
|
||||
{
|
||||
updateConnectedEditors();
|
||||
updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigPolyLinesData> RimFaultReactivationModel::polyLinesData() const
|
||||
{
|
||||
cvf::ref<RigPolyLinesData> pld = new RigPolyLinesData;
|
||||
|
||||
std::vector<cvf::Vec3d> line;
|
||||
for ( const RimPolylineTarget* target : m_targets )
|
||||
{
|
||||
line.push_back( target->targetPointXYZ() );
|
||||
}
|
||||
pld->setPolyLine( line );
|
||||
|
||||
return pld;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimFaultReactivationModel::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_fault )
|
||||
{
|
||||
if ( m_fault() != nullptr )
|
||||
{
|
||||
auto coll = m_fault->firstAncestorOrThisOfType<RimFaultInViewCollection>();
|
||||
if ( coll != nullptr ) RimTools::faultOptionItems( &options, coll );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_selectedTimeSteps )
|
||||
{
|
||||
RimTimeStepFilter::timeStepOptions( options, &m_selectedTimeSteps, m_availableTimeSteps, m_selectedTimeSteps, m_timeStepFilter() );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_geomechCase )
|
||||
{
|
||||
RimTools::geoMechCaseOptionItems( &options );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivFaultReactivationModelPartMgr* RimFaultReactivationModel::partMgr()
|
||||
{
|
||||
if ( m_partMgr.isNull() ) m_partMgr = new RivFaultReactivationModelPartMgr( this );
|
||||
|
||||
return m_partMgr.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigBasicPlane> RimFaultReactivationModel::faultPlane() const
|
||||
{
|
||||
return m_faultPlane;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigFaultReactivationModel> RimFaultReactivationModel::model() const
|
||||
{
|
||||
return m_modelPlane;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModel::showFaultPlane() const
|
||||
{
|
||||
return m_showFaultPlane;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModel::showModel() const
|
||||
{
|
||||
return m_showModelPlane;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<cvf::Vec3d, cvf::Vec3d> RimFaultReactivationModel::localCoordSysNormalsXY() const
|
||||
{
|
||||
cvf::Vec3d yNormal = m_modelPlane->normal();
|
||||
cvf::Vec3d xNormal = yNormal ^ cvf::Vec3d::Z_AXIS;
|
||||
|
||||
xNormal.z() = 0.0;
|
||||
yNormal.z() = 0.0;
|
||||
xNormal.normalize();
|
||||
yNormal.normalize();
|
||||
|
||||
yNormal = xNormal ^ cvf::Vec3d::Z_AXIS;
|
||||
|
||||
return std::make_pair( xNormal, yNormal );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
auto genGrp = uiOrdering.addNewGroup( "General" );
|
||||
genGrp->add( &m_userDescription );
|
||||
genGrp->add( &m_fault );
|
||||
genGrp->add( &m_baseDir );
|
||||
genGrp->add( &m_geomechCase );
|
||||
|
||||
auto faultGrp = uiOrdering.addNewGroup( "Fault Plane" );
|
||||
|
||||
faultGrp->add( &m_showFaultPlane );
|
||||
faultGrp->add( &m_faultPlaneColor );
|
||||
faultGrp->add( &m_extentHorizontal );
|
||||
faultGrp->add( &m_extentVerticalAbove );
|
||||
faultGrp->add( &m_extentVerticalBelow );
|
||||
|
||||
auto modelGrp = uiOrdering.addNewGroup( "2D Model" );
|
||||
modelGrp->add( &m_showModelPlane );
|
||||
|
||||
auto sizeModelGrp = modelGrp->addNewGroup( "Size" );
|
||||
sizeModelGrp->add( &m_modelExtentFromAnchor );
|
||||
sizeModelGrp->add( &m_modelMinZ );
|
||||
sizeModelGrp->add( &m_modelBelowSize );
|
||||
|
||||
auto gridModelGrp = modelGrp->addNewGroup( "Grid" );
|
||||
|
||||
gridModelGrp->add( &m_modelThickness );
|
||||
gridModelGrp->add( &m_numberOfCellsHorzPart1 );
|
||||
gridModelGrp->add( &m_numberOfCellsHorzPart2 );
|
||||
gridModelGrp->add( &m_numberOfCellsVertUp );
|
||||
gridModelGrp->add( &m_numberOfCellsVertMid );
|
||||
gridModelGrp->add( &m_numberOfCellsVertLow );
|
||||
gridModelGrp->add( &m_useLocalCoordinates );
|
||||
|
||||
auto timeStepGrp = uiOrdering.addNewGroup( "Time Steps" );
|
||||
timeStepGrp->add( &m_timeStepFilter );
|
||||
timeStepGrp->add( &m_selectedTimeSteps );
|
||||
|
||||
auto appModelGrp = modelGrp->addNewGroup( "Appearance" );
|
||||
appModelGrp->add( &m_modelPart1Color );
|
||||
appModelGrp->add( &m_modelPart2Color );
|
||||
|
||||
auto trgGroup = uiOrdering.addNewGroup( "Debug" );
|
||||
trgGroup->setCollapsedByDefault();
|
||||
trgGroup->add( &m_targets );
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_userDescription )
|
||||
{
|
||||
updateConnectedEditors();
|
||||
}
|
||||
else
|
||||
{
|
||||
updateVisualization();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_targets )
|
||||
{
|
||||
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>( attribute );
|
||||
if ( tvAttribute )
|
||||
{
|
||||
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FIT_CONTENT;
|
||||
}
|
||||
}
|
||||
else if ( ( field == &m_extentVerticalAbove ) || ( field == &m_extentVerticalBelow ) )
|
||||
{
|
||||
auto* attr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
|
||||
|
||||
if ( attr )
|
||||
{
|
||||
auto eclCase = eclipseCase();
|
||||
if ( eclCase )
|
||||
{
|
||||
auto bb = eclCase->allCellsBoundingBox();
|
||||
double diff = bb.max().z() - bb.min().z();
|
||||
attr->m_minimum = 0;
|
||||
attr->m_maximum = diff;
|
||||
}
|
||||
else
|
||||
{
|
||||
attr->m_minimum = 0;
|
||||
attr->m_maximum = 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimFaultReactivationModel::eclipseCase()
|
||||
{
|
||||
auto eCase = firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
|
||||
if ( eCase == nullptr )
|
||||
{
|
||||
eCase = dynamic_cast<RimEclipseCase*>( RiaApplication::instance()->activeGridView()->ownerCase() );
|
||||
}
|
||||
|
||||
return eCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimFaultReactivationModel::geoMechCase()
|
||||
{
|
||||
return m_geomechCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::setBaseDir( QString path )
|
||||
{
|
||||
m_baseDir = path;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultReactivationModel::baseDir() const
|
||||
{
|
||||
return m_baseDir().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::updateTimeSteps()
|
||||
{
|
||||
m_availableTimeSteps.clear();
|
||||
const auto eCase = eclipseCase();
|
||||
if ( eCase != nullptr ) m_availableTimeSteps = eCase->timeStepDates();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QDateTime> RimFaultReactivationModel::selectedTimeSteps() const
|
||||
{
|
||||
std::vector<QDateTime> dates;
|
||||
for ( auto d : m_selectedTimeSteps() )
|
||||
dates.push_back( d );
|
||||
|
||||
// selected dates might come in the order they were selected, sort them
|
||||
std::sort( dates.begin(), dates.end() );
|
||||
return dates;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimFaultReactivationModel::commandParameters() const
|
||||
{
|
||||
QStringList retlist;
|
||||
|
||||
retlist << baseDir();
|
||||
retlist << inputFilename();
|
||||
retlist << outputOdbFilename();
|
||||
|
||||
return retlist;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultReactivationModel::outputOdbFilename() const
|
||||
{
|
||||
QDir directory( baseDir() );
|
||||
return directory.absoluteFilePath( baseFilename() + ".odb" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultReactivationModel::inputFilename() const
|
||||
{
|
||||
QDir directory( baseDir() );
|
||||
return directory.absoluteFilePath( baseFilename() + ".inp" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultReactivationModel::settingsFilename() const
|
||||
{
|
||||
QDir directory( baseDir() );
|
||||
return directory.absoluteFilePath( baseFilename() + ".settings.json" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultReactivationModel::baseFilename() const
|
||||
{
|
||||
QString tmp = m_userDescription();
|
||||
|
||||
if ( tmp.isEmpty() ) return "faultReactivation";
|
||||
|
||||
tmp.replace( ' ', '_' );
|
||||
tmp.replace( '/', '_' );
|
||||
tmp.replace( '\\', '_' );
|
||||
tmp.replace( ':', '_' );
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModel::exportModelSettings()
|
||||
{
|
||||
if ( m_faultPlane.isNull() ) return false;
|
||||
|
||||
QMap<QString, QVariant> settings;
|
||||
|
||||
auto [topPosition, bottomPosition] = m_faultPlane->intersectTopBottomLine();
|
||||
auto faultNormal = m_faultPlane->normal();
|
||||
|
||||
// make sure we move horizontally
|
||||
faultNormal.z() = 0.0;
|
||||
faultNormal.normalize();
|
||||
|
||||
RimFaultReactivationTools::addSettingsToMap( settings, faultNormal, topPosition, bottomPosition );
|
||||
|
||||
QDir directory( baseDir() );
|
||||
return ResInsightInternalJson::JsonWriter::encodeFile( settingsFilename(), settings );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModel::extractAndExportModelData()
|
||||
{
|
||||
model()->clearModelData();
|
||||
|
||||
if ( !exportModelSettings() ) return false;
|
||||
|
||||
auto eCase = eclipseCase();
|
||||
if ( eCase == nullptr ) return false;
|
||||
|
||||
// get the selected time step indexes
|
||||
std::vector<size_t> selectedTimeStepIndexes;
|
||||
for ( auto& timeStep : selectedTimeSteps() )
|
||||
{
|
||||
auto idx = std::find( m_availableTimeSteps.begin(), m_availableTimeSteps.end(), timeStep );
|
||||
if ( idx == m_availableTimeSteps.end() ) return false;
|
||||
|
||||
selectedTimeStepIndexes.push_back( idx - m_availableTimeSteps.begin() );
|
||||
}
|
||||
|
||||
auto grid = eCase->mainGrid();
|
||||
|
||||
// generate cell index mappings for cells that ends up at the wrong side of the fault
|
||||
model()->generateCellIndexMapping( grid );
|
||||
|
||||
// generate element sets for the various data parts of the model
|
||||
{
|
||||
RimFaultReactivationDataAccess dataAccess( eCase, 0 );
|
||||
model()->generateElementSets( &dataAccess, grid );
|
||||
}
|
||||
|
||||
// extract data for each timestep
|
||||
size_t outputTimeStepIndex = 0;
|
||||
for ( auto timeStepIdx : selectedTimeStepIndexes )
|
||||
{
|
||||
RimFaultReactivationDataAccess dataAccess( eCase, timeStepIdx );
|
||||
model()->extractModelData( &dataAccess, outputTimeStepIndex++ );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::array<double, 3> RimFaultReactivationModel::materialParameters( ElementSets elementSet ) const
|
||||
{
|
||||
std::array<double, 3> retVal = { 0.0, 0.0, 0.0 };
|
||||
static std::map<ElementSets, std::string> groupMap = { { ElementSets::OverBurden, "material_overburden" },
|
||||
{ ElementSets::Reservoir, "material_reservoir" },
|
||||
{ ElementSets::IntraReservoir, "material_intrareservoir" },
|
||||
{ ElementSets::UnderBurden, "material_underburden" } };
|
||||
|
||||
auto keyName = QString::fromStdString( groupMap[elementSet] );
|
||||
|
||||
for ( auto& grp : m_materialParameters )
|
||||
{
|
||||
if ( grp->name() != keyName ) continue;
|
||||
|
||||
retVal[0] = grp->parameterDoubleValue( "youngs_modulus", 0.0 );
|
||||
retVal[1] = grp->parameterDoubleValue( "poissons_number", 0.0 );
|
||||
retVal[2] = grp->parameterDoubleValue( "density", 0.0 );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RimCheckableNamedObject.h"
|
||||
#include "RimFaultReactivationEnums.h"
|
||||
#include "RimPolylinePickerInterface.h"
|
||||
#include "RimPolylinesDataInterface.h"
|
||||
#include "RimTimeStepFilter.h"
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
// Include to make Pdm work for cvf::Color
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
class RicPolylineTargetsPickEventHandler;
|
||||
class RimEclipseCase;
|
||||
class RimGeoMechCase;
|
||||
class RimFaultInView;
|
||||
class RimParameterGroup;
|
||||
class RimPolylineTarget;
|
||||
class RimTimeStepFilter;
|
||||
class RivFaultReactivationModelPartMgr;
|
||||
class RigBasicPlane;
|
||||
class RigFaultReactivationModel;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class BoundingBox;
|
||||
class Plane;
|
||||
} // namespace cvf
|
||||
|
||||
class RimFaultReactivationModel : public RimCheckableNamedObject, public RimPolylinePickerInterface, public RimPolylinesDataInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
using TimeStepFilterEnum = caf::AppEnum<RimTimeStepFilter::TimeStepFilterTypeEnum>;
|
||||
using ElementSets = RimFaultReactivation::ElementSets;
|
||||
|
||||
public:
|
||||
RimFaultReactivationModel();
|
||||
~RimFaultReactivationModel() override;
|
||||
|
||||
bool initSettings( QString& outErrmsg );
|
||||
|
||||
QString userDescription();
|
||||
void setUserDescription( QString description );
|
||||
|
||||
std::pair<bool, std::string> validateBeforeRun() const;
|
||||
|
||||
void setFault( RimFaultInView* fault );
|
||||
RimFaultInView* fault() const;
|
||||
|
||||
void setTargets( cvf::Vec3d target1, cvf::Vec3d target2 );
|
||||
|
||||
RivFaultReactivationModelPartMgr* partMgr();
|
||||
|
||||
// polyline picker interface
|
||||
void insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert ) override;
|
||||
void deleteTarget( RimPolylineTarget* targetToDelete ) override;
|
||||
void updateEditorsAndVisualization() override;
|
||||
void updateVisualization() override;
|
||||
std::vector<RimPolylineTarget*> activeTargets() const override;
|
||||
bool pickingEnabled() const override;
|
||||
caf::PickEventHandler* pickEventHandler() const override;
|
||||
|
||||
// polyline data interface
|
||||
cvf::ref<RigPolyLinesData> polyLinesData() const override;
|
||||
|
||||
cvf::ref<RigBasicPlane> faultPlane() const;
|
||||
bool showFaultPlane() const;
|
||||
|
||||
cvf::ref<RigFaultReactivationModel> model() const;
|
||||
bool showModel() const;
|
||||
|
||||
std::pair<cvf::Vec3d, cvf::Vec3d> localCoordSysNormalsXY() const;
|
||||
|
||||
bool extractAndExportModelData();
|
||||
|
||||
QString baseDir() const;
|
||||
void setBaseDir( QString path );
|
||||
|
||||
std::vector<QDateTime> selectedTimeSteps() const;
|
||||
|
||||
std::array<double, 3> materialParameters( ElementSets elementSet ) const;
|
||||
|
||||
QStringList commandParameters() const;
|
||||
|
||||
QString outputOdbFilename() const;
|
||||
QString inputFilename() const;
|
||||
QString settingsFilename() const;
|
||||
|
||||
void updateTimeSteps();
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
RimEclipseCase* eclipseCase();
|
||||
RimGeoMechCase* geoMechCase();
|
||||
|
||||
void initAfterRead() override;
|
||||
|
||||
QString baseFilename() const;
|
||||
|
||||
bool exportModelSettings();
|
||||
|
||||
private:
|
||||
std::shared_ptr<RicPolylineTargetsPickEventHandler> m_pickTargetsEventHandler;
|
||||
|
||||
cvf::ref<RivFaultReactivationModelPartMgr> m_partMgr;
|
||||
|
||||
caf::PdmField<caf::FilePath> m_baseDir;
|
||||
caf::PdmField<double> m_modelThickness;
|
||||
|
||||
caf::PdmField<QString> m_userDescription;
|
||||
caf::PdmPtrField<RimFaultInView*> m_fault;
|
||||
caf::PdmPtrField<RimGeoMechCase*> m_geomechCase;
|
||||
caf::PdmChildArrayField<RimPolylineTarget*> m_targets;
|
||||
caf::PdmField<cvf::Color3f> m_faultPlaneColor;
|
||||
caf::PdmField<cvf::Color3f> m_modelPart1Color;
|
||||
caf::PdmField<cvf::Color3f> m_modelPart2Color;
|
||||
|
||||
caf::PdmField<bool> m_showFaultPlane;
|
||||
caf::PdmField<bool> m_showModelPlane;
|
||||
|
||||
caf::PdmField<double> m_extentVerticalAbove;
|
||||
caf::PdmField<double> m_extentVerticalBelow;
|
||||
caf::PdmField<double> m_extentHorizontal;
|
||||
caf::PdmField<double> m_modelExtentFromAnchor;
|
||||
caf::PdmField<double> m_modelMinZ;
|
||||
caf::PdmField<double> m_modelBelowSize;
|
||||
caf::PdmField<int> m_numberOfCellsHorzPart1;
|
||||
caf::PdmField<int> m_numberOfCellsHorzPart2;
|
||||
caf::PdmField<int> m_numberOfCellsVertUp;
|
||||
caf::PdmField<int> m_numberOfCellsVertMid;
|
||||
caf::PdmField<int> m_numberOfCellsVertLow;
|
||||
caf::PdmField<bool> m_useLocalCoordinates;
|
||||
|
||||
cvf::ref<RigBasicPlane> m_faultPlane;
|
||||
cvf::ref<RigFaultReactivationModel> m_modelPlane;
|
||||
|
||||
caf::PdmField<TimeStepFilterEnum> m_timeStepFilter;
|
||||
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
||||
|
||||
caf::PdmChildArrayField<RimParameterGroup*> m_materialParameters;
|
||||
|
||||
std::vector<QDateTime> m_availableTimeSteps;
|
||||
};
|
||||
@@ -0,0 +1,212 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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 "RimFaultReactivationModelCollection.h"
|
||||
|
||||
#include "RiaPreferencesGeoMech.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimFaultInView.h"
|
||||
#include "RimFaultReactivationModel.h"
|
||||
|
||||
#include "RivFaultReactivationModelPartMgr.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimFaultReactivationModelCollection, "FaultReactivationModelCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationModelCollection::RimFaultReactivationModelCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Fault Reactivation Models", ":/fault_react_24x24.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_userDescription, "UserDescription", QString( "Fault Reactivation Models" ), "Name" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_models, "FaultReactivationModels", "Models" );
|
||||
m_models.uiCapability()->setUiTreeHidden( true );
|
||||
m_models.uiCapability()->setUiHidden( true );
|
||||
|
||||
setName( "Fault Reactivation Models" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationModelCollection::~RimFaultReactivationModelCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationModel* RimFaultReactivationModelCollection::addNewModel( RimFaultInView* fault,
|
||||
cvf::Vec3d target1,
|
||||
cvf::Vec3d target2,
|
||||
QString baseDir,
|
||||
QString& outErrMsg )
|
||||
{
|
||||
auto newModel = new RimFaultReactivationModel();
|
||||
newModel->setFault( fault );
|
||||
newModel->setBaseDir( baseDir );
|
||||
newModel->setUserDescription( fault->name() );
|
||||
newModel->setTargets( target1, target2 );
|
||||
|
||||
QString errmsg;
|
||||
if ( !newModel->initSettings( errmsg ) )
|
||||
{
|
||||
delete newModel;
|
||||
outErrMsg = "Unable to load default parameters from the Fault Reactivation Model default parameter XML file:\n" + errmsg;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_models.push_back( newModel );
|
||||
|
||||
updateConnectedEditors();
|
||||
|
||||
newModel->updateVisualization();
|
||||
|
||||
return newModel;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModelCollection::empty()
|
||||
{
|
||||
return m_models.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFaultReactivationModelCollection::size()
|
||||
{
|
||||
return static_cast<int>( m_models.size() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultReactivationModelCollection::userDescription()
|
||||
{
|
||||
return m_userDescription;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::setUserDescription( QString description )
|
||||
{
|
||||
m_userDescription = description;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimFaultReactivationModelCollection::userDescriptionField()
|
||||
{
|
||||
return &m_userDescription;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == objectToggleField() )
|
||||
{
|
||||
updateView();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
updateView();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::updateView()
|
||||
{
|
||||
auto view = firstAncestorOrThisOfType<Rim3dView>();
|
||||
if ( view ) view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModelCollection::shouldBeVisibleInTree() const
|
||||
{
|
||||
return RiaPreferencesGeoMech::current()->validateFRMSettings();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::appendPartsToModel( Rim3dView* view,
|
||||
cvf::ModelBasicList* model,
|
||||
caf::DisplayCoordTransform* transform,
|
||||
const cvf::BoundingBox& boundingBox )
|
||||
{
|
||||
if ( !isChecked() ) return;
|
||||
|
||||
for ( auto& frm : m_models )
|
||||
{
|
||||
if ( frm->isChecked() )
|
||||
{
|
||||
frm->partMgr()->appendPolylinePartsToModel( view, model, transform, boundingBox );
|
||||
frm->partMgr()->appendGeometryPartsToModel( model, transform, boundingBox );
|
||||
frm->partMgr()->appendMeshPartsToModel( view, model, transform, boundingBox );
|
||||
}
|
||||
}
|
||||
|
||||
model->updateBoundingBoxesRecursive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::syncTimeSteps()
|
||||
{
|
||||
for ( auto& frm : m_models )
|
||||
{
|
||||
frm->updateTimeSteps();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RimCheckableNamedObject.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimFaultReactivationModel;
|
||||
class RimFaultInView;
|
||||
class Rim3dView;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class BoundingBox;
|
||||
} // namespace cvf
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class DisplayCoordTransform;
|
||||
}
|
||||
|
||||
class RimFaultReactivationModelCollection : public RimCheckableNamedObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimFaultReactivationModelCollection();
|
||||
~RimFaultReactivationModelCollection() override;
|
||||
|
||||
RimFaultReactivationModel* addNewModel( RimFaultInView* fault, cvf::Vec3d target1, cvf::Vec3d target2, QString baseDir, QString& errMsg );
|
||||
|
||||
bool empty();
|
||||
int size();
|
||||
|
||||
bool shouldBeVisibleInTree() const;
|
||||
|
||||
QString userDescription();
|
||||
void setUserDescription( QString description );
|
||||
|
||||
void appendPartsToModel( Rim3dView* view,
|
||||
cvf::ModelBasicList* model,
|
||||
caf::DisplayCoordTransform* transform,
|
||||
const cvf::BoundingBox& boundingBox );
|
||||
|
||||
void syncTimeSteps();
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
void updateView();
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_userDescription;
|
||||
caf::PdmChildArrayField<RimFaultReactivationModel*> m_models;
|
||||
};
|
||||
@@ -0,0 +1,76 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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 "RimFaultReactivationTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimFaultReactivationTools::normalVector( QMap<QString, QVariant> settings )
|
||||
{
|
||||
double x = settings.value( "faultNormal_X", 0.0 ).toDouble();
|
||||
double y = settings.value( "faultNormal_Y", 0.0 ).toDouble();
|
||||
double z = settings.value( "faultNormal_Z", 0.0 ).toDouble();
|
||||
|
||||
return cvf::Vec3d( x, y, z );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimFaultReactivationTools::topFaultPosition( QMap<QString, QVariant> settings )
|
||||
{
|
||||
double x = settings.value( "faultTop_X", 0.0 ).toDouble();
|
||||
double y = settings.value( "faultTop_Y", 0.0 ).toDouble();
|
||||
double z = settings.value( "faultTop_Z", 0.0 ).toDouble();
|
||||
|
||||
return cvf::Vec3d( x, y, z );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimFaultReactivationTools::bottomFaultPosition( QMap<QString, QVariant> settings )
|
||||
{
|
||||
double x = settings.value( "faultBottom_X", 0.0 ).toDouble();
|
||||
double y = settings.value( "faultBottom_Y", 0.0 ).toDouble();
|
||||
double z = settings.value( "faultBottom_Z", 0.0 ).toDouble();
|
||||
|
||||
return cvf::Vec3d( x, y, z );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationTools::addSettingsToMap( QMap<QString, QVariant>& map,
|
||||
cvf::Vec3d normalVector,
|
||||
cvf::Vec3d topFaultPosition,
|
||||
cvf::Vec3d bottomFaultPosition )
|
||||
{
|
||||
map["faultTop_X"] = topFaultPosition.x();
|
||||
map["faultTop_Y"] = topFaultPosition.y();
|
||||
map["faultTop_Z"] = topFaultPosition.z();
|
||||
|
||||
map["faultBottom_X"] = bottomFaultPosition.x();
|
||||
map["faultBottom_Y"] = bottomFaultPosition.y();
|
||||
map["faultBottom_Z"] = bottomFaultPosition.z();
|
||||
|
||||
map["faultNormal_X"] = normalVector.x();
|
||||
map["faultNormal_Y"] = normalVector.y();
|
||||
map["faultNormal_Z"] = normalVector.z();
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 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 <QMap>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
class RimFaultReactivationTools
|
||||
{
|
||||
public:
|
||||
static cvf::Vec3d normalVector( QMap<QString, QVariant> settings );
|
||||
static cvf::Vec3d topFaultPosition( QMap<QString, QVariant> settings );
|
||||
static cvf::Vec3d bottomFaultPosition( QMap<QString, QVariant> settings );
|
||||
|
||||
static void
|
||||
addSettingsToMap( QMap<QString, QVariant>& map, cvf::Vec3d normalVector, cvf::Vec3d topFaultPosition, cvf::Vec3d bottomFaultPosition );
|
||||
|
||||
private:
|
||||
RimFaultReactivationTools(){};
|
||||
};
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "RimPressureDepthData.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogLasFile.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cvfAssert.h"
|
||||
@@ -80,7 +80,7 @@ RifDataSourceForRftPlt RimDataSourceForRftPlt::address() const
|
||||
case RifDataSourceForRftPlt::SourceType::GRID_MODEL_CELL_DATA:
|
||||
return RifDataSourceForRftPlt( RifDataSourceForRftPlt::SourceType::GRID_MODEL_CELL_DATA, m_eclCase );
|
||||
case RifDataSourceForRftPlt::SourceType::SUMMARY_RFT:
|
||||
return RifDataSourceForRftPlt( m_summaryCase, m_ensemble );
|
||||
return RifDataSourceForRftPlt( m_summaryCase, m_ensemble, m_eclCase );
|
||||
case RifDataSourceForRftPlt::SourceType::ENSEMBLE_RFT:
|
||||
return RifDataSourceForRftPlt( m_ensemble );
|
||||
case RifDataSourceForRftPlt::SourceType::OBSERVED_FMU_RFT:
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
class RimObservedFmuRftData;
|
||||
class RimSummaryCaseCollection;
|
||||
class RimWellLogFile;
|
||||
class RimWellLogLasFile;
|
||||
class RimEclipseCase;
|
||||
|
||||
//==================================================================================================
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
caf::PdmPtrField<RimEclipseCase*> m_eclCase;
|
||||
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
|
||||
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
|
||||
caf::PdmPtrField<RimWellLogFile*> m_wellLogFile;
|
||||
caf::PdmPtrField<RimWellLogLasFile*> m_wellLogFile;
|
||||
caf::PdmPtrField<RimObservedFmuRftData*> m_observedFmuRftData;
|
||||
caf::PdmPtrField<RimPressureDepthData*> m_pressureDepthData;
|
||||
};
|
||||
|
||||
@@ -102,7 +102,7 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
|
||||
CAF_PDM_InitField( &m_minCommunication, "MinCommunication", 0.0, "Min Communication" );
|
||||
CAF_PDM_InitField( &m_maxTof, "MaxTof", 146000, "Max Time of Flight [days]" );
|
||||
|
||||
this->m_showWindow = false;
|
||||
m_showWindow = false;
|
||||
setAsPlotMdiWindow();
|
||||
setDeletable( true );
|
||||
}
|
||||
@@ -186,7 +186,7 @@ void RimFlowCharacteristicsPlot::updateCurrentTimeStep()
|
||||
|
||||
if ( m_currentlyPlottedTimeSteps == calculatedTimesteps ) return;
|
||||
|
||||
this->onLoadDataAndUpdate();
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -599,7 +599,7 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
|
||||
// All fields update plot
|
||||
|
||||
this->onLoadDataAndUpdate();
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -703,6 +703,15 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
|
||||
|
||||
m_timeStepToFlowResultMap = timeStepToFlowResultMap;
|
||||
|
||||
if ( m_case() )
|
||||
{
|
||||
m_flowCharPlotWidget->setCaseName( m_case()->caseUserDescription() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_flowCharPlotWidget->setCaseName( "" );
|
||||
}
|
||||
|
||||
m_flowCharPlotWidget->setLorenzCurve( timeStepStrings, timeStepDates, lorenzVals );
|
||||
|
||||
for ( int timeStepIdx : m_currentlyPlottedTimeSteps )
|
||||
|
||||
@@ -164,7 +164,7 @@ RimWellConnectivityTable* RimFlowPlotCollection::defaultWellConnectivityTable()
|
||||
m_defaultWellConnectivityTable = new RimWellConnectivityTable;
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
|
||||
return m_defaultWellConnectivityTable;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ RimWellAllocationOverTimePlot* RimFlowPlotCollection::defaultWellAllocOverTimePl
|
||||
m_defaultWellAllocOverTimePlot->setDescription( "Default Well Allocation Over Time Plot" );
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
|
||||
return m_defaultWellAllocOverTimePlot();
|
||||
}
|
||||
@@ -196,7 +196,7 @@ RimWellAllocationPlot* RimFlowPlotCollection::defaultWellAllocPlot()
|
||||
m_defaultWellAllocPlot->setDescription( "Default Flow Diagnostics Plot" );
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
|
||||
return m_defaultWellAllocPlot();
|
||||
}
|
||||
@@ -211,7 +211,7 @@ RimFlowCharacteristicsPlot* RimFlowPlotCollection::defaultFlowCharacteristicsPlo
|
||||
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
|
||||
return m_flowCharacteristicsPlot();
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ QImage RimTofAccumulatedPhaseFractionsPlot::snapshotWindowContent()
|
||||
void RimTofAccumulatedPhaseFractionsPlot::setDescription( const QString& description )
|
||||
{
|
||||
m_userName = description;
|
||||
this->updateMdiWindowTitle();
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -156,7 +156,7 @@ QImage RimTotalWellAllocationPlot::snapshotWindowContent()
|
||||
void RimTotalWellAllocationPlot::setDescription( const QString& description )
|
||||
{
|
||||
m_userName = description;
|
||||
this->updateMdiWindowTitle();
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
|
||||
#include "RigAccWellFlowCalculator.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
@@ -39,7 +40,7 @@
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimStackablePlotCurve.h"
|
||||
#include "RimWellAllocationTools.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogLasFile.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
|
||||
#include "RiuContextMenuLauncher.h"
|
||||
@@ -55,6 +56,8 @@
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
|
||||
#include "qwt_scale_draw.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellAllocationOverTimePlot, "RimWellAllocationOverTimePlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -267,9 +270,7 @@ RiuPlotWidget* RimWellAllocationOverTimePlot::doCreatePlotViewWidget( QWidget* m
|
||||
// Remove event filter to disable unwanted highlighting on left click in plot.
|
||||
plotWidget->removeEventFilter();
|
||||
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
new RiuContextMenuLauncher( plotWidget, menuBuilder );
|
||||
new RiuContextMenuLauncher( m_plotWidget, { "RicShowPlotDataFeature" } );
|
||||
|
||||
m_plotWidget = plotWidget;
|
||||
RiuQwtPlotTools::enableDateBasedBottomXAxis( m_plotWidget->qwtPlot(),
|
||||
@@ -281,6 +282,16 @@ RiuPlotWidget* RimWellAllocationOverTimePlot::doCreatePlotViewWidget( QWidget* m
|
||||
// Workaround: Enable axis title for bottom axis to activate correct font size for date axis
|
||||
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true );
|
||||
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true );
|
||||
|
||||
if ( auto qwtPlot = m_plotWidget->qwtPlot() )
|
||||
{
|
||||
auto scaleDraw = qwtPlot->axisScaleDraw( QwtAxis::XBottom );
|
||||
if ( scaleDraw )
|
||||
{
|
||||
scaleDraw->setLabelRotation( 30.0 );
|
||||
}
|
||||
}
|
||||
|
||||
m_plotWidget->insertLegend( RiuPlotWidget::Legend::RIGHT );
|
||||
|
||||
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "[Date]" );
|
||||
@@ -393,7 +404,10 @@ void RimWellAllocationOverTimePlot::updateFromWell()
|
||||
QString newDescription = descriptionText + ", " + valueTypeText;
|
||||
|
||||
setDescription( newDescription );
|
||||
m_plotWidget->setWindowTitle( newDescription );
|
||||
|
||||
const auto windowTitle = RiaStdStringTools::removeHtmlTags( newDescription.toStdString() );
|
||||
m_plotWidget->setWindowTitle( QString::fromStdString( windowTitle ) );
|
||||
|
||||
m_plotWidget->setPlotTitle( descriptionText + "<br>" + valueTypeText + "</br>" );
|
||||
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), valueTypeText );
|
||||
|
||||
@@ -625,7 +639,7 @@ void RimWellAllocationOverTimePlot::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
}
|
||||
|
||||
std::set<QString> sortedWellNames = findSortedWellNames();
|
||||
if ( !sortedWellNames.size() )
|
||||
if ( sortedWellNames.empty() )
|
||||
m_wellName = "";
|
||||
else if ( sortedWellNames.count( m_wellName() ) == 0 )
|
||||
{
|
||||
@@ -693,7 +707,7 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationOverTimePlot::calculateValueOptio
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( name, name, false, simWellIcon ) );
|
||||
}
|
||||
if ( options.size() == 0 )
|
||||
if ( options.empty() )
|
||||
{
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
}
|
||||
@@ -748,13 +762,13 @@ cvf::Color3f RimWellAllocationOverTimePlot::getTracerColor( const QString& trace
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellAllocationOverTimePlot::getValueTypeText() const
|
||||
{
|
||||
RiaDefines::EclipseUnitSystem unitSet = m_case->eclipseCaseData()->unitsType();
|
||||
RimWellLogFile::WellFlowCondition condition = m_flowDiagSolution ? RimWellLogFile::WELL_FLOW_COND_RESERVOIR
|
||||
: RimWellLogFile::WELL_FLOW_COND_STANDARD;
|
||||
RiaDefines::EclipseUnitSystem unitSet = m_case->eclipseCaseData()->unitsType();
|
||||
RimWellLogLasFile::WellFlowCondition condition = m_flowDiagSolution ? RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR
|
||||
: RimWellLogLasFile::WELL_FLOW_COND_STANDARD;
|
||||
|
||||
if ( m_flowValueType == FlowValueType::FLOW_RATE_PERCENTAGE )
|
||||
{
|
||||
QString conditionText = condition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR ? "Reservoir" : "Surface";
|
||||
QString conditionText = condition == RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR ? "Reservoir" : "Surface";
|
||||
return QString( "Percentage of %1 Flow Rate [%]" ).arg( conditionText );
|
||||
}
|
||||
if ( m_flowValueType == FlowValueType::FLOW_RATE )
|
||||
@@ -771,7 +785,7 @@ QString RimWellAllocationOverTimePlot::getValueTypeText() const
|
||||
}
|
||||
if ( m_flowValueType == FlowValueType::ACCUMULATED_FLOW_VOLUME_PERCENTAGE )
|
||||
{
|
||||
QString conditionText = condition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR ? "Reservoir" : "Surface";
|
||||
QString conditionText = condition == RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR ? "Reservoir" : "Surface";
|
||||
return QString( "Accumulated %1 Flow Volume Allocation [%]" ).arg( conditionText );
|
||||
}
|
||||
|
||||
@@ -794,7 +808,7 @@ QString RimWellAllocationOverTimePlot::dateFormatString() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationOverTimePlot::setValidTimeStepRangeForCase()
|
||||
{
|
||||
if ( m_case == nullptr || m_case->timeStepDates().size() == 0 )
|
||||
if ( m_case == nullptr || m_case->timeStepDates().empty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "RimWellAllocationTools.h"
|
||||
#include "RimWellFlowRateCurve.h"
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogLasFile.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
@@ -120,7 +120,7 @@ RimWellAllocationPlot::RimWellAllocationPlot()
|
||||
m_tofAccumulatedPhaseFractionsPlot.uiCapability()->setUiTreeHidden( true );
|
||||
m_tofAccumulatedPhaseFractionsPlot = new RimTofAccumulatedPhaseFractionsPlot;
|
||||
|
||||
this->setAsPlotMdiWindow();
|
||||
setAsPlotMdiWindow();
|
||||
|
||||
m_accumulatedWellFlowPlot->setAvailableDepthUnits( {} );
|
||||
m_accumulatedWellFlowPlot->setAvailableDepthTypes( { RiaDefines::DepthTypeEnum::CONNECTION_NUMBER,
|
||||
@@ -337,10 +337,6 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
accFlow = ( m_flowType == ACCUMULATED ? wfCalculator->accumulatedTracerFlowPrConnection( tracerName, brIdx )
|
||||
: wfCalculator->tracerFlowPrConnection( tracerName, brIdx ) );
|
||||
|
||||
// Insert the first depth position again, to add a <maxdepth, 0.0> value pair
|
||||
curveDepthValues.insert( curveDepthValues.begin(), curveDepthValues[0] );
|
||||
accFlow.insert( accFlow.begin(), 0.0 );
|
||||
|
||||
if ( m_flowType == ACCUMULATED && brIdx == 0 && !accFlow.empty() ) // Add fictitious point to -1
|
||||
// for first branch
|
||||
{
|
||||
@@ -444,9 +440,9 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotTrack )
|
||||
{
|
||||
RiaDefines::EclipseUnitSystem unitSet = m_case->eclipseCaseData()->unitsType();
|
||||
RimWellLogFile::WellFlowCondition condition = m_flowDiagSolution ? RimWellLogFile::WELL_FLOW_COND_RESERVOIR
|
||||
: RimWellLogFile::WELL_FLOW_COND_STANDARD;
|
||||
RiaDefines::EclipseUnitSystem unitSet = m_case->eclipseCaseData()->unitsType();
|
||||
RimWellLogLasFile::WellFlowCondition condition = m_flowDiagSolution ? RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR
|
||||
: RimWellLogLasFile::WELL_FLOW_COND_STANDARD;
|
||||
|
||||
QString axisTitle = RimWellPlotTools::flowPlotAxisTitle( condition, unitSet );
|
||||
plotTrack->setPropertyValueAxisTitle( axisTitle );
|
||||
@@ -474,6 +470,8 @@ void RimWellAllocationPlot::addStackedCurve( const QString& tracerNa
|
||||
curve->setColor( getTracerColor( tracerName ) );
|
||||
}
|
||||
|
||||
curve->setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT );
|
||||
|
||||
plotTrack->addCurve( curve );
|
||||
|
||||
curve->loadDataAndUpdate( true );
|
||||
@@ -633,7 +631,7 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions( cons
|
||||
|
||||
if ( fieldNeedingOptions == &m_wellName )
|
||||
{
|
||||
std::set<QString> sortedWellNames = this->findSortedWellNames();
|
||||
std::set<QString> sortedWellNames = findSortedWellNames();
|
||||
|
||||
caf::IconProvider simWellIcon( ":/Well.svg" );
|
||||
for ( const QString& wname : sortedWellNames )
|
||||
@@ -641,7 +639,7 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions( cons
|
||||
options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
|
||||
}
|
||||
|
||||
if ( options.size() == 0 )
|
||||
if ( options.empty() )
|
||||
{
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
}
|
||||
@@ -650,7 +648,7 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions( cons
|
||||
{
|
||||
RimTools::timeStepsForCase( m_case, &options );
|
||||
|
||||
if ( options.size() == 0 )
|
||||
if ( options.empty() )
|
||||
{
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", -1 ) );
|
||||
}
|
||||
@@ -757,7 +755,7 @@ void RimWellAllocationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
}
|
||||
|
||||
std::set<QString> sortedWellNames = findSortedWellNames();
|
||||
if ( !sortedWellNames.size() )
|
||||
if ( sortedWellNames.empty() )
|
||||
m_wellName = "";
|
||||
else if ( sortedWellNames.count( m_wellName() ) == 0 )
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
#include "RiaWellFlowDefines.h"
|
||||
|
||||
#include "RigAccWellFlowCalculator.h"
|
||||
@@ -39,7 +40,7 @@
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellAllocationTools.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogLasFile.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
|
||||
#include "RiuMatrixPlotWidget.h"
|
||||
@@ -125,7 +126,7 @@ RimWellConnectivityTable::RimWellConnectivityTable()
|
||||
m_case.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_cellFilterView, "VisibleCellView", "Filter by 3D View" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_viewFilterType, "ViewFilterType", "Filter type" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_viewFilterType, "ViewFilterType", " Filter type" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution" );
|
||||
m_flowDiagSolution.uiCapability()->setUiHidden( true );
|
||||
@@ -214,8 +215,7 @@ void RimWellConnectivityTable::setFromSimulationWell( RimSimWellInView* simWell
|
||||
auto eclView = simWell->firstAncestorOrThisOfType<RimEclipseView>();
|
||||
auto eclCase = simWell->firstAncestorOrThisOfType<RimEclipseResultCase>();
|
||||
|
||||
m_cellFilterView = eclView;
|
||||
m_case = eclCase;
|
||||
m_case = eclCase;
|
||||
|
||||
// Set valid single time step and time step range selections based on case
|
||||
setValidTimeStepSelectionsForCase();
|
||||
@@ -678,6 +678,9 @@ void RimWellConnectivityTable::onLoadDataAndUpdate()
|
||||
m_matrixPlotWidget->setAxisTitleFontSize( axisTitleFontSize() );
|
||||
m_matrixPlotWidget->setAxisLabelFontSize( axisLabelFontSize() );
|
||||
|
||||
const auto windowTitle = RiaStdStringTools::removeHtmlTags( createTableTitle().toStdString() );
|
||||
m_matrixPlotWidget->setWindowTitle( QString::fromStdString( windowTitle ) );
|
||||
|
||||
m_matrixPlotWidget->createPlot();
|
||||
}
|
||||
|
||||
@@ -916,8 +919,8 @@ std::vector<QString> RimWellConnectivityTable::getProductionWellNamesAtTimeSteps
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellConnectivityTable::createTableTitle() const
|
||||
{
|
||||
RiaDefines::EclipseUnitSystem unitSet = m_case->eclipseCaseData()->unitsType();
|
||||
RimWellLogFile::WellFlowCondition condition = RimWellLogFile::WELL_FLOW_COND_RESERVOIR;
|
||||
RiaDefines::EclipseUnitSystem unitSet = m_case->eclipseCaseData()->unitsType();
|
||||
RimWellLogLasFile::WellFlowCondition condition = RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR;
|
||||
|
||||
auto timeSampleValueTypeText = [&]() -> QString
|
||||
{
|
||||
|
||||
@@ -350,7 +350,6 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
|
||||
const QString timeStepName = m_case ? m_case->timeStepName( m_timeStepIndex ) : "N/A";
|
||||
|
||||
const QString plotTitleStr = QString( "%1 Distribution: %2, %3" ).arg( phaseString ).arg( m_wellName ).arg( timeStepName );
|
||||
m_plotWidget->setPlotTitleRenderingFlags( Qt::AlignHCenter | Qt::TextWordWrap );
|
||||
m_plotWidget->setPlotTitle( plotTitleStr );
|
||||
|
||||
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "TOF [years]" );
|
||||
@@ -381,7 +380,7 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellD
|
||||
plotWidget->setAxisAutoScale( RiuPlotAxis::defaultLeft(), true );
|
||||
|
||||
const std::vector<double>& tofValuesDays = calculator.sortedUniqueTofValues();
|
||||
if ( tofValuesDays.size() == 0 )
|
||||
if ( tofValuesDays.empty() )
|
||||
{
|
||||
// cvf::Trace::show("No TOF values!");
|
||||
return;
|
||||
@@ -468,7 +467,7 @@ QList<caf::PdmOptionItemInfo> RimWellDistributionPlot::calculateValueOptions( co
|
||||
{
|
||||
RimTools::timeStepsForCase( m_case, &options );
|
||||
|
||||
if ( options.size() == 0 )
|
||||
if ( options.empty() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", -1 ) );
|
||||
}
|
||||
@@ -486,7 +485,7 @@ QList<caf::PdmOptionItemInfo> RimWellDistributionPlot::calculateValueOptions( co
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.size() == 0 )
|
||||
if ( options.empty() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", QVariant() ) );
|
||||
}
|
||||
@@ -527,7 +526,7 @@ void RimWellDistributionPlot::fixupDependentFieldsAfterCaseChange()
|
||||
}
|
||||
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
if ( sortedWellNameSet.size() > 0 )
|
||||
if ( !sortedWellNameSet.empty() )
|
||||
{
|
||||
newWellName = *sortedWellNameSet.begin();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
|
||||
#include "RimWellDistributionPlotCollection.h"
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimEclipseCaseTools.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
@@ -28,8 +31,6 @@
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigTofWellDistributionCalculator.h"
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "RiuMultiPlotPage.h"
|
||||
#include "RiuPlotWidget.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
@@ -200,6 +201,12 @@ QWidget* RimWellDistributionPlotCollection::createViewWidget( QWidget* mainWindo
|
||||
{
|
||||
m_viewer = new RiuMultiPlotPage( this, mainWindowParent );
|
||||
m_viewer->setPlotTitle( m_plotWindowTitle );
|
||||
|
||||
auto pointSize =
|
||||
caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), caf::FontTools::RelativeSize::XLarge );
|
||||
|
||||
m_viewer->setTitleFontSizes( pointSize, pointSize );
|
||||
|
||||
recreatePlotWidgets();
|
||||
|
||||
return m_viewer;
|
||||
@@ -286,7 +293,7 @@ QList<caf::PdmOptionItemInfo> RimWellDistributionPlotCollection::calculateValueO
|
||||
{
|
||||
RimTools::timeStepsForCase( m_case, &options );
|
||||
|
||||
if ( options.size() == 0 )
|
||||
if ( options.empty() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", -1 ) );
|
||||
}
|
||||
@@ -304,7 +311,7 @@ QList<caf::PdmOptionItemInfo> RimWellDistributionPlotCollection::calculateValueO
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.size() == 0 )
|
||||
if ( options.empty() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", QVariant() ) );
|
||||
}
|
||||
@@ -444,7 +451,7 @@ void RimWellDistributionPlotCollection::fixupDependentFieldsAfterCaseChange()
|
||||
}
|
||||
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
if ( sortedWellNameSet.size() > 0 )
|
||||
if ( !sortedWellNameSet.empty() )
|
||||
{
|
||||
newWellName = *sortedWellNameSet.begin();
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ QString RimWellFlowRateCurve::createCurveAutoName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
||||
RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
||||
|
||||
m_plotCurve->setTitle( createCurveAutoName() );
|
||||
|
||||
@@ -185,7 +185,7 @@ void RimWellFlowRateCurve::updateCurveAppearance()
|
||||
{
|
||||
auto wellLogTrack = firstAncestorOrThisOfTypeAsserted<RimWellLogTrack>();
|
||||
std::map<int, std::vector<RimWellLogCurve*>> stackedCurveGroups = wellLogTrack->visibleStackedCurves();
|
||||
const std::vector<RimWellLogCurve*>& curveGroup = stackedCurveGroups[this->m_groupId];
|
||||
const std::vector<RimWellLogCurve*>& curveGroup = stackedCurveGroups[m_groupId];
|
||||
|
||||
if ( !curveGroup.empty() )
|
||||
{
|
||||
@@ -268,12 +268,7 @@ void RimWellFlowRateCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedF
|
||||
bool RimWellFlowRateCurve::isUsingConnectionNumberDepthType() const
|
||||
{
|
||||
auto wellLogPlot = firstAncestorOrThisOfType<RimWellLogPlot>();
|
||||
if ( wellLogPlot && wellLogPlot->depthType() == RiaDefines::DepthTypeEnum::CONNECTION_NUMBER )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return wellLogPlot && wellLogPlot->depthType() == RiaDefines::DepthTypeEnum::CONNECTION_NUMBER;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -293,7 +288,7 @@ void RimWellFlowRateCurve::setFlowValuesPrDepthValue( const QString&
|
||||
const std::vector<double>& flowRates )
|
||||
{
|
||||
bool useLogarithmicScale = false;
|
||||
this->setPropertyValuesAndDepths( flowRates, depthValues, depthType, 0.0, RiaDefines::DepthUnitType::UNIT_NONE, false, useLogarithmicScale );
|
||||
setPropertyValuesAndDepths( flowRates, depthValues, depthType, 0.0, RiaDefines::DepthUnitType::UNIT_NONE, false, useLogarithmicScale );
|
||||
|
||||
m_curveAutoName = curveName;
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogFileChannel.h"
|
||||
#include "RimWellLogFileCurve.h"
|
||||
#include "RimWellLogLasFile.h"
|
||||
#include "RimWellLogLasFileCurve.h"
|
||||
#include "RimWellLogRftCurve.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::hasPressureData( const RimWellLogFile* wellLogFile )
|
||||
bool RimWellPlotTools::hasPressureData( const RimWellLogLasFile* wellLogFile )
|
||||
{
|
||||
for ( RimWellLogFileChannel* const wellLogChannel : wellLogFile->wellLogChannels() )
|
||||
{
|
||||
@@ -92,7 +92,7 @@ bool RimWellPlotTools::hasPressureData( const RimWellLogFile* wellLogFile )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::hasPressureData( RimWellPath* wellPath )
|
||||
{
|
||||
for ( RimWellLogFile* const wellLogFile : wellPath->wellLogFiles() )
|
||||
for ( RimWellLogLasFile* const wellLogFile : wellPath->wellLogFiles() )
|
||||
{
|
||||
if ( hasPressureData( wellLogFile ) )
|
||||
{
|
||||
@@ -144,7 +144,7 @@ bool RimWellPlotTools::hasPressureData( RimEclipseResultCase* gridCase )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::hasFlowData( const RimWellLogFile* wellLogFile )
|
||||
bool RimWellPlotTools::hasFlowData( const RimWellLogLasFile* wellLogFile )
|
||||
{
|
||||
for ( RimWellLogFileChannel* const wellLogChannel : wellLogFile->wellLogChannels() )
|
||||
{
|
||||
@@ -158,7 +158,7 @@ bool RimWellPlotTools::hasFlowData( const RimWellLogFile* wellLogFile )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPlotTools::hasFlowData( const RimWellPath* wellPath )
|
||||
{
|
||||
for ( RimWellLogFile* const wellLogFile : wellPath->wellLogFiles() )
|
||||
for ( RimWellLogLasFile* const wellLogFile : wellPath->wellLogFiles() )
|
||||
{
|
||||
if ( hasFlowData( wellLogFile ) )
|
||||
{
|
||||
@@ -268,20 +268,20 @@ void RimWellPlotTools::addTimeStepsToMap( std::map<QDateTime, std::set<RifDataSo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingPressure( const QString& wellPathNameOrSimWellName )
|
||||
std::vector<RimWellLogLasFile*> RimWellPlotTools::wellLogFilesContainingPressure( const QString& wellPathNameOrSimWellName )
|
||||
{
|
||||
std::vector<RimWellLogFile*> wellLogFiles;
|
||||
const RimProject* const project = RimProject::current();
|
||||
std::vector<RimWellPath*> wellPaths = project->allWellPaths();
|
||||
std::vector<RimWellLogLasFile*> wellLogFiles;
|
||||
const RimProject* const project = RimProject::current();
|
||||
std::vector<RimWellPath*> wellPaths = project->allWellPaths();
|
||||
|
||||
for ( auto wellPath : wellPaths )
|
||||
{
|
||||
if ( !wellPathNameOrSimWellName.isEmpty() &&
|
||||
( wellPathNameOrSimWellName == wellPath->associatedSimulationWellName() || wellPathNameOrSimWellName == wellPath->name() ) )
|
||||
{
|
||||
const std::vector<RimWellLogFile*> files = wellPath->wellLogFiles();
|
||||
const std::vector<RimWellLogLasFile*> files = wellPath->wellLogFiles();
|
||||
|
||||
for ( RimWellLogFile* file : files )
|
||||
for ( RimWellLogLasFile* file : files )
|
||||
{
|
||||
if ( hasPressureData( file ) )
|
||||
{
|
||||
@@ -297,7 +297,7 @@ std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingPressure( c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogFileChannel* RimWellPlotTools::getPressureChannelFromWellFile( const RimWellLogFile* wellLogFile )
|
||||
RimWellLogFileChannel* RimWellPlotTools::getPressureChannelFromWellFile( const RimWellLogLasFile* wellLogFile )
|
||||
{
|
||||
if ( wellLogFile != nullptr )
|
||||
{
|
||||
@@ -315,19 +315,19 @@ RimWellLogFileChannel* RimWellPlotTools::getPressureChannelFromWellFile( const R
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingFlow( const QString& wellPathName )
|
||||
std::vector<RimWellLogLasFile*> RimWellPlotTools::wellLogFilesContainingFlow( const QString& wellPathName )
|
||||
{
|
||||
std::vector<RimWellLogFile*> wellLogFiles;
|
||||
const RimProject* const project = RimProject::current();
|
||||
std::vector<RimWellPath*> wellPaths = project->allWellPaths();
|
||||
std::vector<RimWellLogLasFile*> wellLogFiles;
|
||||
const RimProject* const project = RimProject::current();
|
||||
std::vector<RimWellPath*> wellPaths = project->allWellPaths();
|
||||
|
||||
for ( auto wellPath : wellPaths )
|
||||
{
|
||||
if ( wellPath->name() == wellPathName )
|
||||
{
|
||||
std::vector<RimWellLogFile*> files = wellPath->wellLogFiles();
|
||||
std::vector<RimWellLogLasFile*> files = wellPath->wellLogFiles();
|
||||
|
||||
for ( RimWellLogFile* file : files )
|
||||
for ( RimWellLogLasFile* file : files )
|
||||
{
|
||||
if ( hasFlowData( file ) )
|
||||
{
|
||||
@@ -342,14 +342,14 @@ std::vector<RimWellLogFile*> RimWellPlotTools::wellLogFilesContainingFlow( const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath* RimWellPlotTools::wellPathFromWellLogFile( const RimWellLogFile* wellLogFile )
|
||||
RimWellPath* RimWellPlotTools::wellPathFromWellLogFile( const RimWellLogLasFile* wellLogFile )
|
||||
{
|
||||
RimProject* const project = RimProject::current();
|
||||
for ( const auto& oilField : project->oilFields )
|
||||
{
|
||||
for ( const auto& wellPath : oilField->wellPathCollection()->allWellPaths() )
|
||||
{
|
||||
for ( RimWellLogFile* const file : wellPath->wellLogFiles() )
|
||||
for ( RimWellLogLasFile* const file : wellPath->wellLogFiles() )
|
||||
{
|
||||
if ( file == wellLogFile )
|
||||
{
|
||||
@@ -561,7 +561,7 @@ std::set<QDateTime> RimWellPlotTools::findMatchingOrAdjacentTimeSteps( const std
|
||||
// The above will only work if there are at least one available timestep equal or after any of the basetimeline
|
||||
// times. If no timesteps matched but we have some, add the last available because the above code missed it.
|
||||
|
||||
if ( !resultTimeSteps.size() && baseTimeLine.size() && availableTimeSteps.size() )
|
||||
if ( resultTimeSteps.empty() && !baseTimeLine.empty() && !availableTimeSteps.empty() )
|
||||
{
|
||||
resultTimeSteps.insert( *availableTimeSteps.rbegin() );
|
||||
}
|
||||
@@ -597,6 +597,18 @@ std::set<QDateTime> RimWellPlotTools::availableSimWellTimesteps( RimEclipseCase*
|
||||
return availebleTimeSteps;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderRftInterface* RimWellPlotTools::rftReaderInterface( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
auto eclResCase = dynamic_cast<RimEclipseResultCase*>( eclipseCase );
|
||||
|
||||
if ( eclResCase ) return eclResCase->rftReader();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -604,11 +616,11 @@ RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve( const RimWellLogCu
|
||||
{
|
||||
const RimWellLogRftCurve* rftCurve = dynamic_cast<const RimWellLogRftCurve*>( curve );
|
||||
const RimWellLogExtractionCurve* gridCurve = dynamic_cast<const RimWellLogExtractionCurve*>( curve );
|
||||
const RimWellLogFileCurve* wellLogFileCurve = dynamic_cast<const RimWellLogFileCurve*>( curve );
|
||||
const RimWellLogLasFileCurve* wellLogFileCurve = dynamic_cast<const RimWellLogLasFileCurve*>( curve );
|
||||
|
||||
if ( rftCurve != nullptr )
|
||||
{
|
||||
RimEclipseResultCase* rftCase = dynamic_cast<RimEclipseResultCase*>( rftCurve->eclipseResultCase() );
|
||||
RimEclipseResultCase* rftCase = dynamic_cast<RimEclipseResultCase*>( rftCurve->eclipseCase() );
|
||||
RimSummaryCase* rftSummaryCase = rftCurve->summaryCase();
|
||||
RimSummaryCaseCollection* rftEnsemble = rftCurve->ensemble();
|
||||
RimObservedFmuRftData* rftFmuData = rftCurve->observedFmuRftData();
|
||||
@@ -618,17 +630,20 @@ RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve( const RimWellLogCu
|
||||
const QString& wellName = rftAddress.wellName();
|
||||
const QDateTime& timeStep = rftAddress.timeStep();
|
||||
|
||||
if ( rftCase != nullptr )
|
||||
if ( rftSummaryCase != nullptr )
|
||||
{
|
||||
// Presens of rftSummaryCase must be tested before rftCase because a rftSummaryCase can have a rftCase
|
||||
// The rftCase is used to extract TVD/MD from the grid model
|
||||
|
||||
RimSummaryCaseCollection* parentEnsemble = rftSummaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
|
||||
return RiaRftPltCurveDefinition( RifDataSourceForRftPlt( rftSummaryCase, parentEnsemble, rftCase ), wellName, timeStep );
|
||||
}
|
||||
else if ( rftCase != nullptr )
|
||||
{
|
||||
return RiaRftPltCurveDefinition( RifDataSourceForRftPlt( RifDataSourceForRftPlt::SourceType::RFT_SIM_WELL_DATA, rftCase ),
|
||||
wellName,
|
||||
timeStep );
|
||||
}
|
||||
else if ( rftSummaryCase != nullptr )
|
||||
{
|
||||
RimSummaryCaseCollection* parentEnsemble = rftSummaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
|
||||
return RiaRftPltCurveDefinition( RifDataSourceForRftPlt( rftSummaryCase, parentEnsemble ), wellName, timeStep );
|
||||
}
|
||||
else if ( rftEnsemble != nullptr )
|
||||
{
|
||||
return RiaRftPltCurveDefinition( RifDataSourceForRftPlt( rftEnsemble ), wellName, timeStep );
|
||||
@@ -661,7 +676,7 @@ RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve( const RimWellLogCu
|
||||
}
|
||||
else if ( wellLogFileCurve != nullptr )
|
||||
{
|
||||
RimWellLogFile* const wellLogFile = wellLogFileCurve->wellLogFile();
|
||||
RimWellLogLasFile* const wellLogFile = wellLogFileCurve->wellLogFile();
|
||||
|
||||
if ( wellLogFile != nullptr )
|
||||
{
|
||||
@@ -736,9 +751,10 @@ std::set<RiaRftPltCurveDefinition>
|
||||
|
||||
for ( const RifDataSourceForRftPlt& addr : selectedSourcesExpanded )
|
||||
{
|
||||
if ( addr.sourceType() == RifDataSourceForRftPlt::SourceType::RFT_SIM_WELL_DATA && addr.rftReader() )
|
||||
auto rftReader = rftReaderInterface( addr.eclCase() );
|
||||
if ( addr.sourceType() == RifDataSourceForRftPlt::SourceType::RFT_SIM_WELL_DATA && rftReader )
|
||||
{
|
||||
std::set<QDateTime> rftTimes = addr.rftReader()->availableTimeSteps( simWellName, interestingRFTResults );
|
||||
std::set<QDateTime> rftTimes = rftReader->availableTimeSteps( simWellName, interestingRFTResults );
|
||||
for ( const QDateTime& time : rftTimes )
|
||||
{
|
||||
if ( selectedTimeStepSet.count( time ) )
|
||||
@@ -805,7 +821,7 @@ std::set<RiaRftPltCurveDefinition>
|
||||
{
|
||||
if ( summaryCase && summaryCase->rftReader() )
|
||||
{
|
||||
RifDataSourceForRftPlt summaryAddr( summaryCase, addr.ensemble() );
|
||||
RifDataSourceForRftPlt summaryAddr( summaryCase, addr.ensemble(), addr.eclCase() );
|
||||
|
||||
std::set<QDateTime> timeSteps = summaryCase->rftReader()->availableTimeSteps( wellPathNameOrSimWellName );
|
||||
for ( const QDateTime& time : timeSteps )
|
||||
@@ -835,14 +851,12 @@ std::set<RiaRftPltCurveDefinition>
|
||||
auto summaryCase = addr.summaryCase();
|
||||
if ( summaryCase && summaryCase->rftReader() )
|
||||
{
|
||||
RifDataSourceForRftPlt summaryAddr( summaryCase, addr.ensemble() );
|
||||
|
||||
std::set<QDateTime> timeSteps = summaryCase->rftReader()->availableTimeSteps( wellPathNameOrSimWellName );
|
||||
for ( const QDateTime& time : timeSteps )
|
||||
{
|
||||
if ( selectedTimeStepSet.count( time ) )
|
||||
{
|
||||
curveDefs.insert( RiaRftPltCurveDefinition( summaryAddr, wellPathNameOrSimWellName, time ) );
|
||||
curveDefs.insert( RiaRftPltCurveDefinition( addr, wellPathNameOrSimWellName, time ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -855,11 +869,11 @@ std::set<RiaRftPltCurveDefinition>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellPlotTools::flowPlotAxisTitle( RimWellLogFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem )
|
||||
QString RimWellPlotTools::flowPlotAxisTitle( RimWellLogLasFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem )
|
||||
{
|
||||
QString axisTitle;
|
||||
|
||||
if ( condition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR )
|
||||
if ( condition == RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR )
|
||||
{
|
||||
QString unitText = RimWellPlotTools::flowUnitText( condition, unitSystem );
|
||||
|
||||
@@ -903,11 +917,11 @@ QString flowConditionReservoirUnitText( RiaDefines::EclipseUnitSystem unitSystem
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellPlotTools::flowUnitText( RimWellLogFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem )
|
||||
QString RimWellPlotTools::flowUnitText( RimWellLogLasFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem )
|
||||
{
|
||||
QString unitText;
|
||||
|
||||
if ( condition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR )
|
||||
if ( condition == RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR )
|
||||
{
|
||||
unitText = flowConditionReservoirUnitText( unitSystem );
|
||||
}
|
||||
@@ -935,11 +949,11 @@ QString RimWellPlotTools::flowUnitText( RimWellLogFile::WellFlowCondition condit
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellPlotTools::flowVolumePlotAxisTitle( RimWellLogFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem )
|
||||
QString RimWellPlotTools::flowVolumePlotAxisTitle( RimWellLogLasFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem )
|
||||
{
|
||||
QString axisTitle;
|
||||
|
||||
if ( condition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR )
|
||||
if ( condition == RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR )
|
||||
{
|
||||
QString unitText = RimWellPlotTools::flowVolumeUnitText( condition, unitSystem );
|
||||
|
||||
@@ -983,11 +997,11 @@ QString flowVolumeConditionReservoirUnitText( RiaDefines::EclipseUnitSystem unit
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellPlotTools::flowVolumeUnitText( RimWellLogFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem )
|
||||
QString RimWellPlotTools::flowVolumeUnitText( RimWellLogLasFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem )
|
||||
{
|
||||
QString unitText;
|
||||
|
||||
if ( condition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR )
|
||||
if ( condition == RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR )
|
||||
{
|
||||
unitText = flowVolumeConditionReservoirUnitText( unitSystem );
|
||||
}
|
||||
@@ -1015,11 +1029,13 @@ QString RimWellPlotTools::flowVolumeUnitText( RimWellLogFile::WellFlowCondition
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellPlotTools::curveUnitText( RimWellLogFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem, FlowPhase flowPhase )
|
||||
QString RimWellPlotTools::curveUnitText( RimWellLogLasFile::WellFlowCondition condition,
|
||||
RiaDefines::EclipseUnitSystem unitSystem,
|
||||
FlowPhase flowPhase )
|
||||
{
|
||||
QString unitText;
|
||||
|
||||
if ( condition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR )
|
||||
if ( condition == RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR )
|
||||
{
|
||||
unitText = flowConditionReservoirUnitText( unitSystem );
|
||||
}
|
||||
@@ -1148,21 +1164,26 @@ std::map<QDateTime, std::set<RifDataSourceForRftPlt>>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hasObservedData = !observedTimeStepsWithSources.empty();
|
||||
}
|
||||
|
||||
if ( hasRftData )
|
||||
{
|
||||
for ( const auto& source : selSources )
|
||||
{
|
||||
if ( source.sourceType() == RifDataSourceForRftPlt::SourceType::RFT_SIM_WELL_DATA && source.rftReader() )
|
||||
auto rftReader = rftReaderInterface( source.eclCase() );
|
||||
if ( source.sourceType() == RifDataSourceForRftPlt::SourceType::RFT_SIM_WELL_DATA && rftReader )
|
||||
{
|
||||
std::set<QDateTime> rftTimes = source.rftReader()->availableTimeSteps( simWellName, interestingRFTResults );
|
||||
std::set<QDateTime> rftTimes = rftReader->availableTimeSteps( simWellName, interestingRFTResults );
|
||||
for ( const QDateTime& date : rftTimes )
|
||||
{
|
||||
rftTimeStepsWithSources[date].insert( source );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hasRftData = !rftTimeStepsWithSources.empty();
|
||||
}
|
||||
|
||||
if ( hasGridData )
|
||||
@@ -1180,6 +1201,8 @@ std::map<QDateTime, std::set<RifDataSourceForRftPlt>>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hasGridData = !gridTimestepsWithSources.empty();
|
||||
}
|
||||
|
||||
if ( hasSummaryRftData )
|
||||
@@ -1197,6 +1220,8 @@ std::map<QDateTime, std::set<RifDataSourceForRftPlt>>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hasSummaryRftData = !summaryRftTimeStepsWithSources.empty();
|
||||
}
|
||||
|
||||
if ( hasEnsembleData )
|
||||
@@ -1213,34 +1238,36 @@ std::map<QDateTime, std::set<RifDataSourceForRftPlt>>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hasEnsembleData = !ensembleTimeStepsWithSources.empty();
|
||||
}
|
||||
|
||||
// If we have a time baseline add the equal or adjacent grid timesteps
|
||||
|
||||
std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timestepsToShowWithSources;
|
||||
std::map<QDateTime, std::set<RifDataSourceForRftPlt>>* timeBaseline = nullptr;
|
||||
std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timestepsToShowWithSources;
|
||||
std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeBaseline;
|
||||
|
||||
if ( hasObservedData )
|
||||
{
|
||||
timeBaseline = &observedTimeStepsWithSources;
|
||||
timeBaseline = observedTimeStepsWithSources;
|
||||
}
|
||||
else if ( hasRftData )
|
||||
{
|
||||
timeBaseline = &rftTimeStepsWithSources;
|
||||
timeBaseline = rftTimeStepsWithSources;
|
||||
}
|
||||
else if ( hasSummaryRftData )
|
||||
{
|
||||
timeBaseline = &summaryRftTimeStepsWithSources;
|
||||
timeBaseline = summaryRftTimeStepsWithSources;
|
||||
}
|
||||
else if ( hasEnsembleData )
|
||||
{
|
||||
timeBaseline = &ensembleTimeStepsWithSources;
|
||||
timeBaseline = ensembleTimeStepsWithSources;
|
||||
}
|
||||
|
||||
if ( timeBaseline )
|
||||
if ( !timeBaseline.empty() )
|
||||
{
|
||||
std::set<QDateTime> baseTimeSteps;
|
||||
for ( const auto& dateSourceSetPair : *timeBaseline )
|
||||
for ( const auto& dateSourceSetPair : timeBaseline )
|
||||
baseTimeSteps.insert( dateSourceSetPair.first );
|
||||
|
||||
std::set<QDateTime> rftTimeSteps;
|
||||
@@ -1266,7 +1293,7 @@ std::map<QDateTime, std::set<RifDataSourceForRftPlt>>
|
||||
std::set<QDateTime> filteredSummaryRftTimeSteps =
|
||||
RimWellPlotTools::findMatchingOrAdjacentTimeSteps( baseTimeSteps, summaryRftTimeSteps );
|
||||
|
||||
if ( addFirstTimestep && gridTimeSteps.size() )
|
||||
if ( addFirstTimestep && !gridTimeSteps.empty() )
|
||||
{
|
||||
filteredGridTimeSteps.insert( *gridTimeSteps.begin() );
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "RifDataSourceForRftPltQMetaType.h"
|
||||
#include "RifEclipseRftAddress.h"
|
||||
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogLasFile.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
@@ -43,6 +43,7 @@ class RimPressureDepthData;
|
||||
class RiuWellRftPlot;
|
||||
class RigEclipseCaseData;
|
||||
class RigEclipseResultAddress;
|
||||
class RifReaderRftInterface;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -74,24 +75,24 @@ public:
|
||||
static bool isTotalFlowChannel( const QString& channelName );
|
||||
static FlowPhase flowPhaseFromChannelName( const QString& channelName );
|
||||
|
||||
static std::vector<RimWellLogFile*> wellLogFilesContainingFlow( const QString& wellName );
|
||||
static RimWellPath* wellPathByWellPathNameOrSimWellName( const QString& wellPathNameOrSimwellName );
|
||||
static std::vector<RimWellLogLasFile*> wellLogFilesContainingFlow( const QString& wellName );
|
||||
static RimWellPath* wellPathByWellPathNameOrSimWellName( const QString& wellPathNameOrSimwellName );
|
||||
|
||||
// RFT Only
|
||||
private:
|
||||
static std::pair<RigEclipseResultAddress, QString> pressureResultDataInfo( const RigEclipseCaseData* eclipseCaseData );
|
||||
|
||||
public:
|
||||
static void addTimeStepsToMap( std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& destMap,
|
||||
const std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepsToAdd );
|
||||
static std::vector<RimWellLogFile*> wellLogFilesContainingPressure( const QString& wellPathNameOrSimWellName );
|
||||
static RimWellLogFileChannel* getPressureChannelFromWellFile( const RimWellLogFile* wellLogFile );
|
||||
static RimWellPath* wellPathFromWellLogFile( const RimWellLogFile* wellLogFile );
|
||||
static void addTimeStepsToMap( std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& destMap,
|
||||
const std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepsToAdd );
|
||||
static std::vector<RimWellLogLasFile*> wellLogFilesContainingPressure( const QString& wellPathNameOrSimWellName );
|
||||
static RimWellLogFileChannel* getPressureChannelFromWellFile( const RimWellLogLasFile* wellLogFile );
|
||||
static RimWellPath* wellPathFromWellLogFile( const RimWellLogLasFile* wellLogFile );
|
||||
static std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMapFromGridCase( RimEclipseCase* gridCase );
|
||||
static RiaRftPltCurveDefinition curveDefFromCurve( const RimWellLogCurve* curve );
|
||||
|
||||
// others
|
||||
static bool hasFlowData( const RimWellLogFile* wellLogFile );
|
||||
static bool hasFlowData( const RimWellLogLasFile* wellLogFile );
|
||||
static bool hasAssociatedWellPath( const QString& wellName );
|
||||
|
||||
// Both
|
||||
@@ -120,12 +121,13 @@ public:
|
||||
const std::vector<RifDataSourceForRftPlt>& selectedSourcesExpanded,
|
||||
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults );
|
||||
|
||||
static QString flowPlotAxisTitle( RimWellLogFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem );
|
||||
static QString flowUnitText( RimWellLogFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem );
|
||||
static QString flowVolumePlotAxisTitle( RimWellLogFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem );
|
||||
static QString flowVolumeUnitText( RimWellLogFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem );
|
||||
static QString flowPlotAxisTitle( RimWellLogLasFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem );
|
||||
static QString flowUnitText( RimWellLogLasFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem );
|
||||
static QString flowVolumePlotAxisTitle( RimWellLogLasFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem );
|
||||
static QString flowVolumeUnitText( RimWellLogLasFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem );
|
||||
|
||||
static QString curveUnitText( RimWellLogFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem, FlowPhase flowPhase );
|
||||
static QString
|
||||
curveUnitText( RimWellLogLasFile::WellFlowCondition condition, RiaDefines::EclipseUnitSystem unitSystem, FlowPhase flowPhase );
|
||||
|
||||
static bool hasFlowData( const RimWellPath* wellPath );
|
||||
|
||||
@@ -143,7 +145,7 @@ private:
|
||||
|
||||
static std::set<QString> FLOW_DATA_NAMES;
|
||||
|
||||
static bool hasPressureData( const RimWellLogFile* wellLogFile );
|
||||
static bool hasPressureData( const RimWellLogLasFile* wellLogFile );
|
||||
static bool isPressureChannel( RimWellLogFileChannel* channel );
|
||||
static bool hasPressureData( RimEclipseResultCase* gridCase );
|
||||
static bool hasPressureData( RimWellPath* wellPath );
|
||||
@@ -153,4 +155,6 @@ private:
|
||||
static std::set<QDateTime> findMatchingOrAdjacentTimeSteps( const std::set<QDateTime>& baseTimeLine,
|
||||
const std::set<QDateTime>& availableTimeSteps );
|
||||
static std::set<QDateTime> availableSimWellTimesteps( RimEclipseCase* eclCase, const QString& simWellName, bool addFirstReportTimeStep );
|
||||
|
||||
static RifReaderRftInterface* rftReaderInterface( RimEclipseCase* eclipseCase );
|
||||
};
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
#include "RimSummaryCurveAppearanceCalculator.h"
|
||||
#include "RimWellFlowRateCurve.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogFileChannel.h"
|
||||
#include "RimWellLogFileCurve.h"
|
||||
#include "RimWellLogLasFile.h"
|
||||
#include "RimWellLogLasFileCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
@@ -134,7 +134,7 @@ RimWellPltPlot::RimWellPltPlot()
|
||||
m_nameConfig->setCustomName( "PLT Plot" );
|
||||
setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM );
|
||||
|
||||
this->setAsPlotMdiWindow();
|
||||
setAsPlotMdiWindow();
|
||||
m_doInitAfterLoad = false;
|
||||
m_isOnLoad = true;
|
||||
m_plotLegendsHorizontal = false;
|
||||
@@ -178,10 +178,10 @@ void RimWellPltPlot::setPlotXAxisTitles( RimWellLogTrack* plotTrack )
|
||||
|
||||
QString axisTitle;
|
||||
if ( m_useReservoirConditionCurves )
|
||||
axisTitle += RimWellPlotTools::flowPlotAxisTitle( RimWellLogFile::WELL_FLOW_COND_RESERVOIR, unitSet );
|
||||
axisTitle += RimWellPlotTools::flowPlotAxisTitle( RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR, unitSet );
|
||||
if ( m_useReservoirConditionCurves && m_useStandardConditionCurves ) axisTitle += " | ";
|
||||
if ( m_useStandardConditionCurves )
|
||||
axisTitle += RimWellPlotTools::flowPlotAxisTitle( RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet );
|
||||
axisTitle += RimWellPlotTools::flowPlotAxisTitle( RimWellLogLasFile::WELL_FLOW_COND_STANDARD, unitSet );
|
||||
|
||||
plotTrack->setPropertyValueAxisTitle( axisTitle );
|
||||
|
||||
@@ -229,9 +229,7 @@ void RimWellPltPlot::updateFormationsOnPlot() const
|
||||
{
|
||||
/// Set default case. Todo : Use the first of the selected cases in the
|
||||
/// plot
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases( cases );
|
||||
|
||||
std::vector<RimCase*> cases = proj->allGridCases();
|
||||
if ( !cases.empty() )
|
||||
{
|
||||
formationNamesCase = cases[0];
|
||||
@@ -295,20 +293,16 @@ class RigRftResultPointCalculator : public RigResultPointCalculator
|
||||
public:
|
||||
RigRftResultPointCalculator( const QString& wellPathName, RimEclipseResultCase* eclCase, QDateTime m_timeStep )
|
||||
{
|
||||
RifEclipseRftAddress gasRateAddress = RifEclipseRftAddress::createAddress( RimWellPlotTools::simWellName( wellPathName ),
|
||||
m_timeStep,
|
||||
RifEclipseRftAddress::RftWellLogChannelType::GRAT );
|
||||
RifEclipseRftAddress oilRateAddress = RifEclipseRftAddress::createAddress( RimWellPlotTools::simWellName( wellPathName ),
|
||||
m_timeStep,
|
||||
RifEclipseRftAddress::RftWellLogChannelType::ORAT );
|
||||
RifEclipseRftAddress watRateAddress = RifEclipseRftAddress::createAddress( RimWellPlotTools::simWellName( wellPathName ),
|
||||
m_timeStep,
|
||||
RifEclipseRftAddress::RftWellLogChannelType::WRAT );
|
||||
const auto wellNameForRft = RimWellPlotTools::simWellName( wellPathName );
|
||||
|
||||
std::vector<caf::VecIjk> rftIndices;
|
||||
eclCase->rftReader()->cellIndices( gasRateAddress, &rftIndices );
|
||||
if ( rftIndices.empty() ) eclCase->rftReader()->cellIndices( oilRateAddress, &rftIndices );
|
||||
if ( rftIndices.empty() ) eclCase->rftReader()->cellIndices( watRateAddress, &rftIndices );
|
||||
RifEclipseRftAddress gasRateAddress =
|
||||
RifEclipseRftAddress::createAddress( wellNameForRft, m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::GRAT );
|
||||
RifEclipseRftAddress oilRateAddress =
|
||||
RifEclipseRftAddress::createAddress( wellNameForRft, m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::ORAT );
|
||||
RifEclipseRftAddress watRateAddress =
|
||||
RifEclipseRftAddress::createAddress( wellNameForRft, m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::WRAT );
|
||||
|
||||
std::vector<caf::VecIjk> rftIndices = eclCase->rftReader()->cellIndices( wellNameForRft, m_timeStep );
|
||||
if ( rftIndices.empty() ) return;
|
||||
|
||||
std::vector<double> gasRates;
|
||||
@@ -539,7 +533,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
|
||||
const std::vector<double>& depthValues = wfTotalAccumulator.pseudoLengthFromTop( 0 );
|
||||
|
||||
QString curveUnitText = RimWellPlotTools::flowUnitText( RimWellLogFile::WELL_FLOW_COND_RESERVOIR, unitSet );
|
||||
QString curveUnitText = RimWellPlotTools::flowUnitText( RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR, unitSet );
|
||||
|
||||
const std::vector<double> accFlow = wfTotalAccumulator.accumulatedTracerFlowPrPseudoLength( RIG_FLOW_TOTAL_NAME, 0 );
|
||||
addStackedCurve( curveName + ", " + RIG_FLOW_TOTAL_NAME + " " + curveUnitText,
|
||||
@@ -580,7 +574,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
else if ( tracerName == RIG_FLOW_WATER_NAME )
|
||||
flowPhase = FLOW_PHASE_WATER;
|
||||
QString curveUnitText =
|
||||
RimWellPlotTools::curveUnitText( RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet, flowPhase );
|
||||
RimWellPlotTools::curveUnitText( RimWellLogLasFile::WELL_FLOW_COND_STANDARD, unitSet, flowPhase );
|
||||
|
||||
const std::vector<double>& accFlow = wfPhaseAccumulator.accumulatedTracerFlowPrPseudoLength( tracerName, 0 );
|
||||
addStackedCurve( curveName + ", " + tracerName + " " + curveUnitText,
|
||||
@@ -599,14 +593,14 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
{
|
||||
if ( sourceDef.wellLogFile() && sourceDef.wellLogFile()->wellLogFileData() )
|
||||
{
|
||||
RimWellLogFile::WellFlowCondition flowCondition = sourceDef.wellLogFile()->wellFlowRateCondition();
|
||||
RimWellLogLasFile::WellFlowCondition flowCondition = sourceDef.wellLogFile()->wellFlowRateCondition();
|
||||
|
||||
if ( ( m_useStandardConditionCurves() && flowCondition == RimWellLogFile::WELL_FLOW_COND_STANDARD ) ||
|
||||
( m_useReservoirConditionCurves() && flowCondition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR ) )
|
||||
if ( ( m_useStandardConditionCurves() && flowCondition == RimWellLogLasFile::WELL_FLOW_COND_STANDARD ) ||
|
||||
( m_useReservoirConditionCurves() && flowCondition == RimWellLogLasFile::WELL_FLOW_COND_RESERVOIR ) )
|
||||
{
|
||||
using ChannelValNameIdxTuple = std::tuple<double, QString, int>;
|
||||
|
||||
RigWellLogFile* wellLogFileData = sourceDef.wellLogFile()->wellLogFileData();
|
||||
RigWellLogLasFile* wellLogFileData = sourceDef.wellLogFile()->wellLogFileData();
|
||||
|
||||
QStringList channelNames = wellLogFileData->wellLogChannelNames();
|
||||
|
||||
|
||||
@@ -18,10 +18,14 @@
|
||||
|
||||
#include "RimWellRftEnsembleCurveSet.h"
|
||||
|
||||
#include "RifReaderEnsembleStatisticsRft.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEnsembleCurveSetColorManager.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
@@ -59,6 +63,9 @@ RimWellRftEnsembleCurveSet::RimWellRftEnsembleCurveSet()
|
||||
m_ensembleLegendConfig = new RimRegularLegendConfig();
|
||||
m_ensembleLegendConfig->setColorLegend(
|
||||
RimRegularLegendConfig::mapToColorLegend( RimEnsembleCurveSetColorManager::DEFAULT_ENSEMBLE_COLOR_RANGE ) );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseResultCase", "Eclipse Result Case" );
|
||||
m_eclipseCase.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -76,9 +83,14 @@ RimSummaryCaseCollection* RimWellRftEnsembleCurveSet::ensemble() const
|
||||
return m_ensemble;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::setEnsemble( RimSummaryCaseCollection* ensemble )
|
||||
{
|
||||
m_ensemble = ensemble;
|
||||
|
||||
clearEnsembleStatistics();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -150,6 +162,22 @@ std::vector<QString> RimWellRftEnsembleCurveSet::parametersWithVariation() const
|
||||
return std::vector<QString>( paramSet.begin(), paramSet.end() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::clearEnsembleStatistics()
|
||||
{
|
||||
m_statisticsEclipseRftReader = new RifReaderEnsembleStatisticsRft( m_ensemble(), m_eclipseCase() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::initAfterRead()
|
||||
{
|
||||
clearEnsembleStatistics();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -177,6 +205,31 @@ RigEnsembleParameter::Type RimWellRftEnsembleCurveSet::currentEnsembleParameterT
|
||||
return RigEnsembleParameter::TYPE_NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::setEclipseCase( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
m_eclipseCase = eclipseCase;
|
||||
clearEnsembleStatistics();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimWellRftEnsembleCurveSet::eclipseCase() const
|
||||
{
|
||||
return m_eclipseCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderRftInterface* RimWellRftEnsembleCurveSet::statisticsEclipseRftReader()
|
||||
{
|
||||
return m_statisticsEclipseRftReader.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -188,6 +241,10 @@ void RimWellRftEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
rftPlot->syncCurvesFromUiSelection();
|
||||
rftPlot->updateConnectedEditors();
|
||||
}
|
||||
else if ( changedField == &m_eclipseCase )
|
||||
{
|
||||
clearEnsembleStatistics();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -203,6 +260,12 @@ QList<caf::PdmOptionItemInfo> RimWellRftEnsembleCurveSet::calculateValueOptions(
|
||||
options.push_back( caf::PdmOptionItemInfo( param, param ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_eclipseCase )
|
||||
{
|
||||
RimTools::caseOptionItems( &options );
|
||||
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -218,6 +281,9 @@ void RimWellRftEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::Pd
|
||||
{
|
||||
colorsGroup->add( &m_ensembleParameter );
|
||||
}
|
||||
|
||||
uiOrdering.add( &m_eclipseCase );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
|
||||
class RiuCvfOverlayItemWidget;
|
||||
class RimSummaryCaseCollection;
|
||||
class RimEclipseCase;
|
||||
class RifReaderEnsembleStatisticsRft;
|
||||
class RifReaderRftInterface;
|
||||
|
||||
class RimWellRftEnsembleCurveSet : public caf::PdmObject
|
||||
{
|
||||
@@ -57,6 +60,11 @@ public:
|
||||
RimRegularLegendConfig* legendConfig();
|
||||
RigEnsembleParameter::Type currentEnsembleParameterType() const;
|
||||
|
||||
void setEclipseCase( RimEclipseCase* eclipseCase );
|
||||
RimEclipseCase* eclipseCase() const;
|
||||
|
||||
RifReaderRftInterface* statisticsEclipseRftReader();
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
@@ -69,11 +77,18 @@ protected:
|
||||
private:
|
||||
QString ensembleName() const;
|
||||
std::vector<QString> parametersWithVariation() const;
|
||||
void clearEnsembleStatistics();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
|
||||
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
|
||||
caf::PdmProxyValueField<QString> m_ensembleName;
|
||||
caf::PdmField<ColorModeEnum> m_ensembleColorMode;
|
||||
caf::PdmField<QString> m_ensembleParameter;
|
||||
caf::PdmChildField<RimRegularLegendConfig*> m_ensembleLegendConfig;
|
||||
|
||||
cvf::ref<RifReaderEnsembleStatisticsRft> m_statisticsEclipseRftReader;
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
};
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "RiaSimWellBranchTools.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RicImportGridModelFromSummaryCaseFeature.h"
|
||||
|
||||
#include "RifReaderEclipseRft.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
@@ -46,9 +48,9 @@
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogFileChannel.h"
|
||||
#include "RimWellLogFileCurve.h"
|
||||
#include "RimWellLogLasFile.h"
|
||||
#include "RimWellLogLasFileCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
#include "RimWellLogRftCurve.h"
|
||||
@@ -57,6 +59,7 @@
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
#include "RimWellPltPlot.h"
|
||||
#include "RimWellRftEnsembleCurveSet.h"
|
||||
|
||||
#include "RiuAbstractLegendFrame.h"
|
||||
#include "RiuAbstractOverlayContentFrame.h"
|
||||
@@ -121,6 +124,10 @@ RimWellRftPlot::RimWellRftPlot()
|
||||
m_selectedTimeSteps.uiCapability()->setAutoAddingOptionFromValue( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSets, "EnsembleCurveSets", "Ensemble Curve Sets" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSetEclipseCase,
|
||||
"EclipseResultCase",
|
||||
"Grid Model For MD",
|
||||
"Grid model used to compute measured depth using well path geometry" );
|
||||
|
||||
// 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.
|
||||
@@ -133,7 +140,7 @@ RimWellRftPlot::RimWellRftPlot()
|
||||
|
||||
setPlotTitleVisible( true );
|
||||
|
||||
this->setAsPlotMdiWindow();
|
||||
setAsPlotMdiWindow();
|
||||
m_isOnLoad = true;
|
||||
}
|
||||
|
||||
@@ -202,9 +209,7 @@ void RimWellRftPlot::updateFormationsOnPlot() const
|
||||
if ( !formationNamesCase )
|
||||
{
|
||||
/// Set default case. Todo : Use the first of the selected cases in the plot
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases( cases );
|
||||
|
||||
std::vector<RimCase*> cases = proj->allGridCases();
|
||||
if ( !cases.empty() )
|
||||
{
|
||||
formationNamesCase = cases[0];
|
||||
@@ -263,10 +268,10 @@ void RimWellRftPlot::applyInitialSelections()
|
||||
sourcesToSelect.push_back( RifDataSourceForRftPlt( ensemble ) );
|
||||
}
|
||||
|
||||
std::vector<RimWellLogFile*> wellLogFiles = RimWellPlotTools::wellLogFilesContainingPressure( m_wellPathNameOrSimWellName );
|
||||
std::vector<RimWellLogLasFile*> wellLogFiles = RimWellPlotTools::wellLogFilesContainingPressure( m_wellPathNameOrSimWellName );
|
||||
if ( !wellLogFiles.empty() )
|
||||
{
|
||||
for ( RimWellLogFile* const wellLogFile : wellLogFiles )
|
||||
for ( RimWellLogLasFile* const wellLogFile : wellLogFiles )
|
||||
{
|
||||
sourcesToSelect.push_back( RifDataSourceForRftPlt( wellLogFile ) );
|
||||
}
|
||||
@@ -494,7 +499,7 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
|
||||
plotTrack->addCurve( curve );
|
||||
|
||||
auto rftCase = curveDefToAdd.address().eclCase();
|
||||
curve->setEclipseResultCase( dynamic_cast<RimEclipseResultCase*>( rftCase ) );
|
||||
curve->setEclipseCase( rftCase );
|
||||
|
||||
RifEclipseRftAddress address = RifEclipseRftAddress::createAddress( simWellName,
|
||||
curveDefToAdd.timeStep(),
|
||||
@@ -527,19 +532,30 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
|
||||
curve->setZOrder( RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_OBSERVED ) );
|
||||
applyCurveAppearance( curve );
|
||||
}
|
||||
else if ( m_showEnsembleCurves && curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::SourceType::SUMMARY_RFT )
|
||||
else if ( ( !curveDefToAdd.address().ensemble() || m_showEnsembleCurves ) &&
|
||||
curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::SourceType::SUMMARY_RFT )
|
||||
{
|
||||
auto curve = new RimWellLogRftCurve();
|
||||
plotTrack->addCurve( curve );
|
||||
auto rftCase = curveDefToAdd.address().summaryCase();
|
||||
curve->setSummaryCase( rftCase );
|
||||
auto summaryCase = curveDefToAdd.address().summaryCase();
|
||||
curve->setSummaryCase( summaryCase );
|
||||
curve->setEnsemble( curveDefToAdd.address().ensemble() );
|
||||
curve->setObservedFmuRftData( this->findObservedFmuData( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() ) );
|
||||
curve->setObservedFmuRftData( findObservedFmuData( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() ) );
|
||||
RifEclipseRftAddress address = RifEclipseRftAddress::createAddress( m_wellPathNameOrSimWellName,
|
||||
curveDefToAdd.timeStep(),
|
||||
RifEclipseRftAddress::RftWellLogChannelType::PRESSURE );
|
||||
curve->setRftAddress( address );
|
||||
|
||||
// A summary case address can optionally contain an Eclipse case used to compute the TVD/MD for a well path
|
||||
// https://github.com/OPM/ResInsight/issues/10501
|
||||
auto eclipeCase = curveDefToAdd.address().eclCase();
|
||||
if ( curveDefToAdd.address().ensemble() )
|
||||
{
|
||||
auto curveSet = findEnsembleCurveSet( curveDefToAdd.address().ensemble() );
|
||||
if ( curveSet ) eclipeCase = curveSet->eclipseCase();
|
||||
}
|
||||
curve->setEclipseCase( eclipeCase );
|
||||
|
||||
double zValue = 1.0;
|
||||
if ( !curveDefToAdd.address().ensemble() )
|
||||
{
|
||||
@@ -558,9 +574,11 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
|
||||
}
|
||||
else if ( m_showStatisticsCurves && curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::SourceType::ENSEMBLE_RFT )
|
||||
{
|
||||
RimSummaryCaseCollection* ensemble = curveDefToAdd.address().ensemble();
|
||||
RimSummaryCaseCollection* ensemble = curveDefToAdd.address().ensemble();
|
||||
auto curveSet = findEnsembleCurveSet( ensemble );
|
||||
|
||||
std::set<RifEclipseRftAddress> rftAddresses =
|
||||
ensemble->rftStatisticsReader()->eclipseRftAddresses( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() );
|
||||
curveSet->statisticsEclipseRftReader()->eclipseRftAddresses( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() );
|
||||
for ( const auto& rftAddress : rftAddresses )
|
||||
{
|
||||
if ( rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50 )
|
||||
@@ -577,8 +595,9 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
|
||||
auto curve = new RimWellLogRftCurve();
|
||||
plotTrack->addCurve( curve );
|
||||
curve->setEnsemble( ensemble );
|
||||
curve->setEclipseCase( curveSet->eclipseCase() );
|
||||
curve->setRftAddress( rftAddress );
|
||||
curve->setObservedFmuRftData( this->findObservedFmuData( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() ) );
|
||||
curve->setObservedFmuRftData( findObservedFmuData( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() ) );
|
||||
curve->setZOrder( RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_STAT_CURVE ) );
|
||||
applyCurveAppearance( curve );
|
||||
auto symbol = statisticsCurveSymbolFromAddress( rftAddress );
|
||||
@@ -592,6 +611,7 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
|
||||
QString label = uiText.replace( ": Pressure", "" );
|
||||
curve->setSymbolLabel( label );
|
||||
curve->setLineThickness( 3 );
|
||||
curve->setShowInLegend( !m_showEnsembleCurves );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -635,12 +655,12 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
|
||||
}
|
||||
else if ( curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::SourceType::OBSERVED_LAS_FILE )
|
||||
{
|
||||
RimWellLogFile* const wellLogFile = curveDefToAdd.address().wellLogFile();
|
||||
RimWellPath* const wellPath = RimWellPlotTools::wellPathFromWellLogFile( wellLogFile );
|
||||
RimWellLogLasFile* const wellLogFile = curveDefToAdd.address().wellLogFile();
|
||||
RimWellPath* const wellPath = RimWellPlotTools::wellPathFromWellLogFile( wellLogFile );
|
||||
if ( wellLogFile != nullptr )
|
||||
{
|
||||
RimWellLogFileChannel* pressureChannel = RimWellPlotTools::getPressureChannelFromWellFile( wellLogFile );
|
||||
auto curve = new RimWellLogFileCurve();
|
||||
auto curve = new RimWellLogLasFileCurve();
|
||||
|
||||
plotTrack->addCurve( curve );
|
||||
curve->setWellPath( wellPath );
|
||||
@@ -675,7 +695,7 @@ std::vector<RifDataSourceForRftPlt> RimWellRftPlot::selectedSourcesExpanded() co
|
||||
{
|
||||
if ( addr.sourceType() == RifDataSourceForRftPlt::SourceType::OBSERVED_LAS_FILE )
|
||||
{
|
||||
for ( RimWellLogFile* const wellLogFile : RimWellPlotTools::wellLogFilesContainingPressure( m_wellPathNameOrSimWellName ) )
|
||||
for ( RimWellLogLasFile* const wellLogFile : RimWellPlotTools::wellLogFilesContainingPressure( m_wellPathNameOrSimWellName ) )
|
||||
{
|
||||
sources.push_back( RifDataSourceForRftPlt( wellLogFile ) );
|
||||
}
|
||||
@@ -788,6 +808,13 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions( const caf::
|
||||
|
||||
options = RiaSimWellBranchTools::valueOptionsForBranchIndexField( simulationWellBranches );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_ensembleCurveSetEclipseCase )
|
||||
{
|
||||
RimTools::caseOptionItems( &options );
|
||||
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -842,8 +869,9 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptionsForSources()
|
||||
{
|
||||
if ( summaryCase->rftReader() && summaryCase->rftReader()->wellNames().contains( m_wellPathNameOrSimWellName ) )
|
||||
{
|
||||
auto parentEnsemble = summaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
|
||||
auto addr = RifDataSourceForRftPlt( summaryCase, parentEnsemble );
|
||||
auto eclipeGridModel = RicImportGridModelFromSummaryCaseFeature::gridModelFromSummaryCase( summaryCase );
|
||||
auto parentEnsemble = summaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
|
||||
auto addr = RifDataSourceForRftPlt( summaryCase, parentEnsemble, eclipeGridModel );
|
||||
|
||||
auto item = caf::PdmOptionItemInfo( summaryCase->displayCaseName(), QVariant::fromValue( addr ) );
|
||||
item.setLevel( 1 );
|
||||
@@ -953,13 +981,24 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
{
|
||||
updateFormationsOnPlot();
|
||||
syncCurvesFromUiSelection();
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
else if ( changedField == &m_showStatisticsCurves || changedField == &m_showEnsembleCurves || changedField == &m_showErrorInObservedData )
|
||||
{
|
||||
updateFormationsOnPlot();
|
||||
syncCurvesFromUiSelection();
|
||||
}
|
||||
else if ( changedField == &m_ensembleCurveSetEclipseCase )
|
||||
{
|
||||
for ( RimWellRftEnsembleCurveSet* curveSet : m_ensembleCurveSets() )
|
||||
{
|
||||
curveSet->setEclipseCase( m_ensembleCurveSetEclipseCase );
|
||||
}
|
||||
|
||||
createEnsembleCurveSets();
|
||||
updateFormationsOnPlot();
|
||||
syncCurvesFromUiSelection();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1008,6 +1047,11 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword( "Sources", "Sources" );
|
||||
sourcesGroup->add( &m_selectedSources );
|
||||
|
||||
if ( !m_ensembleCurveSets.empty() )
|
||||
{
|
||||
uiOrdering.add( &m_ensembleCurveSetEclipseCase );
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* timeStepsGroup = uiOrdering.addNewGroupWithKeyword( "Time Steps", "TimeSteps" );
|
||||
timeStepsGroup->add( &m_selectedTimeSteps );
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ public:
|
||||
bool showErrorBarsForObservedData() const;
|
||||
void onLegendDefinitionChanged();
|
||||
|
||||
RimWellRftEnsembleCurveSet* findEnsembleCurveSet( RimSummaryCaseCollection* ensemble ) const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
@@ -138,7 +140,6 @@ private:
|
||||
|
||||
std::vector<RimSummaryCaseCollection*> selectedEnsembles() const;
|
||||
void createEnsembleCurveSets();
|
||||
RimWellRftEnsembleCurveSet* findEnsembleCurveSet( RimSummaryCaseCollection* ensemble ) const;
|
||||
|
||||
private:
|
||||
friend class RimWellRftEnsembleCurveSet;
|
||||
@@ -153,7 +154,9 @@ private:
|
||||
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;
|
||||
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
||||
|
||||
caf::PdmChildArrayField<RimWellRftEnsembleCurveSet*> m_ensembleCurveSets;
|
||||
caf::PdmChildArrayField<RimWellRftEnsembleCurveSet*> m_ensembleCurveSets;
|
||||
caf::PdmPtrField<RimEclipseCase*> m_ensembleCurveSetEclipseCase;
|
||||
|
||||
std::map<RimWellRftEnsembleCurveSet*, QPointer<RiuDraggableOverlayFrame>> m_ensembleLegendFrames;
|
||||
|
||||
std::map<RifDataSourceForRftPlt, cvf::Color3f> m_dataSourceColors;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "RicfCommandObject.h"
|
||||
#include "RifOdbReader.h"
|
||||
|
||||
#include "RigFemAddressDefines.h"
|
||||
#include "RigFemPart.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigFemPartGrid.h"
|
||||
@@ -170,15 +171,15 @@ RimGeoMechCase::~RimGeoMechCase()
|
||||
RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection();
|
||||
if ( plotCollection )
|
||||
{
|
||||
plotCollection->removeExtractors( this->geoMechData() );
|
||||
plotCollection->removeExtractors( geoMechData() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( this->geoMechData() )
|
||||
if ( geoMechData() )
|
||||
{
|
||||
// At this point, we assume that memory should be released
|
||||
CVF_ASSERT( this->geoMechData()->refCount() == 1 );
|
||||
CVF_ASSERT( geoMechData()->refCount() == 1 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,11 +204,11 @@ const RigGeoMechCaseData* RimGeoMechCase::geoMechData() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechCase::reloadDataAndUpdate()
|
||||
{
|
||||
if ( this->geoMechData() )
|
||||
if ( geoMechData() )
|
||||
{
|
||||
m_geoMechCaseData = nullptr;
|
||||
std::string errMsg;
|
||||
if ( this->openGeoMechCase( &errMsg ) == CASE_OPEN_ERROR )
|
||||
if ( openGeoMechCase( &errMsg ) == CASE_OPEN_ERROR )
|
||||
{
|
||||
RiaLogging::error( QString::fromStdString( errMsg ) );
|
||||
}
|
||||
@@ -268,7 +269,7 @@ RimGeoMechCase* RimGeoMechCase::createCopy( const QString& newInputFileName )
|
||||
RimProject* project = RimProject::current();
|
||||
|
||||
RimGeoMechCase* copycase =
|
||||
dynamic_cast<RimGeoMechCase*>( this->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
dynamic_cast<RimGeoMechCase*>( xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
CVF_ASSERT( copycase );
|
||||
|
||||
QFileInfo filenameInfo( newInputFileName );
|
||||
@@ -288,7 +289,7 @@ RimGeoMechCase* RimGeoMechCase::createCopy( const QString& newInputFileName )
|
||||
RimGeoMechCase::CaseOpenStatus RimGeoMechCase::openGeoMechCase( std::string* errorMessage )
|
||||
{
|
||||
// If read already, return
|
||||
if ( this->m_geoMechCaseData.notNull() ) return CASE_OPEN_OK;
|
||||
if ( m_geoMechCaseData.notNull() ) return CASE_OPEN_OK;
|
||||
|
||||
if ( !caf::Utils::fileExists( m_caseFileName().path() ) )
|
||||
{
|
||||
@@ -495,7 +496,7 @@ cvf::BoundingBox RimGeoMechCase::reservoirBoundingBox()
|
||||
{
|
||||
cvf::BoundingBox boundingBox;
|
||||
|
||||
RigGeoMechCaseData* rigCaseData = this->geoMechData();
|
||||
RigGeoMechCaseData* rigCaseData = geoMechData();
|
||||
if ( rigCaseData && rigCaseData->femPartResults() && rigCaseData->femParts() )
|
||||
{
|
||||
for ( int p = 0; p < rigCaseData->femParts()->partCount(); p++ )
|
||||
@@ -503,8 +504,8 @@ cvf::BoundingBox RimGeoMechCase::reservoirBoundingBox()
|
||||
RigFemPart* femPart = rigCaseData->femParts()->part( p );
|
||||
const RigFemPartGrid* femPartGrid = femPart->getOrCreateStructGrid();
|
||||
|
||||
RigFemResultAddress porBarAddr( RigFemResultPosEnum::RIG_ELEMENT_NODAL, "POR-Bar", "" );
|
||||
const std::vector<float>& resultValues = rigCaseData->femPartResults()->resultValues( porBarAddr, p, 0, 0 );
|
||||
const std::vector<float>& resultValues =
|
||||
rigCaseData->femPartResults()->resultValues( RigFemAddressDefines::elementNodalPorBarAddress(), p, 0, 0 );
|
||||
|
||||
for ( int i = 0; i < femPart->elementCount(); ++i )
|
||||
{
|
||||
@@ -592,7 +593,7 @@ void RimGeoMechCase::addElementPropertyFiles( const std::vector<caf::FilePath>&
|
||||
}
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
updateConnectedEditors();
|
||||
|
||||
if ( m_geoMechCaseData.notNull() )
|
||||
{
|
||||
@@ -686,10 +687,10 @@ void RimGeoMechCase::setApplyTimeFilter( bool applyTimeFilter )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimGeoMechCase::displayModelOffset() const
|
||||
{
|
||||
auto bb = this->allCellsBoundingBox();
|
||||
auto bb = allCellsBoundingBox();
|
||||
if ( bb.isValid() )
|
||||
{
|
||||
return this->allCellsBoundingBox().min();
|
||||
return allCellsBoundingBox().min();
|
||||
}
|
||||
|
||||
return cvf::Vec3d::ZERO;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user