mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
Removes ensemble summary import mode as separate cases import is not supported. Simplifies the UI by removing the ensemble import option, and updates the logic to handle summary import mode correctly by only supporting skip or unified imports. If separated cases is required for a single summary case, this can be activated by using the import dialog. Adds logic to initialize after read to ensure that if SummaryImportMode is SEPARATE_CASES, it changes to NOT_IMPORT.
347 lines
14 KiB
C++
347 lines
14 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2024 - 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 "RiaPreferencesGrid.h"
|
|
|
|
#include "RiaApplication.h"
|
|
#include "RiaLogging.h"
|
|
#include "RiaPreferences.h"
|
|
#include "RiaPreferencesSummary.h"
|
|
#include "RiaPreferencesSystem.h"
|
|
|
|
#include "RifReaderSettings.h"
|
|
|
|
#include "cafPdmUiCheckBoxEditor.h"
|
|
|
|
CAF_PDM_SOURCE_INIT( RiaPreferencesGrid, "RifReaderSettings" );
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RiaPreferencesGrid::RiaPreferencesGrid()
|
|
: m_gridModelReaderOverride( RiaDefines::GridModelReader::NOT_SET )
|
|
{
|
|
CAF_PDM_InitObject( "RiaPreferencesGrid" );
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_gridModelReader, "gridModelReader", "Model Reader" );
|
|
m_gridModelReader = RiaDefines::GridModelReader::RESDATA;
|
|
|
|
CAF_PDM_InitField( &m_importFaults, "importFaults", true, "Import Faults" );
|
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_importFaults );
|
|
|
|
CAF_PDM_InitField( &m_importNNCs, "importSimulationNNCs", true, "Import NNCs" );
|
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_importNNCs );
|
|
|
|
CAF_PDM_InitField( &m_includeInactiveCellsInFaultGeometry,
|
|
"includeInactiveCellsInFaultGeometry",
|
|
false,
|
|
"Include Inactive Cells in Fault Geometry" );
|
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_includeInactiveCellsInFaultGeometry );
|
|
|
|
CAF_PDM_InitField( &m_importAdvancedMswData, "importAdvancedMswData", true, "Import Advanced MSW Data" );
|
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_importAdvancedMswData );
|
|
|
|
CAF_PDM_InitField( &m_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( &m_useResultIndexFile );
|
|
|
|
CAF_PDM_InitField( &m_skipWellData, "skipWellData", false, "Skip Import of Simulation Well Data" );
|
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_skipWellData );
|
|
|
|
CAF_PDM_InitField( &m_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( &m_autoComputeDepthRelatedProperties,
|
|
"autocomputeDepth",
|
|
true,
|
|
"Compute DEPTH Related Properties",
|
|
"",
|
|
"DEPTH, DX, DY, DZ, TOP, BOTTOM",
|
|
"" );
|
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_autoComputeDepthRelatedProperties );
|
|
|
|
CAF_PDM_InitField( &m_loadAndShowSoil, "loadAndShowSoil", true, "Load and Show SOIL" );
|
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_loadAndShowSoil );
|
|
|
|
CAF_PDM_InitField( &m_onlyLoadActiveCells, "onlyLoadActiveCells", false, "Only Load Active Cell Geometry" );
|
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_onlyLoadActiveCells );
|
|
|
|
CAF_PDM_InitField( &m_invalidateLongThinCells, "invalidateLongThinCells", false, "Skip Long, Thin Cells" );
|
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_invalidateLongThinCells );
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_radialGridMode, "radialGridMode", "Radial Grid Display Mode" );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RiaPreferencesGrid* RiaPreferencesGrid::current()
|
|
{
|
|
return RiaApplication::instance()->preferences()->gridPreferences();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiaPreferencesGrid::appendItems( caf::PdmUiOrdering& uiOrdering )
|
|
{
|
|
auto newCBGroup = uiOrdering.addNewGroup( "Behavior When Loading Data" );
|
|
newCBGroup->add( &m_autoComputeDepthRelatedProperties );
|
|
newCBGroup->add( &m_loadAndShowSoil );
|
|
newCBGroup->add( &m_invalidateLongThinCells );
|
|
|
|
if ( auto prefSummary = RiaPreferencesSummary::current() )
|
|
{
|
|
prefSummary->appendGridFields( *newCBGroup );
|
|
}
|
|
|
|
auto faultGrp = uiOrdering.addNewGroup( "Fault Import" );
|
|
|
|
faultGrp->add( &m_importFaults );
|
|
faultGrp->add( &m_includeInactiveCellsInFaultGeometry );
|
|
#ifdef WIN32
|
|
faultGrp->add( &m_includeFileAbsolutePathPrefix );
|
|
#endif
|
|
faultGrp->add( &m_importNNCs );
|
|
|
|
auto wellGrp = uiOrdering.addNewGroup( "Well Import" );
|
|
|
|
wellGrp->add( &m_skipWellData );
|
|
wellGrp->add( &m_importAdvancedMswData );
|
|
|
|
auto egridGrp = uiOrdering.addNewGroup( "EGRID Settings" );
|
|
|
|
if ( m_gridModelReaderOverride == RiaDefines::GridModelReader::NOT_SET )
|
|
{
|
|
egridGrp->add( &m_gridModelReader );
|
|
}
|
|
if ( gridModelReader() == RiaDefines::GridModelReader::OPM_COMMON )
|
|
{
|
|
egridGrp->add( &m_onlyLoadActiveCells );
|
|
}
|
|
if ( gridModelReader() == RiaDefines::GridModelReader::RESDATA )
|
|
{
|
|
egridGrp->add( &m_useResultIndexFile );
|
|
}
|
|
|
|
egridGrp->add( &m_radialGridMode );
|
|
|
|
const bool setFaultImportSettingsReadOnly = !importFaults();
|
|
|
|
m_includeInactiveCellsInFaultGeometry.uiCapability()->setUiReadOnly( setFaultImportSettingsReadOnly );
|
|
m_includeFileAbsolutePathPrefix.uiCapability()->setUiReadOnly( setFaultImportSettingsReadOnly );
|
|
m_importNNCs.uiCapability()->setUiReadOnly( setFaultImportSettingsReadOnly );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RifReaderSettings RiaPreferencesGrid::gridOnlyReaderSettings()
|
|
{
|
|
// Use the default settings, as they disable most options
|
|
return {};
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RifReaderSettings RiaPreferencesGrid::readerSettings()
|
|
{
|
|
RifReaderSettings rs{ .importFaults = m_importFaults,
|
|
.importNNCs = m_importNNCs,
|
|
.includeInactiveCellsInFaultGeometry = m_includeInactiveCellsInFaultGeometry,
|
|
.importAdvancedMswData = m_importAdvancedMswData,
|
|
.skipWellData = m_skipWellData,
|
|
.importSummaryData = true,
|
|
.includeFileAbsolutePathPrefix = m_includeFileAbsolutePathPrefix,
|
|
.onlyLoadActiveCells = m_onlyLoadActiveCells,
|
|
.invalidateLongThinCells = m_invalidateLongThinCells,
|
|
.useCylindricalCoordinates = m_radialGridMode == RiaGridDefines::RadialGridMode::CYLINDRICAL,
|
|
.minimumAngularCellCount = RiaPreferencesSystem::current()->minimumAngularCellCount()
|
|
|
|
};
|
|
return rs;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RiaPreferencesGrid::importFaults() const
|
|
{
|
|
return m_importFaults;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RiaPreferencesGrid::importNNCs() const
|
|
{
|
|
return m_importNNCs;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RiaPreferencesGrid::includeInactiveCellsInFaultGeometry() const
|
|
{
|
|
return m_includeInactiveCellsInFaultGeometry;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RiaPreferencesGrid::importAdvancedMswData() const
|
|
{
|
|
return m_importAdvancedMswData;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
QString RiaPreferencesGrid::includeFileAbsolutePathPrefix() const
|
|
{
|
|
return m_includeFileAbsolutePathPrefix;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RiaPreferencesGrid::useResultIndexFile() const
|
|
{
|
|
return m_useResultIndexFile;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RiaPreferencesGrid::skipWellData() const
|
|
{
|
|
return m_skipWellData;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RiaPreferencesGrid::loadAndShowSoil() const
|
|
{
|
|
return m_loadAndShowSoil;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RiaPreferencesGrid::autoComputeDepthRelatedProperties() const
|
|
{
|
|
return m_autoComputeDepthRelatedProperties;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RiaPreferencesGrid::onlyLoadActiveCells() const
|
|
{
|
|
return m_onlyLoadActiveCells;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RiaPreferencesGrid::invalidateLongThinCells() const
|
|
{
|
|
return m_invalidateLongThinCells;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RiaDefines::GridModelReader RiaPreferencesGrid::gridModelReader() const
|
|
{
|
|
if ( m_gridModelReaderOverride != RiaDefines::GridModelReader::NOT_SET )
|
|
{
|
|
return m_gridModelReaderOverride;
|
|
}
|
|
|
|
return m_gridModelReader();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiaPreferencesGrid::setGridModelReaderOverride( const std::string& readerName )
|
|
{
|
|
RiaDefines::GridModelReader readerType = RiaDefines::GridModelReader::NOT_SET;
|
|
if ( readerName == "opm_common" )
|
|
{
|
|
readerType = RiaDefines::GridModelReader::OPM_COMMON;
|
|
}
|
|
else if ( readerName == "resdata" )
|
|
{
|
|
readerType = RiaDefines::GridModelReader::RESDATA;
|
|
}
|
|
else
|
|
{
|
|
RiaLogging::warning( QString::fromStdString( "Unknown EGRID reader type specified on command line: " + readerName ) );
|
|
return;
|
|
}
|
|
|
|
if ( readerType != RiaDefines::GridModelReader::NOT_SET )
|
|
{
|
|
RiaLogging::info( QString::fromStdString( "Using EGRID reader: " + readerName ) );
|
|
}
|
|
|
|
m_gridModelReaderOverride = readerType;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiaPreferencesGrid::setGridModelReaderOverride( const RiaDefines::GridModelReader readerType )
|
|
{
|
|
m_gridModelReaderOverride = readerType;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RiaDefines::GridModelReader RiaPreferencesGrid::gridModelReaderOverride() const
|
|
{
|
|
return m_gridModelReaderOverride;
|
|
}
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RiaGridDefines::RadialGridMode RiaPreferencesGrid::radialGridMode() const
|
|
{
|
|
return m_radialGridMode();
|
|
}
|