Merge remote-tracking branch 'refs/remotes/origin/dev'

Conflicts:
	ApplicationCode/ModelVisualization/RivPipeGeometryGenerator.h
	ApplicationCode/ProjectDataModel/RimEclipseWell.cpp
	ApplicationCode/ProjectDataModel/RimEclipseWell.h
	ApplicationCode/UserInterface/RiuViewerCommands.cpp
This commit is contained in:
Magne Sjaastad
2017-01-18 12:19:07 +01:00
101 changed files with 2990 additions and 635 deletions

View File

@@ -47,7 +47,6 @@ ${CEE_CURRENT_LIST_DIR}RimFault.h
${CEE_CURRENT_LIST_DIR}RimFaultCollection.h
${CEE_CURRENT_LIST_DIR}RimFormationNames.h
${CEE_CURRENT_LIST_DIR}RimFormationNamesCollection.h
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.h
${CEE_CURRENT_LIST_DIR}RimMockModelSettings.h
${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.h
${CEE_CURRENT_LIST_DIR}RimEclipseFaultColors.h
@@ -138,7 +137,6 @@ ${CEE_CURRENT_LIST_DIR}RimFault.cpp
${CEE_CURRENT_LIST_DIR}RimFaultCollection.cpp
${CEE_CURRENT_LIST_DIR}RimFormationNames.cpp
${CEE_CURRENT_LIST_DIR}RimFormationNamesCollection.cpp
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.cpp
${CEE_CURRENT_LIST_DIR}RimMockModelSettings.cpp
${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.cpp
${CEE_CURRENT_LIST_DIR}RimEclipseFaultColors.cpp

View File

@@ -0,0 +1,27 @@
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.h
${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.cpp
${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "ProjectDataModel\\Flow" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )

View File

@@ -122,7 +122,6 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
TracerStatusType tracerStatus = UNDEFINED;
std::map<std::string, std::vector<int> > tracersWithCells;
@@ -137,6 +136,9 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
if (!wellResults[wIdx]->hasWellResult(timeStepIndex) ) continue;
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) continue;
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep];
if ( !wellResFrame.m_isOpen ) continue;
@@ -189,27 +191,30 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(Q
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{
if(wellResults[wIdx]->m_wellName == tracerName)
if ( wellResults[wIdx]->m_wellName == tracerName )
{
for (const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps)
{
if (wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR)
tracerStatus = CLOSED;
for ( const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps )
{
if (wellResFrame.m_isOpen)
{
if (tracerStatus == PRODUCER) tracerStatus = VARYING;
else tracerStatus = INJECTOR;
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
if ( tracerStatus == PRODUCER ) tracerStatus = VARYING;
else tracerStatus = INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
else tracerStatus = PRODUCER;
}
}
else if (wellResFrame.m_productionType == RigWellResultFrame::PRODUCER)
{
if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
else tracerStatus = PRODUCER;
}
if (tracerStatus == VARYING) break;
}
if ( tracerStatus == VARYING ) break;
}
break;
break;
}
}
}
@@ -234,8 +239,13 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
if ( wellResults[wIdx]->m_wellName == tracerName )
{
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) return CLOSED;
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep];
{
if (!wellResFrame.m_isOpen) return CLOSED;
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )

View File

