void ecl_file_kw_fwrite( const ecl_file_kw_type * file_kw , FILE * stream ) { int header_length = strlen( file_kw->header ); for (int i=0; i < ECL_STRING8_LENGTH; i++) { if (i < header_length) fputc( file_kw->header[i], stream ); else fputc( ' ' , stream ); } util_fwrite_int( file_kw->kw_size , stream ); util_fwrite_offset( file_kw->file_offset , stream ); util_fwrite_int( ecl_type_get_type( file_kw->data_type ) , stream ); util_fwrite_size_t( ecl_type_get_sizeof_iotype( file_kw->data_type ) , stream ); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RifEclipseOutputFileTools::createReportStepsMetaData(std::vector<ecl_file_type*> ecl_files, std::vector<RifRestartReportStep>* reportSteps) { if (!reportSteps) return; for (auto ecl_file : ecl_files) { if (!ecl_file) continue; int reportStepCount = ecl_file_get_num_named_kw(ecl_file, INTEHEAD_KW); for (int reportStepIndex = 0; reportStepIndex < reportStepCount; reportStepIndex++) { ecl_file_view_type* rst_view = ecl_file_get_global_view(ecl_file); if (!rst_view) continue; ecl_rsthead_type* restart_header = ecl_rsthead_alloc(rst_view, reportStepIndex); if (restart_header) { ecl_file_push_block(ecl_file); { ecl_file_select_block(ecl_file, INTEHEAD_KW, reportStepIndex); RifRestartReportStep reportStep; // Set Date { QDateTime reportDateTime(QDate(restart_header->year, restart_header->month, restart_header->day)); reportStep.dateTime = reportDateTime; } // Find number of keywords withing this report step int numKeywords = ecl_file_get_num_distinct_kw(ecl_file); for (int iKey = 0; iKey < numKeywords; iKey++) { const char* kw = ecl_file_iget_distinct_kw(ecl_file, iKey); int namedKeywordCount = ecl_file_get_num_named_kw(ecl_file, kw); for (int iOcc = 0; iOcc < namedKeywordCount; iOcc++) { ecl_data_type dataType = ecl_file_iget_named_data_type(ecl_file, kw, iOcc); ecl_type_enum dataTypeEmum = ecl_type_get_type(dataType); if (dataTypeEmum != ECL_DOUBLE_TYPE && dataTypeEmum != ECL_FLOAT_TYPE && dataTypeEmum != ECL_INT_TYPE) { continue; } int itemCount = ecl_file_iget_named_size(ecl_file, kw, iOcc); reportStep.m_keywords.appendKeyword(kw, itemCount, iOcc); } } reportSteps->push_back(reportStep); } ecl_file_pop_block(ecl_file); ecl_rsthead_free(restart_header); } } } }