mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-30 09:00:20 -05:00
#13062 Make search for restart header file more robust
Refactors restart file name retrieval to use preferences for reader mode. Simplifies logic by removing separate OPM-specific retrieval methods, and instead uses a unified method that dynamically selects the appropriate reader based on user preferences. Adds fallback mechanism to read restart file paths from SMSPEC files when the RESTART keyword is missing in ESMRY files generated by ResInsight. Corrects path handling for restart files by adjusting paths relative to the header file.
This commit is contained in:
1 parent
3271cb7e1a
commit
a693aa6d09
16 files changed
+128
-39
No files matched your search
@@ -175,28 +175,19 @@ std::unique_ptr<RifSummaryReaderInterface> RimFileSummaryCase::findRelatedFilesA
|
||||
|
||||
auto findFileCandidates = [&ensembleImportState, &headerFileName, &warnings] -> std::vector<QString>
|
||||
{
|
||||
if ( RiaPreferencesSummary::current()->summaryDataReader() == RiaPreferencesSummary::SummaryReaderMode::OPM_COMMON )
|
||||
if ( ( RiaPreferencesSummary::current()->summaryDataReader() == RiaPreferencesSummary::SummaryReaderMode::OPM_COMMON ) &&
|
||||
ensembleImportState.useConfigValues() )
|
||||
{
|
||||
if ( ensembleImportState.useConfigValues() )
|
||||
auto realizationNumber = RifOpmSummaryTools::extractRealizationNumber( headerFileName );
|
||||
if ( !realizationNumber.has_value() )
|
||||
{
|
||||
auto realizationNumber = RifOpmSummaryTools::extractRealizationNumber( headerFileName );
|
||||
if ( !realizationNumber.has_value() )
|
||||
{
|
||||
RiaLogging::error( realizationNumber.error() );
|
||||
return {};
|
||||
}
|
||||
return ensembleImportState.restartFilesForRealization( realizationNumber.value() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the restart file names are not provided, we search for them
|
||||
return RifEclipseSummaryTools::getRestartFileNamesOpm( headerFileName, warnings );
|
||||
RiaLogging::error( realizationNumber.error() );
|
||||
return {};
|
||||
}
|
||||
return ensembleImportState.restartFilesForRealization( realizationNumber.value() );
|
||||
}
|
||||
else
|
||||
{
|
||||
return RifEclipseSummaryTools::getRestartFileNames( headerFileName, warnings );
|
||||
}
|
||||
|
||||
return RifEclipseSummaryTools::getRestartFileNames( headerFileName, warnings );
|
||||
};
|
||||
|
||||
std::vector<QString> restartFileNames;
|
||||
|
||||
Reference in new issue
Block a user