@@ -48,6 +48,7 @@ public:
enum TracerStatusType
{
CLOSED,
PRODUCER,
INJECTOR,
VARYING,

View File

@@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimFlowPlotCollection.h"
#include "RimWellAllocationPlot.h"
#include "cvfAssert.h"
CAF_PDM_SOURCE_INIT(RimFlowPlotCollection, "FlowPlotCollection");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowPlotCollection::RimFlowPlotCollection()
{
CAF_PDM_InitObject("Flow Diagnostics Plots", ":/newIcon16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&defaultPlot, "DefaultFlowPlot", "", "", "", "");
defaultPlot = new RimWellAllocationPlot;
defaultPlot->setDescription("Default Flow Diagnostics Plot");
defaultPlot.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&flowPlots, "FlowPlots", "Stored Plots", "", "", "");
flowPlots.push_back(new RimWellAllocationPlot);
flowPlots.push_back(new RimWellAllocationPlot);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowPlotCollection::~RimFlowPlotCollection()
{
flowPlots.deleteAllChildObjects();
}

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmObject.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
class RimWellAllocationPlot;
//==================================================================================================
///
///
//==================================================================================================
class RimFlowPlotCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimFlowPlotCollection();
virtual ~RimFlowPlotCollection();
caf::PdmChildField<RimWellAllocationPlot*> defaultPlot;
caf::PdmChildArrayField<RimWellAllocationPlot*> flowPlots;
};

View File

@@ -0,0 +1,283 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimWellAllocationPlot.h"
#include "RiaApplication.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RiuMainPlotWindow.h"
#include "RiuWellAllocationPlot.h"
CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlot::RimWellAllocationPlot()
{
CAF_PDM_InitObject("Well Allocation Plot", ":/newIcon16x16.png", "", "");
CAF_PDM_InitField(&m_showWindow, "ShowWindow", true, "Show Flow Diagnostics Plot", "", "", "");
m_showWindow.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Flow Diagnostics Plot"), "Name", "", "", "");
m_userName.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_simulationWell, "SimulationWell", "Simulation Well", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlot::~RimWellAllocationPlot()
{
if (RiaApplication::instance()->mainPlotWindow())
{
RiaApplication::instance()->mainPlotWindow()->removeViewer(m_wellAllocationPlot);
}
deletePlotWidget();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::setSimulationWell(RimEclipseWell* simWell)
{
m_simulationWell = simWell;
updateFromWell();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::deletePlotWidget()
{
if (m_wellAllocationPlot)
{
m_wellAllocationPlot->deleteLater();
m_wellAllocationPlot = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::updateFromWell()
{
QString simName = "None";
if (m_simulationWell)
{
simName = m_simulationWell->name();
}
setDescription(simName);
updateViewerWidget();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimWellAllocationPlot::viewWidget()
{
return m_wellAllocationPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::zoomAll()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_simulationWell)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(activeView);
if (eclView && eclView->wellCollection())
{
RimEclipseWellCollection* coll = eclView->wellCollection();
caf::PdmChildArrayField<RimEclipseWell*>& eclWells = coll->wells;
QIcon simWellIcon(":/Well.png");
for (RimEclipseWell* eclWell : eclWells)
{
options.push_back(caf::PdmOptionItemInfo(eclWell->name(), eclWell, false, simWellIcon));
}
}
if (options.size() == 0)
{
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::handleViewerDeletion()
{
m_showWindow = false;
uiCapability()->updateUiIconFromToggleField();
updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &m_showWindow)
{
updateViewerWidget();
uiCapability()->updateUiIconFromToggleField();
}
else if (changedField == &m_userName ||
changedField == &m_showPlotTitle)
{
updateViewerWidgetWindowTitle();
}
else if (changedField == &m_simulationWell)
{
updateFromWell();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::setupBeforeSave()
{
if (m_wellAllocationPlot && RiaApplication::instance()->mainPlotWindow())
{
this->setMdiWindowGeometry(RiaApplication::instance()->mainPlotWindow()->windowGeometryForViewer(m_wellAllocationPlot));
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimWellAllocationPlot::snapshotWindowContent()
{
QImage image;
// TODO
return image;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::setDescription(const QString& description)
{
m_userName = description;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellAllocationPlot::description() const
{
return m_userName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::loadDataAndUpdate()
{
updateViewerWidget();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::updateViewerWidget()
{
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
if (!mainPlotWindow) return;
if (m_showWindow())
{
if (!m_wellAllocationPlot)
{
m_wellAllocationPlot = new RiuWellAllocationPlot(this, mainPlotWindow);
mainPlotWindow->addViewer(m_wellAllocationPlot, this->mdiWindowGeometry());
mainPlotWindow->setActiveViewer(m_wellAllocationPlot);
}
updateViewerWidgetWindowTitle();
}
else
{
if (m_wellAllocationPlot)
{
this->setMdiWindowGeometry(mainPlotWindow->windowGeometryForViewer(m_wellAllocationPlot));
mainPlotWindow->removeViewer(m_wellAllocationPlot);
deletePlotWidget();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::updateViewerWidgetWindowTitle()
{
if (m_wellAllocationPlot)
{
m_wellAllocationPlot->setWindowTitle(m_userName);
if (m_showPlotTitle)
{
m_wellAllocationPlot->setTitle(m_userName);
}
else
{
m_wellAllocationPlot->setTitle("");
}
}
}

View File

@@ -0,0 +1,89 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
class RiuWellAllocationPlot;
class RimEclipseWell;
namespace caf {
class PdmOptionItemInfo;
}
//==================================================================================================
///
///
//==================================================================================================
class RimWellAllocationPlot : public RimViewWindow
{
CAF_PDM_HEADER_INIT;
public:
RimWellAllocationPlot();
virtual ~RimWellAllocationPlot();
void setSimulationWell(RimEclipseWell* simWell);
void setDescription(const QString& description);
QString description() const;
void loadDataAndUpdate();
void handleViewerDeletion();
virtual QWidget* viewWidget() override;
virtual void zoomAll() override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
protected:
// Overridden PDM methods
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void setupBeforeSave() override;
virtual QImage snapshotWindowContent() override;
private:
void updateViewerWidget();
void updateViewerWidgetWindowTitle();
void deletePlotWidget();
void updateFromWell();
private:
caf::PdmField<bool> m_showWindow;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
caf::PdmPtrField<RimEclipseWell*> m_simulationWell;
QPointer<RiuWellAllocationPlot> m_wellAllocationPlot;
};

View File

@@ -361,18 +361,17 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
if (eclipseView->cellResult()->isTernarySaturationSelected())
{
QString propName = eclipseView->cellResult()->resultVariableUiName();
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
}
if (isResultsInfoRelevant)
{
QString propName = eclipseView->cellResult()->resultVariableUiName();
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
QString timeRangeText = m_statisticsTimeRange().uiText();
if ( eclipseView->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS )
{
timeRangeText = caf::AppEnum<StatisticsTimeRangeType>::uiText(CURRENT_TIMESTEP);
propName = QString::fromStdString( eclipseView->cellResult()->flowDiagResAddress().uiText());
}
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
@@ -407,14 +406,14 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
}
infoText += QString("<b>Fault results: </b> %1<br>").arg(faultMapping);
infoText += QString("<b>Fault Property:</b> %1 <br>").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiName());
infoText += QString("<b>Fault Property:</b> %1 <br>").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiShortName());
}
}
if (eclipseView->hasUserRequestedAnimation() && eclipseView->cellEdgeResult()->hasResult())
{
double min, max;
QString cellEdgeName = eclipseView->cellEdgeResult()->resultVariable();
QString cellEdgeName = eclipseView->cellEdgeResult()->resultVariableUiShortName();
eclipseView->cellEdgeResult()->minMaxCellEdgeValues(min, max);
infoText += QString("<b>Cell Edge Property:</b> %1 ").arg(cellEdgeName);
infoText += QString("<table border=0 cellspacing=5 >"

View File

@@ -21,6 +21,7 @@
#include "RimCellEdgeColors.h"
#include "RigCaseCellResultsData.h"
#include "RigFlowDiagResults.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
@@ -102,9 +103,9 @@ void RimCellEdgeColors::loadResult()
if (isUsingSingleVariable())
{
size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadScalarResult(m_singleVarEdgeResultColors->resultType(),
m_singleVarEdgeResultColors->resultVariable());
m_singleVarEdgeResultColors->loadResult();;
size_t resultindex = m_singleVarEdgeResultColors->scalarResultIndex();
for (int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
{
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(m_singleVarEdgeResultColors->resultVariable(), resultindex);
@@ -397,6 +398,11 @@ bool RimCellEdgeColors::hasResult() const
{
if (!enableCellEdgeColors()) return false;
if (isUsingSingleVariable() && m_singleVarEdgeResultColors->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
return true;
}
bool hasResult = false;
int cubeFaceIndex;
for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex)
@@ -431,22 +437,34 @@ void RimCellEdgeColors::minMaxCellEdgeValues(double& min, double& max)
globalMin = HUGE_VAL;
globalMax = -HUGE_VAL;
size_t resultIndices[6];
this->gridScalarIndices(resultIndices);
size_t idx;
for (idx = 0; idx < 6; idx++)
if (isUsingSingleVariable() && singleVarEdgeResultColors()->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
int currentTimeStep = m_reservoirView->currentTimeStep();
RigFlowDiagResults* fldResults = singleVarEdgeResultColors()->flowDiagSolution()->flowDiagResults();
RigFlowDiagResultAddress resAddr = singleVarEdgeResultColors()->flowDiagResAddress();
fldResults->minMaxScalarValues(resAddr, currentTimeStep, &globalMin, &globalMax);
}
else
{
size_t resultIndices[6];
this->gridScalarIndices(resultIndices);
size_t idx;
for (idx = 0; idx < 6; idx++)
{
double cMin, cMax;
m_reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(resultIndices[idx], cMin, cMax);
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
{
double cMin, cMax;
m_reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(resultIndices[idx], cMin, cMax);
globalMin = CVF_MIN(globalMin, cMin);
globalMax = CVF_MAX(globalMax, cMax);
}
globalMin = CVF_MIN(globalMin, cMin);
globalMax = CVF_MAX(globalMax, cMax);
}
}
min = globalMin;
@@ -510,6 +528,36 @@ QString RimCellEdgeColors::resultVariable() const
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimCellEdgeColors::resultVariableUiName() const
{
if (isUsingSingleVariable())
{
return m_singleVarEdgeResultColors->resultVariableUiName();
}
else
{
return m_resultVariable;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimCellEdgeColors::resultVariableUiShortName() const
{
if (isUsingSingleVariable())
{
return m_singleVarEdgeResultColors->resultVariableUiShortName();
}
else
{
return m_resultVariable;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -549,3 +597,11 @@ RimLegendConfig* RimCellEdgeColors::legendConfig()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCellEdgeColors::PropertyType RimCellEdgeColors::propertyType() const
{
return m_propertyType();
}

View File

@@ -73,6 +73,8 @@ public:
void setResultVariable(const QString& variableName);
QString resultVariable() const;
QString resultVariableUiName() const;
QString resultVariableUiShortName() const;
caf::PdmField<bool> enableCellEdgeColors;
@@ -83,8 +85,11 @@ public:
void loadResult();
bool hasResult() const;
bool hasCategoryResult() const;
bool isUsingSingleVariable() const;
RimEclipseCellColors* singleVarEdgeResultColors();
RimLegendConfig* legendConfig();
PropertyType propertyType() const;
void minMaxCellEdgeValues(double& min, double& max);
void posNegClosestToZero(double& pos, double& neg);
@@ -115,7 +120,6 @@ private:
caf::PdmPointer<RimEclipseView> m_reservoirView;
double m_ignoredResultScalar;
bool isUsingSingleVariable() const;
caf::PdmField<caf::AppEnum< PropertyType > > m_propertyType;
caf::PdmChildField<RimLegendConfig*> m_legendConfig;

View File

@@ -20,7 +20,13 @@
#include "RimEclipseCellColors.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigFlowDiagResults.h"
#include "RigFormationNames.h"
#include "RimCellEdgeColors.h"
#include "RimEclipseCase.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipseView.h"
#include "RimLegendConfig.h"
@@ -234,6 +240,107 @@ RimEclipseView* RimEclipseCellColors::reservoirView()
return m_reservoirView;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
{
if (this->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
RigFlowDiagResults* flowResultsData = this->flowDiagSolution()->flowDiagResults();
RigFlowDiagResultAddress resAddr = this->flowDiagResAddress();
int integerTimeStep = static_cast<int>(currentTimeStep);
flowResultsData->minMaxScalarValues(resAddr, integerTimeStep, &globalMin, &globalMax);
flowResultsData->posNegClosestToZero(resAddr, integerTimeStep, &globalPosClosestToZero, &globalNegClosestToZero);
double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero;
if (this->hasDynamicResult())
{
flowResultsData->minMaxScalarValues(resAddr, integerTimeStep, &localMin, &localMax);
flowResultsData->posNegClosestToZero(resAddr, integerTimeStep, &localPosClosestToZero, &localNegClosestToZero);
}
else
{
localMin = globalMin;
localMax = globalMax;
localPosClosestToZero = globalPosClosestToZero;
localNegClosestToZero = globalNegClosestToZero;
}
CVF_ASSERT(this->legendConfig());
this->legendConfig()->disableAllTimeStepsRange(true);
this->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
this->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
if (this->hasCategoryResult())
{
this->legendConfig()->setNamedCategories(this->flowDiagSolution()->tracerNames());
}
}
else
{
RimEclipseCase* rimEclipseCase = nullptr;
this->firstAncestorOrThisOfType(rimEclipseCase);
CVF_ASSERT(rimEclipseCase);
if (!rimEclipseCase) return;
RigEclipseCaseData* eclipseCase = rimEclipseCase->reservoirData();
CVF_ASSERT(eclipseCase);
if (!eclipseCase) return;
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(this->porosityModel());
RigCaseCellResultsData* cellResultsData = eclipseCase->results(porosityModel);
CVF_ASSERT(cellResultsData);
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
cellResultsData->minMaxCellScalarValues(this->scalarResultIndex(), globalMin, globalMax);
cellResultsData->posNegClosestToZero(this->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero);
double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero;
if (this->hasDynamicResult())
{
cellResultsData->minMaxCellScalarValues(this->scalarResultIndex(), currentTimeStep, localMin, localMax);
cellResultsData->posNegClosestToZero(this->scalarResultIndex(), currentTimeStep, localPosClosestToZero, localNegClosestToZero);
}
else
{
localMin = globalMin;
localMax = globalMax;
localPosClosestToZero = globalPosClosestToZero;
localNegClosestToZero = globalNegClosestToZero;
}
CVF_ASSERT(this->legendConfig());
this->legendConfig()->disableAllTimeStepsRange(false);
this->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
this->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
if (this->hasCategoryResult())
{
if (this->resultType() != RimDefines::FORMATION_NAMES)
{
this->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(this->scalarResultIndex()));
}
else
{
const std::vector<QString>& fnVector = eclipseCase->activeFormationNames()->formationNames();
this->legendConfig()->setNamedCategoriesInverse(fnVector);
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -44,6 +44,7 @@ public:
void setReservoirView(RimEclipseView* ownerReservoirView);
RimEclipseView* reservoirView();
void updateLegendData(size_t timestep);
RimLegendConfig* legendConfig();
caf::PdmChildField<RimTernaryLegendConfig*> ternaryLegendConfig;

View File

@@ -353,7 +353,7 @@ void RimEclipsePropertyFilter::computeResultValueRange()
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::updateFilterName()
{
QString newFiltername = resultDefinition->resultVariableUiName();
QString newFiltername = resultDefinition->resultVariableUiShortName();
if (isCategorySelectionActive())
{

View File

@@ -60,9 +60,6 @@ RimEclipseResultCase::RimEclipseResultCase()
CAF_PDM_InitFieldNoDefault (&m_flowDiagSolutions, "FlowDiagSolutions", "Flow Diagnostics Solutions", "", "", "");
// TODO: Create a solution by default only when flux data is available
m_flowDiagSolutions.push_back( new RimFlowDiagSolution());
// Obsolete, unused field
CAF_PDM_InitField(&caseDirectory, "CaseFolder", QString(), "Directory", "", "" ,"");
caseDirectory.xmlCapability()->setIOWritable(false);
@@ -73,7 +70,7 @@ RimEclipseResultCase::RimEclipseResultCase()
flipYAxis.xmlCapability()->setIOWritable(true);
//flipYAxis.uiCapability()->setUiHidden(true);
m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this);
m_activeCellInfoIsReadFromFile = false;
m_gridAndWellDataIsReadFromFile = false;
@@ -135,6 +132,12 @@ bool RimEclipseResultCase::openEclipseGridFile()
m_gridAndWellDataIsReadFromFile = true;
m_activeCellInfoIsReadFromFile = true;
if (reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes())
{
m_flowDiagSolutions.push_back( new RimFlowDiagSolution());
m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this);
}
return true;
}

View File

@@ -23,23 +23,37 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigFlowDiagResultAddress.h"
#include "RimCellEdgeColors.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimFlowDiagSolution.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimView.h"
#include "RimViewLinker.h"
#include "RimWellLogCurve.h"
#include "RimFlowDiagSolution.h"
#include "cafPdmUiListEditor.h"
#include "RimEclipseResultCase.h"
#include "RigFlowDiagResultAddress.h"
namespace caf
{
template<>
void RimEclipseResultDefinition::FlowTracerSelectionEnum::setUp()
{
addItem(RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD, "FLOW_TR_INJ_AND_PROD", "All Injectors and Producers");
addItem(RimEclipseResultDefinition::FLOW_TR_PRODUCERS, "FLOW_TR_PRODUCERS", "All Producers");
addItem(RimEclipseResultDefinition::FLOW_TR_INJECTORS, "FLOW_TR_INJECTORS", "All Injectors");
addItem(RimEclipseResultDefinition::FLOW_TR_BY_SELECTION, "FLOW_TR_BY_SELECTION", "By Selection");
setDefault(RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD);
}
}
CAF_PDM_SOURCE_INIT(RimEclipseResultDefinition, "ResultDefinition");
@@ -65,6 +79,8 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
CAF_PDM_InitFieldNoDefault(&m_selectedTracers, "SelectedTracers", "Tracers", "", "", "");
m_selectedTracers.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_flowTracerSelectionMode, "FlowTracerSelectionMode", "Tracers", "", "", "");
// Ui only fields
CAF_PDM_InitFieldNoDefault(&m_resultTypeUiField, "MResultType", "Type", "", "", "");
@@ -80,15 +96,15 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
m_resultVariableUiField.xmlCapability()->setIOWritable(false);
m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_flowSolutionUiField, "MFlowDiagSolution", "Solution", "", "", "");
m_flowSolutionUiField.xmlCapability()->setIOReadable(false);
m_flowSolutionUiField.xmlCapability()->setIOWritable(false);
CAF_PDM_InitFieldNoDefault(&m_selectedTracersUiField, "MSelectedTracers", "Tracers", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_selectedTracersUiField, "MSelectedTracers", " ", "", "", "");
m_selectedTracersUiField.xmlCapability()->setIOReadable(false);
m_selectedTracersUiField.xmlCapability()->setIOWritable(false);
m_selectedTracersUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
}
//--------------------------------------------------------------------------------------------------
@@ -301,11 +317,42 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_resultTypeUiField )
{
bool hasFlowDiagFluxes = false;
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
if ( eclResCase && eclResCase->reservoirData() )
{
hasFlowDiagFluxes = eclResCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes();
}
// Do not include flow diag results if not available
if ( !hasFlowDiagFluxes )
{
using ResCatEnum = caf::AppEnum< RimDefines::ResultCatType >;
for ( int i = 0; i < ResCatEnum::size(); ++i )
{
RimDefines::ResultCatType resType = ResCatEnum::fromIndex(i);
if ( resType != RimDefines::FLOW_DIAGNOSTICS )
{
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() != RimDefines::FLOW_DIAGNOSTICS )
{
if ( fieldNeedingOptions == &m_resultVariableUiField )
{
options = calcOptionsForVariableUiFieldStandard();
options = calcOptionsForVariableUiFieldStandard();
}
}
else
@@ -347,7 +394,8 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
case RimFlowDiagSolution::PRODUCER: prefix = "P : "; break;
case RimFlowDiagSolution::VARYING: prefix = "I/P: "; break;
}
prefixedTracerNamesMap[prefix + tracerName] = tracerName;
if (status != RimFlowDiagSolution::CLOSED) prefixedTracerNamesMap[prefix + tracerName] = tracerName;
}
for (auto nameIt: prefixedTracerNamesMap)
@@ -507,10 +555,50 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
{
CVF_ASSERT(m_resultType() == RimDefines::FLOW_DIAGNOSTICS);
RimView* rimView = nullptr;
this->firstAncestorOrThisOfType(rimView);
size_t timeStep = rimView->currentTimeStep();
std::set<std::string> selTracerNames;
for (const QString& tName : m_selectedTracers())
if (m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION)
{
selTracerNames.insert(tName.toStdString());
for (const QString& tName : m_selectedTracers())
{
selTracerNames.insert(tName.toStdString());
}
}
else
{
RimFlowDiagSolution* flowSol = m_flowSolutionUiField();
if (flowSol)
{
std::vector<QString> tracerNames = flowSol->tracerNames();
if (m_flowTracerSelectionMode == FLOW_TR_INJECTORS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD)
{
for (const QString& tracerName : tracerNames)
{
RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatusInTimeStep(tracerName, timeStep);
if (status == RimFlowDiagSolution::INJECTOR)
{
selTracerNames.insert(tracerName.toStdString());
}
}
}
if (m_flowTracerSelectionMode == FLOW_TR_PRODUCERS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD)
{
for (const QString& tracerName : tracerNames)
{
RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatusInTimeStep(tracerName, timeStep);
if (status == RimFlowDiagSolution::PRODUCER)
{
selTracerNames.insert(tracerName.toStdString());
}
}
}
}
}
return RigFlowDiagResultAddress(m_resultVariable().toStdString(), selTracerNames);
@@ -519,11 +607,57 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::resultVariableUiName()
QString RimEclipseResultDefinition::resultVariableUiName() const
{
if (resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
return QString::fromStdString(flowDiagResAddress().uiText());
QString fullName;
if (m_flowTracerSelectionMode() == FLOW_TR_BY_SELECTION)
{
fullName = QString::fromStdString(flowDiagResAddress().uiText());
}
else
{
fullName = QString::fromStdString(flowDiagResAddress().uiShortText());
fullName += QString(" (%1)").arg(m_flowTracerSelectionMode().uiText());
}
return fullName;
}
return m_resultVariable();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::resultVariableUiShortName() const
{
if (resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
QString shortName;
if (m_flowTracerSelectionMode() == FLOW_TR_BY_SELECTION)
{
QString candidate = QString::fromStdString(flowDiagResAddress().uiText());
int stringSizeLimit = 32;
if (candidate.size() > stringSizeLimit)
{
candidate = candidate.left(stringSizeLimit);
candidate += "...";
}
shortName = candidate;
}
else
{
shortName = QString::fromStdString(flowDiagResAddress().uiShortText());
shortName += QString(" (%1)").arg(m_flowTracerSelectionMode().uiText());
}
return shortName;
}
return m_resultVariable();
@@ -737,14 +871,22 @@ bool RimEclipseResultDefinition::hasDualPorFractureResult()
void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_resultTypeUiField);
if (hasDualPorFractureResult())
{
uiOrdering.add(&m_porosityModelUiField);
}
if ( m_resultTypeUiField() == RimDefines::FLOW_DIAGNOSTICS )
{
uiOrdering.add(&m_flowSolutionUiField);
uiOrdering.add(&m_selectedTracersUiField);
uiOrdering.add(&m_flowTracerSelectionMode);
if (m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION)
{
uiOrdering.add(&m_selectedTracersUiField);
}
if ( m_flowSolution() == nullptr )
{

View File

@@ -35,6 +35,7 @@ class RimEclipseView;
class RimReservoirCellResultsStorage;
class RimFlowDiagSolution;
//==================================================================================================
///
///
@@ -42,6 +43,17 @@ class RimFlowDiagSolution;
class RimEclipseResultDefinition : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
enum FlowTracerSelectionType
{
FLOW_TR_INJ_AND_PROD,
FLOW_TR_PRODUCERS,
FLOW_TR_INJECTORS,
FLOW_TR_BY_SELECTION
};
typedef caf::AppEnum<RimEclipseResultDefinition::FlowTracerSelectionType> FlowTracerSelectionEnum;
public:
RimEclipseResultDefinition();
virtual ~RimEclipseResultDefinition();
@@ -59,7 +71,8 @@ public:
RimFlowDiagSolution* flowDiagSolution();
RigFlowDiagResultAddress flowDiagResAddress() const;
QString resultVariableUiName();
QString resultVariableUiName() const;
QString resultVariableUiShortName() const;
void loadResult();
size_t scalarResultIndex() const;
@@ -100,6 +113,7 @@ protected:
caf::PdmField< caf::AppEnum< RimDefines::PorosityModelType > > m_porosityModelUiField;
caf::PdmField<QString> m_resultVariableUiField;
caf::PdmField< caf::AppEnum< FlowTracerSelectionType > > m_flowTracerSelectionMode;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowSolutionUiField;
caf::PdmField<std::vector<QString> > m_selectedTracersUiField;

View File

@@ -44,11 +44,12 @@ void RimEclipseStatisticsCaseEvaluator::addNamedResult(RigCaseCellResultsData* d
CVF_ASSERT(m_sourceCases.size() > 0);
std::vector<QDateTime> sourceTimeStepDates = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(0);
std::vector<int> sourceReportStepNumbers = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->reportStepNumbers(0);
size_t destinationScalarResultIndex = destinationCellResults->addEmptyScalarResult(resultType, resultName, true);
CVF_ASSERT(destinationScalarResultIndex != cvf::UNDEFINED_SIZE_T);
destinationCellResults->setTimeStepDates(destinationScalarResultIndex, sourceTimeStepDates);
destinationCellResults->setTimeStepDates(destinationScalarResultIndex, sourceTimeStepDates, sourceReportStepNumbers);
std::vector< std::vector<double> >& dataValues = destinationCellResults->cellScalarResults(destinationScalarResultIndex);
dataValues.resize(sourceTimeStepDates.size());

View File

@@ -31,6 +31,7 @@
#include "RigMainGrid.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
#include "RigSingleWellResultsData.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimCellEdgeColors.h"
@@ -964,29 +965,36 @@ void RimEclipseView::updateLegends()
if (this->cellEdgeResult()->hasResult())
{
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
this->cellEdgeResult()->minMaxCellEdgeValues(globalMin, globalMax);
this->cellEdgeResult()->posNegClosestToZero(globalPosClosestToZero, globalNegClosestToZero);
this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero);
this->cellEdgeResult()->legendConfig()->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax);
if (this->cellEdgeResult()->hasCategoryResult())
if (this->cellEdgeResult()->isUsingSingleVariable())
{
if(cellEdgeResult()->singleVarEdgeResultColors()->resultType() != RimDefines::FORMATION_NAMES)
this->cellEdgeResult()->singleVarEdgeResultColors()->updateLegendData(m_currentTimeStep);
}
else
{
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
this->cellEdgeResult()->minMaxCellEdgeValues(globalMin, globalMax);
this->cellEdgeResult()->posNegClosestToZero(globalPosClosestToZero, globalNegClosestToZero);
this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero);
this->cellEdgeResult()->legendConfig()->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax);
if (this->cellEdgeResult()->hasCategoryResult())
{
cellEdgeResult()->legendConfig()->setIntegerCategories(results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->scalarResultIndex()));
}
else
{
const std::vector<QString>& fnVector = eclipseCase->activeFormationNames()->formationNames();
cellEdgeResult()->legendConfig()->setNamedCategoriesInverse(fnVector);
if(cellEdgeResult()->singleVarEdgeResultColors()->resultType() != RimDefines::FORMATION_NAMES)
{
cellEdgeResult()->legendConfig()->setIntegerCategories(results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->scalarResultIndex()));
}
else
{
const std::vector<QString>& fnVector = eclipseCase->activeFormationNames()->formationNames();
cellEdgeResult()->legendConfig()->setNamedCategoriesInverse(fnVector);
}
}
}
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend());
this->cellEdgeResult()->legendConfig()->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariable()));
this->cellEdgeResult()->legendConfig()->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiShortName()));
}
else
{
@@ -1002,92 +1010,12 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
{
if (resultColors->hasResult())
{
if (resultColors->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
RigFlowDiagResults* flowResultsData = resultColors->flowDiagSolution()->flowDiagResults();
RigFlowDiagResultAddress resAddr = resultColors->flowDiagResAddress();
flowResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &globalMin, &globalMax);
flowResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &globalPosClosestToZero, &globalNegClosestToZero);
double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero;
if ( resultColors->hasDynamicResult() )
{
flowResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &localMin, &localMax);
flowResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero);
}
else
{
localMin = globalMin;
localMax = globalMax;
localPosClosestToZero = globalPosClosestToZero;
localNegClosestToZero = globalNegClosestToZero;
}
CVF_ASSERT(resultColors->legendConfig());
resultColors->legendConfig()->disableAllTimeStepsRange(true);
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
if ( resultColors->hasCategoryResult() )
{
resultColors->legendConfig()->setNamedCategories(resultColors->flowDiagSolution()->tracerNames());
}
}
else
{
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), globalMin, globalMax);
cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero);
double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero;
if ( resultColors->hasDynamicResult() )
{
cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), m_currentTimeStep, localMin, localMax);
cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), m_currentTimeStep, localPosClosestToZero, localNegClosestToZero);
}
else
{
localMin = globalMin;
localMax = globalMax;
localPosClosestToZero = globalPosClosestToZero;
localNegClosestToZero = globalNegClosestToZero;
}
CVF_ASSERT(resultColors->legendConfig());
resultColors->legendConfig()->disableAllTimeStepsRange(false);
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
if ( resultColors->hasCategoryResult() )
{
if ( resultColors->resultType() != RimDefines::FORMATION_NAMES )
{
resultColors->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex()));
}
else
{
const std::vector<QString>& fnVector = eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
resultColors->legendConfig()->setNamedCategoriesInverse(fnVector);
}
}
}
resultColors->updateLegendData(m_currentTimeStep);
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariableUiName()));
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariableUiShortName()));
}
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();
if (resultColors->isTernarySaturationSelected() && maxTimeStepCount > 1)
{
@@ -1232,11 +1160,6 @@ void RimEclipseView::syncronizeWellsWithResults()
// Make sure all the wells have their reservoirView ptr setup correctly
this->wellCollection()->setReservoirView(this);
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
{
this->wellCollection()->wells()[wIdx]->setReservoirView(this);
}
this->wellCollection()->sortWellsByName();
}

View File

@@ -20,7 +20,8 @@
#include "RimEclipseWell.h"
#include "RimIntersectionCollection.h"
#include "RigSingleWellResultsData.h"
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "RimSimWellFractureCollection.h"
@@ -57,8 +58,6 @@ RimEclipseWell::RimEclipseWell()
m_resultWellIndex = cvf::UNDEFINED_SIZE_T;
m_reservoirView = NULL;
simwellFractureCollection= new RimSimWellFractureCollection();
}
@@ -78,63 +77,29 @@ caf::PdmFieldHandle* RimEclipseWell::userDescriptionField()
return &name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseWell::setReservoirView(RimEclipseView* ownerReservoirView)
{
m_reservoirView = ownerReservoirView;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (&showWellLabel == changedField)
{
if (m_reservoirView)
{
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if (&showWell == changedField)
{
if (m_reservoirView)
{
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
else if (&showWellCells == changedField)
{
if (m_reservoirView)
{
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
RimEclipseView* m_reservoirView = nullptr;
this->firstAncestorOrThisOfType(m_reservoirView);
if (!m_reservoirView) return;
}
else if (&showWellCellFence == changedField)
if (&showWellLabel == changedField ||
&showWellPipes == changedField ||
&showWellSpheres == changedField ||
&wellPipeColor == changedField)
{
if (m_reservoirView)
{
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if (&showWellPipes == changedField)
else if (&showWell == changedField ||
&showWellCells == changedField ||
&showWellCellFence == changedField)
{
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if (&showWellSpheres == changedField)
{
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if (&wellPipeColor == changedField)
{
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if (&pipeRadiusScaleFactor == changedField)
{
@@ -163,6 +128,9 @@ bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex)
if (!wellResults()->hasWellResult(frameIndex)) return false;
RimEclipseView* m_reservoirView = nullptr;
this->firstAncestorOrThisOfType(m_reservoirView);
const std::vector<RivCellSetEnum>& visGridParts = m_reservoirView->visibleGridParts();
cvf::cref<RivReservoirViewPartMgr> rvMan = m_reservoirView->reservoirGridPartManager();
@@ -232,8 +200,11 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
//--------------------------------------------------------------------------------------------------
bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
{
if (m_reservoirView == NULL) return false;
if (this->wellResults() == NULL) return false;
RimEclipseView* m_reservoirView = nullptr;
this->firstAncestorOrThisOfType(m_reservoirView);
if (m_reservoirView == nullptr) return false;
if (this->wellResults() == nullptr) return false;
if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size())
{
@@ -282,8 +253,11 @@ bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
//--------------------------------------------------------------------------------------------------
bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
{
if (m_reservoirView == NULL) return false;
if (this->wellResults() == NULL) return false;
RimEclipseView* m_reservoirView = nullptr;
this->firstAncestorOrThisOfType(m_reservoirView);
if (m_reservoirView == nullptr) return false;
if (this->wellResults() == nullptr) return false;
if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size())
{
@@ -332,6 +306,23 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
//--------------------------------------------------------------------------------------------------
void RimEclipseWell::setWellResults(RigSingleWellResultsData* wellResults, size_t resultWellIndex)
{
m_wellResults = wellResults; m_resultWellIndex = resultWellIndex;
m_wellResults = wellResults;
m_resultWellIndex = resultWellIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigSingleWellResultsData* RimEclipseWell::wellResults()
{
return m_wellResults.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimEclipseWell::resultWellIndex()
{
return m_resultWellIndex;
}

View File

@@ -20,8 +20,6 @@
#pragma once
#include "RigSingleWellResultsData.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
@@ -33,6 +31,7 @@
#include "cafPdmFieldCvfColor.h"
#include "cafPdmChildField.h"
class RigSingleWellResultsData;
class RimEclipseView;
class RimSimWellFractureCollection;
@@ -48,11 +47,9 @@ public:
RimEclipseWell();
virtual ~RimEclipseWell();
void setReservoirView(RimEclipseView* ownerReservoirView);
void setWellResults(RigSingleWellResultsData* wellResults, size_t resultWellIndex);
RigSingleWellResultsData* wellResults() { return m_wellResults.p(); }
size_t resultWellIndex() { return m_resultWellIndex; }
RigSingleWellResultsData* wellResults();
size_t resultWellIndex();
bool isWellPipeVisible(size_t frameIndex);
bool isWellSpheresVisible(size_t frameIndex);
@@ -84,6 +81,4 @@ public:
private:
cvf::ref<RigSingleWellResultsData> m_wellResults;
size_t m_resultWellIndex;
RimEclipseView* m_reservoirView;
};

View File

@@ -75,6 +75,17 @@ namespace caf
}
}
namespace caf
{
template<>
void RimEclipseWellCollection::WellPipeCoordEnum::setUp()
{
addItem(RimEclipseWellCollection::WELLPIPE_INTERPOLATED, "WELLPIPE_INTERPOLATED", "Interpolated");
addItem(RimEclipseWellCollection::WELLPIPE_CELLCENTER, "WELLPIPE_CELLCENTER", "Cell Centers");
setDefault(RimEclipseWellCollection::WELLPIPE_INTERPOLATED);
}
}
CAF_PDM_SOURCE_INIT(RimEclipseWellCollection, "Wells");
//--------------------------------------------------------------------------------------------------
@@ -99,6 +110,7 @@ RimEclipseWellCollection::RimEclipseWellCollection()
CAF_PDM_InitField(&pipeRadiusScaleFactor, "WellPipeRadiusScale", 0.1, "Pipe radius scale", "", "", "");
CAF_PDM_InitField(&pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe vertex count", "", "", "");
pipeCrossSectionVertexCount.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum(WELLPIPE_INTERPOLATED), "Well Pipe Coords", "", "", "");
CAF_PDM_InitField(&wellCellsToRangeFilterMode, "GlobalWellCellVisibility", WellCellsRangeFilterEnum(RANGE_ADD_NONE), "Add cells to range filter", "", "", "");
CAF_PDM_InitField(&showWellCellFences, "ShowWellFences", false, "Use well fence", "", "", "");
@@ -257,7 +269,8 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|| &showWellHead == changedField
|| &isAutoDetectingBranches == changedField
|| &wellHeadPosition == changedField
|| &wellLabelColor == changedField)
|| &wellLabelColor == changedField
|| &wellPipeCoordType == changedField)
{
if (m_reservoirView)
{
@@ -295,6 +308,7 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
caf::PdmUiGroup* wellPipe = uiOrdering.addNewGroup("Well pipe");
wellPipe->add(&wellPipeVisibility);
wellPipe->add(&pipeRadiusScaleFactor);
wellPipe->add(&wellPipeCoordType);
caf::PdmUiGroup* cellCenterSpheres = uiOrdering.addNewGroup("Well cell center spheres");
cellCenterSpheres->add(&wellSphereVisibility);

View File

@@ -80,6 +80,13 @@ public:
};
typedef caf::AppEnum<RimEclipseWellCollection::WellHeadPositionType> WellHeadPositionEnum;
enum WellPipeCoordType
{
WELLPIPE_CELLCENTER,
WELLPIPE_INTERPOLATED
};
typedef caf::AppEnum<RimEclipseWellCollection::WellPipeCoordType> WellPipeCoordEnum;
caf::PdmField<bool> showWellLabel;
caf::PdmField<cvf::Color3f> wellLabelColor;
@@ -94,6 +101,7 @@ public:
caf::PdmField<WellVisibilityEnum> wellPipeVisibility;
caf::PdmField<double> pipeRadiusScaleFactor;
caf::PdmField<int> pipeCrossSectionVertexCount;
caf::PdmField<WellPipeCoordEnum> wellPipeCoordType;
caf::PdmField<double> wellHeadScaleFactor;
caf::PdmField<bool> showWellHead;

View File

@@ -239,6 +239,8 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
RifReaderInterface::PorosityModelResultType poroModel = RifReaderInterface::MATRIX_RESULTS;
std::vector<QDateTime> timeStepDates = rigCaseData->results(poroModel)->timeStepDates(0);
std::vector<int> reportStepNumbers = rigCaseData->results(poroModel)->reportStepNumbers(0);
const std::vector<RigCaseCellResultsData::ResultInfo> resultInfos = rigCaseData->results(poroModel)->infoForEachResultIndex();
for (size_t i = 1; i < caseCollection()->reservoirs.size(); i++)
@@ -262,7 +264,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
if (mustBeCalculated) cellResultsStorage->cellResults()->setMustBeCalculated(scalarResultIndex);
cellResultsStorage->cellResults()->setTimeStepDates(scalarResultIndex, timeStepDates);
cellResultsStorage->cellResults()->setTimeStepDates(scalarResultIndex, timeStepDates, reportStepNumbers);
std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellResults()->cellScalarResults(scalarResultIndex);
dataValues.resize(timeStepDates.size());

View File

@@ -41,6 +41,8 @@
#include "cafPdmUiListEditor.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cvfBoundingBox.h"
namespace caf {

View File

@@ -19,6 +19,7 @@
#include "RimMainPlotCollection.h"
#include "RimFlowPlotCollection.h"
#include "RimProject.h"
#include "RimSummaryPlotCollection.h"
#include "RimWellLogPlotCollection.h"
@@ -44,8 +45,12 @@ RimMainPlotCollection::RimMainPlotCollection()
CAF_PDM_InitFieldNoDefault(&m_summaryPlotCollection, "SummaryPlotCollection", "Summary Plots", "", "", "");
m_summaryPlotCollection.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_flowPlotCollection, "FlowPlotCollection", "Flow Diagnostics Plots", "", "", "");
m_flowPlotCollection.uiCapability()->setUiHidden(true);
m_wellLogPlotCollection = new RimWellLogPlotCollection();
m_summaryPlotCollection = new RimSummaryPlotCollection();
m_flowPlotCollection = new RimFlowPlotCollection();
//m_plotMainWindow = NULL;
//m_plotManagerMainWindow = NULL;
@@ -56,8 +61,9 @@ RimMainPlotCollection::RimMainPlotCollection()
//--------------------------------------------------------------------------------------------------
RimMainPlotCollection::~RimMainPlotCollection()
{
if (m_wellLogPlotCollection()) delete m_wellLogPlotCollection();
if (m_summaryPlotCollection()) delete m_summaryPlotCollection();
if (m_wellLogPlotCollection()) delete m_wellLogPlotCollection();
if (m_summaryPlotCollection()) delete m_summaryPlotCollection();
if (m_flowPlotCollection()) delete m_flowPlotCollection();
//m_plotManagerMainWindow->close();
//m_plotManagerMainWindow->deleteLater();
@@ -148,6 +154,24 @@ RimSummaryPlotCollection* RimMainPlotCollection::summaryPlotCollection()
return m_summaryPlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowPlotCollection* RimMainPlotCollection::flowPlotCollection()
{
return m_flowPlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMainPlotCollection::deleteAllContainedObjects()
{
m_wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
m_summaryPlotCollection()->summaryPlots.deleteAllChildObjects();
m_flowPlotCollection()->flowPlots.deleteAllChildObjects();
}
#if 0
//--------------------------------------------------------------------------------------------------
///

View File

@@ -32,6 +32,7 @@ class RimSummaryPlotCollection;
class RimSummaryPlot;
class RifReaderEclipseSummary;
class RimEclipseResultCase;
class RimFlowPlotCollection;
//==================================================================================================
@@ -45,8 +46,11 @@ public:
RimMainPlotCollection();
virtual ~RimMainPlotCollection();
RimWellLogPlotCollection* wellLogPlotCollection();
RimSummaryPlotCollection* summaryPlotCollection();
RimWellLogPlotCollection* wellLogPlotCollection();
RimSummaryPlotCollection* summaryPlotCollection();
RimFlowPlotCollection* flowPlotCollection();
void deleteAllContainedObjects();
#if 0
// Separate Window stuff
@@ -78,6 +82,7 @@ protected:
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
caf::PdmField<bool> show;
};

View File

@@ -57,22 +57,23 @@ RimMultiSnapshotDefinition::RimMultiSnapshotDefinition()
//CAF_PDM_InitObject("MultiSnapshotDefinition", ":/Well.png", "", "");
CAF_PDM_InitObject("MultiSnapshotDefinition", "", "", "");
CAF_PDM_InitFieldNoDefault(&viewObject, "View", "View", "", "", "");
CAF_PDM_InitField(&isActive, "IsActive", true, "Active", "", "", "");
CAF_PDM_InitFieldNoDefault(&view, "View", "View", "", "", "");
CAF_PDM_InitFieldNoDefault(&eclipseResultType, "EclipseResultType", "Result Type", "", "", "");
CAF_PDM_InitFieldNoDefault(&selectedEclipseResults, "SelectedEclipseResults", "Result Name", "", "", "");
CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Timestep Start", "", "", "");
CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "Timestep End", "", "", "");
CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Timestep Start", "", "", "");
CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "Timestep End", "", "", "");
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(NO_RANGEFILTER), "Range Filter direction", "", "", "");
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 1, "RangeFilter Start", "", "", "");
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 1, "RangeFilter End", "", "", "");
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(NO_RANGEFILTER), "Range Filter direction", "", "", "");
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 1, "RangeFilter Start", "", "", "");
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 1, "RangeFilter End", "", "", "");
CAF_PDM_InitFieldNoDefault(&additionalCases, "AdditionalCases", "Case List", "", "", "");
CAF_PDM_InitFieldNoDefault(&additionalCases, "AdditionalCases", "Case List", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -89,8 +90,10 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
RimProject* proj = RiaApplication::instance()->project();
if (fieldNeedingOptions == &viewObject)
if (fieldNeedingOptions == &view)
{
options.push_back(caf::PdmOptionItemInfo("None", nullptr));
std::vector<RimView*> views;
RimProject* proj = RiaApplication::instance()->project();
@@ -118,10 +121,9 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
}
else if (fieldNeedingOptions == &selectedEclipseResults)
{
RimView* rimView = viewObject();
if (dynamic_cast<RimEclipseView*>(rimView))
RimEclipseView* rimEclipseView = dynamic_cast<RimEclipseView*>(view().p());
if (rimEclipseView)
{
RimEclipseView* rimEclipseView = dynamic_cast<RimEclipseView*>(rimView);
QStringList varList;
varList = rimEclipseView->currentGridCellResults()->cellResults()->resultNames(eclipseResultType());
@@ -151,9 +153,11 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
//--------------------------------------------------------------------------------------------------
void RimMultiSnapshotDefinition::getTimeStepStrings(QList<caf::PdmOptionItemInfo> &options)
{
if (!view()) return;
QStringList timeSteps;
timeSteps = viewObject->ownerCase()->timeStepStrings();
timeSteps = view->ownerCase()->timeStepStrings();
for (int i = 0; i < timeSteps.size(); i++)
{
@@ -175,10 +179,10 @@ void RimMultiSnapshotDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
const cvf::StructGridInterface* mainGrid = nullptr;
RigActiveCellInfo* actCellInfo = nullptr;
if (viewObject())
if (view())
{
mainGrid = viewObject()->rangeFilterCollection()->gridByIndex(0);
actCellInfo = viewObject()->rangeFilterCollection()->activeCellInfo();
mainGrid = view()->rangeFilterCollection()->gridByIndex(0);
actCellInfo = view()->rangeFilterCollection()->activeCellInfo();
}
if (mainGrid && actCellInfo)
@@ -236,3 +240,57 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::toOptionList(const QSt
}
return optionList;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiSnapshotDefinition::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
if (!isActive())
{
view.uiCapability()->setUiReadOnly(true);
eclipseResultType.uiCapability()->setUiReadOnly(true);
selectedEclipseResults.uiCapability()->setUiReadOnly(true);
timeStepStart.uiCapability()->setUiReadOnly(true);
timeStepEnd.uiCapability()->setUiReadOnly(true);
sliceDirection.uiCapability()->setUiReadOnly(true);
startSliceIndex.uiCapability()->setUiReadOnly(true);
endSliceIndex.uiCapability()->setUiReadOnly(true);
additionalCases.uiCapability()->setUiReadOnly(true);
}
else
{
view.uiCapability()->setUiReadOnly(false);
if (!view())
{
eclipseResultType.uiCapability()->setUiReadOnly(true);
selectedEclipseResults.uiCapability()->setUiReadOnly(true);
timeStepStart.uiCapability()->setUiReadOnly(true);
timeStepEnd.uiCapability()->setUiReadOnly(true);
sliceDirection.uiCapability()->setUiReadOnly(true);
startSliceIndex.uiCapability()->setUiReadOnly(true);
endSliceIndex.uiCapability()->setUiReadOnly(true);
additionalCases.uiCapability()->setUiReadOnly(true);
}
else
{
eclipseResultType.uiCapability()->setUiReadOnly(false);
selectedEclipseResults.uiCapability()->setUiReadOnly(false);
timeStepStart.uiCapability()->setUiReadOnly(false);
timeStepEnd.uiCapability()->setUiReadOnly(false);
sliceDirection.uiCapability()->setUiReadOnly(false);
additionalCases.uiCapability()->setUiReadOnly(false);
bool rangeReadOnly = false;
if (sliceDirection() == NO_RANGEFILTER)
{
rangeReadOnly = true;
}
startSliceIndex.uiCapability()->setUiReadOnly(rangeReadOnly);
endSliceIndex.uiCapability()->setUiReadOnly(rangeReadOnly);
}
}
}

View File

@@ -40,7 +40,9 @@ public:
RimMultiSnapshotDefinition();
virtual ~RimMultiSnapshotDefinition();
caf::PdmPtrField<RimView*> viewObject;
caf::PdmField<bool> isActive;
caf::PdmPtrField<RimView*> view;
caf::PdmField< caf::AppEnum< RimDefines::ResultCatType > > eclipseResultType;
caf::PdmField< std::vector<QString> > selectedEclipseResults;
@@ -62,6 +64,9 @@ public:
caf::PdmPtrArrayField<RimCase*> additionalCases;
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;

View File

@@ -33,6 +33,7 @@
#include "RimContextCommandBuilder.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimFlowPlotCollection.h"
#include "RimFormationNamesCollection.h"
#include "RimFractureDefinitionCollection.h"
#include "RimGeoMechCase.h"
@@ -162,14 +163,9 @@ RimProject::~RimProject(void)
//--------------------------------------------------------------------------------------------------
void RimProject::close()
{
if (mainPlotCollection() && mainPlotCollection()->wellLogPlotCollection())
if (mainPlotCollection())
{
mainPlotCollection()->wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
}
if (mainPlotCollection() && mainPlotCollection()->summaryPlotCollection())
{
mainPlotCollection()->summaryPlotCollection()->m_summaryPlots.deleteAllChildObjects();
mainPlotCollection()->deleteAllContainedObjects();
}
oilFields.deleteAllChildObjects();
@@ -811,10 +807,16 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
{
uiTreeOrdering.add(mainPlotCollection->wellLogPlotCollection());
}
if (mainPlotCollection->summaryPlotCollection())
{
uiTreeOrdering.add(mainPlotCollection->summaryPlotCollection());
}
if (mainPlotCollection->flowPlotCollection())
{
uiTreeOrdering.add(mainPlotCollection->flowPlotCollection());
}
}
}
else

View File

@@ -1436,7 +1436,7 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
RimReservoirCellResultsStorageEntryInfo* resInfo = m_resultCacheMetaData[rIdx];
size_t resultIndex = m_cellResults->addEmptyScalarResult(resInfo->m_resultType(), resInfo->m_resultName(), true);
m_cellResults->setTimeStepDates(resultIndex, resInfo->m_timeStepDates());
m_cellResults->setTimeStepDates(resultIndex, resInfo->m_timeStepDates(), std::vector<int>()); // Hack: Using no report step numbers. Not really used except for Flow Diagnostics...
progress.setProgressDescription(resInfo->m_resultName);

View File

@@ -250,8 +250,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
m_eclipseResultDefinition->loadResult();
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createFromResultDefinition(eclipseCase->reservoirData(),
0,
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createFromResultDefinition(0,
m_timeStep,
m_eclipseResultDefinition);

View File

@@ -40,8 +40,8 @@ RimSummaryPlotCollection::RimSummaryPlotCollection()
{
CAF_PDM_InitObject("Summary Plots", ":/SummaryPlots16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_summaryPlots, "SummaryPlots", "Summary Plots", "", "", "");
m_summaryPlots.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&summaryPlots, "SummaryPlots", "Summary Plots", "", "", "");
summaryPlots.uiCapability()->setUiHidden(true);
}
@@ -50,7 +50,7 @@ RimSummaryPlotCollection::RimSummaryPlotCollection()
//--------------------------------------------------------------------------------------------------
RimSummaryPlotCollection::~RimSummaryPlotCollection()
{
m_summaryPlots.deleteAllChildObjects();
summaryPlots.deleteAllChildObjects();
for (auto it = m_summaryFileReaders.begin(); it != m_summaryFileReaders.end(); it++)
{
@@ -124,7 +124,7 @@ RifReaderEclipseSummary* RimSummaryPlotCollection::createSummaryFileReader(const
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotCollection::updateSummaryNameHasChanged()
{
for (RimSummaryPlot* plot : m_summaryPlots)
for (RimSummaryPlot* plot : summaryPlots)
{
plot->updateCaseNameHasChanged();
}

View File

@@ -43,7 +43,7 @@ public:
RifReaderEclipseSummary* getOrCreateSummaryFileReader(const RimEclipseResultCase* eclipseCase);
caf::PdmChildArrayField<RimSummaryPlot*> m_summaryPlots;
caf::PdmChildArrayField<RimSummaryPlot*> summaryPlots;
void updateSummaryNameHasChanged();
private: