From 4c16a4b51ab7f76d37a21292a37c26616515c39a Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Thu, 8 Aug 2024 14:44:16 +0200 Subject: [PATCH 1/5] Remove unused rd_sum_tstep functions --- lib/include/resdata/rd_sum_tstep.hpp | 14 -------- lib/resdata/rd_sum_tstep.cpp | 48 ---------------------------- 2 files changed, 62 deletions(-) diff --git a/lib/include/resdata/rd_sum_tstep.hpp b/lib/include/resdata/rd_sum_tstep.hpp index daab8585f..b7464e383 100644 --- a/lib/include/resdata/rd_sum_tstep.hpp +++ b/lib/include/resdata/rd_sum_tstep.hpp @@ -12,11 +12,6 @@ extern "C" { typedef struct rd_sum_tstep_struct rd_sum_tstep_type; -rd_sum_tstep_type * -rd_sum_tstep_alloc_remap_copy(const rd_sum_tstep_type *src, - const rd_smspec_type *new_smspec, - float default_value, const int *params_map); -rd_sum_tstep_type *rd_sum_tstep_alloc_copy(const rd_sum_tstep_type *src); void rd_sum_tstep_free(rd_sum_tstep_type *ministep); void rd_sum_tstep_free__(void *__ministep); rd_sum_tstep_type *rd_sum_tstep_alloc_from_file(int report_step, @@ -48,21 +43,12 @@ void rd_sum_tstep_fwrite(const rd_sum_tstep_type *ministep, fortio_type *fortio); void rd_sum_tstep_iset(rd_sum_tstep_type *tstep, int index, float value); -/// scales with value; equivalent to iset( iget() * scalar) -void rd_sum_tstep_iscale(rd_sum_tstep_type *tstep, int index, float scalar); - -/// adds addend to tstep[index]; equivalent to iset( iget() + addend) -void rd_sum_tstep_ishift(rd_sum_tstep_type *tstep, int index, float addend); - void rd_sum_tstep_set_from_key(rd_sum_tstep_type *tstep, const char *gen_key, float value); double rd_sum_tstep_get_from_key(const rd_sum_tstep_type *tstep, const char *gen_key); bool rd_sum_tstep_has_key(const rd_sum_tstep_type *tstep, const char *gen_key); -bool rd_sum_tstep_sim_time_equal(const rd_sum_tstep_type *tstep1, - const rd_sum_tstep_type *tstep2); - UTIL_SAFE_CAST_HEADER(rd_sum_tstep); UTIL_SAFE_CAST_HEADER_CONST(rd_sum_tstep); diff --git a/lib/resdata/rd_sum_tstep.cpp b/lib/resdata/rd_sum_tstep.cpp index f94a01fe3..4b7524796 100644 --- a/lib/resdata/rd_sum_tstep.cpp +++ b/lib/resdata/rd_sum_tstep.cpp @@ -53,38 +53,6 @@ struct rd_sum_tstep_struct { smspec; /* The smespec header information for this tstep - must be compatible. */ }; -rd_sum_tstep_type * -rd_sum_tstep_alloc_remap_copy(const rd_sum_tstep_type *src, - const rd_smspec_type *new_smspec, - float default_value, const int *params_map) { - int params_size = rd_smspec_get_params_size(new_smspec); - rd_sum_tstep_type *target = new rd_sum_tstep_type(); - UTIL_TYPE_ID_INIT(target, RD_SUM_TSTEP_ID); - target->report_step = src->report_step; - target->ministep = src->ministep; - - target->smspec = new_smspec; - target->data.resize(params_size); - for (int i = 0; i < params_size; i++) { - - if (params_map[i] >= 0) - target->data[i] = src->data[params_map[i]]; - else - target->data[i] = default_value; - } - return target; -} - -rd_sum_tstep_type *rd_sum_tstep_alloc_copy(const rd_sum_tstep_type *src) { - rd_sum_tstep_type *target = new rd_sum_tstep_type(); - UTIL_TYPE_ID_INIT(target, RD_SUM_TSTEP_ID); - target->smspec = src->smspec; - target->report_step = src->report_step; - target->ministep = src->ministep; - target->data = src->data; - return target; -} - static rd_sum_tstep_type *rd_sum_tstep_alloc(int report_step, int ministep_nr, const rd_smspec_type *smspec) { rd_sum_tstep_type *tstep = new rd_sum_tstep_type(); @@ -285,14 +253,6 @@ void rd_sum_tstep_iset(rd_sum_tstep_type *tstep, int index, float value) { index, tstep->data.size()); } -void rd_sum_tstep_iscale(rd_sum_tstep_type *tstep, int index, float scalar) { - rd_sum_tstep_iset(tstep, index, rd_sum_tstep_iget(tstep, index) * scalar); -} - -void rd_sum_tstep_ishift(rd_sum_tstep_type *tstep, int index, float addend) { - rd_sum_tstep_iset(tstep, index, rd_sum_tstep_iget(tstep, index) + addend); -} - void rd_sum_tstep_set_from_node(rd_sum_tstep_type *tstep, const rd::smspec_node &smspec_node, float value) { @@ -323,11 +283,3 @@ double rd_sum_tstep_get_from_key(const rd_sum_tstep_type *tstep, bool rd_sum_tstep_has_key(const rd_sum_tstep_type *tstep, const char *gen_key) { return rd_smspec_has_general_var(tstep->smspec, gen_key); } - -bool rd_sum_tstep_sim_time_equal(const rd_sum_tstep_type *tstep1, - const rd_sum_tstep_type *tstep2) { - if (tstep1->sim_time == tstep2->sim_time) - return true; - else - return false; -} From 981167a5d8e6e734afd520d96ff3b720bd683f57 Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Thu, 8 Aug 2024 14:49:38 +0200 Subject: [PATCH 2/5] Remove unused grid_dims --- lib/CMakeLists.txt | 18 ---- lib/include/resdata/grid_dims.hpp | 19 ---- lib/include/resdata/rd_grid.hpp | 2 - lib/include/resdata/rd_grid_dims.hpp | 21 ----- lib/resdata/grid_dims.cpp | 25 ------ lib/resdata/rd_grid.cpp | 18 ---- lib/resdata/rd_grid_dims.cpp | 129 --------------------------- lib/resdata/tests/rd_grid_dims.cpp | 69 -------------- 8 files changed, 301 deletions(-) delete mode 100644 lib/include/resdata/grid_dims.hpp delete mode 100644 lib/include/resdata/rd_grid_dims.hpp delete mode 100644 lib/resdata/grid_dims.cpp delete mode 100644 lib/resdata/rd_grid_dims.cpp delete mode 100644 lib/resdata/tests/rd_grid_dims.cpp diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 580e047c0..cb169b7ec 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -86,8 +86,6 @@ add_library( resdata/rd_file.cpp resdata/rd_region.cpp resdata/rd_subsidence.cpp - resdata/rd_grid_dims.cpp - resdata/grid_dims.cpp resdata/nnc_info.cpp resdata/rd_grav_common.cpp resdata/nnc_vector.cpp @@ -374,7 +372,6 @@ foreach( rd_grid_cell_contains_wellpath rd_region2region rd_grid_volume - rd_grid_dims rd_nnc_test rd_lgr_test rd_layer_equinor @@ -509,21 +506,6 @@ add_test( # ${EXECUTABLE_OUTPUT_PATH}/rd_grid_volume # ${_resdatapath}/Heidrun/Summary/FF12_2013B3_CLEAN_RS) -add_test(NAME rd_grid_dims0 COMMAND rd_grid_dims) -add_test(NAME rd_grid_dims1 - COMMAND rd_grid_dims ${_resdatapath}/Gurbat/ECLIPSE.EGRID - ${_resdatapath}/Gurbat/ECLIPSE.INIT) -add_test(NAME rd_grid_dims2 - COMMAND rd_grid_dims ${_resdatapath}/Gurbat/ECLIPSE.GRID - ${_resdatapath}/Gurbat/ECLIPSE.INIT) -add_test(NAME rd_grid_dims3 COMMAND rd_grid_dims - ${_resdatapath}/Gurbat/ECLIPSE.EGRID) -add_test(NAME rd_grid_dims4 COMMAND rd_grid_dims - ${_resdatapath}/Gurbat/ECLIPSE.GRID) -add_test(NAME rd_grid_dims5 - COMMAND rd_grid_dims - ${_resdatapath}/AmalgLGRcase/TESTCASE_AMALG_LGR.EGRID) - add_test(NAME rd_nnc_test1 COMMAND rd_nnc_test ${_resdatapath}/Gurbat/ECLIPSE.EGRID) add_test(NAME rd_nnc_test2 diff --git a/lib/include/resdata/grid_dims.hpp b/lib/include/resdata/grid_dims.hpp deleted file mode 100644 index a32ef7531..000000000 --- a/lib/include/resdata/grid_dims.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef ERT_GRID_DIMS_H -#define ERT_GRID_DIMS_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int nx, ny, nz, nactive; -} grid_dims_type; - -void grid_dims_init(grid_dims_type *dims, int nx, int ny, int nz, int nactive); -grid_dims_type *grid_dims_alloc(int nx, int ny, int nz, int nactive); -void grid_dims_free(grid_dims_type *dims); -void grid_dims_free__(void *arg); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/lib/include/resdata/rd_grid.hpp b/lib/include/resdata/rd_grid.hpp index 846d7547a..0d857b351 100644 --- a/lib/include/resdata/rd_grid.hpp +++ b/lib/include/resdata/rd_grid.hpp @@ -9,7 +9,6 @@ #include #include -#include #include #ifdef __cplusplus @@ -166,7 +165,6 @@ char *rd_grid_alloc_case_filename(const char *case_input); void rd_grid_free(rd_grid_type *); void rd_grid_free__(void *arg); -grid_dims_type rd_grid_iget_dims(const rd_grid_type *grid, int grid_nr); void rd_grid_get_dims(const rd_grid_type *, int *, int *, int *, int *); int rd_grid_get_nz(const rd_grid_type *grid); int rd_grid_get_nx(const rd_grid_type *grid); diff --git a/lib/include/resdata/rd_grid_dims.hpp b/lib/include/resdata/rd_grid_dims.hpp deleted file mode 100644 index 28fd00e07..000000000 --- a/lib/include/resdata/rd_grid_dims.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef ERT_RD_GRID_DIMS_H -#define ERT_RD_GRID_DIMS_H -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef struct rd_grid_dims_struct rd_grid_dims_type; - -rd_grid_dims_type *rd_grid_dims_alloc(const char *grid_file, - const char *data_file); -void rd_grid_dims_free(rd_grid_dims_type *grid_dims); -int rd_grid_dims_get_num_grids(const rd_grid_dims_type *grid_dims); -const grid_dims_type *rd_grid_dims_iget_dims(const rd_grid_dims_type *grid_dims, - int grid_nr); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/lib/resdata/grid_dims.cpp b/lib/resdata/grid_dims.cpp deleted file mode 100644 index 2fbed57d7..000000000 --- a/lib/resdata/grid_dims.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -#include - -#include - -void grid_dims_init(grid_dims_type *dims, int nx, int ny, int nz, int nactive) { - dims->nx = nx; - dims->ny = ny; - dims->nz = nz; - dims->nactive = nactive; -} - -grid_dims_type *grid_dims_alloc(int nx, int ny, int nz, int nactive) { - grid_dims_type *dims = (grid_dims_type *)util_malloc(sizeof *dims); - grid_dims_init(dims, nx, ny, nz, nactive); - return dims; -} - -void grid_dims_free(grid_dims_type *dims) { free(dims); } - -void grid_dims_free__(void *arg) { - grid_dims_type *grid_dims = (grid_dims_type *)arg; - grid_dims_free(grid_dims); -} diff --git a/lib/resdata/rd_grid.cpp b/lib/resdata/rd_grid.cpp index ed3636f4e..326c766d8 100644 --- a/lib/resdata/rd_grid.cpp +++ b/lib/resdata/rd_grid.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include /** @@ -4695,23 +4694,6 @@ int rd_grid_get_ny(const rd_grid_type *grid) { return grid->ny; } int rd_grid_get_nactive(const rd_grid_type *grid) { return grid->total_active; } -grid_dims_type rd_grid_iget_dims(const rd_grid_type *grid, int grid_nr) { - grid_dims_type dims; - const rd_grid_type *lgr; - - if (grid_nr == 0) - lgr = grid; - else - lgr = rd_grid_iget_lgr(grid, grid_nr - 1); - - dims.nx = lgr->nx; - dims.ny = lgr->ny; - dims.nz = lgr->nz; - dims.nactive = lgr->total_active; - - return dims; -} - int rd_grid_get_nactive_fracture(const rd_grid_type *grid) { return grid->total_active_fracture; } diff --git a/lib/resdata/rd_grid_dims.cpp b/lib/resdata/rd_grid_dims.cpp deleted file mode 100644 index 8376ed621..000000000 --- a/lib/resdata/rd_grid_dims.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -struct rd_grid_dims_struct { - vector_type *dims_list; -}; - -static void rd_grid_dims_read_EGRID(rd_grid_dims_type *grid_dims, - fortio_type *grid_fortio, - fortio_type *data_fortio) { - while (rd_kw_fseek_kw(GRIDHEAD_KW, false, false, grid_fortio)) { - grid_dims_type *dims; - { - rd_kw_type *gridhead_kw = rd_kw_fread_alloc(grid_fortio); - - int nx = rd_kw_iget_int(gridhead_kw, GRIDHEAD_NX_INDEX); - int ny = rd_kw_iget_int(gridhead_kw, GRIDHEAD_NY_INDEX); - int nz = rd_kw_iget_int(gridhead_kw, GRIDHEAD_NZ_INDEX); - - dims = grid_dims_alloc(nx, ny, nz, 0); - rd_kw_free(gridhead_kw); - } - - if (data_fortio) { - if (rd_kw_fseek_kw(INTEHEAD_KW, false, false, data_fortio)) { - rd_kw_type *intehead_kw = rd_kw_fread_alloc(data_fortio); - dims->nactive = - rd_kw_iget_int(intehead_kw, INTEHEAD_NACTIVE_INDEX); - rd_kw_free(intehead_kw); - } - } - - vector_append_owned_ref(grid_dims->dims_list, dims, grid_dims_free__); - } -} - -static void rd_grid_dims_read_GRID(rd_grid_dims_type *grid_dims, - fortio_type *grid_fortio, - fortio_type *data_fortio) { - while (rd_kw_fseek_kw(DIMENS_KW, false, false, grid_fortio)) { - grid_dims_type *dims; - { - rd_kw_type *dimens_kw = rd_kw_fread_alloc(grid_fortio); - - int nx = rd_kw_iget_int(dimens_kw, DIMENS_NX_INDEX); - int ny = rd_kw_iget_int(dimens_kw, DIMENS_NY_INDEX); - int nz = rd_kw_iget_int(dimens_kw, DIMENS_NZ_INDEX); - - dims = grid_dims_alloc(nx, ny, nz, 0); - rd_kw_free(dimens_kw); - } - - if (data_fortio) { - if (rd_kw_fseek_kw(INTEHEAD_KW, false, false, data_fortio)) { - rd_kw_type *intehead_kw = rd_kw_fread_alloc(data_fortio); - dims->nactive = - rd_kw_iget_int(intehead_kw, INTEHEAD_NACTIVE_INDEX); - rd_kw_free(intehead_kw); - } - } - - vector_append_owned_ref(grid_dims->dims_list, dims, grid_dims_free__); - } -} - -rd_grid_dims_type *rd_grid_dims_alloc(const char *grid_file, - const char *data_file) { - rd_grid_dims_type *grid_dims = NULL; - bool grid_fmt_file; - rd_file_enum grid_file_type = - rd_get_file_type(grid_file, &grid_fmt_file, NULL); - - if ((grid_file_type == RD_GRID_FILE) || (grid_file_type == RD_EGRID_FILE)) { - fortio_type *grid_fortio = - fortio_open_reader(grid_file, grid_fmt_file, RD_ENDIAN_FLIP); - if (grid_fortio) { - grid_dims = (rd_grid_dims_type *)util_malloc(sizeof *grid_dims); - grid_dims->dims_list = vector_alloc_new(); - - { - fortio_type *data_fortio = NULL; - bool data_fmt_file; - - if (data_file) { - rd_get_file_type(data_file, &data_fmt_file, NULL); - data_fortio = fortio_open_reader(data_file, data_fmt_file, - RD_ENDIAN_FLIP); - } - - if (grid_file_type == RD_EGRID_FILE) - rd_grid_dims_read_EGRID(grid_dims, grid_fortio, - data_fortio); - else - rd_grid_dims_read_GRID(grid_dims, grid_fortio, data_fortio); - - if (data_fortio) - fortio_fclose(data_fortio); - } - fortio_fclose(grid_fortio); - } - } - - return grid_dims; -} - -void rd_grid_dims_free(rd_grid_dims_type *grid_dims) { - vector_free(grid_dims->dims_list); - free(grid_dims); -} - -int rd_grid_dims_get_num_grids(const rd_grid_dims_type *grid_dims) { - return vector_get_size(grid_dims->dims_list); -} - -const grid_dims_type *rd_grid_dims_iget_dims(const rd_grid_dims_type *grid_dims, - int grid_nr) { - return (const grid_dims_type *)vector_iget_const(grid_dims->dims_list, - grid_nr); -} diff --git a/lib/resdata/tests/rd_grid_dims.cpp b/lib/resdata/tests/rd_grid_dims.cpp deleted file mode 100644 index 068f0fc7e..000000000 --- a/lib/resdata/tests/rd_grid_dims.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include -#include -#include - -#include -#include - -#include -#include - -void test_grid(const char *grid_filename, const char *data_filename) { - rd_grid_type *rd_grid = rd_grid_alloc(grid_filename); - rd_grid_dims_type *grid_dims = - rd_grid_dims_alloc(grid_filename, data_filename); - - test_assert_not_NULL(grid_dims); - test_assert_int_equal(rd_grid_get_num_lgr(rd_grid) + 1, - rd_grid_dims_get_num_grids(grid_dims)); - for (int i = 0; i < rd_grid_dims_get_num_grids(grid_dims); i++) { - - grid_dims_type d1 = rd_grid_iget_dims(rd_grid, i); - const grid_dims_type *d2 = rd_grid_dims_iget_dims(grid_dims, i); - - test_assert_int_equal(d1.nx, d2->nx); - test_assert_int_equal(d1.ny, d2->ny); - test_assert_int_equal(d1.nz, d2->nz); - - if (data_filename) - test_assert_int_equal(d1.nactive, d2->nactive); - } -} - -void test_dims() { - grid_dims_type d1; - grid_dims_type *d2 = grid_dims_alloc(100, 100, 100, 0); - - grid_dims_init(&d1, 100, 100, 100, 0); - - test_assert_int_equal(d1.nx, d2->nx); - test_assert_int_equal(d1.ny, d2->ny); - test_assert_int_equal(d1.nz, d2->nz); - test_assert_int_equal(d1.nactive, d2->nactive); - - grid_dims_free(d2); -} - -int main(int argc, char **argv) { - signal( - SIGSEGV, - util_abort_signal); /* Segmentation violation, i.e. overwriting memory ... */ - - if (argc == 1) { - rd_grid_dims_type *grid_dims = rd_grid_dims_alloc(argv[0], NULL); - test_assert_NULL(grid_dims); - test_dims(); - } else { - const char *GRID_file = argv[1]; - char *data_file; - - if (argc == 3) - data_file = argv[2]; - else - data_file = NULL; - - test_grid(GRID_file, data_file); - } - - exit(0); -} From 0c0edc1b911a7b974ab9a1c1c5a38ee1dc053eec Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Thu, 8 Aug 2024 15:19:15 +0200 Subject: [PATCH 3/5] Remove unused rd_kw_alloc_actnum_bitmask --- lib/include/resdata/rd_kw.hpp | 2 -- lib/resdata/rd_kw_functions.cpp | 29 ----------------------------- 2 files changed, 31 deletions(-) diff --git a/lib/include/resdata/rd_kw.hpp b/lib/include/resdata/rd_kw.hpp index 8991b3117..afc5c7fef 100644 --- a/lib/include/resdata/rd_kw.hpp +++ b/lib/include/resdata/rd_kw.hpp @@ -64,8 +64,6 @@ bool rd_kw_fread_realloc(rd_kw_type *, fortio_type *); void rd_kw_fread(rd_kw_type *, fortio_type *); rd_kw_type *rd_kw_fread_alloc(fortio_type *); rd_kw_type *rd_kw_alloc_actnum(const rd_kw_type *porv_kw, float porv_limit); -rd_kw_type *rd_kw_alloc_actnum_bitmask(const rd_kw_type *porv_kw, - float porv_limit, int actnum_bitmask); void rd_kw_free_data(rd_kw_type *); void rd_kw_fread_indexed_data(fortio_type *fortio, offset_type data_offset, rd_data_type, int element_count, diff --git a/lib/resdata/rd_kw_functions.cpp b/lib/resdata/rd_kw_functions.cpp index 1c02a0ab9..de4b2494a 100644 --- a/lib/resdata/rd_kw_functions.cpp +++ b/lib/resdata/rd_kw_functions.cpp @@ -148,32 +148,3 @@ rd_kw_type *rd_kw_alloc_actnum(const rd_kw_type *porv_kw, float porv_limit) { return actnum_kw; } - -/* - Allocate actnum, and assign actnum_bitmask to all cells with pore volume - larger than zero. The bit mask can be any combination of - CELL_ACTIVE_MATRIX and CELL_ACTIVE_FRACTURE. - See documentation in top of rd_grid.cpp -*/ -rd_kw_type *rd_kw_alloc_actnum_bitmask(const rd_kw_type *porv_kw, - float porv_limit, int actnum_bitmask) { - if (!rd_type_is_float(porv_kw->data_type)) - return NULL; - - if (!util_string_equal(PORV_KW, rd_kw_get_header(porv_kw))) - return NULL; - - const int size = rd_kw_get_size(porv_kw); - rd_kw_type *actnum_kw = rd_kw_alloc(ACTNUM_KW, size, RD_INT); - const float *porv_values = rd_kw_get_float_ptr(porv_kw); - int *actnum_values = rd_kw_get_int_ptr(actnum_kw); - - for (int i = 0; i < size; i++) { - if (porv_values[i] > porv_limit) - actnum_values[i] = actnum_bitmask; - else - actnum_values[i] = 0; - } - - return actnum_kw; -} From 941b2646d970bc2aa02df52c9428529d700b5a72 Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Thu, 8 Aug 2024 15:22:57 +0200 Subject: [PATCH 4/5] Remove unused rd_init_file --- lib/CMakeLists.txt | 2 - lib/include/resdata/rd_init_file.hpp | 23 --- lib/resdata/rd_init_file.cpp | 217 --------------------------- lib/resdata/tests/rd_init_file.cpp | 79 ---------- 4 files changed, 321 deletions(-) delete mode 100644 lib/include/resdata/rd_init_file.hpp delete mode 100644 lib/resdata/rd_init_file.cpp delete mode 100644 lib/resdata/tests/rd_init_file.cpp diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index cb169b7ec..96128f791 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -61,7 +61,6 @@ add_library( resdata/rd_rsthead.cpp resdata/rd_sum_tstep.cpp resdata/rd_rst_file.cpp - resdata/rd_init_file.cpp resdata/rd_grid_cache.cpp resdata/smspec_node.cpp resdata/rd_kw_grdecl.cpp @@ -269,7 +268,6 @@ foreach( rd_sum_data_intermediate_test rd_grid_cell_contains rd_unsmry_loader_test - rd_init_file rd_kw_space_pad rd_kw_cmp_string rd_kw_equal diff --git a/lib/include/resdata/rd_init_file.hpp b/lib/include/resdata/rd_init_file.hpp deleted file mode 100644 index 0ad81993c..000000000 --- a/lib/include/resdata/rd_init_file.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef ERT_RD_INIT_FILE_H -#define ERT_RD_INIT_FILE_H - -#include - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void rd_init_file_fwrite_header(fortio_type *fortio, const rd_grid_type *grid, - const rd_kw_type *poro, - ert_rd_unit_enum unit_system, int phases, - time_t start_date); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/lib/resdata/rd_init_file.cpp b/lib/resdata/rd_init_file.cpp deleted file mode 100644 index 48c249428..000000000 --- a/lib/resdata/rd_init_file.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - This file contains functionality to write an ECLIPSE INIT file. The - file does (currently) not contain any datastructures, only - functions. Essentially this file is only a codifying of the ECLIPSE - documentation of INIT files. - - The functionality is mainly targeted at saving grid properties like - PORO, PERMX and FIPNUM. The thermodynamic/relperm properties are - mainly hardcoded to FALSE (in particular in the - rd_init_file_alloc_LOGIHEAD() function); this implies that the INIT - files produced in this way are probably not 100% valid, and can - certainly not be used to query for e.g. relperm properties. -*/ - -#include - -#include -#include -#include -#include -#include -#include -#include - -static rd_kw_type *rd_init_file_alloc_INTEHEAD(const rd_grid_type *rd_grid, - ert_rd_unit_enum unit_system, - int phases, time_t start_date, - int simulator) { - rd_kw_type *intehead_kw = - rd_kw_alloc(INTEHEAD_KW, INTEHEAD_INIT_SIZE, RD_INT); - rd_kw_scalar_set_int(intehead_kw, 0); - - rd_kw_iset_int(intehead_kw, INTEHEAD_UNIT_INDEX, unit_system); - rd_kw_iset_int(intehead_kw, INTEHEAD_NX_INDEX, rd_grid_get_nx(rd_grid)); - rd_kw_iset_int(intehead_kw, INTEHEAD_NY_INDEX, rd_grid_get_ny(rd_grid)); - rd_kw_iset_int(intehead_kw, INTEHEAD_NZ_INDEX, rd_grid_get_nz(rd_grid)); - rd_kw_iset_int(intehead_kw, INTEHEAD_NACTIVE_INDEX, - rd_grid_get_active_size(rd_grid)); - rd_kw_iset_int(intehead_kw, INTEHEAD_PHASE_INDEX, phases); - { - int mday, month, year; - rd_set_date_values(start_date, &mday, &month, &year); - rd_kw_iset_int(intehead_kw, INTEHEAD_DAY_INDEX, mday); - rd_kw_iset_int(intehead_kw, INTEHEAD_MONTH_INDEX, month); - rd_kw_iset_int(intehead_kw, INTEHEAD_YEAR_INDEX, year); - } - rd_kw_iset_int(intehead_kw, INTEHEAD_IPROG_INDEX, simulator); - - return intehead_kw; -} - -static rd_kw_type *rd_init_file_alloc_LOGIHEAD(int simulator) { - /* - This function includes lots of hardcoded options; the main - intention of writing the INIT file is to store the grid properties - like e.g. PORO and SATNUM. The relperm/thermodynamics properties - are just all defaulted to False. - - The documentation - */ - bool with_RS = false; - bool with_RV = false; - bool with_directional_relperm = false; - bool with_reversible_relperm_ECLIPSE100 = false; - bool radial_grid_ECLIPSE100 = false; - bool radial_grid_ECLIPSE300 = false; - bool with_reversible_relperm_ECLIPSE300 = false; - bool with_hysterisis = false; - bool dual_porosity = false; - bool endpoint_scaling = false; - bool directional_endpoint_scaling = false; - bool reversible_endpoint_scaling = false; - bool alternative_endpoint_scaling = false; - bool miscible_displacement = false; - bool scale_water_PC_at_max_sat = false; - bool scale_gas_PC_at_max_sat = false; - - rd_kw_type *logihead_kw = - rd_kw_alloc(LOGIHEAD_KW, LOGIHEAD_INIT_SIZE, RD_BOOL); - - rd_kw_scalar_set_bool(logihead_kw, false); - - rd_kw_iset_bool(logihead_kw, LOGIHEAD_RS_INDEX, with_RS); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_RV_INDEX, with_RV); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_DIR_RELPERM_INDEX, - with_directional_relperm); - - if (simulator == INTEHEAD_ECLIPSE100_VALUE) { - rd_kw_iset_bool(logihead_kw, LOGIHEAD_REV_RELPERM100_INDEX, - with_reversible_relperm_ECLIPSE100); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_RADIAL100_INDEX, - radial_grid_ECLIPSE100); - } else { - rd_kw_iset_bool(logihead_kw, LOGIHEAD_REV_RELPERM300_INDEX, - with_reversible_relperm_ECLIPSE300); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_RADIAL300_INDEX, - radial_grid_ECLIPSE300); - } - - rd_kw_iset_bool(logihead_kw, LOGIHEAD_HYSTERISIS_INDEX, with_hysterisis); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_DUALP_INDEX, dual_porosity); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_ENDPOINT_SCALING_INDEX, - endpoint_scaling); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_DIR_ENDPOINT_SCALING_INDEX, - directional_endpoint_scaling); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_REV_ENDPOINT_SCALING_INDEX, - reversible_endpoint_scaling); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_ALT_ENDPOINT_SCALING_INDEX, - alternative_endpoint_scaling); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_MISC_DISPLACEMENT_INDEX, - miscible_displacement); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_SCALE_WATER_PC_AT_MAX_SAT_INDEX, - scale_water_PC_at_max_sat); - rd_kw_iset_bool(logihead_kw, LOGIHEAD_SCALE_GAS_PC_AT_MAX_SAT_INDEX, - scale_gas_PC_at_max_sat); - - return logihead_kw; -} - -static rd_kw_type *rd_init_file_alloc_DOUBHEAD() { - rd_kw_type *doubhead_kw = - rd_kw_alloc(DOUBHEAD_KW, DOUBHEAD_INIT_SIZE, RD_DOUBLE); - - rd_kw_scalar_set_double(doubhead_kw, 0); - - return doubhead_kw; -} - -/** - The writing of the PORO field is somewhat special cased; the INIT - file should contain the PORV keyword with nx*ny*nz elements. The - cells which are inactive have the PORV volume explicitly set to - zero; this way the active/inactive status can be inferred from PORV - field in the INIT file. - - In this code the PORO field is considered to be the fundamental - quantity, and the PORV field is calculated from PORO and the volume - of the grid cells. Apart from PORV all the remaining fields in the - INIT file should have nactive elements. - - If you do not wish this function to be used for the PORV special - casing you can just pass NULL as the poro_kw in the - rd_init_file_fwrite_header() function. - */ - -static void rd_init_file_fwrite_poro(fortio_type *fortio, - const rd_grid_type *rd_grid, - const rd_kw_type *poro) { - { - rd_kw_type *porv = - rd_kw_alloc(PORV_KW, rd_grid_get_global_size(rd_grid), RD_FLOAT); - int global_index; - bool global_poro = - (rd_kw_get_size(poro) == rd_grid_get_global_size(rd_grid)) ? true - : false; - for (global_index = 0; global_index < rd_grid_get_global_size(rd_grid); - global_index++) { - int active_index = rd_grid_get_active_index1(rd_grid, global_index); - if (active_index >= 0) { - int poro_index = global_poro ? global_index : active_index; - rd_kw_iset_float( - porv, global_index, - rd_kw_iget_float(poro, poro_index) * - rd_grid_get_cell_volume1(rd_grid, global_index)); - } else - rd_kw_iset_float(porv, global_index, 0); - } - rd_kw_fwrite(porv, fortio); - rd_kw_free(porv); - } - - rd_kw_fwrite(poro, fortio); -} - -/* - If the poro keyword is non NULL this function will write both the - PORO keyword itself and also calculate the PORV keyword and write - that. -*/ - -void rd_init_file_fwrite_header(fortio_type *fortio, - const rd_grid_type *rd_grid, - const rd_kw_type *poro, - ert_rd_unit_enum unit_system, int phases, - time_t start_date) { - int simulator = INTEHEAD_ECLIPSE100_VALUE; - { - rd_kw_type *intehead_kw = rd_init_file_alloc_INTEHEAD( - rd_grid, unit_system, phases, start_date, simulator); - rd_kw_fwrite(intehead_kw, fortio); - rd_kw_free(intehead_kw); - } - - { - rd_kw_type *logihead_kw = rd_init_file_alloc_LOGIHEAD(simulator); - rd_kw_fwrite(logihead_kw, fortio); - rd_kw_free(logihead_kw); - } - - { - rd_kw_type *doubhead_kw = rd_init_file_alloc_DOUBHEAD(); - rd_kw_fwrite(doubhead_kw, fortio); - rd_kw_free(doubhead_kw); - } - - if (poro) { - int poro_size = rd_kw_get_size(poro); - if ((poro_size == rd_grid_get_nactive(rd_grid)) || - (poro_size == rd_grid_get_global_size(rd_grid))) - rd_init_file_fwrite_poro(fortio, rd_grid, poro); - else - util_abort("%s: keyword PORO has wrong size:%d Grid: %d/%d \n", - __func__, rd_kw_get_size(poro), - rd_grid_get_nactive(rd_grid), - rd_grid_get_global_size(rd_grid)); - } -} diff --git a/lib/resdata/tests/rd_init_file.cpp b/lib/resdata/tests/rd_init_file.cpp deleted file mode 100644 index 947b64809..000000000 --- a/lib/resdata/tests/rd_init_file.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -void test_write_header() { - int nx = 10; - int ny = 10; - int nz = 5; - - rd::util::TestArea ta("WRITE_header"); - int_vector_type *actnum = int_vector_alloc(nx * ny * nz, 1); - time_t start_time = util_make_date_utc(15, 12, 2010); - rd_grid_type *rd_grid; - - int_vector_iset(actnum, 10, 0); - int_vector_iset(actnum, 100, 0); - - rd_grid = rd_grid_alloc_rectangular(nx, ny, nz, 1, 1, 1, - int_vector_get_ptr(actnum)); - - // Write poro with global size. - { - fortio_type *f = fortio_open_writer("FOO1.INIT", false, RD_ENDIAN_FLIP); - rd_kw_type *poro = - rd_kw_alloc("PORO", rd_grid_get_global_size(rd_grid), RD_FLOAT); - rd_kw_scalar_set_float(poro, 0.10); - rd_init_file_fwrite_header(f, rd_grid, poro, RD_FIELD_UNITS, 7, - start_time); - rd_kw_free(poro); - fortio_fclose(f); - } - - // Write poro with nactive size. - { - fortio_type *f = fortio_open_writer("FOO2.INIT", false, RD_ENDIAN_FLIP); - rd_kw_type *poro = - rd_kw_alloc("PORO", rd_grid_get_global_size(rd_grid), RD_FLOAT); - rd_kw_scalar_set_float(poro, 0.10); - rd_init_file_fwrite_header(f, rd_grid, poro, RD_FIELD_UNITS, 7, - start_time); - rd_kw_free(poro); - fortio_fclose(f); - } - { - rd_file_type *file1 = rd_file_open("FOO1.INIT", 0); - rd_file_type *file2 = rd_file_open("FOO2.INIT", 0); - - test_assert_true(rd_kw_equal(rd_file_iget_named_kw(file1, "PORV", 0), - rd_file_iget_named_kw(file2, "PORV", 0))); - - rd_file_close(file2); - rd_file_close(file1); - } - - // Poro == NULL - { - fortio_type *f = fortio_open_writer("FOO3.INIT", false, RD_ENDIAN_FLIP); - rd_init_file_fwrite_header(f, rd_grid, NULL, RD_METRIC_UNITS, 7, - start_time); - fortio_fclose(f); - } - rd_grid_free(rd_grid); - int_vector_free(actnum); -} - -int main(int argc, char **argv) { - test_write_header(); - exit(0); -} From 8d1a687211ac8206aee5df9d7b5715deb35b3ea9 Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Wed, 14 Aug 2024 09:04:02 +0200 Subject: [PATCH 5/5] Remove unused c functions in rd_region --- lib/include/resdata/rd_region.hpp | 34 -------- lib/resdata/rd_region.cpp | 126 ------------------------------ 2 files changed, 160 deletions(-) diff --git a/lib/include/resdata/rd_region.hpp b/lib/include/resdata/rd_region.hpp index 0d7659447..b088272e1 100644 --- a/lib/include/resdata/rd_region.hpp +++ b/lib/include/resdata/rd_region.hpp @@ -33,13 +33,10 @@ typedef enum { typedef struct rd_region_struct rd_region_type; -void rd_region_unlock(rd_region_type *region); -void rd_region_lock(rd_region_type *region); void rd_region_reset(rd_region_type *rd_region); rd_region_type *rd_region_alloc_copy(const rd_region_type *rd_region); rd_region_type *rd_region_alloc(const rd_grid_type *rd_grid, bool preselect); void rd_region_free(rd_region_type *region); -void rd_region_free__(void *__region); const int_vector_type *rd_region_get_active_list(rd_region_type *region); const int_vector_type *rd_region_get_global_list(rd_region_type *region); @@ -57,7 +54,6 @@ void rd_region_select_true(rd_region_type *region, const rd_kw_type *rd_kw); void rd_region_invert_selection(rd_region_type *region); void rd_region_select_all(rd_region_type *region); void rd_region_deselect_all(rd_region_type *region); -void rd_region_deselect_true(rd_region_type *region, const rd_kw_type *rd_kw); void rd_region_select_false(rd_region_type *region, const rd_kw_type *rd_kw); void rd_region_select_in_interval(rd_region_type *region, @@ -109,14 +105,6 @@ void rd_region_select_large_cells(rd_region_type *rd_region, void rd_region_deselect_large_cells(rd_region_type *rd_region, double volum_limit); -void rd_region_select_global_index(rd_region_type *rd_region, int global_index); -void rd_region_deselect_global_index(rd_region_type *rd_region, - int global_index); - -void rd_region_select_active_index(rd_region_type *rd_region, int active_index); -void rd_region_deselect_active_index(rd_region_type *rd_region, - int active_index); - void rd_region_intersection(rd_region_type *region, const rd_region_type *new_region); void rd_region_union(rd_region_type *region, const rd_region_type *new_region); @@ -142,15 +130,6 @@ void rd_region_cmp_select_more(rd_region_type *rd_region, const rd_kw_type *kw1, void rd_region_cmp_deselect_more(rd_region_type *rd_region, const rd_kw_type *kw1, const rd_kw_type *kw2); -void rd_region_select_in_cylinder(rd_region_type *region, double x0, double y0, - double R); -void rd_region_deselect_in_cylinder(rd_region_type *region, double x0, - double y0, double R); -void rd_region_select_in_zcylinder(rd_region_type *region, double x0, double y0, - double R, double z1, double z2); -void rd_region_deselect_in_zcylinder(rd_region_type *region, double x0, - double y0, double R, double z1, double z2); - void rd_region_select_above_plane(rd_region_type *region, const double n[3], const double p[3]); void rd_region_select_below_plane(rd_region_type *region, const double n[3], @@ -172,10 +151,6 @@ void rd_region_deselect_outside_polygon(rd_region_type *region, void rd_region_select_from_layer(rd_region_type *region, const layer_type *layer, int k, int layer_value); -void rd_region_deselect_from_layer(rd_region_type *region, - const layer_type *layer, int k, - int layer_value); -void rd_region_deselect_false(rd_region_type *region, const rd_kw_type *rd_kw); void rd_region_set_kw_int(rd_region_type *rd_region, rd_kw_type *rd_kw, int value, bool force_active); @@ -185,8 +160,6 @@ void rd_region_set_kw_double(rd_region_type *rd_region, rd_kw_type *rd_kw, double value, bool force_active); void rd_region_kw_copy(rd_region_type *rd_region, rd_kw_type *rd_kw, const rd_kw_type *src_kw, bool force_active); -int rd_region_get_kw_size(rd_region_type *rd_region, const rd_kw_type *rd_kw, - bool force_active); void rd_region_kw_iadd(rd_region_type *rd_region, rd_kw_type *rd_kw, const rd_kw_type *delta_kw, bool force_active); @@ -220,19 +193,12 @@ const int_vector_type *rd_region_get_kw_index_list(rd_region_type *rd_region, void rd_region_set_name(rd_region_type *region, const char *name); const char *rd_region_get_name(const rd_region_type *region); -int rd_region_get_active_size_cpp(rd_region_type *region); -int rd_region_get_global_size_cpp(rd_region_type *region); -const int *rd_region_get_active_list_cpp(rd_region_type *region); -const int *rd_region_get_global_list_cpp(rd_region_type *region); - double rd_region_sum_kw_double(rd_region_type *rd_region, const rd_kw_type *rd_kw, bool force_active); int rd_region_sum_kw_int(rd_region_type *rd_region, const rd_kw_type *rd_kw, bool force_active); float rd_region_sum_kw_float(rd_region_type *rd_region, const rd_kw_type *rd_kw, bool force_active); -int rd_region_sum_kw_bool(rd_region_type *rd_region, const rd_kw_type *rd_kw, - bool force_active); UTIL_IS_INSTANCE_HEADER(rd_region); UTIL_SAFE_CAST_HEADER(rd_region); diff --git a/lib/resdata/rd_region.cpp b/lib/resdata/rd_region.cpp index a2168886c..6d7c246c5 100644 --- a/lib/resdata/rd_region.cpp +++ b/lib/resdata/rd_region.cpp @@ -100,18 +100,6 @@ static void rd_region_invalidate_index_list(rd_region_type *region) { region->active_index_list_valid = false; } -void rd_region_lock(rd_region_type *region) { - int_vector_set_read_only(region->global_index_list, true); - int_vector_set_read_only(region->active_index_list, true); - int_vector_set_read_only(region->global_active_list, true); -} - -void rd_region_unlock(rd_region_type *region) { - int_vector_set_read_only(region->global_index_list, false); - int_vector_set_read_only(region->active_index_list, false); - int_vector_set_read_only(region->global_active_list, false); -} - rd_region_type *rd_region_alloc(const rd_grid_type *rd_grid, bool preselect) { rd_region_type *region = (rd_region_type *)util_malloc(sizeof *region); UTIL_TYPE_ID_INIT(region, RD_REGION_TYPE_ID); @@ -149,11 +137,6 @@ void rd_region_free(rd_region_type *region) { free(region); } -void rd_region_free__(void *__region) { - rd_region_type *region = rd_region_safe_cast(__region); - rd_region_free(region); -} - static void rd_region_assert_global_index_list(rd_region_type *region) { if (!region->global_index_list_valid) { int global_index; @@ -204,23 +187,6 @@ const int_vector_type *rd_region_get_global_list(rd_region_type *region) { return region->global_index_list; } -/* Cpp compat/legacy/cruft functions. */ -int rd_region_get_active_size_cpp(rd_region_type *region) { - return int_vector_size(rd_region_get_active_list(region)); -} - -int rd_region_get_global_size_cpp(rd_region_type *region) { - return int_vector_size(rd_region_get_global_list(region)); -} - -const int *rd_region_get_active_list_cpp(rd_region_type *region) { - return int_vector_get_const_ptr(rd_region_get_active_list(region)); -} - -const int *rd_region_get_global_list_cpp(rd_region_type *region) { - return int_vector_get_const_ptr(rd_region_get_global_list(region)); -} - static void rd_region_assert_kw(const rd_region_type *region, const rd_kw_type *rd_kw, bool *global_kw) { int kw_size = rd_kw_get_size(rd_kw); @@ -335,18 +301,10 @@ void rd_region_select_true(rd_region_type *region, const rd_kw_type *rd_kw) { rd_region_select_bool_equal__(region, rd_kw, true, true); } -void rd_region_deselect_true(rd_region_type *region, const rd_kw_type *rd_kw) { - rd_region_select_bool_equal__(region, rd_kw, true, false); -} - void rd_region_select_false(rd_region_type *region, const rd_kw_type *rd_kw) { rd_region_select_bool_equal__(region, rd_kw, false, true); } -void rd_region_deselect_false(rd_region_type *region, const rd_kw_type *rd_kw) { - rd_region_select_bool_equal__(region, rd_kw, false, false); -} - static void rd_region_select_in_interval__(rd_region_type *region, const rd_kw_type *rd_kw, float min_value, float max_value, @@ -922,28 +880,6 @@ void rd_region_deselect_inactive_cells(rd_region_type *region) { rd_region_select_active_cells__(region, false, false); } -/** - This function will select a cell based on global_index. -*/ - -static void rd_region_select_global_index__(rd_region_type *region, - int global_index, bool select) { - if ((global_index >= 0) && (global_index < region->grid_vol)) - region->active_mask[global_index] = select; - else - util_abort("%s: global_index:%d invalid - legal interval: [0,%d) \n", - __func__, global_index, region->grid_vol); - rd_region_invalidate_index_list(region); -} - -void rd_region_select_global_index(rd_region_type *region, int global_index) { - rd_region_select_global_index__(region, global_index, true); -} - -void rd_region_deselect_global_index(rd_region_type *region, int global_index) { - rd_region_select_global_index__(region, global_index, false); -} - /** Here comes functions for selecting all the cells which are in the vertical cylinder located at (x0,y0) with radius R. The functions @@ -1009,29 +945,6 @@ static void rd_region_cylinder_select__(rd_region_type *region, double x0, rd_region_invalidate_index_list(region); } -void rd_region_select_in_cylinder(rd_region_type *region, double x0, double y0, - double R) { - rd_region_cylinder_select__(region, x0, y0, R, 1, 0, true, true); -} - -void rd_region_deselect_in_cylinder(rd_region_type *region, double x0, - double y0, double R) { - rd_region_cylinder_select__(region, x0, y0, R, 1, 0, true, false); -} - -void rd_region_select_in_zcylinder(rd_region_type *region, double x0, double y0, - double R, double z1, double z2) { - rd_region_cylinder_select__(region, x0, y0, R, util_double_min(z1, z2), - util_double_max(z1, z2), true, true); -} - -void rd_region_deselect_in_zcylinder(rd_region_type *region, double x0, - double y0, double R, double z1, - double z2) { - rd_region_cylinder_select__(region, x0, y0, R, util_double_min(z1, z2), - util_double_max(z1, z2), true, false); -} - /** Select or deselect points based on their distance to the plane specified by normal vector @n and point @p. @@ -1156,30 +1069,6 @@ void rd_region_deselect_outside_polygon(rd_region_type *region, rd_region_polygon_select__(region, polygon, false, false); } -/** - This function will select a cell based on active_index. -*/ - -static void rd_region_select_active_index__(rd_region_type *region, - int active_index, bool select) { - if ((active_index >= 0) && (active_index < region->grid_active)) { - int global_index = - rd_grid_get_global_index1A(region->parent_grid, active_index); - region->active_mask[global_index] = select; - } else - util_abort("%s: active_index:%d invalid - legal interval: [0,%d) \n", - __func__, active_index, region->grid_vol); - rd_region_invalidate_index_list(region); -} - -void rd_region_select_active_index(rd_region_type *region, int active_index) { - rd_region_select_active_index__(region, active_index, true); -} - -void rd_region_deselect_active_index(rd_region_type *region, int active_index) { - rd_region_select_active_index__(region, active_index, false); -} - static void rd_region_select_from_layer__(rd_region_type *region, const layer_type *layer, int k, int layer_value, bool select) { @@ -1211,12 +1100,6 @@ void rd_region_select_from_layer(rd_region_type *region, rd_region_select_from_layer__(region, layer, k, layer_value, true); } -void rd_region_deselect_from_layer(rd_region_type *region, - const layer_type *layer, int k, - int layer_value) { - rd_region_select_from_layer__(region, layer, k, layer_value, false); -} - static void rd_region_select_all__(rd_region_type *region, bool select) { int global_index; for (global_index = 0; global_index < region->grid_vol; global_index++) @@ -1517,12 +1400,3 @@ double rd_region_sum_kw_double(rd_region_type *rd_region, rd_kw_element_sum_indexed(rd_kw, index_set, &sum); return sum; } - -int rd_region_sum_kw_bool(rd_region_type *rd_region, const rd_kw_type *rd_kw, - bool force_active) { - int sum; - const int_vector_type *index_set = - rd_region_get_kw_index_list(rd_region, rd_kw, force_active); - rd_kw_element_sum_indexed(rd_kw, index_set, &sum); - return sum; -}