Restart files. Fix bug during import of grid summary cases

This commit is contained in:
Bjørn Erik Jensen 2018-04-09 10:53:51 +02:00
parent e4ef9bd014
commit c69b558ff8

View File

@ -20,6 +20,7 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiaPreferences.h" #include "RiaPreferences.h"
#include "RiaFilePathTools.h"
#include "RicSummaryCaseRestartDialog.h" #include "RicSummaryCaseRestartDialog.h"
@ -117,28 +118,36 @@ std::vector<RifSummaryCaseFileInfo> RifSummaryCaseRestartSelector::getFilesToImp
std::vector<RifSummaryCaseFileInfo> RifSummaryCaseRestartSelector::getFilesToImportUsingPrefs(const QStringList& initialFiles, std::vector<RifSummaryCaseFileInfo> RifSummaryCaseRestartSelector::getFilesToImportUsingPrefs(const QStringList& initialFiles,
RiaPreferences::SummaryRestartFilesImportModeType summaryRestartMode) RiaPreferences::SummaryRestartFilesImportModeType summaryRestartMode)
{ {
std::set<RifSummaryCaseFileInfo> filesToImport; std::vector<RifSummaryCaseFileInfo> filesToImport;
RicSummaryCaseRestartDialogResult lastResult; RicSummaryCaseRestartDialogResult lastResult;
for (const QString& file : initialFiles) for (const QString& initialFile : initialFiles)
{ {
QString file = RiaFilePathTools::toInternalSeparator(initialFile);
if (summaryRestartMode == RiaPreferences::IMPORT) if (summaryRestartMode == RiaPreferences::IMPORT)
{ {
filesToImport.insert(RifSummaryCaseFileInfo(file, true)); filesToImport.push_back(RifSummaryCaseFileInfo(file, true));
} }
else if (summaryRestartMode == RiaPreferences::NOT_IMPORT) else if (summaryRestartMode == RiaPreferences::NOT_IMPORT)
{ {
filesToImport.insert(RifSummaryCaseFileInfo(file, false)); filesToImport.push_back(RifSummaryCaseFileInfo(file, false));
} }
else if (summaryRestartMode == RiaPreferences::SEPARATE_CASES) else if (summaryRestartMode == RiaPreferences::SEPARATE_CASES)
{ {
filesToImport.insert(RifSummaryCaseFileInfo(file, false)); filesToImport.push_back(RifSummaryCaseFileInfo(file, false));
RifReaderEclipseSummary reader; RifReaderEclipseSummary reader;
std::vector<RifRestartFileInfo> restartFileInfos = reader.getRestartFiles(file); std::vector<RifRestartFileInfo> restartFileInfos = reader.getRestartFiles(file);
for (const auto& fi : restartFileInfos) for (const auto& rfi : restartFileInfos)
filesToImport.insert(RifSummaryCaseFileInfo(fi.fileName, false)); {
RifSummaryCaseFileInfo fi(rfi.fileName, false);
if (!vectorContains(filesToImport, fi))
{
filesToImport.push_back(fi);
}
}
} }
} }
return std::vector<RifSummaryCaseFileInfo>(filesToImport.begin(), filesToImport.end()); return filesToImport;
} }