mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1769 Add time step filtering when importing model
Move import code from RiaApplication to command feature Show time step selection UI when importing Eclipse data Support time step reading of HDF data
This commit is contained in:
@@ -19,6 +19,7 @@ ${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicApplyPropertyFilterAsCellResultFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseTimeStepFilterFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -36,6 +37,7 @@ ${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicApplyPropertyFilterAsCellResultFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseTimeStepFilterFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
|
||||
#include "RicCreateGridCaseGroupFeature.h"
|
||||
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuMultiCaseImportDialog.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
@@ -42,13 +43,12 @@ bool RicCreateGridCaseGroupFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateGridCaseGroupFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiuMultiCaseImportDialog dialog;
|
||||
int action = dialog.exec();
|
||||
if (action == QDialog::Accepted)
|
||||
{
|
||||
QStringList gridFileNames = dialog.eclipseCaseFileNames();
|
||||
app->addEclipseCases(gridFileNames);
|
||||
RiaImportEclipseCaseTools::addEclipseCases(gridFileNames);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,12 @@
|
||||
|
||||
#include "RicImportEclipseCaseFeature.h"
|
||||
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
@@ -57,7 +61,7 @@ void RicImportEclipseCaseFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
if (!fileNames.isEmpty())
|
||||
{
|
||||
if (app->openEclipseCaseFromFile(fileName))
|
||||
if (RiaImportEclipseCaseTools::openEclipseCaseFromFile(fileName))
|
||||
{
|
||||
app->addToRecentFiles(fileName);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicImportEclipseCaseTimeStepFilterFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicImportEclipseCaseTimeStepFilterFeature, "RicImportEclipseCaseTimeStepFilterFeature");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportEclipseCaseTimeStepFilterFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
|
||||
QString fileName = QFileDialog::getOpenFileName(RiuMainWindow::instance(), "Import Eclipse File", defaultDir, "Eclipse Grid Files (*.GRID *.EGRID)");
|
||||
if (!fileName.isEmpty())
|
||||
{
|
||||
defaultDir = QFileInfo(fileName).absolutePath();
|
||||
app->setLastUsedDialogDirectory("BINARY_GRID", defaultDir);
|
||||
|
||||
if (RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilter(fileName))
|
||||
{
|
||||
app->addToRecentFiles(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportEclipseCaseTimeStepFilterFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/Case48x48.png"));
|
||||
actionToSetup->setText("Import Eclipse Case (Time Step Filtered)");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportEclipseCaseTimeStepFilterFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicImportEclipseCaseTimeStepFilterFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
};
|
||||
|
||||
|
||||
@@ -19,17 +19,68 @@
|
||||
|
||||
#include "RicImportInputEclipseCaseFeature.h"
|
||||
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPorosityModel.h"
|
||||
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseInputCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicImportInputEclipseCaseFeature, "RicImportInputEclipseCaseFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportInputEclipseCaseFeature::openInputEclipseCaseFromFileNames(const QStringList& fileNames)
|
||||
{
|
||||
RimEclipseInputCase* rimInputReservoir = new RimEclipseInputCase();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* project = app->project();
|
||||
|
||||
project->assignCaseIdToCase(rimInputReservoir);
|
||||
|
||||
rimInputReservoir->openDataFileSet(fileNames);
|
||||
|
||||
RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels() : NULL;
|
||||
if (analysisModels == NULL) return false;
|
||||
|
||||
analysisModels->cases.push_back(rimInputReservoir);
|
||||
|
||||
RimEclipseView* riv = rimInputReservoir->createAndAddReservoirView();
|
||||
|
||||
riv->cellResult()->setResultType(RiaDefines::INPUT_PROPERTY);
|
||||
riv->hasUserRequestedAnimation = true;
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
if (!riv->cellResult()->hasResult())
|
||||
{
|
||||
riv->cellResult()->setResultVariable(RiaDefines::undefinedResultName());
|
||||
}
|
||||
|
||||
analysisModels->updateConnectedEditors();
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult());
|
||||
|
||||
if (fileNames.size() == 1)
|
||||
{
|
||||
app->addToRecentFiles(fileNames[0]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -52,8 +103,7 @@ void RicImportInputEclipseCaseFeature::onActionTriggered(bool isChecked)
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory("INPUT_FILES", QFileInfo(fileNames.last()).absolutePath());
|
||||
|
||||
app->openInputEclipseCaseFromFileNames(fileNames);
|
||||
|
||||
RicImportInputEclipseCaseFeature::openInputEclipseCaseFromFileNames(fileNames);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class QStringList;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@@ -30,6 +32,10 @@ class RicImportInputEclipseCaseFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static bool openInputEclipseCaseFromFileNames(const QStringList& fileNames);
|
||||
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
|
||||
Reference in New Issue
Block a user