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

@@ -39,6 +39,7 @@ ${CEE_CURRENT_LIST_DIR}RiuWellLogTrack.h
${CEE_CURRENT_LIST_DIR}RiuGeoMechXfTensorResultAccessor.h
${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.h
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -76,6 +77,7 @@ ${CEE_CURRENT_LIST_DIR}RiuWellLogTrack.cpp
${CEE_CURRENT_LIST_DIR}RiuGeoMechXfTensorResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.cpp
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.cpp
)
list(APPEND CODE_HEADER_FILES
@@ -102,6 +104,7 @@ ${CEE_CURRENT_LIST_DIR}RiuRecentFileActionProvider.h
${CEE_CURRENT_LIST_DIR}RiuSummaryQwtPlot.h
${CEE_CURRENT_LIST_DIR}RiuQwtScalePicker.h
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.h
)
list(APPEND QT_UI_FILES

View File

@@ -23,6 +23,8 @@
#include "RicExportMultipleSnapshotsFeature.h"
#include "RimCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimMultiSnapshotDefinition.h"
#include "RimProject.h"
#include "RimView.h"
@@ -64,6 +66,7 @@ RiuExportMultipleSnapshotsWidget::RiuExportMultipleSnapshotsWidget(QWidget* pare
m_pdmTableView = new caf::PdmUiTableView(this);
m_pdmTableView->tableView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_pdmTableView->tableView()->setContextMenuPolicy(Qt::CustomContextMenu);
m_pdmTableView->enableHeaderText(false);
connect(m_pdmTableView->tableView(), SIGNAL(customContextMenuRequested(QPoint)), SLOT(customMenuRequested(QPoint)));
@@ -137,15 +140,48 @@ void RiuExportMultipleSnapshotsWidget::addSnapshotItemFromActiveView()
if (activeView)
{
RimMultiSnapshotDefinition* multiSnapshot = new RimMultiSnapshotDefinition();
multiSnapshot->viewObject = activeView;
multiSnapshot->view = activeView;
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(activeView);
if (eclipseView)
{
multiSnapshot->eclipseResultType = eclipseView->cellResult->resultType();
multiSnapshot->selectedEclipseResults.v().push_back(eclipseView->cellResult->resultVariable());
}
multiSnapshot->timeStepStart = activeView->currentTimeStep();
multiSnapshot->timeStepEnd = activeView->currentTimeStep();
RimCase* sourceCase = nullptr;
activeView->firstAncestorOrThisOfType(sourceCase);
if (sourceCase)
{
multiSnapshot->additionalCases().push_back(sourceCase);
}
m_rimProject->multiSnapshotDefinitions.push_back(multiSnapshot);
m_rimProject->multiSnapshotDefinitions.uiCapability()->updateConnectedEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuExportMultipleSnapshotsWidget::addEmptySnapshotItems(size_t itemCount)
{
if (!m_rimProject) return;
for (size_t i = 0; i < itemCount; i++)
{
RimMultiSnapshotDefinition* multiSnapshot = new RimMultiSnapshotDefinition();
multiSnapshot->isActive = false;
m_rimProject->multiSnapshotDefinitions.push_back(multiSnapshot);
}
m_rimProject->multiSnapshotDefinitions.uiCapability()->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -214,24 +250,5 @@ void RiuExportMultipleSnapshotsWidget::folderSelectionClicked()
//--------------------------------------------------------------------------------------------------
void RiuExportMultipleSnapshotsWidget::addSnapshotItem()
{
if (!m_rimProject) return;
if (m_rimProject->multiSnapshotDefinitions.size() == 0)
{
addSnapshotItemFromActiveView();
}
else
{
//Getting default value from last entered line:
RimMultiSnapshotDefinition* other = m_rimProject->multiSnapshotDefinitions[m_rimProject->multiSnapshotDefinitions.size() - 1];
RimMultiSnapshotDefinition* multiSnapshot = new RimMultiSnapshotDefinition();
multiSnapshot->viewObject = other->viewObject();
multiSnapshot->timeStepStart = other->timeStepStart();
multiSnapshot->timeStepEnd = other->timeStepEnd();
m_rimProject->multiSnapshotDefinitions.push_back(multiSnapshot);
m_rimProject->multiSnapshotDefinitions.uiCapability()->updateConnectedEditors();
}
addSnapshotItemFromActiveView();
}

View File

@@ -37,6 +37,7 @@ public:
~RiuExportMultipleSnapshotsWidget();
void addSnapshotItemFromActiveView();
void addEmptySnapshotItems(size_t itemCount);
private slots:
void customMenuRequested(QPoint pos);

View File

@@ -26,6 +26,7 @@
#include "RimSummaryPlot.h"
#include "RimTreeViewStateSerializer.h"
#include "RimViewWindow.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogPlot.h"
#include "RiuDragDrop.h"
@@ -33,6 +34,7 @@
#include "RiuSummaryQwtPlot.h"
#include "RiuToolTipMenu.h"
#include "RiuTreeViewEventFilter.h"
#include "RiuWellAllocationPlot.h"
#include "RiuWellLogPlot.h"
#include "cafCmdFeatureManager.h"
@@ -498,6 +500,24 @@ void RiuMainPlotWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
RiaApplication::instance()->setActiveSummaryPlot(NULL);
}
}
{
RiuWellAllocationPlot* wellAllocationPlotWidget = dynamic_cast<RiuWellAllocationPlot*>(subWindow->widget());
if (wellAllocationPlotWidget)
{
RimWellAllocationPlot* wellAllocationPlot = wellAllocationPlotWidget->ownerPlotDefinition();
if (wellAllocationPlot != RiaApplication::instance()->activeWellAllocationPlot())
{
RiaApplication::instance()->setActiveWellAllocationPlot(wellAllocationPlot);
projectTreeView()->selectAsCurrentItem(wellAllocationPlot);
}
}
else
{
RiaApplication::instance()->setActiveWellAllocationPlot(nullptr);
}
}
}
//--------------------------------------------------------------------------------------------------
@@ -575,10 +595,9 @@ void RiuMainPlotWindow::selectedObjectsChanged()
// Well log plot
bool isActiveWellLogPlotChanged = false;
bool isActiveObjectChanged = false;
RimWellLogPlot* selectedWellLogPlot = dynamic_cast<RimWellLogPlot*>(firstSelectedObject);
if (!selectedWellLogPlot)
{
firstSelectedObject->firstAncestorOrThisOfType(selectedWellLogPlot);
@@ -590,20 +609,13 @@ void RiuMainPlotWindow::selectedObjectsChanged()
{
setActiveViewer(selectedWellLogPlot->viewWidget());
}
isActiveWellLogPlotChanged = true;
}
if (isActiveWellLogPlotChanged)
{
isActiveObjectChanged = true;
RiaApplication::instance()->setActiveWellLogPlot(selectedWellLogPlot);
}
// Summary plot
bool isActiveSummaryPlotChanged = false;
RimSummaryPlot* selectedSummaryPlot = dynamic_cast<RimSummaryPlot*>(firstSelectedObject);
if (!selectedSummaryPlot)
{
firstSelectedObject->firstAncestorOrThisOfType(selectedSummaryPlot);
@@ -615,15 +627,31 @@ void RiuMainPlotWindow::selectedObjectsChanged()
{
setActiveViewer(selectedSummaryPlot->viewWidget());
}
isActiveSummaryPlotChanged = true;
}
if (isActiveSummaryPlotChanged)
{
isActiveObjectChanged = true;
RiaApplication::instance()->setActiveSummaryPlot(selectedSummaryPlot);
}
if (isActiveWellLogPlotChanged || isActiveSummaryPlotChanged)
// Flow plot
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(firstSelectedObject);
if (!wellAllocationPlot)
{
firstSelectedObject->firstAncestorOrThisOfType(wellAllocationPlot);
}
if (wellAllocationPlot)
{
if (wellAllocationPlot->viewWidget())
{
setActiveViewer(wellAllocationPlot->viewWidget());
}
isActiveObjectChanged = true;
RiaApplication::instance()->setActiveWellAllocationPlot(wellAllocationPlot);
}
if (isActiveObjectChanged)
{
// The only way to get to this code is by selection change initiated from the project tree view
// As we are activating an MDI-window, the focus is given to this MDI-window

View File

@@ -56,6 +56,8 @@
#include "cafPdmUiTreeView.h"
#include "cafSelectionManager.h"
#include "cvfTimer.h"
#include <QAction>
#include <QCloseEvent>
#include <QDir>
@@ -71,6 +73,7 @@
//==================================================================================================
///
/// \class RiuMainWindow

View File

@@ -494,7 +494,7 @@ void RiuResultTextBuilder::appendTextFromResultColors(RigEclipseCaseData* eclips
}
else
{
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, gridIndex, timeStepIndex, resultColors);
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(gridIndex, timeStepIndex, resultColors);
}
if (resultAccessor.notNull())
@@ -516,33 +516,42 @@ QString RiuResultTextBuilder::cellEdgeResultDetails()
if (m_reservoirView->cellEdgeResult()->hasResult())
{
std::vector<RimCellEdgeMetaData> metaData;
m_reservoirView->cellEdgeResult()->cellEdgeMetaData(&metaData);
std::set<size_t> uniqueResultIndices;
text += "-- Cell edge result data --\n";
for (int idx = 0; idx < 6; idx++)
if (m_reservoirView->cellEdgeResult()->isUsingSingleVariable())
{
size_t resultIndex = metaData[idx].m_resultIndex;
if (resultIndex == cvf::UNDEFINED_SIZE_T) continue;
text += cellResultText(m_reservoirView->cellEdgeResult()->singleVarEdgeResultColors());
text += "\n";
}
else
{
std::vector<RimCellEdgeMetaData> metaData;
m_reservoirView->cellEdgeResult()->cellEdgeMetaData(&metaData);
std::set<size_t> uniqueResultIndices;
for (int idx = 0; idx < 6; idx++)
{
size_t resultIndex = metaData[idx].m_resultIndex;
if (resultIndex == cvf::UNDEFINED_SIZE_T) continue;
if (uniqueResultIndices.find(resultIndex) != uniqueResultIndices.end()) continue;
if (uniqueResultIndices.find(resultIndex) != uniqueResultIndices.end()) continue;
size_t adjustedTimeStep = m_timeStepIndex;
if (metaData[idx].m_isStatic)
{
adjustedTimeStep = 0;
}
size_t adjustedTimeStep = m_timeStepIndex;
if (metaData[idx].m_isStatic)
{
adjustedTimeStep = 0;
}
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_reservoirView->cellResult()->porosityModel());
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_reservoirView->eclipseCase()->reservoirData(), m_gridIndex, porosityModel, adjustedTimeStep, resultIndex);
if (resultAccessor.notNull())
{
double scalarValue = resultAccessor->cellScalar(m_cellIndex);
text.append(QString("%1 : %2\n").arg(metaData[idx].m_resultVariable).arg(scalarValue));
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_reservoirView->cellResult()->porosityModel());
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_reservoirView->eclipseCase()->reservoirData(), m_gridIndex, porosityModel, adjustedTimeStep, resultIndex);
if (resultAccessor.notNull())
{
double scalarValue = resultAccessor->cellScalar(m_cellIndex);
text.append(QString("%1 : %2\n").arg(metaData[idx].m_resultVariable).arg(scalarValue));
uniqueResultIndices.insert(resultIndex);
uniqueResultIndices.insert(resultIndex);
}
}
}
}
@@ -691,7 +700,7 @@ QString RiuResultTextBuilder::cellResultText(RimEclipseCellColors* resultColors)
adjustedTimeStep = 0;
}
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCaseData, m_gridIndex, adjustedTimeStep, resultColors);
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(m_gridIndex, adjustedTimeStep, resultColors);
if (resultAccessor.notNull())
{
double scalarValue = resultAccessor->cellFaceScalar(m_cellIndex, m_face);

View File

@@ -23,9 +23,11 @@
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RiuFemTimeHistoryResultAccessor.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultsCollection.h"
#include "RigGeoMechCaseData.h"
#include "RigTimeHistoryResultAccessor.h"
#include "RiuFemTimeHistoryResultAccessor.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
@@ -37,15 +39,13 @@
#include "RiuFemResultTextBuilder.h"
#include "RiuMainWindow.h"
#include "RiuResultQwtPlot.h"
#include "RiuResultTextBuilder.h"
#include "RiuSelectionManager.h"
#include "RiuResultQwtPlot.h"
#include <QStatusBar>
#include <assert.h>
#include "RigFemPartResultsCollection.h"
#include "RigFemPartCollection.h"
//--------------------------------------------------------------------------------------------------
///
@@ -104,8 +104,10 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuEclipseSelec
RimEclipseView* eclipseView = eclipseSelectionItem->m_view.p();
if (eclipseView->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
// Todo
{
// NB! Do not read out data for flow results, as this can be a time consuming operation
return;
}
else if (eclipseView->cellResult()->hasDynamicResult() &&
eclipseView->eclipseCase() &&
@@ -117,19 +119,15 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuEclipseSelec
eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->maxTimeStepCount(&scalarIndexWithMaxTimeStepCount);
std::vector<QDateTime> timeStepDates = eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->timeStepDates(scalarIndexWithMaxTimeStepCount);
RigTimeHistoryResultAccessor timeHistResultAccessor(eclipseView->eclipseCase()->reservoirData(),
eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_cellIndex,
eclipseView->cellResult()->scalarResultIndex(), porosityModel);
QString curveName = eclipseView->eclipseCase()->caseUserDescription();
curveName += ", ";
curveName += eclipseView->cellResult()->resultVariableUiName();
curveName += eclipseView->cellResult()->resultVariableUiShortName();
curveName += ", ";
curveName += QString("Grid index %1").arg(eclipseSelectionItem->m_gridIndex);
curveName += ", ";
curveName += timeHistResultAccessor.topologyText();
curveName += RigTimeHistoryResultAccessor::topologyText(eclipseView->eclipseCase()->reservoirData(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_cellIndex);
std::vector<double> timeHistoryValues = timeHistResultAccessor.timeHistoryValues();
std::vector<double> timeHistoryValues = RigTimeHistoryResultAccessor::timeHistoryValues(eclipseView->cellResult(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_cellIndex, timeStepDates.size());
CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size());
RiuMainWindow::instance()->resultPlot()->addCurve(curveName, eclipseSelectionItem->m_color, timeStepDates, timeHistoryValues);

View File

@@ -319,6 +319,8 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
caf::SelectionManager::instance()->setSelectedItem(well);
commandIds << "RicNewSimWellIntersectionFeature";
commandIds << "RicNewSimWellIntersectionFeature";
commandIds << "RicShowWellAllocationPlotFeature";
size_t gridIndex = cvf::UNDEFINED_SIZE_T;
size_t gridCellIndex = cvf::UNDEFINED_SIZE_T;

View File

@@ -0,0 +1,80 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RiuWellAllocationPlot.h"
#include "RiaApplication.h"
#include "RimWellAllocationPlot.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
: QwtPlot(parent)
{
Q_ASSERT(plotDefinition);
m_plotDefinition = plotDefinition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::~RiuWellAllocationPlot()
{
if (m_plotDefinition)
{
m_plotDefinition->handleViewerDeletion();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlot* RiuWellAllocationPlot::ownerPlotDefinition()
{
return m_plotDefinition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellAllocationPlot::minimumSizeHint() const
{
return QSize(0, 100);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellAllocationPlot::sizeHint() const
{
return QSize(0, 0);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::setDefaults()
{
}

View File

@@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "qwt_plot.h"
#include "cafPdmPointer.h"
#include <QPointer>
class RimWellAllocationPlot;
//==================================================================================================
//
//
//
//==================================================================================================
class RiuWellAllocationPlot : public QwtPlot
{
Q_OBJECT;
public:
RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent = NULL);
virtual ~RiuWellAllocationPlot();
RimWellAllocationPlot* ownerPlotDefinition();
protected:
virtual QSize sizeHint() const override;
virtual QSize minimumSizeHint() const override;
private:
void setDefaults();
private:
caf::PdmPointer<RimWellAllocationPlot> m_plotDefinition;
};