From c1dd40ab33d9a9e68d55a8edc90ff9309b98fa27 Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Wed, 14 Aug 2024 09:14:25 +0200 Subject: [PATCH 1/5] Remove unused functions in rd_rft_cell --- lib/include/resdata/rd_rft_cell.hpp | 4 ---- lib/resdata/rd_rft_cell.cpp | 15 ++------------- lib/resdata/tests/rd_rft_cell.cpp | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/lib/include/resdata/rd_rft_cell.hpp b/lib/include/resdata/rd_rft_cell.hpp index 0009d19b4..a7e546038 100644 --- a/lib/include/resdata/rd_rft_cell.hpp +++ b/lib/include/resdata/rd_rft_cell.hpp @@ -23,7 +23,6 @@ rd_rft_cell_type *rd_rft_cell_alloc_RFT(int i, int j, int k, double depth, double pressure, double swat, double sgas); void rd_rft_cell_free(rd_rft_cell_type *cell); -void rd_rft_cell_free__(void *arg); bool rd_rft_cell_ijk_equal(const rd_rft_cell_type *cell, int i, int j, int k); void rd_rft_cell_get_ijk(const rd_rft_cell_type *cell, int *i, int *j, int *k); @@ -47,9 +46,6 @@ double rd_rft_cell_get_oil_flowrate(const rd_rft_cell_type *cell); double rd_rft_cell_get_gas_flowrate(const rd_rft_cell_type *cell); double rd_rft_cell_get_water_flowrate(const rd_rft_cell_type *cell); -int rd_rft_cell_cmp__(const void *arg1, const void *arg2); -int rd_rft_cell_cmp(const rd_rft_cell_type *cell1, - const rd_rft_cell_type *cell2); bool rd_rft_cell_lt(const rd_rft_cell_type *cell1, const rd_rft_cell_type *cell2); #ifdef __cplusplus diff --git a/lib/resdata/rd_rft_cell.cpp b/lib/resdata/rd_rft_cell.cpp index 0e1053b04..56c82de1a 100644 --- a/lib/resdata/rd_rft_cell.cpp +++ b/lib/resdata/rd_rft_cell.cpp @@ -149,11 +149,6 @@ void rd_rft_cell_free(rd_rft_cell_type *cell) { free(cell); } -void rd_rft_cell_free__(void *arg) { - rd_rft_cell_type *cell = rd_rft_cell_safe_cast(arg); - rd_rft_cell_free(cell); -} - int rd_rft_cell_get_i(const rd_rft_cell_type *cell) { return cell->i; } int rd_rft_cell_get_j(const rd_rft_cell_type *cell) { return cell->j; } @@ -277,8 +272,8 @@ bool rd_rft_cell_ijk_equal(const rd_rft_cell_type *cell, int i, int j, int k) { /* Currently only comparison based on connection length along PLT is supported. */ -int rd_rft_cell_cmp(const rd_rft_cell_type *cell1, - const rd_rft_cell_type *cell2) { +static int rd_rft_cell_cmp(const rd_rft_cell_type *cell1, + const rd_rft_cell_type *cell2) { double val1 = rd_rft_cell_get_connection_start(cell1); double val2 = rd_rft_cell_get_connection_start(cell2); @@ -290,12 +285,6 @@ int rd_rft_cell_cmp(const rd_rft_cell_type *cell1, return 1; } -int rd_rft_cell_cmp__(const void *arg1, const void *arg2) { - const rd_rft_cell_type *cell1 = rd_rft_cell_safe_cast_const(arg1); - const rd_rft_cell_type *cell2 = rd_rft_cell_safe_cast_const(arg2); - return rd_rft_cell_cmp(cell1, cell2); -} - bool rd_rft_cell_lt(const rd_rft_cell_type *cell1, const rd_rft_cell_type *cell2) { return (rd_rft_cell_cmp(cell1, cell2) < 0); diff --git a/lib/resdata/tests/rd_rft_cell.cpp b/lib/resdata/tests/rd_rft_cell.cpp index cc4a02a26..ab2f1d9c4 100644 --- a/lib/resdata/tests/rd_rft_cell.cpp +++ b/lib/resdata/tests/rd_rft_cell.cpp @@ -66,7 +66,7 @@ void test_rft_cell() { test_assert_true(rd_rft_cell_ijk_equal(cell, i, j, k)); test_assert_false(rd_rft_cell_ijk_equal(cell, i, j, k + 1)); - rd_rft_cell_free__(cell); + rd_rft_cell_free(cell); } } From 6cb59eb70dcf26e6c6b9c5cf1e7e49dae3ae7385 Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Wed, 14 Aug 2024 09:54:21 +0200 Subject: [PATCH 2/5] Remove unused functions in rd_file.cpp --- lib/include/resdata/rd_file.hpp | 45 ---- lib/resdata/rd_file.cpp | 284 +-------------------- lib/resdata/tests/rd_file.cpp | 2 - lib/resdata/tests/rd_file_equinor.cpp | 20 -- python/tests/rd_tests/test_indexed_read.py | 135 ---------- 5 files changed, 13 insertions(+), 473 deletions(-) delete mode 100644 python/tests/rd_tests/test_indexed_read.py diff --git a/lib/include/resdata/rd_file.hpp b/lib/include/resdata/rd_file.hpp index 24bf254c4..9f073174a 100644 --- a/lib/include/resdata/rd_file.hpp +++ b/lib/include/resdata/rd_file.hpp @@ -30,49 +30,24 @@ bool rd_file_write_index(const rd_file_type *rd_file, const char *index_filename); bool rd_file_index_valid(const char *file_name, const char *index_file_name); void rd_file_close(rd_file_type *rd_file); -void rd_file_fortio_detach(rd_file_type *rd_file); -void rd_file_free__(void *arg); -rd_kw_type *rd_file_icopy_named_kw(const rd_file_type *rd_file, const char *kw, - int ith); rd_kw_type *rd_file_icopy_kw(const rd_file_type *rd_file, int index); bool rd_file_has_kw(const rd_file_type *rd_file, const char *kw); int rd_file_get_num_named_kw(const rd_file_type *rd_file, const char *kw); int rd_file_get_size(const rd_file_type *rd_file); -int rd_file_get_num_distinct_kw(const rd_file_type *rd_file); -const char *rd_file_iget_distinct_kw(const rd_file_type *rd_file, int index); const char *rd_file_get_src_file(const rd_file_type *rd_file); -int rd_file_iget_occurence(const rd_file_type *rd_file, int index); rd_version_enum rd_file_get_rd_version(const rd_file_type *file); void rd_file_fwrite_fortio(const rd_file_type *ec_file, fortio_type *fortio, int offset); void rd_file_fwrite(const rd_file_type *rd_file, const char *, bool fmt_file); -void rd_file_replace_kw(rd_file_type *rd_file, rd_kw_type *old_kw, - rd_kw_type *new_kw, bool insert_copy); int rd_file_get_phases(const rd_file_type *init_file); -void rd_file_fprintf_kw_list(const rd_file_type *rd_file, FILE *stream); bool rd_file_writable(const rd_file_type *rd_file); -int rd_file_get_flags(const rd_file_type *rd_file); -void rd_file_set_flags(rd_file_type *rd_file, int new_flags); bool rd_file_flags_set(const rd_file_type *rd_file, int flags); -rd_file_kw_type *rd_file_iget_file_kw(const rd_file_type *file, - int global_index); -rd_file_kw_type *rd_file_iget_named_file_kw(const rd_file_type *file, - const char *kw, int ith); rd_kw_type *rd_file_iget_kw(const rd_file_type *file, int global_index); -rd_data_type rd_file_iget_data_type(const rd_file_type *file, int global_index); -int rd_file_iget_size(const rd_file_type *file, int global_index); -const char *rd_file_iget_header(const rd_file_type *file, int global_index); rd_kw_type *rd_file_iget_named_kw(const rd_file_type *file, const char *kw, int ith); -rd_data_type rd_file_iget_named_data_type(const rd_file_type *file, - const char *kw, int ith); -int rd_file_iget_named_size(const rd_file_type *file, const char *kw, int ith); -void rd_file_indexed_read(const rd_file_type *file, const char *kw, int index, - const int_vector_type *index_map, char *buffer); - rd_file_view_type *rd_file_get_global_blockview(rd_file_type *rd_file, const char *kw, int occurence); rd_file_view_type *rd_file_alloc_global_blockview(rd_file_type *rd_file, @@ -80,9 +55,7 @@ rd_file_view_type *rd_file_alloc_global_blockview(rd_file_type *rd_file, int occurence); rd_file_view_type *rd_file_get_global_view(rd_file_type *rd_file); rd_file_view_type *rd_file_get_active_view(rd_file_type *rd_file); -//bool rd_file_writable( const rd_file_type * rd_file ); bool rd_file_save_kw(const rd_file_type *rd_file, const rd_kw_type *rd_kw); -bool rd_file_has_kw_ptr(const rd_file_type *rd_file, const rd_kw_type *rd_kw); double rd_file_iget_restart_sim_days(const rd_file_type *restart_file, int index); @@ -93,8 +66,6 @@ int rd_file_get_restart_index(const rd_file_type *restart_file, bool rd_file_has_report_step(const rd_file_type *rd_file, int report_step); bool rd_file_has_sim_time(const rd_file_type *rd_file, time_t sim_time); -void rd_file_close_fortio_stream(rd_file_type *rd_file); - rd_file_view_type *rd_file_get_restart_view(rd_file_type *rd_file, int input_index, int report_step, time_t sim_time, double sim_days); @@ -103,24 +74,8 @@ rd_file_view_type *rd_file_get_summary_view(rd_file_type *rd_file, UTIL_IS_INSTANCE_HEADER(rd_file); -//Deprecated: - -void rd_file_push_block(rd_file_type *rd_file); -void rd_file_pop_block(rd_file_type *rd_file); bool rd_file_subselect_block(rd_file_type *rd_file, const char *kw, int occurence); -bool rd_file_select_block(rd_file_type *rd_file, const char *kw, int occurence); - -bool rd_file_select_rstblock_sim_time(rd_file_type *rd_file, time_t sim_time); -bool rd_file_select_rstblock_report_step(rd_file_type *rd_file, - int report_step); -bool rd_file_iselect_rstblock(rd_file_type *rd_file, int seqnum_index); -rd_file_type *rd_file_open_rstblock_report_step(const char *filename, - int report_step, int flags); -rd_file_type *rd_file_open_rstblock_sim_time(const char *filename, - time_t sim_time, int flags); -rd_file_type *rd_file_iopen_rstblock(const char *filename, int seqnum_index, - int flags); #ifdef __cplusplus } diff --git a/lib/resdata/rd_file.cpp b/lib/resdata/rd_file.cpp index 8c89f40bc..61052dd5e 100644 --- a/lib/resdata/rd_file.cpp +++ b/lib/resdata/rd_file.cpp @@ -137,7 +137,6 @@ struct rd_file_struct { kw_index = {"SEQHDR": [0], "MINISTEP": [1,3,5], "PARAMS": [2,4,6]} <== This is hash table. kw_list = [SEQHDR , MINISTEP , PARAMS , MINISTEP , PARAMS , MINISTEP , PARAMS] - distinct_kw = [SEQHDR , MINISTEP , PARAMS] */ @@ -194,80 +193,8 @@ void rd_file_fwrite(const rd_file_type *rd_file, const char *filename, input, and returns the corresponding rd_kw instance - without considering which keyword it is. - ------- - - In addition the functions rd_file_get_num_distinct_kw() and - rd_file_iget_distinct_kw() will return the number of distinct - keywords, and distinct keyword keyword nr i (as a const char *). - - - Possible usage pattern: - - .... - for (ikw = 0; ikw < rd_file_get_num_distinct_kw(rd_file); ikw++) { - const char * kw = rd_file_iget_distinct_kw(rd_file , ikw); - - printf("The file contains: %d occurences of \'%s\' \n",rd_file_get_num_named_kw( rd_file , kw) , kw); - } - .... - - For the summary file showed in the top this code will produce: - - The file contains 1 occurences of 'SEQHDR' - The file contains 3 occurences of 'MINISTEP' - The file contains 3 occurences of 'PARAMS' - -*/ - -/** - This function will iterate through the rd_file instance and search - for the rd_kw instance @old_kw - the search is based on pointer - equality, i.e. the actual rd_kw instance, and not on content - equality. - - When @old_kw is found that keyword instance will be discarded with - rd_kw_free() and the new keyword @new_kw will be inserted. If - @old_kw can not be found the function will fail hard - to verify - that @new_kw is indeed in the rd_file instance you should use - rd_file_has_kw_ptr() first. - - The rd_file function typically gives out references to the - internal rd_kw instances via the rd_file_iget_kw() function. Use - of rd_file_replace_kw() might lead to invalidating rd_kw - instances held by the calling scope: - - - .... - rd_file_type * restart_file = rd_file_fread_alloc( "CASE.UNRST" ); - rd_kw_type * initial_pressure = rd_file_iget_named_kw( rd_file , "PRESSURE" , 0); - rd_kw_type * faked_pressure = rd_kw_alloc_copy( initial_pressure ); - - rd_kw_scale( faked_pressure , 1.25 ); - rd_file_replace_kw( restart_file , initial_pressure , faked_pressure , false ); <--- This call will invalidate the inital_pressure reference - .... - .... - // This will fail horribly: - printf("The initial pressure in cell(0) was:%g \n",rd_kw_iget_double( initial_pressure , 0 )); - /|\ - | - +---------> Using initial_pressure => Crash and burn! - - The rd_file structure takes ownership of all the keywords, and - will also take ownership of the newly instered @new_kw instance; if - the boolean @insert_copy is set to true the function will insert a - copy of @new_kw, leaving the original reference untouched. */ -void rd_file_replace_kw(rd_file_type *rd_file, rd_kw_type *old_kw, - rd_kw_type *new_kw, bool insert_copy) { - rd_file_view_replace_kw(rd_file->active_view, old_kw, new_kw, insert_copy); -} - -rd_kw_type *rd_file_icopy_named_kw(const rd_file_type *rd_file, const char *kw, - int ith) { - return rd_kw_alloc_copy(rd_file_iget_named_kw(rd_file, kw, ith)); -} - /* Will return the number of times a particular keyword occurs in a rd_file instance. Will return 0 if the keyword can not be found. @@ -277,29 +204,6 @@ int rd_file_get_num_named_kw(const rd_file_type *rd_file, const char *kw) { return rd_file_view_get_num_named_kw(rd_file->active_view, kw); } -/** - This function does the following: - - 1. Takes an input index which goes in to the global kw_list vector. - 2. Looks up the corresponding keyword. - 3. Return the number of this particular keyword instance, among - the other instance with the same header. - - With the example above we get: - - rd_file_iget_occurence(rd_file , 2) -> 0; Global index 2 will - look up the first occurence of PARAMS. - - rd_file_iget_occurence(rd_file , 5) -> 2; Global index 5 will - look up th third occurence of MINISTEP. - - The enkf layer uses this funny functionality. -*/ - -int rd_file_iget_occurence(const rd_file_type *rd_file, int index) { - return rd_file_view_iget_occurence(rd_file->active_view, index); -} - /** Returns the total number of rd_kw instances in the rd_file instance. @@ -316,49 +220,14 @@ bool rd_file_has_kw(const rd_file_type *rd_file, const char *kw) { return rd_file_view_has_kw(rd_file->active_view, kw); } -int rd_file_get_num_distinct_kw(const rd_file_type *rd_file) { - return rd_file_view_get_num_distinct_kw(rd_file->active_view); -} - -const char *rd_file_iget_distinct_kw(const rd_file_type *rd_file, int index) { - return rd_file_view_iget_distinct_kw(rd_file->active_view, index); -} - const char *rd_file_get_src_file(const rd_file_type *rd_file) { return fortio_filename_ref(rd_file->fortio); } -void rd_file_fprintf_kw_list(const rd_file_type *rd_file, FILE *stream) { - rd_file_view_fprintf_kw_list(rd_file->active_view, stream); -} - -rd_file_kw_type *rd_file_iget_file_kw(const rd_file_type *file, - int global_index) { - return rd_file_view_iget_file_kw(file->active_view, global_index); -} - -rd_file_kw_type *rd_file_iget_named_file_kw(const rd_file_type *file, - const char *kw, int ith) { - return rd_file_view_iget_named_file_kw(file->active_view, kw, ith); -} - rd_kw_type *rd_file_iget_kw(const rd_file_type *file, int global_index) { return rd_file_view_iget_kw(file->active_view, global_index); } -rd_data_type rd_file_iget_data_type(const rd_file_type *file, - int global_index) { - return rd_file_view_iget_data_type(file->active_view, global_index); -} - -int rd_file_iget_size(const rd_file_type *file, int global_index) { - return rd_file_view_iget_size(file->active_view, global_index); -} - -const char *rd_file_iget_header(const rd_file_type *file, int global_index) { - return rd_file_view_iget_header(file->active_view, global_index); -} - /* This function will return the ith occurence of 'kw' in rd_file. Will abort hard if the request can not be satisifed - use @@ -370,21 +239,6 @@ rd_kw_type *rd_file_iget_named_kw(const rd_file_type *file, const char *kw, return rd_file_view_iget_named_kw(file->active_view, kw, ith); } -void rd_file_indexed_read(const rd_file_type *file, const char *kw, int index, - const int_vector_type *index_map, char *buffer) { - rd_file_view_index_fload_kw(file->active_view, kw, index, index_map, - buffer); -} - -rd_data_type rd_file_iget_named_data_type(const rd_file_type *file, - const char *kw, int ith) { - return rd_file_view_iget_named_data_type(file->active_view, kw, ith); -} - -int rd_file_iget_named_size(const rd_file_type *file, const char *kw, int ith) { - return rd_file_view_iget_named_size(file->active_view, kw, ith); -} - rd_file_view_type *rd_file_get_global_view(rd_file_type *rd_file) { return rd_file->global_view; } @@ -401,10 +255,10 @@ rd_file_view_type *rd_file_get_global_blockview(rd_file_type *rd_file, return view; } -rd_file_view_type *rd_file_alloc_global_blockview2(rd_file_type *rd_file, - const char *start_kw, - const char *end_kw, - int occurence) { +static rd_file_view_type *rd_file_alloc_global_blockview2(rd_file_type *rd_file, + const char *start_kw, + const char *end_kw, + int occurence) { rd_file_view_type *view = rd_file_view_alloc_blockview2( rd_file->global_view, start_kw, end_kw, occurence); return view; @@ -483,7 +337,7 @@ static void rd_file_scan(rd_file_type *rd_file) { rd_file_view_make_index(rd_file->global_view); } -void rd_file_select_global(rd_file_type *rd_file) { +static void rd_file_select_global(rd_file_type *rd_file) { rd_file->active_view = rd_file->global_view; } @@ -532,16 +386,6 @@ rd_file_type *rd_file_open(const char *filename, int flags) { return NULL; } -int rd_file_get_flags(const rd_file_type *rd_file) { return rd_file->flags; } - -void rd_file_set_flags(rd_file_type *rd_file, int flags) { - rd_file->flags = flags; -} - -bool rd_file_flags_set(const rd_file_type *rd_file, int flags) { - return rd_file_view_check_flags(rd_file->flags, flags); -} - bool rd_file_writable(const rd_file_type *rd_file) { return rd_file_view_check_flags(rd_file->flags, RD_FILE_WRITABLE); } @@ -564,32 +408,10 @@ void rd_file_close(rd_file_type *rd_file) { free(rd_file); } -void rd_file_close_fortio_stream(rd_file_type *rd_file) { - if (rd_file->fortio != NULL) { - fortio_fclose_stream(rd_file->fortio); - } -} - -/** - This function will detach the current rd_file instance from the - underlying fortio instance. The rd_file instance can be used - further to access the rd_kw instances which have been loaded - already, but if you try on-demand loading of a keyword you will get - crash-and-burn. To ensure that all keywords are in memory you can - call rd_file_load_all() prior to the detach call. -*/ - -void rd_file_fortio_detach(rd_file_type *rd_file) { - fortio_fclose(rd_file->fortio); - rd_file->fortio = NULL; -} - bool rd_file_load_all(rd_file_type *rd_file) { return rd_file_view_load_all(rd_file->active_view); } -void rd_file_free__(void *arg) { rd_file_close(rd_file_safe_cast(arg)); } - /* Functions specialized to work with restart files. */ /* Query functions. */ @@ -728,31 +550,13 @@ bool rd_file_writable( const rd_file_type * rd_file ) { } */ -/** - Checks if the rd_file contains rd_kw; this check is based on - pointer equality - i.e. we check if the rd_file contains exactly - this keyword - not an arbitrary equivalent keyword. - - This function can be called as a safeguard before calling - rd_file_save_kw(). -*/ - -bool rd_file_has_kw_ptr(const rd_file_type *rd_file, const rd_kw_type *rd_kw) { - rd_file_kw_type *file_kw = inv_map_get_file_kw(rd_file->inv_view, rd_kw); - if (file_kw == NULL) - return false; - else - return true; -} - /* Will save the content of @rd_kw to the on-disk file wrapped by the rd_file instance. This function is quite strict: 1. The actual keyword which should be updated is identified using pointer comparison; i.e. the rd_kw argument must be the actual - return value from an earlier rd_file_get_kw() operation. To - check this you can call rd_file_has_kw_ptr(). + return value from an earlier rd_file_get_kw() operation. 2. The header data of the rd_kw must be unmodified; this is checked by the rd_file_kw_inplace_fwrite() function and crash-and-burn @@ -786,16 +590,6 @@ bool rd_file_save_kw(const rd_file_type *rd_file, const rd_kw_type *rd_kw) { } } -/* DEPRECATED */ -void rd_file_push_block(rd_file_type *rd_file) { - vector_append_ref(rd_file->map_stack, rd_file->active_view); -} - -void rd_file_pop_block(rd_file_type *rd_file) { - rd_file->active_view = - (rd_file_view_type *)vector_pop_back(rd_file->map_stack); -} - static rd_file_view_type *rd_file_get_relative_blockview(rd_file_type *rd_file, const char *kw, int occurence) { @@ -815,8 +609,8 @@ bool rd_file_subselect_block(rd_file_type *rd_file, const char *kw, return false; } -bool rd_file_select_block(rd_file_type *rd_file, const char *kw, - int occurence) { +static bool rd_file_select_block(rd_file_type *rd_file, const char *kw, + int occurence) { rd_file_view_type *blockmap = rd_file_get_global_blockview(rd_file, kw, occurence); if (blockmap != NULL) { @@ -830,11 +624,12 @@ bool rd_file_select_block(rd_file_type *rd_file, const char *kw, Will select restart block nr @seqnum_index - without considering report_steps or simulation time. */ -bool rd_file_iselect_rstblock(rd_file_type *rd_file, int seqnum_index) { +static bool rd_file_iselect_rstblock(rd_file_type *rd_file, int seqnum_index) { return rd_file_select_block(rd_file, SEQNUM_KW, seqnum_index); } -bool rd_file_select_rstblock_sim_time(rd_file_type *rd_file, time_t sim_time) { +static bool rd_file_select_rstblock_sim_time(rd_file_type *rd_file, + time_t sim_time) { int seqnum_index = rd_file_view_seqnum_index_from_sim_time(rd_file->global_view, sim_time); @@ -844,8 +639,8 @@ bool rd_file_select_rstblock_sim_time(rd_file_type *rd_file, time_t sim_time) { return false; } -bool rd_file_select_rstblock_report_step(rd_file_type *rd_file, - int report_step) { +static bool rd_file_select_rstblock_report_step(rd_file_type *rd_file, + int report_step) { int global_index = rd_file_view_find_kw_value(rd_file->global_view, SEQNUM_KW, &report_step); if (global_index >= 0) { @@ -856,59 +651,6 @@ bool rd_file_select_rstblock_report_step(rd_file_type *rd_file, return false; } -static rd_file_type *rd_file_open_rstblock_report_step__(const char *filename, - int report_step, - int flags) { - rd_file_type *rd_file = rd_file_open(filename, flags); - if (rd_file) { - if (!rd_file_select_rstblock_report_step(rd_file, report_step)) { - rd_file_close(rd_file); - rd_file = NULL; - } - } - return rd_file; -} - -rd_file_type *rd_file_open_rstblock_report_step(const char *filename, - int report_step, int flags) { - return rd_file_open_rstblock_report_step__(filename, report_step, flags); -} - -static rd_file_type *rd_file_open_rstblock_sim_time__(const char *filename, - time_t sim_time, - int flags) { - rd_file_type *rd_file = rd_file_open(filename, flags); - if (rd_file) { - if (!rd_file_select_rstblock_sim_time(rd_file, sim_time)) { - rd_file_close(rd_file); - rd_file = NULL; - } - } - return rd_file; -} - -rd_file_type *rd_file_open_rstblock_sim_time(const char *filename, - time_t sim_time, int flags) { - return rd_file_open_rstblock_sim_time__(filename, sim_time, flags); -} - -static rd_file_type *rd_file_iopen_rstblock__(const char *filename, - int seqnum_index, int flags) { - rd_file_type *rd_file = rd_file_open(filename, flags); - if (rd_file) { - if (!rd_file_iselect_rstblock(rd_file, seqnum_index)) { - rd_file_close(rd_file); - rd_file = NULL; - } - } - return rd_file; -} - -rd_file_type *rd_file_iopen_rstblock(const char *filename, int seqnum_index, - int flags) { - return rd_file_iopen_rstblock__(filename, seqnum_index, flags); -} - static bool rd_file_index_valid0(const char *file_name, const char *index_file_name) { if (!util_file_exists(file_name)) diff --git a/lib/resdata/tests/rd_file.cpp b/lib/resdata/tests/rd_file.cpp index 2e45a612d..f1c09a5c4 100644 --- a/lib/resdata/tests/rd_file.cpp +++ b/lib/resdata/tests/rd_file.cpp @@ -51,7 +51,6 @@ void test_truncated() { rd_file_type *rd_file = rd_file_open("TEST.EGRID", 0); test_assert_true(rd_file_is_instance(rd_file)); num_kw = rd_file_get_size(rd_file); - test_assert_int_equal(rd_file_get_num_distinct_kw(rd_file), 11); rd_file_close(rd_file); } @@ -81,7 +80,6 @@ void test_mixed_case() { rd_file_type *rd_file = rd_file_open("TESTcase.EGRID", 0); test_assert_true(rd_file_is_instance(rd_file)); num_kw = rd_file_get_size(rd_file); - test_assert_int_equal(rd_file_get_num_distinct_kw(rd_file), 11); rd_file_close(rd_file); } diff --git a/lib/resdata/tests/rd_file_equinor.cpp b/lib/resdata/tests/rd_file_equinor.cpp index c9540ec9a..00e271828 100644 --- a/lib/resdata/tests/rd_file_equinor.cpp +++ b/lib/resdata/tests/rd_file_equinor.cpp @@ -13,25 +13,6 @@ #include #include -void test_flags(const char *filename) { - int FLAG1 = 1; - int FLAG2 = 2; - int FLAG3 = 4; - int FLAG4 = 8; - - int FLAGS = FLAG1 + FLAG2 + FLAG3; - - rd_file_type *rd_file = rd_file_open(filename, FLAGS); - - test_assert_int_equal(rd_file_get_flags(rd_file), FLAGS); - test_assert_true(rd_file_flags_set(rd_file, FLAG1)); - test_assert_true(rd_file_flags_set(rd_file, FLAG1 | FLAG2)); - test_assert_true(rd_file_flags_set(rd_file, FLAG1 | FLAG3)); - test_assert_true(rd_file_flags_set(rd_file, FLAG1 | FLAG3 | FLAG2)); - test_assert_false(rd_file_flags_set(rd_file, FLAG1 | FLAG3 | FLAG4)); - rd_file_close(rd_file); -} - void test_close_stream2(const char *src_file, const char *target_file) { util_copy_file(src_file, target_file); rd_file_type *rd_file = rd_file_open(target_file, RD_FILE_CLOSE_STREAM); @@ -88,7 +69,6 @@ void test_writable(const char *src_file) { ta.copy_file(src_file); { - test_flags(fname); rd_file_type *rd_file = rd_file_open(fname, RD_FILE_WRITABLE); rd_kw_type *swat = rd_file_iget_named_kw(rd_file, "SWAT", 0); rd_kw_type *swat0 = rd_kw_alloc_copy(swat); diff --git a/python/tests/rd_tests/test_indexed_read.py b/python/tests/rd_tests/test_indexed_read.py deleted file mode 100644 index fdb232b48..000000000 --- a/python/tests/rd_tests/test_indexed_read.py +++ /dev/null @@ -1,135 +0,0 @@ -import ctypes -import resdata - -from resdata import ResdataPrototype -from resdata import ResDataType -from resdata.resfile import ResdataKW, ResdataFile, FortIO -from resdata.util.test import TestAreaContext -from tests import ResdataTest -from resdata.util.util import IntVector - - -class ResdataIndexedReadTest(ResdataTest): - _freadIndexedData = ResdataPrototype( - "void rd_kw_fread_indexed_data_python(rd_fortio, int, rd_data_type, int, rd_int_vector, char*)", - bind=False, - ) # fortio, offset, type, count, index_map, buffer - _resFileIndexedRead = ResdataPrototype( - "void rd_file_indexed_read(rd_file, char*, int, rd_int_vector, char*)", - bind=False, - ) # rd_file, kw, index, index_map, buffer - - def test_rd_kw_indexed_read(self): - with TestAreaContext("rd_kw_indexed_read") as area: - fortio = FortIO("index_test", mode=FortIO.WRITE_MODE) - - element_count = 100000 - rd_kw = ResdataKW("TEST", element_count, ResDataType.RD_INT) - - for index in range(element_count): - rd_kw[index] = index - - rd_kw.fwrite(fortio) - - fortio.close() - - fortio = FortIO("index_test", mode=FortIO.READ_MODE) - - new_rd_kw = ResdataKW.fread(fortio) - - for index in range(element_count): - self.assertEqual(new_rd_kw[index], index) - - index_map = IntVector() - index_map.append(2) - index_map.append(3) - index_map.append(5) - index_map.append(7) - index_map.append(11) - index_map.append(13) - index_map.append(313) - index_map.append(1867) - index_map.append(5227) - index_map.append(7159) - index_map.append(12689) - index_map.append(18719) - index_map.append(32321) - index_map.append(37879) - index_map.append(54167) - index_map.append(77213) - index_map.append(88843) - index_map.append(99991) - - char_buffer = ctypes.create_string_buffer( - len(index_map) * ctypes.sizeof(ctypes.c_int) - ) - - self._freadIndexedData( - fortio, - 24, - ResDataType.RD_INT, - element_count, - index_map, - char_buffer, - ) - - int_buffer = ctypes.cast(char_buffer, ctypes.POINTER(ctypes.c_int)) - - for index, index_map_value in enumerate(index_map): - self.assertEqual(index_map_value, int_buffer[index]) - - def test_rd_file_indexed_read(self): - with TestAreaContext("rd_file_indexed_read") as area: - fortio = FortIO("rd_file_index_test", mode=FortIO.WRITE_MODE) - - element_count = 100000 - rd_kw_1 = ResdataKW("TEST1", element_count, ResDataType.RD_INT) - rd_kw_2 = ResdataKW("TEST2", element_count, ResDataType.RD_INT) - - for index in range(element_count): - rd_kw_1[index] = index - rd_kw_2[index] = index + 3 - - rd_kw_1.fwrite(fortio) - rd_kw_2.fwrite(fortio) - - fortio.close() - - rd_file = ResdataFile("rd_file_index_test") - - index_map = IntVector() - index_map.append(2) - index_map.append(3) - index_map.append(5) - index_map.append(7) - index_map.append(11) - index_map.append(13) - index_map.append(313) - index_map.append(1867) - index_map.append(5227) - index_map.append(7159) - index_map.append(12689) - index_map.append(18719) - index_map.append(32321) - index_map.append(37879) - index_map.append(54167) - index_map.append(77213) - index_map.append(88843) - index_map.append(99991) - - char_buffer_1 = ctypes.create_string_buffer( - len(index_map) * ctypes.sizeof(ctypes.c_int) - ) - char_buffer_2 = ctypes.create_string_buffer( - len(index_map) * ctypes.sizeof(ctypes.c_int) - ) - - self._resFileIndexedRead(rd_file, "TEST2", 0, index_map, char_buffer_2) - self._resFileIndexedRead(rd_file, "TEST1", 0, index_map, char_buffer_1) - - int_buffer_1 = ctypes.cast(char_buffer_1, ctypes.POINTER(ctypes.c_int)) - int_buffer_2 = ctypes.cast(char_buffer_2, ctypes.POINTER(ctypes.c_int)) - - for index, index_map_value in enumerate(index_map): - self.assertEqual(index_map_value, int_buffer_1[index]) - self.assertEqual(index_map_value, int_buffer_2[index] - 3) From 8776f377d38f520dfaa7f59cf8634ca23349ccc3 Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Wed, 14 Aug 2024 10:07:45 +0200 Subject: [PATCH 3/5] Remove unused c functions in rd_file_view --- lib/include/resdata/rd_file_view.hpp | 23 --------- lib/resdata/rd_file_view.cpp | 76 +++------------------------- 2 files changed, 7 insertions(+), 92 deletions(-) diff --git a/lib/include/resdata/rd_file_view.hpp b/lib/include/resdata/rd_file_view.hpp index 304f9cdd7..7f6339ce2 100644 --- a/lib/include/resdata/rd_file_view.hpp +++ b/lib/include/resdata/rd_file_view.hpp @@ -34,16 +34,11 @@ bool rd_file_view_check_flags(int state_flags, int query_flags); rd_file_view_type *rd_file_view_alloc(fortio_type *fortio, int *flags, inv_map_type *inv_map, bool owner); -int rd_file_view_get_global_index(const rd_file_view_type *rd_file_view, - const char *kw, int ith); void rd_file_view_make_index(rd_file_view_type *rd_file_view); bool rd_file_view_has_kw(const rd_file_view_type *rd_file_view, const char *kw); rd_file_kw_type * rd_file_view_iget_file_kw(const rd_file_view_type *rd_file_view, int global_index); -rd_file_kw_type * -rd_file_view_iget_named_file_kw(const rd_file_view_type *rd_file_view, - const char *kw, int ith); rd_kw_type *rd_file_view_iget_kw(const rd_file_view_type *rd_file_view, int index); void rd_file_view_index_fload_kw(const rd_file_view_type *rd_file_view, @@ -56,34 +51,18 @@ const char *rd_file_view_iget_distinct_kw(const rd_file_view_type *rd_file_view, int index); int rd_file_view_get_num_distinct_kw(const rd_file_view_type *rd_file_view); int rd_file_view_get_size(const rd_file_view_type *rd_file_view); -rd_data_type rd_file_view_iget_data_type(const rd_file_view_type *rd_file_view, - int index); -int rd_file_view_iget_size(const rd_file_view_type *rd_file_view, int index); -const char *rd_file_view_iget_header(const rd_file_view_type *rd_file_view, - int index); rd_kw_type *rd_file_view_iget_named_kw(const rd_file_view_type *rd_file_view, const char *kw, int ith); -rd_data_type -rd_file_view_iget_named_data_type(const rd_file_view_type *rd_file_view, - const char *kw, int ith); -int rd_file_view_iget_named_size(const rd_file_view_type *rd_file_view, - const char *kw, int ith); -void rd_file_view_replace_kw(rd_file_view_type *rd_file_view, - rd_kw_type *old_kw, rd_kw_type *new_kw, - bool insert_copy); bool rd_file_view_load_all(rd_file_view_type *rd_file_view); void rd_file_view_add_kw(rd_file_view_type *rd_file_view, rd_file_kw_type *file_kw); void rd_file_view_free(rd_file_view_type *rd_file_view); -void rd_file_view_free__(void *arg); int rd_file_view_get_num_named_kw(const rd_file_view_type *rd_file_view, const char *kw); void rd_file_view_fwrite(const rd_file_view_type *rd_file_view, fortio_type *target, int offset); int rd_file_view_iget_occurence(const rd_file_view_type *rd_file_view, int global_index); -void rd_file_view_fprintf_kw_list(const rd_file_view_type *rd_file_view, - FILE *stream); rd_file_view_type *rd_file_view_add_blockview(rd_file_view_type *rd_file_view, const char *header, int occurence); @@ -104,8 +83,6 @@ rd_file_view_alloc_blockview2(const rd_file_view_type *rd_file_view, const char *start_kw, const char *end_kw, int occurence); -void rd_file_view_add_child(rd_file_view_type *parent, - rd_file_view_type *child); bool rd_file_view_drop_flag(rd_file_view_type *file_view, int flag); void rd_file_view_add_flag(rd_file_view_type *file_view, int flag); diff --git a/lib/resdata/rd_file_view.cpp b/lib/resdata/rd_file_view.cpp index 3c76100ef..9d24ec5d9 100644 --- a/lib/resdata/rd_file_view.cpp +++ b/lib/resdata/rd_file_view.cpp @@ -59,8 +59,8 @@ rd_file_view_type *rd_file_view_alloc(fortio_type *fortio, int *flags, return rd_file_view; } -int rd_file_view_get_global_index(const rd_file_view_type *rd_file_view, - const char *kw, int ith) { +static int rd_file_view_get_global_index(const rd_file_view_type *rd_file_view, + const char *kw, int ith) { const auto &index_vector = rd_file_view->kw_index.at(kw); return index_vector[ith]; } @@ -102,7 +102,7 @@ rd_file_view_iget_file_kw(const rd_file_view_type *rd_file_view, return rd_file_view->kw_list[global_index]; } -rd_file_kw_type * +static rd_file_kw_type * rd_file_view_iget_named_file_kw(const rd_file_view_type *rd_file_view, const char *kw, int ith) { int global_index = rd_file_view_get_global_index(rd_file_view, kw, ith); @@ -196,23 +196,6 @@ int rd_file_view_get_size(const rd_file_view_type *rd_file_view) { return rd_file_view->kw_list.size(); } -rd_data_type rd_file_view_iget_data_type(const rd_file_view_type *rd_file_view, - int index) { - rd_file_kw_type *file_kw = rd_file_view_iget_file_kw(rd_file_view, index); - return rd_file_kw_get_data_type(file_kw); -} - -int rd_file_view_iget_size(const rd_file_view_type *rd_file_view, int index) { - rd_file_kw_type *file_kw = rd_file_view_iget_file_kw(rd_file_view, index); - return rd_file_kw_get_size(file_kw); -} - -const char *rd_file_view_iget_header(const rd_file_view_type *rd_file_view, - int index) { - rd_file_kw_type *file_kw = rd_file_view_iget_file_kw(rd_file_view, index); - return rd_file_kw_get_header(file_kw); -} - rd_kw_type *rd_file_view_iget_named_kw(const rd_file_view_type *rd_file_view, const char *kw, int ith) { rd_file_kw_type *file_kw = @@ -220,46 +203,6 @@ rd_kw_type *rd_file_view_iget_named_kw(const rd_file_view_type *rd_file_view, return rd_file_view_get_kw(rd_file_view, file_kw); } -rd_data_type -rd_file_view_iget_named_data_type(const rd_file_view_type *rd_file_view, - const char *kw, int ith) { - rd_file_kw_type *file_kw = - rd_file_view_iget_named_file_kw(rd_file_view, kw, ith); - return rd_file_kw_get_data_type(file_kw); -} - -int rd_file_view_iget_named_size(const rd_file_view_type *rd_file_view, - const char *kw, int ith) { - rd_file_kw_type *file_kw = - rd_file_view_iget_named_file_kw(rd_file_view, kw, ith); - return rd_file_kw_get_size(file_kw); -} - -void rd_file_view_replace_kw(rd_file_view_type *rd_file_view, - rd_kw_type *old_kw, rd_kw_type *new_kw, - bool insert_copy) { - size_t index = 0; - while (index < rd_file_view->kw_list.size()) { - auto *ikw = rd_file_view->kw_list[index]; - if (rd_file_kw_ptr_eq(ikw, old_kw)) { - /* - Found it; observe that the vector_iset() function will - automatically invoke the destructor on the old_kw. - */ - rd_kw_type *insert_kw = new_kw; - - if (insert_copy) - insert_kw = rd_kw_alloc_copy(new_kw); - rd_file_kw_replace_kw(ikw, rd_file_view->fortio, insert_kw); - - rd_file_view_make_index(rd_file_view); - return; - } - index++; - } - util_abort("%s: could not find rd_kw ptr: %p \n", __func__, old_kw); -} - bool rd_file_view_load_all(rd_file_view_type *rd_file_view) { bool loadOK = false; @@ -294,11 +237,6 @@ void rd_file_view_free(rd_file_view_type *rd_file_view) { delete rd_file_view; } -void rd_file_view_free__(void *arg) { - rd_file_view_type *rd_file_view = (rd_file_view_type *)arg; - rd_file_view_free(rd_file_view); -} - int rd_file_view_get_num_named_kw(const rd_file_view_type *rd_file_view, const char *kw) { if (rd_file_view_has_kw(rd_file_view, kw)) { @@ -662,8 +600,8 @@ bool rd_file_view_has_sim_time(const rd_file_view_type *rd_file_view, } } -bool rd_file_view_has_sim_days(const rd_file_view_type *rd_file_view, - double sim_days) { +static bool rd_file_view_has_sim_days(const rd_file_view_type *rd_file_view, + double sim_days) { int num_DOUBHEAD = rd_file_view_get_num_named_kw(rd_file_view, DOUBHEAD_KW); if (num_DOUBHEAD == 0) return false; /* We have no DOUBHEAD headers - probably not a restart file at all. */ @@ -708,8 +646,8 @@ int rd_file_view_seqnum_index_from_sim_time(rd_file_view_type *parent_map, return -1; } -int rd_file_view_seqnum_index_from_sim_days(rd_file_view_type *file_view, - double sim_days) { +static int rd_file_view_seqnum_index_from_sim_days(rd_file_view_type *file_view, + double sim_days) { int num_seqnum = rd_file_view_get_num_named_kw(file_view, SEQNUM_KW); int seqnum_index = 0; rd_file_view_type *seqnum_map; From dc93cb1bfb2fafbbabbba811dea2573d19536fca Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Wed, 14 Aug 2024 09:18:35 +0200 Subject: [PATCH 4/5] Remove unused c functions in rd_file_kw --- lib/include/resdata/rd_file_kw.hpp | 5 ---- lib/resdata/rd_file_kw.cpp | 41 ------------------------------ 2 files changed, 46 deletions(-) diff --git a/lib/include/resdata/rd_file_kw.hpp b/lib/include/resdata/rd_file_kw.hpp index f532bd00a..cb7b1cd00 100644 --- a/lib/include/resdata/rd_file_kw.hpp +++ b/lib/include/resdata/rd_file_kw.hpp @@ -24,18 +24,13 @@ rd_file_kw_type *rd_file_kw_alloc(const rd_kw_type *rd_kw, offset_type offset); rd_file_kw_type *rd_file_kw_alloc0(const char *header, rd_data_type data_type, int size, offset_type offset); void rd_file_kw_free(rd_file_kw_type *file_kw); -void rd_file_kw_free__(void *arg); rd_kw_type *rd_file_kw_get_kw(rd_file_kw_type *file_kw, fortio_type *fortio, inv_map_type *inv_map); rd_kw_type *rd_file_kw_get_kw_ptr(rd_file_kw_type *file_kw); -rd_file_kw_type *rd_file_kw_alloc_copy(const rd_file_kw_type *src); const char *rd_file_kw_get_header(const rd_file_kw_type *file_kw); int rd_file_kw_get_size(const rd_file_kw_type *file_kw); rd_data_type rd_file_kw_get_data_type(const rd_file_kw_type *); offset_type rd_file_kw_get_offset(const rd_file_kw_type *file_kw); -bool rd_file_kw_ptr_eq(const rd_file_kw_type *file_kw, const rd_kw_type *rd_kw); -void rd_file_kw_replace_kw(rd_file_kw_type *file_kw, fortio_type *target, - rd_kw_type *new_kw); bool rd_file_kw_fskip_data(const rd_file_kw_type *file_kw, fortio_type *fortio); void rd_file_kw_inplace_fwrite(rd_file_kw_type *file_kw, fortio_type *fortio); diff --git a/lib/resdata/rd_file_kw.cpp b/lib/resdata/rd_file_kw.cpp index 0ce3b0efd..c9f51e61d 100644 --- a/lib/resdata/rd_file_kw.cpp +++ b/lib/resdata/rd_file_kw.cpp @@ -143,14 +143,6 @@ rd_file_kw_type *rd_file_kw_alloc(const rd_kw_type *rd_kw, offset_type offset) { offset); } -/** - Does NOT copy the kw pointer which must be reloaded. -*/ -rd_file_kw_type *rd_file_kw_alloc_copy(const rd_file_kw_type *src) { - return rd_file_kw_alloc0(src->header, rd_file_kw_get_data_type(src), - src->kw_size, src->file_offset); -} - void rd_file_kw_free(rd_file_kw_type *file_kw) { if (file_kw->kw != NULL) { rd_kw_free(file_kw->kw); @@ -160,11 +152,6 @@ void rd_file_kw_free(rd_file_kw_type *file_kw) { free(file_kw); } -void rd_file_kw_free__(void *arg) { - rd_file_kw_type *file_kw = rd_file_kw_safe_cast(arg); - rd_file_kw_free(file_kw); -} - bool rd_file_kw_equal(const rd_file_kw_type *kw1, const rd_file_kw_type *kw2) { if (kw1->file_offset != kw2->file_offset) return false; @@ -256,34 +243,6 @@ rd_kw_type *rd_file_kw_get_kw(rd_file_kw_type *file_kw, fortio_type *fortio, return file_kw->kw; } -bool rd_file_kw_ptr_eq(const rd_file_kw_type *file_kw, - const rd_kw_type *rd_kw) { - if (file_kw->kw == rd_kw) - return true; - else - return false; -} - -void rd_file_kw_replace_kw(rd_file_kw_type *file_kw, fortio_type *target, - rd_kw_type *new_kw) { - if (!rd_type_is_equal(rd_file_kw_get_data_type(file_kw), - rd_kw_get_data_type(new_kw))) - util_abort("%s: sorry type mismatch between in-file keyword and new " - "keyword \n", - __func__); - if (file_kw->kw_size != rd_kw_get_size(new_kw)) - util_abort("%s: sorry size mismatch between in-file keyword and new " - "keyword \n", - __func__); - - if (file_kw->kw != NULL) - rd_kw_free(file_kw->kw); - - file_kw->kw = new_kw; - fortio_fseek(target, file_kw->file_offset, SEEK_SET); - rd_kw_fwrite(file_kw->kw, target); -} - const char *rd_file_kw_get_header(const rd_file_kw_type *file_kw) { return file_kw->header; } From 29ee054261114815dd373d0c3e5c27ba31671661 Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Tue, 20 Aug 2024 06:41:46 +0200 Subject: [PATCH 5/5] Remove unused functions in nnc_info --- lib/include/resdata/nnc_info.hpp | 4 ---- lib/resdata/nnc_info.cpp | 21 --------------------- 2 files changed, 25 deletions(-) diff --git a/lib/include/resdata/nnc_info.hpp b/lib/include/resdata/nnc_info.hpp index af8ff1624..608b02db0 100644 --- a/lib/include/resdata/nnc_info.hpp +++ b/lib/include/resdata/nnc_info.hpp @@ -13,8 +13,6 @@ typedef struct nnc_info_struct nnc_info_type; const std::vector & nnc_info_get_grid_index_list(const nnc_info_type *nnc_info, int lgr_nr); const std::vector & -nnc_info_iget_grid_index_list(const nnc_info_type *nnc_info, int lgr_index); -const std::vector & nnc_info_get_self_grid_index_list(const nnc_info_type *nnc_info); #endif @@ -39,8 +37,6 @@ nnc_vector_type *nnc_info_get_self_vector(const nnc_info_type *nnc_info); int nnc_info_get_lgr_nr(const nnc_info_type *nnc_info); int nnc_info_get_size(const nnc_info_type *nnc_info); int nnc_info_get_total_size(const nnc_info_type *nnc_info); -void nnc_info_fprintf(const nnc_info_type *nnc_info, FILE *stream); - bool nnc_info_equal(const nnc_info_type *nnc_info1, const nnc_info_type *nnc_info2); nnc_info_type *nnc_info_alloc_copy(const nnc_info_type *src_info); diff --git a/lib/resdata/nnc_info.cpp b/lib/resdata/nnc_info.cpp index 574b1342e..51c6c5a93 100644 --- a/lib/resdata/nnc_info.cpp +++ b/lib/resdata/nnc_info.cpp @@ -208,24 +208,3 @@ int nnc_info_get_total_size(const nnc_info_type *nnc_info) { } return num_nnc; } - -void nnc_info_fprintf(const nnc_info_type *nnc_info, FILE *stream) { - fprintf(stream, "LGR_NR:%d \n", nnc_info->lgr_nr); - { - int lgr_nr; - for (lgr_nr = 0; lgr_nr < int_vector_size(nnc_info->lgr_index_map); - lgr_nr++) { - int lgr_index = int_vector_iget(nnc_info->lgr_index_map, lgr_nr); - if (lgr_index >= 0) { - printf(" %02d -> %02d => ", lgr_nr, lgr_index); - { - const std::vector &index_list = - nnc_info_iget_grid_index_list(nnc_info, lgr_index); - vector_util_fprintf(index_list, stream, " ", "%d"); - printf("\n"); - } - } - } - } - fprintf(stream, "\n"); -}