Merge remote-tracking branch 'origin/2018.01.01-patch' into dev

This commit is contained in:
Magne Sjaastad 2018-01-29 10:09:54 +01:00
commit 71deeb8954
3 changed files with 29 additions and 5 deletions

View File

@ -251,8 +251,7 @@ void RifEclipseRestartFilesetAccess::readWellData(well_info_type* well_info, boo
if (m_ecl_files[i]) if (m_ecl_files[i])
{ {
const char* fileName = ecl_file_get_src_file(m_ecl_files[i]); int reportNumber = RifEclipseRestartFilesetAccess::reportNumber(m_ecl_files[i]);
int reportNumber = ecl_util_filename_report_nr(fileName);
if(reportNumber != -1) if(reportNumber != -1)
{ {
well_info_add_wells(well_info, m_ecl_files[i], reportNumber, importCompleteMswData); well_info_add_wells(well_info, m_ecl_files[i], reportNumber, importCompleteMswData);
@ -284,6 +283,23 @@ void RifEclipseRestartFilesetAccess::openTimeStep(size_t timeStep)
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RifEclipseRestartFilesetAccess::reportNumber(const ecl_file_type* ecl_file)
{
if (!ecl_file) return -1;
const char* eclFileName = ecl_file_get_src_file(ecl_file);
QString fileNameUpper(eclFileName);
fileNameUpper = fileNameUpper.toUpper();
// Convert to upper case, as ecl_util_filename_report_nr does not handle lower case file extensions
int reportNumber = ecl_util_filename_report_nr(fileNameUpper.toAscii().data());
return reportNumber;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -319,9 +335,11 @@ std::vector<int> RifEclipseRestartFilesetAccess::reportNumbers()
{ {
if (ecl_file) if (ecl_file)
{ {
const char* fileName = ecl_file_get_src_file(ecl_file); int reportNumber = RifEclipseRestartFilesetAccess::reportNumber(ecl_file);
int reportNumber = ecl_util_filename_report_nr(fileName); if (reportNumber != -1)
reportNr.push_back(reportNumber); {
reportNr.push_back(reportNumber);
}
} }
} }

View File

@ -58,6 +58,7 @@ public:
private: private:
void openTimeStep(size_t timeStep); void openTimeStep(size_t timeStep);
static int reportNumber(const ecl_file_type* ecl_file);
private: private:
QStringList m_fileNames; QStringList m_fileNames;

View File

@ -50,6 +50,11 @@ private:
template <typename StatisticsAccumulator> template <typename StatisticsAccumulator>
void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex) void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex)
{ {
if (timeStepIndex >= m_resultsData->cellScalarResults(m_scalarResultIndex).size())
{
return;
}
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
if (values.empty()) if (values.empty())