2017-09-27 05:39:28 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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"
|
2017-10-11 06:52:29 -05:00
|
|
|
#include "cvfCollection.h"
|
2017-10-09 03:51:07 -05:00
|
|
|
#include "RimPlotCurve.h"
|
2017-10-26 03:35:23 -05:00
|
|
|
|
|
|
|
#include "RifWellRftAddressQMetaType.h"
|
|
|
|
|
2017-09-27 05:39:28 -05:00
|
|
|
#include <QPointer>
|
2017-10-03 01:19:38 -05:00
|
|
|
#include <QDate>
|
|
|
|
#include <QMetaType>
|
2017-10-13 07:32:26 -05:00
|
|
|
#include <set>
|
|
|
|
#include <map>
|
2017-11-02 05:05:39 -05:00
|
|
|
#include <utility>
|
2017-10-13 06:44:53 -05:00
|
|
|
|
2017-10-11 06:52:29 -05:00
|
|
|
class RimEclipseCase;
|
2017-10-13 02:29:42 -05:00
|
|
|
class RimEclipseResultCase;
|
|
|
|
class RimWellLogCurve;
|
|
|
|
class RimWellLogFileChannel;
|
2017-09-27 05:39:28 -05:00
|
|
|
class RimWellLogPlot;
|
2017-10-03 06:54:07 -05:00
|
|
|
class RimWellPath;
|
2017-10-13 02:29:42 -05:00
|
|
|
class RiuWellRftPlot;
|
2017-11-02 05:05:39 -05:00
|
|
|
class RigEclipseCaseData;
|
2017-09-27 05:39:28 -05:00
|
|
|
|
|
|
|
namespace cvf {
|
|
|
|
class Color3f;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace caf {
|
|
|
|
class PdmOptionItemInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
|
|
|
class RimWellRftPlot : public RimViewWindow
|
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
2017-10-04 07:36:33 -05:00
|
|
|
|
2017-11-02 05:05:39 -05:00
|
|
|
static const std::set<QString> PRESSURE_DATA_NAMES;
|
2017-10-05 09:25:04 -05:00
|
|
|
static const char PLOT_NAME_QFORMAT_STRING[];
|
2017-09-27 05:39:28 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
RimWellRftPlot();
|
|
|
|
virtual ~RimWellRftPlot();
|
|
|
|
|
|
|
|
void setDescription(const QString& description);
|
|
|
|
QString description() const;
|
|
|
|
|
|
|
|
virtual QWidget* viewWidget() override;
|
|
|
|
virtual void zoomAll() override;
|
|
|
|
|
2017-09-27 07:05:14 -05:00
|
|
|
RimWellLogPlot* wellLogPlot() const;
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-09-29 04:24:18 -05:00
|
|
|
void setCurrentWellName(const QString& currWellName);
|
|
|
|
QString currentWellName() const;
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-10-19 09:12:22 -05:00
|
|
|
static bool hasPressureData(const RimWellLogFile* wellLogFile);
|
|
|
|
static bool isPressureChannel(RimWellLogFileChannel* channel);
|
2017-10-05 09:25:04 -05:00
|
|
|
static bool hasPressureData(RimEclipseResultCase* gridCase);
|
2017-10-19 09:12:22 -05:00
|
|
|
static bool hasPressureData(RimWellPath* wellPath);
|
2017-11-02 05:05:39 -05:00
|
|
|
static std::pair<size_t, QString> pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData);
|
2017-10-05 09:25:04 -05:00
|
|
|
static const char* plotNameFormatString();
|
|
|
|
|
2017-10-17 04:01:15 -05:00
|
|
|
void applyInitialSelections();
|
|
|
|
|
2017-09-27 05:39:28 -05:00
|
|
|
protected:
|
|
|
|
// Overridden PDM methods
|
|
|
|
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
|
|
|
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 QImage snapshotWindowContent() override;
|
|
|
|
|
|
|
|
|
|
|
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
2017-10-31 06:49:14 -05:00
|
|
|
virtual void onLoadDataAndUpdate() override;
|
2017-09-27 05:39:28 -05:00
|
|
|
|
|
|
|
private:
|
2017-10-27 02:38:24 -05:00
|
|
|
static void addTimeStepToMap(std::map<QDateTime, std::set<RifWellRftAddress>>& destMap,
|
2017-10-26 03:35:23 -05:00
|
|
|
const std::pair<QDateTime, std::set<RifWellRftAddress>>& timeStepToAdd);
|
2017-10-27 02:38:24 -05:00
|
|
|
static void addTimeStepsToMap(std::map<QDateTime, std::set<RifWellRftAddress>>& destMap,
|
2017-10-26 03:35:23 -05:00
|
|
|
const std::map<QDateTime, std::set<RifWellRftAddress>>& timeStepsToAdd);
|
2017-09-29 04:24:18 -05:00
|
|
|
void calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>& options);
|
2017-10-04 07:36:33 -05:00
|
|
|
void calculateValueOptionsForTimeSteps(const QString& wellName, QList<caf::PdmOptionItemInfo>& options);
|
2017-10-02 02:40:33 -05:00
|
|
|
|
2017-10-05 03:54:52 -05:00
|
|
|
void updateEditorsFromCurves();
|
2017-09-27 05:39:28 -05:00
|
|
|
void updateWidgetTitleWindowTitle();
|
|
|
|
|
2017-10-05 09:25:04 -05:00
|
|
|
void syncCurvesFromUiSelection();
|
2017-10-03 01:19:38 -05:00
|
|
|
|
2017-10-19 09:12:22 -05:00
|
|
|
std::vector<RimWellLogFile*> wellLogFilesContainingPressure(const QString& wellName) const;
|
|
|
|
RimWellLogFileChannel* getPressureChannelFromWellFile(const RimWellLogFile* wellLogFile) const;
|
2017-10-04 07:36:33 -05:00
|
|
|
|
2017-10-19 09:12:22 -05:00
|
|
|
RimWellPath* wellPathFromWellLogFile(const RimWellLogFile* wellLogFile) const;
|
|
|
|
|
2017-10-16 05:22:13 -05:00
|
|
|
std::vector<std::tuple<RimEclipseResultCase*, bool, bool>> eclipseCasesForWell(const QString& wellName) const;
|
2017-10-11 14:58:51 -05:00
|
|
|
std::vector<RimEclipseResultCase*> gridCasesFromEclipseCases(const std::vector<std::tuple<RimEclipseResultCase*, bool, bool>>& eclipseCasesTuple) const;
|
|
|
|
std::vector<RimEclipseResultCase*> rftCasesFromEclipseCases(const std::vector<std::tuple<RimEclipseResultCase*, bool, bool>>& eclipseCasesTuple) const;
|
2017-10-26 03:35:23 -05:00
|
|
|
std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsFromRftCase(RimEclipseResultCase* gridCase) const;
|
|
|
|
std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsFromGridCase(RimEclipseCase* gridCase) const;
|
|
|
|
std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsFromWellLogFile(RimWellLogFile* wellLogFile) const;
|
|
|
|
std::map<QDateTime, std::set<RifWellRftAddress>> adjacentTimeSteps(const std::vector<std::pair<QDateTime, std::set<RifWellRftAddress>>>& allTimeSteps,
|
|
|
|
const std::pair<QDateTime, std::set<RifWellRftAddress>>& searchTimeStepPair);
|
|
|
|
static bool mapContainsTimeStep(const std::map<QDateTime, std::set<RifWellRftAddress>>& map, const QDateTime& timeStep);
|
|
|
|
|
|
|
|
std::set<std::pair<RifWellRftAddress, QDateTime>> selectedCurveDefs() const;
|
|
|
|
std::set<std::pair<RifWellRftAddress, QDateTime>> curveDefsFromCurves() const;
|
|
|
|
std::pair<RifWellRftAddress, QDateTime> curveDefFromCurve(const RimWellLogCurve* curve) const;
|
|
|
|
void updateCurvesInPlot(const std::set<std::pair<RifWellRftAddress, QDateTime>>& allCurveDefs,
|
|
|
|
const std::set<std::pair<RifWellRftAddress, QDateTime>>& curveDefsToAdd,
|
2017-10-05 03:54:52 -05:00
|
|
|
const std::set<RimWellLogCurve*>& curvesToDelete);
|
2017-10-13 07:32:26 -05:00
|
|
|
bool isOnlyGridSourcesSelected() const;
|
2017-10-26 03:35:23 -05:00
|
|
|
bool isAnySourceAddressSelected(const std::set<RifWellRftAddress>& addresses) const;
|
|
|
|
std::vector<RifWellRftAddress> selectedSources() const;
|
2017-10-13 07:32:26 -05:00
|
|
|
|
2017-09-27 05:39:28 -05:00
|
|
|
// RimViewWindow overrides
|
|
|
|
|
|
|
|
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
|
|
|
virtual void deleteViewWidget() override;
|
|
|
|
|
2017-10-09 03:51:07 -05:00
|
|
|
void applyCurveAppearance(RimWellLogCurve* newCurve);
|
2017-10-17 06:35:12 -05:00
|
|
|
void updateSelectedTimeStepsFromSelectedSources();
|
2017-10-09 03:51:07 -05:00
|
|
|
|
2017-09-27 05:39:28 -05:00
|
|
|
private:
|
|
|
|
caf::PdmField<bool> m_showPlotTitle;
|
|
|
|
caf::PdmField<QString> m_userName;
|
|
|
|
|
|
|
|
caf::PdmField<QString> m_wellName;
|
2017-10-05 09:25:04 -05:00
|
|
|
caf::PdmField<int> m_branchIndex;
|
2017-10-26 03:35:23 -05:00
|
|
|
caf::PdmField<std::vector<RifWellRftAddress>> m_selectedSources;
|
2017-10-03 01:19:38 -05:00
|
|
|
|
2017-10-03 06:54:07 -05:00
|
|
|
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-09-27 07:05:14 -05:00
|
|
|
QPointer<RiuWellRftPlot> m_wellLogPlotWidget;
|
2017-09-27 05:39:28 -05:00
|
|
|
|
2017-09-27 07:05:14 -05:00
|
|
|
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot;
|
2017-10-13 07:32:26 -05:00
|
|
|
|
2017-10-26 03:35:23 -05:00
|
|
|
std::map<QDateTime, std::set<RifWellRftAddress>> m_timeStepsToAddresses;
|
2017-10-19 09:12:22 -05:00
|
|
|
|
|
|
|
bool m_selectedSourcesOrTimeStepsFieldsChanged;
|
2017-09-27 05:39:28 -05:00
|
|
|
};
|