#1126 Add "Accumulated Saturation by Time of Flight"-plot

This commit is contained in:
Bjørnar Grip Fjær
2017-08-15 16:00:00 +02:00
parent 4bda27c627
commit 030ad9cec4
11 changed files with 704 additions and 5 deletions

View File

@@ -9,6 +9,7 @@ ${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.h
${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.h
${CEE_CURRENT_LIST_DIR}RimTotalWellAllocationPlot.h
${CEE_CURRENT_LIST_DIR}RimTofAccumulatedPhaseFractionsPlot.h
${CEE_CURRENT_LIST_DIR}RimWellFlowRateCurve.h
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlotLegend.h
${CEE_CURRENT_LIST_DIR}RimFlowCharacteristicsPlot.h
@@ -19,6 +20,7 @@ ${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.cpp
${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.cpp
${CEE_CURRENT_LIST_DIR}RimTotalWellAllocationPlot.cpp
${CEE_CURRENT_LIST_DIR}RimTofAccumulatedPhaseFractionsPlot.cpp
${CEE_CURRENT_LIST_DIR}RimWellFlowRateCurve.cpp
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlotLegend.cpp
${CEE_CURRENT_LIST_DIR}RimFlowCharacteristicsPlot.cpp

View File

@@ -0,0 +1,216 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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 "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RiaApplication.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RimWellAllocationPlot.h"
#include "RigSingleWellResultsData.h"
#include "RigTofAccumulatedPhaseFractionsCalculator.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RiuMainPlotWindow.h"
#include "RiuTofAccumulatedPhaseFractionsPlot.h"
#include "RiuWellAllocationPlot.h"
#include "cvfColor3.h"
CAF_PDM_SOURCE_INIT(RimTofAccumulatedPhaseFractionsPlot, "TofAccumulatedPhaseFractionsPlot");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimTofAccumulatedPhaseFractionsPlot::RimTofAccumulatedPhaseFractionsPlot()
{
CAF_PDM_InitObject("Cumulative Saturation by Time of Flight", ":/WellAllocPie16x16.png", "", "");
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Cumulative Saturation by Time of Flight"), "Name", "", "", "");
m_userName.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
m_showWindow = false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimTofAccumulatedPhaseFractionsPlot::~RimTofAccumulatedPhaseFractionsPlot()
{
removeMdiWindowFromMdiArea();
deleteViewWidget();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::deleteViewWidget()
{
if (m_tofAccumulatedPhaseFractionsPlotWidget)
{
m_tofAccumulatedPhaseFractionsPlotWidget->deleteLater();
m_tofAccumulatedPhaseFractionsPlotWidget = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::reloadFromWell()
{
loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultCase* RimTofAccumulatedPhaseFractionsPlot::resultCase()
{
RimWellAllocationPlot* allocationPlot;
firstAncestorOrThisOfTypeAsserted(allocationPlot);
return allocationPlot->rimCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimTofAccumulatedPhaseFractionsPlot::tracerName()
{
RimWellAllocationPlot* allocationPlot;
firstAncestorOrThisOfTypeAsserted(allocationPlot);
return allocationPlot->wellName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimTofAccumulatedPhaseFractionsPlot::timeStep()
{
RimWellAllocationPlot* allocationPlot;
firstAncestorOrThisOfTypeAsserted(allocationPlot);
return static_cast<size_t>(allocationPlot->timeStep());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimTofAccumulatedPhaseFractionsPlot::viewWidget()
{
return m_tofAccumulatedPhaseFractionsPlotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::zoomAll()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
if (changedField == &m_userName ||
changedField == &m_showPlotTitle)
{
updateMdiWindowTitle();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimTofAccumulatedPhaseFractionsPlot::snapshotWindowContent()
{
QImage image;
// TODO
return image;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::setDescription(const QString& description)
{
m_userName = description;
this->updateMdiWindowTitle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimTofAccumulatedPhaseFractionsPlot::description() const
{
return m_userName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTofAccumulatedPhaseFractionsPlot::loadDataAndUpdate()
{
updateMdiWindowVisibility();
if (m_tofAccumulatedPhaseFractionsPlotWidget)
{
RigTofAccumulatedPhaseFractionsCalculator calc(resultCase(), tracerName(), timeStep());
const std::vector<double>& xValues = calc.sortedUniqueTOFValues();
const std::vector<double>& watValues = calc.accumulatedPhaseFractionsSwat();
const std::vector<double>& oilValues = calc.accumulatedPhaseFractionsSoil();
const std::vector<double>& gasValues = calc.accumulatedPhaseFractionsSgas();
m_tofAccumulatedPhaseFractionsPlotWidget->setSamples(xValues, watValues, oilValues, gasValues);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimTofAccumulatedPhaseFractionsPlot::createViewWidget(QWidget* mainWindowParent)
{
if (!m_tofAccumulatedPhaseFractionsPlotWidget)
{
m_tofAccumulatedPhaseFractionsPlotWidget = new RiuTofAccumulatedPhaseFractionsPlot(this, mainWindowParent);
}
return m_tofAccumulatedPhaseFractionsPlotWidget;
}

View File

@@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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 "RimViewWindow.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include <QPointer>
#include <vector>
class RiuWellAllocationPlot;
class RimEclipseWell;
class RimWellLogPlot;
class RiuTofAccumulatedPhaseFractionsPlot;
class RimEclipseResultCase;
namespace caf {
class PdmOptionItemInfo;
}
namespace cvf {
class Color3f;
}
//==================================================================================================
///
///
//==================================================================================================
class RimTofAccumulatedPhaseFractionsPlot : public RimViewWindow
{
CAF_PDM_HEADER_INIT;
public:
RimTofAccumulatedPhaseFractionsPlot();
virtual ~RimTofAccumulatedPhaseFractionsPlot();
void setDescription(const QString& description);
QString description() const;
// RimViewWindow overrides
virtual QWidget* viewWidget() override;
virtual void zoomAll() override;
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
virtual void deleteViewWidget() override;
void reloadFromWell();
RimEclipseResultCase* resultCase();
QString tracerName();
size_t timeStep();
protected:
// RimViewWindow overrides
virtual void loadDataAndUpdate() override;
virtual QImage snapshotWindowContent() override;
// Overridden PDM methods
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
QPointer<RiuTofAccumulatedPhaseFractionsPlot> m_tofAccumulatedPhaseFractionsPlotWidget;
};

View File

@@ -41,6 +41,7 @@
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellAllocationPlotLegend.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RiuMainPlotWindow.h"
#include "RiuWellAllocationPlot.h"
@@ -102,6 +103,10 @@ RimWellAllocationPlot::RimWellAllocationPlot()
m_wellAllocationPlotLegend.uiCapability()->setUiHidden(true);
m_wellAllocationPlotLegend = new RimWellAllocationPlotLegend;
CAF_PDM_InitFieldNoDefault(&m_tofAccumulatedPhaseFractionsPlot, "TofAccumulatedPhaseFractionsPlot", "TOF Accumulated Phase Fractions", "", "", "");
m_tofAccumulatedPhaseFractionsPlot.uiCapability()->setUiHidden(true);
m_tofAccumulatedPhaseFractionsPlot = new RimTofAccumulatedPhaseFractionsPlot;
this->setAsPlotMdiWindow();
}
@@ -114,6 +119,7 @@ RimWellAllocationPlot::~RimWellAllocationPlot()
delete m_accumulatedWellFlowPlot();
delete m_totalWellAllocationPlot();
delete m_tofAccumulatedPhaseFractionsPlot();
deleteViewWidget();
}
@@ -311,6 +317,10 @@ void RimWellAllocationPlot::updateFromWell()
m_totalWellAllocationPlot->updateConnectedEditors();
accumulatedWellFlowPlot()->updateConnectedEditors();
m_tofAccumulatedPhaseFractionsPlot->reloadFromWell();
m_tofAccumulatedPhaseFractionsPlot->updateConnectedEditors();
if (m_wellAllocationPlotWidget) m_wellAllocationPlotWidget->updateGeometry();
}
@@ -523,6 +533,14 @@ RimTotalWellAllocationPlot* RimWellAllocationPlot::totalWellFlowPlot()
return m_totalWellAllocationPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimTofAccumulatedPhaseFractionsPlot * RimWellAllocationPlot::tofAccumulatedPhaseFractionsPlot()
{
return m_tofAccumulatedPhaseFractionsPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -35,6 +35,7 @@ class RimWellAllocationPlotLegend;
class RimWellLogPlot;
class RiuWellAllocationPlot;
class RimWellLogTrack;
class RimTofAccumulatedPhaseFractionsPlot;
class RigSingleWellResultsData;
namespace cvf {
@@ -72,6 +73,7 @@ public:
RimWellLogPlot* accumulatedWellFlowPlot();
RimTotalWellAllocationPlot* totalWellFlowPlot();
RimTofAccumulatedPhaseFractionsPlot* tofAccumulatedPhaseFractionsPlot();
caf::PdmObject* plotLegend();
RimEclipseResultCase* rimCase();
int timeStep();
@@ -134,4 +136,5 @@ private:
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot;
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
caf::PdmChildField<RimWellAllocationPlotLegend*> m_wellAllocationPlotLegend;
caf::PdmChildField<RimTofAccumulatedPhaseFractionsPlot*> m_tofAccumulatedPhaseFractionsPlot;
};