mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'origin/dev' into pre-proto
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -23,10 +23,21 @@
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
|
||||
#include "RicEclipsePropertyFilterFeatureImpl.h"
|
||||
#include "RicSelectOrCreateViewFeatureImpl.h"
|
||||
|
||||
#include "RiuFlowCharacteristicsPlot.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
@@ -35,13 +46,13 @@
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void AppEnum< RimFlowCharacteristicsPlot::TimeSelectionType >::setUp()
|
||||
{
|
||||
addItem(RimFlowCharacteristicsPlot::ALL_AVAILABLE, "ALL_AVAILABLE", "All available");
|
||||
addItem(RimFlowCharacteristicsPlot::SELECT_AVAILABLE, "SELECT_AVAILABLE", "Select");
|
||||
setDefault(RimFlowCharacteristicsPlot::ALL_AVAILABLE);
|
||||
}
|
||||
template<>
|
||||
void AppEnum< RimFlowCharacteristicsPlot::TimeSelectionType >::setUp()
|
||||
{
|
||||
addItem(RimFlowCharacteristicsPlot::ALL_AVAILABLE, "ALL_AVAILABLE", "All available");
|
||||
addItem(RimFlowCharacteristicsPlot::SELECT_AVAILABLE, "SELECT_AVAILABLE", "Select");
|
||||
setDefault(RimFlowCharacteristicsPlot::ALL_AVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimFlowCharacteristicsPlot, "FlowCharacteristicsPlot");
|
||||
@@ -60,10 +71,28 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_applyTimeSteps, "ApplyTimeSteps", "", "", "", "");
|
||||
m_applyTimeSteps.xmlCapability()->setIOWritable(false);
|
||||
m_applyTimeSteps.xmlCapability()->setIOReadable(false);
|
||||
m_applyTimeSteps.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
|
||||
m_applyTimeSteps.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
CAF_PDM_InitField(&m_maxPvFraction, "CellPVThreshold", 0.1, "Aquifer Cell Threshold", "", "Exclude Aquifer Effects by adding a Cell Pore Volume Threshold as Fraction of Total Pore Volume.", "");
|
||||
|
||||
|
||||
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Legend", "", "", "");
|
||||
|
||||
// Region group
|
||||
CAF_PDM_InitFieldNoDefault(&m_cellSelection, "CellSelection", "Cell Selection", "", "", "");
|
||||
CAF_PDM_InitField(&m_tracerFilter, "TracerFilter", QString(), "Filter", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedTracerNames, "SelectedTracerNames", " ", "", "", "");
|
||||
m_selectedTracerNames.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
CAF_PDM_InitFieldNoDefault(&m_showRegion, "ShowRegion", "", "", "", "");
|
||||
m_showRegion.xmlCapability()->setIOWritable(false);
|
||||
m_showRegion.xmlCapability()->setIOReadable(false);
|
||||
m_showRegion.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
|
||||
m_showRegion.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
|
||||
this->m_showWindow = false;
|
||||
setAsPlotMdiWindow();
|
||||
}
|
||||
@@ -173,14 +202,66 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
|
||||
{
|
||||
if ( m_flowDiagSolution )
|
||||
{
|
||||
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
|
||||
|
||||
QStringList timeStepDates = m_case->timeStepStrings();
|
||||
|
||||
for ( int tsIdx : calculatedTimesteps )
|
||||
std::vector<int> calculatedTimeSteps = m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
|
||||
for (int tsIdx = 0; tsIdx < timeStepDates.size(); ++tsIdx)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(timeStepDates[tsIdx], tsIdx));
|
||||
auto it = std::find(calculatedTimeSteps.begin(), calculatedTimeSteps.end(), tsIdx);
|
||||
QString itemText = timeStepDates[tsIdx];
|
||||
if (it == calculatedTimeSteps.end())
|
||||
{
|
||||
itemText = itemText + " *";
|
||||
}
|
||||
options.push_back(caf::PdmOptionItemInfo(itemText, tsIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_selectedTracerNames)
|
||||
{
|
||||
if (m_flowDiagSolution)
|
||||
{
|
||||
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
|
||||
for (QString tracerName : tracerNames)
|
||||
{
|
||||
if (!caf::Utils::isStringMatch(m_tracerFilter, tracerName)) continue;
|
||||
|
||||
RimFlowDiagSolution::TracerStatusType tracerStatus = m_flowDiagSolution->tracerStatusOverall(tracerName);
|
||||
if (tracerStatus == RimFlowDiagSolution::CLOSED) continue;
|
||||
|
||||
if (m_cellSelection() == RigFlowDiagResults::CELLS_FLOODED)
|
||||
{
|
||||
if (tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::VARYING)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(tracerName, tracerName));
|
||||
}
|
||||
}
|
||||
else if (m_cellSelection() == RigFlowDiagResults::CELLS_DRAINED)
|
||||
{
|
||||
if (tracerStatus == RimFlowDiagSolution::PRODUCER || tracerStatus == RimFlowDiagSolution::VARYING)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(tracerName, tracerName));
|
||||
}
|
||||
}
|
||||
else if (m_cellSelection() == RigFlowDiagResults::CELLS_COMMUNICATION)
|
||||
{
|
||||
QString prefix;
|
||||
switch (tracerStatus)
|
||||
{
|
||||
case RimFlowDiagSolution::INJECTOR:
|
||||
prefix = "I : ";
|
||||
break;
|
||||
case RimFlowDiagSolution::PRODUCER:
|
||||
prefix = "P : ";
|
||||
break;
|
||||
case RimFlowDiagSolution::VARYING:
|
||||
prefix = "I/P: ";
|
||||
break;
|
||||
case RimFlowDiagSolution::UNDEFINED:
|
||||
prefix = "U : ";
|
||||
break;
|
||||
}
|
||||
options.push_back(caf::PdmOptionItemInfo(prefix + tracerName, tracerName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -198,14 +279,52 @@ void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::Pdm
|
||||
uiOrdering.add(&m_flowDiagSolution);
|
||||
uiOrdering.add(&m_timeStepSelectionType);
|
||||
|
||||
if (m_timeStepSelectionType == SELECT_AVAILABLE) uiOrdering.add(&m_selectedTimeSteps);
|
||||
if (m_timeStepSelectionType == SELECT_AVAILABLE)
|
||||
{
|
||||
uiOrdering.add(&m_selectedTimeSteps);
|
||||
uiOrdering.add(&m_applyTimeSteps);
|
||||
}
|
||||
|
||||
uiOrdering.add(&m_showLegend);
|
||||
uiOrdering.add(&m_maxPvFraction);
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* regionGroup = uiOrdering.addNewGroup("Region");
|
||||
regionGroup->add(&m_cellSelection);
|
||||
if (m_cellSelection() != RigFlowDiagResults::CELLS_ACTIVE)
|
||||
{
|
||||
regionGroup->add(&m_tracerFilter);
|
||||
regionGroup->add(&m_selectedTracerNames);
|
||||
}
|
||||
regionGroup->add(&m_showRegion);
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (field == &m_applyTimeSteps)
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>(attribute);
|
||||
if (attrib)
|
||||
{
|
||||
attrib->m_buttonText = "Apply";
|
||||
}
|
||||
}
|
||||
else if (field == &m_showRegion)
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>(attribute);
|
||||
if (attrib)
|
||||
{
|
||||
attrib->m_buttonText = "Show Region";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -234,6 +353,81 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
m_currentlyPlottedTimeSteps.clear();
|
||||
}
|
||||
else if (&m_applyTimeSteps == changedField)
|
||||
{
|
||||
if (m_flowDiagSolution)
|
||||
{
|
||||
// Compute any missing time steps from selected
|
||||
for (int tsIdx : m_selectedTimeSteps())
|
||||
{
|
||||
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux(tsIdx);
|
||||
}
|
||||
}
|
||||
m_applyTimeSteps = false;
|
||||
}
|
||||
else if (&m_showRegion == changedField)
|
||||
{
|
||||
if (m_case)
|
||||
{
|
||||
if (m_cellSelection() != RigFlowDiagResults::CELLS_ACTIVE)
|
||||
{
|
||||
RimEclipseView* view = RicSelectOrCreateViewFeatureImpl::showViewSelection(m_case, "FlowCharacteristicsLastUsedView", "Show Region in View");
|
||||
|
||||
view->cellResult()->setResultType(RiaDefines::FLOW_DIAGNOSTICS);
|
||||
view->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_BY_SELECTION);
|
||||
view->cellResult()->setSelectedTracers(m_selectedTracerNames);
|
||||
|
||||
if (m_cellSelection() == RigFlowDiagResults::CELLS_COMMUNICATION)
|
||||
{
|
||||
view->cellResult()->setResultVariable(RIG_FLD_COMMUNICATION_RESNAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
view->cellResult()->setResultVariable(RIG_FLD_TOF_RESNAME);
|
||||
}
|
||||
|
||||
int timeStep = 0;
|
||||
if (m_timeStepSelectionType() == ALL_AVAILABLE)
|
||||
{
|
||||
if (m_flowDiagSolution)
|
||||
{
|
||||
std::vector<int> timeSteps = m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
|
||||
if (!timeSteps.empty())
|
||||
{
|
||||
timeStep = timeSteps[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_selectedTimeSteps().empty())
|
||||
{
|
||||
timeStep = m_selectedTimeSteps()[0];
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure selected time step has computed results
|
||||
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux(timeStep);
|
||||
|
||||
view->setCurrentTimeStep(timeStep);
|
||||
|
||||
for (RimEclipsePropertyFilter* f : view->eclipsePropertyFilterCollection()->propertyFilters())
|
||||
{
|
||||
f->isActive = false;
|
||||
}
|
||||
RicEclipsePropertyFilterFeatureImpl::addPropertyFilter(view->eclipsePropertyFilterCollection());
|
||||
|
||||
view->loadDataAndUpdate();
|
||||
m_case->updateConnectedEditors();
|
||||
|
||||
RicSelectOrCreateViewFeatureImpl::focusView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (changedField == &m_cellSelection)
|
||||
{
|
||||
m_selectedTracerNames = std::vector<QString>();
|
||||
}
|
||||
|
||||
// All fields update plot
|
||||
|
||||
@@ -290,16 +484,25 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
|
||||
|
||||
m_flowCharPlotWidget->removeAllCurves();
|
||||
|
||||
std::vector<QString> selectedTracerNames = m_selectedTracerNames();
|
||||
if (m_cellSelection() == RigFlowDiagResults::CELLS_ACTIVE)
|
||||
{
|
||||
if (m_flowDiagSolution)
|
||||
{
|
||||
selectedTracerNames = m_flowDiagSolution->tracerNames();
|
||||
}
|
||||
}
|
||||
|
||||
for ( int timeStepIdx: calculatedTimesteps )
|
||||
{
|
||||
lorenzVals[timeStepIdx] = flowResult->flowCharacteristicsResults(timeStepIdx, m_maxPvFraction()).m_lorenzCoefficient;
|
||||
lorenzVals[timeStepIdx] = flowResult->flowCharacteristicsResults(timeStepIdx, m_cellSelection(), selectedTracerNames, m_maxPvFraction()).m_lorenzCoefficient;
|
||||
}
|
||||
m_flowCharPlotWidget->setLorenzCurve(timeStepStrings, timeStepDates, lorenzVals);
|
||||
|
||||
for ( int timeStepIdx: calculatedTimesteps )
|
||||
{
|
||||
|
||||
const auto flowCharResults = flowResult->flowCharacteristicsResults(timeStepIdx, m_maxPvFraction());
|
||||
const auto flowCharResults = flowResult->flowCharacteristicsResults(timeStepIdx, m_cellSelection(), selectedTracerNames, m_maxPvFraction());
|
||||
m_flowCharPlotWidget->addFlowCapStorageCapCurve(timeStepDates[timeStepIdx],
|
||||
flowCharResults.m_flowCapStorageCapCurve.first,
|
||||
flowCharResults.m_flowCapStorageCapCurve.second);
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include "RigFlowDiagResults.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
@@ -62,22 +64,24 @@ public:
|
||||
virtual void zoomAll() override;
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
virtual void deleteViewWidget() override;
|
||||
virtual void loadDataAndUpdate() override;
|
||||
|
||||
enum TimeSelectionType
|
||||
{
|
||||
ALL_AVAILABLE,
|
||||
SELECT_AVAILABLE
|
||||
};
|
||||
|
||||
protected:
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual void loadDataAndUpdate() override;
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
|
||||
// Overridden PDM methods
|
||||
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 defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute );
|
||||
|
||||
private:
|
||||
|
||||
@@ -86,9 +90,15 @@ private:
|
||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
|
||||
caf::PdmField<caf::AppEnum<TimeSelectionType> > m_timeStepSelectionType;
|
||||
caf::PdmField<std::vector<int> > m_selectedTimeSteps;
|
||||
caf::PdmField<bool> m_applyTimeSteps;
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
caf::PdmField<double> m_maxPvFraction;
|
||||
|
||||
caf::PdmField<RigFlowDiagResults::CellSelectionEnum> m_cellSelection;
|
||||
caf::PdmField<QString> m_tracerFilter;
|
||||
caf::PdmField< std::vector<QString> > m_selectedTracerNames;
|
||||
caf::PdmField<bool> m_showRegion;
|
||||
|
||||
std::vector<int> m_currentlyPlottedTimeSteps;
|
||||
|
||||
QPointer<RiuFlowCharacteristicsPlot> m_flowCharPlotWidget;
|
||||
|
||||
@@ -40,7 +40,8 @@ RimFlowPlotCollection::RimFlowPlotCollection()
|
||||
CAF_PDM_InitFieldNoDefault(&m_defaultWellAllocPlot, "DefaultWellAllocationPlot", "", "", "", "");
|
||||
m_defaultWellAllocPlot.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_storedWellAllocPlots, "StoredWellAllocationPlots", "Stored Plots", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_storedWellAllocPlots, "StoredWellAllocationPlots", "Stored Well Allocation Plots", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_storedFlowCharacteristicsPlots, "StoredFlowCharacteristicsPlots", "Stored Flow Characteristics Plots", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -67,6 +68,7 @@ void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||
delete m_flowCharacteristicsPlot;
|
||||
|
||||
m_storedWellAllocPlots.deleteAllChildObjects();
|
||||
m_storedFlowCharacteristicsPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -74,7 +76,7 @@ void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::loadDataAndUpdate()
|
||||
{
|
||||
caf::ProgressInfo plotProgress(m_storedWellAllocPlots.size() + 1, "");
|
||||
caf::ProgressInfo plotProgress(m_storedWellAllocPlots.size() + m_storedFlowCharacteristicsPlots.size() + 1, "");
|
||||
|
||||
if (m_defaultWellAllocPlot) m_defaultWellAllocPlot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
@@ -84,6 +86,12 @@ void RimFlowPlotCollection::loadDataAndUpdate()
|
||||
p->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
|
||||
for (RimFlowCharacteristicsPlot* p : m_storedFlowCharacteristicsPlots)
|
||||
{
|
||||
p->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -94,6 +102,7 @@ size_t RimFlowPlotCollection::plotCount() const
|
||||
size_t plotCount = 0;
|
||||
if (m_defaultWellAllocPlot) plotCount = 1;
|
||||
plotCount += m_storedWellAllocPlots.size();
|
||||
plotCount += m_storedFlowCharacteristicsPlots.size();
|
||||
return plotCount;
|
||||
}
|
||||
|
||||
@@ -105,6 +114,14 @@ void RimFlowPlotCollection::addWellAllocPlotToStoredPlots(RimWellAllocationPlot*
|
||||
m_storedWellAllocPlots.push_back(plot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::addFlowCharacteristicsPlotToStoredPlots(RimFlowCharacteristicsPlot* plot)
|
||||
{
|
||||
m_storedFlowCharacteristicsPlots.push_back(plot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
size_t plotCount() const;
|
||||
|
||||
void addWellAllocPlotToStoredPlots(RimWellAllocationPlot* plot);
|
||||
void addFlowCharacteristicsPlotToStoredPlots(RimFlowCharacteristicsPlot* plot);
|
||||
RimWellAllocationPlot* defaultWellAllocPlot();
|
||||
RimFlowCharacteristicsPlot* defaultFlowCharacteristicsPlot();
|
||||
|
||||
@@ -48,4 +49,5 @@ private:
|
||||
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
|
||||
caf::PdmChildField<RimWellAllocationPlot*> m_defaultWellAllocPlot;
|
||||
caf::PdmChildArrayField<RimWellAllocationPlot*> m_storedWellAllocPlots;
|
||||
caf::PdmChildArrayField<RimFlowCharacteristicsPlot*> m_storedFlowCharacteristicsPlots;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 && m_showWindow())
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -189,7 +189,7 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf
|
||||
varList = m_reservoirView->currentGridCellResults()->cellResults()->resultNames(RiaDefines::STATIC_NATIVE);
|
||||
|
||||
//TODO: Must also handle input properties
|
||||
//varList += m_reservoirView->gridCellResults()->resultNames(RiaEclipseUnitTools::INPUT_PROPERTY);
|
||||
//varList += m_reservoirView->gridCellResults()->resultNames(RiaDefines::INPUT_PROPERTY);
|
||||
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "RimFault.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimFormationNames.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
@@ -359,6 +360,10 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicAddStoredWellAllocationPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFlowCharacteristicsPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddStoredFlowCharacteristicsPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFlowDiagSolution*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowFlowCharacteristicsPlotFeature";
|
||||
@@ -447,6 +452,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicReloadCaseFeature";
|
||||
commandIds << "RicExecuteScriptForCasesFeature";
|
||||
commandIds << "RicCloseSourSimDataFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryPlot*>(uiItem))
|
||||
{
|
||||
|
||||
@@ -601,7 +601,22 @@ bool RimEclipseCase::openReserviorCase()
|
||||
size_t combinedTransResIdx = results->cellResults()->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName());
|
||||
if (combinedTransResIdx != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
eclipseCaseData()->mainGrid()->nncData()->setCombTransmissibilityScalarResultIndex(combinedTransResIdx);
|
||||
eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameCombTrans(), combinedTransResIdx);
|
||||
}
|
||||
size_t combinedWatFluxResIdx = results->cellResults()->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::combinedWaterFluxResultName());
|
||||
if (combinedWatFluxResIdx != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameFluxWat(), combinedWatFluxResIdx);
|
||||
}
|
||||
size_t combinedOilFluxResIdx = results->cellResults()->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::combinedOilFluxResultName());
|
||||
if (combinedOilFluxResIdx != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameFluxOil(), combinedOilFluxResIdx);
|
||||
}
|
||||
size_t combinedGasFluxResIdx = results->cellResults()->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::combinedGasFluxResultName());
|
||||
if (combinedGasFluxResIdx != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
eclipseCaseData()->mainGrid()->nncData()->setScalarResultIndex(RigNNCData::propertyNameFluxGas(), combinedGasFluxResIdx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,11 @@
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimTimeStepFilter.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
|
||||
#include "cafPdmSettings.h"
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cafUtils.h"
|
||||
@@ -75,7 +78,11 @@ RimEclipseResultCase::RimEclipseResultCase()
|
||||
flipYAxis.xmlCapability()->setIOWritable(true);
|
||||
//flipYAxis.uiCapability()->setUiHidden(true);
|
||||
|
||||
|
||||
CAF_PDM_InitField(&m_sourSimFileName, "SourSimFileName", QString(), "SourSim File Name", "", "", "");
|
||||
m_sourSimFileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
#ifndef USE_HDF5
|
||||
m_sourSimFileName.uiCapability()->setUiHidden(true);
|
||||
#endif
|
||||
|
||||
m_activeCellInfoIsReadFromFile = false;
|
||||
m_gridAndWellDataIsReadFromFile = false;
|
||||
@@ -148,6 +155,12 @@ bool RimEclipseResultCase::openEclipseGridFile()
|
||||
{
|
||||
m_flowDiagSolutions.push_back(new RimFlowDiagSolution());
|
||||
}
|
||||
|
||||
if (!m_sourSimFileName().isEmpty())
|
||||
{
|
||||
RifReaderEclipseOutput* outReader = dynamic_cast<RifReaderEclipseOutput*>(readerInterface.p());
|
||||
outReader->setHdf5FileName(m_sourSimFileName());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -220,6 +233,39 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::loadAndUpdateSourSimData()
|
||||
{
|
||||
if (!results(RiaDefines::MATRIX_MODEL)) return;
|
||||
|
||||
RifReaderEclipseOutput* rifReaderOutput = dynamic_cast<RifReaderEclipseOutput*>(results(RiaDefines::MATRIX_MODEL)->readerInterface());
|
||||
if (rifReaderOutput)
|
||||
{
|
||||
rifReaderOutput->setHdf5FileName(m_sourSimFileName);
|
||||
}
|
||||
|
||||
if (!hasSourSimFile())
|
||||
{
|
||||
// Deselect SourSimRL cell results
|
||||
for (RimView* view : views())
|
||||
{
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view);
|
||||
if (eclipseView != nullptr)
|
||||
{
|
||||
if (eclipseView->cellResult()->resultType() == RiaDefines::SOURSIMRL)
|
||||
{
|
||||
eclipseView->cellResult()->setResultType(RiaDefines::DYNAMIC_NATIVE);
|
||||
eclipseView->cellResult()->setResultVariable("SOIL");
|
||||
eclipseView->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -435,6 +481,24 @@ void RimEclipseResultCase::setCaseInfo(const QString& userDescription, const QSt
|
||||
proj->assignCaseIdToCase(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::setSourSimFileName(const QString& fileName)
|
||||
{
|
||||
m_sourSimFileName = fileName;
|
||||
|
||||
loadAndUpdateSourSimData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultCase::hasSourSimFile()
|
||||
{
|
||||
return !m_sourSimFileName().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -471,3 +535,31 @@ void RimEclipseResultCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrde
|
||||
m_timeStepFilter->uiOrdering(uiConfigName, *group1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_sourSimFileName)
|
||||
{
|
||||
loadAndUpdateSourSimData();
|
||||
}
|
||||
|
||||
return RimEclipseCase::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (field == &m_sourSimFileName)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_fileSelectionFilter = "SourSim (*.sourres)";
|
||||
myAttr->m_defaultPath = QFileInfo(caseFileName()).absolutePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
|
||||
void setGridFileName(const QString& caseFileName);
|
||||
void setCaseInfo(const QString& userDescription, const QString& caseFileName);
|
||||
void setSourSimFileName(const QString& fileName);
|
||||
bool hasSourSimFile();
|
||||
|
||||
virtual bool openEclipseGridFile();
|
||||
virtual void reloadEclipseGridFile();
|
||||
@@ -57,6 +59,13 @@ public:
|
||||
std::vector<RimFlowDiagSolution*> flowDiagSolutions();
|
||||
RigFlowDiagSolverInterface* flowDiagSolverInterface();
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
|
||||
private:
|
||||
void loadAndUpdateSourSimData();
|
||||
|
||||
private:
|
||||
cvf::ref<RifReaderInterface> createMockModel(QString modelName);
|
||||
|
||||
@@ -69,6 +78,7 @@ private:
|
||||
// Fields:
|
||||
caf::PdmField<QString> caseFileName;
|
||||
caf::PdmChildArrayField<RimFlowDiagSolution*> m_flowDiagSolutions;
|
||||
caf::PdmField<QString> m_sourSimFileName;
|
||||
|
||||
|
||||
// Obsolete field
|
||||
@@ -76,4 +86,5 @@ private:
|
||||
|
||||
bool m_gridAndWellDataIsReadFromFile;
|
||||
bool m_activeCellInfoIsReadFromFile;
|
||||
|
||||
};
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@@ -404,19 +405,6 @@ void RimEclipseResultDefinition::loadDataAndUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
bool isStringMatch(const QString& filterString, const QString& value)
|
||||
{
|
||||
if (filterString.isEmpty()) return true;
|
||||
if (filterString.trimmed() == "*")
|
||||
{
|
||||
if (!value.isEmpty()) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
QRegExp searcher(filterString, Qt::CaseInsensitive, QRegExp::WildcardUnix);
|
||||
return searcher.exactMatch(value);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -426,27 +414,47 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
|
||||
if ( fieldNeedingOptions == &m_resultTypeUiField )
|
||||
{
|
||||
bool hasSourSimRLFile = false;
|
||||
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
|
||||
if ( eclResCase && eclResCase->eclipseCaseData() )
|
||||
{
|
||||
hasSourSimRLFile = eclResCase->hasSourSimFile();
|
||||
}
|
||||
|
||||
#ifndef USE_HDF5
|
||||
// If using ResInsight without HDF5 support, ignore SourSim files and
|
||||
// do not show it as a result category.
|
||||
hasSourSimRLFile = false;
|
||||
#endif
|
||||
|
||||
|
||||
RimGridTimeHistoryCurve* timeHistoryCurve;
|
||||
this->firstAncestorOrThisOfType(timeHistoryCurve);
|
||||
|
||||
// Do not include flow diagnostics results if not available or is a time history curve
|
||||
if ( timeHistoryCurve != nullptr )
|
||||
// Do not include flow diagnostics results if it is a time history curve
|
||||
// Do not include SourSimRL if no SourSim file is loaded
|
||||
if ( timeHistoryCurve != nullptr || !hasSourSimRLFile )
|
||||
{
|
||||
using ResCatEnum = caf::AppEnum< RiaDefines::ResultCatType >;
|
||||
for ( size_t i = 0; i < ResCatEnum::size(); ++i )
|
||||
{
|
||||
RiaDefines::ResultCatType resType = ResCatEnum::fromIndex(i);
|
||||
if ( resType != RiaDefines::FLOW_DIAGNOSTICS )
|
||||
if ( resType == RiaDefines::FLOW_DIAGNOSTICS
|
||||
&& (timeHistoryCurve) )
|
||||
{
|
||||
QString uiString = ResCatEnum::uiTextFromIndex(i);
|
||||
options.push_back(caf::PdmOptionItemInfo(uiString, resType));
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( resType == RiaDefines::SOURSIMRL
|
||||
&& (!hasSourSimRLFile ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QString uiString = ResCatEnum::uiTextFromIndex(i);
|
||||
options.push_back(caf::PdmOptionItemInfo(uiString, resType));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do nothing, and thereby use the defaults of the AppEnum field
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_resultTypeUiField() != RiaDefines::FLOW_DIAGNOSTICS )
|
||||
@@ -460,10 +468,13 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
{
|
||||
if ( fieldNeedingOptions == &m_resultVariableUiField )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("Time Of Flight (Average)", RIG_FLD_TOF_RESNAME));
|
||||
options.push_back(caf::PdmOptionItemInfo("Tracer Cell Fraction (Sum)", RIG_FLD_CELL_FRACTION_RESNAME));
|
||||
options.push_back(caf::PdmOptionItemInfo("Max Fraction Tracer", RIG_FLD_MAX_FRACTION_TRACER_RESNAME));
|
||||
options.push_back(caf::PdmOptionItemInfo("Injector Producer Communication", RIG_FLD_COMMUNICATION_RESNAME));
|
||||
options.push_back(caf::PdmOptionItemInfo("Time Of Flight (Average)", RIG_FLD_TOF_RESNAME));
|
||||
if (m_phaseSelection() == RigFlowDiagResultAddress::PHASE_ALL)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("Tracer Cell Fraction (Sum)", RIG_FLD_CELL_FRACTION_RESNAME));
|
||||
options.push_back(caf::PdmOptionItemInfo("Max Fraction Tracer", RIG_FLD_MAX_FRACTION_TRACER_RESNAME));
|
||||
options.push_back(caf::PdmOptionItemInfo("Injector Producer Communication", RIG_FLD_COMMUNICATION_RESNAME));
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_flowSolutionUiField)
|
||||
{
|
||||
@@ -855,6 +866,10 @@ bool RimEclipseResultDefinition::hasDynamicResult() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (m_resultType() == RiaDefines::SOURSIMRL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (m_resultType() == RiaDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
return true;
|
||||
@@ -1097,7 +1112,7 @@ std::vector<QString> RimEclipseResultDefinition::tracerNamesMatchingFilter() con
|
||||
{
|
||||
for (const QString& tracerName : tracerNames)
|
||||
{
|
||||
if (isStringMatch(m_selectedTracersUiFieldFilter, tracerName))
|
||||
if (caf::Utils::isStringMatch(m_selectedTracersUiFieldFilter, tracerName))
|
||||
{
|
||||
matchingNames.push_back(tracerName);
|
||||
}
|
||||
|
||||
@@ -95,6 +95,7 @@ public:
|
||||
void updateAnyFieldHasChanged();
|
||||
|
||||
void setTofAndSelectTracer(const QString& tracerName);
|
||||
void setSelectedTracers(const std::vector<QString>& selectedTracers);
|
||||
|
||||
|
||||
protected:
|
||||
@@ -135,7 +136,6 @@ protected:
|
||||
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
|
||||
|
||||
private:
|
||||
void setSelectedTracers(const std::vector<QString>& selectedTracers);
|
||||
void assignFlowSolutionFromCase();
|
||||
|
||||
bool hasDualPorFractureResult();
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QUuid>
|
||||
#include "RifReaderEclipseOutput.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimReservoirCellResultsStorage, "ReservoirCellResultStorage");
|
||||
|
||||
@@ -243,6 +244,11 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(const QString& res
|
||||
scalarResultIndex = this->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, resultName);
|
||||
}
|
||||
|
||||
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
scalarResultIndex = this->findOrLoadScalarResult(RiaDefines::SOURSIMRL, resultName);
|
||||
}
|
||||
|
||||
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
scalarResultIndex = m_cellResults->findScalarResultIndex(RiaDefines::GENERATED, resultName);
|
||||
@@ -335,6 +341,27 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RiaDefines::Result
|
||||
computeRiTRANSbyAreaComponent(resultName);
|
||||
}
|
||||
}
|
||||
else if (type == RiaDefines::DYNAMIC_NATIVE)
|
||||
{
|
||||
if (resultName == RiaDefines::combinedWaterFluxResultName())
|
||||
{
|
||||
this->findOrLoadScalarResult(type, "FLRWATI+");
|
||||
this->findOrLoadScalarResult(type, "FLRWATJ+");
|
||||
this->findOrLoadScalarResult(type, "FLRWATK+");
|
||||
}
|
||||
else if (resultName == RiaDefines::combinedOilFluxResultName())
|
||||
{
|
||||
this->findOrLoadScalarResult(type, "FLROILI+");
|
||||
this->findOrLoadScalarResult(type, "FLROILJ+");
|
||||
this->findOrLoadScalarResult(type, "FLROILK+");
|
||||
}
|
||||
else if (resultName == RiaDefines::combinedGasFluxResultName())
|
||||
{
|
||||
this->findOrLoadScalarResult(type, "FLRGASI+");
|
||||
this->findOrLoadScalarResult(type, "FLRGASJ+");
|
||||
this->findOrLoadScalarResult(type, "FLRGASK+");
|
||||
}
|
||||
}
|
||||
|
||||
if (isDataPresent(scalarResultIndex))
|
||||
{
|
||||
@@ -417,6 +444,26 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RiaDefines::Result
|
||||
}
|
||||
}
|
||||
|
||||
// Handle SourSimRL reading
|
||||
|
||||
if (type == RiaDefines::SOURSIMRL)
|
||||
{
|
||||
RifReaderEclipseOutput* eclReader = dynamic_cast<RifReaderEclipseOutput*>(m_readerInterface.p());
|
||||
if (eclReader)
|
||||
{
|
||||
size_t timeStepCount = m_cellResults->infoForEachResultIndex()[scalarResultIndex].m_timeStepInfos.size();
|
||||
|
||||
m_cellResults->cellScalarResults(scalarResultIndex).resize(timeStepCount);
|
||||
|
||||
size_t i;
|
||||
for ( i = 0; i < timeStepCount; i++ )
|
||||
{
|
||||
std::vector<double>& values = m_cellResults->cellScalarResults(scalarResultIndex)[i];
|
||||
eclReader->sourSimRlResult(resultName, i, &values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return scalarResultIndex;
|
||||
}
|
||||
|
||||
@@ -498,6 +545,26 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResultForTimeStep(RiaDefi
|
||||
}
|
||||
}
|
||||
|
||||
// Handle SourSimRL reading
|
||||
|
||||
if (type == RiaDefines::SOURSIMRL)
|
||||
{
|
||||
RifReaderEclipseOutput* eclReader = dynamic_cast<RifReaderEclipseOutput*>(m_readerInterface.p());
|
||||
if (eclReader)
|
||||
{
|
||||
size_t timeStepCount = m_cellResults->infoForEachResultIndex()[scalarResultIndex].m_timeStepInfos.size();
|
||||
|
||||
m_cellResults->cellScalarResults(scalarResultIndex).resize(timeStepCount);
|
||||
|
||||
std::vector<double>& values = m_cellResults->cellScalarResults(scalarResultIndex)[timeStepIndex];
|
||||
|
||||
if ( values.size() == 0)
|
||||
{
|
||||
eclReader->sourSimRlResult(resultName, timeStepIndex, &values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return scalarResultIndex;
|
||||
|
||||
}
|
||||
@@ -992,7 +1059,7 @@ void RimReservoirCellResultsStorage::computeNncCombRiTrans()
|
||||
if (!m_cellResults) return;
|
||||
|
||||
size_t riCombTransScalarResultIndex = m_cellResults->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiTranResultName());
|
||||
if (m_ownerMainGrid->nncData()->connectionScalarResult(riCombTransScalarResultIndex)) return;
|
||||
if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransScalarResultIndex)) return;
|
||||
|
||||
double cdarchy = darchysValue();
|
||||
|
||||
@@ -1011,7 +1078,8 @@ void RimReservoirCellResultsStorage::computeNncCombRiTrans()
|
||||
std::vector<double> & permXResults = m_cellResults->cellScalarResults(permXResultIdx)[0];
|
||||
std::vector<double> & permYResults = m_cellResults->cellScalarResults(permYResultIdx)[0];
|
||||
std::vector<double> & permZResults = m_cellResults->cellScalarResults(permZResultIdx)[0];
|
||||
std::vector<double> & riCombTransResults = m_ownerMainGrid->nncData()->makeConnectionScalarResult(riCombTransScalarResultIndex);
|
||||
std::vector<double> & riCombTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTrans());
|
||||
m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTrans(), riCombTransScalarResultIndex);
|
||||
|
||||
std::vector<double> * ntgResults = NULL;
|
||||
if (hasNTGResults)
|
||||
@@ -1252,11 +1320,12 @@ void RimReservoirCellResultsStorage::computeNncCombRiMULT()
|
||||
size_t riCombTransScalarResultIndex = m_cellResults->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiTranResultName());
|
||||
size_t combTransScalarResultIndex = m_cellResults->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName());
|
||||
|
||||
if (m_ownerMainGrid->nncData()->connectionScalarResult(riCombMultScalarResultIndex)) return;
|
||||
if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombMultScalarResultIndex)) return;
|
||||
|
||||
std::vector<double> & riMultResults = m_ownerMainGrid->nncData()->makeConnectionScalarResult(riCombMultScalarResultIndex);
|
||||
const std::vector<double> * riTransResults = m_ownerMainGrid->nncData()->connectionScalarResult(riCombTransScalarResultIndex);
|
||||
const std::vector<double> * transResults = m_ownerMainGrid->nncData()->connectionScalarResult(combTransScalarResultIndex);
|
||||
std::vector<double> & riMultResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombMult());
|
||||
const std::vector<double> * riTransResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransScalarResultIndex);
|
||||
const std::vector<double> * transResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransScalarResultIndex);
|
||||
m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombMult(), riCombMultScalarResultIndex);
|
||||
|
||||
for (size_t nncConIdx = 0; nncConIdx < riMultResults.size(); ++nncConIdx)
|
||||
{
|
||||
@@ -1385,10 +1454,11 @@ void RimReservoirCellResultsStorage::computeNncCombRiTRANSbyArea()
|
||||
size_t riCombTransByAreaScResIdx = m_cellResults->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiAreaNormTranResultName());
|
||||
size_t combTransScalarResultIndex = m_cellResults->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName());
|
||||
|
||||
if (m_ownerMainGrid->nncData()->connectionScalarResult(riCombTransByAreaScResIdx)) return;
|
||||
if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransByAreaScResIdx)) return;
|
||||
|
||||
std::vector<double> & riAreaNormTransResults = m_ownerMainGrid->nncData()->makeConnectionScalarResult(riCombTransByAreaScResIdx);
|
||||
const std::vector<double> * transResults = m_ownerMainGrid->nncData()->connectionScalarResult(combTransScalarResultIndex);
|
||||
std::vector<double> & riAreaNormTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTransByArea());
|
||||
m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTransByArea(), riCombTransByAreaScResIdx);
|
||||
const std::vector<double> * transResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransScalarResultIndex);
|
||||
|
||||
const std::vector<RigConnection>& connections = m_ownerMainGrid->nncData()->connections();
|
||||
|
||||
@@ -1508,7 +1578,7 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
|
||||
{
|
||||
std::vector<double>* data = NULL;
|
||||
|
||||
data = &(m_cellResults->cellScalarResults(rIdx, tsIdx));
|
||||
data = &(m_cellResults->cellScalarResults(resultIndex, tsIdx));
|
||||
|
||||
quint64 cellCount = 0;
|
||||
stream >> cellCount;
|
||||
|
||||
@@ -5,6 +5,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RimAsciiDataCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFileSummaryCase.h
|
||||
${CEE_CURRENT_LIST_DIR}RimGridSummaryCase.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryCase.h
|
||||
@@ -22,6 +23,7 @@ ${CEE_CURRENT_LIST_DIR}RimSummaryYAxisProperties.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RimAsciiDataCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFileSummaryCase.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimGridSummaryCase.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryCase.cpp
|
||||
|
||||
258
ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp
Normal file
258
ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp
Normal file
@@ -0,0 +1,258 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimAsciiDataCurve.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RifReaderEclipseSummary.h"
|
||||
|
||||
#include "RigSummaryCaseData.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryFilter.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
|
||||
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include "qwt_date.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAsciiDataCurve, "AsciiDataCurve");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAsciiDataCurve::RimAsciiDataCurve()
|
||||
{
|
||||
CAF_PDM_InitObject("ASCII Data Curve", ":/SummaryCurve16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_plotAxis, "PlotAxis", "Axis", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_timeSteps, "TimeSteps", "Time Steps", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_values, "Values", "Values", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_title, "Title", "Title", "", "", "");
|
||||
|
||||
m_symbolSkipPixelDistance = 10.0f;
|
||||
m_curveThickness = 2;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAsciiDataCurve::~RimAsciiDataCurve()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimAsciiDataCurve::yValues() const
|
||||
{
|
||||
return m_values;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<time_t>& RimAsciiDataCurve::timeSteps() const
|
||||
{
|
||||
static std::vector<time_t> timeSteps;
|
||||
timeSteps.clear();
|
||||
|
||||
for (const QDateTime& dateTime : m_timeSteps())
|
||||
{
|
||||
timeSteps.push_back(dateTime.toTime_t());
|
||||
}
|
||||
|
||||
return timeSteps;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAsciiDataCurve::setYAxis(RiaDefines::PlotAxis plotAxis)
|
||||
{
|
||||
m_plotAxis = plotAxis;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::PlotAxis RimAsciiDataCurve::yAxis() const
|
||||
{
|
||||
return m_plotAxis();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimAsciiDataCurve::createCurveAutoName()
|
||||
{
|
||||
return m_title();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAsciiDataCurve::updateZoomInParentPlot()
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
|
||||
plot->updateZoomInQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAsciiDataCurve::onLoadDataAndUpdate()
|
||||
{
|
||||
this->RimPlotCurve::updateCurvePresentation();
|
||||
|
||||
if (isCurveVisible())
|
||||
{
|
||||
std::vector<time_t> dateTimes = this->timeSteps();
|
||||
std::vector<double> values = this->yValues();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
bool isLogCurve = plot->isLogarithmicScaleEnabled(this->yAxis());
|
||||
|
||||
if (dateTimes.size() > 0 && dateTimes.size() == values.size())
|
||||
{
|
||||
if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE)
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndValues(dateTimes, values, isLogCurve);
|
||||
}
|
||||
else
|
||||
{
|
||||
double timeScale = plot->timeAxisProperties()->fromTimeTToDisplayUnitScale();
|
||||
|
||||
std::vector<double> times;
|
||||
if ( dateTimes.size() )
|
||||
{
|
||||
time_t startDate = dateTimes[0];
|
||||
for ( time_t& date: dateTimes )
|
||||
{
|
||||
times.push_back(timeScale*(date - startDate));
|
||||
}
|
||||
}
|
||||
|
||||
m_qwtPlotCurve->setSamplesFromTimeAndValues(times, values, isLogCurve);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve);
|
||||
}
|
||||
|
||||
updateZoomInParentPlot();
|
||||
|
||||
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||
}
|
||||
|
||||
updateQwtPlotAxis();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAsciiDataCurve::updateQwtPlotAxis()
|
||||
{
|
||||
if (m_qwtPlotCurve)
|
||||
{
|
||||
if (this->yAxis() == RiaDefines::PLOT_AXIS_LEFT)
|
||||
{
|
||||
m_qwtPlotCurve->setYAxis(QwtPlot::yLeft);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setYAxis(QwtPlot::yRight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAsciiDataCurve::setTimeSteps(const std::vector<QDateTime>& timeSteps)
|
||||
{
|
||||
m_timeSteps = timeSteps;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAsciiDataCurve::setValues(const std::vector<double>& values)
|
||||
{
|
||||
m_values = values;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAsciiDataCurve::setTitle(const QString& title)
|
||||
{
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAsciiDataCurve::curveData(std::vector<QDateTime>* timeSteps, std::vector<double>* values) const
|
||||
{
|
||||
CVF_ASSERT(timeSteps && values);
|
||||
|
||||
*timeSteps = m_timeSteps();
|
||||
*values = m_values();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAsciiDataCurve::fieldChangedByUi(const caf::PdmFieldHandle * changedField, const QVariant & oldValue, const QVariant & newValue)
|
||||
{
|
||||
RimPlotCurve::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted(plot);
|
||||
|
||||
if (changedField == &m_plotAxis)
|
||||
{
|
||||
updateQwtPlotAxis();
|
||||
plot->updateAxes();
|
||||
}
|
||||
if (changedField == &m_showCurve)
|
||||
{
|
||||
plot->updateAxes();
|
||||
}
|
||||
}
|
||||
|
||||
84
ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.h
Normal file
84
ApplicationCode/ProjectDataModel/Summary/RimAsciiDataCurve.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RiaDefines.h"
|
||||
#include "RimPlotCurve.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
class RifReaderEclipseSummary;
|
||||
class RimSummaryCase;
|
||||
class RimSummaryFilter;
|
||||
class RiuLineSegmentQwtPlotCurve;
|
||||
class RimAsciiDataCurveAutoName;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAsciiDataCurve : public RimPlotCurve
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimAsciiDataCurve();
|
||||
virtual ~RimAsciiDataCurve();
|
||||
|
||||
std::vector<double> yValues() const;
|
||||
const std::vector<time_t>& timeSteps() const;
|
||||
|
||||
void setYAxis(RiaDefines::PlotAxis plotAxis);
|
||||
RiaDefines::PlotAxis yAxis() const;
|
||||
void updateQwtPlotAxis();
|
||||
|
||||
void setTimeSteps(const std::vector<QDateTime>& timeSteps);
|
||||
void setValues(const std::vector<double>& values);
|
||||
void setTitle(const QString& title);
|
||||
|
||||
protected:
|
||||
// RimPlotCurve overrides
|
||||
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void updateZoomInParentPlot() override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
bool curveData(std::vector<QDateTime>* timeSteps, std::vector<double>* values) const;
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
private:
|
||||
// Fields
|
||||
caf::PdmField< caf::AppEnum< RiaDefines::PlotAxis > > m_plotAxis;
|
||||
|
||||
caf::PdmField< std::vector<QDateTime> > m_timeSteps;
|
||||
caf::PdmField< std::vector<double> > m_values;
|
||||
caf::PdmField< QString > m_title;
|
||||
};
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryYAxisProperties.h"
|
||||
#include "RimAsciiDataCurve.h"
|
||||
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
@@ -98,10 +99,12 @@ public:
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotYAxisFormatter::RimSummaryPlotYAxisFormatter(RimSummaryYAxisProperties* axisProperties,
|
||||
const std::vector<RimSummaryCurve*>& curves,
|
||||
const std::vector<RimSummaryCurve*>& summaryCurves,
|
||||
const std::vector<RimAsciiDataCurve*>& asciiCurves,
|
||||
const std::set<QString>& timeHistoryCurveQuantities)
|
||||
: m_axisProperties(axisProperties),
|
||||
m_singleCurves(curves),
|
||||
m_summaryCurves(summaryCurves),
|
||||
m_asciiDataCurves(asciiCurves),
|
||||
m_timeHistoryCurveQuantities(timeHistoryCurveQuantities)
|
||||
{
|
||||
}
|
||||
@@ -193,7 +196,7 @@ QString RimSummaryPlotYAxisFormatter::autoAxisTitle() const
|
||||
{
|
||||
std::map<std::string, std::set<std::string> > unitToQuantityNameMap;
|
||||
|
||||
for ( RimSummaryCurve* rimCurve : m_singleCurves )
|
||||
for ( RimSummaryCurve* rimCurve : m_summaryCurves )
|
||||
{
|
||||
if ( rimCurve->yAxis() == this->m_axisProperties->plotAxisType() )
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
class RimAsciiDataCurve;
|
||||
class RimSummaryCurve;
|
||||
class RimSummaryCurveFilter;
|
||||
class RimSummaryYAxisProperties;
|
||||
@@ -34,7 +35,8 @@ class RimSummaryPlotYAxisFormatter
|
||||
{
|
||||
public:
|
||||
RimSummaryPlotYAxisFormatter(RimSummaryYAxisProperties* axisProperties,
|
||||
const std::vector<RimSummaryCurve*>& curves,
|
||||
const std::vector<RimSummaryCurve*>& summaryCurves,
|
||||
const std::vector<RimAsciiDataCurve*>& asciiCurves,
|
||||
const std::set<QString>& timeHistoryCurveQuantities);
|
||||
|
||||
void applyYAxisPropertiesToPlot(RiuSummaryQwtPlot* qwtPlot);
|
||||
@@ -43,9 +45,10 @@ private:
|
||||
QString autoAxisTitle() const;
|
||||
|
||||
private:
|
||||
RimSummaryYAxisProperties* m_axisProperties;
|
||||
const std::vector<RimSummaryCurve*> m_singleCurves;
|
||||
const std::set<QString> m_timeHistoryCurveQuantities;
|
||||
RimSummaryYAxisProperties* m_axisProperties;
|
||||
const std::vector<RimSummaryCurve*> m_summaryCurves;
|
||||
const std::vector<RimAsciiDataCurve*> m_asciiDataCurves;
|
||||
const std::set<QString> m_timeHistoryCurveQuantities;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
#include "RimSummaryYAxisProperties.h"
|
||||
#include "RimAsciiDataCurve.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
@@ -72,6 +73,9 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
CAF_PDM_InitFieldNoDefault(&m_gridTimeHistoryCurves, "GridTimeHistoryCurves", "", "", "", "");
|
||||
m_gridTimeHistoryCurves.uiCapability()->setUiTreeHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_asciiDataCurves, "AsciiDataCurves", "", "", "", "");
|
||||
m_asciiDataCurves.uiCapability()->setUiTreeHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_leftYAxisProperties, "LeftYAxisProperties", "Left Y Axis", "", "", "");
|
||||
m_leftYAxisProperties.uiCapability()->setUiTreeHidden(true);
|
||||
|
||||
@@ -359,6 +363,68 @@ QString RimSummaryPlot::asciiDataForPlotExport() const
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<std::vector<time_t> > timeSteps;
|
||||
|
||||
std::vector<std::vector<std::vector<double> > > allCurveData;
|
||||
std::vector<std::vector<QString > > allCurveNames;
|
||||
//Vectors containing cases - curves - data points/curve name
|
||||
|
||||
for (RimAsciiDataCurve* curve : m_asciiDataCurves)
|
||||
{
|
||||
if (!curve->isCurveVisible()) continue;
|
||||
|
||||
size_t casePosInList = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
if (casePosInList == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
std::vector<time_t> curveTimeSteps = curve->timeSteps();
|
||||
timeSteps.push_back(curveTimeSteps);
|
||||
|
||||
std::vector<std::vector<double> > curveDataForCase;
|
||||
std::vector<double> curveYData = curve->yValues();
|
||||
curveDataForCase.push_back(curveYData);
|
||||
allCurveData.push_back(curveDataForCase);
|
||||
|
||||
std::vector<QString> curveNamesForCase;
|
||||
curveNamesForCase.push_back(curve->curveName());
|
||||
allCurveNames.push_back(curveNamesForCase);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<double> curveYData = curve->yValues();
|
||||
allCurveData[casePosInList].push_back(curveYData);
|
||||
|
||||
QString curveName = curve->curveName();
|
||||
allCurveNames[casePosInList].push_back(curveName);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < timeSteps.size(); i++) //cases
|
||||
{
|
||||
out += "\n\n";
|
||||
|
||||
for (size_t j = 0; j < timeSteps[i].size(); j++) //time steps & data points
|
||||
{
|
||||
if (j == 0)
|
||||
{
|
||||
out += "Date and time";
|
||||
for (size_t k = 0; k < allCurveNames[i].size(); k++) // curves
|
||||
{
|
||||
out += "\t" + (allCurveNames[i][k]);
|
||||
}
|
||||
}
|
||||
out += "\n";
|
||||
out += QDateTime::fromTime_t(timeSteps[i][j]).toUTC().toString("yyyy-MM-dd hh:mm:ss ");
|
||||
|
||||
for (size_t k = 0; k < allCurveData[i].size(); k++) // curves
|
||||
{
|
||||
out += "\t" + QString::number(allCurveData[i][k][j], 'g', 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -391,7 +457,10 @@ void RimSummaryPlot::updateAxis(RiaDefines::PlotAxis plotAxis)
|
||||
timeHistoryQuantities.insert(c->quantityName());
|
||||
}
|
||||
|
||||
RimSummaryPlotYAxisFormatter calc(yAxisProperties, visibleSummaryCurvesForAxis(plotAxis), timeHistoryQuantities);
|
||||
RimSummaryPlotYAxisFormatter calc(yAxisProperties,
|
||||
visibleSummaryCurvesForAxis(plotAxis),
|
||||
visibleAsciiDataCurvesForAxis(plotAxis),
|
||||
timeHistoryQuantities);
|
||||
calc.applyYAxisPropertiesToPlot(m_qwtPlot);
|
||||
}
|
||||
else
|
||||
@@ -426,6 +495,13 @@ void RimSummaryPlot::updateZoomForAxis(RiaDefines::PlotAxis plotAxis)
|
||||
plotCurves.push_back(c->qwtPlotCurve());
|
||||
}
|
||||
|
||||
for (RimAsciiDataCurve* c : visibleAsciiDataCurvesForAxis(plotAxis))
|
||||
{
|
||||
std::vector<double> curveValues = c->yValues();
|
||||
yValues.insert(yValues.end(), curveValues.begin(), curveValues.end());
|
||||
plotCurves.push_back(c->qwtPlotCurve());
|
||||
}
|
||||
|
||||
double min, max;
|
||||
RimSummaryPlotYAxisRangeCalculator calc(plotCurves, yValues);
|
||||
calc.computeYRange(&min, &max);
|
||||
@@ -485,6 +561,11 @@ bool RimSummaryPlot::hasVisibleCurvesForAxis(RiaDefines::PlotAxis plotAxis) cons
|
||||
return true;
|
||||
}
|
||||
|
||||
if (visibleAsciiDataCurvesForAxis(plotAxis).size() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -527,6 +608,24 @@ std::vector<RimGridTimeHistoryCurve*> RimSummaryPlot::visibleTimeHistoryCurvesFo
|
||||
return curves;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimAsciiDataCurve*> RimSummaryPlot::visibleAsciiDataCurvesForAxis(RiaDefines::PlotAxis plotAxis) const
|
||||
{
|
||||
std::vector<RimAsciiDataCurve*> curves;
|
||||
|
||||
for (auto c : m_asciiDataCurves)
|
||||
{
|
||||
if (c->isCurveVisible() && c->yAxis() == plotAxis)
|
||||
{
|
||||
curves.push_back(c);
|
||||
}
|
||||
}
|
||||
|
||||
return curves;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -691,6 +790,21 @@ void RimSummaryPlot::addGridTimeHistoryCurve(RimGridTimeHistoryCurve* curve)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::addAsciiDataCruve(RimAsciiDataCurve* curve)
|
||||
{
|
||||
CVF_ASSERT(curve);
|
||||
|
||||
m_asciiDataCurves.push_back(curve);
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
this->updateAxes();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -742,6 +856,7 @@ void RimSummaryPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
||||
uiTreeOrdering.add(&m_curveFilters);
|
||||
uiTreeOrdering.add(&m_summaryCurves);
|
||||
uiTreeOrdering.add(&m_gridTimeHistoryCurves);
|
||||
uiTreeOrdering.add(&m_asciiDataCurves);
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
@@ -768,6 +883,11 @@ void RimSummaryPlot::loadDataAndUpdate()
|
||||
curve->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
for (RimAsciiDataCurve* curve : m_asciiDataCurves)
|
||||
{
|
||||
curve->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
this->updateAxes();
|
||||
|
||||
updateZoomInQwt();
|
||||
@@ -867,6 +987,11 @@ QWidget* RimSummaryPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
}
|
||||
|
||||
for (RimAsciiDataCurve* curve : m_asciiDataCurves)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
}
|
||||
}
|
||||
|
||||
return m_qwtPlot;
|
||||
@@ -937,6 +1062,11 @@ void RimSummaryPlot::detachAllCurves()
|
||||
{
|
||||
curve->detachQwtCurve();
|
||||
}
|
||||
|
||||
for (RimAsciiDataCurve* curve : m_asciiDataCurves)
|
||||
{
|
||||
curve->detachQwtCurve();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -960,6 +1090,14 @@ caf::PdmObject* RimSummaryPlot::findRimCurveFromQwtCurve(const QwtPlotCurve* qwt
|
||||
}
|
||||
}
|
||||
|
||||
for (RimAsciiDataCurve* curve : m_asciiDataCurves)
|
||||
{
|
||||
if (curve->qwtPlotCurve() == qwtCurve)
|
||||
{
|
||||
return curve;
|
||||
}
|
||||
}
|
||||
|
||||
for (RimSummaryCurveFilter* curveFilter: m_curveFilters)
|
||||
{
|
||||
RimSummaryCurve* foundCurve = curveFilter->findRimCurveFromQwtCurve(qwtCurve);
|
||||
@@ -974,7 +1112,7 @@ caf::PdmObject* RimSummaryPlot::findRimCurveFromQwtCurve(const QwtPlotCurve* qwt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimSummaryPlot::curveCount() const
|
||||
{
|
||||
return m_summaryCurves.size() + m_gridTimeHistoryCurves.size();
|
||||
return m_summaryCurves.size() + m_gridTimeHistoryCurves.size() + m_asciiDataCurves.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -36,6 +36,7 @@ class RimSummaryCurveFilter;
|
||||
class RimSummaryYAxisProperties;
|
||||
class RimSummaryTimeAxisProperties;
|
||||
class RimGridTimeHistoryCurve;
|
||||
class RimAsciiDataCurve;
|
||||
class PdmUiTreeOrdering;
|
||||
|
||||
class QwtPlotCurve;
|
||||
@@ -61,6 +62,8 @@ public:
|
||||
|
||||
void addGridTimeHistoryCurve(RimGridTimeHistoryCurve* curve);
|
||||
|
||||
void addAsciiDataCruve(RimAsciiDataCurve* curve);
|
||||
|
||||
caf::PdmObject* findRimCurveFromQwtCurve(const QwtPlotCurve* curve) const;
|
||||
size_t curveCount() const;
|
||||
|
||||
@@ -102,6 +105,7 @@ protected:
|
||||
private:
|
||||
std::vector<RimSummaryCurve*> visibleSummaryCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||
std::vector<RimGridTimeHistoryCurve*> visibleTimeHistoryCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||
std::vector<RimAsciiDataCurve*> visibleAsciiDataCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||
bool hasVisibleCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||
|
||||
RimSummaryYAxisProperties* yAxisPropertiesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||
@@ -125,6 +129,7 @@ private:
|
||||
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
|
||||
caf::PdmChildArrayField<RimSummaryCurve*> m_summaryCurves;
|
||||
caf::PdmChildArrayField<RimSummaryCurveFilter*> m_curveFilters;
|
||||
caf::PdmChildArrayField<RimAsciiDataCurve*> m_asciiDataCurves;
|
||||
|
||||
caf::PdmField<bool> m_isAutoZoom;
|
||||
caf::PdmChildField<RimSummaryYAxisProperties*> m_leftYAxisProperties;
|
||||
|
||||
Reference in New Issue
Block a user