mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 14:40:26 -05:00
#14077 Add umbrella Import Simulation Grid feature for GRID/EGRID, GRDECL, and ROFF
This commit is contained in:
1 parent
1ad4a9651d
commit
a8306ebb81
13 files changed
+130
-137
No files matched your search
@@ -11,7 +11,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicEclipsePropertyFilterNewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportEclipseCaseFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportEclipseCasesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportInputEclipseCaseFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportGridModelFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewStatisticsCaseFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicApplyPropertyFilterAsCellResultFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportEclipseCaseTimeStepFilterFeature.cpp
|
||||
@@ -19,7 +19,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicEclipseHideFaultFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicEclipseShowOnlyFaultFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRenameCaseFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportRoffCaseFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicAddGridCalculationFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCaseEnsemblesFromFilesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicAddLinkedEclipsePropertyFilterFeature.cpp
|
||||
|
||||
+3
-3
@@ -38,9 +38,9 @@ void RicImportEclipseCaseTimeStepFilterFeature::onActionTriggered( bool isChecke
|
||||
|
||||
QString defaultDir = app->lastUsedDialogDirectory( "BINARY_GRID" );
|
||||
QString fileName = RiuFileDialogTools::getOpenFileName( Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"Import Eclipse File",
|
||||
"Import Grid Model",
|
||||
defaultDir,
|
||||
"Eclipse Grid Files (*.GRID *.EGRID)" );
|
||||
"Binary Grid Models (*.GRID *.EGRID)" );
|
||||
if ( !fileName.isEmpty() )
|
||||
{
|
||||
defaultDir = QFileInfo( fileName ).absolutePath();
|
||||
@@ -59,5 +59,5 @@ void RicImportEclipseCaseTimeStepFilterFeature::onActionTriggered( bool isChecke
|
||||
void RicImportEclipseCaseTimeStepFilterFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/Case48x48.png" ) );
|
||||
actionToSetup->setText( "Import Eclipse Case (Time Step Filtered)" );
|
||||
actionToSetup->setText( "Import Grid Model (Time Step Filtered)" );
|
||||
}
|
||||
@@ -45,7 +45,7 @@ void RicImportEclipseCasesFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
RicRecursiveFileSearchDialogResult result =
|
||||
RicRecursiveFileSearchDialog::runRecursiveSearchDialog( RiaGuiApplication::widgetToUseAsParent(),
|
||||
"Import Eclipse Cases",
|
||||
"Import Grid Models",
|
||||
defaultDir,
|
||||
m_pathFilter,
|
||||
m_fileNameFilter,
|
||||
@@ -78,5 +78,5 @@ void RicImportEclipseCasesFeature::onActionTriggered( bool isChecked )
|
||||
void RicImportEclipseCasesFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/Cases16x16.png" ) );
|
||||
actionToSetup->setText( "Import Eclipse Cases Recursively" );
|
||||
actionToSetup->setText( "Import Grid Models Recursively" );
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2026- Equinor 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 "RicImportGridModelFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RicImportEclipseCaseFeature.h"
|
||||
#include "RicImportGeneralDataFeature.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuFileDialogTools.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicImportGridModelFeature, "RicImportGridModelFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportGridModelFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
const QString binaryGridPattern = "*.GRID *.EGRID";
|
||||
const QString textGridPattern = "*.GRDECL";
|
||||
const QString roffPattern = "*.ROFF *.ROFFASC";
|
||||
const QString allGridsPattern = QString( "%1 %2 %3" ).arg( binaryGridPattern, textGridPattern, roffPattern );
|
||||
|
||||
const QString binaryGridFilter = QString( "Binary Grid Models (%1)" ).arg( binaryGridPattern );
|
||||
|
||||
const QStringList filterGroups = { QString( "Grid Models (%1)" ).arg( allGridsPattern ),
|
||||
binaryGridFilter,
|
||||
QString( "Text Grid Models (%1)" ).arg( textGridPattern ),
|
||||
QString( "Roff Grid Models (%1)" ).arg( roffPattern ) };
|
||||
|
||||
const QString defaultDirLabel = RiaDefines::defaultDirectoryLabel( RiaDefines::ImportFileType::ANY_ECLIPSE_FILE );
|
||||
const QString defaultDir = app->lastUsedDialogDirectory( defaultDirLabel );
|
||||
|
||||
// Default to the binary grid filter (GRID/EGRID) when the dialog opens.
|
||||
QString selectedFilter = binaryGridFilter;
|
||||
|
||||
// Use nullptr as parent: this command can be invoked from both the 3D main window and the plot window.
|
||||
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( RiaGuiApplication::widgetToUseAsParent(),
|
||||
"Import Grid Models",
|
||||
defaultDir,
|
||||
filterGroups.join( ";;" ),
|
||||
&selectedFilter );
|
||||
|
||||
if ( fileNames.isEmpty() ) return;
|
||||
|
||||
app->setLastUsedDialogDirectory( defaultDirLabel, QFileInfo( fileNames.last() ).absolutePath() );
|
||||
|
||||
// Track existing views so newly imported PVD surfaces can be enabled only in new views.
|
||||
RimProject* project = RimProject::current();
|
||||
const std::vector<RimEclipseView*> allViewsBefore = RicImportEclipseCaseFeature::allEclipseViews( project );
|
||||
|
||||
constexpr bool doCreateDefaultPlot = true;
|
||||
constexpr bool createDefaultView = true;
|
||||
const auto results = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( fileNames, doCreateDefaultPlot, createDefaultView );
|
||||
|
||||
if ( !results )
|
||||
{
|
||||
RiaLogging::error( std::format( "Failed to open grid model files: {}", fileNames.join( ", " ).toStdString() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// openEclipseFilesFromFileNames already adds GRDECL/ROFF/summary files to recent files;
|
||||
// the binary Eclipse grid path does not, so add those here.
|
||||
for ( const QString& f : results.eclipseCaseFiles )
|
||||
{
|
||||
app->addToRecentFiles( f );
|
||||
}
|
||||
|
||||
// Auto-import matching PVD surface files for any imported binary grid files.
|
||||
if ( !results.eclipseCaseFiles.isEmpty() )
|
||||
{
|
||||
RicImportEclipseCaseFeature::importPvdSurfacesForGridFiles( results.eclipseCaseFiles, allViewsBefore );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportGridModelFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/Case.svg" ) );
|
||||
actionToSetup->setText( "Import Grid Models" );
|
||||
}
|
||||
+7
-5
@@ -1,7 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
// Copyright (C) 2026- Equinor 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
|
||||
@@ -19,12 +18,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicImportGeneralDataFeature.h"
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
/// Umbrella feature for importing grid models of any supported type
|
||||
/// (binary GRID/EGRID, text GRDECL, Roff). Presents a single file dialog with
|
||||
/// filter groups for each format plus a combined group, and routes the selected
|
||||
/// files to the matching importer based on extension.
|
||||
//==================================================================================================
|
||||
class RicImportInputEclipseCaseFeature : public RicImportGeneralDataFeature
|
||||
class RicImportGridModelFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
@@ -1,41 +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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicImportInputEclipseCaseFeature.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicImportInputEclipseCaseFeature, "RicImportInputEclipseCaseFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportInputEclipseCaseFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RicImportGeneralDataFeature::openFileDialog( RiaDefines::ImportFileType::ECLIPSE_INPUT_FILE );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportInputEclipseCaseFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/EclipseInput48x48.png" ) );
|
||||
actionToSetup->setText( "Import Input Eclipse Case" );
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2022- Equinor 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 "RicImportRoffCaseFeature.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicImportRoffCaseFeature, "RicImportRoffCaseFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportRoffCaseFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RicImportGeneralDataFeature::openFileDialog( RiaDefines::ImportFileType::ROFF_FILE );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportRoffCaseFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/EclipseInput48x48.png" ) );
|
||||
actionToSetup->setText( "Import Roff Case" );
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2022- Equinor 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 "RicImportGeneralDataFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicImportRoffCaseFeature : public RicImportGeneralDataFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
Reference in new issue
Block a user