mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Grid preferences update (#11547)
* Refactor RifReaderSettings and grid preferences tab
This commit is contained in:
@@ -128,7 +128,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifJsonEncodeDecode.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderInterface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderMockModel.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderSettings.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifEclipseSummaryAddress.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifEclipseRftAddress.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifWellPathImporter.cpp
|
||||
|
||||
@@ -21,11 +21,10 @@
|
||||
#include "RifEclipseUnifiedRestartFileAccess.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaPreferencesGrid.h"
|
||||
|
||||
#include "RiaStringEncodingTools.h"
|
||||
#include "RifEclipseOutputFileTools.h"
|
||||
#include "RifReaderSettings.h"
|
||||
|
||||
#include "ert/ecl/ecl_file.h"
|
||||
#include "ert/ecl/ecl_kw_magic.h"
|
||||
@@ -135,10 +134,8 @@ bool RifEclipseUnifiedRestartFileAccess::openFile()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifEclipseUnifiedRestartFileAccess::useResultIndexFile() const
|
||||
{
|
||||
RiaPreferences* prefs = RiaPreferences::current();
|
||||
const RifReaderSettings* readerSettings = prefs->readerSettings();
|
||||
|
||||
return readerSettings->useResultIndexFile();
|
||||
RiaPreferencesGrid* prefs = RiaPreferencesGrid::current();
|
||||
return prefs->useResultIndexFile();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "RifHdf5ReaderInterface.h"
|
||||
#include "RifOpmRadialGridTools.h"
|
||||
#include "RifReaderEclipseWell.h"
|
||||
#include "RifReaderSettings.h"
|
||||
|
||||
#ifdef USE_HDF5
|
||||
#include "RifHdf5Reader.h"
|
||||
|
||||
@@ -19,57 +19,65 @@
|
||||
|
||||
#include "RifReaderInterface.h"
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaPreferencesGrid.h"
|
||||
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
#include "RifReaderSettings.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderInterface::isFaultImportEnabled()
|
||||
RifReaderInterface::RifReaderInterface()
|
||||
{
|
||||
return readerSettings()->importFaults;
|
||||
RiaPreferencesGrid* prefs = RiaPreferencesGrid::current();
|
||||
m_readerSettings = prefs->readerSettings();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderInterface::isImportOfCompleteMswDataEnabled()
|
||||
bool RifReaderInterface::isFaultImportEnabled() const
|
||||
{
|
||||
return readerSettings()->importAdvancedMswData;
|
||||
return m_readerSettings.importFaults;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderInterface::isNNCsEnabled()
|
||||
bool RifReaderInterface::isImportOfCompleteMswDataEnabled() const
|
||||
{
|
||||
return readerSettings()->importNNCs;
|
||||
return m_readerSettings.importAdvancedMswData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderInterface::loadWellDataEnabled()
|
||||
bool RifReaderInterface::isNNCsEnabled() const
|
||||
{
|
||||
return !readerSettings()->skipWellData;
|
||||
return m_readerSettings.importNNCs;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderInterface::includeInactiveCellsInFaultGeometry()
|
||||
bool RifReaderInterface::loadWellDataEnabled() const
|
||||
{
|
||||
return readerSettings()->includeInactiveCellsInFaultGeometry();
|
||||
return !m_readerSettings.skipWellData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString RifReaderInterface::faultIncludeFileAbsolutePathPrefix()
|
||||
bool RifReaderInterface::includeInactiveCellsInFaultGeometry() const
|
||||
{
|
||||
return readerSettings()->includeFileAbsolutePathPrefix;
|
||||
return m_readerSettings.includeInactiveCellsInFaultGeometry;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString RifReaderInterface::faultIncludeFileAbsolutePathPrefix() const
|
||||
{
|
||||
return m_readerSettings.includeFileAbsolutePathPrefix;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -122,26 +130,7 @@ size_t RifReaderInterface::timeStepIndexOnFile( size_t timeStepIndex ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RifReaderSettings* RifReaderInterface::readerSettings() const
|
||||
{
|
||||
if ( m_readerSettings )
|
||||
{
|
||||
return m_readerSettings.get();
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaPreferences* prefs = RiaPreferences::current();
|
||||
|
||||
CVF_ASSERT( prefs->readerSettings() );
|
||||
|
||||
return prefs->readerSettings();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderInterface::setReaderSettings( std::shared_ptr<RifReaderSettings> readerSettings )
|
||||
void RifReaderInterface::setReaderSettings( RifReaderSettings readerSettings )
|
||||
{
|
||||
m_readerSettings = readerSettings;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaPorosityModel.h"
|
||||
|
||||
#include "RifReaderSettings.h"
|
||||
|
||||
#include "cvfCollection.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
@@ -36,7 +38,6 @@
|
||||
#include <vector>
|
||||
|
||||
class RigEclipseCaseData;
|
||||
class RifReaderSettings;
|
||||
class RigFault;
|
||||
|
||||
//==================================================================================================
|
||||
@@ -47,17 +48,17 @@ class RigFault;
|
||||
class RifReaderInterface : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RifReaderInterface() {}
|
||||
RifReaderInterface();
|
||||
~RifReaderInterface() override {}
|
||||
|
||||
void setReaderSettings( std::shared_ptr<RifReaderSettings> readerSettings );
|
||||
bool isFaultImportEnabled() const;
|
||||
bool isImportOfCompleteMswDataEnabled() const;
|
||||
bool isNNCsEnabled() const;
|
||||
bool includeInactiveCellsInFaultGeometry() const;
|
||||
bool loadWellDataEnabled() const;
|
||||
const QString faultIncludeFileAbsolutePathPrefix() const;
|
||||
|
||||
bool isFaultImportEnabled();
|
||||
bool isImportOfCompleteMswDataEnabled();
|
||||
bool isNNCsEnabled();
|
||||
bool includeInactiveCellsInFaultGeometry();
|
||||
bool loadWellDataEnabled();
|
||||
const QString faultIncludeFileAbsolutePathPrefix();
|
||||
void setReaderSettings( RifReaderSettings readerSettings );
|
||||
|
||||
virtual bool open( const QString& fileName, RigEclipseCaseData* eclipseCase ) = 0;
|
||||
|
||||
@@ -81,13 +82,10 @@ protected:
|
||||
size_t timeStepIndexOnFile( size_t timeStepIndex ) const;
|
||||
void importFaults( const QStringList& fileSet, cvf::Collection<RigFault>* faults );
|
||||
|
||||
private:
|
||||
const RifReaderSettings* readerSettings() const;
|
||||
|
||||
private:
|
||||
std::vector<QString> m_filenamesWithFaults;
|
||||
|
||||
std::vector<size_t> m_fileTimeStepIndices;
|
||||
|
||||
std::shared_ptr<RifReaderSettings> m_readerSettings;
|
||||
RifReaderSettings m_readerSettings;
|
||||
};
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) 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 "RifReaderSettings.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RifReaderSettings, "RifReaderSettings" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderSettings::RifReaderSettings()
|
||||
{
|
||||
CAF_PDM_InitObject( "RifReaderSettings" );
|
||||
|
||||
CAF_PDM_InitField( &importFaults, "importFaults", true, "Import Faults" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &importFaults );
|
||||
|
||||
CAF_PDM_InitField( &importNNCs, "importSimulationNNCs", true, "Import NNCs" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &importNNCs );
|
||||
|
||||
CAF_PDM_InitField( &includeInactiveCellsInFaultGeometry, "includeInactiveCellsInFaultGeometry", false, "Include Inactive Cells" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &includeInactiveCellsInFaultGeometry );
|
||||
|
||||
CAF_PDM_InitField( &importAdvancedMswData, "importAdvancedMswData", true, "Import Advanced MSW Data" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &importAdvancedMswData );
|
||||
|
||||
CAF_PDM_InitField( &useResultIndexFile,
|
||||
"useResultIndexFile",
|
||||
false,
|
||||
"Use Result Index File",
|
||||
"",
|
||||
"After import of a result file, store index data in an index file in the same folder as the "
|
||||
"result file.\n"
|
||||
"Import of result data if a result index file is present, will reduce file parsing "
|
||||
"significantly.",
|
||||
"" );
|
||||
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &useResultIndexFile );
|
||||
|
||||
CAF_PDM_InitField( &skipWellData, "skipWellData", false, "Skip Import of Simulation Well Data" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &skipWellData );
|
||||
|
||||
CAF_PDM_InitField( &includeFileAbsolutePathPrefix,
|
||||
"includeFileAbsolutePathPrefix",
|
||||
QString(),
|
||||
"Include File Absolute Path Prefix",
|
||||
"",
|
||||
"Path used to prefix absolute UNIX paths in include statements on Windows, used when searching "
|
||||
"for FAULTS and EQUIL",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitField( &importSummaryData, "importSummaryData", true, "Import summary data" );
|
||||
importSummaryData.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &importFaults );
|
||||
uiOrdering.add( &includeInactiveCellsInFaultGeometry );
|
||||
#ifdef WIN32
|
||||
uiOrdering.add( &includeFileAbsolutePathPrefix );
|
||||
#endif
|
||||
uiOrdering.add( &importNNCs );
|
||||
uiOrdering.add( &importAdvancedMswData );
|
||||
uiOrdering.add( &useResultIndexFile );
|
||||
uiOrdering.add( &skipWellData );
|
||||
|
||||
bool setFaultImportSettingsReadOnly = !importFaults();
|
||||
|
||||
includeInactiveCellsInFaultGeometry.uiCapability()->setUiReadOnly( setFaultImportSettingsReadOnly );
|
||||
includeFileAbsolutePathPrefix.uiCapability()->setUiReadOnly( setFaultImportSettingsReadOnly );
|
||||
importNNCs.uiCapability()->setUiReadOnly( setFaultImportSettingsReadOnly );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::shared_ptr<RifReaderSettings> RifReaderSettings::createGridOnlyReaderSettings()
|
||||
{
|
||||
std::shared_ptr<RifReaderSettings> readerSettings = std::make_shared<RifReaderSettings>();
|
||||
// Disable as much as possible
|
||||
readerSettings->importNNCs = false;
|
||||
readerSettings->importFaults = false;
|
||||
readerSettings->skipWellData = true;
|
||||
readerSettings->includeInactiveCellsInFaultGeometry = false;
|
||||
readerSettings->importAdvancedMswData = false;
|
||||
readerSettings->importSummaryData = false;
|
||||
return readerSettings;
|
||||
}
|
||||
@@ -19,33 +19,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RifReaderSettings : public caf::PdmObject
|
||||
struct RifReaderSettings
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
friend class RiaPreferences;
|
||||
|
||||
public:
|
||||
RifReaderSettings();
|
||||
|
||||
caf::PdmField<bool> importFaults;
|
||||
caf::PdmField<bool> importNNCs;
|
||||
caf::PdmField<bool> includeInactiveCellsInFaultGeometry;
|
||||
caf::PdmField<bool> importAdvancedMswData;
|
||||
caf::PdmField<QString> includeFileAbsolutePathPrefix;
|
||||
caf::PdmField<bool> useResultIndexFile;
|
||||
caf::PdmField<bool> skipWellData;
|
||||
caf::PdmField<bool> importSummaryData;
|
||||
|
||||
static std::shared_ptr<RifReaderSettings> createGridOnlyReaderSettings();
|
||||
|
||||
private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
bool importFaults;
|
||||
bool importNNCs;
|
||||
bool includeInactiveCellsInFaultGeometry;
|
||||
bool importAdvancedMswData;
|
||||
bool useResultIndexFile;
|
||||
bool skipWellData;
|
||||
bool importSummaryData;
|
||||
QString includeFileAbsolutePathPrefix;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user