static void well_state_add_LGR_connections( well_state_type * well_state , const ecl_grid_type * grid , ecl_file_type * ecl_file, int global_well_nr ) { // Go through all the LGRs and add connections; both in the bulk // grid and as wellhead. int num_lgr = ecl_grid_get_num_lgr( grid ); int lgr_index; for (lgr_index = 0; lgr_index < num_lgr; lgr_index++) { ecl_file_push_block( ecl_file ); // <-------------------------// { // ecl_file_subselect_block( ecl_file , LGR_KW , lgr_index ); // { // Restrict the file view const char * grid_name = ecl_grid_iget_lgr_name( grid , lgr_index ); // int well_nr = well_state_get_lgr_well_nr( well_state , ecl_file ); // to one LGR block. if (well_nr >= 0) // well_state_add_connections__( well_state , ecl_file , grid_name , lgr_index + 1, well_nr ); // } // } // ecl_file_pop_block( ecl_file ); // <-------------------------// } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector<int> RifEclipseUnifiedRestartFileAccess::reportNumbers() { std::vector<int> reportNr; // Taken from well_info_add_UNRST_wells int num_blocks = ecl_file_get_num_named_kw(m_ecl_file, SEQNUM_KW); int block_nr; for (block_nr = 0; block_nr < num_blocks; block_nr++) { ecl_file_push_block(m_ecl_file); // <------------------------------------------------------- { // ecl_file_subselect_block(m_ecl_file, SEQNUM_KW, block_nr); // Ensure that the status { // is not changed as a side const ecl_kw_type * seqnum_kw = ecl_file_iget_named_kw(m_ecl_file, SEQNUM_KW, 0); // effect. int report_nr = ecl_kw_iget_int(seqnum_kw, 0); // reportNr.push_back(report_nr); } // } // ecl_file_pop_block(m_ecl_file); // <------------------------------------------------------- } return reportNr; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- 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); } } } }