Merge branch 'dev' into hdf-prototype

This commit is contained in:
Magne Sjaastad 2017-03-24 11:43:37 +01:00
commit 9b27e4cd37
161 changed files with 5353 additions and 1781 deletions

View File

@ -2412,7 +2412,7 @@ bool RiaApplication::addEclipseCases(const QStringList& fileNames)
bool identicalGrid = RigGridManager::isGridDimensionsEqual(mainCaseGridDimensions, caseGridDimensions);
if (identicalGrid)
{
if (rimResultReservoir->openAndReadActiveCellData(mainResultCase->reservoirData()))
if (rimResultReservoir->openAndReadActiveCellData(mainResultCase->eclipseCaseData()))
{
RimOilField* oilField = m_project->activeOilField();
if (oilField && oilField->analysisModels())

View File

@ -191,7 +191,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
uiOrdering.add(&defaultCurveFilter);
}
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -17,6 +17,7 @@ ${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.h
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.h
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.h
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.h
${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -32,6 +33,7 @@ ${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.cpp
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.cpp
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.cpp
)
list(APPEND CODE_HEADER_FILES
@ -42,10 +44,10 @@ list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
#set (QT_MOC_HEADERS
#${QT_MOC_HEADERS}
#${CEE_CURRENT_LIST_DIR}RicBoxManipulatorEventHandler.h
#)
set (QT_MOC_HEADERS
${QT_MOC_HEADERS}
${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.h
)
source_group( "CommandFeature\\Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )

View File

@ -0,0 +1,232 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicShowPlotDataFeature.h"
#include "RiaApplication.h"
#include "RimSummaryPlot.h"
#include "RimWellLogPlot.h"
#include "RiuMainPlotWindow.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QBoxLayout>
#include <QClipboard>
#include <QMenu>
#include <QPlainTextEdit>
CAF_CMD_SOURCE_INIT(RicShowPlotDataFeature, "RicShowPlotDataFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowPlotDataFeature::isCommandEnabled()
{
std::vector<RimSummaryPlot*> selectedSummaryPlots;
caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
if (selectedSummaryPlots.size() > 0) return true;
std::vector<RimWellLogPlot*> wellLogPlots;
caf::SelectionManager::instance()->objectsByType(&wellLogPlots);
if (wellLogPlots.size() > 0) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowPlotDataFeature::onActionTriggered(bool isChecked)
{
std::vector<RimSummaryPlot*> selectedSummaryPlots;
caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
std::vector<RimWellLogPlot*> wellLogPlots;
caf::SelectionManager::instance()->objectsByType(&wellLogPlots);
if (selectedSummaryPlots.size() == 0 && wellLogPlots.size() == 0)
{
CVF_ASSERT(false);
return;
}
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
CVF_ASSERT(plotwindow);
for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
{
QString title = summaryPlot->description();
QString text = summaryPlot->asciiDataForPlotExport();
RicShowPlotDataFeature::showTextWindow(title, text);
}
for (RimWellLogPlot* wellLogPlot : wellLogPlots)
{
QString title = wellLogPlot->description();
QString text = wellLogPlot->asciiDataForPlotExport();
RicShowPlotDataFeature::showTextWindow(title, text);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowPlotDataFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Show Plot Data");
actionToSetup->setIcon(QIcon(":/PlotWindow24x24.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowPlotDataFeature::showTextWindow(const QString& title, const QString& text)
{
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
CVF_ASSERT(plotwindow);
RicTextWidget* textWiget = new RicTextWidget(plotwindow);
textWiget->setMinimumSize(400, 600);
textWiget->setWindowTitle(title);
textWiget->setText(text);
textWiget->show();
plotwindow->addToTemporaryWidgets(textWiget);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicTextWidget::RicTextWidget(QWidget* parent) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
{
m_textEdit = new QPlainTextEdit(this);
m_textEdit->setReadOnly(true);
m_textEdit->setLineWrapMode(QPlainTextEdit::NoWrap);
QFont font("Courier", 8);
m_textEdit->setFont(font);
m_textEdit->setContextMenuPolicy(Qt::NoContextMenu);
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget(m_textEdit);
setLayout(layout);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicTextWidget::setText(const QString& text)
{
m_textEdit->setPlainText(text);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicTextWidget::slotCopyContentToClipboard()
{
QTextCursor cursor(m_textEdit->textCursor());
QString textForClipboard;
QString selText = cursor.selectedText();
if (!selText.isEmpty())
{
QTextDocument doc;
doc.setPlainText(selText);
textForClipboard = doc.toPlainText();
}
if (textForClipboard.isEmpty())
{
textForClipboard = m_textEdit->toPlainText();
}
if (!textForClipboard.isEmpty())
{
QClipboard* clipboard = QApplication::clipboard();
if (clipboard)
{
clipboard->setText(textForClipboard);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicTextWidget::slotSelectAll()
{
m_textEdit->selectAll();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicTextWidget::contextMenuEvent(QContextMenuEvent* event)
{
QMenu menu;
{
QAction* actionToSetup = new QAction(this);
actionToSetup->setText("Copy");
actionToSetup->setIcon(QIcon(":/Copy.png"));
actionToSetup->setShortcuts(QKeySequence::Copy);
connect(actionToSetup, SIGNAL(triggered()), this, SLOT(slotCopyContentToClipboard()));
menu.addAction(actionToSetup);
}
{
QAction* actionToSetup = new QAction(this);
actionToSetup->setText("Select All");
actionToSetup->setShortcuts(QKeySequence::SelectAll);
connect(actionToSetup, SIGNAL(triggered()), this, SLOT(slotSelectAll()));
menu.addAction(actionToSetup);
}
menu.exec(event->globalPos());
}

View File

@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"
#include <QDialog>
class QPlainTextEdit;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RicTextWidget : public QDialog
{
Q_OBJECT
public:
explicit RicTextWidget(QWidget* parent = 0);
void setText(const QString& text);
private slots:
void slotCopyContentToClipboard();
void slotSelectAll();
private:
QPlainTextEdit* m_textEdit;
protected:
virtual void contextMenuEvent(QContextMenuEvent *) override;
};
//==================================================================================================
///
//==================================================================================================
class RicShowPlotDataFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
private:
static void showTextWindow(const QString& title, const QString& text);
};

View File

@ -112,11 +112,11 @@ void RicEclipsePropertyFilterFeatureImpl::setDefaults(RimEclipsePropertyFilter*
{
CVF_ASSERT(propertyFilter);
RimEclipsePropertyFilterCollection* propertyFilterCollection = propertyFilter->parentContainer();
CVF_ASSERT(propertyFilterCollection);
RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
propertyFilter->firstAncestorOrThisOfTypeAsserted(propertyFilterCollection);
RimEclipseView* reservoirView = propertyFilterCollection->reservoirView();
CVF_ASSERT(reservoirView);
RimEclipseView* reservoirView = nullptr;
propertyFilter->firstAncestorOrThisOfTypeAsserted(reservoirView);
propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase());
propertyFilter->resultDefinition->simpleCopy(reservoirView->cellResult);

View File

@ -57,8 +57,8 @@ QString RicEclipsePropertyFilterInsertExec::name()
//--------------------------------------------------------------------------------------------------
void RicEclipsePropertyFilterInsertExec::redo()
{
RimEclipsePropertyFilterCollection* propertyFilterCollection = m_propertyFilter->parentContainer();
CVF_ASSERT(propertyFilterCollection);
RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
m_propertyFilter->firstAncestorOrThisOfTypeAsserted(propertyFilterCollection);
size_t index = propertyFilterCollection->propertyFilters.index(m_propertyFilter);
CVF_ASSERT(index < propertyFilterCollection->propertyFilters.size());

View File

@ -99,7 +99,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Eclipse Property to Text File", "");
if (propertyDialog.exec() == QDialog::Accepted)
{
bool isOk = RifEclipseInputFileTools::writePropertyToTextFile(exportSettings.fileName, inputReservoir->reservoirData(), 0, inputProperty->resultName, exportSettings.eclipseKeyword);
bool isOk = RifEclipseInputFileTools::writePropertyToTextFile(exportSettings.fileName, inputReservoir->eclipseCaseData(), 0, inputProperty->resultName, exportSettings.eclipseKeyword);
if (isOk)
{
inputProperty->fileName = exportSettings.fileName;
@ -116,7 +116,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicSaveEclipseInputPropertyFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Save Property To File");
actionToSetup->setText("Export Property To File");
}
//--------------------------------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ RicSaveEclipseResultAsInputPropertyExec::~RicSaveEclipseResultAsInputPropertyExe
//--------------------------------------------------------------------------------------------------
QString RicSaveEclipseResultAsInputPropertyExec::name()
{
return "Save Property To File";
return "Export Property To File";
}
//--------------------------------------------------------------------------------------------------
@ -72,7 +72,7 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
if (!m_cellColors->reservoirView()) return;
if (!m_cellColors->reservoirView()->eclipseCase()) return;
if (!m_cellColors->reservoirView()->eclipseCase()->reservoirData()) return;
if (!m_cellColors->reservoirView()->eclipseCase()->eclipseCaseData()) return;
RimBinaryExportSettings exportSettings;
exportSettings.eclipseKeyword = m_cellColors->resultVariable();
@ -96,7 +96,7 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
size_t timeStep = m_cellColors->reservoirView()->currentTimeStep();
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_cellColors->porosityModel());
bool isOk = RifEclipseInputFileTools::writeBinaryResultToTextFile(exportSettings.fileName, m_cellColors->reservoirView()->eclipseCase()->reservoirData(), porosityModel, timeStep, m_cellColors->resultVariable(), exportSettings.eclipseKeyword, exportSettings.undefinedValue);
bool isOk = RifEclipseInputFileTools::writeBinaryResultToTextFile(exportSettings.fileName, m_cellColors->reservoirView()->eclipseCase()->eclipseCaseData(), porosityModel, timeStep, m_cellColors->resultVariable(), exportSettings.eclipseKeyword, exportSettings.undefinedValue);
if (!isOk)
{
QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName);

View File

@ -61,7 +61,7 @@ void RicSaveEclipseResultAsInputPropertyFeature::onActionTriggered(bool isChecke
//--------------------------------------------------------------------------------------------------
void RicSaveEclipseResultAsInputPropertyFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Save Property To File");
actionToSetup->setText("Export Property To File");
}

View File

@ -89,7 +89,7 @@ void RicShowContributingWellsFeature::onActionTriggered(bool isChecked)
RimEclipseResultCase* eclipseResultCase = nullptr;
well->firstAncestorOrThisOfTypeAsserted(eclipseResultCase);
RimEclipseView* modifiedView = RicShowContributingWellsFeatureImpl::showViewSelection(eclipseResultCase, well->name(), eclipseView->currentTimeStep());
RimEclipseView* modifiedView = RicShowContributingWellsFeatureImpl::maniuplateSelectedView(eclipseResultCase, well->name(), eclipseView->currentTimeStep());
if (modifiedView)
{
modifiedView->createDisplayModelAndRedraw();

View File

@ -46,7 +46,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseView* RicShowContributingWellsFeatureImpl::showViewSelection(RimEclipseResultCase* eclipseResultCase, QString wellName, int timeStep)
RimEclipseView* RicShowContributingWellsFeatureImpl::maniuplateSelectedView(RimEclipseResultCase* eclipseResultCase, QString wellName, int timeStep)
{
const QString lastUsedViewKey("lastUsedViewKey");

View File

@ -34,7 +34,7 @@ class RimFlowDiagSolution;
class RicShowContributingWellsFeatureImpl
{
public:
static RimEclipseView* showViewSelection(RimEclipseResultCase* wellAllocationResultCase, QString wellName, int timeStep);
static RimEclipseView* maniuplateSelectedView(RimEclipseResultCase* wellAllocationResultCase, QString wellName, int timeStep);
private:
static void modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName, int timeStep);

View File

@ -35,7 +35,10 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributin
//--------------------------------------------------------------------------------------------------
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
{
return true;
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
if (wellAllocationPlot) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
@ -52,7 +55,7 @@ void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
RimEclipseResultCase* wellAllocationResultCase = nullptr;
wellAllocationPlot->flowDiagSolution()->firstAncestorOrThisOfTypeAsserted(wellAllocationResultCase);
RicShowContributingWellsFeatureImpl::showViewSelection(wellAllocationResultCase, wellName, timeStep);
RicShowContributingWellsFeatureImpl::maniuplateSelectedView(wellAllocationResultCase, wellName, timeStep);
}
//--------------------------------------------------------------------------------------------------

View File

@ -41,18 +41,12 @@ CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlot
//--------------------------------------------------------------------------------------------------
bool RicShowWellAllocationPlotFeature::isCommandEnabled()
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return false;
std::vector<RimEclipseWell*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
RimEclipseResultCase* eclCase = nullptr;
activeView->firstAncestorOrThisOfType(eclCase);
if (eclCase)
if (collection.size() > 0)
{
RimFlowDiagSolution* defaultFlowDiagSolution = eclCase->defaultFlowDiagSolution();
if (defaultFlowDiagSolution)
{
return true;
}
return true;
}
return false;

View File

@ -23,11 +23,9 @@
#include "RimEclipseView.h"
#include "RimGeoMechView.h"
#include "RimMimeData.h"
#include "RimSummaryCurve.h"
#include "RimSummaryCurveFilter.h"
#include "RimSummaryPlot.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
@ -142,7 +140,7 @@ bool RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported(PdmObject* pdm
{
return true;
}
else if (dynamic_cast<RimSummaryCurve*>(pdmObject))
else if (dynamic_cast<RimPlotCurve*>(pdmObject))
{
return true;
}
@ -150,10 +148,6 @@ bool RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported(PdmObject* pdm
{
return true;
}
else if (dynamic_cast<RimWellLogCurve*>(pdmObject))
{
if (!wellAllocPlot) return true;
}
else if (dynamic_cast<RimWellLogTrack*>(pdmObject))
{
if (!wellAllocPlot) return true;

View File

@ -179,7 +179,7 @@ void RicPasteEclipseCasesFeature::addCasesToGridCaseGroup(PdmObjectGroup& object
continue;
}
if (!rimResultReservoir->openAndReadActiveCellData(mainResultCase->reservoirData()))
if (!rimResultReservoir->openAndReadActiveCellData(mainResultCase->eclipseCaseData()))
{
CVF_ASSERT(false);
}

View File

@ -29,6 +29,7 @@
#include "RimFormationNamesCollection.h"
#include "RimGeoMechPropertyFilter.h"
#include "RimGeoMechView.h"
#include "RimGridTimeHistoryCurve.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimIntersection.h"
#include "RimIntersectionBox.h"
@ -85,6 +86,7 @@ bool isDeletable(PdmUiItem * uiItem)
if (dynamic_cast<RimWellLogCurve*>(uiItem)) return true;
if (dynamic_cast<RimSummaryPlot*>(uiItem)) return true;
if (dynamic_cast<RimSummaryCurve*>(uiItem)) return true;
if (dynamic_cast<RimGridTimeHistoryCurve*>(uiItem)) return true;
if (dynamic_cast<RimSummaryCurveFilter*>(uiItem)) return true;
if (dynamic_cast<RimIntersection*>(uiItem)) return true;
if (dynamic_cast<RimIntersectionBox*>(uiItem)) return true;

View File

@ -88,7 +88,7 @@ void RicExportFaultsFeature::onActionTriggered(bool isChecked)
QString completeFilename = selectedDir + "/" + baseFilename + ".grdecl";
RicExportFaultsFeature::saveFault(completeFilename, eclCase->reservoirData()->mainGrid(), rimFault->faultGeometry()->faultFaces(), faultName);
RicExportFaultsFeature::saveFault(completeFilename, eclCase->eclipseCaseData()->mainGrid(), rimFault->faultGeometry()->faultFaces(), faultName);
}

View File

@ -93,11 +93,11 @@ void RicSnapshotViewToFileFeature::saveSnapshotAs(const QString& fileName, RimVi
{
if (image.save(fileName))
{
qDebug() << "Saved snapshot image to " << fileName;
qDebug() << "Exported snapshot image to " << fileName;
}
else
{
qDebug() << "Error when trying to save snapshot image to " << fileName;
qDebug() << "Error when trying to export snapshot image to " << fileName;
}
}
}
@ -132,7 +132,7 @@ void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
startPath += "/image.png";
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save File"), startPath, tr("Image files (*.bmp *.png * *.jpg)"));
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Export to File"), startPath, tr("Image files (*.bmp *.png * *.jpg)"));
if (fileName.isEmpty())
{
return;

View File

@ -14,6 +14,9 @@ ${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.h
${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicPasteSummaryCurveFeature.h
${CEE_CURRENT_LIST_DIR}RicAsciiExportSummaryPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicNewGridTimeHistoryCurveFeature.h
${CEE_CURRENT_LIST_DIR}RicSelectSummaryPlotUI.h
${CEE_CURRENT_LIST_DIR}RicPasteTimeHistoryCurveFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -25,6 +28,9 @@ ${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.cpp
${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicPasteSummaryCurveFeature.cpp
${CEE_CURRENT_LIST_DIR}RicAsciiExportSummaryPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewGridTimeHistoryCurveFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSelectSummaryPlotUI.cpp
${CEE_CURRENT_LIST_DIR}RicPasteTimeHistoryCurveFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -28,6 +28,8 @@
#include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h"
#include "cafSelectionManager.h"
#include "cafUtils.h"
#include "cvfAssert.h"
#include <QAction>
@ -35,8 +37,7 @@
#include <QFileDialog>
#include <QFileInfo>
#include <QMessageBox>
#include <vector>
#include "cafUtils.h"
@ -65,19 +66,16 @@ void RicAsciiExportSummaryPlotFeature::onActionTriggered(bool isChecked)
caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("PLOT_ASCIIEXPORT_DIR", projectFolder);
caf::ProgressInfo pi(selectedSummaryPlots.size(), QString("Exporting to csv"));
caf::ProgressInfo pi(selectedSummaryPlots.size(), QString("Exporting plot data to ASCII"));
size_t progress = 0;
bool isOk = false;
if (selectedSummaryPlots.size() == 1)
{
RimSummaryPlot* summaryPlot = selectedSummaryPlots.at(0);
QString defaultFileName = defaultDir + "/" + caf::Utils::makeValidFileBasename((summaryPlot->description())) + ".csv";
QString fileName = QFileDialog::getSaveFileName(NULL, "Select file for Summary Plot Export", defaultFileName, "All files(*.*)");
QString defaultFileName = defaultDir + "/" + caf::Utils::makeValidFileBasename((summaryPlot->description())) + ".ascii";
QString fileName = QFileDialog::getSaveFileName(nullptr, "Select File for Summary Plot Export", defaultFileName, "Text File(*.ascii);;All files(*.*)");
if (fileName.isEmpty()) return;
isOk = writeAsciiExportForSummaryPlots(fileName, summaryPlot);
RicAsciiExportSummaryPlotFeature::exportAsciiForSummaryPlot(fileName, summaryPlot);
progress++;
pi.setProgress(progress);
@ -87,7 +85,7 @@ void RicAsciiExportSummaryPlotFeature::onActionTriggered(bool isChecked)
std::vector<QString> fileNames;
for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
{
QString fileName = caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".csv";
QString fileName = caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".ascii";
fileNames.push_back(fileName);
}
@ -95,20 +93,15 @@ void RicAsciiExportSummaryPlotFeature::onActionTriggered(bool isChecked)
bool writeFiles = caf::Utils::getSaveDirectoryAndCheckOverwriteFiles(defaultDir, fileNames, &saveDir);
if (!writeFiles) return;
RiaLogging::debug(QString("Writing to directory %!").arg(saveDir));
RiaLogging::debug(QString("Writing to directory %1").arg(saveDir));
for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
{
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".csv";
isOk = writeAsciiExportForSummaryPlots(fileName, summaryPlot);
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".ascii";
RicAsciiExportSummaryPlotFeature::exportAsciiForSummaryPlot(fileName, summaryPlot);
progress++;
pi.setProgress(progress);
}
}
if (!isOk)
{
QMessageBox::critical(NULL, "File export", "Failed to export summary plots to csv");
}
}
//--------------------------------------------------------------------------------------------------
@ -116,30 +109,31 @@ void RicAsciiExportSummaryPlotFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicAsciiExportSummaryPlotFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Export Summary Plot Data");
actionToSetup->setText("Export Plot Data to Text File");
actionToSetup->setIcon(QIcon(":/Save.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAsciiExportSummaryPlotFeature::writeAsciiExportForSummaryPlots(const QString& fileName, const RimSummaryPlot* summaryPlot)
bool RicAsciiExportSummaryPlotFeature::exportAsciiForSummaryPlot(const QString& fileName, const RimSummaryPlot* summaryPlot)
{
RiaLogging::info(QString("Writing ascii values for summary plot(s) to file: %1").arg(fileName));
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
return false;
}
RiaLogging::info(QString("Writing values for summary plot(s) to file: %1").arg(fileName));
QTextStream out(&file);
out << summaryPlot->description();
out << summaryPlot->asciiDataForPlotExport();
out << "\n\n";
RiaLogging::info(QString("Competed writing ascii values for summary plot(s) to file %1").arg(fileName));
RiaLogging::info(QString("Competed writing values for summary plot(s) to file %1").arg(fileName));
return true;
}

View File

@ -19,7 +19,6 @@
#pragma once
#include "cafCmdFeature.h"
#include "cafPdmField.h"
class RimSummaryPlot;
@ -30,13 +29,11 @@ class RicAsciiExportSummaryPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
protected:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook(QAction* actionToSetup) override;
private:
bool writeAsciiExportForSummaryPlots(const QString& fileName, const RimSummaryPlot* selectedSummaryPlots);
static bool exportAsciiForSummaryPlot(const QString& fileName, const RimSummaryPlot* selectedSummaryPlots);
};

View File

@ -0,0 +1,251 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicNewGridTimeHistoryCurveFeature.h"
#include "RiaApplication.h"
#include "RicNewSummaryCurveFeature.h"
#include "RicSelectSummaryPlotUI.h"
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseResultDefinition.h"
#include "RimEclipseView.h"
#include "RimGeoMechResultDefinition.h"
#include "RimGeoMechView.h"
#include "RimGridTimeHistoryCurve.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h"
#include "RiuMainPlotWindow.h"
#include "RiuSelectionManager.h"
#include "cafPdmReferenceHelper.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cvfAssert.h"
#include "cvfColor3.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewGridTimeHistoryCurveFeature, "RicNewGridTimeHistoryCurveFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewGridTimeHistoryCurveFeature::createCurveFromSelectionItem(const RiuSelectionItem* selectionItem, RimSummaryPlot* plot)
{
CVF_ASSERT(selectionItem);
CVF_ASSERT(plot);
RimGridTimeHistoryCurve* newCurve = new RimGridTimeHistoryCurve();
newCurve->setFromSelectionItem(selectionItem);
newCurve->setLineThickness(2);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plot->curveCount());
newCurve->setColor(curveColor);
plot->addGridTimeHistoryCurve(newCurve);
newCurve->loadDataAndUpdate();
plot->updateConnectedEditors();
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(newCurve);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
{
const QString lastUsedSummaryPlotKey("lastUsedSummaryPlotKey");
RimProject* project = RiaApplication::instance()->project();
CVF_ASSERT(project);
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
CVF_ASSERT(mainPlotColl);
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
CVF_ASSERT(summaryPlotColl);
RimSummaryPlot* defaultSelectedPlot = nullptr;
{
QString lastUsedPlotRef = RiaApplication::instance()->cacheDataObject(lastUsedSummaryPlotKey).toString();
RimSummaryPlot* lastUsedPlot = dynamic_cast<RimSummaryPlot*>(caf::PdmReferenceHelper::objectFromReference(RiaApplication::instance()->project(), lastUsedPlotRef));
if (lastUsedPlot)
{
defaultSelectedPlot = lastUsedPlot;
}
if (!defaultSelectedPlot)
{
defaultSelectedPlot = RiaApplication::instance()->activeSummaryPlot();
}
if (!defaultSelectedPlot && summaryPlotColl->summaryPlots().size() > 0)
{
defaultSelectedPlot = summaryPlotColl->summaryPlots()[0];
}
}
RicSelectSummaryPlotUI featureUi;
if (defaultSelectedPlot)
{
featureUi.setDefaultSummaryPlot(defaultSelectedPlot);
}
QString newPlotName = RicNewGridTimeHistoryCurveFeature::suggestedNewPlotName();
featureUi.setSuggestedPlotName(newPlotName);
caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, "Select Destination Plot", "");
propertyDialog.resize(QSize(400, 200));
if (propertyDialog.exec() != QDialog::Accepted) return nullptr;
RimSummaryPlot* summaryPlot = nullptr;
if (featureUi.isCreateNewPlotChecked())
{
RimSummaryPlot* plot = new RimSummaryPlot();
summaryPlotColl->summaryPlots().push_back(plot);
plot->setDescription(featureUi.newPlotName());
summaryPlotColl->updateConnectedEditors();
plot->loadDataAndUpdate();
summaryPlot = plot;
}
else
{
summaryPlot = featureUi.selectedSummaryPlot();
}
QString refFromProjectToView = caf::PdmReferenceHelper::referenceFromRootToObject(RiaApplication::instance()->project(), summaryPlot);
RiaApplication::instance()->setCacheDataObject(lastUsedSummaryPlotKey, refFromProjectToView);
return summaryPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicNewGridTimeHistoryCurveFeature::suggestedNewPlotName()
{
QString resultName;
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(activeView);
if (eclView)
{
RimEclipseResultDefinition* resDef = eclView->cellResult();
resultName = resDef->resultVariableUiShortName();
}
RimGeoMechView* geoView = dynamic_cast<RimGeoMechView*>(activeView);
if (geoView)
{
// NOTE: See also RimGeoMechProertyFilter for generation of result name
RimGeoMechResultDefinition* resultDefinition = geoView->cellResultResultDefinition();
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
if (resultAddress.resultPosType == RIG_FORMATION_NAMES)
{
resultName = resultDefinition->resultFieldName();
}
else
{
QString posName;
switch (resultAddress.resultPosType)
{
case RIG_NODAL: posName = "N"; break;
case RIG_ELEMENT_NODAL: posName = "EN"; break;
case RIG_INTEGRATION_POINT: posName = "IP"; break;
}
QString fieldUiName = resultDefinition->resultFieldUiName();
QString compoUiName = resultDefinition->resultComponentUiName();
resultName = posName + ", " + fieldUiName + ", " + compoUiName;
}
}
}
QString plotName = "New Plot Name";
if (!resultName.isEmpty())
{
plotName = QString("Cell Result - %1").arg(resultName);
}
return plotName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewGridTimeHistoryCurveFeature::isCommandEnabled()
{
std::vector<RiuSelectionItem*> items;
RiuSelectionManager::instance()->selectedItems(items);
if (items.size() > 0)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewGridTimeHistoryCurveFeature::onActionTriggered(bool isChecked)
{
RimSummaryPlot* summaryPlot = RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot();
if (!summaryPlot) return;
std::vector<RiuSelectionItem*> items;
RiuSelectionManager::instance()->selectedItems(items);
CVF_ASSERT(items.size() > 0);
for (auto item : items)
{
RicNewGridTimeHistoryCurveFeature::createCurveFromSelectionItem(item, summaryPlot);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewGridTimeHistoryCurveFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Plot Time History for Selected Cells");
actionToSetup->setIcon(QIcon(":/SummaryCurve16x16.png"));
}

View File

@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"
class RiuSelectionItem;
class RimSummaryPlot;
//==================================================================================================
///
//==================================================================================================
class RicNewGridTimeHistoryCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook( QAction* actionToSetup ) override;
private:
static void createCurveFromSelectionItem(const RiuSelectionItem* selectionItem, RimSummaryPlot* plot);
static RimSummaryPlot* userSelectedSummaryPlot();
static QString suggestedNewPlotName();
};

View File

@ -0,0 +1,117 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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 "RicPasteTimeHistoryCurveFeature.h"
#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h"
#include "cafPdmDefaultObjectFactory.h"
#include "cafPdmDocument.h"
#include "cafPdmObjectGroup.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
#include "RimSummaryPlot.h"
#include "RimGridTimeHistoryCurve.h"
CAF_CMD_SOURCE_INIT(RicPasteTimeHistoryCurveFeature, "RicPasteTimeHistoryCurveFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPasteTimeHistoryCurveFeature::isCommandEnabled()
{
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
RimSummaryPlot* summaryPlot = nullptr;
destinationObject->firstAncestorOrThisOfType(summaryPlot);
if (!summaryPlot)
{
return false;
}
return RicPasteTimeHistoryCurveFeature::timeHistoryCurves().size() > 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteTimeHistoryCurveFeature::onActionTriggered(bool isChecked)
{
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
RimSummaryPlot* summaryPlot = nullptr;
destinationObject->firstAncestorOrThisOfType(summaryPlot);
if (!summaryPlot)
{
return;
}
std::vector<caf::PdmPointer<RimGridTimeHistoryCurve> > sourceObjects = RicPasteTimeHistoryCurveFeature::timeHistoryCurves();
for (size_t i = 0; i < sourceObjects.size(); i++)
{
RimGridTimeHistoryCurve* newObject = dynamic_cast<RimGridTimeHistoryCurve*>(sourceObjects[i]->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
CVF_ASSERT(newObject);
summaryPlot->addGridTimeHistoryCurve(newObject);
// Resolve references after object has been inserted into the project data model
newObject->resolveReferencesRecursively();
// If source curve is part of a curve filter, resolve of references to the summary case does not
// work when pasting the new curve into a plot. Must set summary case manually.
//newObject->setSummaryCase(sourceObjects[i]->summaryCase());
newObject->initAfterReadRecursively();
newObject->loadDataAndUpdate();
newObject->updateConnectedEditors();
summaryPlot->updateConnectedEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteTimeHistoryCurveFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Paste Time History Curve");
RicPasteFeatureImpl::setIconAndShortcuts(actionToSetup);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmPointer<RimGridTimeHistoryCurve> > RicPasteTimeHistoryCurveFeature::timeHistoryCurves()
{
caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs(&objectGroup);
std::vector<caf::PdmPointer<RimGridTimeHistoryCurve> > typedObjects;
objectGroup.objectsByType(&typedObjects);
return typedObjects;
}

View File

@ -18,31 +18,28 @@
#pragma once
#include "cvfBase.h"
#include "cvfCollection.h"
#include "cvfVector3.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
#include <vector>
namespace cvf
class RimGridTimeHistoryCurve;
//==================================================================================================
///
//==================================================================================================
class RicPasteTimeHistoryCurveFeature : public caf::CmdFeature
{
class ModelBasicList;
}
CAF_CMD_HEADER_INIT;
class RimEclipseView;
class RivWellSpheresPartMgr;
protected:
// Overrides
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook(QAction* actionToSetup) override;
class RivReservoirWellSpheresPartMgr : public cvf::Object
{
public:
explicit RivReservoirWellSpheresPartMgr(RimEclipseView* reservoirView);
~RivReservoirWellSpheresPartMgr();
void clearGeometryCache();
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);
private:
caf::PdmPointer<RimEclipseView> m_reservoirView;
cvf::Collection< RivWellSpheresPartMgr > m_wellSpheresPartMgrs;
static std::vector<caf::PdmPointer<RimGridTimeHistoryCurve> > timeHistoryCurves();
};

View File

@ -0,0 +1,147 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicSelectSummaryPlotUI.h"
#include "RiaApplication.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h"
CAF_PDM_SOURCE_INIT(RicSelectSummaryPlotUI, "RicSelectSummaryPlotUI");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicSelectSummaryPlotUI::RicSelectSummaryPlotUI()
{
CAF_PDM_InitObject("RicSelectSummaryPlotUI", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_selectedSummaryPlot, "SelectedSummaryPlot", "Select Plot", "", "", "");
CAF_PDM_InitField(&m_createNewPlot, "CreateNewPlot", false, "Create New Plot", "", "", "");
CAF_PDM_InitField(&m_newSummaryPlotName, "NewViewName", QString("Cell Results"), "New Plot Name", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSelectSummaryPlotUI::setDefaultSummaryPlot(RimSummaryPlot* summaryPlot)
{
m_selectedSummaryPlot = summaryPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSelectSummaryPlotUI::setSuggestedPlotName(const QString& name)
{
m_newSummaryPlotName = name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryPlot* RicSelectSummaryPlotUI::selectedSummaryPlot() const
{
return m_selectedSummaryPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicSelectSummaryPlotUI::isCreateNewPlotChecked() const
{
return m_createNewPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicSelectSummaryPlotUI::newPlotName() const
{
return m_newSummaryPlotName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RicSelectSummaryPlotUI::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_selectedSummaryPlot)
{
for (RimSummaryPlot* plot : RicSelectSummaryPlotUI::summaryPlots())
{
QIcon icon = plot->uiCapability()->uiIcon();
QString displayName = plot->description();
options.push_back(caf::PdmOptionItemInfo(displayName, plot, false, icon));
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSelectSummaryPlotUI::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
if (RicSelectSummaryPlotUI::summaryPlots().size() == 0)
{
m_createNewPlot = true;
}
if (m_createNewPlot)
{
m_newSummaryPlotName.uiCapability()->setUiReadOnly(false);
m_selectedSummaryPlot.uiCapability()->setUiReadOnly(true);
}
else
{
m_newSummaryPlotName.uiCapability()->setUiReadOnly(true);
m_selectedSummaryPlot.uiCapability()->setUiReadOnly(false);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSummaryPlot*> RicSelectSummaryPlotUI::summaryPlots()
{
RimProject* project = RiaApplication::instance()->project();
CVF_ASSERT(project);
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
CVF_ASSERT(mainPlotColl);
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
CVF_ASSERT(summaryPlotColl);
std::vector<RimSummaryPlot*> sumPlots;
summaryPlotColl->descendantsIncludingThisOfType(sumPlots);
return sumPlots;
}

View File

@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
class RimSummaryPlot;
//==================================================================================================
///
//==================================================================================================
class RicSelectSummaryPlotUI : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RicSelectSummaryPlotUI();
void setDefaultSummaryPlot(RimSummaryPlot* summaryPlot);
void setSuggestedPlotName(const QString& name);
RimSummaryPlot* selectedSummaryPlot() const;
bool isCreateNewPlotChecked() const;
QString newPlotName() const;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
static std::vector<RimSummaryPlot*> summaryPlots();
private:
caf::PdmPtrField<RimSummaryPlot*> m_selectedSummaryPlot;
caf::PdmField<bool> m_createNewPlot;
caf::PdmField<QString> m_newSummaryPlotName;
};

View File

@ -18,6 +18,7 @@
#include "RicSummaryCurveSwitchAxisFeature.h"
#include "RimGridTimeHistoryCurve.h"
#include "RimSummaryCurve.h"
#include "RimSummaryCurveFilter.h"
#include "RimSummaryPlot.h"
@ -36,10 +37,14 @@ bool RicSummaryCurveSwitchAxisFeature::isCommandEnabled()
{
std::set<RimSummaryCurveFilter*> selectedCurveFilters;
std::set<RimSummaryCurve*> selectedSoloCurves;
std::vector<RimGridTimeHistoryCurve*> gridTimeHistoryCurves;
RicSummaryCurveSwitchAxisFeature::extractSelectedCurveFiltersAndSoloCurves(&selectedCurveFilters,
&selectedSoloCurves);
return (selectedCurveFilters.size() || selectedSoloCurves.size());
&selectedSoloCurves,
&gridTimeHistoryCurves);
return ( selectedCurveFilters.size()
|| selectedSoloCurves.size()
|| gridTimeHistoryCurves.size());
}
//--------------------------------------------------------------------------------------------------
@ -49,9 +54,11 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered(bool isChecked)
{
std::set<RimSummaryCurveFilter*> selectedCurveFilters;
std::set<RimSummaryCurve*> selectedSoloCurves;
std::vector<RimGridTimeHistoryCurve*> gridTimeHistoryCurves;
RicSummaryCurveSwitchAxisFeature::extractSelectedCurveFiltersAndSoloCurves(&selectedCurveFilters,
&selectedSoloCurves);
&selectedSoloCurves,
&gridTimeHistoryCurves);
for (RimSummaryCurveFilter* summaryCurveFilter: selectedCurveFilters)
{
@ -89,6 +96,26 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered(bool isChecked)
summaryCurve->firstAncestorOrThisOfType(plot);
if ( plot ) plot->updateAxes();
}
for (RimGridTimeHistoryCurve* timeHistoryCurve : gridTimeHistoryCurves)
{
RimDefines::PlotAxis plotAxis = timeHistoryCurve->yAxis();
if (plotAxis == RimDefines::PLOT_AXIS_LEFT)
{
timeHistoryCurve->setYAxis(RimDefines::PLOT_AXIS_RIGHT);
}
else
{
timeHistoryCurve->setYAxis(RimDefines::PLOT_AXIS_LEFT);
}
timeHistoryCurve->updateConnectedEditors();
RimSummaryPlot* plot = nullptr;
timeHistoryCurve->firstAncestorOrThisOfType(plot);
if (plot) plot->updateAxes();
}
}
//--------------------------------------------------------------------------------------------------
@ -100,19 +127,24 @@ void RicSummaryCurveSwitchAxisFeature::setupActionLook(QAction* actionToSetup)
}
//--------------------------------------------------------------------------------------------------
/// Solo curves means selected curves that does not have a selected curvefilter as parent
/// Solo curves means selected curves that does not have a selected curve filter as parent
//--------------------------------------------------------------------------------------------------
void RicSummaryCurveSwitchAxisFeature::extractSelectedCurveFiltersAndSoloCurves(std::set<RimSummaryCurveFilter*>* selectedCurveFilters,
std::set<RimSummaryCurve*>* selectedSoloCurves)
std::set<RimSummaryCurve*>* selectedSoloCurves,
std::vector<RimGridTimeHistoryCurve*>* gridTimeHistoryCurves)
{
selectedSoloCurves->clear();
{
std::vector<RimSummaryCurve*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
for (RimSummaryCurve* curve: selection)
for (RimSummaryCurve* curve : selection)
{
selectedSoloCurves->insert(curve);
RimSummaryCurveFilter* parentCurveFilter = nullptr;
curve->firstAncestorOrThisOfType(parentCurveFilter);
if (!parentCurveFilter)
{
selectedSoloCurves->insert(curve);
}
}
}
@ -120,30 +152,12 @@ void RicSummaryCurveSwitchAxisFeature::extractSelectedCurveFiltersAndSoloCurves(
{
std::vector<RimSummaryCurveFilter*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
for ( RimSummaryCurveFilter* curveFilter: selection )
for (RimSummaryCurveFilter* curveFilter : selection)
{
selectedCurveFilters->insert(curveFilter);
}
}
std::vector<RimSummaryCurve*> curvesToRemove;
for (RimSummaryCurve* curve: (*selectedSoloCurves))
{
RimSummaryCurveFilter* parentCurveFilter;
curve->firstAncestorOrThisOfType(parentCurveFilter);
if (parentCurveFilter)
{
if (selectedCurveFilters->count(parentCurveFilter) > 0 )
{
curvesToRemove.push_back(curve);
}
}
}
for (RimSummaryCurve* curve: curvesToRemove)
{
selectedSoloCurves->erase(curve);
}
}
// Read out all time history curves directly from selection manager
caf::SelectionManager::instance()->objectsByType(gridTimeHistoryCurves);
}

View File

@ -24,7 +24,7 @@
class RimSummaryCurve;
class RimSummaryCurveFilter;
class RimGridTimeHistoryCurve;
//==================================================================================================
@ -41,5 +41,6 @@ protected:
private:
static void extractSelectedCurveFiltersAndSoloCurves(std::set<RimSummaryCurveFilter*>* selectedCurveFilters,
std::set<RimSummaryCurve*>* selectedSoloCurves);
std::set<RimSummaryCurve*>* selectedSoloCurves,
std::vector<RimGridTimeHistoryCurve*>* gridTimeHistoryCurves);
};

View File

@ -27,8 +27,8 @@
#include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h"
#include "cafUtils.h"
#include "cafSelectionManager.h"
#include "cafUtils.h"
#include "cvfAssert.h"
#include <QAction>
@ -36,7 +36,6 @@
#include <QFileDialog>
#include <QFileInfo>
#include <QMessageBox>
#include <vector>
@ -65,17 +64,16 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
caf::SelectionManager::instance()->objectsByType(&selectedWellLogPlots);
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("PLOT_ASCIIEXPORT_DIR", projectFolder);
caf::ProgressInfo pi(selectedWellLogPlots.size(), QString("Exporting to csv"));
caf::ProgressInfo pi(selectedWellLogPlots.size(), QString("Exporting plot data to ASCII"));
size_t progress = 0;
bool isOk = false;
if (selectedWellLogPlots.size() == 1)
{
RimWellLogPlot* wellLogPlot = selectedWellLogPlots.at(0);
QString defaultFileName = defaultDir + "/" + caf::Utils::makeValidFileBasename((wellLogPlot->description())) + ".csv";
QString fileName = QFileDialog::getSaveFileName(NULL, "Select file for Well Log Plot Export", defaultFileName, "All files(*.*)");
QString defaultFileName = defaultDir + "/" + caf::Utils::makeValidFileBasename((wellLogPlot->description())) + ".ascii";
QString fileName = QFileDialog::getSaveFileName(nullptr, "Select File for Plot Data Export", defaultFileName, "Text File(*.ascii);;All files(*.*)");
if (fileName.isEmpty()) return;
isOk = writeAsciiExportForWellLogPlots(fileName, wellLogPlot);
RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot(fileName, wellLogPlot);
progress++;
pi.setProgress(progress);
@ -85,7 +83,7 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
std::vector<QString> fileNames;
for (RimWellLogPlot* wellLogPlot : selectedWellLogPlots)
{
QString fileName = caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".csv";
QString fileName = caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".ascii";
fileNames.push_back(fileName);
}
@ -96,19 +94,13 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
RiaLogging::debug(QString("Writing to directory %!").arg(saveDir));
for (RimWellLogPlot* wellLogPlot : selectedWellLogPlots)
{
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".csv";
isOk = writeAsciiExportForWellLogPlots(fileName, wellLogPlot);
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".ascii";
RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot(fileName, wellLogPlot);
progress++;
pi.setProgress(progress);
}
}
if (!isOk)
{
QMessageBox::critical(NULL, "File export", "Failed to export well log plot to csv");
}
}
//--------------------------------------------------------------------------------------------------
@ -116,19 +108,22 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicAsciiExportWellLogPlotFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Export to csv");
actionToSetup->setText("Export Plot Data to Text File");
actionToSetup->setIcon(QIcon(":/Save.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAsciiExportWellLogPlotFeature::writeAsciiExportForWellLogPlots(const QString& fileName, const RimWellLogPlot* wellLogPlot)
bool RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot(const QString& fileName, const RimWellLogPlot* wellLogPlot)
{
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
return false;
}
RiaLogging::info(QString("Writing values for plot(s) to file: %1").arg(fileName));
QTextStream out(&file);
@ -137,7 +132,8 @@ bool RicAsciiExportWellLogPlotFeature::writeAsciiExportForWellLogPlots(const QSt
out << wellLogPlot->asciiDataForPlotExport();
out << "\n\n";
RiaLogging::info(QString("CVS export completed for %1").arg(fileName));
RiaLogging::info(QString("Competed writing values for plot(s) to file %1").arg(fileName));
return true;
}

View File

@ -19,7 +19,6 @@
#pragma once
#include "cafCmdFeature.h"
#include "cafPdmField.h"
class RimWellLogPlot;
@ -30,15 +29,11 @@ class RicAsciiExportWellLogPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
protected:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook(QAction* actionToSetup) override;
private:
bool writeAsciiExportForWellLogPlots(const QString& fileName, const RimWellLogPlot* wellLogPlot);
static bool exportAsciiForWellLogPlot(const QString& fileName, const RimWellLogPlot* wellLogPlot);
};

View File

@ -34,6 +34,8 @@ add_library( ${PROJECT_NAME}
RigFemPartGrid.cpp
RigFemResultAddress.h
RigFemResultPosEnum.h
RimGeoMechTopologyItem.h
RimGeoMechTopologyItem.cpp
)
target_link_libraries( ${PROJECT_NAME} LibCore cafTensor ResultStatisticsCache)

View File

@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimGeoMechTopologyItem.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechView.h"
#include "RiuSelectionManager.h"
CAF_PDM_SOURCE_INIT(RimGeoMechTopologyItem, "RimGeoMechTopologyItem");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechTopologyItem::RimGeoMechTopologyItem()
{
CAF_PDM_InitObject("GeoMech Topology Item", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_geoMechCase, "GeoMechCase", "Geo Mech Case", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_gridIndex, "m_gridIndex", "m_gridIndex", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_cellIndex, "m_cellIndex", "m_cellIndex", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_elementFace, "m_elementFace", "m_elementFace", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_hasIntersectionTriangle, "m_hasIntersectionTriangle", "m_hasIntersectionTriangle", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_0, "m_intersectionTriangle_0", "m_intersectionTriangle_0", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_1, "m_intersectionTriangle_1", "m_intersectionTriangle_1", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_2, "m_intersectionTriangle_2", "m_intersectionTriangle_2", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_localIntersectionPoint, "m_localIntersectionPoint", "m_localIntersectionPoint", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechTopologyItem::~RimGeoMechTopologyItem()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechTopologyItem::setFromSelectionItem(const RiuGeoMechSelectionItem* selectionItem)
{
m_geoMechCase = selectionItem->m_view->geoMechCase();
m_gridIndex = selectionItem->m_gridIndex;
m_cellIndex = selectionItem->m_cellIndex;
m_elementFace = selectionItem->m_elementFace;
m_hasIntersectionTriangle = selectionItem->m_hasIntersectionTriangle;
m_intersectionTriangle_0 = cvf::Vec3d(selectionItem->m_intersectionTriangle[0]);
m_intersectionTriangle_1 = cvf::Vec3d(selectionItem->m_intersectionTriangle[1]);
m_intersectionTriangle_2 = cvf::Vec3d(selectionItem->m_intersectionTriangle[2]);
m_localIntersectionPoint = selectionItem->m_localIntersectionPoint;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGeoMechTopologyItem::topologyText() const
{
QString text;
/*
if (m_geoMechCase)
{
text += m_geoMechCase->caseUserDescription();
}
else
{
text = "No case";
}
text += ", ";
text += QString("Grid index %1").arg(m_gridIndex);
text += ", ";
text += RigTimeHistoryResultAccessor::topologyText(m_geoMechCase->eclipseCaseData(), m_gridIndex, m_cellIndex);
*/
return text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechCase* RimGeoMechTopologyItem::geoMechCase() const
{
return m_geoMechCase;
}

View File

@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimPickingTopologyItem.h"
#include "cafPdmField.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cafPdmPtrField.h"
class RiuGeoMechSelectionItem;
class RimGeoMechCase;
//==================================================================================================
///
///
//==================================================================================================
class RimGeoMechTopologyItem : public RimPickingTopologyItem
{
CAF_PDM_HEADER_INIT;
public:
RimGeoMechTopologyItem();
virtual ~RimGeoMechTopologyItem() override;
void setFromSelectionItem(const RiuGeoMechSelectionItem* selectionItem);
virtual QString topologyText() const override;
RimGeoMechCase* geoMechCase() const;
public:
caf::PdmField<size_t> m_gridIndex;
caf::PdmField<size_t> m_cellIndex;
caf::PdmField<int> m_elementFace;
caf::PdmField<bool> m_hasIntersectionTriangle;
caf::PdmField<cvf::Vec3d> m_intersectionTriangle_0;
caf::PdmField<cvf::Vec3d> m_intersectionTriangle_1;
caf::PdmField<cvf::Vec3d> m_intersectionTriangle_2;
caf::PdmField<cvf::Vec3d> m_localIntersectionPoint;
private:
caf::PdmPtrField<RimGeoMechCase*> m_geoMechCase;
};

View File

@ -15,13 +15,12 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirPartMgr.h
${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.h
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.h
${CEE_CURRENT_LIST_DIR}RivReservoirFaultsPartMgr.h
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.h
${CEE_CURRENT_LIST_DIR}RivReservoirSimWellsPartMgr.h
${CEE_CURRENT_LIST_DIR}RivSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.h
${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.h
${CEE_CURRENT_LIST_DIR}RivReservoirWellSpheresPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h
${CEE_CURRENT_LIST_DIR}RivResultToTextureMapper.h
${CEE_CURRENT_LIST_DIR}RivTernaryResultToTextureMapper.h
@ -36,6 +35,8 @@ ${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h
${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.h
${CEE_CURRENT_LIST_DIR}RivPartPriority.h
${CEE_CURRENT_LIST_DIR}RivWellConnectionsPartMgr.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -49,13 +50,12 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirFaultsPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirSimWellsPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirWellSpheresPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivTextureCoordsCreator.cpp
${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapper.cpp
@ -67,6 +67,7 @@ ${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.cpp
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp
${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellConnectionsPartMgr.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -95,7 +95,7 @@ void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex)
CVF_ASSERT(cellResultColors);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->reservoirData();
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData();
// CrossSections
if (m_intersectionBoxFaces.notNull())
@ -127,7 +127,7 @@ void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex)
}
else
{
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(cellResultColors->reservoirView()->eclipseCase()->reservoirData(),
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData(),
0,
timeStepIndex,
cellResultColors);

View File

@ -103,7 +103,7 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
CVF_ASSERT(cellResultColors);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->reservoirData();
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData();
// CrossSections
if (m_crossSectionFaces.notNull())
@ -135,7 +135,7 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
}
else
{
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(cellResultColors->reservoirView()->eclipseCase()->reservoirData(),
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData(),
0,
timeStepIndex,
cellResultColors);

View File

@ -55,7 +55,7 @@ void RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(
bool useDefaultValueForHugeVals,
float opacityLevel)
{
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
CVF_ASSERT(eclipseCase != NULL);
// Create result access objects
@ -199,7 +199,7 @@ void RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(size_t tim
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo, size_t gridIndex, float opacityLevel)
{
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
CVF_ASSERT(eclipseCase != NULL);
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));

View File

@ -107,7 +107,7 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RimEclipseView* eclipseView = cellResultColors->reservoirView();
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->reservoirData();
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData();
// Faults
if (m_nativeFaultFaces.notNull())

View File

@ -18,7 +18,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivReservoirPipesPartMgr.h"
#include "RivReservoirSimWellsPartMgr.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimCellEdgeColors.h"
@ -36,11 +36,13 @@
#include "cafPdmFieldCvfMat4d.h"
#include "cvfTransform.h"
#include "RivWellSpheresPartMgr.h"
#include "RivWellConnectionsPartMgr.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReservoirPipesPartMgr::RivReservoirPipesPartMgr(RimEclipseView* reservoirView)
RivReservoirSimWellsPartMgr::RivReservoirSimWellsPartMgr(RimEclipseView* reservoirView)
{
m_reservoirView = reservoirView;
@ -50,7 +52,7 @@ RivReservoirPipesPartMgr::RivReservoirPipesPartMgr(RimEclipseView* reservoirView
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReservoirPipesPartMgr::~RivReservoirPipesPartMgr()
RivReservoirSimWellsPartMgr::~RivReservoirSimWellsPartMgr()
{
}
@ -58,16 +60,18 @@ RivReservoirPipesPartMgr::~RivReservoirPipesPartMgr()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::clearGeometryCache()
void RivReservoirSimWellsPartMgr::clearGeometryCache()
{
m_wellPipesPartMgrs.clear();
m_wellHeadPartMgrs.clear();
m_wellSpheresPartMgrs.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::scheduleGeometryRegen()
void RivReservoirSimWellsPartMgr::scheduleGeometryRegen()
{
for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx)
{
@ -78,12 +82,14 @@ void RivReservoirPipesPartMgr::scheduleGeometryRegen()
{
//m_wellHeadPartMgrs[wIdx]->scheduleGeometryRegen(scaleTransform);
}
m_wellSpheresPartMgrs.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::setScaleTransform(cvf::Transform * scaleTransform)
void RivReservoirSimWellsPartMgr::setScaleTransform(cvf::Transform * scaleTransform)
{
m_scaleTransform = scaleTransform;
@ -101,7 +107,7 @@ void RivReservoirPipesPartMgr::setScaleTransform(cvf::Transform * scaleTransform
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
void RivReservoirSimWellsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{
if (!m_reservoirView->wellCollection()->isActive()) return;
@ -126,12 +132,43 @@ void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasic
m_wellPipesPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
m_wellHeadPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
}
// Well spheres
if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size())
{
m_wellSpheresPartMgrs.clear();
for (RimEclipseWell* rimWell : m_reservoirView->wellCollection()->wells())
{
RivWellSpheresPartMgr* wppmgr = new RivWellSpheresPartMgr(m_reservoirView, rimWell);
m_wellSpheresPartMgrs.push_back(wppmgr);
}
}
for (size_t wIdx = 0; wIdx < m_wellSpheresPartMgrs.size(); wIdx++)
{
if (m_reservoirView->wellCollection()->wells[wIdx]->isWellSpheresVisible(frameIndex))
{
m_wellSpheresPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
}
}
// Well Connection Arrows
if ( m_reservoirView->wellCollection()->showWellCommunicationLines() )
{
for ( RimEclipseWell* rimWell : m_reservoirView->wellCollection()->wells() )
{
cvf::ref<RivWellConnectionsPartMgr> wppmgr = new RivWellConnectionsPartMgr(m_reservoirView, rimWell);
wppmgr->appendDynamicGeometryPartsToModel(model, frameIndex);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::updatePipeResultColor(size_t frameIndex)
void RivReservoirSimWellsPartMgr::updatePipeResultColor(size_t frameIndex)
{
for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx)
{
@ -142,7 +179,7 @@ void RivReservoirPipesPartMgr::updatePipeResultColor(size_t frameIndex)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector< std::vector <cvf::Vec3d> >* RivReservoirPipesPartMgr::centerLineOfWellBranches(int wellIdx)
const std::vector< std::vector <cvf::Vec3d> >* RivReservoirSimWellsPartMgr::centerLineOfWellBranches(int wellIdx)
{
if (wellIdx < static_cast<int>(m_wellPipesPartMgrs.size()))
{

View File

@ -34,12 +34,14 @@ namespace cvf
class RimEclipseView;
class RivSimWellPipesPartMgr;
class RivWellHeadPartMgr;
class RivWellSpheresPartMgr;
class RivWellConnectionsPartMgr;
class RivReservoirPipesPartMgr : public cvf::Object
class RivReservoirSimWellsPartMgr : public cvf::Object
{
public:
explicit RivReservoirPipesPartMgr(RimEclipseView* reservoirView);
~RivReservoirPipesPartMgr();
explicit RivReservoirSimWellsPartMgr(RimEclipseView* reservoirView);
~RivReservoirSimWellsPartMgr();
void clearGeometryCache();
void scheduleGeometryRegen();
@ -57,4 +59,7 @@ private:
cvf::Collection< RivSimWellPipesPartMgr > m_wellPipesPartMgrs;
cvf::Collection< RivWellHeadPartMgr > m_wellHeadPartMgrs;
cvf::Collection< RivWellSpheresPartMgr > m_wellSpheresPartMgrs;
cvf::Collection< RivWellConnectionsPartMgr > m_wellConnPartMgrs;
};

View File

@ -153,7 +153,7 @@ void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType)
RigEclipseCaseData* eclipseCase = NULL;
if (m_reservoirView != NULL && m_reservoirView->eclipseCase())
{
eclipseCase = m_reservoirView->eclipseCase()->reservoirData();
eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData();
}
if (geomType == PROPERTY_FILTERED)
@ -250,7 +250,7 @@ void RivReservoirViewPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicL
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType)
{
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->reservoirData();
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData();
m_geometries[geometryType].clearAndSetReservoir(res, m_reservoirView);
m_geometries[geometryType].setTransform(m_scaleTransform.p());
@ -273,7 +273,7 @@ void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType)
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, RivCellSetEnum geometryType, RigGridBase* grid, size_t gridIdx)
{
RigEclipseCaseData* eclipseCase = m_reservoirView->eclipseCase()->reservoirData();
RigEclipseCaseData* eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData();
RigActiveCellInfo* activeCellInfo = m_reservoirView->currentActiveCellInfo();
switch (geometryType)
@ -400,7 +400,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t frameIndex)
{
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->reservoirData();
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData();
if ( frameIndex >= m_propFilteredGeometryFrames.size())
{
@ -477,7 +477,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameIndex)
{
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->reservoirData();
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData();
if ( frameIndex >= m_propFilteredWellGeometryFrames.size())
{
@ -790,7 +790,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
{
const RimCellFilter::FilterModeType filterType = propertyFilter->filterMode();
RigEclipseCaseData* eclipseCase = propFilterColl->reservoirView()->eclipseCase()->reservoirData();
RigEclipseCaseData* eclipseCase = propFilterColl->reservoirView()->eclipseCase()->eclipseCaseData();
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, grid->gridIndex(), timeStepIndex, propertyFilter->resultDefinition);

View File

@ -1,86 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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 "RivReservoirWellSpheresPartMgr.h"
#include "RivWellSpheresPartMgr.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfMat4d.h"
#include "cvfTransform.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReservoirWellSpheresPartMgr::RivReservoirWellSpheresPartMgr(RimEclipseView* reservoirView)
{
m_reservoirView = reservoirView;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReservoirWellSpheresPartMgr::~RivReservoirWellSpheresPartMgr()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirWellSpheresPartMgr::clearGeometryCache()
{
m_wellSpheresPartMgrs.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{
if (!m_reservoirView->wellCollection()->isActive()) return;
if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size())
{
clearGeometryCache();
for (RimEclipseWell* rimWell : m_reservoirView->wellCollection()->wells())
{
RivWellSpheresPartMgr* wppmgr = new RivWellSpheresPartMgr(m_reservoirView, rimWell);
m_wellSpheresPartMgrs.push_back(wppmgr);
}
}
for (size_t i = 0; i < m_wellSpheresPartMgrs.size(); i++)
{
if (m_reservoirView->wellCollection()->wells[i]->isWellSpheresVisible(frameIndex))
{
m_wellSpheresPartMgrs.at(i)->appendDynamicGeometryPartsToModel(model, frameIndex);
}
}
}

View File

@ -84,9 +84,7 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
m_rimWell->calculateWellPipeStaticCenterLine(m_pipeBranchesCLCoords, pipeBranchesCellIds);
double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize();
double pipeRadius = m_rimReservoirView->wellCollection()->pipeScaleFactor() * m_rimWell->pipeScaleFactor() * characteristicCellSize;
double pipeRadius = m_rimWell->pipeRadius();
for (size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); ++brIdx)
{

View File

@ -49,7 +49,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
CVF_ASSERT(quadMapper);
m_quadMapper = quadMapper;
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
size_t resTimeStepIdx = timeStepIndex;
@ -83,7 +83,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
size_t timeStepIndex)
: m_quadMapper(NULL)
{
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
size_t resTimeStepIdx = timeStepIndex;

View File

@ -40,7 +40,7 @@
//--------------------------------------------------------------------------------------------------
RivTextureCoordsCreator::RivTextureCoordsCreator(RimEclipseCellColors* cellResultColors, size_t timeStepIndex, size_t gridIndex, const cvf::StructGridQuadToCellFaceMapper* quadMapper)
{
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
m_quadMapper = quadMapper;
CVF_ASSERT(quadMapper && eclipseCase );

View File

@ -0,0 +1,354 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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 "RivWellConnectionsPartMgr.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RigSingleWellResultsData.h"
#include "RigFlowDiagResults.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigActiveCellInfo.h"
#include "cafEffectGenerator.h"
#include "cafDisplayCoordTransform.h"
#include "cvfDrawableGeo.h"
#include "cvfPart.h"
#include "cvfModelBasicList.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellConnectionsPartMgr::RivWellConnectionsPartMgr(RimEclipseView* reservoirView, RimEclipseWell* well)
{
m_rimReservoirView = reservoirView;
m_rimWell = well;
m_useCurvedArrows = true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellConnectionsPartMgr::~RivWellConnectionsPartMgr()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellConnectionsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{
if ( m_rimReservoirView.isNull() ) return;
if ( !m_rimReservoirView->eclipseCase() ) return;
if ( !m_rimWell->showWell() ) return;
if ( !m_rimWell->wellResults()->hasWellResult(frameIndex) ) return;
if ( !m_rimWell->wellResults()->wellResultFrame(frameIndex).m_isOpen ) return;
if ( m_rimWell->wellResults()->wellResultFrame(frameIndex).m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ) return;
bool isProducer = (m_rimWell->wellResults()->wellResultFrame(frameIndex).m_productionType == RigWellResultFrame::PRODUCER);
double pipeRadius = m_rimWell->pipeRadius();
cvf::Vec3d wellHeadTop;
cvf::Vec3d wellHeadBottom;
double characteristicCellSize;
double mainArrowZHeight;
cvf::ref<caf::DisplayCoordTransform> displayCordXf;
RigFlowDiagResults* flowResults;
std::string injectorName;
std::string producerName;
std::string crossFlowInjectorName;
std::string crossFlowProducerName;
double fluxWidthScale = 0.0;
{
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(m_rimReservoirView->eclipseCase());
if ( !eclResCase ) return;
if ( !eclResCase->defaultFlowDiagSolution() ) return;
flowResults = eclResCase->defaultFlowDiagSolution()->flowDiagResults();
displayCordXf = m_rimReservoirView->displayCoordTransform();
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->eclipseCaseData();
characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
m_rimWell->wellHeadTopBottomPosition(frameIndex, &wellHeadTop, &wellHeadBottom);
wellHeadTop = displayCordXf->transformToDisplayCoord(wellHeadTop);
wellHeadBottom = displayCordXf->transformToDisplayCoord(wellHeadBottom);
wellHeadTop.z() += characteristicCellSize;
cvf::Vec3d activeCellsBoundingBoxMax = displayCordXf->transformToDisplayCoord(m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max());
mainArrowZHeight = activeCellsBoundingBoxMax.z() + 1.5*characteristicCellSize; // Above the bbox somewhat;
if ( isProducer )
{
producerName = m_rimWell->name().toStdString();
crossFlowInjectorName = RimFlowDiagSolution::addCrossFlowEnding(m_rimWell->name()).toStdString();
}
else
{
injectorName = m_rimWell->name().toStdString();
crossFlowProducerName = RimFlowDiagSolution::addCrossFlowEnding(m_rimWell->name()).toStdString();
}
double maxAbsFlux = flowResults->maxAbsPairFlux(static_cast<int>(frameIndex));
if (maxAbsFlux != 0.0) fluxWidthScale = characteristicCellSize / maxAbsFlux;
}
bool enableLighting = !m_rimReservoirView->isLightingDisabled();
RimEclipseWellCollection* wellColl = m_rimReservoirView->wellCollection();
// Create potentially two the arrows to/from m_rimWell for each of the other wells in the model.
// One arrow for the "official" state of the well, and one to account for cross flow contributions
for ( RimEclipseWell * otherWell: wellColl->wells )
{
if ( otherWell == m_rimWell ) continue;
if ( !otherWell->wellResults()->hasWellResult(frameIndex) ) continue;
if ( !otherWell->wellResults()->wellResultFrame(frameIndex).m_isOpen ) continue;
if ( otherWell->wellResults()->wellResultFrame(frameIndex).m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ) continue;
bool isOtherProducer = (otherWell->wellResults()->wellResultFrame(frameIndex).m_productionType == RigWellResultFrame::PRODUCER);
{
std::string otherWellName = otherWell->name().toStdString();
std::string otherWellXfName = RimFlowDiagSolution::addCrossFlowEnding(otherWell->name()).toStdString();
if ( isProducer != isOtherProducer )
{
if ( isOtherProducer )
{
producerName = otherWellName;
crossFlowInjectorName = otherWellXfName;
}
else
{
injectorName = otherWellName;
crossFlowProducerName = otherWellXfName;
}
}
else
{
if ( isProducer )
{
injectorName = otherWellXfName;
crossFlowProducerName = otherWellName;
}
else
{
producerName = otherWellXfName;
crossFlowInjectorName = otherWellName;
}
}
}
std::pair<double, double> injProdFluxPair = flowResults->injectorProducerPairFluxes(injectorName, producerName, static_cast<int>(frameIndex));
std::pair<double, double> injProdFluxPairXF = flowResults->injectorProducerPairFluxes(crossFlowInjectorName, crossFlowProducerName, static_cast<int>(frameIndex));
const double fluxThreshold = 0.0; // Todo : Needs threshold in Gui
if ( fabs(injProdFluxPair.first) <= fluxThreshold
&& fabs(injProdFluxPair.second) <= fluxThreshold
&& fabs(injProdFluxPairXF.first) <= fluxThreshold
&& fabs(injProdFluxPairXF.second)<= fluxThreshold ) continue;
float width = fluxWidthScale * ( isProducer ? injProdFluxPair.second : injProdFluxPair.first);
float widthXf = fluxWidthScale * (!isProducer ? injProdFluxPairXF.second: injProdFluxPairXF.first);
cvf::Vec3d otherWellHeadTop;
cvf::Vec3d otherWellHeadBottom;
{
otherWell->wellHeadTopBottomPosition(frameIndex, &otherWellHeadTop, &otherWellHeadBottom);
otherWellHeadTop = displayCordXf->transformToDisplayCoord(otherWellHeadTop);
otherWellHeadBottom = displayCordXf->transformToDisplayCoord(otherWellHeadBottom);
otherWellHeadTop.z() += characteristicCellSize;
}
{
cvf::Vec3f startPoint = cvf::Vec3f(0.5*(wellHeadTop + otherWellHeadTop));
if (m_useCurvedArrows) startPoint.z() = mainArrowZHeight;
cvf::Vec3f endPoint = cvf::Vec3f(wellHeadTop + (3* pipeRadius * (otherWellHeadTop - wellHeadTop).getNormalized()));
cvf::Color4f arrowColor(otherWell->wellPipeColor());
if ( fabs(injProdFluxPair.first) > fluxThreshold
&& fabs(injProdFluxPair.second) > fluxThreshold )
{
if ( isProducer == isOtherProducer )
{
startPoint.z() -= 0.5*characteristicCellSize;
endPoint.z() -= 0.5*characteristicCellSize;
}
cvf::ref<cvf::Part> arrowPart = createArrowPart(startPoint, endPoint, width, isProducer, arrowColor, enableLighting);
model->addPart(arrowPart.p());
}
if ( fabs(injProdFluxPairXF.first) > fluxThreshold
&& fabs(injProdFluxPairXF.second) > fluxThreshold )
{
startPoint.z() -= 0.5*characteristicCellSize;
endPoint.z() -= 0.5*characteristicCellSize;
cvf::ref<cvf::Part> arrowPart = createArrowPart(startPoint, endPoint, widthXf, !isProducer, arrowColor, enableLighting);
model->addPart(arrowPart.p());
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::Part> RivWellConnectionsPartMgr::createArrowPart(const cvf::Vec3f& startPoint,
const cvf::Vec3f& endPoint,
float width,
bool isProducer,
const cvf::Color4f& arrowColor,
bool enableLighting)
{
cvf::ref<cvf::Part> part = new cvf::Part;
cvf::ref<cvf::DrawableGeo> geo = createArrowGeometry(startPoint, endPoint, width, isProducer);
part->setDrawable(geo.p());
caf::SurfaceEffectGenerator surfaceGen(arrowColor, caf::PO_1);
surfaceGen.enableLighting(enableLighting);
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
part->setEffect(eff.p());
return part;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref< cvf::DrawableGeo> RivWellConnectionsPartMgr::createArrowGeometry(const cvf::Vec3f& startPoint,
const cvf::Vec3f& endPoint,
double width,
bool useArrowEnd)
{
// Vertex layout
// _ - _
// __________ - - _
// - Producer end: Injector end
// 0 2 4 6 8 10 20 12 14 16 16
// : flat : : : : : : : : end 18 18
// 1 3 5 7 9 11 19 13 15 17 17
static const cvf::uint producerArrowFaceList[8 * 5 + 4] ={ 4, 0, 1, 3, 2,
4, 2, 3, 5, 4,
4, 4, 5, 7, 6,
4, 6, 7, 9, 8,
4, 8, 9, 11, 10,
4, 10, 11, 20, 19,
4, 19, 20, 13, 12,
4, 12, 13, 15, 14,
3, 16, 17, 18 };
static const cvf::uint injectorArrowFaceList[8 * 5 + 8] ={ 4, 0, 1, 3, 2,
4, 2, 3, 5, 4,
4, 4, 5, 7, 6,
4, 6, 7, 9, 8,
4, 8, 9, 11, 10,
4, 10, 11, 20, 19,
4, 19, 20, 13, 12,
4, 12, 13, 15, 14,
3, 14, 18, 16,
3, 18, 15, 17 };
cvf::Vec3f endPointInTopPlane = endPoint;
if (m_useCurvedArrows) endPointInTopPlane.z() = startPoint.z();
cvf::Vec3f heightDiff = cvf::Vec3f::ZERO;
if (m_useCurvedArrows) heightDiff.z() = (startPoint.z() - endPoint.z());
cvf::Vec3f fromTo = endPointInTopPlane - startPoint;
float length = fromTo.length();
float halfWidth = width * 0.5;
cvf::Vec3f widthVector = halfWidth *(fromTo.getNormalized() ^ -cvf::Vec3f::Z_AXIS);
float heightScale = 0.3*length * 0.15;
cvf::Vec3f heightScaleVec = cvf::Vec3f::ZERO;
if (m_useCurvedArrows) heightScaleVec.z() = heightScale;
float endStart = 0.4f;
float endStep = (1.0f - endStart) / 7.5f;
cvf::ref< cvf::Vec3fArray> arrowVertexArray = new cvf::Vec3fArray;
arrowVertexArray->resize(18+3);
(*arrowVertexArray)[0] = 0.0f * fromTo + startPoint + widthVector;
(*arrowVertexArray)[1] = 0.0f * fromTo + startPoint - widthVector;
(*arrowVertexArray)[2] = endStart * fromTo + startPoint + widthVector;
(*arrowVertexArray)[3] = endStart * fromTo + startPoint - widthVector;
(*arrowVertexArray)[4] = (1*endStep + endStart) * fromTo + startPoint + widthVector + 0.250f * heightScaleVec;//0.0250f * heightDiff;
(*arrowVertexArray)[5] = (1*endStep + endStart) * fromTo + startPoint - widthVector + 0.250f * heightScaleVec;//0.0250f * heightDiff;
(*arrowVertexArray)[6] = (2*endStep + endStart) * fromTo + startPoint + widthVector + 0.750f * heightScaleVec;//0.0750f * heightDiff;
(*arrowVertexArray)[7] = (2*endStep + endStart) * fromTo + startPoint - widthVector + 0.750f * heightScaleVec;//0.0750f * heightDiff;
(*arrowVertexArray)[8] = (3*endStep + endStart) * fromTo + startPoint + widthVector + 1.000f * heightScaleVec;//0.1000f * heightDiff;
(*arrowVertexArray)[9] = (3*endStep + endStart) * fromTo + startPoint - widthVector + 1.000f * heightScaleVec;//0.1000f * heightDiff;
(*arrowVertexArray)[10] = (4*endStep + endStart) * fromTo + startPoint + widthVector + 0.875f * heightScaleVec;//0.0875f * heightDiff;
(*arrowVertexArray)[11] = (4*endStep + endStart) * fromTo + startPoint - widthVector + 0.875f * heightScaleVec;//0.0875f * heightDiff;
(*arrowVertexArray)[19] = (4.7f*endStep + endStart) * fromTo + startPoint + widthVector + 0.400f * heightScaleVec;//0.0875f * heightDiff;
(*arrowVertexArray)[20] = (4.7f*endStep + endStart) * fromTo + startPoint - widthVector + 0.400f * heightScaleVec;//0.0875f * heightDiff;
(*arrowVertexArray)[12] = (5*endStep + endStart) * fromTo + startPoint + widthVector;
(*arrowVertexArray)[13] = (5*endStep + endStart) * fromTo + startPoint - widthVector;
(*arrowVertexArray)[14] = (6*endStep + endStart) * fromTo + startPoint + widthVector - 0.5f * heightDiff;
(*arrowVertexArray)[15] = (6*endStep + endStart) * fromTo + startPoint - widthVector - 0.5f * heightDiff;
if ( useArrowEnd )
{
(*arrowVertexArray)[16] = (6*endStep + endStart) * fromTo + startPoint + 1.6f * widthVector - 0.5f * heightDiff;
(*arrowVertexArray)[17] = (6*endStep + endStart) * fromTo + startPoint - 1.6f * widthVector - 0.5f * heightDiff;
(*arrowVertexArray)[18] = 1.0f * fromTo + startPoint - 1.0f * heightDiff;
}
else
{
(*arrowVertexArray)[16] = 1.0f * fromTo + startPoint + 0.5f * widthVector - 1.0f * heightDiff;
(*arrowVertexArray)[17] = 1.0f * fromTo + startPoint - 0.5f * widthVector - 1.0f * heightDiff;
(*arrowVertexArray)[18] = (6*endStep + endStart) * fromTo + startPoint - 0.5f * heightDiff;
}
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
geo->setVertexArray(arrowVertexArray.p());
if ( useArrowEnd )
geo->setFromFaceList(cvf::UIntArray(producerArrowFaceList, 8 * 5 + 4));
else
geo->setFromFaceList(cvf::UIntArray(injectorArrowFaceList, 8 * 5 + 8));
geo->computeNormals();
return geo;
}

View File

@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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 "cvfBase.h"
#include "cvfObject.h"
#include "cafPdmPointer.h"
#include "cvfVector3.h"
#include "cvfColor4.h"
#include <list>
#include <vector>
#include <utility>
namespace cvf
{
class ModelBasicList;
class DrawableGeo;
class Part;
}
class RivPipeGeometryGenerator;
class RimEclipseView;
class RimEclipseWell;
class RigWellResultFrame;
struct RigWellResultPoint;
class RivWellConnectionsPartMgr : public cvf::Object
{
public:
RivWellConnectionsPartMgr(RimEclipseView* reservoirView, RimEclipseWell* well);
~RivWellConnectionsPartMgr();
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);
private:
cvf::ref<cvf::Part> createArrowPart(const cvf::Vec3f& startPoint,
const cvf::Vec3f& endPoint,
float width,
bool isProducer,
const cvf::Color4f& arrowColor,
bool enableLighting);
cvf::ref< cvf::DrawableGeo> createArrowGeometry(const cvf::Vec3f& startPoint,
const cvf::Vec3f& endPoint,
double width,
bool useArrowEnd);
private:
caf::PdmPointer<RimEclipseView> m_rimReservoirView;
caf::PdmPointer<RimEclipseWell> m_rimWell;
bool m_useCurvedArrows;
};

View File

@ -49,6 +49,7 @@
#include "cvfPart.h"
#include "cvfTransform.h"
#include "cvfqtUtils.h"
#include "cafDisplayCoordTransform.h"
@ -77,71 +78,32 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
clearAllGeometry();
if (m_rimReservoirView.isNull()) return;
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->reservoirData();
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->eclipseCaseData();
RimEclipseWell* well = m_rimWell;
RigSingleWellResultsData* wellResults = well->wellResults();
if (wellResults->staticWellCells().m_wellResultBranches.size() == 0) return;
if (!wellResults->hasWellResult(frameIndex)) return;
const RigWellResultFrame& wellResultFrame = wellResults->wellResultFrame(frameIndex);
const RigCell& whCell = rigReservoir->cellFromWellResultCell(wellResultFrame.m_wellHead);
double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
// Match this position with pipe start position in RivWellPipesPartMgr::calculateWellPipeCenterline()
cvf::Vec3d whStartPos = whCell.faceCenter(cvf::StructGridInterface::NEG_K);
whStartPos -= rigReservoir->mainGrid()->displayModelOffset();
whStartPos.transformPoint(m_scaleTransform->worldTransform());
// Compute well head based on the z position of the top of the K column the well head is part of
cvf::Vec3d whEndPos = whStartPos;
if (m_rimReservoirView->wellCollection()->wellHeadPosition() == RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN)
cvf::Vec3d whEndPos;
cvf::Vec3d whStartPos;
{
// Position well head at top active cell of IJ-column
well->wellHeadTopBottomPosition(frameIndex, &whEndPos, &whStartPos);
size_t i, j, k;
rigReservoir->mainGrid()->ijkFromCellIndex(whCell.mainGridCellIndex(), &i, &j, &k);
size_t kIndexWellHeadCell = k;
k = 0;
size_t topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
while(k < kIndexWellHeadCell && !m_rimReservoirView->currentActiveCellInfo()->isActive(topActiveCellIndex))
{
k++;
topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
}
const RigCell& topActiveCell = rigReservoir->mainGrid()->cell(topActiveCellIndex);
cvf::Vec3d topCellPos = topActiveCell.faceCenter(cvf::StructGridInterface::NEG_K);
topCellPos -= rigReservoir->mainGrid()->displayModelOffset();
topCellPos.transformPoint(m_scaleTransform->worldTransform());
// Modify position if top active cell is closer to sea than well head
if (kIndexWellHeadCell > k)
{
whEndPos.z() = topCellPos.z() + characteristicCellSize;
}
}
else
{
// Position well head at top of active cells bounding box
cvf::Vec3d activeCellsBoundingBoxMax = m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max();
activeCellsBoundingBoxMax -= rigReservoir->mainGrid()->displayModelOffset();
activeCellsBoundingBoxMax.transformPoint(m_scaleTransform->worldTransform());
whEndPos.z() = activeCellsBoundingBoxMax.z();
cvf::ref<caf::DisplayCoordTransform> transForm = m_rimReservoirView->displayCoordTransform();
whEndPos = transForm->transformToDisplayCoord(whEndPos);
whStartPos = transForm->transformToDisplayCoord(whStartPos);
whEndPos.z() += characteristicCellSize;
}
double pipeRadius = m_rimReservoirView->wellCollection()->pipeScaleFactor() * m_rimWell->pipeScaleFactor() * characteristicCellSize;
if (!well->wellResults()->hasWellResult(frameIndex)) return;
const RigWellResultFrame& wellResultFrame = well->wellResults()->wellResultFrame(frameIndex);
double pipeRadius = m_rimWell->pipeRadius();
if (wellResultFrame.m_isOpen)
{
// Use slightly larger well head arrow when well is open
@ -331,7 +293,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
drawableText->setVerticalAlignment(cvf::TextDrawer::CENTER);
drawableText->setTextColor(m_rimReservoirView->wellCollection()->wellLabelColor());
cvf::String cvfString = cvfqt::Utils::toString(well->name());
cvf::String cvfString = cvfqt::Utils::toString(m_rimWell->name());
cvf::Vec3f textCoord(textPosition);
drawableText->addText(cvfString, textCoord);

View File

@ -71,7 +71,7 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLis
{
if (m_rimReservoirView.isNull()) return;
if (!m_rimReservoirView->eclipseCase()) return;
if (!m_rimReservoirView->eclipseCase()->reservoirData()) return;
if (!m_rimReservoirView->eclipseCase()->eclipseCaseData()) return;
const RigMainGrid* mainGrid = m_rimReservoirView->mainGrid();
CVF_ASSERT(mainGrid);

View File

@ -88,6 +88,9 @@ ${CEE_CURRENT_LIST_DIR}RimMdiWindowController.h
${CEE_CURRENT_LIST_DIR}RimPropertyFilter.h
${CEE_CURRENT_LIST_DIR}RimNamedObject.h
${CEE_CURRENT_LIST_DIR}RimCheckableNamedObject.h
${CEE_CURRENT_LIST_DIR}RimGridTimeHistoryCurve.h
${CEE_CURRENT_LIST_DIR}RimPickingTopologyItem.h
${CEE_CURRENT_LIST_DIR}RimEclipseTopologyItem.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -174,6 +177,9 @@ ${CEE_CURRENT_LIST_DIR}RimMdiWindowController.cpp
${CEE_CURRENT_LIST_DIR}RimPropertyFilter.cpp
${CEE_CURRENT_LIST_DIR}RimNamedObject.cpp
${CEE_CURRENT_LIST_DIR}RimCheckableNamedObject.cpp
${CEE_CURRENT_LIST_DIR}RimGridTimeHistoryCurve.cpp
${CEE_CURRENT_LIST_DIR}RimPickingTopologyItem.cpp
${CEE_CURRENT_LIST_DIR}RimEclipseTopologyItem.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -35,20 +35,22 @@
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
#define CROSS_FLOW_ENDING "-XF"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool hasCrossFlowEnding(const QString& tracerName)
bool RimFlowDiagSolution::hasCrossFlowEnding(const QString& tracerName)
{
return tracerName.endsWith("-Xf");
return tracerName.endsWith(CROSS_FLOW_ENDING);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString removeCrossFlowEnding(const QString& tracerName)
QString RimFlowDiagSolution::removeCrossFlowEnding(const QString& tracerName)
{
if (tracerName.endsWith("-Xf"))
if (tracerName.endsWith(CROSS_FLOW_ENDING))
{
return tracerName.left(tracerName.size() - 3);
}
@ -61,9 +63,9 @@ QString removeCrossFlowEnding(const QString& tracerName)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString addCrossFlowEnding(const QString& wellName)
QString RimFlowDiagSolution::addCrossFlowEnding(const QString& wellName)
{
return wellName + "-Xf";
return wellName + CROSS_FLOW_ENDING;
}
//--------------------------------------------------------------------------------------------------
@ -103,9 +105,9 @@ RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
CVF_ASSERT(eclCase && eclCase->reservoirData() );
CVF_ASSERT(eclCase && eclCase->eclipseCaseData() );
timeStepCount = eclCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount();
timeStepCount = eclCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount();
}
@ -127,7 +129,7 @@ std::vector<QString> RimFlowDiagSolution::tracerNames() const
if (eclCase)
{
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->eclipseCaseData()->wellResults();
for (size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx)
{
@ -167,9 +169,9 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
if ( eclCase )
{
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
RigMainGrid* mainGrid = eclCase->reservoirData()->mainGrid();
RigActiveCellInfo* activeCellInfo = eclCase->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); //Todo: Must come from the results definition
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->eclipseCaseData()->wellResults();
RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid();
RigActiveCellInfo* activeCellInfo = eclCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); //Todo: Must come from the results definition
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{
@ -179,10 +181,10 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
bool isInjectorWell = ( wellResFrame.m_productionType != RigWellResultFrame::PRODUCER
&& wellResFrame.m_productionType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE);
std::string wellname = wellResults[wIdx]->m_wellName.toStdString();
std::string wellName = wellResults[wIdx]->m_wellName.toStdString();
std::string wellNameXf = addCrossFlowEnding(wellResults[wIdx]->m_wellName).toStdString();
std::vector<int>& tracerCells = tracersWithCells[wellname];
std::vector<int>& tracerCells = tracersWithCells[wellName];
std::vector<int>& tracerCellsCrossFlow = tracersWithCells[wellNameXf];
for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches)
@ -208,6 +210,9 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
}
}
}
if (tracerCells.empty()) tracersWithCells.erase(wellName);
if (tracerCellsCrossFlow.empty()) tracersWithCells.erase(wellNameXf);
}
}
@ -224,7 +229,7 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(c
TracerStatusType tracerStatus = UNDEFINED;
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{
@ -270,7 +275,7 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfTypeAsserted(eclCase);
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{
@ -334,7 +339,7 @@ cvf::Color3f RimFlowDiagSolution::tracerColor(const QString& tracerName) const
// If we do not find a well color, use index in well result data to be able to get variation of tracer colors
// This can be the case if we do not have any views at all
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{

View File

@ -36,6 +36,7 @@ class RimFlowDiagSolution : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimFlowDiagSolution();
virtual ~RimFlowDiagSolution();
@ -59,6 +60,9 @@ public:
TracerStatusType tracerStatusInTimeStep(const QString& tracerName, size_t timeStepIndex) const;
cvf::Color3f tracerColor(const QString& tracerName) const;
static bool hasCrossFlowEnding(const QString& tracerName);
static QString removeCrossFlowEnding(const QString& tracerName);
static QString addCrossFlowEnding(const QString& wellName);
private:
std::map<std::string, std::vector<int> > allTracerActiveCellIndices(size_t timeStepIndex, bool useInjectors) const;

View File

@ -58,8 +58,8 @@ namespace caf
template<>
void AppEnum<RimWellAllocationPlot::FlowType>::setUp()
{
addItem(RimWellAllocationPlot::ACCUMULATED, "ACCUMULATED", "Well Flow");
addItem(RimWellAllocationPlot::INFLOW, "INFLOW", "In Flow");
addItem(RimWellAllocationPlot::ACCUMULATED, "ACCUMULATED", "Accumulated");
addItem(RimWellAllocationPlot::INFLOW, "INFLOW", "Inflow Rates");
setDefault(RimWellAllocationPlot::ACCUMULATED);
}
@ -179,7 +179,7 @@ void RimWellAllocationPlot::updateFromWell()
if (!m_case) return;
const RigSingleWellResultsData* wellResults = m_case->reservoirData()->findWellResult(m_wellName);
const RigSingleWellResultsData* wellResults = m_case->eclipseCaseData()->findWellResult(m_wellName);
if (!wellResults) return;
@ -188,7 +188,7 @@ void RimWellAllocationPlot::updateFromWell()
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(m_case->reservoirData(),
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(m_case->eclipseCaseData(),
wellResults,
m_timeStep,
true,
@ -207,7 +207,7 @@ void RimWellAllocationPlot::updateFromWell()
{
bool isProducer = ( wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::PRODUCER
|| wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE );
RigEclCellIndexCalculator cellIdxCalc(m_case->reservoirData()->mainGrid(), m_case->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS));
RigEclCellIndexCalculator cellIdxCalc(m_case->eclipseCaseData()->mainGrid(), m_case->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS));
wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords,
pipeBranchesCellIds,
tracerFractionCellValues,
@ -225,12 +225,6 @@ void RimWellAllocationPlot::updateFromWell()
}
}
m_contributingTracerNames.clear();
if (wfCalculator)
{
m_contributingTracerNames = wfCalculator->tracerNames();
}
auto depthType = accumulatedWellFlowPlot()->depthType();
if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) return;
@ -364,7 +358,7 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
{
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, tracerName.toStdString());
const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep);
tracerCellFractionValues[tracerName] = tracerCellFractions;
if (tracerCellFractions) tracerCellFractionValues[tracerName] = tracerCellFractions;
}
}
}
@ -377,7 +371,7 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack)
{
RigEclipseCaseData::UnitsType unitSet = m_case->reservoirData()->unitsType();
RigEclipseCaseData::UnitsType unitSet = m_case->eclipseCaseData()->unitsType();
QString unitText;
switch ( unitSet )
{
@ -448,7 +442,7 @@ QString RimWellAllocationPlot::wellStatusTextForTimeStep(const QString& wellName
if (eclipseResultCase)
{
const RigSingleWellResultsData* wellResults = eclipseResultCase->reservoirData()->findWellResult(wellName);
const RigSingleWellResultsData* wellResults = eclipseResultCase->eclipseCaseData()->findWellResult(wellName);
if (wellResults)
{
@ -541,9 +535,9 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
if (fieldNeedingOptions == &m_wellName)
{
std::set<QString> sortedWellNames;
if ( m_case && m_case->reservoirData() )
if ( m_case && m_case->eclipseCaseData() )
{
const cvf::Collection<RigSingleWellResultsData>& wellRes = m_case->reservoirData()->wellResults();
const cvf::Collection<RigSingleWellResultsData>& wellRes = m_case->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellRes.size(); ++wIdx )
{
@ -566,7 +560,7 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
{
QStringList timeStepNames;
if (m_case && m_case->reservoirData())
if (m_case && m_case->eclipseCaseData())
{
timeStepNames = m_case->timeStepStrings();
}
@ -616,14 +610,6 @@ QString RimWellAllocationPlot::wellName() const
return m_wellName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<QString> RimWellAllocationPlot::contributingTracerNames() const
{
return m_contributingTracerNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -72,7 +72,6 @@ public:
int timeStep();
QString wellName() const;
const std::vector<QString> contributingTracerNames() const;
void removeFromMdiAreaAndDeleteViewWidget();
@ -125,6 +124,4 @@ private:
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot;
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
caf::PdmChildField<RimWellAllocationPlotLegend*> m_wellAllocationPlotLegend;
std::vector<QString> m_contributingTracerNames;
};

View File

@ -30,6 +30,9 @@
#include "qwt_plot.h"
#include "cvfMath.h"
#include <cmath>
//==================================================================================================
@ -152,10 +155,10 @@ void RimWellFlowRateCurve::updateCurveAppearance()
void RimWellFlowRateCurve::updateStackedPlotData()
{
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType(wellLogPlot);
firstAncestorOrThisOfTypeAsserted(wellLogPlot);
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfType(wellLogTrack);
firstAncestorOrThisOfTypeAsserted(wellLogTrack);
bool isFirstTrack = (wellLogTrack == wellLogPlot->trackByIndex(0));
@ -186,6 +189,29 @@ void RimWellFlowRateCurve::updateStackedPlotData()
depthValues.insert(depthValues.begin(), depthValues[0]);
stackedValues.insert(stackedValues.begin(), 0.0);
polyLineStartStopIndices.front().second += 1;
if (wellLogPlot->trackCount() > 1 && isFirstTrack)
{
// Add a dummy negative depth value to make the contribution
// from other branches connected to well head visible
double availableMinDepth;
double availableMaxDepth;
wellLogPlot->availableDepthRange(&availableMinDepth, &availableMaxDepth);
double depthSpan = 0.1 * cvf::Math::abs(availableMinDepth - availableMaxDepth);
// Round off value to floored decade
double logDecValue = log10(depthSpan);
logDecValue = cvf::Math::floor(logDecValue);
depthSpan = pow(10.0, logDecValue);
double dummyNegativeDepthValue = depthValues.back() - depthSpan;
depthValues.push_back(dummyNegativeDepthValue);
stackedValues.push_back(stackedValues.back());
polyLineStartStopIndices.front().second += 1;
}
}
// Add a dummy point for the zeroth connection to make the "end" distribution show better.
@ -233,10 +259,11 @@ RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::setFlowValuesPrDepthValue(const QString& tracerName, const std::vector<double>& connectionNumbers, const std::vector<double>& flowRates)
void RimWellFlowRateCurve::setFlowValuesPrDepthValue(const QString& tracerName, const std::vector<double>& depthValues, const std::vector<double>& flowRates)
{
m_curveData = new RigWellLogCurveData;
m_curveData->setValuesAndMD(flowRates, connectionNumbers, RimDefines::UNIT_NONE, false);
m_curveData->setValuesAndMD(flowRates, depthValues, RimDefines::UNIT_NONE, false);
m_tracerName = tracerName;
}

View File

@ -38,7 +38,7 @@ public:
RimWellFlowRateCurve();
virtual ~RimWellFlowRateCurve();
void setFlowValuesPrDepthValue(const QString& tracerName , const std::vector<double>& connectionNumbers, const std::vector<double>& flowRates);
void setFlowValuesPrDepthValue(const QString& tracerName , const std::vector<double>& depthValues, const std::vector<double>& flowRates);
void updateStackedPlotData();
virtual QString wellName() const override;

View File

@ -207,7 +207,7 @@ void Rim3dOverlayInfoConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
}
statGroup->add(&m_statisticsCellRange);
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
@ -346,8 +346,8 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
{
caseName = eclipseView->eclipseCase()->caseUserDescription();
totCellCount = QString::number(eclipseView->mainGrid()->globalCellArray().size());
size_t mxActCellCount = eclipseView->eclipseCase()->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->reservoirActiveCellCount();
size_t frActCellCount = eclipseView->eclipseCase()->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->reservoirActiveCellCount();
size_t mxActCellCount = eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->reservoirActiveCellCount();
size_t frActCellCount = eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->reservoirActiveCellCount();
if (frActCellCount > 0) activeCellCountText += "Matrix : ";
activeCellCountText += QString::number(mxActCellCount);
if (frActCellCount > 0) activeCellCountText += " Fracture : " + QString::number(frActCellCount);

View File

@ -262,7 +262,7 @@ void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
if (isUsingSingleVariable())
{
m_singleVarEdgeResultColors->defineUiOrdering(uiConfigName,uiOrdering );
m_singleVarEdgeResultColors->uiOrdering(uiConfigName,uiOrdering );
}
else
{
@ -273,7 +273,7 @@ void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
uiOrdering.add(&useZVariable);
}
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
@ -282,7 +282,7 @@ void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
void RimCellEdgeColors::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
{
uiTreeOrdering.add(legendConfig());
uiTreeOrdering.setForgetRemainingFields(true);
uiTreeOrdering.skipRemainingChildren(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -296,8 +296,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicNewSummaryCurveFeature";
commandIds << "Separator";
commandIds << "RicCopyReferencesToClipboardFeature";
commandIds << "Separator";
commandIds << "RicSummaryCurveSwitchAxisFeature";
}
else if(dynamic_cast<RimSummaryCurveFilter*>(uiItem))
{
@ -307,8 +305,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicNewSummaryCurveFeature";
commandIds << "Separator";
commandIds << "RicCopyReferencesToClipboardFeature";
commandIds << "Separator";
commandIds << "RicSummaryCurveSwitchAxisFeature";
}
else if (dynamic_cast<RimSummaryCase*>(uiItem))
{
@ -380,7 +376,11 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
// is aware of multiple selected items, move the command to this list
// without using dyncamic_cast.
commandIds << "RicPasteTimeHistoryCurveFeature";
commandIds << "RicCopyReferencesToClipboardFeature";
commandIds << "RicShowPlotDataFeature";
commandIds << "RicSummaryCurveSwitchAxisFeature";
// Work in progress -- End
@ -397,12 +397,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
{
commandIds << "RicExecuteScriptForCasesFeature";
}
else if (dynamic_cast<RimSummaryCurve*>(uiItem) ||
dynamic_cast<RimSummaryCurveFilter*>(uiItem) )
{
commandIds << "RicSummaryCurveSwitchAxisFeature";
}
else if (dynamic_cast<RimSummaryPlot*>(uiItem))
{
commandIds << "RicAsciiExportSummaryPlotFeature";
@ -488,15 +482,29 @@ void RimContextCommandBuilder::appendCommandsToMenu(const QStringList& commandId
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
for (int i = 0; i < commandIds.size(); i++)
{
caf::CmdFeature* feature = commandManager->getCommandFeature(commandIds[i].toStdString());
CVF_ASSERT(feature);
if (feature->canFeatureBeExecuted())
if (commandIds[i] == "Separator")
{
QAction* act = commandManager->action(commandIds[i]);
CVF_ASSERT(act);
menu->addSeparator();
}
else
{
caf::CmdFeature* feature = commandManager->getCommandFeature(commandIds[i].toStdString());
CVF_ASSERT(feature);
menu->addAction(act);
if (feature->canFeatureBeExecuted())
{
QAction* act = commandManager->action(commandIds[i]);
CVF_ASSERT(act);
for (QAction* existingAct : menu->actions())
{
// If action exist, continue to make sure the action is positioned at the first
// location of a command ID
if (existingAct == act) continue;
}
menu->addAction(act);
}
}
}
}

View File

@ -105,22 +105,22 @@ RimEclipseCase::~RimEclipseCase()
RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection();
if (plotCollection)
{
plotCollection->removeExtractors(this->reservoirData());
plotCollection->removeExtractors(this->eclipseCaseData());
}
}
}
if (this->reservoirData())
if (this->eclipseCaseData())
{
// At this point, we assume that memory should be released
CVF_ASSERT(this->reservoirData()->refCount() == 1);
CVF_ASSERT(this->eclipseCaseData()->refCount() == 1);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseCaseData* RimEclipseCase::reservoirData()
RigEclipseCaseData* RimEclipseCase::eclipseCaseData()
{
return m_rigEclipseCase.p();
}
@ -128,7 +128,7 @@ RigEclipseCaseData* RimEclipseCase::reservoirData()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigEclipseCaseData* RimEclipseCase::reservoirData() const
const RigEclipseCaseData* RimEclipseCase::eclipseCaseData() const
{
return m_rigEclipseCase.p();
}
@ -255,7 +255,7 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
{
if (changedField == &releaseResultMemory)
{
if (this->reservoirData())
if (this->eclipseCaseData())
{
for (size_t i = 0; i < reservoirViews().size(); i++)
{
@ -277,13 +277,13 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
reservoirView->createDisplayModelAndRedraw();
}
RigCaseCellResultsData* matrixModelResults = reservoirData()->results(RifReaderInterface::MATRIX_RESULTS);
RigCaseCellResultsData* matrixModelResults = eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS);
if (matrixModelResults)
{
matrixModelResults->clearAllResults();
}
RigCaseCellResultsData* fractureModelResults = reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS);
RigCaseCellResultsData* fractureModelResults = eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS);
if (fractureModelResults)
{
fractureModelResults->clearAllResults();
@ -294,7 +294,7 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
}
else if (changedField == &flipXAxis || changedField == &flipYAxis)
{
RigEclipseCaseData* rigEclipseCase = reservoirData();
RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
if (rigEclipseCase)
{
rigEclipseCase->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
@ -306,7 +306,7 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
RimEclipseView* reservoirView = reservoirViews()[i];
reservoirView->scheduleReservoirGridGeometryRegen();
reservoirView->schedulePipeGeometryRegen();
reservoirView->scheduleSimWellGeometryRegen();
reservoirView->createDisplayModelAndRedraw();
}
}
@ -323,7 +323,7 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::updateFormationNamesData()
{
RigEclipseCaseData* rigEclipseCase = reservoirData();
RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
if(rigEclipseCase)
{
if(activeFormationNames())
@ -381,7 +381,7 @@ void RimEclipseCase::updateFormationNamesData()
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::computeCachedData()
{
RigEclipseCaseData* rigEclipseCase = reservoirData();
RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
if (rigEclipseCase)
{
caf::ProgressInfo pInf(30, "");
@ -428,12 +428,12 @@ RimCaseCollection* RimEclipseCase::parentCaseCollection()
void RimEclipseCase::setReservoirData(RigEclipseCaseData* eclipseCase)
{
m_rigEclipseCase = eclipseCase;
if (this->reservoirData())
if (this->eclipseCaseData())
{
m_fractureModelResults()->setCellResults(reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS));
m_matrixModelResults()->setCellResults(reservoirData()->results(RifReaderInterface::MATRIX_RESULTS));
m_fractureModelResults()->setMainGrid(this->reservoirData()->mainGrid());
m_matrixModelResults()->setMainGrid(this->reservoirData()->mainGrid());
m_fractureModelResults()->setCellResults(eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS));
m_matrixModelResults()->setCellResults(eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS));
m_fractureModelResults()->setMainGrid(this->eclipseCaseData()->mainGrid());
m_matrixModelResults()->setMainGrid(this->eclipseCaseData()->mainGrid());
}
else
{
@ -511,7 +511,7 @@ bool RimEclipseCase::openReserviorCase()
{
// If read already, return
if (this->reservoirData() != NULL) return true;
if (this->eclipseCaseData() != NULL) return true;
if (!openEclipseGridFile())
{
@ -528,7 +528,7 @@ bool RimEclipseCase::openReserviorCase()
size_t combinedTransResIdx = results->cellResults()->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedTransmissibilityResultName());
if (combinedTransResIdx != cvf::UNDEFINED_SIZE_T)
{
reservoirData()->mainGrid()->nncData()->setCombTransmisibilityScalarResultIndex(combinedTransResIdx);
eclipseCaseData()->mainGrid()->nncData()->setCombTransmisibilityScalarResultIndex(combinedTransResIdx);
}
}

View File

@ -67,8 +67,8 @@ public:
bool openReserviorCase();
virtual bool openEclipseGridFile() = 0;
RigEclipseCaseData* reservoirData();
const RigEclipseCaseData* reservoirData() const;
RigEclipseCaseData* eclipseCaseData();
const RigEclipseCaseData* eclipseCaseData() const;
RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel);

View File

@ -76,7 +76,7 @@ RimIdenticalGridCaseGroup* RimEclipseCaseCollection::createIdenticalCaseGroupFro
{
CVF_ASSERT(mainCase);
RigEclipseCaseData* rigEclipseCase = mainCase->reservoirData();
RigEclipseCaseData* rigEclipseCase = mainCase->eclipseCaseData();
RigMainGrid* equalGrid = registerCaseInGridCollection(rigEclipseCase);
CVF_ASSERT(equalGrid);
@ -101,7 +101,7 @@ void RimEclipseCaseCollection::moveEclipseCaseIntoCaseGroup(RimEclipseCase* rimR
{
CVF_ASSERT(rimReservoir);
RigEclipseCaseData* rigEclipseCase = rimReservoir->reservoirData();
RigEclipseCaseData* rigEclipseCase = rimReservoir->eclipseCaseData();
RigMainGrid* equalGrid = registerCaseInGridCollection(rigEclipseCase);
CVF_ASSERT(equalGrid);
@ -139,7 +139,7 @@ void RimEclipseCaseCollection::moveEclipseCaseIntoCaseGroup(RimEclipseCase* rimR
//--------------------------------------------------------------------------------------------------
void RimEclipseCaseCollection::removeCaseFromAllGroups(RimEclipseCase* reservoir)
{
m_gridCollection->removeCase(reservoir->reservoirData());
m_gridCollection->removeCase(reservoir->eclipseCaseData());
for (size_t i = 0; i < caseGroups.size(); i++)
{
@ -188,7 +188,7 @@ void RimEclipseCaseCollection::insertCaseInCaseGroup(RimIdenticalGridCaseGroup*
{
CVF_ASSERT(rimReservoir);
RigEclipseCaseData* rigEclipseCase = rimReservoir->reservoirData();
RigEclipseCaseData* rigEclipseCase = rimReservoir->eclipseCaseData();
registerCaseInGridCollection(rigEclipseCase);
caseGroup->addCase(rimReservoir);

View File

@ -194,7 +194,7 @@ void RimEclipseCellColors::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOr
uiTreeOrdering.add(m_legendConfigPtrField());
}
uiTreeOrdering.setForgetRemainingFields(true);
uiTreeOrdering.skipRemainingChildren(true);
}
//--------------------------------------------------------------------------------------------------
@ -241,6 +241,33 @@ RimEclipseView* RimEclipseCellColors::reservoirView()
return m_reservoirView;
}
bool operator<(const cvf::Color3ub first, const cvf::Color3ub second)
{
if (first.r() != second.r()) return first.r() < second.r();
if (first.g() != second.g()) return first.g() < second.g();
if (first.b() != second.b()) return first.b() < second.b();
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class TupleCompare
{
public :
bool operator() (const std::tuple<QString, int, cvf::Color3ub>& t1, const std::tuple<QString, int, cvf::Color3ub>& t2) const
{
using namespace std;
if (get<0>(t1) != get<0>(t2)) return get<0>(t1) < get<0>(t2);
if (get<1>(t1) != get<1>(t2)) return get<1>(t1) < get<1>(t2);
if (get<2>(t1) != get<2>(t2)) return get<2>(t1) < get<2>(t2);
return false;
}
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -282,32 +309,28 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
if (this->hasCategoryResult())
{
std::vector<std::tuple<QString, int, cvf::Color3ub>> categories;
std::set<std::tuple<QString, int, cvf::Color3ub>, TupleCompare > categories;
//std::set<std::tuple<QString, int, cvf::Color3ub> > categories;
std::vector<QString> tracerNames = this->flowDiagSolution()->tracerNames();
// Loop through the wells to get same ordering as the wells in tree view
for (size_t i = 0; i < m_reservoirView->wellCollection()->wells().size(); i++)
int tracerIndex = 0;
for (const auto& tracerName : tracerNames)
{
size_t reverseIndex = m_reservoirView->wellCollection()->wells().size() - i - 1;
RimEclipseWell* well = m_reservoirView->wellCollection()->findWell(RimFlowDiagSolution::removeCrossFlowEnding(tracerName));
cvf::Color3ub color(cvf::Color3::GRAY);
if (well) color = cvf::Color3ub(well->wellPipeColor());
RimEclipseWell* well = m_reservoirView->wellCollection()->wells()[reverseIndex];
QString wellName = well->name();
auto tracer = std::find(begin(tracerNames), end(tracerNames), wellName);
if (tracer != end(tracerNames))
{
// The category value is defined as the index of the tracer name in the tracer name vector
size_t categoryValue = std::distance(begin(tracerNames), tracer);
cvf::Color3ub color(cvf::Color3::SEA_GREEN);
color = cvf::Color3ub(well->wellPipeColor());
categories.push_back(std::make_tuple(wellName, static_cast<int>(categoryValue), color));
}
categories.insert(std::make_tuple(tracerName, tracerIndex, color));
++tracerIndex;
}
this->legendConfig()->setCategoryItems(categories);
std::vector<std::tuple<QString, int, cvf::Color3ub>> reverseCategories;
for (auto tupIt = categories.rbegin(); tupIt != categories.rend(); ++tupIt)
{
reverseCategories.push_back(*tupIt);
}
this->legendConfig()->setCategoryItems(reverseCategories);
}
}
else
@ -317,7 +340,7 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
CVF_ASSERT(rimEclipseCase);
if (!rimEclipseCase) return;
RigEclipseCaseData* eclipseCase = rimEclipseCase->reservoirData();
RigEclipseCaseData* eclipseCase = rimEclipseCase->eclipseCaseData();
CVF_ASSERT(eclipseCase);
if (!eclipseCase) return;

View File

@ -111,7 +111,7 @@ caf::PdmFieldHandle* RimEclipseFaultColors::objectToggleField()
void RimEclipseFaultColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
m_customFaultResultColors->defineUiOrdering(uiConfigName, *group1);
m_customFaultResultColors->uiOrdering(uiConfigName, *group1);
}
//--------------------------------------------------------------------------------------------------

View File

@ -82,8 +82,8 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->computeDerivedData();
reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->computeDerivedData();
eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->computeDerivedData();
eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->computeDerivedData();
QFileInfo gridFileName(fileNames[0]);
QString caseName = gridFileName.completeBaseName();
@ -94,19 +94,19 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
return;
}
if (this->reservoirData() == NULL)
if (this->eclipseCaseData() == NULL)
{
this->setReservoirData(new RigEclipseCaseData);
}
// First find and read the grid data
if (this->reservoirData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
if (this->eclipseCaseData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
{
RiaPreferences* prefs = RiaApplication::instance()->preferences();
for (int i = 0; i < fileNames.size(); i++)
{
if (RifEclipseInputFileTools::openGridFile(fileNames[i], this->reservoirData(), prefs->readerSettings->importFaults()))
if (RifEclipseInputFileTools::openGridFile(fileNames[i], this->eclipseCaseData(), prefs->readerSettings->importFaults()))
{
m_gridFileName = fileNames[i];
@ -115,7 +115,7 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
this->caseUserDescription = caseName;
this->reservoirData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
this->eclipseCaseData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
computeCachedData();
@ -124,7 +124,7 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
}
}
if (this->reservoirData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
if (this->eclipseCaseData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
{
return ; // No grid present
}
@ -152,7 +152,7 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
for (int i = 0; i < filesToRead.size(); i++)
{
QString propertyFileName = filesToRead[i];
std::map<QString, QString> readProperties = RifEclipseInputFileTools::readProperties(propertyFileName, this->reservoirData());
std::map<QString, QString> readProperties = RifEclipseInputFileTools::readProperties(propertyFileName, this->eclipseCaseData());
std::map<QString, QString>::iterator it;
for (it = readProperties.begin(); it != readProperties.end(); ++it)
@ -179,7 +179,7 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
bool RimEclipseInputCase::openEclipseGridFile()
{
// Early exit if reservoir data is created
if (this->reservoirData() == NULL)
if (this->eclipseCaseData() == NULL)
{
cvf::ref<RifReaderInterface> readerInterface;
@ -202,13 +202,13 @@ bool RimEclipseInputCase::openEclipseGridFile()
this->setReservoirData( eclipseCase.p() );
}
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->eclipseCaseData());
CVF_ASSERT(readerInterface.notNull());
results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
this->reservoirData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
this->eclipseCaseData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
computeCachedData();
loadAndSyncronizeInputProperties();
@ -237,8 +237,8 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
{
// Make sure we actually have reservoir data
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->reservoirData()->mainGrid()->gridPointDimensions() != cvf::Vec3st(0,0,0));
CVF_ASSERT(this->eclipseCaseData());
CVF_ASSERT(this->eclipseCaseData()->mainGrid()->gridPointDimensions() != cvf::Vec3st(0,0,0));
// Then read the properties from all the files referenced by the InputReservoir
@ -287,7 +287,7 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
ipsUsingThisFile[ipIdx]->resolvedState = RimEclipseInputProperty::KEYWORD_NOT_IN_FILE;
if (fileKeywordSet.count(kw))
{
if (RifEclipseInputFileTools::readProperty(filenames[i], this->reservoirData(), kw, ipsUsingThisFile[ipIdx]->resultName ))
if (RifEclipseInputFileTools::readProperty(filenames[i], this->eclipseCaseData(), kw, ipsUsingThisFile[ipIdx]->resultName ))
{
ipsUsingThisFile[ipIdx]->resolvedState = RimEclipseInputProperty::RESOLVED;
}
@ -304,8 +304,8 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
for (const QString fileKeyword : fileKeywordSet)
{
{
QString resultName = this->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeyword);
if (RifEclipseInputFileTools::readProperty(filenames[i], this->reservoirData(), fileKeyword, resultName))
QString resultName = this->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeyword);
if (RifEclipseInputFileTools::readProperty(filenames[i], this->eclipseCaseData(), fileKeyword, resultName))
{
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
inputProperty->resultName = resultName;

View File

@ -99,8 +99,8 @@ void RimEclipseInputCaseOpm::appendPropertiesFromStandaloneFiles(const QStringLi
if (fileKeywordSet.count(knownKeyword) > 0)
{
QString qtKnownKeyword = QString::fromStdString(knownKeyword);
QString resultName = this->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(qtKnownKeyword);
if (propertyReader.copyPropertyToCaseData(knownKeyword, this->reservoirData(), resultName))
QString resultName = this->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(qtKnownKeyword);
if (propertyReader.copyPropertyToCaseData(knownKeyword, this->eclipseCaseData(), resultName))
{
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
inputProperty->resultName = resultName;
@ -160,18 +160,18 @@ void RimEclipseInputCaseOpm::updateFilePathsFromProjectPath(const QString& newPr
//--------------------------------------------------------------------------------------------------
void RimEclipseInputCaseOpm::importEclipseGridAndProperties(const QString& fileName)
{
if (this->reservoirData() == NULL)
if (this->eclipseCaseData() == NULL)
{
this->setReservoirData(new RigEclipseCaseData);
RifReaderOpmParserInput::importGridPropertiesFaults(fileName, reservoirData());
RifReaderOpmParserInput::importGridPropertiesFaults(fileName, eclipseCaseData());
if (this->reservoirData()->mainGrid() == NULL)
if (this->eclipseCaseData()->mainGrid() == NULL)
{
return;
}
this->reservoirData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
this->eclipseCaseData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
computeCachedData();
@ -194,8 +194,8 @@ void RimEclipseInputCaseOpm::loadAndSyncronizeInputProperties()
{
// Make sure we actually have reservoir data
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->reservoirData()->mainGrid()->gridPointDimensions() != cvf::Vec3st(0, 0, 0));
CVF_ASSERT(this->eclipseCaseData());
CVF_ASSERT(this->eclipseCaseData()->mainGrid()->gridPointDimensions() != cvf::Vec3st(0, 0, 0));
// Then read the properties from all the files referenced by the InputReservoir
@ -226,7 +226,7 @@ void RimEclipseInputCaseOpm::loadAndSyncronizeInputProperties()
inputProperty->resolvedState = RimEclipseInputProperty::KEYWORD_NOT_IN_FILE;
if (fileKeywordSet.count(kw.toStdString()))
{
if (propertyReader.copyPropertyToCaseData(kw.toStdString(), this->reservoirData(), inputProperty->resultName))
if (propertyReader.copyPropertyToCaseData(kw.toStdString(), this->eclipseCaseData(), inputProperty->resultName))
{
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
}
@ -242,8 +242,8 @@ void RimEclipseInputCaseOpm::loadAndSyncronizeInputProperties()
if (fileKeywordSet.count(knownKeyword) > 0)
{
QString qtKnownKeyword = QString::fromStdString(knownKeyword);
QString resultName = this->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(qtKnownKeyword);
if (propertyReader.copyPropertyToCaseData(knownKeyword, this->reservoirData(), resultName))
QString resultName = this->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(qtKnownKeyword);
if (propertyReader.copyPropertyToCaseData(knownKeyword, this->eclipseCaseData(), resultName))
{
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
inputProperty->resultName = resultName;

View File

@ -91,7 +91,7 @@ void RimEclipseInputProperty::fieldChangedByUi(const caf::PdmFieldHandle* change
QString oldName = oldValue.toString();
QString newName = newValue.toString();
RigCaseCellResultsData* matrixResults = rimCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS);
RigCaseCellResultsData* matrixResults = rimCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS);
if (matrixResults)
{
if (matrixResults->updateResultName(RimDefines::INPUT_PROPERTY, oldName, newName))
@ -100,7 +100,7 @@ void RimEclipseInputProperty::fieldChangedByUi(const caf::PdmFieldHandle* change
}
}
RigCaseCellResultsData* fracResults = rimCase->reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS);
RigCaseCellResultsData* fracResults = rimCase->eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS);
if (fracResults)
{
if (fracResults->updateResultName(RimDefines::INPUT_PROPERTY, oldName, newName))

View File

@ -22,12 +22,14 @@
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigFlowDiagResults.h"
#include "RigFormationNames.h"
#include "RimEclipseCase.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseResultDefinition.h"
#include "RimEclipseView.h"
#include "RimFlowDiagSolution.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimViewController.h"
@ -37,8 +39,8 @@
#include "cvfAssert.h"
#include "cvfMath.h"
#include "RigFlowDiagResults.h"
#include "RimFlowDiagSolution.h"
#include <cmath> // Needed for HUGE_VAL on Linux
namespace caf
@ -74,6 +76,11 @@ RimEclipsePropertyFilter::RimEclipsePropertyFilter()
resultDefinition.uiCapability()->setUiHidden(true);
resultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitField(&m_rangeLabelText, "Dummy_keyword", QString("Range Type"), "Range Type", "", "", "");
m_rangeLabelText.xmlCapability()->setIOReadable(false);
m_rangeLabelText.xmlCapability()->setIOWritable(false);
m_rangeLabelText.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&m_lowerBound, "LowerBound", 0.0, "Min", "", "", "");
m_lowerBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
@ -124,7 +131,6 @@ bool RimEclipsePropertyFilter::isCategorySelectionActive() const
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if ( &m_lowerBound == changedField
|| &m_upperBound == changedField
|| &obsoleteField_evaluationRegion == changedField
@ -146,7 +152,10 @@ void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* chang
//--------------------------------------------------------------------------------------------------
RimEclipsePropertyFilterCollection* RimEclipsePropertyFilter::parentContainer()
{
return dynamic_cast<RimEclipsePropertyFilterCollection*>(this->parentField()->ownerObject());
RimEclipsePropertyFilterCollection* propFilterColl = nullptr;
this->firstAncestorOrThisOfTypeAsserted(propFilterColl);
return propFilterColl;
}
//--------------------------------------------------------------------------------------------------
@ -163,7 +172,6 @@ void RimEclipsePropertyFilter::setToDefaultValues()
m_selectedCategoryValues = m_categoryValues;
m_useCategorySelection = true;
}
//--------------------------------------------------------------------------------------------------
@ -176,10 +184,12 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
// Fields declared in RimResultDefinition
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
resultDefinition->defineUiOrdering(uiConfigName, *group1);
resultDefinition->uiOrdering(uiConfigName, *group1);
// Fields declared in RimCellFilter
uiOrdering.add(&filterMode);
uiOrdering.add(&m_rangeLabelText);
if (resultDefinition->hasCategoryResult())
{
@ -196,9 +206,10 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
uiOrdering.add(&m_upperBound);
}
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
updateReadOnlyStateOfAllFields();
updateRangeLabel();
}
//--------------------------------------------------------------------------------------------------
@ -226,9 +237,26 @@ void RimEclipsePropertyFilter::updateReadOnlyStateOfAllFields()
objFields.push_back(&(resultDefinition->m_porosityModelUiField));
objFields.push_back(&(resultDefinition->m_resultVariableUiField));
for (size_t i = 0; i < objFields.size(); i++)
for (auto f : objFields)
{
objFields[i]->uiCapability()->setUiReadOnly(readOnlyState);
if (f == &m_rangeLabelText) continue;
f->uiCapability()->setUiReadOnly(readOnlyState);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::updateRangeLabel()
{
if (resultDefinition->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
m_rangeLabelText = "Current Timestep";
}
else
{
m_rangeLabelText = "All Timesteps";
}
}
@ -237,19 +265,15 @@ void RimEclipsePropertyFilter::updateReadOnlyStateOfAllFields()
//--------------------------------------------------------------------------------------------------
bool RimEclipsePropertyFilter::isPropertyFilterControlled()
{
RimView* rimView = NULL;
firstAncestorOrThisOfType(rimView);
CVF_ASSERT(rimView);
RimView* rimView = nullptr;
firstAncestorOrThisOfTypeAsserted(rimView);
bool isPropertyFilterControlled = false;
if (rimView)
RimViewController* vc = rimView->viewController();
if (vc && vc->isPropertyFilterOveridden())
{
RimViewController* vc = rimView->viewController();
if (vc && vc->isPropertyFilterOveridden())
{
isPropertyFilterControlled = true;
}
isPropertyFilterControlled = true;
}
return isPropertyFilterControlled;
@ -293,8 +317,8 @@ void RimEclipsePropertyFilter::computeResultValueRange()
{
CVF_ASSERT(parentContainer());
double min = 0.0;
double max = 0.0;
double min = HUGE_VAL;
double max = -HUGE_VAL;
clearCategories();
@ -309,7 +333,7 @@ void RimEclipsePropertyFilter::computeResultValueRange()
if ( resultDefinition->flowDiagSolution() )
{
RigFlowDiagResults* results = resultDefinition->flowDiagSolution()->flowDiagResults();
results->minMaxScalarValues(resAddr, timeStep, &max, &max);
results->minMaxScalarValues(resAddr, timeStep, &min, &max);
if ( resultDefinition->hasCategoryResult() )
{
@ -335,10 +359,10 @@ void RimEclipsePropertyFilter::computeResultValueRange()
}
else
{
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData());
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames());
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->eclipseCaseData());
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->eclipseCaseData()->activeFormationNames());
const std::vector<QString>& fnVector = parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
const std::vector<QString>& fnVector = parentContainer()->reservoirView()->eclipseCase()->eclipseCaseData()->activeFormationNames()->formationNames();
setCategoryNames(fnVector);
}
}
@ -352,6 +376,88 @@ void RimEclipsePropertyFilter::computeResultValueRange()
m_upperBound.uiCapability()->setUiName(QString("Max (%1)").arg(max));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::updateFromCurrentTimeStep()
{
// Update range for flow diagnostics values when time step changes
// Range for flow is always current time step, not computed across all time steps
// If upper/lower slider is set to available extrema, the filter values will be
// updated with the min/max values for the current time step
//
// If the user manually has set a filter value, this value is left untouched
if (resultDefinition->resultType() != RimDefines::FLOW_DIAGNOSTICS)
{
return;
}
double threshold = 1e-6;
bool followMin = false;
if (fabs(m_lowerBound - m_minimumResultValue) < threshold || m_minimumResultValue == HUGE_VAL)
{
followMin = true;
}
bool followMax = false;
if (fabs(m_upperBound - m_maximumResultValue) < threshold || m_maximumResultValue == -HUGE_VAL)
{
followMax = true;
}
double min = HUGE_VAL;
double max = -HUGE_VAL;
clearCategories();
RimView* view = nullptr;
this->firstAncestorOrThisOfTypeAsserted(view);
int timeStep = view->currentTimeStep();
RigFlowDiagResultAddress resAddr = resultDefinition->flowDiagResAddress();
if (resultDefinition->flowDiagSolution())
{
RigFlowDiagResults* results = resultDefinition->flowDiagSolution()->flowDiagResults();
results->minMaxScalarValues(resAddr, timeStep, &min, &max);
if (resultDefinition->hasCategoryResult())
{
setCategoryNames(resultDefinition->flowDiagSolution()->tracerNames());
}
}
if (min == HUGE_VAL && max == -HUGE_VAL)
{
m_lowerBound.uiCapability()->setUiName(QString("Min (inf)"));
m_upperBound.uiCapability()->setUiName(QString("Max (inf)"));
}
else
{
m_maximumResultValue = max;
m_minimumResultValue = min;
if (followMin)
{
m_lowerBound = min;
}
if (followMax)
{
m_upperBound = m_maximumResultValue;
}
m_lowerBound.uiCapability()->setUiName(QString("Min (%1)").arg(min));
m_upperBound.uiCapability()->setUiName(QString("Max (%1)").arg(max));
}
m_lowerBound.uiCapability()->updateConnectedEditors();
m_upperBound.uiCapability()->updateConnectedEditors();
updateFilterName();
this->name.uiCapability()->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -407,4 +513,3 @@ void RimEclipsePropertyFilter::initAfterRead()
resultDefinition->setEclipseCase(parentContainer()->reservoirView()->eclipseCase());
updateIconState();
}

View File

@ -49,15 +49,14 @@ public:
void rangeValues(double* lower, double* upper) const;
bool isCategorySelectionActive() const;
RimEclipsePropertyFilterCollection* parentContainer();
void setToDefaultValues();
void updateFilterName();
void computeResultValueRange();
void updateFromCurrentTimeStep();
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void initAfterRead();
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName);
@ -70,9 +69,13 @@ private:
void updateActiveState();
void updateReadOnlyStateOfAllFields();
void updateRangeLabel();
bool isPropertyFilterControlled();
RimEclipsePropertyFilterCollection* parentContainer();
private:
caf::PdmField<QString> m_rangeLabelText;
caf::PdmField<double> m_lowerBound;
caf::PdmField<double> m_upperBound;

View File

@ -167,3 +167,14 @@ void RimEclipsePropertyFilterCollection::updateIconState()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilterCollection::updateFromCurrentTimeStep()
{
for (RimEclipsePropertyFilter* cellFilter : propertyFilters())
{
cellFilter->updateFromCurrentTimeStep();
}
}

View File

@ -51,6 +51,7 @@ public:
void loadAndInitializePropertyFilters();
void updateIconState();
void updateFromCurrentTimeStep();
protected:
// Overridden methods

View File

@ -124,7 +124,7 @@ bool RimEclipseResultCase::openEclipseGridFile()
progInfo.incrementProgress();
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->eclipseCaseData());
CVF_ASSERT(readerInterface.notNull());
progInfo.setProgressDescription("Computing Case Cache");
@ -133,7 +133,7 @@ bool RimEclipseResultCase::openEclipseGridFile()
m_gridAndWellDataIsReadFromFile = true;
m_activeCellInfoIsReadFromFile = true;
if (reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes())
if (eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes())
{
m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this);
@ -177,15 +177,12 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl
CVF_ASSERT(mainEclipseCase && mainEclipseCase->mainGrid());
eclipseCase->setMainGrid(mainEclipseCase->mainGrid());
size_t scalarIndexWithMaxTimeStepCount = cvf::UNDEFINED_SIZE_T;
mainEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount(&scalarIndexWithMaxTimeStepCount);
if (scalarIndexWithMaxTimeStepCount == cvf::UNDEFINED_SIZE_T)
std::vector<QDateTime> timeStepDates = mainEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->timeStepDates();
if (timeStepDates.size() == 0)
{
return false;
}
std::vector<QDateTime> timeStepDates = mainEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->timeStepDates(scalarIndexWithMaxTimeStepCount);
cvf::ref<RifReaderEclipseOutput> readerEclipseOutput = new RifReaderEclipseOutput;
if (!readerEclipseOutput->openAndReadActiveCellData(caseFileName(), timeStepDates, eclipseCase.p()))
{
@ -202,10 +199,10 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl
results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->eclipseCaseData());
CVF_ASSERT(readerInterface.notNull());
reservoirData()->computeActiveCellBoundingBoxes();
eclipseCaseData()->computeActiveCellBoundingBoxes();
m_activeCellInfoIsReadFromFile = true;

View File

@ -33,10 +33,10 @@
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimFlowDiagSolution.h"
#include "RimPlotCurve.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimView.h"
#include "RimViewLinker.h"
#include "RimWellLogCurve.h"
#include "cafPdmUiListEditor.h"
@ -242,7 +242,7 @@ void RimEclipseResultDefinition::updateAnyFieldHasChanged()
cellColors->updateConnectedEditors();
}
RimWellLogCurve* curve = nullptr;
RimPlotCurve* curve = nullptr;
this->firstAncestorOrThisOfType(curve);
if (curve)
{
@ -339,7 +339,7 @@ void RimEclipseResultDefinition::loadDataAndUpdate()
}
}
RimWellLogCurve* curve = nullptr;
RimPlotCurve* curve = nullptr;
this->firstAncestorOrThisOfType(curve);
if (curve)
{
@ -359,9 +359,9 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
bool hasFlowDiagFluxes = false;
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
if ( eclResCase && eclResCase->reservoirData() )
if ( eclResCase && eclResCase->eclipseCaseData() )
{
hasFlowDiagFluxes = eclResCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes();
hasFlowDiagFluxes = eclResCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes();
}
// Do not include flow diag results if not available
@ -521,7 +521,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
// Remove Per Cell Face options
{
RimWellLogCurve* curve = nullptr;
RimPlotCurve* curve = nullptr;
this->firstAncestorOrThisOfType(curve);
RimEclipsePropertyFilter* propFilter = nullptr;
@ -886,8 +886,8 @@ bool RimEclipseResultDefinition::hasCategoryResult() const
{
if (this->m_resultType() == RimDefines::FORMATION_NAMES
&& m_eclipseCase
&& m_eclipseCase->reservoirData()
&& m_eclipseCase->reservoirData()->activeFormationNames() ) return true;
&& m_eclipseCase->eclipseCaseData()
&& m_eclipseCase->eclipseCaseData()->activeFormationNames() ) return true;
if (this->m_resultType() == RimDefines::FLOW_DIAGNOSTICS
&& m_resultVariable() == RIG_FLD_MAX_FRACTION_TRACER_RESNAME) return true;
@ -904,9 +904,9 @@ bool RimEclipseResultDefinition::hasCategoryResult() const
bool RimEclipseResultDefinition::hasDualPorFractureResult()
{
if ( m_eclipseCase
&& m_eclipseCase->reservoirData()
&& m_eclipseCase->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)
&& m_eclipseCase->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->reservoirActiveCellCount() > 0 )
&& m_eclipseCase->eclipseCaseData()
&& m_eclipseCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)
&& m_eclipseCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->reservoirActiveCellCount() > 0 )
{
return true;
}
@ -945,7 +945,7 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
}
uiOrdering.add(&m_resultVariableUiField);
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -93,6 +93,7 @@ public:
void setTofAndSelectTracer(const QString& tracerName);
protected:
virtual void updateLegendCategorySettings() {};

View File

@ -131,9 +131,9 @@ RimEclipseStatisticsCase::~RimEclipseStatisticsCase()
void RimEclipseStatisticsCase::setMainGrid(RigMainGrid* mainGrid)
{
CVF_ASSERT(mainGrid);
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->eclipseCaseData());
reservoirData()->setMainGrid(mainGrid);
eclipseCaseData()->setMainGrid(mainGrid);
}
//--------------------------------------------------------------------------------------------------
@ -141,7 +141,7 @@ void RimEclipseStatisticsCase::setMainGrid(RigMainGrid* mainGrid)
//--------------------------------------------------------------------------------------------------
bool RimEclipseStatisticsCase::openEclipseGridFile()
{
if (this->reservoirData()) return true;
if (this->eclipseCaseData()) return true;
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData;
@ -190,7 +190,7 @@ void RimEclipseStatisticsCase::populateResultSelectionAfterLoadingGrid()
//--------------------------------------------------------------------------------------------------
void RimEclipseStatisticsCase::computeStatistics()
{
if (this->reservoirData() == NULL)
if (this->eclipseCaseData() == NULL)
{
openEclipseGridFile();
}
@ -228,7 +228,7 @@ void RimEclipseStatisticsCase::computeStatistics()
timeStepIndices.push_back(i);
}
RigEclipseCaseData* resultCase = reservoirData();
RigEclipseCaseData* resultCase = eclipseCaseData();
QList<RimEclipseStatisticsCaseEvaluator::ResSpec > resultSpecification;
@ -390,12 +390,12 @@ QList<caf::PdmOptionItemInfo> RimEclipseStatisticsCase::calculateValueOptions(co
if (useOptionsOnly) *useOptionsOnly = true;
RimIdenticalGridCaseGroup* idgcg = caseGroup();
if (!(caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->reservoirData()))
if (!(caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->eclipseCaseData()))
{
return options;
}
RigEclipseCaseData* caseData = idgcg->mainCase()->reservoirData();
RigEclipseCaseData* caseData = idgcg->mainCase()->eclipseCaseData();
if (&m_selectedDynamicProperties == fieldNeedingOptions)
{
@ -486,9 +486,9 @@ void RimEclipseStatisticsCase::fieldChangedByUi(const caf::PdmFieldHandle* chang
sourceResultCase->openEclipseGridFile();
// Propagate well info to statistics case
if (sourceResultCase->reservoirData())
if (sourceResultCase->eclipseCaseData())
{
const cvf::Collection<RigSingleWellResultsData>& sourceCaseWellResults = sourceResultCase->reservoirData()->wellResults();
const cvf::Collection<RigSingleWellResultsData>& sourceCaseWellResults = sourceResultCase->eclipseCaseData()->wellResults();
setWellResultsAndUpdateViews(sourceCaseWellResults);
}
}
@ -505,7 +505,7 @@ void RimEclipseStatisticsCase::fieldChangedByUi(const caf::PdmFieldHandle* chang
//--------------------------------------------------------------------------------------------------
void RimEclipseStatisticsCase::setWellResultsAndUpdateViews(const cvf::Collection<RigSingleWellResultsData>& sourceCaseWellResults)
{
this->reservoirData()->setWellResults(sourceCaseWellResults);
this->eclipseCaseData()->setWellResults(sourceCaseWellResults);
caf::ProgressInfo progInfo(reservoirViews().size() + 1, "Updating Well Data for Views");
@ -637,9 +637,9 @@ void RimEclipseStatisticsCase::updatePercentileUiVisibility()
//--------------------------------------------------------------------------------------------------
bool RimEclipseStatisticsCase::hasComputedStatistics() const
{
if ( reservoirData()
&& ( reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->resultCount()
|| reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS)->resultCount()))
if ( eclipseCaseData()
&& ( eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->resultCount()
|| eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS)->resultCount()))
{
return true;
}
@ -677,14 +677,14 @@ void RimEclipseStatisticsCase::updateConnectedEditorsAndReservoirViews()
//--------------------------------------------------------------------------------------------------
void RimEclipseStatisticsCase::clearComputedStatistics()
{
if (reservoirData() && reservoirData()->results(RifReaderInterface::MATRIX_RESULTS))
if (eclipseCaseData() && eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS))
{
reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->clearAllResults();
eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->clearAllResults();
}
if (reservoirData() && reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS))
if (eclipseCaseData() && eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS))
{
reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS)->clearAllResults();
eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS)->clearAllResults();
}
updateConnectedEditorsAndReservoirViews();
@ -711,12 +711,12 @@ void RimEclipseStatisticsCase::computeStatisticsAndUpdateViews()
void RimEclipseStatisticsCase::populateResultSelection()
{
RimIdenticalGridCaseGroup* idgcg = caseGroup();
if (!(caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->reservoirData()))
if (!(caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->eclipseCaseData()))
{
return;
}
RigEclipseCaseData* caseData = idgcg->mainCase()->reservoirData();
RigEclipseCaseData* caseData = idgcg->mainCase()->eclipseCaseData();
if (m_selectedDynamicProperties().size() == 0)
{

View File

@ -163,7 +163,7 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults(const QList<ResSpec>&
// Trigger loading of dataset
sourceCase->results(poroModel)->findOrLoadScalarResultForTimeStep(resultType, resultName, dataAccessTimeStepIndex);
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromNameAndType(sourceCase->reservoirData(), gridIdx, poroModel, dataAccessTimeStepIndex, resultName, resultType);
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromNameAndType(sourceCase->eclipseCaseData(), gridIdx, poroModel, dataAccessTimeStepIndex, resultName, resultType);
if (resultAccessor.notNull())
{
sourceDataAccessList.push_back(resultAccessor.p());
@ -329,7 +329,7 @@ RimEclipseStatisticsCaseEvaluator::RimEclipseStatisticsCaseEvaluator(const std::
{
if (sourceCases.size() > 0)
{
m_reservoirCellCount = sourceCases[0]->reservoirData()->mainGrid()->globalCellArray().size();
m_reservoirCellCount = sourceCases[0]->eclipseCaseData()->mainGrid()->globalCellArray().size();
}
CVF_ASSERT(m_destinationCase);

View File

@ -0,0 +1,111 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimEclipseTopologyItem.h"
#include "RigTimeHistoryResultAccessor.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RiuSelectionManager.h"
CAF_PDM_SOURCE_INIT(RimEclipseTopologyItem, "RimEclipseTopologyItem");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseTopologyItem::RimEclipseTopologyItem()
{
CAF_PDM_InitObject("Eclipse Topoloty Item", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "EclipseCase", "Eclipse Case", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_gridIndex, "m_gridIndex", "m_gridIndex", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_cellIndex, "m_cellIndex", "m_cellIndex", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_localIntersectionPoint, "m_localIntersectionPoint", "m_localIntersectionPoint", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseTopologyItem::~RimEclipseTopologyItem()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseTopologyItem::setFromSelectionItem(const RiuEclipseSelectionItem* selectionItem)
{
m_gridIndex = selectionItem->m_gridIndex;
m_cellIndex = selectionItem->m_cellIndex;
m_localIntersectionPoint = selectionItem->m_localIntersectionPoint;
m_eclipseCase = selectionItem->m_view->eclipseCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseTopologyItem::topologyText() const
{
QString text;
if (m_eclipseCase)
{
text += m_eclipseCase->caseUserDescription();
}
else
{
text = "No case";
}
text += ", ";
text += QString("Grid index %1").arg(m_gridIndex);
text += ", ";
text += RigTimeHistoryResultAccessor::topologyText(m_eclipseCase->eclipseCaseData(), m_gridIndex, m_cellIndex);
return text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RimEclipseTopologyItem::eclipseCase() const
{
return m_eclipseCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimEclipseTopologyItem::gridIndex() const
{
return m_gridIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimEclipseTopologyItem::cellIndex() const
{
return m_cellIndex;
}

View File

@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimPickingTopologyItem.h"
#include "cafPdmField.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cafPdmPtrField.h"
class RimEclipseCase;
class RiuEclipseSelectionItem;
//==================================================================================================
///
///
//==================================================================================================
class RimEclipseTopologyItem : public RimPickingTopologyItem
{
CAF_PDM_HEADER_INIT;
public:
RimEclipseTopologyItem();
virtual ~RimEclipseTopologyItem() override;
void setFromSelectionItem(const RiuEclipseSelectionItem* selectionItem);
virtual QString topologyText() const override;
RimEclipseCase* eclipseCase() const;
size_t gridIndex() const;
size_t cellIndex() const;
private:
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
caf::PdmField<size_t> m_gridIndex;
caf::PdmField<size_t> m_cellIndex;
caf::PdmField<cvf::Vec3d> m_localIntersectionPoint;
};

View File

@ -61,9 +61,8 @@
#include "RiuSelectionManager.h"
#include "RiuViewer.h"
#include "RivReservoirPipesPartMgr.h"
#include "RivReservoirSimWellsPartMgr.h"
#include "RivReservoirViewPartMgr.h"
#include "RivReservoirWellSpheresPartMgr.h"
#include "RivSingleCellPartGenerator.h"
#include "RivTernarySaturationOverlayItem.h"
#include "RivWellPathCollectionPartMgr.h"
@ -137,10 +136,9 @@ RimEclipseView::RimEclipseView()
this->faultResultSettings()->setReservoirView(this);
m_reservoirGridPartManager = new RivReservoirViewPartMgr(this);
m_pipesPartManager = new RivReservoirPipesPartMgr(this);
m_wellSpheresPartManager = new RivReservoirWellSpheresPartMgr(this);
m_simWellsPartManager = new RivReservoirSimWellsPartMgr(this);
m_reservoir = NULL;
m_eclipseCase = NULL;
}
//--------------------------------------------------------------------------------------------------
@ -158,7 +156,7 @@ RimEclipseView::~RimEclipseView()
m_reservoirGridPartManager->clearGeometryCache();
m_reservoir = NULL;
m_eclipseCase = NULL;
}
@ -228,7 +226,7 @@ void RimEclipseView::updateScaleTransform()
scale(2, 2) = scaleZ();
this->scaleTransform()->setLocalTransform(scale);
m_pipesPartManager->setScaleTransform(this->scaleTransform());
m_simWellsPartManager->setScaleTransform(this->scaleTransform());
if (m_viewer) m_viewer->updateCachedValuesInScene();
}
@ -250,7 +248,7 @@ void RimEclipseView::createDisplayModel()
RiuMainWindow::instance()->setResultInfo(QString("RimReservoirView::createDisplayModel() ") + QString::number(callCount++));
#endif
if (!(m_reservoir && m_reservoir->reservoirData())) return;
if (!(m_eclipseCase && m_eclipseCase->eclipseCaseData())) return;
// Define a vector containing time step indices to produce geometry for.
// First entry in this vector is used to define the geometry only result mode with no results.
@ -473,6 +471,8 @@ void RimEclipseView::createDisplayModel()
//--------------------------------------------------------------------------------------------------
void RimEclipseView::updateCurrentTimeStep()
{
m_propertyFilterCollection()->updateFromCurrentTimeStep();
updateLegends(); // To make sure the scalar mappers are set up correctly
std::vector<RivCellSetEnum> geometriesToRecolor;
@ -613,26 +613,23 @@ void RimEclipseView::updateCurrentTimeStep()
crossSectionCollection->applySingleColorEffect();
}
// Simulation Well pipes
// Simulation Wells
if (m_viewer)
{
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
if (frameScene)
{
// Simulation Well pipes
cvf::ref<cvf::ModelBasicList> simWellModelBasicList = new cvf::ModelBasicList;
simWellModelBasicList->setName("SimWellPipeMod");
cvf::ref<cvf::ModelBasicList> wellPipeModelBasicList = new cvf::ModelBasicList;
wellPipeModelBasicList->setName("SimWellPipeMod");
m_simWellsPartManager->appendDynamicGeometryPartsToModel(simWellModelBasicList.p(), m_currentTimeStep);
m_pipesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
m_wellSpheresPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
simWellModelBasicList->updateBoundingBoxesRecursive();
wellPipeModelBasicList->updateBoundingBoxesRecursive();
this->removeModelByName(frameScene, simWellModelBasicList->name());
frameScene->addModel(simWellModelBasicList.p());
this->removeModelByName(frameScene, wellPipeModelBasicList->name());
frameScene->addModel(wellPipeModelBasicList.p());
m_pipesPartManager->updatePipeResultColor(m_currentTimeStep);
m_simWellsPartManager->updatePipeResultColor(m_currentTimeStep);
}
}
@ -650,13 +647,13 @@ void RimEclipseView::loadDataAndUpdate()
{
updateScaleTransform();
if (m_reservoir)
if (m_eclipseCase)
{
if (!m_reservoir->openReserviorCase())
if (!m_eclipseCase->openReserviorCase())
{
QMessageBox::warning(RiuMainWindow::instance(),
"Error when opening project file",
"Could not open the Eclipse Grid file: \n"+ m_reservoir->gridFileName());
"Could not open the Eclipse Grid file: \n"+ m_eclipseCase->gridFileName());
this->setEclipseCase( NULL);
return;
}
@ -678,8 +675,7 @@ void RimEclipseView::loadDataAndUpdate()
this->faultCollection()->syncronizeFaults();
m_reservoirGridPartManager->clearGeometryCache();
m_pipesPartManager->clearGeometryCache();
m_wellSpheresPartManager->clearGeometryCache();
m_simWellsPartManager->clearGeometryCache();
syncronizeWellsWithResults();
@ -813,11 +809,11 @@ void RimEclipseView::updateDisplayModelVisibility()
//--------------------------------------------------------------------------------------------------
RimReservoirCellResultsStorage* RimEclipseView::currentGridCellResults()
{
if (m_reservoir)
if (m_eclipseCase)
{
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult->porosityModel());
return m_reservoir->results(porosityModel);
return m_eclipseCase->results(porosityModel);
}
return NULL;
@ -828,13 +824,13 @@ RimReservoirCellResultsStorage* RimEclipseView::currentGridCellResults()
//--------------------------------------------------------------------------------------------------
RigActiveCellInfo* RimEclipseView::currentActiveCellInfo()
{
if (m_reservoir &&
m_reservoir->reservoirData()
if (m_eclipseCase &&
m_eclipseCase->eclipseCaseData()
)
{
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult->porosityModel());
return m_reservoir->reservoirData()->activeCellInfo(porosityModel);
return m_eclipseCase->eclipseCaseData()->activeCellInfo(porosityModel);
}
return NULL;
@ -871,10 +867,9 @@ void RimEclipseView::scheduleReservoirGridGeometryRegen()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseView::schedulePipeGeometryRegen()
void RimEclipseView::scheduleSimWellGeometryRegen()
{
m_pipesPartManager->scheduleGeometryRegen();
m_wellSpheresPartManager->clearGeometryCache();
m_simWellsPartManager->scheduleGeometryRegen();
}
@ -887,9 +882,9 @@ void RimEclipseView::indicesToVisibleGrids(std::vector<size_t>* gridIndices)
// Create vector of grid indices to render
std::vector<RigGridBase*> grids;
if (this->m_reservoir && this->m_reservoir->reservoirData() )
if (this->m_eclipseCase && this->m_eclipseCase->eclipseCaseData() )
{
this->m_reservoir->reservoirData()->allGrids(&grids);
this->m_eclipseCase->eclipseCaseData()->allGrids(&grids);
}
size_t i;
@ -912,12 +907,12 @@ void RimEclipseView::updateLegends()
m_viewer->removeAllColorLegends();
}
if (!m_reservoir || !m_viewer || !m_reservoir->reservoirData() )
if (!m_eclipseCase || !m_viewer || !m_eclipseCase->eclipseCaseData() )
{
return;
}
RigEclipseCaseData* eclipseCase = m_reservoir->reservoirData();
RigEclipseCaseData* eclipseCase = m_eclipseCase->eclipseCaseData();
CVF_ASSERT(eclipseCase);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult()->porosityModel());
@ -1049,7 +1044,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
//--------------------------------------------------------------------------------------------------
void RimEclipseView::setEclipseCase(RimEclipseCase* reservoir)
{
m_reservoir = reservoir;
m_eclipseCase = reservoir;
cellResult()->setEclipseCase(reservoir);
faultResultSettings()->customFaultResult()->setEclipseCase(reservoir);
@ -1061,7 +1056,7 @@ void RimEclipseView::setEclipseCase(RimEclipseCase* reservoir)
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RimEclipseView::eclipseCase() const
{
return m_reservoir;
return m_eclipseCase;
}
//--------------------------------------------------------------------------------------------------
@ -1079,9 +1074,9 @@ RimEclipseCase* RimEclipseView::eclipseCase() const
//--------------------------------------------------------------------------------------------------
void RimEclipseView::syncronizeWellsWithResults()
{
if (!(m_reservoir && m_reservoir->reservoirData()) ) return;
if (!(m_eclipseCase && m_eclipseCase->eclipseCaseData()) ) return;
cvf::Collection<RigSingleWellResultsData> wellResults = m_reservoir->reservoirData()->wellResults();
cvf::Collection<RigSingleWellResultsData> wellResults = m_eclipseCase->eclipseCaseData()->wellResults();
std::vector<caf::PdmPointer<RimEclipseWell> > newWells;
@ -1262,8 +1257,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
void RimEclipseView::updateDisplayModelForWellResults()
{
m_reservoirGridPartManager->clearGeometryCache();
m_pipesPartManager->clearGeometryCache();
m_wellSpheresPartManager->clearGeometryCache();
m_simWellsPartManager->clearGeometryCache();
syncronizeWellsWithResults();
@ -1328,7 +1322,7 @@ void RimEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
uiTreeOrdering.add(m_rangeFilterCollection());
uiTreeOrdering.add(m_propertyFilterCollection());
uiTreeOrdering.setForgetRemainingFields(true);
uiTreeOrdering.skipRemainingChildren(true);
}
//--------------------------------------------------------------------------------------------------
@ -1454,9 +1448,9 @@ RimCase* RimEclipseView::ownerCase()
//--------------------------------------------------------------------------------------------------
RigMainGrid* RimEclipseView::mainGrid() const
{
if (eclipseCase() && eclipseCase()->reservoirData())
if (eclipseCase() && eclipseCase()->eclipseCaseData())
{
return eclipseCase()->reservoirData()->mainGrid();
return eclipseCase()->eclipseCaseData()->mainGrid();
}
return nullptr;
@ -1508,7 +1502,7 @@ void RimEclipseView::setOverridePropertyFilterCollection(RimEclipsePropertyFilte
//--------------------------------------------------------------------------------------------------
void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility)
{
size_t gridCount = this->eclipseCase()->reservoirData()->gridCount();
size_t gridCount = this->eclipseCase()->eclipseCaseData()->gridCount();
size_t cellCount = this->mainGrid()->globalCellArray().size();
totalVisibility->resize(cellCount);
@ -1516,7 +1510,7 @@ void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalV
for (size_t gridIdx = 0; gridIdx < gridCount; ++gridIdx)
{
RigGridBase * grid = this->eclipseCase()->reservoirData()->grid(gridIdx);
RigGridBase * grid = this->eclipseCase()->eclipseCaseData()->grid(gridIdx);
int gridCellCount = static_cast<int>(grid->cellCount());
for (size_t gpIdx = 0; gpIdx < m_visibleGridParts.size(); ++gpIdx)
@ -1556,9 +1550,9 @@ void RimEclipseView::createPartCollectionFromSelection(cvf::Collection<cvf::Part
if (eclipseSelItem && eclipseSelItem->m_view == this)
{
CVF_ASSERT(eclipseSelItem->m_view->eclipseCase());
CVF_ASSERT(eclipseSelItem->m_view->eclipseCase()->reservoirData());
CVF_ASSERT(eclipseSelItem->m_view->eclipseCase()->eclipseCaseData());
RivSingleCellPartGenerator partGen(eclipseSelItem->m_view->eclipseCase()->reservoirData(), eclipseSelItem->m_gridIndex, eclipseSelItem->m_cellIndex);
RivSingleCellPartGenerator partGen(eclipseSelItem->m_view->eclipseCase()->eclipseCaseData(), eclipseSelItem->m_gridIndex, eclipseSelItem->m_cellIndex);
cvf::ref<cvf::Part> part = partGen.createPart(eclipseSelItem->m_color);
part->setTransform(this->scaleTransform());

View File

@ -54,8 +54,7 @@ class RimReservoirCellResultsStorage;
class RimEclipseCellColors;
class RimEclipseWellCollection;
class RiuViewer;
class RivReservoirPipesPartMgr;
class RivReservoirWellSpheresPartMgr;
class RivReservoirSimWellsPartMgr;
class RivIntersectionPartMgr;
class RivReservoirViewPartMgr;
@ -88,12 +87,12 @@ public:
// Fields containing child objects :
caf::PdmChildField<RimEclipseCellColors*> cellResult;
caf::PdmChildField<RimCellEdgeColors*> cellEdgeResult;
caf::PdmChildField<RimEclipseFaultColors*> faultResultSettings;
caf::PdmChildField<RimEclipseWellCollection*> wellCollection;
caf::PdmChildField<RimFaultCollection*> faultCollection;
caf::PdmChildField<RimEclipseCellColors*> cellResult;
caf::PdmChildField<RimCellEdgeColors*> cellEdgeResult;
caf::PdmChildField<RimEclipseFaultColors*> faultResultSettings;
caf::PdmChildField<RimEclipseWellCollection*> wellCollection;
caf::PdmChildField<RimFaultCollection*> faultCollection;
// Fields
@ -125,7 +124,7 @@ public:
virtual void scheduleGeometryRegen(RivCellSetEnum geometryType);
void scheduleReservoirGridGeometryRegen();
void schedulePipeGeometryRegen();
void scheduleSimWellGeometryRegen();
void updateDisplayModelForWellResults();
const std::vector<RivCellSetEnum>& visibleGridParts() const;
@ -177,11 +176,10 @@ private:
caf::PdmChildField<RimEclipsePropertyFilterCollection*> m_propertyFilterCollection;
caf::PdmPointer<RimEclipsePropertyFilterCollection> m_overridePropertyFilterCollection;
caf::PdmPointer<RimEclipseCase> m_reservoir;
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
cvf::ref<RivReservoirViewPartMgr> m_reservoirGridPartManager;
cvf::ref<RivReservoirPipesPartMgr> m_pipesPartManager;
cvf::ref<RivReservoirWellSpheresPartMgr> m_wellSpheresPartManager;
cvf::ref<RivReservoirSimWellsPartMgr> m_simWellsPartManager;
std::vector<RivCellSetEnum> m_visibleGridParts;
};

View File

@ -33,6 +33,11 @@
#include "RivReservoirViewPartMgr.h"
#include "cvfMath.h"
#include "RigCell.h"
#include "RimEclipseCase.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigActiveCellInfo.h"
CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well");
@ -107,7 +112,7 @@ void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
{
if (reservoirView)
{
reservoirView->schedulePipeGeometryRegen();
reservoirView->scheduleSimWellGeometryRegen();
reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
@ -155,6 +160,81 @@ void RimEclipseWell::calculateWellPipeDynamicCenterLine(size_t timeStepIdx,
RigSimulationWellCenterLineCalculator::calculateWellPipeDynamicCenterline(this, timeStepIdx, pipeBranchesCLCoords, pipeBranchesCellIds);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseWell::wellHeadTopBottomPosition(size_t frameIndex, cvf::Vec3d* top, cvf::Vec3d* bottom)
{
RimEclipseView* m_rimReservoirView;
firstAncestorOrThisOfTypeAsserted(m_rimReservoirView);
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->eclipseCaseData();
if (!this->wellResults()->hasWellResult(frameIndex)) return;
const RigWellResultFrame& wellResultFrame = this->wellResults()->wellResultFrame(frameIndex);
const RigCell& whCell = rigReservoir->cellFromWellResultCell(wellResultFrame.m_wellHead);
// Match this position with pipe start position in RivWellPipesPartMgr::calculateWellPipeCenterline()
(*bottom) = whCell.faceCenter(cvf::StructGridInterface::NEG_K);
// Compute well head based on the z position of the top of the K column the well head is part of
(*top) = (*bottom);
if ( m_rimReservoirView->wellCollection()->wellHeadPosition() == RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN )
{
// Position well head at top active cell of IJ-column
size_t i, j, k;
rigReservoir->mainGrid()->ijkFromCellIndex(whCell.mainGridCellIndex(), &i, &j, &k);
size_t kIndexWellHeadCell = k;
k = 0;
size_t topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
while ( k < kIndexWellHeadCell && !m_rimReservoirView->currentActiveCellInfo()->isActive(topActiveCellIndex) )
{
k++;
topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
}
const RigCell& topActiveCell = rigReservoir->mainGrid()->cell(topActiveCellIndex);
cvf::Vec3d topCellPos = topActiveCell.faceCenter(cvf::StructGridInterface::NEG_K);
// Modify position if top active cell is closer to sea than well head
if ( kIndexWellHeadCell > k )
{
top->z() = topCellPos.z();
}
}
else
{
// Position well head at top of active cells bounding box
cvf::Vec3d activeCellsBoundingBoxMax = m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max();
top->z() = activeCellsBoundingBoxMax.z();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimEclipseWell::pipeRadius()
{
RimEclipseView* reservoirView;
firstAncestorOrThisOfTypeAsserted(reservoirView);
RigEclipseCaseData* rigReservoir = reservoirView->eclipseCase()->eclipseCaseData();
double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
double pipeRadius = reservoirView->wellCollection()->pipeScaleFactor() * this->pipeScaleFactor() * characteristicCellSize;
return pipeRadius;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -273,7 +353,7 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells());
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -69,6 +69,8 @@ public:
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds);
void wellHeadTopBottomPosition(size_t frameIndex, cvf::Vec3d* top, cvf::Vec3d* bottom);
double pipeRadius();
caf::PdmField<bool> showWell;
caf::PdmField<QString> name;

View File

@ -39,6 +39,7 @@
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiCheckBoxTristateEditor.h"
#include "RimEclipseResultCase.h"
namespace caf
@ -198,6 +199,8 @@ RimEclipseWellCollection::RimEclipseWellCollection()
CAF_PDM_InitField(&obsoleteField_showWellLabel, "ShowWellLabel", true, "Show Well Label", "", "", "");
CAF_PDM_InitField(&obsoleteField_showWellCellFence, "ShowWellFences", false, "Show Well Cell Fence", "", "", "");
CAF_PDM_InitField(&m_showWellCommunicationLines, "ShowWellCommunicationLines", false, "Show Communication Lines", "", "", "");
obsoleteField_showWellHead.uiCapability()->setUiHidden(true);
obsoleteField_showWellLabel.uiCapability()->setUiHidden(true);
obsoleteField_showWellCellFence.uiCapability()->setUiHidden(true);
@ -392,7 +395,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|| &m_showWellSpheres == changedField
|| &showConnectionStatusColors == changedField)
{
m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleSimWellGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if ( &pipeCrossSectionVertexCount == changedField
@ -405,13 +408,13 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|| &wellPipeCoordType == changedField
|| &m_showWellPipe == changedField)
{
m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleSimWellGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if (&showWellsIntersectingVisibleCells == changedField)
{
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleSimWellGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
@ -446,6 +449,11 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
{
RiuMainWindow::instance()->refreshDrawStyleActions();
}
if (&m_showWellCommunicationLines == changedField)
{
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
//--------------------------------------------------------------------------------------------------
@ -454,15 +462,19 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
void RimEclipseWellCollection::assignDefaultWellColors()
{
const caf::ColorTable& colorTable = RiaColorTables::wellsPaletteColors();
cvf::Color3ubArray catColors = colorTable.color3ubArray();
cvf::Color3ubArray interpolatedCatColors = caf::ColorTable::interpolateColorArray(catColors, wells.size());
cvf::Color3ubArray wellColors = colorTable.color3ubArray();
cvf::Color3ubArray interpolatedWellColors = wellColors;
if (wells.size() > 1)
{
interpolatedWellColors = caf::ColorTable::interpolateColorArray(wellColors, wells.size());
}
for (size_t wIdx = 0; wIdx < wells.size(); ++wIdx)
{
RimEclipseWell* well = wells[wIdx];
if (well)
{
cvf::Color3f col = cvf::Color3f(interpolatedCatColors[wIdx]);
cvf::Color3f col = cvf::Color3f(interpolatedWellColors[wIdx]);
well->wellPipeColor = col;
well->updateConnectedEditors();
@ -539,6 +551,10 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
filterGroup->add(&m_showWellCellFence);
filterGroup->add(&wellCellFenceType);
RimEclipseResultCase* ownerCase;
firstAncestorOrThisOfTypeAsserted(ownerCase);
m_showWellCommunicationLines.uiCapability()->setUiHidden(!ownerCase->flowDiagSolverInterface());
m_showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells());
wellCellFenceType.uiCapability()->setUiReadOnly(!showWellCells());
}

View File

@ -98,6 +98,8 @@ public:
void setShowWellCellsState(bool enable);
bool showWellCells();
bool showWellCommunicationLines() { return m_showWellCommunicationLines();}
caf::PdmField<WellFenceEnum> wellCellFenceType;
caf::PdmField<double> wellCellTransparencyLevel;
@ -155,6 +157,8 @@ private:
caf::PdmField<caf::Tristate> m_showWellCells;
caf::PdmField<caf::Tristate> m_showWellCellFence;
caf::PdmField<bool> m_showWellCommunicationLines;
// Obsolete fields
caf::PdmField<WellVisibilityEnum> obsoleteField_wellPipeVisibility;
caf::PdmField<WellCellsRangeFilterEnum> obsoleteField_wellCellsToRangeFilterMode;

View File

@ -133,7 +133,7 @@ void RimGeoMechPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
uiOrdering.add(&name);
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
resultDefinition->defineUiOrdering(uiConfigName, *group1);
resultDefinition->uiOrdering(uiConfigName, *group1);
uiOrdering.add(&isActive);
uiOrdering.add(&filterMode);
@ -150,7 +150,7 @@ void RimGeoMechPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
updateReadOnlyStateOfAllFields();
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -30,8 +30,8 @@
#include "RimGeoMechCellColors.h"
#include "RimGeoMechPropertyFilter.h"
#include "RimGeoMechView.h"
#include "RimPlotCurve.h"
#include "RimViewLinker.h"
#include "RimWellLogCurve.h"
#include "cafPdmUiListEditor.h"
@ -119,7 +119,7 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
if (m_isTimeLapseResultUiField())
timeLapseGr->add(&m_timeLapseBaseTimestepUiField);
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
@ -206,12 +206,11 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
// Get the possible property filter owner
RimGeoMechPropertyFilter* propFilter = dynamic_cast<RimGeoMechPropertyFilter*>(this->parentField()->ownerObject());
RimView* view = NULL;
RimView* view = nullptr;
this->firstAncestorOrThisOfType(view);
RimWellLogCurve* curve = NULL;
RimPlotCurve* curve = nullptr;
this->firstAncestorOrThisOfType(curve);
if (&m_resultVariableUiField == changedField)
{
QStringList fieldComponentNames = m_resultVariableUiField().split(QRegExp("\\s+"));

View File

@ -63,8 +63,7 @@ public:
protected:
virtual void updateLegendCategorySettings() {};
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
@ -72,7 +71,6 @@ private:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool * useOptionsOnly);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue);

View File

@ -641,7 +641,7 @@ void RimGeoMechView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
uiTreeOrdering.add(m_rangeFilterCollection());
uiTreeOrdering.add(m_propertyFilterCollection());
uiTreeOrdering.setForgetRemainingFields(true);
uiTreeOrdering.skipRemainingChildren(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,601 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimGridTimeHistoryCurve.h"
#include "RiaApplication.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigTimeHistoryResultAccessor.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseResultDefinition.h"
#include "RimEclipseTopologyItem.h"
#include "RimEclipseView.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechTopologyItem.h"
#include "RimGeoMechResultDefinition.h"
#include "RimGeoMechView.h"
#include "RimProject.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimSummaryPlot.h"
#include "RimSummaryTimeAxisProperties.h"
#include "RiuFemTimeHistoryResultAccessor.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RiuSelectionManager.h"
#include "qwt_plot.h"
CAF_PDM_SOURCE_INIT(RimGridTimeHistoryCurve, "TimeHistoryCurve");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridTimeHistoryCurve::RimGridTimeHistoryCurve()
{
CAF_PDM_InitObject("Grid Time History Curve", ":/SummaryCurve16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_topologyText, "TopologyText", "Topology Reference", "", "", "");
m_topologyText.registerGetMethod(this, &RimGridTimeHistoryCurve::topologyText);
m_topologyText.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitFieldNoDefault(&m_eclipseResultDefinition, "EclipseResultDefinition", "Eclipse Result definition", "", "", "");
m_eclipseResultDefinition.uiCapability()->setUiHidden(true);
m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault(&m_geoMechResultDefinition, "GeoMechResultDefinition", "GeoMech Result definition", "", "", "");
m_geoMechResultDefinition.uiCapability()->setUiHidden(true);
m_geoMechResultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault(&m_pickingTopologyItem, "PickingTopologyItem", "Picking Topology Item", "", "", "");
m_pickingTopologyItem.uiCapability()->setUiTreeHidden(true);
m_pickingTopologyItem.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitField(&m_plotAxis, "PlotAxis", caf::AppEnum< RimDefines::PlotAxis >(RimDefines::PLOT_AXIS_LEFT), "Axis", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridTimeHistoryCurve::~RimGridTimeHistoryCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridTimeHistoryCurve::setFromSelectionItem(const RiuSelectionItem* selectionItem)
{
if (m_pickingTopologyItem())
{
delete m_pickingTopologyItem();
}
if (m_eclipseResultDefinition())
{
delete m_eclipseResultDefinition();
}
if (m_geoMechResultDefinition())
{
delete m_geoMechResultDefinition();
}
const RiuEclipseSelectionItem* eclSelectionItem = dynamic_cast<const RiuEclipseSelectionItem*>(selectionItem);
if (eclSelectionItem)
{
RimEclipseTopologyItem* topologyItem = new RimEclipseTopologyItem;
m_pickingTopologyItem = topologyItem;
topologyItem->setFromSelectionItem(eclSelectionItem);
if (eclSelectionItem->m_view)
{
m_eclipseResultDefinition = new RimEclipseResultDefinition;
m_eclipseResultDefinition->simpleCopy(eclSelectionItem->m_view->cellResult());
}
}
const RiuGeoMechSelectionItem* geoMechSelectionItem = dynamic_cast<const RiuGeoMechSelectionItem*>(selectionItem);
if (geoMechSelectionItem)
{
RimGeoMechTopologyItem* topologyItem = new RimGeoMechTopologyItem;
m_pickingTopologyItem = topologyItem;
topologyItem->setFromSelectionItem(geoMechSelectionItem);
if (geoMechSelectionItem->m_view)
{
m_geoMechResultDefinition = new RimGeoMechResultDefinition;
m_geoMechResultDefinition->setGeoMechCase(geoMechSelectionItem->m_view->geoMechCase());
m_geoMechResultDefinition->setResultAddress(geoMechSelectionItem->m_view->cellResultResultDefinition()->resultAddress());
}
}
updateResultDefinitionFromCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimDefines::PlotAxis RimGridTimeHistoryCurve::yAxis() const
{
return m_plotAxis();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridTimeHistoryCurve::setYAxis(RimDefines::PlotAxis plotAxis)
{
m_plotAxis = plotAxis;
updateQwtPlotAxis();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimGridTimeHistoryCurve::yValues() const
{
std::vector<double> values;
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
if (eclTopItem && eclTopItem->eclipseCase())
{
size_t cellIndex = eclTopItem->cellIndex();
size_t gridIndex = eclTopItem->gridIndex();
CVF_ASSERT(m_eclipseResultDefinition());
m_eclipseResultDefinition->loadResult();
RimReservoirCellResultsStorage* cellResStorage = m_eclipseResultDefinition->currentGridCellResults();
RigCaseCellResultsData* cellResultsData = cellResStorage->cellResults();
std::vector<QDateTime> timeStepDates = cellResultsData->timeStepDates();
values = RigTimeHistoryResultAccessor::timeHistoryValues(eclTopItem->eclipseCase()->eclipseCaseData(), m_eclipseResultDefinition(), gridIndex, cellIndex, timeStepDates.size());
}
if (geoMechTopologyItem() && geoMechTopologyItem()->geoMechCase())
{
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor = femTimeHistoryResultAccessor();
if (timeHistResultAccessor)
{
values = timeHistResultAccessor->timeHistoryValues();
}
}
return values;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridTimeHistoryCurve::quantityName() const
{
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
if (eclTopItem)
{
CVF_ASSERT(m_eclipseResultDefinition());
return m_eclipseResultDefinition->resultVariableUiName();
}
if (geoMechTopologyItem())
{
CVF_ASSERT(m_geoMechResultDefinition());
RimGeoMechTopologyItem* geoMechTopItem = geoMechTopologyItem();
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor = femTimeHistoryResultAccessor();
QString text;
caf::AppEnum<RigFemResultPosEnum> resPosAppEnum = m_geoMechResultDefinition()->resultPositionType();
text.append(resPosAppEnum.uiText() + ", ");
text.append(m_geoMechResultDefinition()->resultFieldUiName() + ", ");
text.append(m_geoMechResultDefinition()->resultComponentUiName() + " ");
if (resPosAppEnum == RIG_ELEMENT_NODAL_FACE)
{
if (geoMechTopItem->m_elementFace >= 0)
{
text.append(", " + caf::AppEnum<cvf::StructGridInterface::FaceType>::textFromIndex(geoMechTopItem->m_elementFace));
}
else
{
text.append(", from N[" + QString::number(timeHistResultAccessor->closestNodeId()) + "] transformed onto intersection");
}
}
return text;
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridTimeHistoryCurve::caseName() const
{
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
if (eclTopItem && eclTopItem->eclipseCase())
{
return eclTopItem->eclipseCase()->caseUserDescription();
}
RimGeoMechTopologyItem* geoMechTopItem = geoMechTopologyItem();
if (geoMechTopItem && geoMechTopItem->geoMechCase())
{
return geoMechTopItem->geoMechCase()->caseUserDescription();
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridTimeHistoryCurve::createCurveAutoName()
{
QString text;
text += quantityName();
QString topoText = topologyText();
if (!topoText.isEmpty())
{
text += ", ";
text += topoText;
}
return text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridTimeHistoryCurve::updateZoomInParentPlot()
{
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfType(plot);
plot->updateZoomInQwt();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridTimeHistoryCurve::onLoadDataAndUpdate()
{
this->RimPlotCurve::updateCurvePresentation();
if (isCurveVisible())
{
std::vector<time_t> dateTimes;
std::vector<double> values;
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
if (eclTopItem && eclTopItem->eclipseCase())
{
m_eclipseResultDefinition->loadResult();
}
RimGeoMechTopologyItem* geoMechTopItem = geoMechTopologyItem();
if (geoMechTopItem && geoMechTopItem->geoMechCase())
{
m_geoMechResultDefinition->loadResult();
}
dateTimes = timeStepValues();
values = yValues();
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfType(plot);
bool isLogCurve = plot->isLogarithmicScaleEnabled(this->yAxis());
if (dateTimes.size() > 0 && dateTimes.size() == values.size())
{
if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE)
{
m_qwtPlotCurve->setSamplesFromTimeTAndValues(dateTimes, values, isLogCurve);
}
else
{
double timeScale = plot->timeAxisProperties()->fromTimeTToDisplayUnitScale();
std::vector<double> times;
if (dateTimes.size())
{
time_t startDate = dateTimes[0];
for (time_t& date : dateTimes)
{
times.push_back(timeScale*(date - startDate));
}
}
m_qwtPlotCurve->setSamplesFromTimeAndValues(times, values, isLogCurve);
}
}
else
{
m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve);
}
updateZoomInParentPlot();
if (m_parentQwtPlot) m_parentQwtPlot->replot();
updateQwtPlotAxis();
plot->updateAxes();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<time_t> RimGridTimeHistoryCurve::timeStepValues() const
{
std::vector<time_t> dateTimes;
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
if (eclTopItem && eclTopItem->eclipseCase())
{
RimReservoirCellResultsStorage* cellResStorage = m_eclipseResultDefinition->currentGridCellResults();
RigCaseCellResultsData* cellResultsData = cellResStorage->cellResults();
std::vector<QDateTime> timeStepDates = cellResultsData->timeStepDates();
for (QDateTime dt : timeStepDates)
{
dateTimes.push_back(dt.toTime_t());
}
}
RimGeoMechTopologyItem* geoMechTopItem = geoMechTopologyItem();
if (geoMechTopItem && geoMechTopItem->geoMechCase())
{
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor = femTimeHistoryResultAccessor();
if (timeHistResultAccessor)
{
std::vector<double> values = timeHistResultAccessor->timeHistoryValues();
QStringList stepNames = geoMechTopItem->geoMechCase()->timeStepStrings();
std::vector<QDateTime> dates = RimGeoMechCase::dateTimeVectorFromTimeStepStrings(stepNames);
if (dates.size() == values.size())
{
for (QDateTime dt : dates)
{
dateTimes.push_back(dt.toTime_t());
}
}
else
{
for (size_t i = 0; i < values.size(); i++)
{
dateTimes.push_back(i);
}
}
}
}
return dateTimes;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridTimeHistoryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
RimPlotCurve::updateOptionSensitivity();
uiOrdering.add(&m_topologyText);
// Fields declared in RimResultDefinition
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
if (eclipseTopologyItem())
{
CVF_ASSERT(m_eclipseResultDefinition());
m_eclipseResultDefinition->uiOrdering(uiConfigName, *group1);
}
if (geoMechTopologyItem())
{
CVF_ASSERT(m_geoMechResultDefinition());
m_geoMechResultDefinition->uiOrdering(uiConfigName, *group1);
}
uiOrdering.add(&m_plotAxis);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridTimeHistoryCurve::initAfterRead()
{
updateResultDefinitionFromCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridTimeHistoryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &m_plotAxis)
{
updateQwtPlotAxis();
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted(plot);
plot->updateAxes();
}
else
{
RimPlotCurve::fieldChangedByUi(changedField, oldValue, newValue);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigMainGrid* RimGridTimeHistoryCurve::mainGrid()
{
if (eclipseTopologyItem() && eclipseTopologyItem()->eclipseCase() && eclipseTopologyItem()->eclipseCase()->eclipseCaseData())
{
return eclipseTopologyItem()->eclipseCase()->eclipseCaseData()->mainGrid();
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseTopologyItem* RimGridTimeHistoryCurve::eclipseTopologyItem() const
{
RimPickingTopologyItem* pickItem = m_pickingTopologyItem();
return dynamic_cast<RimEclipseTopologyItem*>(pickItem);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechTopologyItem* RimGridTimeHistoryCurve::geoMechTopologyItem() const
{
RimPickingTopologyItem* pickItem = m_pickingTopologyItem();
return dynamic_cast<RimGeoMechTopologyItem*>(pickItem);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridTimeHistoryCurve::updateResultDefinitionFromCase()
{
if (eclipseTopologyItem())
{
CVF_ASSERT(m_eclipseResultDefinition());
m_eclipseResultDefinition->setEclipseCase(eclipseTopologyItem()->eclipseCase());
}
if (geoMechTopologyItem())
{
CVF_ASSERT(m_geoMechResultDefinition());
m_geoMechResultDefinition->setGeoMechCase(geoMechTopologyItem()->geoMechCase());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridTimeHistoryCurve::topologyText() const
{
QString text;
if (eclipseTopologyItem() && m_pickingTopologyItem())
{
text = m_pickingTopologyItem->topologyText();
}
else if (geoMechTopologyItem())
{
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor = femTimeHistoryResultAccessor();
if (timeHistResultAccessor)
{
text = timeHistResultAccessor->topologyText();
}
}
else
{
text = "No topology";
}
return text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridTimeHistoryCurve::updateQwtPlotAxis()
{
if (m_qwtPlotCurve)
{
if (this->yAxis() == RimDefines::PLOT_AXIS_LEFT)
{
m_qwtPlotCurve->setYAxis(QwtPlot::yLeft);
}
else
{
m_qwtPlotCurve->setYAxis(QwtPlot::yRight);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::unique_ptr<RiuFemTimeHistoryResultAccessor> RimGridTimeHistoryCurve::femTimeHistoryResultAccessor() const
{
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor;
if ( geoMechTopologyItem()
&& geoMechTopologyItem()->geoMechCase()
&& geoMechTopologyItem()->geoMechCase()->geoMechData())
{
RimGeoMechTopologyItem* geoMechTopItem = geoMechTopologyItem();
if (geoMechTopItem->m_hasIntersectionTriangle)
{
std::array<cvf::Vec3f, 3> intersectionTriangle;
intersectionTriangle[0] = cvf::Vec3f(geoMechTopItem->m_intersectionTriangle_0());
intersectionTriangle[1] = cvf::Vec3f(geoMechTopItem->m_intersectionTriangle_1());
intersectionTriangle[2] = cvf::Vec3f(geoMechTopItem->m_intersectionTriangle_2());
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>(
new RiuFemTimeHistoryResultAccessor(geoMechTopItem->geoMechCase()->geoMechData(),
m_geoMechResultDefinition()->resultAddress(),
geoMechTopItem->m_gridIndex,
static_cast<int>(geoMechTopItem->m_cellIndex),
geoMechTopItem->m_elementFace,
geoMechTopItem->m_localIntersectionPoint,
intersectionTriangle));
}
else
{
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>(
new RiuFemTimeHistoryResultAccessor(geoMechTopItem->geoMechCase()->geoMechData(),
m_geoMechResultDefinition()->resultAddress(),
geoMechTopItem->m_gridIndex,
static_cast<int>(geoMechTopItem->m_cellIndex),
geoMechTopItem->m_elementFace,
geoMechTopItem->m_localIntersectionPoint));
}
}
return timeHistResultAccessor;
}

View File

@ -0,0 +1,92 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimPlotCurve.h"
#include "RimDefines.h"
#include "cafPdmChildField.h"
#include "cafPdmProxyValueField.h"
#include "cafPdmPtrField.h"
#include <memory>
class RigMainGrid;
class RimEclipseCase;
class RimEclipseResultDefinition;
class RimEclipseTopologyItem;
class RimGeoMechResultDefinition;
class RimGeoMechTopologyItem;
class RimPickingTopologyItem;
class RiuFemTimeHistoryResultAccessor;
class RiuSelectionItem;
//==================================================================================================
///
///
//==================================================================================================
class RimGridTimeHistoryCurve : public RimPlotCurve
{
CAF_PDM_HEADER_INIT;
public:
public:
RimGridTimeHistoryCurve();
virtual ~RimGridTimeHistoryCurve();
void setFromSelectionItem(const RiuSelectionItem* selectionItem);
RimDefines::PlotAxis yAxis() const;
void setYAxis(RimDefines::PlotAxis plotAxis);
std::vector<double> yValues() const;
std::vector<time_t> timeStepValues() const;
QString quantityName() const;
QString caseName() const;
protected:
virtual QString createCurveAutoName() override;
virtual void updateZoomInParentPlot() override;
virtual void onLoadDataAndUpdate() override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual void initAfterRead() override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
RigMainGrid* mainGrid();
RimEclipseTopologyItem* eclipseTopologyItem() const;
RimGeoMechTopologyItem* geoMechTopologyItem() const;
void updateResultDefinitionFromCase();
QString topologyText() const;
void updateQwtPlotAxis();
std::unique_ptr<RiuFemTimeHistoryResultAccessor> femTimeHistoryResultAccessor() const;
private:
caf::PdmProxyValueField<QString> m_topologyText;
caf::PdmChildField<RimEclipseResultDefinition*> m_eclipseResultDefinition;
caf::PdmChildField<RimGeoMechResultDefinition*> m_geoMechResultDefinition;
caf::PdmChildField<RimPickingTopologyItem*> m_pickingTopologyItem;
caf::PdmField< caf::AppEnum< RimDefines::PlotAxis > > m_plotAxis;
};

View File

@ -102,11 +102,11 @@ void RimIdenticalGridCaseGroup::addCase(RimEclipseCase* reservoir)
if (!m_mainGrid)
{
m_mainGrid = reservoir->reservoirData()->mainGrid();
m_mainGrid = reservoir->eclipseCaseData()->mainGrid();
}
else
{
reservoir->reservoirData()->setMainGrid(m_mainGrid);
reservoir->eclipseCaseData()->setMainGrid(m_mainGrid);
}
caseCollection()->reservoirs().push_back(reservoir);
@ -181,7 +181,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
return;
}
RigEclipseCaseData* rigCaseData = mainCase->reservoirData();
RigEclipseCaseData* rigCaseData = mainCase->eclipseCaseData();
CVF_ASSERT(rigCaseData);
RifReaderInterface::PorosityModelResultType poroModel = RifReaderInterface::MATRIX_RESULTS;
@ -285,7 +285,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
if (i == 0)
{
rimReservoir->reservoirData()->computeActiveCellBoundingBoxes();
rimReservoir->eclipseCaseData()->computeActiveCellBoundingBoxes();
}
}
}
@ -331,7 +331,7 @@ void RimIdenticalGridCaseGroup::computeUnionOfActiveCells()
if (activeM[gridLocalCellIndex] == 0)
{
if (caseCollection->reservoirs[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActive(reservoirCellIndex))
if (caseCollection->reservoirs[caseIdx]->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActive(reservoirCellIndex))
{
activeM[gridLocalCellIndex] = 1;
}
@ -339,7 +339,7 @@ void RimIdenticalGridCaseGroup::computeUnionOfActiveCells()
if (activeF[gridLocalCellIndex] == 0)
{
if (caseCollection->reservoirs[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->isActive(reservoirCellIndex))
if (caseCollection->reservoirs[caseIdx]->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->isActive(reservoirCellIndex))
{
activeF[gridLocalCellIndex] = 1;
}
@ -400,13 +400,13 @@ void RimIdenticalGridCaseGroup::updateMainGridAndActiveCellsForStatisticsCases()
{
RimEclipseCase* rimStaticsCase = statisticsCaseCollection->reservoirs[i];
if (rimStaticsCase->reservoirData())
if (rimStaticsCase->eclipseCaseData())
{
rimStaticsCase->reservoirData()->setMainGrid(this->mainGrid());
rimStaticsCase->eclipseCaseData()->setMainGrid(this->mainGrid());
if (i == 0)
{
rimStaticsCase->reservoirData()->computeActiveCellBoundingBoxes();
rimStaticsCase->eclipseCaseData()->computeActiveCellBoundingBoxes();
}
}
}
@ -521,7 +521,7 @@ RimEclipseCase* RimIdenticalGridCaseGroup::mainCase()
//--------------------------------------------------------------------------------------------------
bool RimIdenticalGridCaseGroup::canCaseBeAdded(RimEclipseCase* reservoir) const
{
CVF_ASSERT(reservoir && reservoir->reservoirData() && reservoir->reservoirData()->mainGrid());
CVF_ASSERT(reservoir && reservoir->eclipseCaseData() && reservoir->eclipseCaseData()->mainGrid());
if (!m_mainGrid)
{
@ -529,7 +529,7 @@ bool RimIdenticalGridCaseGroup::canCaseBeAdded(RimEclipseCase* reservoir) const
return true;
}
RigMainGrid* incomingMainGrid = reservoir->reservoirData()->mainGrid();
RigMainGrid* incomingMainGrid = reservoir->eclipseCaseData()->mainGrid();
if (RigGridManager::isEqual(m_mainGrid, incomingMainGrid))
{

View File

@ -228,7 +228,7 @@ void RimIntersection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
updateWellExtentDefaultValue();
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -626,20 +626,22 @@ void RimLegendConfig::setCategoryItems(const std::vector< std::tuple<QString, in
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimLegendConfig::categoryNameFromCategoryValue(int categoryValue) const
QString RimLegendConfig::categoryNameFromCategoryValue(double categoryResultValue) const
{
if (categoryResultValue == HUGE_VAL) return "Undefined";
if (m_categoryNames.size() > 0)
{
for (size_t categoryIndex = 0; categoryIndex < m_categories.size(); categoryIndex++)
{
if (categoryValue == m_categories[categoryIndex])
if (categoryResultValue == m_categories[categoryIndex])
{
return cvfqt::Utils::toQString(m_categoryNames[categoryIndex]);
}
}
}
return QString("%1").arg(categoryValue);
return QString("%1").arg(categoryResultValue);
}
//--------------------------------------------------------------------------------------------------

View File

@ -111,7 +111,7 @@ public:
void setIntegerCategories(const std::vector<int>& categories);
void setNamedCategoriesInverse(const std::vector<QString>& categoryNames);
void setCategoryItems(const std::vector<std::tuple<QString, int, cvf::Color3ub>>& categories);
QString categoryNameFromCategoryValue(int categoryValue) const;
QString categoryNameFromCategoryValue(double categoryResultValue) const;
void setTitle(const cvf::String& title);

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimPickingTopologyItem.h"
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimPickingTopologyItem, "RimPickingTopologyItem");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPickingTopologyItem::RimPickingTopologyItem()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPickingTopologyItem::~RimPickingTopologyItem()
{
}

View File

@ -0,0 +1,32 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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"
class RimPickingTopologyItem : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimPickingTopologyItem();
virtual ~RimPickingTopologyItem();
virtual QString topologyText() const = 0;
};

View File

@ -137,7 +137,6 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con
m_customCurveName = createCurveAutoName();
}
updateOptionSensitivity();
updateCurveName();
}
@ -241,15 +240,6 @@ bool RimPlotCurve::isCurveVisible() const
return m_showCurve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::initAfterRead()
{
updateOptionSensitivity();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More