mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
clang-format : Apply clang-fomat on ApplicationCode
This commit is contained in:
parent
260ff04b19
commit
4ccbd274b8
@ -70,8 +70,8 @@ void caf::AppEnum<RiaDefines::PlotAxis>::setUp()
|
||||
template <>
|
||||
void caf::AppEnum<RiaDefines::PhaseType>::setUp()
|
||||
{
|
||||
addItem( RiaDefines::OIL_PHASE, "OIL_PHASE", "Oil" );
|
||||
addItem( RiaDefines::GAS_PHASE, "GAS_PHASE", "Gas" );
|
||||
addItem( RiaDefines::OIL_PHASE, "OIL_PHASE", "Oil" );
|
||||
addItem( RiaDefines::GAS_PHASE, "GAS_PHASE", "Gas" );
|
||||
addItem( RiaDefines::WATER_PHASE, "WATER_PHASE", "Water" );
|
||||
setDefault( RiaDefines::OIL_PHASE );
|
||||
}
|
||||
|
@ -41,7 +41,9 @@ class Rim3dView;
|
||||
class Ric3dPickEvent : public caf::PickEvent
|
||||
{
|
||||
public:
|
||||
Ric3dPickEvent( const std::vector<RiuPickItemInfo>& pickItemInfos, Rim3dView* view, Qt::KeyboardModifiers keyboardModifiers)
|
||||
Ric3dPickEvent( const std::vector<RiuPickItemInfo>& pickItemInfos,
|
||||
Rim3dView* view,
|
||||
Qt::KeyboardModifiers keyboardModifiers )
|
||||
: m_pickItemInfos( pickItemInfos )
|
||||
, m_view( view )
|
||||
, m_keyboardModifiers( keyboardModifiers )
|
||||
|
@ -44,8 +44,8 @@ RimFlowPlotCollection::RimFlowPlotCollection()
|
||||
CAF_PDM_InitFieldNoDefault( &m_defaultWellAllocPlot, "DefaultWellAllocationPlot", "", "", "", "" );
|
||||
m_defaultWellAllocPlot.uiCapability()->setUiHidden( true );
|
||||
|
||||
//CAF_PDM_InitFieldNoDefault( &m_dbgWellDistributionPlot, "DbgWellDistributionPlot", "", "", "", "" );
|
||||
//m_dbgWellDistributionPlot.uiCapability()->setUiHidden( true );
|
||||
// CAF_PDM_InitFieldNoDefault( &m_dbgWellDistributionPlot, "DbgWellDistributionPlot", "", "", "", "" );
|
||||
// m_dbgWellDistributionPlot.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellDistributionPlotCollection, "WellDistributionPlotCollection", "", "", "", "" );
|
||||
m_wellDistributionPlotCollection.uiCapability()->setUiHidden( true );
|
||||
@ -86,7 +86,7 @@ void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||
}
|
||||
|
||||
delete m_flowCharacteristicsPlot;
|
||||
//delete m_dbgWellDistributionPlot;
|
||||
// delete m_dbgWellDistributionPlot;
|
||||
delete m_wellDistributionPlotCollection;
|
||||
|
||||
m_storedWellAllocPlots.deleteAllChildObjects();
|
||||
@ -120,7 +120,7 @@ void RimFlowPlotCollection::loadDataAndUpdate()
|
||||
m_flowCharacteristicsPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//if ( m_dbgWellDistributionPlot )
|
||||
// if ( m_dbgWellDistributionPlot )
|
||||
//{
|
||||
// m_dbgWellDistributionPlot->loadDataAndUpdate();
|
||||
//}
|
||||
@ -206,7 +206,7 @@ void RimFlowPlotCollection::ensureDefaultFlowPlotsAreCreated()
|
||||
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
|
||||
}
|
||||
|
||||
//if ( !m_dbgWellDistributionPlot() )
|
||||
// if ( !m_dbgWellDistributionPlot() )
|
||||
//{
|
||||
// m_dbgWellDistributionPlot = new RimWellDistributionPlot;
|
||||
// m_dbgWellDistributionPlot->setAsPlotMdiWindow();
|
||||
|
@ -27,7 +27,6 @@ class RimFlowCharacteristicsPlot;
|
||||
class RimWellDistributionPlot;
|
||||
class RimWellDistributionPlotCollection;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@ -51,10 +50,10 @@ public:
|
||||
void ensureDefaultFlowPlotsAreCreated();
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
|
||||
caf::PdmChildField<RimWellAllocationPlot*> m_defaultWellAllocPlot;
|
||||
//caf::PdmChildField<RimWellDistributionPlot*> m_dbgWellDistributionPlot;
|
||||
caf::PdmChildField<RimWellDistributionPlotCollection*> m_wellDistributionPlotCollection;
|
||||
caf::PdmChildArrayField<RimWellAllocationPlot*> m_storedWellAllocPlots;
|
||||
caf::PdmChildArrayField<RimFlowCharacteristicsPlot*> m_storedFlowCharacteristicsPlots;
|
||||
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
|
||||
caf::PdmChildField<RimWellAllocationPlot*> m_defaultWellAllocPlot;
|
||||
// caf::PdmChildField<RimWellDistributionPlot*> m_dbgWellDistributionPlot;
|
||||
caf::PdmChildField<RimWellDistributionPlotCollection*> m_wellDistributionPlotCollection;
|
||||
caf::PdmChildArrayField<RimWellAllocationPlot*> m_storedWellAllocPlots;
|
||||
caf::PdmChildArrayField<RimFlowCharacteristicsPlot*> m_storedFlowCharacteristicsPlots;
|
||||
};
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
#include "RimWellDistributionPlot.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigTofWellDistributionCalculator.h"
|
||||
@ -28,14 +28,14 @@
|
||||
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_legend_label.h"
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_plot_curve.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QTextBrowser>
|
||||
#include <QWidget>
|
||||
|
||||
//#include "cvfBase.h"
|
||||
//#include "cvfTrace.h"
|
||||
@ -43,58 +43,63 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellDistributionPlot, "WellDistributionPlot");
|
||||
CAF_PDM_SOURCE_INIT( RimWellDistributionPlot, "WellDistributionPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlot::RimWellDistributionPlot(RiaDefines::PhaseType phase)
|
||||
RimWellDistributionPlot::RimWellDistributionPlot( RiaDefines::PhaseType phase )
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::RimWellDistributionPlot()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::RimWellDistributionPlot()");
|
||||
|
||||
CAF_PDM_InitObject("Well Distribution Plot", "", "", "");
|
||||
CAF_PDM_InitObject( "Well Distribution Plot", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_case, "Case", "Case", "", "", "");
|
||||
CAF_PDM_InitField(&m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "");
|
||||
CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", "");
|
||||
CAF_PDM_InitField(&m_phase, "Phase", caf::AppEnum<RiaDefines::PhaseType>(phase), "Phase", "", "", "");
|
||||
CAF_PDM_InitField(&m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "");
|
||||
CAF_PDM_InitField(&m_smallContributionsRelativeThreshold, "SmallContributionsRelativeThreshold", 0.005, "Relative Threshold [0, 1]", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" );
|
||||
CAF_PDM_InitField( &m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "" );
|
||||
CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well", "", "", "" );
|
||||
CAF_PDM_InitField( &m_phase, "Phase", caf::AppEnum<RiaDefines::PhaseType>( phase ), "Phase", "", "", "" );
|
||||
CAF_PDM_InitField( &m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "" );
|
||||
CAF_PDM_InitField( &m_smallContributionsRelativeThreshold,
|
||||
"SmallContributionsRelativeThreshold",
|
||||
0.005,
|
||||
"Relative Threshold [0, 1]",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
m_showWindow = false;
|
||||
m_showWindow = false;
|
||||
m_showPlotLegends = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlot::~RimWellDistributionPlot()
|
||||
{
|
||||
}
|
||||
RimWellDistributionPlot::~RimWellDistributionPlot() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::setDataSourceParameters(RimEclipseResultCase* eclipseResultCase, int timeStepIndex, QString targetWellName)
|
||||
void RimWellDistributionPlot::setDataSourceParameters( RimEclipseResultCase* eclipseResultCase,
|
||||
int timeStepIndex,
|
||||
QString targetWellName )
|
||||
{
|
||||
m_case = eclipseResultCase;
|
||||
m_case = eclipseResultCase;
|
||||
m_timeStepIndex = timeStepIndex;
|
||||
m_wellName = targetWellName;
|
||||
m_wellName = targetWellName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::setPlotOptions(bool groupSmallContributions, double smallContributionsRelativeThreshold)
|
||||
void RimWellDistributionPlot::setPlotOptions( bool groupSmallContributions, double smallContributionsRelativeThreshold )
|
||||
{
|
||||
m_groupSmallContributions = groupSmallContributions;
|
||||
m_groupSmallContributions = groupSmallContributions;
|
||||
m_smallContributionsRelativeThreshold = smallContributionsRelativeThreshold;
|
||||
}
|
||||
|
||||
@ -109,17 +114,17 @@ RiuQwtPlotWidget* RimWellDistributionPlot::viewer()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::setAutoScaleXEnabled(bool /*enabled*/)
|
||||
void RimWellDistributionPlot::setAutoScaleXEnabled( bool /*enabled*/ )
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::setAutoScaleXEnabled()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::setAutoScaleXEnabled()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::setAutoScaleYEnabled(bool /*enabled*/)
|
||||
void RimWellDistributionPlot::setAutoScaleYEnabled( bool /*enabled*/ )
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::setAutoScaleYEnabled()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::setAutoScaleYEnabled()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -127,7 +132,7 @@ void RimWellDistributionPlot::setAutoScaleYEnabled(bool /*enabled*/)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::updateAxes()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::updateAxes()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::updateAxes()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -135,28 +140,28 @@ void RimWellDistributionPlot::updateAxes()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::updateLegend()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::updateLegend()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::updateLegend()");
|
||||
|
||||
if (!m_plotWidget)
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// For now we always show the legend when in multiplot mode
|
||||
bool doShowLegend = true;
|
||||
if (isMdiWindow())
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
doShowLegend = m_showPlotLegends;
|
||||
}
|
||||
|
||||
if (doShowLegend)
|
||||
if ( doShowLegend )
|
||||
{
|
||||
QwtLegend* legend = new QwtLegend(m_plotWidget);
|
||||
m_plotWidget->insertLegend(legend, QwtPlot::BottomLegend);
|
||||
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
||||
m_plotWidget->insertLegend( legend, QwtPlot::BottomLegend );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->insertLegend(nullptr);
|
||||
m_plotWidget->insertLegend( nullptr );
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +170,7 @@ void RimWellDistributionPlot::updateLegend()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::updateZoomInQwt()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::updateZoomInQwt()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::updateZoomInQwt()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -173,7 +178,7 @@ void RimWellDistributionPlot::updateZoomInQwt()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::updateZoomFromQwt()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::updateZoomFromQwt()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::updateZoomFromQwt()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -181,7 +186,7 @@ void RimWellDistributionPlot::updateZoomFromQwt()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellDistributionPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::asciiDataForPlotExport()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::asciiDataForPlotExport()");
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -190,7 +195,7 @@ QString RimWellDistributionPlot::asciiDataForPlotExport() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::reattachAllCurves()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::reattachAllCurves()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::reattachAllCurves()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -198,24 +203,24 @@ void RimWellDistributionPlot::reattachAllCurves()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::detachAllCurves()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::detachAllCurves()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::detachAllCurves()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimWellDistributionPlot::findPdmObjectFromQwtCurve(const QwtPlotCurve* /*curve*/) const
|
||||
caf::PdmObject* RimWellDistributionPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* /*curve*/ ) const
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::findPdmObjectFromQwtCurve()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::findPdmObjectFromQwtCurve()");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::onAxisSelected(int /*axis*/, bool /*toggle*/)
|
||||
void RimWellDistributionPlot::onAxisSelected( int /*axis*/, bool /*toggle*/ )
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::onAxisSelected()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::onAxisSelected()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -231,7 +236,7 @@ QString RimWellDistributionPlot::description() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellDistributionPlot::viewWidget()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::viewWidget()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::viewWidget()");
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
@ -240,14 +245,14 @@ QWidget* RimWellDistributionPlot::viewWidget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimWellDistributionPlot::snapshotWindowContent()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::snapshotWindowContent()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::snapshotWindowContent()");
|
||||
|
||||
QImage image;
|
||||
|
||||
if (m_plotWidget)
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
QPixmap pix = m_plotWidget->grab();
|
||||
image = pix.toImage();
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
@ -258,7 +263,7 @@ QImage RimWellDistributionPlot::snapshotWindowContent()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::zoomAll()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::zoomAll()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::zoomAll()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -266,26 +271,26 @@ void RimWellDistributionPlot::zoomAll()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::doRemoveFromCollection()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::doRemoveFromCollection()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::doRemoveFromCollection()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellDistributionPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
QWidget* RimWellDistributionPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::createViewWidget()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::createViewWidget()");
|
||||
|
||||
// It seems we risk being called multiple times
|
||||
if (m_plotWidget)
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
m_plotWidget = new RiuQwtPlotWidget(this, mainWindowParent);
|
||||
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||
|
||||
m_plotWidget->setAutoReplot(false);
|
||||
m_plotWidget->setDraggable(false);
|
||||
m_plotWidget->setAutoReplot( false );
|
||||
m_plotWidget->setDraggable( false );
|
||||
|
||||
updateLegend();
|
||||
onLoadDataAndUpdate();
|
||||
@ -298,11 +303,11 @@ QWidget* RimWellDistributionPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::deleteViewWidget()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::deleteViewWidget()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::deleteViewWidget()");
|
||||
|
||||
if (m_plotWidget)
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->setParent(nullptr);
|
||||
m_plotWidget->setParent( nullptr );
|
||||
delete m_plotWidget;
|
||||
m_plotWidget = nullptr;
|
||||
}
|
||||
@ -313,10 +318,10 @@ void RimWellDistributionPlot::deleteViewWidget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::onLoadDataAndUpdate()");
|
||||
//cvf::DebugTimer tim("RimWellDistributionPlot::onLoadDataAndUpdate()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::onLoadDataAndUpdate()");
|
||||
// cvf::DebugTimer tim("RimWellDistributionPlot::onLoadDataAndUpdate()");
|
||||
|
||||
if (isMdiWindow())
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
}
|
||||
@ -325,47 +330,52 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
|
||||
updateParentLayout();
|
||||
}
|
||||
|
||||
if (!m_plotWidget)
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_plotWidget->detachItems(QwtPlotItem::Rtti_PlotCurve);
|
||||
m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||
|
||||
updateLegend();
|
||||
|
||||
if (m_case)
|
||||
if ( m_case )
|
||||
{
|
||||
//tim.reportLapTimeMS("about to start calc");
|
||||
RigTofWellDistributionCalculator calc(m_case, m_wellName, m_timeStepIndex, m_phase());
|
||||
//tim.reportLapTimeMS("calc");
|
||||
// tim.reportLapTimeMS("about to start calc");
|
||||
RigTofWellDistributionCalculator calc( m_case, m_wellName, m_timeStepIndex, m_phase() );
|
||||
// tim.reportLapTimeMS("calc");
|
||||
|
||||
if (m_groupSmallContributions)
|
||||
if ( m_groupSmallContributions )
|
||||
{
|
||||
calc.groupSmallContributions(m_smallContributionsRelativeThreshold);
|
||||
//tim.reportLapTimeMS("group");
|
||||
calc.groupSmallContributions( m_smallContributionsRelativeThreshold );
|
||||
// tim.reportLapTimeMS("group");
|
||||
}
|
||||
|
||||
const RimFlowDiagSolution* flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
|
||||
//cvf::Trace::show("Populating plot for phase '%s'", m_phase == RiaDefines::OIL_PHASE ? "oil" : (m_phase == RiaDefines::GAS_PHASE ? "gas" : "water"));
|
||||
populatePlotWidgetWithCurveData(calc, *flowDiagSolution, m_plotWidget);
|
||||
// cvf::Trace::show("Populating plot for phase '%s'", m_phase == RiaDefines::OIL_PHASE ? "oil" : (m_phase ==
|
||||
// RiaDefines::GAS_PHASE ? "gas" : "water"));
|
||||
populatePlotWidgetWithCurveData( calc, *flowDiagSolution, m_plotWidget );
|
||||
}
|
||||
|
||||
QString phaseString = "N/A";
|
||||
if (m_phase == RiaDefines::OIL_PHASE) phaseString = "Oil";
|
||||
else if (m_phase == RiaDefines::GAS_PHASE) phaseString = "Gas";
|
||||
else if (m_phase == RiaDefines::WATER_PHASE) phaseString = "Water";
|
||||
if ( m_phase == RiaDefines::OIL_PHASE )
|
||||
phaseString = "Oil";
|
||||
else if ( m_phase == RiaDefines::GAS_PHASE )
|
||||
phaseString = "Gas";
|
||||
else if ( m_phase == RiaDefines::WATER_PHASE )
|
||||
phaseString = "Water";
|
||||
|
||||
const QString timeStepName = m_case ? m_case->timeStepName(m_timeStepIndex) : "N/A";
|
||||
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->setTitle(plotTitleStr);
|
||||
const QString plotTitleStr =
|
||||
QString( "%1 Distribution: %2, %3" ).arg( phaseString ).arg( m_wellName ).arg( timeStepName );
|
||||
m_plotWidget->setTitle( plotTitleStr );
|
||||
|
||||
m_plotWidget->setAxisTitleText(QwtPlot::xBottom, "TOF [years]");
|
||||
m_plotWidget->setAxisTitleText(QwtPlot::yLeft, "Reservoir Volume [m3]");
|
||||
m_plotWidget->setAxisTitleEnabled(QwtPlot::xBottom, true);
|
||||
m_plotWidget->setAxisTitleEnabled(QwtPlot::yLeft, true);
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "TOF [years]" );
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::yLeft, "Reservoir Volume [m3]" );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true );
|
||||
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
@ -373,136 +383,141 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::populatePlotWidgetWithCurveData(const RigTofWellDistributionCalculator& calculator, const RimFlowDiagSolution& flowDiagSolution, RiuQwtPlotWidget* plotWidget)
|
||||
void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellDistributionCalculator& calculator,
|
||||
const RimFlowDiagSolution& flowDiagSolution,
|
||||
RiuQwtPlotWidget* plotWidget )
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlot::populatePlotWidgetWithCurves()");
|
||||
// cvf::Trace::show("RimWellDistributionPlot::populatePlotWidgetWithCurves()");
|
||||
|
||||
// Currently select this value so that the grid appears on top of the curves
|
||||
const double baseCurveZValue = 9.5;
|
||||
|
||||
plotWidget->detachItems(QwtPlotItem::Rtti_PlotCurve);
|
||||
plotWidget->setAxisScale(QwtPlot::xBottom, 0, 1);
|
||||
plotWidget->setAxisScale(QwtPlot::yLeft, 0, 1);
|
||||
plotWidget->setAxisAutoScale(QwtPlot::xBottom, true);
|
||||
plotWidget->setAxisAutoScale(QwtPlot::yLeft, true);
|
||||
plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||
plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 );
|
||||
plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
|
||||
|
||||
const std::vector<double>& tofValuesDays = calculator.sortedUniqueTOFValues();
|
||||
if (tofValuesDays.size() == 0)
|
||||
if ( tofValuesDays.size() == 0 )
|
||||
{
|
||||
//cvf::Trace::show("No TOF values!");
|
||||
// cvf::Trace::show("No TOF values!");
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<double> tofValuesYears;
|
||||
for (double tofDays : tofValuesDays)
|
||||
for ( double tofDays : tofValuesDays )
|
||||
{
|
||||
const double tofYears = tofDays / 365.2425;
|
||||
tofValuesYears.push_back(tofYears);
|
||||
tofValuesYears.push_back( tofYears );
|
||||
}
|
||||
|
||||
//cvf::Trace::show("numTofValues: %d (min, max: %f, %f)", static_cast<int>(tofValuesYears.size()), tofValuesYears.front(), tofValuesYears.back());
|
||||
// cvf::Trace::show("numTofValues: %d (min, max: %f, %f)", static_cast<int>(tofValuesYears.size()),
|
||||
// tofValuesYears.front(), tofValuesYears.back());
|
||||
|
||||
const size_t numWells = calculator.contributingWellCount();
|
||||
//cvf::Trace::show("numContribWells: %d", static_cast<int>(numWells));
|
||||
// cvf::Trace::show("numContribWells: %d", static_cast<int>(numWells));
|
||||
|
||||
std::vector<double> yVals(tofValuesYears.size(), 0);
|
||||
std::vector<double> yVals( tofValuesYears.size(), 0 );
|
||||
|
||||
for (size_t i = 0; i < numWells; i++)
|
||||
for ( size_t i = 0; i < numWells; i++ )
|
||||
{
|
||||
QString wellName = calculator.contributingWellName(i);
|
||||
const std::vector<double>& volArr = calculator.accumulatedVolumeForContributingWell(i);
|
||||
QString wellName = calculator.contributingWellName( i );
|
||||
const std::vector<double>& volArr = calculator.accumulatedVolumeForContributingWell( i );
|
||||
|
||||
cvf::Color3f cvfClr = flowDiagSolution.tracerColor(wellName);
|
||||
QColor qtClr = RiaColorTools::toQColor(cvfClr);
|
||||
cvf::Color3f cvfClr = flowDiagSolution.tracerColor( wellName );
|
||||
QColor qtClr = RiaColorTools::toQColor( cvfClr );
|
||||
|
||||
for (size_t j = 0; j < yVals.size(); j++)
|
||||
for ( size_t j = 0; j < yVals.size(); j++ )
|
||||
{
|
||||
yVals[j] += volArr[j];
|
||||
}
|
||||
|
||||
//cvf::Trace::show("wellName min, max: %15s %12.3f, %12.3f maxAggrY: %12.3f", wellName.toStdString().c_str(), volArr.front(), volArr.back(), yVals.back());
|
||||
// cvf::Trace::show("wellName min, max: %15s %12.3f, %12.3f maxAggrY: %12.3f",
|
||||
// wellName.toStdString().c_str(), volArr.front(), volArr.back(), yVals.back());
|
||||
|
||||
QwtPlotCurve* curve = new QwtPlotCurve;
|
||||
curve->setTitle(wellName);
|
||||
curve->setBrush(qtClr);
|
||||
curve->setZ(baseCurveZValue - i * 0.0001);
|
||||
curve->setSamples(tofValuesYears.data(), yVals.data(), static_cast<int>(tofValuesYears.size()));
|
||||
curve->attach(plotWidget);
|
||||
curve->setTitle( wellName );
|
||||
curve->setBrush( qtClr );
|
||||
curve->setZ( baseCurveZValue - i * 0.0001 );
|
||||
curve->setSamples( tofValuesYears.data(), yVals.data(), static_cast<int>( tofValuesYears.size() ) );
|
||||
curve->attach( plotWidget );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
void RimWellDistributionPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add(&m_case);
|
||||
uiOrdering.add(&m_timeStepIndex);
|
||||
uiOrdering.add(&m_wellName);
|
||||
uiOrdering.add(&m_phase);
|
||||
uiOrdering.add(&m_groupSmallContributions);
|
||||
uiOrdering.add(&m_smallContributionsRelativeThreshold);
|
||||
uiOrdering.add( &m_case );
|
||||
uiOrdering.add( &m_timeStepIndex );
|
||||
uiOrdering.add( &m_wellName );
|
||||
uiOrdering.add( &m_phase );
|
||||
uiOrdering.add( &m_groupSmallContributions );
|
||||
uiOrdering.add( &m_smallContributionsRelativeThreshold );
|
||||
|
||||
m_smallContributionsRelativeThreshold.uiCapability()->setUiReadOnly(m_groupSmallContributions == false);
|
||||
m_smallContributionsRelativeThreshold.uiCapability()->setUiReadOnly( m_groupSmallContributions == false );
|
||||
|
||||
RimPlot::defineUiOrdering(uiConfigName, uiOrdering);
|
||||
//uiOrdering.skipRemainingFields();
|
||||
RimPlot::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
// uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimWellDistributionPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimWellDistributionPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimPlot::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
|
||||
QList<caf::PdmOptionItemInfo> options = RimPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
|
||||
|
||||
if (fieldNeedingOptions == &m_case)
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* ownerProj = nullptr;
|
||||
firstAncestorOrThisOfType(ownerProj);
|
||||
if (ownerProj)
|
||||
firstAncestorOrThisOfType( ownerProj );
|
||||
if ( ownerProj )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> caseArr;
|
||||
ownerProj->descendantsIncludingThisOfType(caseArr);
|
||||
for (RimEclipseResultCase* c : caseArr)
|
||||
ownerProj->descendantsIncludingThisOfType( caseArr );
|
||||
for ( RimEclipseResultCase* c : caseArr )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, true, c->uiIconProvider()));
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (fieldNeedingOptions == &m_timeStepIndex)
|
||||
else if ( fieldNeedingOptions == &m_timeStepIndex )
|
||||
{
|
||||
if (m_case && m_case->eclipseCaseData())
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
const QStringList timeStepNames = m_case->timeStepStrings();
|
||||
for (int i = 0; i < timeStepNames.size(); i++)
|
||||
for ( int i = 0; i < timeStepNames.size(); i++ )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
|
||||
options.push_back( caf::PdmOptionItemInfo( timeStepNames[i], i ) );
|
||||
}
|
||||
}
|
||||
|
||||
if (options.size() == 0)
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("None", -1));
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", -1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
else if (fieldNeedingOptions == &m_wellName)
|
||||
else if ( fieldNeedingOptions == &m_wellName )
|
||||
{
|
||||
if (m_case && m_case->eclipseCaseData())
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
caf::QIconProvider simWellIcon(":/Well.png");
|
||||
caf::QIconProvider simWellIcon( ":/Well.png" );
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
for (const QString& name : sortedWellNameSet)
|
||||
for ( const QString& name : sortedWellNameSet )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(name, name, true, simWellIcon));
|
||||
options.push_back( caf::PdmOptionItemInfo( name, name, true, simWellIcon ) );
|
||||
}
|
||||
}
|
||||
|
||||
if (options.size() == 0)
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("None", QVariant()));
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", QVariant() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -512,11 +527,13 @@ QList<caf::PdmOptionItemInfo> RimWellDistributionPlot::calculateValueOptions(con
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
void RimWellDistributionPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimPlot::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
RimPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if (changedField == &m_case)
|
||||
if ( changedField == &m_case )
|
||||
{
|
||||
fixupDependentFieldsAfterCaseChange();
|
||||
}
|
||||
@ -529,26 +546,24 @@ void RimWellDistributionPlot::fieldChangedByUi(const caf::PdmFieldHandle* change
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::fixupDependentFieldsAfterCaseChange()
|
||||
{
|
||||
int newTimeStepIndex = -1;
|
||||
int newTimeStepIndex = -1;
|
||||
QString newWellName;
|
||||
|
||||
if (m_case)
|
||||
if ( m_case )
|
||||
{
|
||||
const int timeStepCount = m_case->timeStepStrings().size();
|
||||
if (timeStepCount > 0)
|
||||
if ( timeStepCount > 0 )
|
||||
{
|
||||
newTimeStepIndex = timeStepCount - 1;
|
||||
}
|
||||
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
if (sortedWellNameSet.size() > 0)
|
||||
if ( sortedWellNameSet.size() > 0 )
|
||||
{
|
||||
newWellName = *sortedWellNameSet.begin();
|
||||
}
|
||||
}
|
||||
|
||||
m_timeStepIndex = newTimeStepIndex;
|
||||
m_wellName = newWellName;
|
||||
m_wellName = newWellName;
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimPlot.h"
|
||||
#include "RiaDefines.h"
|
||||
#include "RimPlot.h"
|
||||
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
@ -30,8 +30,6 @@ class RimFlowDiagSolution;
|
||||
class RigTofWellDistributionCalculator;
|
||||
class RiuQwtPlotWidget;
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
@ -42,58 +40,63 @@ class RimWellDistributionPlot : public RimPlot
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
explicit RimWellDistributionPlot(RiaDefines::PhaseType phase = RiaDefines::OIL_PHASE);
|
||||
explicit RimWellDistributionPlot( RiaDefines::PhaseType phase = RiaDefines::OIL_PHASE );
|
||||
~RimWellDistributionPlot() override;
|
||||
|
||||
void setDataSourceParameters(RimEclipseResultCase* eclipseResultCase, int timeStepIndex, QString targetWellName);
|
||||
void setPlotOptions(bool groupSmallContributions, double smallContributionsRelativeThreshold);
|
||||
void setDataSourceParameters( RimEclipseResultCase* eclipseResultCase, int timeStepIndex, QString targetWellName );
|
||||
void setPlotOptions( bool groupSmallContributions, double smallContributionsRelativeThreshold );
|
||||
|
||||
// RimPlot implementations
|
||||
virtual RiuQwtPlotWidget* viewer() override;
|
||||
virtual void setAutoScaleXEnabled(bool enabled) override;
|
||||
virtual void setAutoScaleYEnabled(bool enabled) override;
|
||||
virtual void updateAxes() override;
|
||||
virtual void updateLegend() override;
|
||||
virtual void updateZoomInQwt() override;
|
||||
virtual void updateZoomFromQwt() override;
|
||||
virtual QString asciiDataForPlotExport() const override;
|
||||
virtual void reattachAllCurves() override;
|
||||
virtual void detachAllCurves() override;
|
||||
virtual caf::PdmObject* findPdmObjectFromQwtCurve(const QwtPlotCurve* curve) const override;
|
||||
virtual void onAxisSelected(int axis, bool toggle) override;
|
||||
virtual RiuQwtPlotWidget* viewer() override;
|
||||
virtual void setAutoScaleXEnabled( bool enabled ) override;
|
||||
virtual void setAutoScaleYEnabled( bool enabled ) override;
|
||||
virtual void updateAxes() override;
|
||||
virtual void updateLegend() override;
|
||||
virtual void updateZoomInQwt() override;
|
||||
virtual void updateZoomFromQwt() override;
|
||||
virtual QString asciiDataForPlotExport() const override;
|
||||
virtual void reattachAllCurves() override;
|
||||
virtual void detachAllCurves() override;
|
||||
virtual caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
virtual void onAxisSelected( int axis, bool toggle ) override;
|
||||
|
||||
// RimPlotWindow implementations
|
||||
virtual QString description() const override;
|
||||
virtual QString description() const override;
|
||||
|
||||
// RimViewWindow implementations
|
||||
virtual QWidget* viewWidget() override;
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
virtual void zoomAll() override;
|
||||
virtual QWidget* viewWidget() override;
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
virtual void zoomAll() override;
|
||||
|
||||
private:
|
||||
// RimPlot implementations
|
||||
virtual void doRemoveFromCollection() override;
|
||||
virtual void doRemoveFromCollection() override;
|
||||
|
||||
// RimViewWindow implementations
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
virtual void deleteViewWidget() override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
virtual QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
virtual void deleteViewWidget() override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
static void populatePlotWidgetWithCurveData(const RigTofWellDistributionCalculator& calculator, const RimFlowDiagSolution& flowDiagSolution, RiuQwtPlotWidget* plotWidget);
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
static void populatePlotWidgetWithCurveData( const RigTofWellDistributionCalculator& calculator,
|
||||
const RimFlowDiagSolution& flowDiagSolution,
|
||||
RiuQwtPlotWidget* plotWidget );
|
||||
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||
caf::PdmField<int> m_timeStepIndex;
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField< caf::AppEnum<RiaDefines::PhaseType>> m_phase;
|
||||
caf::PdmField<bool> m_groupSmallContributions;
|
||||
caf::PdmField<double> m_smallContributionsRelativeThreshold;
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||
caf::PdmField<int> m_timeStepIndex;
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::PhaseType>> m_phase;
|
||||
caf::PdmField<bool> m_groupSmallContributions;
|
||||
caf::PdmField<double> m_smallContributionsRelativeThreshold;
|
||||
|
||||
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
||||
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
||||
};
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
#include "RimWellDistributionPlotCollection.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellDistributionPlot.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
@ -29,70 +29,73 @@
|
||||
|
||||
#include "RiuQwtPlotTools.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_plot_curve.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QTextBrowser>
|
||||
#include <QWidget>
|
||||
|
||||
//#include "cvfBase.h"
|
||||
//#include "cvfTrace.h"
|
||||
//#include "cvfDebugTimer.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellDistributionPlotCollection, "WellDistributionPlotCollection");
|
||||
CAF_PDM_SOURCE_INIT( RimWellDistributionPlotCollection, "WellDistributionPlotCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()
|
||||
: RimMultiPlotWindow(true)
|
||||
: RimMultiPlotWindow( true )
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()");
|
||||
// cvf::Trace::show("RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()");
|
||||
|
||||
CAF_PDM_InitObject("Well Distribution Plots", "", "", "");
|
||||
CAF_PDM_InitObject( "Well Distribution Plots", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_case, "Case", "Case", "", "", "");
|
||||
CAF_PDM_InitField(&m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "");
|
||||
CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", "");
|
||||
CAF_PDM_InitField(&m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "");
|
||||
CAF_PDM_InitField(&m_smallContributionsRelativeThreshold, "SmallContributionsRelativeThreshold", 0.005, "Relative Threshold [0, 1]", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" );
|
||||
CAF_PDM_InitField( &m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "" );
|
||||
CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well", "", "", "" );
|
||||
CAF_PDM_InitField( &m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "" );
|
||||
CAF_PDM_InitField( &m_smallContributionsRelativeThreshold,
|
||||
"SmallContributionsRelativeThreshold",
|
||||
0.005,
|
||||
"Relative Threshold [0, 1]",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
m_plotWindowTitle = "Well Distribution Plots";
|
||||
m_columnCountEnum = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
||||
|
||||
m_showPlotLegends = false;
|
||||
m_showWindow = false;
|
||||
m_showWindow = false;
|
||||
|
||||
setAcceptDrops(false);
|
||||
setAcceptDrops( false );
|
||||
setAsPlotMdiWindow();
|
||||
|
||||
addPlot(new RimWellDistributionPlot(RiaDefines::OIL_PHASE));
|
||||
addPlot(new RimWellDistributionPlot(RiaDefines::GAS_PHASE));
|
||||
addPlot(new RimWellDistributionPlot(RiaDefines::WATER_PHASE));
|
||||
addPlot( new RimWellDistributionPlot( RiaDefines::OIL_PHASE ) );
|
||||
addPlot( new RimWellDistributionPlot( RiaDefines::GAS_PHASE ) );
|
||||
addPlot( new RimWellDistributionPlot( RiaDefines::WATER_PHASE ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlotCollection::~RimWellDistributionPlotCollection()
|
||||
{
|
||||
}
|
||||
RimWellDistributionPlotCollection::~RimWellDistributionPlotCollection() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::onLoadDataAndUpdate()
|
||||
{
|
||||
//cvf::Trace::show("RimWellDistributionPlotCollection::onLoadDataAndUpdate()");
|
||||
// cvf::Trace::show("RimWellDistributionPlotCollection::onLoadDataAndUpdate()");
|
||||
|
||||
RimMultiPlotWindow::onLoadDataAndUpdate();
|
||||
}
|
||||
@ -100,74 +103,77 @@ void RimWellDistributionPlotCollection::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
void RimWellDistributionPlotCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add(&m_case);
|
||||
uiOrdering.add(&m_timeStepIndex);
|
||||
uiOrdering.add(&m_wellName);
|
||||
uiOrdering.add(&m_groupSmallContributions);
|
||||
uiOrdering.add(&m_smallContributionsRelativeThreshold);
|
||||
uiOrdering.add( &m_case );
|
||||
uiOrdering.add( &m_timeStepIndex );
|
||||
uiOrdering.add( &m_wellName );
|
||||
uiOrdering.add( &m_groupSmallContributions );
|
||||
uiOrdering.add( &m_smallContributionsRelativeThreshold );
|
||||
|
||||
m_smallContributionsRelativeThreshold.uiCapability()->setUiReadOnly(m_groupSmallContributions == false);
|
||||
m_smallContributionsRelativeThreshold.uiCapability()->setUiReadOnly( m_groupSmallContributions == false );
|
||||
|
||||
//RimMultiPlotWindow::defineUiOrdering(uiConfigName, uiOrdering);
|
||||
// RimMultiPlotWindow::defineUiOrdering(uiConfigName, uiOrdering);
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimWellDistributionPlotCollection::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimWellDistributionPlotCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimMultiPlotWindow::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
|
||||
QList<caf::PdmOptionItemInfo> options = RimMultiPlotWindow::calculateValueOptions( fieldNeedingOptions,
|
||||
useOptionsOnly );
|
||||
|
||||
if (fieldNeedingOptions == &m_case)
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* ownerProj = nullptr;
|
||||
firstAncestorOrThisOfType(ownerProj);
|
||||
if (ownerProj)
|
||||
firstAncestorOrThisOfType( ownerProj );
|
||||
if ( ownerProj )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> caseArr;
|
||||
ownerProj->descendantsIncludingThisOfType(caseArr);
|
||||
for (RimEclipseResultCase* c : caseArr)
|
||||
ownerProj->descendantsIncludingThisOfType( caseArr );
|
||||
for ( RimEclipseResultCase* c : caseArr )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, true, c->uiIconProvider()));
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (fieldNeedingOptions == &m_timeStepIndex)
|
||||
else if ( fieldNeedingOptions == &m_timeStepIndex )
|
||||
{
|
||||
if (m_case && m_case->eclipseCaseData())
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
const QStringList timeStepNames = m_case->timeStepStrings();
|
||||
for (int i = 0; i < timeStepNames.size(); i++)
|
||||
for ( int i = 0; i < timeStepNames.size(); i++ )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
|
||||
options.push_back( caf::PdmOptionItemInfo( timeStepNames[i], i ) );
|
||||
}
|
||||
}
|
||||
|
||||
if (options.size() == 0)
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("None", -1));
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", -1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
else if (fieldNeedingOptions == &m_wellName)
|
||||
else if ( fieldNeedingOptions == &m_wellName )
|
||||
{
|
||||
if (m_case && m_case->eclipseCaseData())
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
caf::QIconProvider simWellIcon(":/Well.png");
|
||||
caf::QIconProvider simWellIcon( ":/Well.png" );
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
for (const QString& name : sortedWellNameSet)
|
||||
for ( const QString& name : sortedWellNameSet )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(name, name, true, simWellIcon));
|
||||
options.push_back( caf::PdmOptionItemInfo( name, name, true, simWellIcon ) );
|
||||
}
|
||||
}
|
||||
|
||||
if (options.size() == 0)
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("None", QVariant()));
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", QVariant() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,50 +183,47 @@ QList<caf::PdmOptionItemInfo> RimWellDistributionPlotCollection::calculateValueO
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
void RimWellDistributionPlotCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if (changedField == &m_case)
|
||||
if ( changedField == &m_case )
|
||||
{
|
||||
fixupDependentFieldsAfterCaseChange();
|
||||
}
|
||||
|
||||
bool shouldRecalculatePlotData = false;
|
||||
if (changedField == &m_case ||
|
||||
changedField == &m_timeStepIndex ||
|
||||
changedField == &m_wellName ||
|
||||
changedField == &m_groupSmallContributions ||
|
||||
changedField == &m_smallContributionsRelativeThreshold)
|
||||
if ( changedField == &m_case || changedField == &m_timeStepIndex || changedField == &m_wellName ||
|
||||
changedField == &m_groupSmallContributions || changedField == &m_smallContributionsRelativeThreshold )
|
||||
{
|
||||
applyPlotParametersToContainedPlots();
|
||||
shouldRecalculatePlotData = true;
|
||||
}
|
||||
|
||||
RimMultiPlotWindow::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
RimMultiPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if (shouldRecalculatePlotData)
|
||||
if ( shouldRecalculatePlotData )
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::applyPlotParametersToContainedPlots()
|
||||
{
|
||||
const size_t numPlots = plotCount();
|
||||
for (size_t i = 0; i < numPlots; i++)
|
||||
for ( size_t i = 0; i < numPlots; i++ )
|
||||
{
|
||||
// Dirty usage of dyn_cast, but type is lost when adding the plots to our base class
|
||||
RimWellDistributionPlot* aPlot = dynamic_cast<RimWellDistributionPlot*>(plotByIndex(i));
|
||||
if (aPlot)
|
||||
RimWellDistributionPlot* aPlot = dynamic_cast<RimWellDistributionPlot*>( plotByIndex( i ) );
|
||||
if ( aPlot )
|
||||
{
|
||||
aPlot->setDataSourceParameters(m_case, m_timeStepIndex, m_wellName);
|
||||
aPlot->setPlotOptions(m_groupSmallContributions, m_smallContributionsRelativeThreshold);
|
||||
aPlot->setDataSourceParameters( m_case, m_timeStepIndex, m_wellName );
|
||||
aPlot->setPlotOptions( m_groupSmallContributions, m_smallContributionsRelativeThreshold );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -228,26 +231,24 @@ void RimWellDistributionPlotCollection::applyPlotParametersToContainedPlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::fixupDependentFieldsAfterCaseChange()
|
||||
{
|
||||
int newTimeStepIndex = -1;
|
||||
int newTimeStepIndex = -1;
|
||||
QString newWellName;
|
||||
|
||||
if (m_case)
|
||||
if ( m_case )
|
||||
{
|
||||
const int timeStepCount = m_case->timeStepStrings().size();
|
||||
if (timeStepCount > 0)
|
||||
if ( timeStepCount > 0 )
|
||||
{
|
||||
newTimeStepIndex = timeStepCount - 1;
|
||||
}
|
||||
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
if (sortedWellNameSet.size() > 0)
|
||||
if ( sortedWellNameSet.size() > 0 )
|
||||
{
|
||||
newWellName = *sortedWellNameSet.begin();
|
||||
}
|
||||
}
|
||||
|
||||
m_timeStepIndex = newTimeStepIndex;
|
||||
m_wellName = newWellName;
|
||||
m_wellName = newWellName;
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimMultiPlotWindow.h"
|
||||
#include "RiaDefines.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
@ -34,7 +34,6 @@ class RigTofWellDistributionCalculator;
|
||||
class QTextBrowser;
|
||||
class QwtPlot;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
@ -50,15 +49,18 @@ public:
|
||||
|
||||
private:
|
||||
// RimPlotWindow overrides
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
void applyPlotParametersToContainedPlots();
|
||||
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
void applyPlotParametersToContainedPlots();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||
|
@ -186,12 +186,12 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
if ( &m_resultPositionTypeUiField == fieldNeedingOptions )
|
||||
{
|
||||
std::vector<RigFemResultPosEnum> optionItems = { RIG_NODAL,
|
||||
RIG_ELEMENT_NODAL,
|
||||
RIG_INTEGRATION_POINT,
|
||||
RIG_ELEMENT_NODAL_FACE,
|
||||
RIG_FORMATION_NAMES,
|
||||
RIG_ELEMENT };
|
||||
std::vector<RigFemResultPosEnum> optionItems = {RIG_NODAL,
|
||||
RIG_ELEMENT_NODAL,
|
||||
RIG_INTEGRATION_POINT,
|
||||
RIG_ELEMENT_NODAL_FACE,
|
||||
RIG_FORMATION_NAMES,
|
||||
RIG_ELEMENT};
|
||||
if ( m_addWellPathDerivedResults )
|
||||
{
|
||||
optionItems.push_back( RIG_WELLPATH_DERIVED );
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include "RigTofWellDistributionCalculator.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaPorosityModel.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPorosityModel.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
@ -35,8 +35,6 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
@ -46,57 +44,77 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigTofWellDistributionCalculator::RigTofWellDistributionCalculator(RimEclipseResultCase* caseToApply, QString targetWellname, size_t timeStepIndex, RiaDefines::PhaseType phase)
|
||||
RigTofWellDistributionCalculator::RigTofWellDistributionCalculator( RimEclipseResultCase* caseToApply,
|
||||
QString targetWellname,
|
||||
size_t timeStepIndex,
|
||||
RiaDefines::PhaseType phase )
|
||||
{
|
||||
CVF_ASSERT(caseToApply);
|
||||
CVF_ASSERT( caseToApply );
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = caseToApply->eclipseCaseData();
|
||||
CVF_ASSERT(eclipseCaseData);
|
||||
CVF_ASSERT( eclipseCaseData );
|
||||
|
||||
RimFlowDiagSolution* flowDiagSolution = caseToApply->defaultFlowDiagSolution();
|
||||
CVF_ASSERT(flowDiagSolution);
|
||||
CVF_ASSERT( flowDiagSolution );
|
||||
|
||||
RigFlowDiagResults* flowDiagResults = flowDiagSolution->flowDiagResults();
|
||||
CVF_ASSERT(flowDiagResults);
|
||||
CVF_ASSERT( flowDiagResults );
|
||||
|
||||
const std::vector<double>* porvResults = eclipseCaseData->resultValues(RiaDefines::MATRIX_MODEL, RiaDefines::STATIC_NATIVE, "PORV", 0);
|
||||
if (!porvResults)
|
||||
const std::vector<double>* porvResults = eclipseCaseData->resultValues( RiaDefines::MATRIX_MODEL,
|
||||
RiaDefines::STATIC_NATIVE,
|
||||
"PORV",
|
||||
0 );
|
||||
if ( !porvResults )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString phaseResultName;
|
||||
if (phase == RiaDefines::WATER_PHASE) phaseResultName = "SWAT";
|
||||
else if (phase == RiaDefines::OIL_PHASE) phaseResultName = "SOIL";
|
||||
else if (phase == RiaDefines::GAS_PHASE) phaseResultName = "SGAS";
|
||||
const std::vector<double>* phaseResults = eclipseCaseData->resultValues(RiaDefines::MATRIX_MODEL, RiaDefines::DYNAMIC_NATIVE, phaseResultName, timeStepIndex);
|
||||
if (!phaseResults)
|
||||
if ( phase == RiaDefines::WATER_PHASE )
|
||||
phaseResultName = "SWAT";
|
||||
else if ( phase == RiaDefines::OIL_PHASE )
|
||||
phaseResultName = "SOIL";
|
||||
else if ( phase == RiaDefines::GAS_PHASE )
|
||||
phaseResultName = "SGAS";
|
||||
const std::vector<double>* phaseResults = eclipseCaseData->resultValues( RiaDefines::MATRIX_MODEL,
|
||||
RiaDefines::DYNAMIC_NATIVE,
|
||||
phaseResultName,
|
||||
timeStepIndex );
|
||||
if ( !phaseResults )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const RigFlowDiagResultAddress resultAddrTof("TOF", RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL, targetWellname.toStdString());
|
||||
const RigFlowDiagResultAddress resultAddrFraction("Fraction", RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL, targetWellname.toStdString());
|
||||
const std::vector<double>* tofData = flowDiagResults->resultValues(resultAddrTof, timeStepIndex);
|
||||
const std::vector<double>* targetWellFractionData = flowDiagResults->resultValues(resultAddrFraction, timeStepIndex);
|
||||
if (!tofData || !targetWellFractionData)
|
||||
const RigFlowDiagResultAddress resultAddrTof( "TOF",
|
||||
RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL,
|
||||
targetWellname.toStdString() );
|
||||
const RigFlowDiagResultAddress resultAddrFraction( "Fraction",
|
||||
RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL,
|
||||
targetWellname.toStdString() );
|
||||
const std::vector<double>* tofData = flowDiagResults->resultValues( resultAddrTof, timeStepIndex );
|
||||
const std::vector<double>* targetWellFractionData = flowDiagResults->resultValues( resultAddrFraction, timeStepIndex );
|
||||
if ( !tofData || !targetWellFractionData )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const std::map<double, std::vector<size_t>> tofToCellIndicesMap = buildSortedTofToCellIndicesMap( *tofData );
|
||||
|
||||
const std::map<double, std::vector<size_t>> tofToCellIndicesMap = buildSortedTofToCellIndicesMap(*tofData);
|
||||
const std::vector<QString> candidateContributingWellNames = findCandidateContributingWellNames( *flowDiagSolution,
|
||||
targetWellname,
|
||||
timeStepIndex );
|
||||
const size_t numContribWells = candidateContributingWellNames.size();
|
||||
|
||||
const std::vector<QString> candidateContributingWellNames = findCandidateContributingWellNames(*flowDiagSolution, targetWellname, timeStepIndex);
|
||||
const size_t numContribWells = candidateContributingWellNames.size();
|
||||
|
||||
for (size_t iContribWell = 0; iContribWell < numContribWells; iContribWell++)
|
||||
for ( size_t iContribWell = 0; iContribWell < numContribWells; iContribWell++ )
|
||||
{
|
||||
const QString contribWellName = candidateContributingWellNames[iContribWell];
|
||||
|
||||
const RigFlowDiagResultAddress resultAddrContribWellFraction("Fraction", RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL, contribWellName.toStdString());
|
||||
const std::vector<double>* contribWellFractionData = flowDiagResults->resultValues(resultAddrContribWellFraction, timeStepIndex);
|
||||
if (!contribWellFractionData)
|
||||
const RigFlowDiagResultAddress resultAddrContribWellFraction( "Fraction",
|
||||
RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL,
|
||||
contribWellName.toStdString() );
|
||||
const std::vector<double>* contribWellFractionData = flowDiagResults->resultValues( resultAddrContribWellFraction,
|
||||
timeStepIndex );
|
||||
if ( !contribWellFractionData )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -106,74 +124,74 @@ RigTofWellDistributionCalculator::RigTofWellDistributionCalculator(RimEclipseRes
|
||||
ContribWellEntry contribWellEntry;
|
||||
contribWellEntry.name = contribWellName;
|
||||
|
||||
for (auto mapElement : tofToCellIndicesMap)
|
||||
for ( auto mapElement : tofToCellIndicesMap )
|
||||
{
|
||||
const double tofValue = mapElement.first;
|
||||
const double tofValue = mapElement.first;
|
||||
const std::vector<size_t>& cellIndicesArr = mapElement.second;
|
||||
|
||||
for (size_t cellIndex : cellIndicesArr)
|
||||
for ( size_t cellIndex : cellIndicesArr )
|
||||
{
|
||||
const double porv = porvResults->at(cellIndex);
|
||||
const double targetWellFractionVal = targetWellFractionData->at(cellIndex);
|
||||
const double contribWellFractionVal = contribWellFractionData->at(cellIndex);
|
||||
if (contribWellFractionVal == HUGE_VAL)
|
||||
const double porv = porvResults->at( cellIndex );
|
||||
const double targetWellFractionVal = targetWellFractionData->at( cellIndex );
|
||||
const double contribWellFractionVal = contribWellFractionData->at( cellIndex );
|
||||
if ( contribWellFractionVal == HUGE_VAL )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const double volAllPhasesThisCell = porv * targetWellFractionVal*contribWellFractionVal;
|
||||
accumulatedVolForSpecifiedPhase += phaseResults->at(cellIndex)*volAllPhasesThisCell;
|
||||
const double volAllPhasesThisCell = porv * targetWellFractionVal * contribWellFractionVal;
|
||||
accumulatedVolForSpecifiedPhase += phaseResults->at( cellIndex ) * volAllPhasesThisCell;
|
||||
}
|
||||
|
||||
contribWellEntry.accumulatedVolAlongTof.push_back(accumulatedVolForSpecifiedPhase);
|
||||
contribWellEntry.accumulatedVolAlongTof.push_back( accumulatedVolForSpecifiedPhase );
|
||||
}
|
||||
|
||||
if (accumulatedVolForSpecifiedPhase > 0)
|
||||
if ( accumulatedVolForSpecifiedPhase > 0 )
|
||||
{
|
||||
m_contributingWells.push_back(contribWellEntry);
|
||||
m_contributingWells.push_back( contribWellEntry );
|
||||
}
|
||||
}
|
||||
|
||||
for (auto mapElement : tofToCellIndicesMap)
|
||||
for ( auto mapElement : tofToCellIndicesMap )
|
||||
{
|
||||
const double tofValue = mapElement.first;
|
||||
m_tofInIncreasingOrder.push_back(tofValue);
|
||||
m_tofInIncreasingOrder.push_back( tofValue );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigTofWellDistributionCalculator::groupSmallContributions(double smallContribThreshold)
|
||||
void RigTofWellDistributionCalculator::groupSmallContributions( double smallContribThreshold )
|
||||
{
|
||||
if (m_tofInIncreasingOrder.size() == 0)
|
||||
if ( m_tofInIncreasingOrder.size() == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double totalVolAtLastTof = 0;
|
||||
for (const ContribWellEntry& entry : m_contributingWells)
|
||||
for ( const ContribWellEntry& entry : m_contributingWells )
|
||||
{
|
||||
totalVolAtLastTof += entry.accumulatedVolAlongTof.back();
|
||||
}
|
||||
|
||||
std::vector<ContribWellEntry> sourceEntryArr = std::move(m_contributingWells);
|
||||
std::vector<ContribWellEntry> sourceEntryArr = std::move( m_contributingWells );
|
||||
|
||||
ContribWellEntry groupingEntry;
|
||||
groupingEntry.name = "Other";
|
||||
groupingEntry.accumulatedVolAlongTof.resize(m_tofInIncreasingOrder.size(), 0);
|
||||
groupingEntry.accumulatedVolAlongTof.resize( m_tofInIncreasingOrder.size(), 0 );
|
||||
bool anySmallContribsDetected = false;
|
||||
|
||||
for (const ContribWellEntry& sourceEntry : sourceEntryArr)
|
||||
for ( const ContribWellEntry& sourceEntry : sourceEntryArr )
|
||||
{
|
||||
const double volAtLastTof = sourceEntry.accumulatedVolAlongTof.back();
|
||||
if (volAtLastTof >= totalVolAtLastTof*smallContribThreshold)
|
||||
if ( volAtLastTof >= totalVolAtLastTof * smallContribThreshold )
|
||||
{
|
||||
m_contributingWells.push_back(sourceEntry);
|
||||
m_contributingWells.push_back( sourceEntry );
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < groupingEntry.accumulatedVolAlongTof.size(); i++)
|
||||
for ( size_t i = 0; i < groupingEntry.accumulatedVolAlongTof.size(); i++ )
|
||||
{
|
||||
groupingEntry.accumulatedVolAlongTof[i] += sourceEntry.accumulatedVolAlongTof[i];
|
||||
}
|
||||
@ -181,39 +199,40 @@ void RigTofWellDistributionCalculator::groupSmallContributions(double smallContr
|
||||
}
|
||||
}
|
||||
|
||||
if (anySmallContribsDetected)
|
||||
if ( anySmallContribsDetected )
|
||||
{
|
||||
m_contributingWells.push_back(groupingEntry);
|
||||
m_contributingWells.push_back( groupingEntry );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<double, std::vector<size_t>> RigTofWellDistributionCalculator::buildSortedTofToCellIndicesMap(const std::vector<double>& tofData)
|
||||
std::map<double, std::vector<size_t>>
|
||||
RigTofWellDistributionCalculator::buildSortedTofToCellIndicesMap( const std::vector<double>& tofData )
|
||||
{
|
||||
std::map<double, std::vector<size_t>> tofToCellIndicesMap;
|
||||
|
||||
for (size_t i = 0; i < tofData.size(); i++)
|
||||
for ( size_t i = 0; i < tofData.size(); i++ )
|
||||
{
|
||||
const double tofValue = tofData[i];
|
||||
if (tofValue == HUGE_VAL)
|
||||
if ( tofValue == HUGE_VAL )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Also filter out special TOF values greater than 73000 days (~200 years)
|
||||
if (tofValue > 73000.0)
|
||||
if ( tofValue > 73000.0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector<size_t> vectorOfIndexes{ i };
|
||||
auto iteratorBoolFromInsertToMap = tofToCellIndicesMap.insert(std::make_pair(tofValue, vectorOfIndexes));
|
||||
if (!iteratorBoolFromInsertToMap.second)
|
||||
std::vector<size_t> vectorOfIndexes{i};
|
||||
auto iteratorBoolFromInsertToMap = tofToCellIndicesMap.insert( std::make_pair( tofValue, vectorOfIndexes ) );
|
||||
if ( !iteratorBoolFromInsertToMap.second )
|
||||
{
|
||||
// Map element for this tofValue already exist => we must add the cell index ourselves
|
||||
iteratorBoolFromInsertToMap.first->second.push_back(i);
|
||||
iteratorBoolFromInsertToMap.first->second.push_back( i );
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,33 +242,39 @@ std::map<double, std::vector<size_t>> RigTofWellDistributionCalculator::buildSor
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Determine name of the the wells that are candidates for contributing in our calculation
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RigTofWellDistributionCalculator::findCandidateContributingWellNames(const RimFlowDiagSolution& flowDiagSolution, QString targetWellname, size_t timeStepIndex)
|
||||
std::vector<QString>
|
||||
RigTofWellDistributionCalculator::findCandidateContributingWellNames( const RimFlowDiagSolution& flowDiagSolution,
|
||||
QString targetWellname,
|
||||
size_t timeStepIndex )
|
||||
{
|
||||
std::vector<QString> candidateWellNames;
|
||||
|
||||
const RimFlowDiagSolution::TracerStatusType targetWellStatus = flowDiagSolution.tracerStatusInTimeStep(targetWellname, timeStepIndex);
|
||||
if (targetWellStatus != RimFlowDiagSolution::INJECTOR &&
|
||||
targetWellStatus != RimFlowDiagSolution::PRODUCER)
|
||||
const RimFlowDiagSolution::TracerStatusType targetWellStatus =
|
||||
flowDiagSolution.tracerStatusInTimeStep( targetWellname, timeStepIndex );
|
||||
if ( targetWellStatus != RimFlowDiagSolution::INJECTOR && targetWellStatus != RimFlowDiagSolution::PRODUCER )
|
||||
{
|
||||
RiaLogging::warning("Status of target well is neither INJECTOR nor PRODUCER");
|
||||
RiaLogging::warning( "Status of target well is neither INJECTOR nor PRODUCER" );
|
||||
return candidateWellNames;
|
||||
}
|
||||
|
||||
const RimFlowDiagSolution::TracerStatusType oppositeStatus = (targetWellStatus == RimFlowDiagSolution::INJECTOR) ? RimFlowDiagSolution::PRODUCER : RimFlowDiagSolution::INJECTOR;
|
||||
const RimFlowDiagSolution::TracerStatusType oppositeStatus = ( targetWellStatus == RimFlowDiagSolution::INJECTOR )
|
||||
? RimFlowDiagSolution::PRODUCER
|
||||
: RimFlowDiagSolution::INJECTOR;
|
||||
|
||||
const std::vector<QString> allWellNames = flowDiagSolution.tracerNames();
|
||||
for (QString name : allWellNames)
|
||||
for ( QString name : allWellNames )
|
||||
{
|
||||
const RimFlowDiagSolution::TracerStatusType status = flowDiagSolution.tracerStatusInTimeStep(name, timeStepIndex);
|
||||
if (status == oppositeStatus)
|
||||
const RimFlowDiagSolution::TracerStatusType status = flowDiagSolution.tracerStatusInTimeStep( name,
|
||||
timeStepIndex );
|
||||
if ( status == oppositeStatus )
|
||||
{
|
||||
candidateWellNames.push_back(name);
|
||||
candidateWellNames.push_back( name );
|
||||
}
|
||||
else if (status == targetWellStatus)
|
||||
else if ( status == targetWellStatus )
|
||||
{
|
||||
if (RimFlowDiagSolution::hasCrossFlowEnding(name))
|
||||
if ( RimFlowDiagSolution::hasCrossFlowEnding( name ) )
|
||||
{
|
||||
candidateWellNames.push_back(name);
|
||||
candidateWellNames.push_back( name );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -276,7 +301,7 @@ size_t RigTofWellDistributionCalculator::contributingWellCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString& RigTofWellDistributionCalculator::contributingWellName(size_t contribWellIndex) const
|
||||
const QString& RigTofWellDistributionCalculator::contributingWellName( size_t contribWellIndex ) const
|
||||
{
|
||||
return m_contributingWells[contribWellIndex].name;
|
||||
}
|
||||
@ -284,10 +309,10 @@ const QString& RigTofWellDistributionCalculator::contributingWellName(size_t con
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RigTofWellDistributionCalculator::accumulatedVolumeForContributingWell(size_t contributingWellIndex) const
|
||||
const std::vector<double>&
|
||||
RigTofWellDistributionCalculator::accumulatedVolumeForContributingWell( size_t contributingWellIndex ) const
|
||||
{
|
||||
CVF_ASSERT(contributingWellIndex < m_contributingWells.size());
|
||||
CVF_ASSERT( contributingWellIndex < m_contributingWells.size() );
|
||||
const ContribWellEntry& entry = m_contributingWells[contributingWellIndex];
|
||||
return entry.accumulatedVolAlongTof;
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <QString>
|
||||
|
||||
@ -30,7 +30,6 @@ class RimEclipseResultCase;
|
||||
class RimFlowDiagSolution;
|
||||
class QString;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
@ -39,28 +38,32 @@ class QString;
|
||||
class RigTofWellDistributionCalculator
|
||||
{
|
||||
public:
|
||||
RigTofWellDistributionCalculator(RimEclipseResultCase* caseToApply, QString targetWellname, size_t timeStepIndex, RiaDefines::PhaseType phase);
|
||||
RigTofWellDistributionCalculator( RimEclipseResultCase* caseToApply,
|
||||
QString targetWellname,
|
||||
size_t timeStepIndex,
|
||||
RiaDefines::PhaseType phase );
|
||||
|
||||
void groupSmallContributions(double smallContribThreshold);
|
||||
void groupSmallContributions( double smallContribThreshold );
|
||||
|
||||
const std::vector<double>& sortedUniqueTOFValues() const;
|
||||
const std::vector<double>& sortedUniqueTOFValues() const;
|
||||
|
||||
size_t contributingWellCount() const;
|
||||
const QString& contributingWellName(size_t contribWellIndex) const;
|
||||
const std::vector<double>& accumulatedVolumeForContributingWell(size_t contributingWellIndex) const;
|
||||
size_t contributingWellCount() const;
|
||||
const QString& contributingWellName( size_t contribWellIndex ) const;
|
||||
const std::vector<double>& accumulatedVolumeForContributingWell( size_t contributingWellIndex ) const;
|
||||
|
||||
private:
|
||||
static std::map<double, std::vector<size_t>> buildSortedTofToCellIndicesMap(const std::vector<double>& tofData);
|
||||
static std::vector<QString> findCandidateContributingWellNames(const RimFlowDiagSolution& flowDiagSolution, QString targetWellname, size_t timeStepIndex);
|
||||
static std::map<double, std::vector<size_t>> buildSortedTofToCellIndicesMap( const std::vector<double>& tofData );
|
||||
static std::vector<QString> findCandidateContributingWellNames( const RimFlowDiagSolution& flowDiagSolution,
|
||||
QString targetWellname,
|
||||
size_t timeStepIndex );
|
||||
|
||||
struct ContribWellEntry
|
||||
{
|
||||
QString name;
|
||||
std::vector<double> accumulatedVolAlongTof; // This array has same size as m_tofInIncreasingOrder
|
||||
std::vector<double> accumulatedVolAlongTof; // This array has same size as m_tofInIncreasingOrder
|
||||
};
|
||||
|
||||
private:
|
||||
std::vector<double> m_tofInIncreasingOrder;
|
||||
std::vector<ContribWellEntry> m_contributingWells;
|
||||
std::vector<double> m_tofInIncreasingOrder;
|
||||
std::vector<ContribWellEntry> m_contributingWells;
|
||||
};
|
||||
|
||||
|
@ -55,8 +55,6 @@ RiuRelativePermeabilityPlotUpdater::RiuRelativePermeabilityPlotUpdater( RiuRelat
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -254,8 +252,8 @@ QString RiuRelativePermeabilityPlotUpdater::constructCellReferenceText( const Ri
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuEclipseSelectionItem*
|
||||
RiuRelativePermeabilityPlotUpdater::extractEclipseSelectionItem( const RiuSelectionItem* selectionItem,
|
||||
Rim3dView*& newFollowAnimView )
|
||||
RiuRelativePermeabilityPlotUpdater::extractEclipseSelectionItem( const RiuSelectionItem* selectionItem,
|
||||
Rim3dView*& newFollowAnimView )
|
||||
{
|
||||
newFollowAnimView = nullptr;
|
||||
RiuEclipseSelectionItem* eclipseSelectionItem = nullptr;
|
||||
@ -288,7 +286,6 @@ RiuRelativePermeabilityPlotUpdater::extractEclipseSelectionItem( const RiuSelect
|
||||
return eclipseSelectionItem;
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user