#4927 Blind attempt at improving reliability of smspec import

This commit is contained in:
Gaute Lindkvist 2019-11-07 15:59:37 +01:00
parent dc2af5e0c8
commit 285433cbb8
2 changed files with 18 additions and 2 deletions

View File

@ -173,6 +173,8 @@ std::vector<RifRestartFileInfo> RifReaderEclipseSummary::getRestartFiles( const
m_warnings.clear();
*hasWarnings = false;
std::set<QString> restartFilesOpened;
RifRestartFileInfo currFile;
currFile.fileName = headerFileName;
while ( !currFile.fileName.isEmpty() )
@ -216,6 +218,12 @@ std::vector<RifRestartFileInfo> RifReaderEclipseSummary::getRestartFiles( const
*hasWarnings = true;
break;
}
else if ( restartFilesOpened.count( currFile.fileName ) != 0u )
{
m_warnings.push_back( "RifReaderEclipseSummary: Same restart file being opened multiple times" );
*hasWarnings = true;
}
restartFilesOpened.insert( currFile.fileName );
}
if ( !currFile.fileName.isEmpty() ) restartFiles.push_back( currFile );

View File

@ -1230,8 +1230,16 @@ ecl_smspec_type * ecl_smspec_fread_alloc(const char *header_file, const char * k
const ecl::smspec_node * day_node = ecl_smspec_get_var_node(ecl_smspec->misc_var_index, "DAY");
if (day_node != NULL) {
ecl_smspec->day_index = smspec_node_get_params_index( day_node );
ecl_smspec->month_index = smspec_node_get_params_index( &ecl_smspec->misc_var_index["MONTH"] );
ecl_smspec->year_index = smspec_node_get_params_index( &ecl_smspec->misc_var_index["YEAR"] );
const ecl::smspec_node * month_node = ecl_smspec_get_var_node(ecl_smspec->misc_var_index, "MONTH");
if (month_node != NULL) {
ecl_smspec->month_index = smspec_node_get_params_index( month_node );
}
const ecl::smspec_node * year_node = ecl_smspec_get_var_node(ecl_smspec->misc_var_index, "YEAR");
if (year_node != NULL) {
ecl_smspec->year_index = smspec_node_get_params_index( year_node );
}
}
if ((ecl_smspec->time_index == -1) && ( ecl_smspec->day_index == -1)) {