mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'dev' into hdf-prototype
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -57,10 +57,6 @@ CTest*.cmake
|
||||
*.opensdf
|
||||
*.unsuccessfulbuild
|
||||
ipch/
|
||||
[Oo]bj/
|
||||
[Bb]in
|
||||
[Dd]ebug*/
|
||||
[Rr]elease*/
|
||||
Ankh.NoLoad
|
||||
|
||||
#Temp files
|
||||
|
||||
@@ -48,8 +48,9 @@
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimFaultCollection.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechModels.h"
|
||||
@@ -66,13 +67,13 @@
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimTreeViewStateSerializer.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
@@ -98,10 +99,12 @@
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmFieldCvfMat4d.h"
|
||||
#include "cafPdmSettings.h"
|
||||
#include "cafPdmUiModelChangeDetector.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cafUiProcess.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include "cvfProgramOptions.h"
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
@@ -113,6 +116,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <QTreeView>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -616,6 +620,47 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::storeTreeViewState()
|
||||
{
|
||||
{
|
||||
if (mainPlotWindow() && mainPlotWindow()->projectTreeView())
|
||||
{
|
||||
caf::PdmUiTreeView* projectTreeView = mainPlotWindow()->projectTreeView();
|
||||
|
||||
QString treeViewState;
|
||||
RimTreeViewStateSerializer::storeTreeViewStateToString(projectTreeView->treeView(), treeViewState);
|
||||
|
||||
QModelIndex mi = projectTreeView->treeView()->currentIndex();
|
||||
|
||||
QString encodedModelIndexString;
|
||||
RimTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
|
||||
|
||||
project()->plotWindowTreeViewState = treeViewState;
|
||||
project()->plotWindowCurrentModelIndexPath = encodedModelIndexString;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiTreeView* projectTreeView = RiuMainWindow::instance()->projectTreeView();
|
||||
if (projectTreeView)
|
||||
{
|
||||
QString treeViewState;
|
||||
RimTreeViewStateSerializer::storeTreeViewStateToString(projectTreeView->treeView(), treeViewState);
|
||||
|
||||
QModelIndex mi = projectTreeView->treeView()->currentIndex();
|
||||
|
||||
QString encodedModelIndexString;
|
||||
RimTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
|
||||
|
||||
project()->mainWindowTreeViewState = treeViewState;
|
||||
project()->mainWindowCurrentModelIndexPath = encodedModelIndexString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Add a list of well path file paths (JSON files) to the well path collection
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -716,6 +761,55 @@ bool RiaApplication::saveProjectPromptForFileName()
|
||||
return bSaveOk;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaApplication::hasValidProjectFileExtension(const QString& fileName)
|
||||
{
|
||||
if (fileName.contains(".rsp", Qt::CaseInsensitive) || fileName.contains(".rip", Qt::CaseInsensitive))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaApplication::askUserToSaveModifiedProject()
|
||||
{
|
||||
if (caf::PdmUiModelChangeDetector::instance()->isModelChanged())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
|
||||
QString questionText;
|
||||
questionText = QString("The current project is modified.\n\nDo you want to save the changes?");
|
||||
|
||||
msgBox.setText(questionText);
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
|
||||
int ret = msgBox.exec();
|
||||
if (ret == QMessageBox::Cancel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (ret == QMessageBox::Yes)
|
||||
{
|
||||
if (!saveProject())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::PdmUiModelChangeDetector::instance()->reset();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -724,6 +818,8 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
|
||||
{
|
||||
m_project->fileName = fileName;
|
||||
|
||||
storeTreeViewState();
|
||||
|
||||
if (!m_project->writeFile())
|
||||
{
|
||||
QMessageBox::warning(NULL, "Error when saving project file", QString("Not possible to save project file. Make sure you have sufficient access rights.\n\nProject file location : %1").arg(fileName));
|
||||
@@ -736,10 +832,11 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
|
||||
|
||||
m_recentFileActionProvider->addFileName(fileName);
|
||||
|
||||
caf::PdmUiModelChangeDetector::instance()->reset();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1116,6 +1213,25 @@ RimView* RiaApplication::activeReservoirView()
|
||||
return m_activeReservoirView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow* RiaApplication::activePlotWindow() const
|
||||
{
|
||||
RimViewWindow* viewWindow = nullptr;
|
||||
|
||||
if ( m_mainPlotWindow )
|
||||
{
|
||||
QList<QMdiSubWindow*> subwindows = m_mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||
if ( subwindows.size() > 0 )
|
||||
{
|
||||
viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
|
||||
}
|
||||
}
|
||||
|
||||
return viewWindow;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1124,54 +1240,6 @@ void RiaApplication::setActiveReservoirView(RimView* rv)
|
||||
m_activeReservoirView = rv;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::setActiveWellLogPlot(RimWellLogPlot* wlp)
|
||||
{
|
||||
m_activeWellLogPlot = wlp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot* RiaApplication::activeWellLogPlot()
|
||||
{
|
||||
return m_activeWellLogPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::setActiveSummaryPlot(RimSummaryPlot* sp)
|
||||
{
|
||||
m_activeSummaryPlot = sp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RiaApplication::activeSummaryPlot()
|
||||
{
|
||||
return m_activeSummaryPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::setActiveWellAllocationPlot(RimWellAllocationPlot* wap)
|
||||
{
|
||||
m_activeWellAllocationPlot = wap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot* RiaApplication::activeWellAllocationPlot()
|
||||
{
|
||||
return m_activeWellAllocationPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1620,42 +1688,20 @@ RimViewWindow* RiaApplication::activeViewWindow()
|
||||
{
|
||||
RimViewWindow* viewWindow = NULL;
|
||||
|
||||
QWidget* topLevelWidget = RiaApplication::activeWindow();
|
||||
QWidget* mainWindowWidget = RiaApplication::activeWindow();
|
||||
|
||||
if (dynamic_cast<RiuMainWindow*>(topLevelWidget))
|
||||
if (dynamic_cast<RiuMainWindow*>(mainWindowWidget))
|
||||
{
|
||||
viewWindow = RiaApplication::instance()->activeReservoirView();
|
||||
}
|
||||
|
||||
if (dynamic_cast<RiuMainPlotWindow*>(topLevelWidget))
|
||||
else if (dynamic_cast<RiuMainPlotWindow*>(mainWindowWidget))
|
||||
{
|
||||
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(topLevelWidget);
|
||||
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(mainWindowWidget);
|
||||
|
||||
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||
if (subwindows.size() > 0)
|
||||
{
|
||||
RiuSummaryQwtPlot* summaryQwtPlot = dynamic_cast<RiuSummaryQwtPlot*>(subwindows.back()->widget());
|
||||
if (summaryQwtPlot)
|
||||
{
|
||||
viewWindow = summaryQwtPlot->ownerPlotDefinition();
|
||||
}
|
||||
|
||||
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(subwindows.back()->widget());
|
||||
if (wellLogPlot)
|
||||
{
|
||||
viewWindow = wellLogPlot->ownerPlotDefinition();
|
||||
}
|
||||
|
||||
RiuWellAllocationPlot* wellAllocationPlot = dynamic_cast<RiuWellAllocationPlot*>(subwindows.back()->widget());
|
||||
if (wellAllocationPlot)
|
||||
{
|
||||
viewWindow = wellAllocationPlot->ownerPlotDefinition();
|
||||
}
|
||||
|
||||
RiuFlowCharacteristicsPlot* flowCharacteristicsPlot = dynamic_cast<RiuFlowCharacteristicsPlot*>(subwindows.back()->widget());
|
||||
if (flowCharacteristicsPlot)
|
||||
{
|
||||
viewWindow = flowCharacteristicsPlot->ownerPlotDefinition();
|
||||
}
|
||||
viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2073,7 +2119,7 @@ bool RiaApplication::openFile(const QString& fileName)
|
||||
|
||||
bool loadingSucceded = false;
|
||||
|
||||
if (fileName.contains(".rsp", Qt::CaseInsensitive) || fileName.contains(".rip", Qt::CaseInsensitive))
|
||||
if (RiaApplication::hasValidProjectFileExtension(fileName))
|
||||
{
|
||||
loadingSucceded = loadProject(fileName);
|
||||
}
|
||||
@@ -2108,6 +2154,11 @@ bool RiaApplication::openFile(const QString& fileName)
|
||||
}
|
||||
}
|
||||
|
||||
if (loadingSucceded && !RiaApplication::hasValidProjectFileExtension(fileName))
|
||||
{
|
||||
caf::PdmUiModelChangeDetector::instance()->setModelChanged();
|
||||
}
|
||||
|
||||
return loadingSucceded;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,14 +96,7 @@ public:
|
||||
RimView* activeReservoirView();
|
||||
const RimView* activeReservoirView() const;
|
||||
|
||||
void setActiveWellLogPlot(RimWellLogPlot*);
|
||||
RimWellLogPlot* activeWellLogPlot();
|
||||
|
||||
void setActiveSummaryPlot(RimSummaryPlot*);
|
||||
RimSummaryPlot* activeSummaryPlot();
|
||||
|
||||
void setActiveWellAllocationPlot(RimWellAllocationPlot*);
|
||||
RimWellAllocationPlot* activeWellAllocationPlot();
|
||||
RimViewWindow* activePlotWindow() const;
|
||||
|
||||
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
|
||||
|
||||
@@ -133,7 +126,11 @@ public:
|
||||
bool saveProject();
|
||||
bool saveProjectAs(const QString& fileName);
|
||||
bool saveProjectPromptForFileName();
|
||||
static bool hasValidProjectFileExtension(const QString& fileName);
|
||||
|
||||
bool askUserToSaveModifiedProject();
|
||||
void closeProject();
|
||||
|
||||
void addWellPathsToModel(QList<QString> wellPathFilePaths);
|
||||
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
|
||||
|
||||
@@ -216,6 +213,8 @@ private:
|
||||
|
||||
void loadAndUpdatePlotData();
|
||||
|
||||
void storeTreeViewState();
|
||||
|
||||
private slots:
|
||||
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void slotUpdateScheduledDisplayModels();
|
||||
@@ -228,9 +227,6 @@ private slots:
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimView> m_activeReservoirView;
|
||||
caf::PdmPointer<RimWellLogPlot> m_activeWellLogPlot;
|
||||
caf::PdmPointer<RimSummaryPlot> m_activeSummaryPlot;
|
||||
caf::PdmPointer<RimWellAllocationPlot> m_activeWellAllocationPlot;
|
||||
|
||||
caf::PdmPointer<RimProject> m_project;
|
||||
|
||||
|
||||
@@ -163,12 +163,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
newCaseBehaviourGroup->add(&loadAndShowSoil);
|
||||
newCaseBehaviourGroup->add(&showLasCurveWithoutTvdWarning);
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> readerSettingsFields;
|
||||
readerSettings->fields(readerSettingsFields);
|
||||
for (size_t i = 0; i < readerSettingsFields.size(); i++)
|
||||
{
|
||||
newCaseBehaviourGroup->add(readerSettingsFields[i]);
|
||||
}
|
||||
readerSettings->defineUiOrdering(uiConfigName, *newCaseBehaviourGroup);
|
||||
|
||||
caf::PdmUiGroup* ssihubGroup = uiOrdering.addNewGroup("SSIHUB");
|
||||
ssihubGroup->add(&ssihubAddress);
|
||||
|
||||
@@ -29,9 +29,7 @@ include_directories(
|
||||
${ResInsight_SOURCE_DIR}/ThirdParty/Qwt/src
|
||||
${ERT_INCLUDE_DIRS}
|
||||
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${ResInsight_SOURCE_DIR}/ThirdParty/custom-opm-common/opm-common/
|
||||
${custom-opm-parser_SOURCE_DIR}/opm-parser/
|
||||
${boost-Subset_SOURCE_DIR}
|
||||
${custom-opm-flowdiagnostics_SOURCE_DIR}/opm-flowdiagnostics/
|
||||
${custom-opm-flowdiag-app_SOURCE_DIR}/opm-flowdiagnostics-applications/
|
||||
${custom-opm-flowdiag-app_SOURCE_DIR}/opmCore
|
||||
@@ -306,20 +304,6 @@ endif ()
|
||||
# Set up libraries and dependent projects to link with
|
||||
#############################################################################
|
||||
|
||||
if (MSVC)
|
||||
set (RI_BOOST_LIBRARIES
|
||||
debug ${Boost_SYSTEM_LIBRARY_DEBUG}
|
||||
optimized ${Boost_SYSTEM_LIBRARY_RELEASE}
|
||||
debug ${Boost_FILESYSTEM_LIBRARY_DEBUG}
|
||||
optimized ${Boost_FILESYSTEM_LIBRARY_RELEASE}
|
||||
debug ${Boost_REGEX_LIBRARY_DEBUG}
|
||||
optimized ${Boost_REGEX_LIBRARY_RELEASE}
|
||||
)
|
||||
else()
|
||||
set (RI_BOOST_LIBRARIES ${Boost_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
||||
set( LINK_LIBRARIES
|
||||
${OPM_LIBRARIES}
|
||||
|
||||
@@ -337,9 +321,8 @@ set( LINK_LIBRARIES
|
||||
|
||||
${OPENGL_LIBRARIES}
|
||||
${QT_LIBRARIES}
|
||||
|
||||
${RI_BOOST_LIBRARIES}
|
||||
)
|
||||
|
||||
set( EXTERNAL_LINK_LIBRARIES ${ERT_LIBRARY_LIST} )
|
||||
|
||||
# According to ivarun this is needed on OpenSuse, and Fedora. See: https://github.com/OPM/ResInsight/pull/7
|
||||
@@ -369,9 +352,6 @@ if(RESINSIGHT_ENABLE_COTIRE)
|
||||
# multiple QRC files are not supported
|
||||
set_source_files_properties (qrc_cafAnimControl.cxx PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
# TODO: Revisit why opm-parser is not working
|
||||
set_source_files_properties (UnitTests/opm-parser-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
# variables at global file scope
|
||||
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
@@ -383,13 +363,9 @@ if(RESINSIGHT_ENABLE_COTIRE)
|
||||
# using namespace cvf
|
||||
set_source_files_properties (GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (UnitTests/cvfGeometryTools-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (UnitTests/opm-parser-Performance-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
# opm parser
|
||||
set_source_files_properties (FileInterface/RifReaderOpmParserInput.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ProjectDataModel/RimProject.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (UnitTests/opm-parser-Performance-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (UnitTests/opm-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
set_target_properties(ResInsight PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
|
||||
|
||||
|
||||
@@ -37,8 +37,12 @@ bool RicCloseProjectFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCloseProjectFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
if (!app->askUserToSaveModifiedProject()) return;
|
||||
|
||||
app->closeProject();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ bool RicEditPreferencesFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEditPreferencesFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
QStringList tabNames = app->preferences()->tabNames();
|
||||
|
||||
@@ -37,7 +37,11 @@ bool RicExitApplicationFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExitApplicationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
if (!app->askUserToSaveModifiedProject()) return;
|
||||
|
||||
app->closeAllWindows();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ bool RicHelpAboutFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHelpAboutFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
caf::AboutDialog dlg(NULL);
|
||||
|
||||
dlg.setApplicationName(RI_APPLICATION_NAME);
|
||||
@@ -100,6 +102,8 @@ bool RicHelpCommandLineFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHelpCommandLineFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString text = app->commandLineParameterHelp();
|
||||
app->showFormattedTextInMessageBox(text);
|
||||
@@ -131,6 +135,8 @@ bool RicHelpOpenUsersGuideFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicHelpOpenUsersGuideFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
QString usersGuideUrl = "http://resinsight.org/docs/home";
|
||||
|
||||
if (!QDesktopServices::openUrl(usersGuideUrl))
|
||||
|
||||
@@ -39,6 +39,8 @@ bool RicLaunchUnitTestsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLaunchUnitTestsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication::instance()->launchUnitTestsWithConsole();
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@ bool RicOpenLastUsedFileFeature::isCommandEnabled()
|
||||
void RicOpenLastUsedFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
if (!app->askUserToSaveModifiedProject()) return;
|
||||
|
||||
QString fileName = app->preferences()->lastUsedProjectFileName;
|
||||
|
||||
if (app->loadProject(fileName))
|
||||
|
||||
@@ -42,6 +42,9 @@ bool RicOpenProjectFeature::isCommandEnabled()
|
||||
void RicOpenProjectFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
if (!app->askUserToSaveModifiedProject()) return;
|
||||
|
||||
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
|
||||
QString fileName = QFileDialog::getOpenFileName(NULL, "Open ResInsight Project", defaultDir, "ResInsight project (*.rsp *.rip);;All files(*.*)");
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ bool RicSaveProjectAsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveProjectAsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RicSaveProjectFeature::storeTreeViewState();
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
app->saveProjectPromptForFileName();
|
||||
}
|
||||
|
||||
@@ -20,16 +20,7 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTreeViewStateSerializer.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include "cafPdmUiTreeView.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QTreeView>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicSaveProjectFeature, "RicSaveProjectFeature");
|
||||
|
||||
@@ -46,9 +37,9 @@ bool RicSaveProjectFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveProjectFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RicSaveProjectFeature::storeTreeViewState();
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
app->saveProject();
|
||||
}
|
||||
@@ -63,44 +54,3 @@ void RicSaveProjectFeature::setupActionLook(QAction* actionToSetup)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveProjectFeature::storeTreeViewState()
|
||||
{
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
if (app->mainPlotWindow() && app->mainPlotWindow()->projectTreeView())
|
||||
{
|
||||
caf::PdmUiTreeView* projectTreeView = app->mainPlotWindow()->projectTreeView();
|
||||
|
||||
QString treeViewState;
|
||||
RimTreeViewStateSerializer::storeTreeViewStateToString(projectTreeView->treeView(), treeViewState);
|
||||
|
||||
QModelIndex mi = projectTreeView->treeView()->currentIndex();
|
||||
|
||||
QString encodedModelIndexString;
|
||||
RimTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
|
||||
|
||||
RiaApplication::instance()->project()->plotWindowTreeViewState = treeViewState;
|
||||
RiaApplication::instance()->project()->plotWindowCurrentModelIndexPath = encodedModelIndexString;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiTreeView* projectTreeView = RiuMainWindow::instance()->projectTreeView();
|
||||
if (projectTreeView)
|
||||
{
|
||||
QString treeViewState;
|
||||
RimTreeViewStateSerializer::storeTreeViewStateToString(projectTreeView->treeView(), treeViewState);
|
||||
|
||||
QModelIndex mi = projectTreeView->treeView()->currentIndex();
|
||||
|
||||
QString encodedModelIndexString;
|
||||
RimTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
|
||||
|
||||
RiaApplication::instance()->project()->mainWindowTreeViewState = treeViewState;
|
||||
RiaApplication::instance()->project()->mainWindowCurrentModelIndexPath = encodedModelIndexString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,6 @@ class RicSaveProjectFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void storeTreeViewState();
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
|
||||
@@ -39,6 +39,8 @@ bool RicShowMainWindowFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowMainWindowFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
|
||||
if (mainWnd->isMinimized())
|
||||
|
||||
@@ -31,14 +31,144 @@
|
||||
#include <QBoxLayout>
|
||||
#include <QClipboard>
|
||||
#include <QMenu>
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicShowPlotDataFeature, "RicShowPlotDataFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
/// RiuQPlainTextEdit
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQPlainTextEdit::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
if ( e->key() == Qt::Key_C && e->modifiers() == Qt::ControlModifier )
|
||||
{
|
||||
slotCopyContentToClipboard();
|
||||
e->setAccepted(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
QPlainTextEdit::keyPressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQPlainTextEdit::slotCopyContentToClipboard()
|
||||
{
|
||||
QTextCursor cursor(this->textCursor());
|
||||
|
||||
QString textForClipboard;
|
||||
|
||||
QString selText = cursor.selectedText();
|
||||
if (!selText.isEmpty())
|
||||
{
|
||||
QTextDocument doc;
|
||||
doc.setPlainText(selText);
|
||||
|
||||
textForClipboard = doc.toPlainText();
|
||||
}
|
||||
|
||||
if (textForClipboard.isEmpty())
|
||||
{
|
||||
textForClipboard = this->toPlainText();
|
||||
}
|
||||
|
||||
if (!textForClipboard.isEmpty())
|
||||
{
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
if (clipboard)
|
||||
{
|
||||
clipboard->setText(textForClipboard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQPlainTextEdit::slotSelectAll()
|
||||
{
|
||||
this->selectAll();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
/// RicTextWidget
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicTextWidget::RicTextWidget(QWidget* parent) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||
{
|
||||
m_textEdit = new RiuQPlainTextEdit(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::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()), m_textEdit, SLOT(slotCopyContentToClipboard()));
|
||||
|
||||
menu.addAction(actionToSetup);
|
||||
}
|
||||
|
||||
{
|
||||
QAction* actionToSetup = new QAction(this);
|
||||
|
||||
actionToSetup->setText("Select All");
|
||||
actionToSetup->setShortcuts(QKeySequence::SelectAll);
|
||||
|
||||
connect(actionToSetup, SIGNAL(triggered()), m_textEdit, SLOT(slotSelectAll()));
|
||||
|
||||
menu.addAction(actionToSetup);
|
||||
}
|
||||
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
/// RicShowPlotDataFeature
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowPlotDataFeature::isCommandEnabled()
|
||||
{
|
||||
@@ -58,6 +188,8 @@ bool RicShowPlotDataFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowPlotDataFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
std::vector<RimSummaryPlot*> selectedSummaryPlots;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
|
||||
|
||||
@@ -129,104 +261,3 @@ void RicShowPlotDataFeature::showTextWindow(const QString& title, const QString&
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,24 @@
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
|
||||
class RiuQPlainTextEdit : public QPlainTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RiuQPlainTextEdit(QWidget *parent = 0) : QPlainTextEdit(parent) {}
|
||||
|
||||
protected:
|
||||
virtual void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
private slots:
|
||||
void slotCopyContentToClipboard();
|
||||
void slotSelectAll();
|
||||
|
||||
};
|
||||
|
||||
class QPlainTextEdit;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -36,12 +52,8 @@ public:
|
||||
|
||||
void setText(const QString& text);
|
||||
|
||||
private slots:
|
||||
void slotCopyContentToClipboard();
|
||||
void slotSelectAll();
|
||||
|
||||
private:
|
||||
QPlainTextEdit* m_textEdit;
|
||||
RiuQPlainTextEdit* m_textEdit;
|
||||
protected:
|
||||
virtual void contextMenuEvent(QContextMenuEvent *) override;
|
||||
|
||||
@@ -61,7 +73,7 @@ protected:
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
public:
|
||||
static void showTextWindow(const QString& title, const QString& text);
|
||||
};
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ bool RicShowPlotWindowFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowPlotWindowFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ bool RicTileWindowsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTileWindowsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||
if (mainWindow)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,6 @@ endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAddOpmInputPropertyFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.h
|
||||
@@ -18,7 +17,6 @@ ${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h
|
||||
@@ -28,7 +26,6 @@ ${CEE_CURRENT_LIST_DIR}RicApplyPropertyFilterAsCellResultFeature.h
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAddOpmInputPropertyFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.cpp
|
||||
@@ -40,7 +37,6 @@ ${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "RimEclipseInputPropertyCollection.h"
|
||||
#include "RimEclipseInputCase.h"
|
||||
#include "RimEclipseInputCaseOpm.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuMainWindow.h"
|
||||
@@ -40,18 +39,6 @@ CAF_CMD_SOURCE_INIT(RicAddEclipseInputPropertyFeature, "RicAddEclipseInputProper
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
|
||||
{
|
||||
RimEclipseInputPropertyCollection* inputProp = selectedInputPropertyCollection();
|
||||
if (inputProp)
|
||||
{
|
||||
RimEclipseInputCaseOpm* inputCaseOpm = NULL;
|
||||
|
||||
inputProp->firstAncestorOrThisOfType(inputCaseOpm);
|
||||
if (inputCaseOpm)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return selectedInputPropertyCollection() != NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,115 +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 "RicAddOpmInputPropertyFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimEclipseInputCaseOpm.h"
|
||||
#include "RimEclipseInputPropertyCollection.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicAddOpmInputPropertyFeature, "RicAddOpmInputPropertyFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAddOpmInputPropertyFeature::isCommandEnabled()
|
||||
{
|
||||
RimEclipseInputPropertyCollection* inputProp = selectedInputPropertyCollection();
|
||||
if (inputProp)
|
||||
{
|
||||
RimEclipseInputCaseOpm* inputCaseOpm = NULL;
|
||||
|
||||
inputProp->firstAncestorOrThisOfType(inputCaseOpm);
|
||||
if (inputCaseOpm)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddOpmInputPropertyFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(NULL, "Select Eclipse Input Property Files", defaultDir, "All Files (*.* *)");
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
// Remember the directory to next time
|
||||
defaultDir = QFileInfo(fileNames.last()).absolutePath();
|
||||
app->setLastUsedDialogDirectory("INPUT_FILES", defaultDir);
|
||||
|
||||
RimEclipseInputPropertyCollection* inputPropertyCollection = selectedInputPropertyCollection();
|
||||
if (inputPropertyCollection)
|
||||
{
|
||||
addEclipseInputProperty(fileNames, inputPropertyCollection);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddOpmInputPropertyFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Add Input Property");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseInputPropertyCollection* RicAddOpmInputPropertyFeature::selectedInputPropertyCollection() const
|
||||
{
|
||||
std::vector<RimEclipseInputPropertyCollection*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection.size() > 0 ? selection[0] : NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddOpmInputPropertyFeature::addEclipseInputProperty(const QStringList& fileNames, RimEclipseInputPropertyCollection* inputPropertyCollection)
|
||||
{
|
||||
CVF_ASSERT(inputPropertyCollection);
|
||||
|
||||
RimEclipseInputCaseOpm* inputCaseOpm = NULL;
|
||||
|
||||
inputPropertyCollection->firstAncestorOrThisOfType(inputCaseOpm);
|
||||
if (inputCaseOpm)
|
||||
{
|
||||
inputCaseOpm->appendPropertiesFromStandaloneFiles(fileNames);
|
||||
}
|
||||
|
||||
inputPropertyCollection->updateConnectedEditors();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 RimEclipseInputPropertyCollection;
|
||||
class QStringList;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicAddOpmInputPropertyFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
RimEclipseInputPropertyCollection* selectedInputPropertyCollection() const;
|
||||
static void addEclipseInputProperty(const QStringList& fileNames, RimEclipseInputPropertyCollection* inputPropertyCollection);
|
||||
};
|
||||
|
||||
|
||||
@@ -34,10 +34,7 @@ CAF_CMD_SOURCE_INIT(RicCreateGridCaseGroupFeature, "RicCreateGridCaseGroupFeatur
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateGridCaseGroupFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimEclipseCaseCollection*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection.size() > 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,100 +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 "RicImportInputEclipseCaseOpmFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimDefines.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseInputCaseOpm.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicImportInputEclipseCaseOpmFeature, "RicImportInputEclipseCaseOpmFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportInputEclipseCaseOpmFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportInputEclipseCaseOpmFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
|
||||
QString fileName = QFileDialog::getOpenFileName(RiuMainWindow::instance(), "Import Eclipse Input file", defaultDir, "Eclipse Input Files (*.GRDECL);;All Files (*.*)");
|
||||
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory("INPUT_FILES", QFileInfo(fileName).absolutePath());
|
||||
|
||||
RimProject* proj = app->project();
|
||||
RimEclipseCaseCollection* analysisModels = proj->activeOilField() ? proj->activeOilField()->analysisModels() : NULL;
|
||||
if (analysisModels)
|
||||
{
|
||||
// This code originates from RiaApplication::openInputEclipseCaseFromFileNames
|
||||
|
||||
RimEclipseInputCaseOpm* rimInputReservoir = new RimEclipseInputCaseOpm();
|
||||
proj->assignCaseIdToCase(rimInputReservoir);
|
||||
|
||||
rimInputReservoir->importNewEclipseGridAndProperties(fileName);
|
||||
|
||||
analysisModels->cases.push_back(rimInputReservoir);
|
||||
|
||||
RimEclipseView* riv = rimInputReservoir->createAndAddReservoirView();
|
||||
|
||||
riv->cellResult()->setResultType(RimDefines::INPUT_PROPERTY);
|
||||
riv->hasUserRequestedAnimation = true;
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
if (!riv->cellResult()->hasResult())
|
||||
{
|
||||
riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
|
||||
}
|
||||
|
||||
analysisModels->updateConnectedEditors();
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportInputEclipseCaseOpmFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/EclipseInput48x48.png"));
|
||||
actionToSetup->setText("Import Input Eclipse Case (opm-parser) - BETA");
|
||||
}
|
||||
@@ -1,39 +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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicImportInputEclipseCaseOpmFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ bool RicSaveEclipseInputPropertyFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RimEclipseInputProperty* inputProperty = selectedInputProperty();
|
||||
if (!inputProperty) return;
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ bool RicSaveEclipseResultAsInputPropertyFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveEclipseResultAsInputPropertyFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
std::vector<RimEclipseCellColors*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
if (selection.size() == 1)
|
||||
|
||||
@@ -13,6 +13,7 @@ ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.h
|
||||
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSelectViewUI.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowTotalAllocationDataFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -24,6 +25,7 @@ ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSelectViewUI.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowTotalAllocationDataFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -35,7 +35,8 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributin
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
||||
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
|
||||
|
||||
if (wellAllocationPlot) return true;
|
||||
|
||||
return false;
|
||||
@@ -46,7 +47,8 @@ bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
||||
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
|
||||
|
||||
if (!wellAllocationPlot) return;
|
||||
|
||||
int timeStep = wellAllocationPlot->timeStep();
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicShowTotalAllocationDataFeature.h"
|
||||
|
||||
#include "ApplicationCommands/RicShowPlotDataFeature.h"
|
||||
|
||||
#include "RimTotalWellAllocationPlot.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
#include <set>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicShowTotalAllocationDataFeature, "RicShowTotalAllocationDataFeature");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowTotalAllocationDataFeature::isCommandEnabled()
|
||||
{
|
||||
std::set<RimWellAllocationPlot*> wellAllocPlots = RicShowTotalAllocationDataFeature::selectedWellAllocationPlots();
|
||||
|
||||
if (wellAllocPlots.size() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowTotalAllocationDataFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
std::set<RimWellAllocationPlot*> wellAllocPlots = RicShowTotalAllocationDataFeature::selectedWellAllocationPlots();
|
||||
CVF_ASSERT(wellAllocPlots.size() > 0);
|
||||
|
||||
for (auto wellAllocPlot : wellAllocPlots)
|
||||
{
|
||||
QString txt = wellAllocPlot->description();
|
||||
txt += "\n";
|
||||
txt += "\n";
|
||||
txt += wellAllocPlot->totalWellFlowPlot()->totalAllocationAsText();
|
||||
|
||||
QString title = "Total Allocation (" + wellAllocPlot->wellName() + ")";
|
||||
|
||||
RicShowPlotDataFeature::showTextWindow(title, txt);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowTotalAllocationDataFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Show Total Allocation");
|
||||
//actionToSetup->setIcon(QIcon(":/PlotWindow24x24.png"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimWellAllocationPlot*> RicShowTotalAllocationDataFeature::selectedWellAllocationPlots()
|
||||
{
|
||||
std::set<RimWellAllocationPlot*> wellAllocPlots;
|
||||
|
||||
std::vector<caf::PdmObject*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType(&objects);
|
||||
for (auto obj : objects)
|
||||
{
|
||||
CVF_ASSERT(obj);
|
||||
|
||||
RimWellAllocationPlot* parentPlot = nullptr;
|
||||
obj->firstAncestorOrThisOfType(parentPlot);
|
||||
|
||||
if (parentPlot)
|
||||
{
|
||||
wellAllocPlots.insert(parentPlot);
|
||||
}
|
||||
}
|
||||
|
||||
return wellAllocPlots;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <set>
|
||||
|
||||
class RimWellAllocationPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicShowTotalAllocationDataFeature : 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 std::set<RimWellAllocationPlot*> selectedWellAllocationPlots();
|
||||
};
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "RimCalcScript.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cvfAssert.h"
|
||||
@@ -49,6 +50,9 @@ void RicExecuteScriptFeature::onActionTriggered(bool isChecked)
|
||||
std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts();
|
||||
CVF_ASSERT(selection.size() > 0);
|
||||
|
||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||
mainWindow->showProcessMonitorDockPanel();
|
||||
|
||||
RimCalcScript* calcScript = selection[0];
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
@@ -74,6 +75,9 @@ void RicExecuteScriptForCasesFeature::slotExecuteScriptForSelectedCases()
|
||||
|
||||
QString scriptAbsolutePath = action->data().toString();
|
||||
|
||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||
mainWindow->showProcessMonitorDockPanel();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString octavePath = app->octavePath();
|
||||
if (!octavePath.isEmpty())
|
||||
|
||||
@@ -57,6 +57,8 @@ bool RicCopyReferencesToClipboardFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCopyReferencesToClipboardFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
if (!isAnyCopyableObjectSelected()) return;
|
||||
|
||||
std::vector<QString> referenceList;
|
||||
|
||||
@@ -117,7 +117,8 @@ void RicPasteEclipseCasesFeature::addCasesToGridCaseGroup(PdmObjectGroup& object
|
||||
RimEclipseResultCase* eclCase = dynamic_cast<RimEclipseResultCase*>(objectGroup.objects[i]);
|
||||
if (eclCase)
|
||||
{
|
||||
RimEclipseResultCase* eclCaseCopy = dynamic_cast<RimEclipseResultCase*>(eclCase->copyByXmlSerialization(PdmDefaultObjectFactory::instance()));
|
||||
RimEclipseResultCase* eclCaseCopy = new RimEclipseResultCase();
|
||||
eclCaseCopy->setCaseInfo(eclCase->caseUserDescription(), eclCase->gridFileName());
|
||||
resultCases.push_back(eclCaseCopy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "RicPasteFeatureImpl.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
@@ -83,6 +85,8 @@ void RicPasteEclipseViewsFeature::onActionTriggered(bool isChecked)
|
||||
std::vector<caf::PdmPointer<RimEclipseView> > eclipseViews;
|
||||
objectGroup.objectsByType(&eclipseViews);
|
||||
|
||||
RimEclipseView* lastViewCopy = nullptr;
|
||||
|
||||
// Add cases to case group
|
||||
for (size_t i = 0; i < eclipseViews.size(); i++)
|
||||
{
|
||||
@@ -97,16 +101,18 @@ void RicPasteEclipseViewsFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
// Resolve references after reservoir view has been inserted into Rim structures
|
||||
// Intersections referencing a well path/ simulation well requires this
|
||||
// TODO: initAfterReadRecursively can probably be removed
|
||||
rimReservoirView->initAfterReadRecursively();
|
||||
rimReservoirView->resolveReferencesRecursively();
|
||||
rimReservoirView->initAfterReadRecursively();
|
||||
|
||||
rimReservoirView->loadDataAndUpdate();
|
||||
|
||||
caf::PdmDocument::updateUiIconStateRecursively(rimReservoirView);
|
||||
|
||||
eclipseCase->updateConnectedEditors();
|
||||
lastViewCopy = rimReservoirView;
|
||||
}
|
||||
|
||||
if (lastViewCopy) RiuMainWindow::instance()->selectAsCurrentItem(lastViewCopy);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "RicPasteFeatureImpl.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
|
||||
@@ -77,6 +79,8 @@ void RicPasteGeoMechViewsFeature::onActionTriggered(bool isChecked)
|
||||
std::vector<caf::PdmPointer<RimGeoMechView> > geomViews;
|
||||
objectGroup.objectsByType(&geomViews);
|
||||
|
||||
RimGeoMechView* lastViewCopy = nullptr;
|
||||
|
||||
// Add cases to case group
|
||||
for (size_t i = 0; i < geomViews.size(); i++)
|
||||
{
|
||||
@@ -89,15 +93,19 @@ void RicPasteGeoMechViewsFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
// Resolve references after reservoir view has been inserted into Rim structures
|
||||
// Intersections referencing a well path requires this
|
||||
rimReservoirView->initAfterReadRecursively();
|
||||
rimReservoirView->resolveReferencesRecursively();
|
||||
rimReservoirView->initAfterReadRecursively();
|
||||
|
||||
caf::PdmDocument::updateUiIconStateRecursively(rimReservoirView);
|
||||
|
||||
rimReservoirView->loadDataAndUpdate();
|
||||
|
||||
geomCase->updateConnectedEditors();
|
||||
|
||||
lastViewCopy = rimReservoirView;
|
||||
}
|
||||
|
||||
if (lastViewCopy) RiuMainWindow::instance()->selectAsCurrentItem(lastViewCopy);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -158,6 +158,26 @@ void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
|
||||
}
|
||||
else
|
||||
{
|
||||
RimIdenticalGridCaseGroup* caseGroup = caseCollection->parentCaseGroup();
|
||||
if (caseGroup)
|
||||
{
|
||||
// When deleting the last source case for statistics, remove any views on statistics cases.
|
||||
// This is done because the views do not work well
|
||||
if (caseGroup->caseCollection()->reservoirs.size() == 1)
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> children;
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.childObjects(&children);
|
||||
|
||||
for (size_t i = children.size(); i-- > 0;)
|
||||
{
|
||||
caf::PdmObjectHandle* obj = children[i];
|
||||
delete obj;
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.erase(i);
|
||||
}
|
||||
|
||||
caseGroup->statisticsCaseCollection()->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
removeCaseFromAllGroups(eclipseCase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ bool RicExportFaultsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportFaultsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
std::vector<RimFault*> selectedFaults;
|
||||
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedFaults);
|
||||
@@ -70,6 +72,11 @@ void RicExportFaultsFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
QString selectedDir = QFileDialog::getExistingDirectory(NULL, tr("Select Directory"), defaultDir);
|
||||
|
||||
if (selectedDir.isNull()) {
|
||||
// Stop if folder selection was cancelled.
|
||||
return;
|
||||
}
|
||||
|
||||
for (RimFault* rimFault : selectedFaults)
|
||||
{
|
||||
RimEclipseCase* eclCase = nullptr;
|
||||
@@ -106,6 +113,75 @@ void RicExportFaultsFeature::setupActionLook(QAction* actionToSetup)
|
||||
actionToSetup->setIcon(QIcon(":/Save.png"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Order FaultCellAndFace by i, j, face then k.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportFaultsFeature::faultOrdering(FaultCellAndFace first, FaultCellAndFace second)
|
||||
{
|
||||
size_t i1, i2, j1, j2, k1, k2;
|
||||
cvf::StructGridInterface::FaceType f1, f2;
|
||||
std::tie(i1, j1, k1, f1) = first;
|
||||
std::tie(i2, j2, k2, f2) = second;
|
||||
if (i1 == i2)
|
||||
{
|
||||
if (j1 == j2)
|
||||
{
|
||||
if (f1 == f2)
|
||||
{
|
||||
return k1 < k2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return f1 < f2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return j1 < j2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return i1 < i2;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicExportFaultsFeature::faceText(cvf::StructGridInterface::FaceType faceType)
|
||||
{
|
||||
switch (faceType)
|
||||
{
|
||||
case cvf::StructGridInterface::POS_I: return QString(" I");
|
||||
case cvf::StructGridInterface::NEG_I: return QString("-I");
|
||||
case cvf::StructGridInterface::POS_J: return QString(" J");
|
||||
case cvf::StructGridInterface::NEG_J: return QString("-J");
|
||||
case cvf::StructGridInterface::POS_K: return QString(" K");
|
||||
case cvf::StructGridInterface::NEG_K: return QString("-K");
|
||||
default: CVF_ASSERT(false);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportFaultsFeature::writeLine(QTextStream & stream, QString faultName, size_t i, size_t j, size_t startK, size_t endK, cvf::StructGridInterface::FaceType faceType)
|
||||
{
|
||||
// Convert indices to eclipse format
|
||||
i++;
|
||||
j++;
|
||||
startK++;
|
||||
endK++;
|
||||
|
||||
stream << "'" << faultName << "'" << " " << i << " " << i
|
||||
<< " " << j << " " << j
|
||||
<< " " << startK << " " << endK
|
||||
<< " " << RicExportFaultsFeature::faceText(faceType) << " / ";
|
||||
stream << endl;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -127,32 +203,54 @@ void RicExportFaultsFeature::saveFault(QString completeFilename, const RigMainGr
|
||||
|
||||
// 'NAME' 1 1 1 1 1 2 J /
|
||||
|
||||
for (const RigFault::FaultFace& fface: faultFaces)
|
||||
{
|
||||
size_t i1, j1, k1, i2, j2, k2;
|
||||
std::vector<FaultCellAndFace> faultCellAndFaces;
|
||||
|
||||
bool ok = mainGrid->ijkFromCellIndex(fface.m_nativeReservoirCellIndex, &i1, &j1, &k1);
|
||||
for (const RigFault::FaultFace& faultCellAndFace : faultFaces)
|
||||
{
|
||||
size_t i, j, k;
|
||||
bool ok = mainGrid->ijkFromCellIndex(faultCellAndFace.m_nativeReservoirCellIndex, &i, &j, &k);
|
||||
if (!ok) continue;
|
||||
ok = mainGrid->ijkFromCellIndex(fface.m_oppositeReservoirCellIndex, &i2, &j2, &k2);
|
||||
|
||||
QString faceText;
|
||||
switch (fface.m_nativeFace)
|
||||
faultCellAndFaces.push_back(std::make_tuple(i, j, k, faultCellAndFace.m_nativeFace));
|
||||
}
|
||||
|
||||
// Sort order: i, j, face then k.
|
||||
std::sort(faultCellAndFaces.begin(), faultCellAndFaces.end(), RicExportFaultsFeature::faultOrdering);
|
||||
|
||||
size_t lastI = std::numeric_limits<size_t>::max();
|
||||
size_t lastJ = std::numeric_limits<size_t>::max();
|
||||
size_t lastK = std::numeric_limits<size_t>::max();
|
||||
size_t startK = std::numeric_limits<size_t>::max();
|
||||
cvf::StructGridInterface::FaceType lastFaceType = cvf::StructGridInterface::FaceType::NO_FACE;
|
||||
|
||||
for (const FaultCellAndFace &faultCellAndFace : faultCellAndFaces)
|
||||
{
|
||||
case cvf::StructGridInterface::POS_I: faceText = " I"; break;
|
||||
case cvf::StructGridInterface::NEG_I: faceText = "-I"; break;
|
||||
case cvf::StructGridInterface::POS_J: faceText = " J"; break;
|
||||
case cvf::StructGridInterface::NEG_J: faceText = "-J"; break;
|
||||
case cvf::StructGridInterface::POS_K: faceText = " K"; break;
|
||||
case cvf::StructGridInterface::NEG_K: faceText = "-K"; break;
|
||||
}
|
||||
size_t i, j, k;
|
||||
cvf::StructGridInterface::FaceType faceType;
|
||||
std::tie(i, j, k, faceType) = faultCellAndFace;
|
||||
|
||||
stream << "'" << faultName << "'" << " " << i1 << " " << i2
|
||||
<< " " << j1 << " " << j2
|
||||
<< " " << k1 << " " << k2
|
||||
<< " " << faceText << " / ";
|
||||
stream << endl ;
|
||||
if (i != lastI || j != lastJ || lastFaceType != faceType || k != lastK+1)
|
||||
{
|
||||
// No fault should have no face
|
||||
if (lastFaceType != cvf::StructGridInterface::FaceType::NO_FACE)
|
||||
{
|
||||
RicExportFaultsFeature::writeLine(stream, faultName, lastI, lastJ, startK, lastK, lastFaceType);
|
||||
}
|
||||
lastI = i;
|
||||
lastJ = j;
|
||||
lastK = k;
|
||||
lastFaceType = faceType;
|
||||
startK = k;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastK = k;
|
||||
}
|
||||
}
|
||||
// No fault should have no face
|
||||
if (lastFaceType != cvf::StructGridInterface::FaceType::NO_FACE)
|
||||
{
|
||||
RicExportFaultsFeature::writeLine(stream, faultName, lastI, lastJ, startK, lastK, lastFaceType);
|
||||
}
|
||||
|
||||
stream << "/" << endl;
|
||||
|
||||
}
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
class RigMainGrid;
|
||||
|
||||
typedef std::tuple<size_t, size_t, size_t, cvf::StructGridInterface::FaceType> FaultCellAndFace;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@@ -41,5 +43,8 @@ protected:
|
||||
|
||||
private:
|
||||
static void saveFault(QString completeFilename, const RigMainGrid* mainGrid, const std::vector<RigFault::FaultFace>& faultFaces, QString faultName);
|
||||
static bool faultOrdering(FaultCellAndFace first, FaultCellAndFace second);
|
||||
static QString faceText(cvf::StructGridInterface::FaceType faceType);
|
||||
static void writeLine(QTextStream &stream, QString faultName, size_t i, size_t j, size_t startK, size_t endK, cvf::StructGridInterface::FaceType faceType);
|
||||
};
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ bool RicExportMultipleSnapshotsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportMultipleSnapshotsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
if (proj)
|
||||
@@ -152,10 +154,8 @@ void RicExportMultipleSnapshotsFeature::exportMultipleSnapshots(const QString& f
|
||||
copyOfGeoMechView->setGeoMechCase(geomCase);
|
||||
|
||||
// Resolve references after reservoir view has been inserted into Rim structures
|
||||
// Intersections referencing a well path/ simulation well requires this
|
||||
// TODO: initAfterReadRecursively can probably be removed
|
||||
copyOfGeoMechView->initAfterReadRecursively();
|
||||
copyOfGeoMechView->resolveReferencesRecursively();
|
||||
copyOfGeoMechView->initAfterReadRecursively();
|
||||
|
||||
copyOfGeoMechView->loadDataAndUpdate();
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ bool RicExportToLasFileFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportToLasFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return;
|
||||
|
||||
std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves();
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "RimView.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
@@ -36,9 +37,9 @@ CAF_CMD_SOURCE_INIT(RicNewViewFeature, "RicNewViewFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewViewFeature::addReservoirView()
|
||||
void RicNewViewFeature::addReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase)
|
||||
{
|
||||
RimView* newView = createReservoirView();
|
||||
RimView* newView = createReservoirView(eclipseCase, geomCase);
|
||||
|
||||
if (newView)
|
||||
{
|
||||
@@ -62,7 +63,18 @@ bool RicNewViewFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewViewFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
addReservoirView();
|
||||
// Establish type of selected object
|
||||
RimEclipseCase* eclipseCase = selectedEclipseCase();
|
||||
RimGeoMechCase* geomCase = selectedGeoMechCase();
|
||||
RimGeoMechView* geoMechView = selectedGeoMechView();
|
||||
RimEclipseView* reservoirView = selectedEclipseView();
|
||||
|
||||
|
||||
// Find case to insert into
|
||||
if (geoMechView) geomCase = geoMechView->geoMechCase();
|
||||
if (reservoirView) eclipseCase = reservoirView->eclipseCase();
|
||||
|
||||
addReservoirView(eclipseCase, geomCase);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -77,18 +89,8 @@ void RicNewViewFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimView* RicNewViewFeature::createReservoirView()
|
||||
RimView* RicNewViewFeature::createReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase)
|
||||
{
|
||||
// Establish type of selected object
|
||||
RimEclipseCase* eclipseCase = selectedEclipseCase();
|
||||
RimGeoMechCase* geomCase = selectedGeoMechCase();
|
||||
RimGeoMechView* geoMechView = selectedGeoMechView();
|
||||
RimEclipseView* reservoirView = selectedEclipseView();
|
||||
|
||||
// Find case to insert into
|
||||
if (geoMechView) geomCase = geoMechView->geoMechCase();
|
||||
if (reservoirView) eclipseCase = reservoirView->eclipseCase();
|
||||
|
||||
RimView* insertedView = NULL;
|
||||
|
||||
if (eclipseCase)
|
||||
|
||||
@@ -35,7 +35,7 @@ class RicNewViewFeature : public caf::CmdFeature
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void addReservoirView();
|
||||
static void addReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase);
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
@@ -44,7 +44,7 @@ protected:
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
static RimView* createReservoirView();
|
||||
static RimView* createReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase);
|
||||
|
||||
static RimEclipseCase* selectedEclipseCase();
|
||||
static RimGeoMechCase* selectedGeoMechCase();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "RicSnapshotViewToClipboardFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
@@ -51,6 +52,8 @@ bool RicSnapshotViewToClipboardFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSnapshotViewToClipboardFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RimViewWindow* viewWindow = RiaApplication::activeViewWindow();
|
||||
|
||||
if (viewWindow)
|
||||
@@ -119,6 +122,17 @@ void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* proj = app->project();
|
||||
|
||||
// Get active view window before displaying the file selection dialog
|
||||
// If this is done after the file save dialog is displayed (and closed)
|
||||
// app->activeViewWindow() returns NULL on Linux
|
||||
RimViewWindow* viewWindow = app->activeViewWindow();
|
||||
if (!viewWindow)
|
||||
{
|
||||
RiaLogging::error("No view window is available, nothing to do");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
QString startPath;
|
||||
if (!proj->fileName().isEmpty())
|
||||
{
|
||||
@@ -141,7 +155,6 @@ void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
|
||||
// Remember the directory to next time
|
||||
app->setLastUsedDialogDirectory("IMAGE_SNAPSHOT", QFileInfo(fileName).absolutePath());
|
||||
|
||||
RimViewWindow* viewWindow = app->activeViewWindow();
|
||||
RicSnapshotViewToFileFeature::saveSnapshotAs(fileName, viewWindow);
|
||||
}
|
||||
|
||||
@@ -208,7 +221,16 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(QStrin
|
||||
{
|
||||
if (viewWindow->isMdiWindow() && viewWindow->viewWidget())
|
||||
{
|
||||
QString fileName = viewWindow->userDescriptionField()->uiCapability()->uiValue().toString();
|
||||
QString fileName;
|
||||
if ( viewWindow->userDescriptionField())
|
||||
{
|
||||
fileName = viewWindow->userDescriptionField()->uiCapability()->uiValue().toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName = viewWindow->uiCapability()->uiName();
|
||||
}
|
||||
|
||||
fileName = caf::Utils::makeValidFileBasename(fileName);
|
||||
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
||||
|
||||
@@ -56,6 +56,8 @@ bool RicAsciiExportSummaryPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAsciiExportSummaryPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString projectFolder = app->currentProjectPath();
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
||||
|
||||
if (!defaultSelectedPlot)
|
||||
{
|
||||
defaultSelectedPlot = RiaApplication::instance()->activeSummaryPlot();
|
||||
defaultSelectedPlot = dynamic_cast<RimSummaryPlot*>( RiaApplication::instance()->activePlotWindow() );
|
||||
}
|
||||
|
||||
if (!defaultSelectedPlot && summaryPlotColl->summaryPlots().size() > 0)
|
||||
|
||||
@@ -42,6 +42,11 @@ bool RicPasteTimeHistoryCurveFeature::isCommandEnabled()
|
||||
{
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
|
||||
|
||||
if (!destinationObject)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
destinationObject->firstAncestorOrThisOfType(summaryPlot);
|
||||
if (!summaryPlot)
|
||||
@@ -58,6 +63,7 @@ bool RicPasteTimeHistoryCurveFeature::isCommandEnabled()
|
||||
void RicPasteTimeHistoryCurveFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
|
||||
CVF_ASSERT(destinationObject);
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
destinationObject->firstAncestorOrThisOfType(summaryPlot);
|
||||
|
||||
@@ -53,6 +53,8 @@ bool RicViewZoomAllFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicViewZoomAllFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
QWidget* topLevelWidget = RiaApplication::activeWindow();
|
||||
|
||||
if (dynamic_cast<RiuMainWindow*>(topLevelWidget))
|
||||
@@ -66,53 +68,11 @@ void RicViewZoomAllFeature::onActionTriggered(bool isChecked)
|
||||
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||
if (subwindows.size() > 0)
|
||||
{
|
||||
{
|
||||
RiuSummaryQwtPlot* summaryQwtPlot = dynamic_cast<RiuSummaryQwtPlot*>(subwindows.back()->widget());
|
||||
if (summaryQwtPlot)
|
||||
{
|
||||
RimViewWindow* viewWindow = summaryQwtPlot->ownerPlotDefinition();
|
||||
RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
|
||||
|
||||
if (viewWindow)
|
||||
{
|
||||
viewWindow->zoomAll();
|
||||
summaryQwtPlot->replot();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(subwindows.back()->widget());
|
||||
if (wellLogPlot)
|
||||
{
|
||||
RimViewWindow* viewWindow = wellLogPlot->ownerPlotDefinition();
|
||||
viewWindow->zoomAll();
|
||||
wellLogPlot->update();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RiuWellAllocationPlot* wellAllocationPlot = dynamic_cast<RiuWellAllocationPlot*>(subwindows.back()->widget());
|
||||
if (wellAllocationPlot)
|
||||
{
|
||||
RimWellAllocationPlot* viewWindow = wellAllocationPlot->ownerPlotDefinition();
|
||||
viewWindow->zoomAll();
|
||||
wellAllocationPlot->update();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RiuFlowCharacteristicsPlot* flowCharPlot = dynamic_cast<RiuFlowCharacteristicsPlot*>(subwindows.back()->widget());
|
||||
if (flowCharPlot)
|
||||
{
|
||||
RimFlowCharacteristicsPlot* viewWindow = flowCharPlot->ownerPlotDefinition();
|
||||
viewWindow->zoomAll();
|
||||
flowCharPlot->update();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ bool RicAsciiExportWellLogPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString projectFolder = app->currentProjectPath();
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ ${CEE_CURRENT_LIST_DIR}RifReaderInterface.h
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderMockModel.h
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderSettings.h
|
||||
${CEE_CURRENT_LIST_DIR}RifEclipseSummaryAddress.h
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderOpmParserInput.h
|
||||
${CEE_CURRENT_LIST_DIR}RifHdf5ReaderInterface.h
|
||||
|
||||
# HDF5 file reader is directly included in ResInsight main CmakeList.txt
|
||||
@@ -41,7 +40,6 @@ ${CEE_CURRENT_LIST_DIR}RifReaderInterface.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderMockModel.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderSettings.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifEclipseSummaryAddress.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderOpmParserInput.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifHdf5ReaderInterface.cpp
|
||||
|
||||
# HDF5 file reader is directly included in ResInsight main CmakeList.txt
|
||||
|
||||
@@ -649,7 +649,7 @@ void RifEclipseInputFileTools::parseAndReadFaults(const QString& fileName, cvf::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseInputFileTools::readFaultsInGridSection(const QString& fileName, cvf::Collection<RigFault>* faults, std::vector<QString>* filenamesWithFaults)
|
||||
void RifEclipseInputFileTools::readFaultsInGridSection(const QString& fileName, cvf::Collection<RigFault>* faults, std::vector<QString>* filenamesWithFaults, const QString& faultIncludeFileAbsolutePathPrefix)
|
||||
{
|
||||
QFile data(fileName);
|
||||
if (!data.open(QFile::ReadOnly))
|
||||
@@ -669,7 +669,7 @@ void RifEclipseInputFileTools::readFaultsInGridSection(const QString& fileName,
|
||||
std::vector< std::pair<QString, QString> > pathAliasDefinitions;
|
||||
parseAndReadPathAliasKeyword(fileName, &pathAliasDefinitions);
|
||||
|
||||
readFaultsAndParseIncludeStatementsRecursively(data, gridPos, pathAliasDefinitions, faults, filenamesWithFaults, &isEditKeywordDetected);
|
||||
readFaultsAndParseIncludeStatementsRecursively(data, gridPos, pathAliasDefinitions, faults, filenamesWithFaults, &isEditKeywordDetected, faultIncludeFileAbsolutePathPrefix);
|
||||
}
|
||||
|
||||
|
||||
@@ -758,7 +758,8 @@ bool RifEclipseInputFileTools::readFaultsAndParseIncludeStatementsRecursively(
|
||||
const std::vector< std::pair<QString, QString> >& pathAliasDefinitions,
|
||||
cvf::Collection<RigFault>* faults,
|
||||
std::vector<QString>* filenamesWithFaults,
|
||||
bool* isEditKeywordDetected)
|
||||
bool* isEditKeywordDetected,
|
||||
const QString& faultIncludeFileAbsolutePathPrefix)
|
||||
{
|
||||
QString line;
|
||||
|
||||
@@ -819,6 +820,14 @@ bool RifEclipseInputFileTools::readFaultsAndParseIncludeStatementsRecursively(
|
||||
includeFilename.replace(textToReplace, entry.second);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
if (includeFilename.startsWith('/'))
|
||||
{
|
||||
// Absolute UNIX path, prefix on Windows
|
||||
includeFilename = faultIncludeFileAbsolutePathPrefix + includeFilename;
|
||||
}
|
||||
#endif
|
||||
|
||||
QFileInfo fi(currentFileFolder, includeFilename);
|
||||
if (fi.exists())
|
||||
{
|
||||
@@ -828,7 +837,7 @@ bool RifEclipseInputFileTools::readFaultsAndParseIncludeStatementsRecursively(
|
||||
{
|
||||
//qDebug() << "Found include statement, and start parsing of\n " << absoluteFilename;
|
||||
|
||||
if (!readFaultsAndParseIncludeStatementsRecursively(includeFile, 0, pathAliasDefinitions, faults, filenamesWithFaults, isEditKeywordDetected))
|
||||
if (!readFaultsAndParseIncludeStatementsRecursively(includeFile, 0, pathAliasDefinitions, faults, filenamesWithFaults, isEditKeywordDetected, faultIncludeFileAbsolutePathPrefix))
|
||||
{
|
||||
qDebug() << "Error when parsing include file : " << absoluteFilename;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
static std::map<QString, QString> readProperties(const QString& fileName, RigEclipseCaseData* eclipseCase);
|
||||
static bool readProperty (const QString& fileName, RigEclipseCaseData* eclipseCase, const QString& eclipseKeyWord, const QString& resultName );
|
||||
|
||||
static void readFaultsInGridSection(const QString& fileName, cvf::Collection<RigFault>* faults, std::vector<QString>* filenamesWithFaults);
|
||||
static void readFaultsInGridSection(const QString& fileName, cvf::Collection<RigFault>* faults, std::vector<QString>* filenamesWithFaults, const QString& faultIncludeFileAbsolutePathPrefix);
|
||||
static void readFaults(const QString& fileName, const std::vector< RifKeywordAndFilePos >& fileKeywords, cvf::Collection<RigFault>* faults);
|
||||
static void parseAndReadFaults(const QString& fileName, cvf::Collection<RigFault>* faults);
|
||||
|
||||
@@ -83,7 +83,8 @@ public:
|
||||
const std::vector< std::pair<QString, QString> >& pathAliasDefinitions,
|
||||
cvf::Collection<RigFault>* faults,
|
||||
std::vector<QString>* filenamesWithFaults,
|
||||
bool* isEditKeywordDetected);
|
||||
bool* isEditKeywordDetected,
|
||||
const QString& faultIncludeFileAbsolutePathPrefix);
|
||||
|
||||
static cvf::StructGridInterface::FaceEnum faceEnumFromText(const QString& faceString);
|
||||
|
||||
|
||||
@@ -151,8 +151,6 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<Q
|
||||
{
|
||||
ecl_kw_type* kwINTEHEAD = ecl_file_iget_named_kw(ecl_file, INTEHEAD_KW, i);
|
||||
CVF_ASSERT(kwINTEHEAD);
|
||||
if (kwINTEHEAD)
|
||||
{
|
||||
int day = 0;
|
||||
int month = 0;
|
||||
int year = 0;
|
||||
@@ -162,9 +160,12 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<Q
|
||||
CVF_ASSERT(reportDateTime.isValid());
|
||||
|
||||
double dayFraction = dayFractions[i];
|
||||
int seconds = static_cast<int>(dayFraction * 24.0 * 60.0 * 60.0);
|
||||
int milliseconds = static_cast<int>(dayFraction * 24.0 * 60.0 * 60.0 * 1000.0);
|
||||
int seconds = milliseconds % 1000;
|
||||
milliseconds -= seconds * 1000;
|
||||
QTime time(0, 0);
|
||||
time = time.addSecs(seconds);
|
||||
time = time.addMSecs(milliseconds);
|
||||
|
||||
reportDateTime.setTime(time);
|
||||
|
||||
@@ -174,7 +175,6 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<Q
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "RifEclipseOutputFileTools.h"
|
||||
#include "RifEclipseRestartFilesetAccess.h"
|
||||
#include "RifEclipseUnifiedRestartFileAccess.h"
|
||||
#include "RifReaderOpmParserInput.h"
|
||||
#include "RifHdf5ReaderInterface.h"
|
||||
|
||||
#ifdef USE_HDF5
|
||||
@@ -398,7 +397,6 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e
|
||||
{
|
||||
cvf::Collection<RigFault> faults;
|
||||
|
||||
//importFaultsOpmParser(fileSet, &faults);
|
||||
importFaults(fileSet, &faults);
|
||||
|
||||
RigMainGrid* mainGrid = eclipseCase->mainGrid();
|
||||
@@ -527,20 +525,6 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName)
|
||||
m_hdfReaderInterface = std::move(myReader);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderEclipseOutput::importFaultsOpmParser(const QStringList& fileSet, cvf::Collection<RigFault>* faults) const
|
||||
{
|
||||
foreach(QString fname, fileSet)
|
||||
{
|
||||
if (fname.endsWith(".DATA"))
|
||||
{
|
||||
RifReaderOpmParserInput::readFaults(fname, faults);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -562,7 +546,7 @@ void RifReaderEclipseOutput::importFaults(const QStringList& fileSet, cvf::Colle
|
||||
if (fname.endsWith(".DATA"))
|
||||
{
|
||||
std::vector<QString> filenamesWithFaults;
|
||||
RifEclipseInputFileTools::readFaultsInGridSection(fname, faults, &filenamesWithFaults);
|
||||
RifEclipseInputFileTools::readFaultsInGridSection(fname, faults, &filenamesWithFaults, faultIncludeFileAbsolutePathPrefix());
|
||||
|
||||
std::sort(filenamesWithFaults.begin(), filenamesWithFaults.end());
|
||||
std::vector<QString>::iterator last = std::unique(filenamesWithFaults.begin(), filenamesWithFaults.end());
|
||||
@@ -835,7 +819,12 @@ void RifReaderEclipseOutput::buildMetaData()
|
||||
staticDate.push_back(m_timeSteps.front());
|
||||
}
|
||||
|
||||
std::vector<int> reportNumbers = m_dynamicResultsAccess->reportNumbers();
|
||||
std::vector<int> reportNumbers;
|
||||
if (m_dynamicResultsAccess.notNull())
|
||||
{
|
||||
reportNumbers = m_dynamicResultsAccess->reportNumbers();
|
||||
}
|
||||
|
||||
if ( reportNumbers.size() > 0 )
|
||||
{
|
||||
staticReportNumber.push_back(reportNumbers.front());
|
||||
|
||||
@@ -75,7 +75,6 @@ private:
|
||||
|
||||
static RigWellResultPoint createWellResultPoint(const RigGridBase* grid, const well_conn_type* ert_connection, int ertBranchId, int ertSegmentId, const char* wellName);
|
||||
|
||||
void importFaultsOpmParser(const QStringList& fileSet, cvf::Collection<RigFault>* faults) const;
|
||||
void importFaults(const QStringList& fileSet, cvf::Collection<RigFault>* faults);
|
||||
|
||||
|
||||
|
||||
@@ -67,3 +67,13 @@ bool RifReaderInterface::isNNCsEnabled()
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const QString RifReaderInterface::faultIncludeFileAbsolutePathPrefix()
|
||||
{
|
||||
if (m_settings.notNull())
|
||||
{
|
||||
return m_settings->faultIncludeFileAbsolutePathPrefix;
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
bool isFaultImportEnabled();
|
||||
bool isImportOfCompleteMswDataEnabled();
|
||||
bool isNNCsEnabled();
|
||||
const QString faultIncludeFileAbsolutePathPrefix();
|
||||
|
||||
virtual bool open(const QString& fileName, RigEclipseCaseData* eclipseCase) = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
@@ -1,618 +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 "RifReaderOpmParserInput.h"
|
||||
|
||||
#include "RifReaderEclipseOutput.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RimEclipseInputCaseOpm.h"
|
||||
#include "RimEclipseInputProperty.h"
|
||||
#include "RimEclipseInputPropertyCollection.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "RiuProcessMonitor.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cvfBase.h"
|
||||
|
||||
#include "opm/parser/eclipse/Deck/DeckItem.hpp"
|
||||
#include "opm/parser/eclipse/Deck/Section.hpp"
|
||||
#include "opm/parser/eclipse/Parser/MessageContainer.hpp"
|
||||
#include "opm/parser/eclipse/Parser/ParseContext.hpp"
|
||||
#include "opm/parser/eclipse/Parser/Parser.hpp"
|
||||
|
||||
#include "../generated-source/include/opm/parser/eclipse/Parser/ParserKeywords/F.hpp"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderOpmParserInput::importGridPropertiesFaults(const QString& fileName, RigEclipseCaseData* caseData)
|
||||
{
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog(QString("\nStarted reading of grid and properties from file : " + fileName + "\n"));
|
||||
|
||||
{
|
||||
std::shared_ptr<const Opm::EclipseGrid> eclipseGrid;
|
||||
std::string errorMessage;
|
||||
|
||||
std::shared_ptr<Opm::Deck> deck;
|
||||
|
||||
try
|
||||
{
|
||||
Opm::Parser parser;
|
||||
|
||||
// A default ParseContext will set up all parsing errors to throw exceptions
|
||||
Opm::ParseContext parseContext;
|
||||
RifReaderOpmParserInput::initUsingWarnings(&parseContext);
|
||||
|
||||
deck = parser.parseFile(fileName.toStdString(), parseContext);
|
||||
|
||||
if (deck)
|
||||
{
|
||||
eclipseGrid = Opm::Parser::parseGrid(*deck, parseContext);
|
||||
|
||||
if (eclipseGrid && eclipseGrid->c_ptr())
|
||||
{
|
||||
RifReaderEclipseOutput::transferGeometry(eclipseGrid->c_ptr(), caseData);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::invalid_argument("No valid 3D grid detected");
|
||||
}
|
||||
|
||||
Opm::TableManager tableManager(*deck);
|
||||
|
||||
Opm::Eclipse3DProperties properties(*deck, tableManager, *eclipseGrid);
|
||||
|
||||
std::vector<std::string> predefKeywords = RifReaderOpmParserInput::knownPropertyKeywords();
|
||||
for (auto keyword : predefKeywords)
|
||||
{
|
||||
if (properties.supportsGridProperty(keyword))
|
||||
{
|
||||
if (properties.hasDeckDoubleGridProperty(keyword))
|
||||
{
|
||||
auto allValues = properties.getDoubleGridProperty(keyword).getData();
|
||||
|
||||
QString newResultName = caseData->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(QString::fromStdString(keyword));
|
||||
size_t resultIndex = RifReaderOpmParserPropertyReader::findOrCreateResult(newResultName, caseData);
|
||||
|
||||
if (resultIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
std::vector< std::vector<double> >& newPropertyData = caseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||
newPropertyData.push_back(allValues);
|
||||
}
|
||||
}
|
||||
else if (properties.hasDeckIntGridProperty(keyword))
|
||||
{
|
||||
auto intValues = properties.getIntGridProperty(keyword).getData();
|
||||
|
||||
QString newResultName = caseData->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(QString::fromStdString(keyword));
|
||||
size_t resultIndex = RifReaderOpmParserPropertyReader::findOrCreateResult(newResultName, caseData);
|
||||
|
||||
if (resultIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
std::vector< std::vector<double> >& newPropertyData = caseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||
|
||||
std::vector<double> doubleValues;
|
||||
|
||||
doubleValues.insert(std::end(doubleValues), std::begin(intValues), std::end(intValues));
|
||||
|
||||
newPropertyData.push_back(doubleValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caseData->results(RifReaderInterface::MATRIX_RESULTS)->resultCount() == 0)
|
||||
{
|
||||
// Eclipse3DProperties was not able to extract results. This is often the case when reading a GRDECL file directly
|
||||
// Parse for known keywords by analyzing the present keywords in the deck
|
||||
|
||||
RifReaderOpmParserPropertyReader propertyReader(deck);
|
||||
|
||||
std::set<std::string> keywordsOnFile = propertyReader.keywords();
|
||||
std::vector<std::string> predefKeywords = RifReaderOpmParserInput::knownPropertyKeywords();
|
||||
for (auto keyword : predefKeywords)
|
||||
{
|
||||
if (std::find(keywordsOnFile.begin(), keywordsOnFile.end(), keyword) != keywordsOnFile.end())
|
||||
{
|
||||
QString newResultName = caseData->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(QString::fromStdString(keyword));
|
||||
propertyReader.copyPropertyToCaseData(keyword, caseData, newResultName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caseData->mainGrid())
|
||||
{
|
||||
cvf::Collection<RigFault> faults;
|
||||
importFaults(*deck, &faults);
|
||||
if (faults.size() > 0)
|
||||
{
|
||||
caseData->mainGrid()->setFaults(faults);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
errorMessage = e.what();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
errorMessage = "Unknown exception throwm from Opm::Parser";
|
||||
}
|
||||
|
||||
if (deck)
|
||||
{
|
||||
const Opm::MessageContainer& messages = deck->getMessageContainer();
|
||||
if (messages.size() > 0)
|
||||
{
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog("\n\nLog messages from Deck : \n");
|
||||
}
|
||||
for (auto m : messages)
|
||||
{
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog(" Deck : " + QString::fromStdString(m.message) + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (eclipseGrid)
|
||||
{
|
||||
const Opm::MessageContainer& messages = eclipseGrid->getMessageContainer();
|
||||
if (messages.size() > 0)
|
||||
{
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog("\n\nLog messages from EclipseGrid : \n");
|
||||
}
|
||||
for (auto m : messages)
|
||||
{
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog(" EclipseGrid :" + QString::fromStdString(m.message) + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessage.size() > 0)
|
||||
{
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog("\n\nError messages : \n");
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog(" " + QString::fromStdString(errorMessage) + "\n");
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog(QString("Failed reading of grid and properties from file : " + fileName + "\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog(QString("Completed reading of grid and properties from file : " + fileName + "\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderOpmParserInput::readFaults(const QString& fileName, cvf::Collection<RigFault>* faults)
|
||||
{
|
||||
{
|
||||
std::string errorMessage;
|
||||
|
||||
try
|
||||
{
|
||||
Opm::Parser parser;
|
||||
|
||||
// A default ParseContext will set up all parsing errors to throw exceptions
|
||||
Opm::ParseContext parseContext;
|
||||
RifReaderOpmParserInput::initUsingWarnings(&parseContext);
|
||||
|
||||
auto deckptr = parser.parseFile(fileName.toStdString(), parseContext);
|
||||
const Opm::Deck& deck = *deckptr;
|
||||
|
||||
importFaults(deck, faults);
|
||||
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
errorMessage = e.what();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
errorMessage = "Unknown exception throwm from Opm::Parser";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderOpmParserInput::importFaults(const Opm::Deck& deck, cvf::Collection<RigFault>* faults)
|
||||
{
|
||||
{
|
||||
std::string errorMessage;
|
||||
|
||||
try
|
||||
{
|
||||
RigFault* fault = NULL;
|
||||
|
||||
// The following is based on Opm::FaultCollection
|
||||
// Not possible to use this class, as the logic in ResInsight handles IJK-values instead
|
||||
// of cell indices
|
||||
const auto& faultKeywords = deck.getKeywordList<Opm::ParserKeywords::FAULTS>();
|
||||
for (auto keyword_iter = faultKeywords.begin(); keyword_iter != faultKeywords.end(); ++keyword_iter) {
|
||||
const auto& faultsKeyword = *keyword_iter;
|
||||
for (auto iter = faultsKeyword->begin(); iter != faultsKeyword->end(); ++iter) {
|
||||
const auto& faultRecord = *iter;
|
||||
const std::string& faultName = faultRecord.getItem(0).get< std::string >(0);
|
||||
int I1 = faultRecord.getItem(1).get< int >(0) - 1;
|
||||
int I2 = faultRecord.getItem(2).get< int >(0) - 1;
|
||||
int J1 = faultRecord.getItem(3).get< int >(0) - 1;
|
||||
int J2 = faultRecord.getItem(4).get< int >(0) - 1;
|
||||
int K1 = faultRecord.getItem(5).get< int >(0) - 1;
|
||||
int K2 = faultRecord.getItem(6).get< int >(0) - 1;
|
||||
|
||||
const std::string& faceText = faultRecord.getItem(7).get< std::string >(0);
|
||||
|
||||
cvf::StructGridInterface::FaceEnum cellFaceEnum = RifReaderOpmParserInput::faceEnumFromText(QString::fromStdString(faceText));
|
||||
|
||||
QString name = QString::fromStdString(faultName);
|
||||
|
||||
// Guard against invalid cell ranges by limiting lowest possible range value to zero
|
||||
cvf::CellRange cellrange(CVF_MAX(I1, 0), CVF_MAX(J1, 0), CVF_MAX(K1, 0), CVF_MAX(I2, 0), CVF_MAX(J2, 0), CVF_MAX(K2, 0));
|
||||
|
||||
if (!(fault && fault->name() == name))
|
||||
{
|
||||
if (findFaultByName(*faults, name) == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
RigFault* newFault = new RigFault;
|
||||
newFault->setName(name);
|
||||
|
||||
faults->push_back(newFault);
|
||||
}
|
||||
|
||||
size_t faultIndex = findFaultByName(*faults, name);
|
||||
if (faultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
CVF_ASSERT(faultIndex != cvf::UNDEFINED_SIZE_T);
|
||||
continue;
|
||||
}
|
||||
|
||||
fault = faults->at(faultIndex);
|
||||
}
|
||||
|
||||
CVF_ASSERT(fault);
|
||||
|
||||
fault->addCellRangeForFace(cellFaceEnum, cellrange);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
errorMessage = e.what();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
errorMessage = "Unknown exception throwm from Opm::Parser";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::string> RifReaderOpmParserInput::knownPropertyKeywords()
|
||||
{
|
||||
std::vector<std::string> knownKeywords;
|
||||
knownKeywords.push_back("AQUIFERA");
|
||||
knownKeywords.push_back("ACTNUM");
|
||||
knownKeywords.push_back("EQLNUM");
|
||||
knownKeywords.push_back("FIPNUM");
|
||||
knownKeywords.push_back("KRG");
|
||||
knownKeywords.push_back("KRGR");
|
||||
knownKeywords.push_back("KRO");
|
||||
knownKeywords.push_back("KRORG");
|
||||
knownKeywords.push_back("KRORW");
|
||||
knownKeywords.push_back("KRW");
|
||||
knownKeywords.push_back("KRWR");
|
||||
knownKeywords.push_back("MINPVV");
|
||||
knownKeywords.push_back("MULTPV");
|
||||
knownKeywords.push_back("MULTX");
|
||||
knownKeywords.push_back("MULTX-");
|
||||
knownKeywords.push_back("MULTY");
|
||||
knownKeywords.push_back("MULTY-");
|
||||
knownKeywords.push_back("MULTZ");
|
||||
knownKeywords.push_back("NTG");
|
||||
knownKeywords.push_back("PCG");
|
||||
knownKeywords.push_back("PCW");
|
||||
knownKeywords.push_back("PERMX");
|
||||
knownKeywords.push_back("PERMY");
|
||||
knownKeywords.push_back("PERMZ");
|
||||
knownKeywords.push_back("PORO");
|
||||
knownKeywords.push_back("PVTNUM");
|
||||
knownKeywords.push_back("SATNUM");
|
||||
knownKeywords.push_back("SGCR");
|
||||
knownKeywords.push_back("SGL");
|
||||
knownKeywords.push_back("SGLPC");
|
||||
knownKeywords.push_back("SGU");
|
||||
knownKeywords.push_back("SGWCR");
|
||||
knownKeywords.push_back("SWATINIT");
|
||||
knownKeywords.push_back("SWCR");
|
||||
knownKeywords.push_back("SWGCR");
|
||||
knownKeywords.push_back("SWL");
|
||||
knownKeywords.push_back("SWLPC");
|
||||
knownKeywords.push_back("TRANX");
|
||||
knownKeywords.push_back("TRANY");
|
||||
knownKeywords.push_back("TRANZ");
|
||||
|
||||
return knownKeywords;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::string> RifReaderOpmParserInput::allParserConfigKeys()
|
||||
{
|
||||
std::vector<std::string> configKeys;
|
||||
configKeys.push_back(Opm::ParseContext::PARSE_UNKNOWN_KEYWORD);
|
||||
configKeys.push_back(Opm::ParseContext::PARSE_RANDOM_TEXT);
|
||||
configKeys.push_back(Opm::ParseContext::PARSE_RANDOM_SLASH);
|
||||
configKeys.push_back(Opm::ParseContext::PARSE_MISSING_DIMS_KEYWORD);
|
||||
configKeys.push_back(Opm::ParseContext::PARSE_EXTRA_DATA);
|
||||
configKeys.push_back(Opm::ParseContext::PARSE_MISSING_INCLUDE);
|
||||
configKeys.push_back(Opm::ParseContext::UNSUPPORTED_SCHEDULE_GEO_MODIFIER);
|
||||
configKeys.push_back(Opm::ParseContext::UNSUPPORTED_COMPORD_TYPE);
|
||||
configKeys.push_back(Opm::ParseContext::UNSUPPORTED_INITIAL_THPRES);
|
||||
configKeys.push_back(Opm::ParseContext::INTERNAL_ERROR_UNINITIALIZED_THPRES);
|
||||
configKeys.push_back(Opm::ParseContext::PARSE_MISSING_SECTIONS);
|
||||
|
||||
return configKeys;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RifReaderOpmParserInput::findFaultByName(const cvf::Collection<RigFault>& faults, const QString& name)
|
||||
{
|
||||
for (size_t i = 0; i < faults.size(); i++)
|
||||
{
|
||||
if (faults.at(i)->name() == name)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::StructGridInterface::FaceEnum RifReaderOpmParserInput::faceEnumFromText(const QString& faceString)
|
||||
{
|
||||
QString upperCaseText = faceString.toUpper().trimmed();
|
||||
|
||||
if (upperCaseText == "X" || upperCaseText == "X+" || upperCaseText == "I" || upperCaseText == "I+") return cvf::StructGridInterface::POS_I;
|
||||
if (upperCaseText == "Y" || upperCaseText == "Y+" || upperCaseText == "J" || upperCaseText == "J+") return cvf::StructGridInterface::POS_J;
|
||||
if (upperCaseText == "Z" || upperCaseText == "Z+" || upperCaseText == "K" || upperCaseText == "K+") return cvf::StructGridInterface::POS_K;
|
||||
|
||||
if (upperCaseText == "X-" || upperCaseText == "I-") return cvf::StructGridInterface::NEG_I;
|
||||
if (upperCaseText == "Y-" || upperCaseText == "J-") return cvf::StructGridInterface::NEG_J;
|
||||
if (upperCaseText == "Z-" || upperCaseText == "K-") return cvf::StructGridInterface::NEG_K;
|
||||
|
||||
return cvf::StructGridInterface::NO_FACE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderOpmParserInput::initUsingWarnings(Opm::ParseContext* parseContext)
|
||||
{
|
||||
if (!parseContext) return;
|
||||
|
||||
for (auto state : allParserConfigKeys())
|
||||
{
|
||||
parseContext->addKey(state);
|
||||
}
|
||||
|
||||
// Treat all parsing errors as warnings
|
||||
parseContext->update(Opm::InputError::WARN);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RifReaderOpmParserPropertyReader::findOrCreateResult(const QString& newResultName, RigEclipseCaseData* reservoir)
|
||||
{
|
||||
size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName);
|
||||
if (resultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName, false);
|
||||
}
|
||||
|
||||
return resultIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderOpmParserPropertyReader::RifReaderOpmParserPropertyReader(std::shared_ptr< Opm::Deck > deck)
|
||||
: m_deck(deck)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderOpmParserPropertyReader::RifReaderOpmParserPropertyReader(const QString& fileName)
|
||||
{
|
||||
open(fileName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderOpmParserPropertyReader::open(const QString& fileName)
|
||||
{
|
||||
{
|
||||
std::string errorMessage;
|
||||
|
||||
try
|
||||
{
|
||||
Opm::Parser parser;
|
||||
|
||||
// A default ParseContext will set up all parsing errors to throw exceptions
|
||||
Opm::ParseContext parseContext;
|
||||
|
||||
// Treat all parsing errors as warnings
|
||||
parseContext.update(Opm::InputError::WARN);
|
||||
|
||||
m_deck = parser.parseFile(fileName.toStdString(), parseContext);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
errorMessage = e.what();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
errorMessage = "Unknown exception throwm from Opm::Parser";
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RifReaderOpmParserPropertyReader::keywords() const
|
||||
{
|
||||
std::set<std::string> ids;
|
||||
|
||||
if (m_deck)
|
||||
{
|
||||
for (auto it = m_deck->begin(); it != m_deck->end(); it++)
|
||||
{
|
||||
ids.insert(it->name());
|
||||
}
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderOpmParserPropertyReader::copyPropertyToCaseData(const std::string& keywordName, RigEclipseCaseData* caseData, const QString& resultName)
|
||||
{
|
||||
{
|
||||
std::string errorMessage;
|
||||
|
||||
try
|
||||
{
|
||||
if (m_deck->hasKeyword(keywordName))
|
||||
{
|
||||
bool isItemCountEqual = isDataItemCountIdenticalToMainGridCellCount(m_deck, keywordName, caseData);
|
||||
if (isItemCountEqual)
|
||||
{
|
||||
std::vector<double> allValues;
|
||||
|
||||
getAllValuesForKeyword(m_deck, keywordName, allValues);
|
||||
|
||||
size_t resultIndex = RifReaderOpmParserPropertyReader::findOrCreateResult(resultName, caseData);
|
||||
if (resultIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
std::vector< std::vector<double> >& newPropertyData = caseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||
newPropertyData.push_back(allValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
errorMessage = e.what();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
errorMessage = "Unknown exception throwm from Opm::Parser";
|
||||
}
|
||||
|
||||
QString fileName = QString::fromStdString(m_deck->getDataFile());
|
||||
|
||||
if (errorMessage.size() > 0)
|
||||
{
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog(" " + QString::fromStdString(errorMessage) + "\n");
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog(QString("Error detected while reading property %1 from file : %2\n").arg(QString::fromStdString(keywordName)).arg(fileName));
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuMainWindow::instance()->processMonitor()->addStringToLog(QString("Completed reading of property %1 from file : %2\n").arg(QString::fromStdString(keywordName)).arg(fileName));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderOpmParserPropertyReader::getAllValuesForKeyword(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, std::vector<double>& allValues)
|
||||
{
|
||||
for (auto deckKeyword : deck->getKeywordList(keyword))
|
||||
{
|
||||
if (deckKeyword->isDataKeyword() && deckKeyword->size() == 1)
|
||||
{
|
||||
auto deckRecord = deckKeyword->getDataRecord();
|
||||
if (deckRecord.size() == 1)
|
||||
{
|
||||
if (deckRecord.getDataItem().typeof() == Opm::DeckItem::integer)
|
||||
{
|
||||
auto opmData = deckKeyword->getIntData();
|
||||
allValues.insert(std::end(allValues), std::begin(opmData), std::end(opmData));
|
||||
}
|
||||
else if (deckRecord.getDataItem().typeof() == Opm::DeckItem::fdouble)
|
||||
{
|
||||
auto opmData = deckKeyword->getRawDoubleData();
|
||||
allValues.insert(std::end(allValues), std::begin(opmData), std::end(opmData));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderOpmParserPropertyReader::isDataItemCountIdenticalToMainGridCellCount(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, RigEclipseCaseData* caseData)
|
||||
{
|
||||
bool isEqual = false;
|
||||
{
|
||||
size_t valueCount = 0;
|
||||
for (auto deckKeyword : deck->getKeywordList(keyword))
|
||||
{
|
||||
if (deckKeyword->isDataKeyword())
|
||||
{
|
||||
valueCount += deckKeyword->getDataSize();
|
||||
}
|
||||
}
|
||||
|
||||
if (valueCount == caseData->mainGrid()->cellCount())
|
||||
{
|
||||
isEqual = true;
|
||||
}
|
||||
}
|
||||
|
||||
return isEqual;
|
||||
}
|
||||
|
||||
@@ -1,89 +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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigFault.h"
|
||||
|
||||
#include "cvfCollection.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RigEclipseCaseData;
|
||||
|
||||
namespace Opm {
|
||||
class Deck;
|
||||
class ParseContext;
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RifReaderOpmParserInput
|
||||
{
|
||||
public:
|
||||
static void importGridPropertiesFaults(const QString& fileName, RigEclipseCaseData* eclipseCase);
|
||||
|
||||
static void readFaults(const QString& fileName, cvf::Collection<RigFault>* faults);
|
||||
|
||||
static std::vector<std::string> knownPropertyKeywords();
|
||||
|
||||
private:
|
||||
static void importFaults(const Opm::Deck& deck, cvf::Collection<RigFault>* faults);
|
||||
static std::vector<std::string> allParserConfigKeys();
|
||||
static size_t findFaultByName(const cvf::Collection<RigFault>& faults, const QString& name);
|
||||
static cvf::StructGridInterface::FaceEnum faceEnumFromText(const QString& faceString);
|
||||
static void initUsingWarnings(Opm::ParseContext* parseContext);
|
||||
};
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RifReaderOpmParserPropertyReader
|
||||
{
|
||||
public:
|
||||
explicit RifReaderOpmParserPropertyReader(std::shared_ptr< Opm::Deck > deck);
|
||||
explicit RifReaderOpmParserPropertyReader(const QString& fileName);
|
||||
|
||||
std::set<std::string> keywords() const;
|
||||
|
||||
bool copyPropertyToCaseData(const std::string& keywordName, RigEclipseCaseData* eclipseCase, const QString& resultName);
|
||||
|
||||
static size_t findOrCreateResult(const QString& newResultName, RigEclipseCaseData* reservoir);
|
||||
|
||||
private:
|
||||
static void getAllValuesForKeyword(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, std::vector<double>& allValues);
|
||||
static bool isDataItemCountIdenticalToMainGridCellCount(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, RigEclipseCaseData* caseData);
|
||||
bool open(const QString& fileName);
|
||||
|
||||
private:
|
||||
std::shared_ptr< Opm::Deck > m_deck;
|
||||
};
|
||||
@@ -39,6 +39,8 @@ RifReaderSettings::RifReaderSettings()
|
||||
|
||||
CAF_PDM_InitField(&importAdvancedMswData, "importAdvancedMswData", false, "Import advanced MSW data", "", "", "");
|
||||
importAdvancedMswData.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitField(&faultIncludeFileAbsolutePathPrefix, "faultIncludeFileAbsolutePathPrefix", QString(), "Fault Include File Absolute Path Prefix", "", "Path used to prefix absolute UNIX paths in fault include statements on Windows", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -58,3 +60,13 @@ void RifReaderSettings::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
}
|
||||
}
|
||||
|
||||
void RifReaderSettings::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&importFaults);
|
||||
uiOrdering.add(&importNNCs);
|
||||
uiOrdering.add(&importAdvancedMswData);
|
||||
#ifdef WIN32
|
||||
uiOrdering.add(&faultIncludeFileAbsolutePathPrefix);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -39,9 +39,12 @@ public:
|
||||
caf::PdmField<bool> importFaults;
|
||||
caf::PdmField<bool> importNNCs;
|
||||
caf::PdmField<bool> importAdvancedMswData;
|
||||
caf::PdmField<QString> faultIncludeFileAbsolutePathPrefix;
|
||||
|
||||
protected:
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ add_library( ${PROJECT_NAME}
|
||||
RigFemPartGrid.cpp
|
||||
RigFemResultAddress.h
|
||||
RigFemResultPosEnum.h
|
||||
RimGeoMechTopologyItem.h
|
||||
RimGeoMechTopologyItem.cpp
|
||||
RimGeoMechGeometrySelectionItem.h
|
||||
RimGeoMechGeometrySelectionItem.cpp
|
||||
)
|
||||
|
||||
target_link_libraries( ${PROJECT_NAME} LibCore cafTensor ResultStatisticsCache)
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimGeoMechGeometrySelectionItem.h"
|
||||
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
|
||||
|
||||
#include "RiuSelectionManager.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimGeoMechGeometrySelectionItem, "GeoMechGeometrySelectionItem");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechGeometrySelectionItem::RimGeoMechGeometrySelectionItem()
|
||||
{
|
||||
CAF_PDM_InitObject("GeoMech Topology Item", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_geoMechCase, "GeoMechCase", "Geo Mech Case", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_gridIndex, "m_gridIndex", "GridIndex", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_cellIndex, "m_cellIndex", "CellIndex", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_elementFace, "m_elementFace", "ElementFace", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_hasIntersectionTriangle, "m_hasIntersectionTriangle", "HasIntersectionTriangle", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_0, "m_intersectionTriangle_0", "IntersectionTriangle_0", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_1, "m_intersectionTriangle_1", "IntersectionTriangle_1", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_2, "m_intersectionTriangle_2", "IntersectionTriangle_2", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_localIntersectionPoint, "m_localIntersectionPoint", "LocalIntersectionPoint", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechGeometrySelectionItem::~RimGeoMechGeometrySelectionItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechGeometrySelectionItem::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 RimGeoMechGeometrySelectionItem::geometrySelectionText() 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::geometrySelectionText(m_geoMechCase->eclipseCaseData(), m_gridIndex, m_cellIndex);
|
||||
*/
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimGeoMechGeometrySelectionItem::geoMechCase() const
|
||||
{
|
||||
return m_geoMechCase;
|
||||
}
|
||||
|
||||
@@ -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 "RimGeometrySelectionItem.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RiuGeoMechSelectionItem;
|
||||
class RimGeoMechCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGeoMechGeometrySelectionItem : public RimGeometrySelectionItem
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimGeoMechGeometrySelectionItem();
|
||||
virtual ~RimGeoMechGeometrySelectionItem() override;
|
||||
|
||||
void setFromSelectionItem(const RiuGeoMechSelectionItem* selectionItem);
|
||||
|
||||
virtual QString geometrySelectionText() 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;
|
||||
};
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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;
|
||||
};
|
||||
|
||||
@@ -81,7 +81,6 @@ ${CEE_CURRENT_LIST_DIR}RimIntersectionCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.h
|
||||
${CEE_CURRENT_LIST_DIR}RimGridCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimPlotCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.h
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMdiWindowController.h
|
||||
@@ -89,8 +88,8 @@ ${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
|
||||
${CEE_CURRENT_LIST_DIR}RimGeometrySelectionItem.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseGeometrySelectionItem.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -170,7 +169,6 @@ ${CEE_CURRENT_LIST_DIR}RimIntersectionCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimGridCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimPlotCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMdiWindowController.cpp
|
||||
@@ -178,8 +176,8 @@ ${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
|
||||
${CEE_CURRENT_LIST_DIR}RimGeometrySelectionItem.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseGeometrySelectionItem.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -52,6 +52,8 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_case, "FlowCase", "Case", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution", "", "", "");
|
||||
m_flowDiagSolution.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", "");
|
||||
|
||||
@@ -104,6 +106,22 @@ void RimFlowCharacteristicsPlot::deleteViewWidget()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::updateCurrentTimeStep()
|
||||
{
|
||||
if (m_timeStepSelectionType() != ALL_AVAILABLE) return;
|
||||
if (!m_flowDiagSolution()) return;
|
||||
|
||||
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps();
|
||||
|
||||
if (m_currentlyPlottedTimeSteps == calculatedTimesteps) return;
|
||||
|
||||
this->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -121,20 +139,23 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
|
||||
proj->descendantsIncludingThisOfType(cases);
|
||||
|
||||
for ( RimEclipseResultCase* c : cases )
|
||||
{
|
||||
if ( c->defaultFlowDiagSolution() )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_flowDiagSolution )
|
||||
{
|
||||
if ( m_case )
|
||||
{
|
||||
std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo("None", nullptr));
|
||||
for ( RimFlowDiagSolution* flowSol : flowSols )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("None", nullptr));
|
||||
options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon()));
|
||||
}
|
||||
}
|
||||
@@ -200,6 +221,7 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
if ( &m_case == changedField )
|
||||
{
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
m_currentlyPlottedTimeSteps.clear();
|
||||
}
|
||||
|
||||
// All fields update plot
|
||||
@@ -252,6 +274,8 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
m_currentlyPlottedTimeSteps = calculatedTimesteps;
|
||||
|
||||
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
|
||||
std::vector<double> lorenzVals(timeStepDates.size(), HUGE_VAL);
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
virtual ~RimFlowCharacteristicsPlot();
|
||||
|
||||
void setFromFlowSolution(RimFlowDiagSolution* flowSolution);
|
||||
void updateCurrentTimeStep();
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
@@ -86,5 +87,7 @@ private:
|
||||
caf::PdmField<caf::AppEnum<TimeSelectionType> > m_timeStepSelectionType;
|
||||
caf::PdmField<std::vector<int> > m_selectedTimeSteps;
|
||||
|
||||
std::vector<int> m_currentlyPlottedTimeSteps;
|
||||
|
||||
QPointer<RiuFlowCharacteristicsPlot> m_flowCharPlotWidget;
|
||||
};
|
||||
|
||||
@@ -317,44 +317,20 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RimFlowDiagSolution::tracerColor(const QString& tracerName) const
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfType(eclCase);
|
||||
|
||||
QString wellName = removeCrossFlowEnding(tracerName);
|
||||
|
||||
if ( eclCase )
|
||||
{
|
||||
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||
|
||||
if (activeView)
|
||||
{
|
||||
RimEclipseWell* well = activeView->wellCollection->findWell(wellName);
|
||||
if (well)
|
||||
{
|
||||
return well->wellPipeColor();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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->eclipseCaseData()->wellResults();
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
|
||||
{
|
||||
if ( wellResults[wIdx]->m_wellName == wellName )
|
||||
{
|
||||
return RiaColorTables::wellsPaletteColors().cycledColor3f(wIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wellName == RIG_FLOW_TOTAL_NAME) return cvf::Color3f::LIGHT_GRAY;
|
||||
if (wellName == RIG_RESERVOIR_TRACER_NAME) return cvf::Color3f::LIGHT_GRAY;
|
||||
if (wellName == RIG_TINY_TRACER_GROUP_NAME) return cvf::Color3f::DARK_GRAY;
|
||||
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfType(eclCase);
|
||||
|
||||
if ( eclCase )
|
||||
{
|
||||
return eclCase->defaultWellColor(wellName);
|
||||
}
|
||||
|
||||
return cvf::Color3f::LIGHT_GRAY;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ RimFlowPlotCollection::RimFlowPlotCollection()
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowCharacteristicsPlot, "FlowCharacteristicsPlot", "", "", "", "");
|
||||
m_flowCharacteristicsPlot.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_defaultWellAllocPlot, "DefaultFlowPlot", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_defaultWellAllocPlot, "DefaultWellAllocationPlot", "", "", "", "");
|
||||
m_defaultWellAllocPlot.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_storedWellAllocPlots, "FlowPlots", "Stored Plots", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_storedWellAllocPlots, "StoredWellAllocationPlots", "Stored Plots", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -63,6 +63,9 @@ void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||
m_defaultWellAllocPlot->removeFromMdiAreaAndDeleteViewWidget();
|
||||
delete m_defaultWellAllocPlot();
|
||||
}
|
||||
|
||||
delete m_flowCharacteristicsPlot;
|
||||
|
||||
m_storedWellAllocPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ CAF_PDM_SOURCE_INIT(RimTotalWellAllocationPlot, "TotalWellAllocationPlot");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTotalWellAllocationPlot::RimTotalWellAllocationPlot()
|
||||
{
|
||||
CAF_PDM_InitObject("Total Well Allocation Plot", ":/WellAllocPie16x16.png", "", "");
|
||||
CAF_PDM_InitObject("Total Allocation", ":/WellAllocPie16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Total Well Allocation Plot"), "Name", "", "", "");
|
||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Total Allocation"), "Name", "", "", "");
|
||||
m_userName.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
|
||||
@@ -138,6 +138,24 @@ QString RimTotalWellAllocationPlot::description() const
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimTotalWellAllocationPlot::totalAllocationAsText() const
|
||||
{
|
||||
QString txt;
|
||||
|
||||
for (auto a : m_sliceInfo)
|
||||
{
|
||||
txt += a.first;
|
||||
txt += "\t";
|
||||
txt += QString::number(a.second);
|
||||
txt += "\n";
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -150,6 +168,8 @@ void RimTotalWellAllocationPlot::addSlice(const QString& name, const cvf::Color3
|
||||
m_wellTotalAllocationPlotWidget->addItem(name, sliceColor, value);
|
||||
m_wellTotalAllocationPlotWidget->update();
|
||||
}
|
||||
|
||||
m_sliceInfo.push_back(std::make_pair(name, value));
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +183,8 @@ void RimTotalWellAllocationPlot::clearSlices()
|
||||
m_wellTotalAllocationPlotWidget->clear();
|
||||
m_wellTotalAllocationPlotWidget->update();
|
||||
}
|
||||
|
||||
m_sliceInfo.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RiuWellAllocationPlot;
|
||||
class RimEclipseWell;
|
||||
class RimWellLogPlot;
|
||||
@@ -55,6 +57,7 @@ public:
|
||||
|
||||
void setDescription(const QString& description);
|
||||
QString description() const;
|
||||
QString totalAllocationAsText() const;
|
||||
|
||||
void addSlice(const QString& name, const cvf::Color3f& color, float value);
|
||||
void clearSlices();
|
||||
@@ -80,4 +83,6 @@ private:
|
||||
caf::PdmField<QString> m_userName;
|
||||
|
||||
QPointer<RiuNightchartsWidget> m_wellTotalAllocationPlotWidget;
|
||||
|
||||
std::vector<std::pair<QString, float> > m_sliceInfo;
|
||||
};
|
||||
|
||||
@@ -82,12 +82,10 @@ RimWellAllocationPlot::RimWellAllocationPlot()
|
||||
|
||||
CAF_PDM_InitField(&m_timeStep, "PlotTimeStep", 0, "Time Step", "", "", "");
|
||||
CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowDiagSolution, "FlowDiagSolution", "Plot Type", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowType, "FlowType", "Flow Type", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "");
|
||||
CAF_PDM_InitField(&m_smallContributionsThreshold, "SmallContributionsThreshold", 0.005, "Threshold", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_accumulatedWellFlowPlot, "AccumulatedWellFlowPlot", "Accumulated Well Flow", "", "", "");
|
||||
m_accumulatedWellFlowPlot.uiCapability()->setUiHidden(true);
|
||||
m_accumulatedWellFlowPlot = new RimWellLogPlot;
|
||||
@@ -175,7 +173,11 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
|
||||
CVF_ASSERT(accumulatedWellFlowPlot()->trackCount() == 0);
|
||||
|
||||
accumulatedWellFlowPlot()->setDescription("Accumulated Well Flow (" + m_wellName + ")");
|
||||
QString description;
|
||||
if (m_flowType() == ACCUMULATED) description = "Accumulated Flow";
|
||||
if (m_flowType() == INFLOW) description = "Inflow Rates";
|
||||
|
||||
accumulatedWellFlowPlot()->setDescription(description + " (" + m_wellName + ")");
|
||||
|
||||
if (!m_case) return;
|
||||
|
||||
@@ -296,7 +298,7 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
|
||||
QString wellStatusText = QString("(%1)").arg(RimWellAllocationPlot::wellStatusTextForTimeStep(m_wellName, m_case, m_timeStep));
|
||||
|
||||
QString flowTypeText = m_flowType().uiText();
|
||||
QString flowTypeText = m_flowDiagSolution() ? "Well Allocation": "Well Flow";
|
||||
setDescription(flowTypeText + ": " + m_wellName + " " + wellStatusText + ", " + m_case->timeStepStrings()[m_timeStep] + " (" + m_case->caseUserDescription() + ")");
|
||||
|
||||
/// Pie chart
|
||||
@@ -511,6 +513,14 @@ RimTotalWellAllocationPlot* RimWellAllocationPlot::totalWellFlowPlot()
|
||||
return m_totalWellAllocationPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimWellAllocationPlot::plotLegend()
|
||||
{
|
||||
return m_wellAllocationPlotLegend;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -536,16 +546,7 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
|
||||
|
||||
if (fieldNeedingOptions == &m_wellName)
|
||||
{
|
||||
std::set<QString> sortedWellNames;
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
const cvf::Collection<RigSingleWellResultsData>& wellRes = m_case->eclipseCaseData()->wellResults();
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < wellRes.size(); ++wIdx )
|
||||
{
|
||||
sortedWellNames.insert(wellRes[wIdx]->m_wellName);
|
||||
}
|
||||
}
|
||||
std::set<QString> sortedWellNames = this->findSortedWellNames();
|
||||
|
||||
QIcon simWellIcon(":/Well.png");
|
||||
for ( const QString& wname: sortedWellNames )
|
||||
@@ -591,12 +592,18 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
|
||||
{
|
||||
if (m_case)
|
||||
{
|
||||
std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
|
||||
//std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
|
||||
// options.push_back(caf::PdmOptionItemInfo("None", nullptr));
|
||||
//for (RimFlowDiagSolution* flowSol : flowSols)
|
||||
//{
|
||||
// options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon()));
|
||||
//}
|
||||
|
||||
for (RimFlowDiagSolution* flowSol : flowSols)
|
||||
RimFlowDiagSolution* defaultFlowSolution = m_case->defaultFlowDiagSolution();
|
||||
options.push_back(caf::PdmOptionItemInfo("Well Flow", nullptr));
|
||||
if (defaultFlowSolution)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("None", nullptr));
|
||||
options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo("Allocation", defaultFlowSolution ));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -641,8 +648,30 @@ void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedF
|
||||
{
|
||||
updateWidgetTitleWindowTitle();
|
||||
}
|
||||
else if ( changedField == &m_case)
|
||||
{
|
||||
if ( m_flowDiagSolution && m_case )
|
||||
{
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_flowDiagSolution = nullptr;
|
||||
}
|
||||
|
||||
if (!m_case) m_timeStep = 0;
|
||||
else if (m_timeStep >= static_cast<int>(m_case->timeStepDates().size()))
|
||||
{
|
||||
m_timeStep = std::max(0, ((int)m_case->timeStepDates().size()) - 1);
|
||||
}
|
||||
|
||||
std::set<QString> sortedWellNames = findSortedWellNames();
|
||||
if (!sortedWellNames.size()) m_wellName = "";
|
||||
else if ( sortedWellNames.count(m_wellName()) == 0 ){ m_wellName = *sortedWellNames.begin();}
|
||||
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
else if ( changedField == &m_wellName
|
||||
|| changedField == &m_case
|
||||
|| changedField == &m_timeStep
|
||||
|| changedField == &m_flowDiagSolution
|
||||
|| changedField == &m_groupSmallContributions
|
||||
@@ -653,6 +682,25 @@ void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedF
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QString> RimWellAllocationPlot::findSortedWellNames()
|
||||
{
|
||||
std::set<QString> sortedWellNames;
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
const cvf::Collection<RigSingleWellResultsData>& wellRes = m_case->eclipseCaseData()->wellResults();
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < wellRes.size(); ++wIdx )
|
||||
{
|
||||
sortedWellNames.insert(wellRes[wIdx]->m_wellName);
|
||||
}
|
||||
}
|
||||
|
||||
return sortedWellNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -674,6 +722,19 @@ QImage RimWellAllocationPlot::snapshotWindowContent()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_userName);
|
||||
uiOrdering.add(&m_showPlotTitle);
|
||||
|
||||
caf::PdmUiGroup& dataGroup = *uiOrdering.addNewGroup("Plot Data");
|
||||
dataGroup.add(&m_case);
|
||||
dataGroup.add(&m_timeStep);
|
||||
dataGroup.add(&m_wellName);
|
||||
|
||||
caf::PdmUiGroup& optionGroup = *uiOrdering.addNewGroup("Options");
|
||||
optionGroup.add(&m_flowDiagSolution);
|
||||
optionGroup.add(&m_flowType);
|
||||
optionGroup.add(&m_groupSmallContributions);
|
||||
optionGroup.add(&m_smallContributionsThreshold);
|
||||
m_smallContributionsThreshold.uiCapability()->setUiReadOnly(!m_groupSmallContributions());
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
|
||||
RimWellLogPlot* accumulatedWellFlowPlot();
|
||||
RimTotalWellAllocationPlot* totalWellFlowPlot();
|
||||
caf::PdmObject* plotLegend();
|
||||
RimFlowDiagSolution* flowDiagSolution();
|
||||
int timeStep();
|
||||
|
||||
@@ -80,6 +81,9 @@ protected:
|
||||
// Overridden PDM methods
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
std::set<QString> findSortedWellNames();
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
|
||||
@@ -26,7 +26,7 @@ CAF_PDM_SOURCE_INIT(RimWellAllocationPlotLegend, "WellAllocationPlotLegend");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlotLegend::RimWellAllocationPlotLegend()
|
||||
{
|
||||
CAF_PDM_InitObject("Well Allocation Plot Legend", ":/WellAllocLegend16x16.png", "", "");
|
||||
CAF_PDM_InitObject("Legend", ":/WellAllocLegend16x16.png", "", "");
|
||||
CAF_PDM_InitField(&m_showLegend, "ShowPlotLegend", true, "Show Plot Legend", "", "", "");
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellFlowRateCurve, "RimWellFlowRateCurve");
|
||||
CAF_PDM_SOURCE_INIT(RimWellFlowRateCurve, "WellFlowRateCurve");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -149,6 +149,19 @@ void RimWellFlowRateCurve::updateCurveAppearance()
|
||||
m_qwtPlotCurve->setCurveAttribute(QwtPlotCurve::Inverted, true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_curveName);
|
||||
m_curveName.uiCapability()->setUiReadOnly(true);
|
||||
uiOrdering.add(&m_curveColor);
|
||||
m_curveColor.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -49,6 +49,8 @@ protected:
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
virtual void updateCurveAppearance() override;
|
||||
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
private:
|
||||
bool isUsingConnectionNumberDepthType() const;
|
||||
RimWellAllocationPlot* wellAllocationPlot() const;
|
||||
|
||||
@@ -39,7 +39,7 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimCase, "RimCase");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCase::RimCase()
|
||||
{
|
||||
CAF_PDM_InitField(&caseUserDescription, "CaseUserDescription", QString(), "Case name", "", "" ,"");
|
||||
CAF_PDM_InitField(&caseUserDescription, "CaseUserDescription", QString(), "Case Name", "", "" ,"");
|
||||
|
||||
CAF_PDM_InitField(&caseId, "CaseId", -1, "Case ID", "", "" ,"");
|
||||
caseId.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
@@ -61,8 +61,9 @@ public:
|
||||
|
||||
virtual void updateFormationNamesData() = 0;
|
||||
|
||||
private:
|
||||
protected:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
private:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override { return &caseUserDescription; }
|
||||
};
|
||||
|
||||
|
||||
@@ -165,7 +165,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
else if (dynamic_cast<RimEclipseInputPropertyCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddEclipseInputPropertyFeature";
|
||||
commandIds << "RicAddOpmInputPropertyFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseInputProperty*>(uiItem))
|
||||
{
|
||||
@@ -391,6 +390,8 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
|
||||
commandIds << "RicShowPlotDataFeature";
|
||||
commandIds << "RicShowTotalAllocationDataFeature";
|
||||
|
||||
commandIds << "RicSummaryCurveSwitchAxisFeature";
|
||||
|
||||
// Work in progress -- End
|
||||
|
||||
@@ -21,12 +21,14 @@
|
||||
#include "RimEclipseCase.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigSingleWellResultsData.h"
|
||||
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
@@ -133,6 +135,48 @@ const RigEclipseCaseData* RimEclipseCase::eclipseCaseData() const
|
||||
return m_rigEclipseCase.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RimEclipseCase::defaultWellColor(const QString& wellName)
|
||||
{
|
||||
if ( m_wellToColorMap.empty() )
|
||||
{
|
||||
const caf::ColorTable& colorTable = RiaColorTables::wellsPaletteColors();
|
||||
cvf::Color3ubArray wellColors = colorTable.color3ubArray();
|
||||
cvf::Color3ubArray interpolatedWellColors = wellColors;
|
||||
|
||||
const cvf::Collection<RigSingleWellResultsData>& wellResults = this->eclipseCaseData()->wellResults();
|
||||
if ( wellResults.size() > 1 )
|
||||
{
|
||||
interpolatedWellColors = caf::ColorTable::interpolateColorArray(wellColors, wellResults.size());
|
||||
}
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
|
||||
{
|
||||
m_wellToColorMap[wellResults[wIdx]->m_wellName] = cvf::Color3f::BLACK;
|
||||
}
|
||||
|
||||
size_t wIdx = 0;
|
||||
for ( auto & wNameColorPair: m_wellToColorMap )
|
||||
{
|
||||
wNameColorPair.second = cvf::Color3f(interpolatedWellColors[wIdx]);
|
||||
|
||||
++wIdx;
|
||||
}
|
||||
}
|
||||
|
||||
auto nmColor = m_wellToColorMap.find(wellName);
|
||||
if (nmColor != m_wellToColorMap.end())
|
||||
{
|
||||
return nmColor->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
return cvf::Color3f::LIGHT_GRAY;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -190,10 +234,8 @@ RimEclipseView* RimEclipseCase::createCopyAndAddView(const RimEclipseView* sourc
|
||||
reservoirViews().push_back(rimEclipseView);
|
||||
|
||||
// Resolve references after reservoir view has been inserted into Rim structures
|
||||
// Intersections referencing a well path/ simulation well requires this
|
||||
// TODO: initAfterReadRecursively can probably be removed
|
||||
rimEclipseView->initAfterReadRecursively();
|
||||
rimEclipseView->resolveReferencesRecursively();
|
||||
rimEclipseView->initAfterReadRecursively();
|
||||
|
||||
return rimEclipseView;
|
||||
}
|
||||
@@ -573,7 +615,6 @@ QStringList RimEclipseCase::timeStepStrings()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
QString RimEclipseCase::timeStepName(int frameIdx)
|
||||
{
|
||||
std::vector<QDateTime> timeStepDates = this->timeStepDates();
|
||||
@@ -582,19 +623,39 @@ QString RimEclipseCase::timeStepName(int frameIdx)
|
||||
if (m_timeStepFormatString.isEmpty())
|
||||
{
|
||||
bool hasHoursAndMinutesInTimesteps = false;
|
||||
bool hasSecondsInTimesteps = false;
|
||||
bool hasMillisecondsInTimesteps = false;
|
||||
for (size_t i = 0; i < timeStepDates.size(); i++)
|
||||
{
|
||||
if (timeStepDates[i].time().hour() != 0.0 || timeStepDates[i].time().minute() != 0.0)
|
||||
if (timeStepDates[i].time().msec() != 0.0)
|
||||
{
|
||||
hasMillisecondsInTimesteps = true;
|
||||
hasSecondsInTimesteps = true;
|
||||
hasHoursAndMinutesInTimesteps = true;
|
||||
break;
|
||||
}
|
||||
else if (timeStepDates[i].time().second() != 0.0) {
|
||||
hasHoursAndMinutesInTimesteps = true;
|
||||
hasSecondsInTimesteps = true;
|
||||
}
|
||||
else if (timeStepDates[i].time().hour() != 0.0 || timeStepDates[i].time().minute() != 0.0)
|
||||
{
|
||||
hasHoursAndMinutesInTimesteps = true;
|
||||
}
|
||||
}
|
||||
|
||||
m_timeStepFormatString = "dd.MMM yyyy";
|
||||
if (hasHoursAndMinutesInTimesteps)
|
||||
{
|
||||
m_timeStepFormatString += " - hh:mm";
|
||||
if (hasSecondsInTimesteps)
|
||||
{
|
||||
m_timeStepFormatString += ":ss";
|
||||
if (hasMillisecondsInTimesteps)
|
||||
{
|
||||
m_timeStepFormatString += ".zzz";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
class QString;
|
||||
|
||||
@@ -69,6 +70,7 @@ public:
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData();
|
||||
const RigEclipseCaseData* eclipseCaseData() const;
|
||||
cvf::Color3f defaultWellColor(const QString& wellName);
|
||||
|
||||
RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
|
||||
@@ -115,6 +117,8 @@ private:
|
||||
caf::PdmChildField<RimReservoirCellResultsStorage*> m_fractureModelResults;
|
||||
QString m_timeStepFormatString;
|
||||
|
||||
std::map<QString , cvf::Color3f> m_wellToColorMap;
|
||||
|
||||
// Obsolete fields
|
||||
protected:
|
||||
caf::PdmField<QString> caseName;
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimEclipseGeometrySelectionItem.h"
|
||||
|
||||
#include "RigTimeHistoryResultAccessor.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
|
||||
#include "RiuSelectionManager.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimEclipseGeometrySelectionItem, "EclipseGeometrySelectionItem");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseGeometrySelectionItem::RimEclipseGeometrySelectionItem()
|
||||
{
|
||||
CAF_PDM_InitObject("Eclipse Geometry Selection Item", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "EclipseCase", "Eclipse Case", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_gridIndex, "GridIndex", "m_gridIndex", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_cellIndex, "CellIndex", "m_cellIndex", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_localIntersectionPoint, "LocalIntersectionPoint", "m_localIntersectionPoint", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseGeometrySelectionItem::~RimEclipseGeometrySelectionItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseGeometrySelectionItem::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 RimEclipseGeometrySelectionItem::geometrySelectionText() 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::geometrySelectionText(m_eclipseCase->eclipseCaseData(), m_gridIndex, m_cellIndex);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimEclipseGeometrySelectionItem::eclipseCase() const
|
||||
{
|
||||
return m_eclipseCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEclipseGeometrySelectionItem::gridIndex() const
|
||||
{
|
||||
return m_gridIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEclipseGeometrySelectionItem::cellIndex() const
|
||||
{
|
||||
return m_cellIndex;
|
||||
}
|
||||
@@ -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 "RimGeometrySelectionItem.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimEclipseCase;
|
||||
class RiuEclipseSelectionItem;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEclipseGeometrySelectionItem : public RimGeometrySelectionItem
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimEclipseGeometrySelectionItem();
|
||||
virtual ~RimEclipseGeometrySelectionItem() override;
|
||||
|
||||
void setFromSelectionItem(const RiuEclipseSelectionItem* selectionItem);
|
||||
|
||||
virtual QString geometrySelectionText() 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;
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@ RimEclipseInputCase::RimEclipseInputCase()
|
||||
: RimEclipseCase()
|
||||
{
|
||||
CAF_PDM_InitObject("RimInputCase", ":/EclipseInput48x48.png", "", "");
|
||||
CAF_PDM_InitField(&m_gridFileName, "GridFileName", QString(), "Case grid filename", "", "" ,"");
|
||||
CAF_PDM_InitField(&m_gridFileName, "GridFileName", QString(), "Case File Name", "", "" ,"");
|
||||
m_gridFileName.uiCapability()->setUiReadOnly(true);
|
||||
CAF_PDM_InitFieldNoDefault(&m_additionalFileNames, "AdditionalFileNames", "Additional files", "", "" ,"");
|
||||
m_additionalFileNames.uiCapability()->setUiReadOnly(true);
|
||||
@@ -375,6 +375,23 @@ cvf::ref<RifReaderInterface> RimEclipseInputCase::createMockModel(QString modelN
|
||||
return mockFileInterface.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseInputCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&caseUserDescription);
|
||||
uiOrdering.add(&caseId);
|
||||
uiOrdering.add(&m_gridFileName);
|
||||
uiOrdering.add(&m_additionalFileNames);
|
||||
|
||||
auto group = uiOrdering.addNewGroup("Case Options");
|
||||
group->add(&activeFormationNames);
|
||||
group->add(&flipXAxis);
|
||||
group->add(&flipYAxis);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -60,6 +60,9 @@ public:
|
||||
|
||||
virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath);
|
||||
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
private:
|
||||
cvf::ref<RifReaderInterface> createMockModel(QString modelName);
|
||||
|
||||
|
||||
@@ -1,269 +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 "RimEclipseInputCaseOpm.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RifReaderOpmParserInput.h"
|
||||
#include "RifReaderSettings.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseInputProperty.h"
|
||||
#include "RimEclipseInputPropertyCollection.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimEclipseInputCaseOpm, "EclipseInputCaseOpm");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseInputCaseOpm::RimEclipseInputCaseOpm()
|
||||
: RimEclipseCase()
|
||||
{
|
||||
CAF_PDM_InitObject("RimInputCase", ":/EclipseInput48x48.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_gridFileName, "GridFileName", QString(), "Case grid filename", "", "" ,"");
|
||||
m_gridFileName.uiCapability()->setUiReadOnly(true);
|
||||
CAF_PDM_InitFieldNoDefault(&m_additionalFileNames, "AdditionalFileNames", "Additional files", "", "", "");
|
||||
m_additionalFileNames.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_inputPropertyCollection, "InputPropertyCollection", "", "", "", "");
|
||||
m_inputPropertyCollection = new RimEclipseInputPropertyCollection;
|
||||
m_inputPropertyCollection->parentField()->uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseInputCaseOpm::~RimEclipseInputCaseOpm()
|
||||
{
|
||||
delete m_inputPropertyCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseInputCaseOpm::importNewEclipseGridAndProperties(const QString& fileName)
|
||||
{
|
||||
m_gridFileName = fileName;
|
||||
|
||||
QFileInfo gridFileName(m_gridFileName);
|
||||
QString caseName = gridFileName.completeBaseName();
|
||||
this->caseUserDescription = caseName + " (opm-parser)";
|
||||
|
||||
importEclipseGridAndProperties(m_gridFileName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseInputCaseOpm::appendPropertiesFromStandaloneFiles(const QStringList& fileNames)
|
||||
{
|
||||
for (auto filename : fileNames)
|
||||
{
|
||||
QFileInfo fi(filename);
|
||||
if (!fi.exists()) continue;
|
||||
|
||||
RifReaderOpmParserPropertyReader propertyReader(filename);
|
||||
std::set<std::string> fileKeywordSet = propertyReader.keywords();
|
||||
|
||||
std::vector<std::string> knownKeywords = RifReaderOpmParserInput::knownPropertyKeywords();
|
||||
for (auto knownKeyword : knownKeywords)
|
||||
{
|
||||
if (fileKeywordSet.count(knownKeyword) > 0)
|
||||
{
|
||||
QString qtKnownKeyword = QString::fromStdString(knownKeyword);
|
||||
QString resultName = this->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(qtKnownKeyword);
|
||||
if (propertyReader.copyPropertyToCaseData(knownKeyword, this->eclipseCaseData(), resultName))
|
||||
{
|
||||
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
|
||||
inputProperty->resultName = resultName;
|
||||
inputProperty->eclipseKeyword = qtKnownKeyword;
|
||||
inputProperty->fileName = filename;
|
||||
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
||||
m_inputPropertyCollection->inputProperties.push_back(inputProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_additionalFileNames.v().push_back(filename);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseInputCaseOpm::openEclipseGridFile()
|
||||
{
|
||||
importEclipseGridAndProperties(m_gridFileName);
|
||||
|
||||
loadAndSyncronizeInputProperties();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseInputCaseOpm::locationOnDisc() const
|
||||
{
|
||||
if (m_gridFileName().isEmpty()) return QString();
|
||||
|
||||
QFileInfo fi(m_gridFileName);
|
||||
return fi.absolutePath();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseInputCaseOpm::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
|
||||
{
|
||||
bool foundFile = false;
|
||||
std::vector<QString> searchedPaths;
|
||||
|
||||
m_gridFileName = RimTools::relocateFile(m_gridFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
|
||||
|
||||
for (size_t i = 0; i < m_additionalFileNames().size(); i++)
|
||||
{
|
||||
m_additionalFileNames.v()[i] = RimTools::relocateFile(m_additionalFileNames()[i], newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseInputCaseOpm::importEclipseGridAndProperties(const QString& fileName)
|
||||
{
|
||||
if (this->eclipseCaseData() == NULL)
|
||||
{
|
||||
this->setReservoirData(new RigEclipseCaseData);
|
||||
|
||||
RifReaderOpmParserInput::importGridPropertiesFaults(fileName, eclipseCaseData());
|
||||
|
||||
if (this->eclipseCaseData()->mainGrid() == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->eclipseCaseData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
|
||||
|
||||
computeCachedData();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
if (app->preferences()->autocomputeDepthRelatedProperties)
|
||||
{
|
||||
RimReservoirCellResultsStorage* matrixResults = results(RifReaderInterface::MATRIX_RESULTS);
|
||||
RimReservoirCellResultsStorage* fractureResults = results(RifReaderInterface::FRACTURE_RESULTS);
|
||||
|
||||
matrixResults->computeDepthRelatedResults();
|
||||
fractureResults->computeDepthRelatedResults();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseInputCaseOpm::loadAndSyncronizeInputProperties()
|
||||
{
|
||||
// Make sure we actually have reservoir data
|
||||
|
||||
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
|
||||
|
||||
for (QString filename : m_additionalFileNames())
|
||||
{
|
||||
QFileInfo fileNameInfo(filename);
|
||||
bool isExistingFile = fileNameInfo.exists();
|
||||
|
||||
// Find the input property objects referring to the file
|
||||
|
||||
std::vector<RimEclipseInputProperty*> ipsUsingThisFile = this->m_inputPropertyCollection()->findInputProperties(filename);
|
||||
|
||||
if (!isExistingFile)
|
||||
{
|
||||
for (auto inputProperty : ipsUsingThisFile)
|
||||
{
|
||||
inputProperty->resolvedState = RimEclipseInputProperty::FILE_MISSING;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RifReaderOpmParserPropertyReader propertyReader(filename);
|
||||
std::set<std::string> fileKeywordSet = propertyReader.keywords();
|
||||
|
||||
for (auto inputProperty : ipsUsingThisFile)
|
||||
{
|
||||
QString kw = inputProperty->eclipseKeyword();
|
||||
inputProperty->resolvedState = RimEclipseInputProperty::KEYWORD_NOT_IN_FILE;
|
||||
if (fileKeywordSet.count(kw.toStdString()))
|
||||
{
|
||||
if (propertyReader.copyPropertyToCaseData(kw.toStdString(), this->eclipseCaseData(), inputProperty->resultName))
|
||||
{
|
||||
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
||||
}
|
||||
}
|
||||
fileKeywordSet.erase(kw.toStdString());
|
||||
}
|
||||
|
||||
if (!fileKeywordSet.empty())
|
||||
{
|
||||
std::vector<std::string> knownKeywords = RifReaderOpmParserInput::knownPropertyKeywords();
|
||||
for (auto knownKeyword : knownKeywords)
|
||||
{
|
||||
if (fileKeywordSet.count(knownKeyword) > 0)
|
||||
{
|
||||
QString qtKnownKeyword = QString::fromStdString(knownKeyword);
|
||||
QString resultName = this->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(qtKnownKeyword);
|
||||
if (propertyReader.copyPropertyToCaseData(knownKeyword, this->eclipseCaseData(), resultName))
|
||||
{
|
||||
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
|
||||
inputProperty->resultName = resultName;
|
||||
inputProperty->eclipseKeyword = qtKnownKeyword;
|
||||
inputProperty->fileName = filename;
|
||||
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
||||
m_inputPropertyCollection->inputProperties.push_back(inputProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(auto inputProperty : m_inputPropertyCollection->inputProperties())
|
||||
{
|
||||
if (inputProperty->resolvedState() == RimEclipseInputProperty::UNKNOWN)
|
||||
{
|
||||
inputProperty->resolvedState = RimEclipseInputProperty::FILE_MISSING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
class RimEclipseInputProperty;
|
||||
class RimEclipseInputPropertyCollection;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// This class is intended to replace RimEclipseInputCase when the opm-parser is considered stable
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimEclipseInputCaseOpm : public RimEclipseCase
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimEclipseInputCaseOpm();
|
||||
virtual ~RimEclipseInputCaseOpm();
|
||||
|
||||
void importNewEclipseGridAndProperties(const QString& fileName);
|
||||
|
||||
void appendPropertiesFromStandaloneFiles(const QStringList& fileNames);
|
||||
|
||||
// RimCase overrides
|
||||
virtual bool openEclipseGridFile(); // Find grid file among file set. Read, Find read and validate property date. Syncronize child property sets.
|
||||
|
||||
// Overrides from RimCase
|
||||
virtual QString locationOnDisc() const;
|
||||
virtual QString gridFileName() const { return m_gridFileName();}
|
||||
|
||||
virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath);
|
||||
|
||||
private:
|
||||
void importEclipseGridAndProperties(const QString& fileName);
|
||||
void loadAndSyncronizeInputProperties();
|
||||
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimEclipseInputPropertyCollection*> m_inputPropertyCollection;
|
||||
caf::PdmField<std::vector<QString> > m_additionalFileNames;
|
||||
|
||||
caf::PdmField<QString> m_gridFileName;
|
||||
};
|
||||
@@ -186,24 +186,26 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
|
||||
resultDefinition->uiOrdering(uiConfigName, *group1);
|
||||
|
||||
// Fields declared in RimCellFilter
|
||||
uiOrdering.add(&filterMode);
|
||||
caf::PdmUiGroup& group2 = *(uiOrdering.addNewGroup("Filter Settings"));
|
||||
|
||||
uiOrdering.add(&m_rangeLabelText);
|
||||
// Fields declared in RimCellFilter
|
||||
group2.add(&filterMode);
|
||||
|
||||
group2.add(&m_rangeLabelText);
|
||||
|
||||
if (resultDefinition->hasCategoryResult())
|
||||
{
|
||||
uiOrdering.add(&m_useCategorySelection);
|
||||
group2.add(&m_useCategorySelection);
|
||||
}
|
||||
|
||||
if ( resultDefinition->hasCategoryResult() && m_useCategorySelection() )
|
||||
{
|
||||
uiOrdering.add(&m_selectedCategoryValues);
|
||||
group2.add(&m_selectedCategoryValues);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiOrdering.add(&m_lowerBound);
|
||||
uiOrdering.add(&m_upperBound);
|
||||
group2.add(&m_lowerBound);
|
||||
group2.add(&m_upperBound);
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
|
||||
@@ -56,10 +56,13 @@ RimEclipseResultCase::RimEclipseResultCase()
|
||||
{
|
||||
CAF_PDM_InitObject("Eclipse Case", ":/Case48x48.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&caseFileName, "CaseFileName", QString(), "Case file name", "", "" ,"");
|
||||
CAF_PDM_InitField(&caseFileName, "CaseFileName", QString(), "Case File Name", "", "" ,"");
|
||||
caseFileName.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault (&m_flowDiagSolutions, "FlowDiagSolutions", "Flow Diagnostics Solutions", "", "", "");
|
||||
m_flowDiagSolutions.uiCapability()->setUiHidden(true);
|
||||
m_flowDiagSolutions.uiCapability()->setUiTreeHidden(true);
|
||||
m_flowDiagSolutions.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
// Obsolete, unused field
|
||||
CAF_PDM_InitField(&caseDirectory, "CaseFolder", QString(), "Directory", "", "" ,"");
|
||||
@@ -464,6 +467,12 @@ void RimEclipseResultCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrde
|
||||
uiOrdering.add(&caseUserDescription);
|
||||
uiOrdering.add(&caseId);
|
||||
uiOrdering.add(&caseFileName);
|
||||
|
||||
auto group = uiOrdering.addNewGroup("Case Options");
|
||||
group->add(&activeFormationNames);
|
||||
group->add(&flipXAxis);
|
||||
group->add(&flipYAxis);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -100,6 +100,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowSolutionUiField, "MFlowDiagSolution", "Solution", "", "", "");
|
||||
m_flowSolutionUiField.xmlCapability()->setIOReadable(false);
|
||||
m_flowSolutionUiField.xmlCapability()->setIOWritable(false);
|
||||
m_flowSolutionUiField.uiCapability()->setUiHidden(true); // For now since there are only one to choose from
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedTracersUiField, "MSelectedTracers", " ", "", "", "");
|
||||
m_selectedTracersUiField.xmlCapability()->setIOReadable(false);
|
||||
@@ -672,7 +673,7 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
|
||||
}
|
||||
else
|
||||
{
|
||||
RimFlowDiagSolution* flowSol = m_flowSolutionUiField();
|
||||
RimFlowDiagSolution* flowSol = m_flowSolution();
|
||||
if (flowSol)
|
||||
{
|
||||
std::vector<QString> tracerNames = flowSol->tracerNames();
|
||||
|
||||
@@ -75,7 +75,7 @@ RimEclipseStatisticsCase::RimEclipseStatisticsCase()
|
||||
m_selectionSummary.xmlCapability()->setIOReadable(false);
|
||||
m_selectionSummary.uiCapability()->setUiReadOnly(true);
|
||||
m_selectionSummary.uiCapability()->setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName());
|
||||
m_selectionSummary.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
||||
m_selectionSummary.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_resultType, "ResultType", "Result Type", "", "", "");
|
||||
m_resultType.xmlCapability()->setIOWritable(false);
|
||||
@@ -114,6 +114,11 @@ RimEclipseStatisticsCase::RimEclipseStatisticsCase()
|
||||
CAF_PDM_InitField(&m_useZeroAsInactiveCellValue, "UseZeroAsInactiveCellValue", false, "Use Zero as Inactive Cell Value", "", "", "");
|
||||
|
||||
m_populateSelectionAfterLoadingGrid = false;
|
||||
|
||||
// These does not work properly for statistics case, so hide for now
|
||||
flipXAxis.uiCapability()->setUiHidden(true);
|
||||
flipYAxis.uiCapability()->setUiHidden(true);
|
||||
activeFormationNames.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -339,12 +344,16 @@ void RimEclipseStatisticsCase::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
updatePercentileUiVisibility();
|
||||
|
||||
uiOrdering.add(&caseUserDescription);
|
||||
|
||||
uiOrdering.add(&caseId);
|
||||
uiOrdering.add(&m_calculateEditCommand);
|
||||
uiOrdering.add(&m_selectionSummary);
|
||||
|
||||
caf::PdmUiGroup * group = uiOrdering.addNewGroup("Properties to consider");
|
||||
uiOrdering.add(&m_calculateEditCommand);
|
||||
|
||||
caf::PdmUiGroup * group = uiOrdering.addNewGroup("Summary of Calculation Setup");
|
||||
group->add(&m_useZeroAsInactiveCellValue);
|
||||
m_useZeroAsInactiveCellValue.uiCapability()->setUiHidden(hasComputedStatistics());
|
||||
group->add(&m_selectionSummary);
|
||||
|
||||
group = uiOrdering.addNewGroup("Properties to consider");
|
||||
group->setUiHidden(hasComputedStatistics());
|
||||
group->add(&m_resultType);
|
||||
group->add(&m_porosityModel);
|
||||
@@ -357,8 +366,6 @@ void RimEclipseStatisticsCase::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
group->add(&m_selectedFractureGeneratedProperties);
|
||||
group->add(&m_selectedFractureInputProperties);
|
||||
|
||||
uiOrdering.add(&m_useZeroAsInactiveCellValue);
|
||||
m_useZeroAsInactiveCellValue.uiCapability()->setUiHidden(hasComputedStatistics());
|
||||
|
||||
group = uiOrdering.addNewGroup("Percentile setup");
|
||||
group->setUiHidden(hasComputedStatistics());
|
||||
@@ -368,6 +375,11 @@ void RimEclipseStatisticsCase::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
group->add(&m_midPercentile);
|
||||
group->add(&m_highPercentile);
|
||||
|
||||
group = uiOrdering.addNewGroup("Case Options");
|
||||
group->add(&m_wellDataSourceCase);
|
||||
group->add(&activeFormationNames);
|
||||
group->add(&flipXAxis);
|
||||
group->add(&flipYAxis);
|
||||
}
|
||||
|
||||
QList<caf::PdmOptionItemInfo> toOptionList(const QStringList& varList)
|
||||
@@ -451,6 +463,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseStatisticsCase::calculateValueOptions(co
|
||||
return toOptionList(sourceCaseNames);
|
||||
}
|
||||
|
||||
if (!options.size()) options = RimEclipseCase::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
|
||||
|
||||
return options;
|
||||
}
|
||||
@@ -460,6 +473,8 @@ QList<caf::PdmOptionItemInfo> RimEclipseStatisticsCase::calculateValueOptions(co
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseStatisticsCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
RimEclipseCase::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
|
||||
if (&m_resultType == changedField || &m_porosityModel == changedField)
|
||||
{
|
||||
}
|
||||
@@ -701,7 +716,7 @@ void RimEclipseStatisticsCase::computeStatisticsAndUpdateViews()
|
||||
|
||||
if (reservoirViews.size() == 0)
|
||||
{
|
||||
RicNewViewFeature::addReservoirView();
|
||||
RicNewViewFeature::addReservoirView(this, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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;
|
||||
};
|
||||
|
||||
@@ -423,14 +423,18 @@ void RimEclipseView::createDisplayModel()
|
||||
*/
|
||||
// Well path model
|
||||
|
||||
RigMainGrid* mainGrid = this->mainGrid();
|
||||
|
||||
m_wellPathPipeVizModel->removeAllParts();
|
||||
|
||||
RigMainGrid* mainGrid = this->mainGrid();
|
||||
if (mainGrid)
|
||||
{
|
||||
addWellPathsToModel(m_wellPathPipeVizModel.p(),
|
||||
mainGrid->displayModelOffset(),
|
||||
mainGrid->characteristicIJCellSize(),
|
||||
currentActiveCellInfo()->geometryBoundingBox(),
|
||||
m_reservoirGridPartManager->scaleTransform());
|
||||
}
|
||||
|
||||
m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p());
|
||||
|
||||
@@ -1287,15 +1291,7 @@ const std::vector<RivCellSetEnum>& RimEclipseView::visibleGridParts() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
caf::PdmUiGroup* viewGroup = uiOrdering.addNewGroup("Viewer");
|
||||
viewGroup->add(&name);
|
||||
viewGroup->add(&backgroundColor);
|
||||
viewGroup->add(&showGridBox);
|
||||
|
||||
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup("Grid Appearance");
|
||||
gridGroup->add(&scaleZ);
|
||||
gridGroup->add(&meshMode);
|
||||
gridGroup->add(&surfaceMode);
|
||||
RimView::defineUiOrdering(uiConfigName, uiOrdering);
|
||||
|
||||
caf::PdmUiGroup* cellGroup = uiOrdering.addNewGroup("Cell Visibility");
|
||||
cellGroup->add(&showMainGrid);
|
||||
|
||||
@@ -57,8 +57,8 @@ RimEclipseWell::RimEclipseWell()
|
||||
CAF_PDM_InitField(&showWellPipe, "ShowWellPipe", true, "Pipe", "", "", "");
|
||||
CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", false, "Spheres", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScaleFactor", 1.0, "Well Head Scale Factor", "", "", "");
|
||||
CAF_PDM_InitField(&pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Pipe Scale Factor", "", "", "");
|
||||
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScaleFactor", 1.0, "Well Head Scale", "", "", "");
|
||||
CAF_PDM_InitField(&pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Pipe Radius Scale", "", "", "");
|
||||
CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), "Pipe Color", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&showWellCells, "ShowWellCells", false, "Well Cells", "", "", "");
|
||||
@@ -342,16 +342,17 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
appearanceGroup->add(&showWellPipe);
|
||||
appearanceGroup->add(&showWellSpheres);
|
||||
|
||||
caf::PdmUiGroup* sizeScalingGroup = uiOrdering.addNewGroup("Size Scaling");
|
||||
sizeScalingGroup->add(&pipeScaleFactor);
|
||||
sizeScalingGroup->add(&wellHeadScaleFactor);
|
||||
|
||||
uiOrdering.add(&wellPipeColor);
|
||||
|
||||
uiOrdering.add(&showWellCells);
|
||||
uiOrdering.add(&showWellCellFence);
|
||||
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well Cells and Fence");
|
||||
filterGroup->add(&showWellCells);
|
||||
filterGroup->add(&showWellCellFence);
|
||||
|
||||
showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells());
|
||||
caf::PdmUiGroup* sizeScalingGroup = uiOrdering.addNewGroup("Size Scaling");
|
||||
sizeScalingGroup->add(&wellHeadScaleFactor);
|
||||
sizeScalingGroup->add(&pipeScaleFactor);
|
||||
|
||||
caf::PdmUiGroup* colorGroup = uiOrdering.addNewGroup("Colors");
|
||||
colorGroup->add(&wellPipeColor);
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user