Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove more unused c code #1003

Merged
merged 5 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions lib/include/resdata/rd_rft_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,10 @@ extern "C" {

typedef struct rd_rft_file_struct rd_rft_file_type;

char *rd_rft_file_alloc_case_filename(const char *case_input);
const char *rd_rft_file_get_filename(const rd_rft_file_type *rft_file);
rd_rft_file_type *rd_rft_file_alloc_case(const char *case_input);
bool rd_rft_file_case_has_rft(const char *case_input);
rd_rft_file_type *rd_rft_file_alloc(const char *);
void rd_rft_file_free(rd_rft_file_type *);
void rd_rft_file_block(const rd_rft_file_type *, double, const char *, int,
const double *, int *, int *, int *);
void rd_rft_file_fprintf_rft_obs(const rd_rft_file_type *, double, const char *,
const char *, const char *, double);
rd_rft_node_type *rd_rft_file_get_node(const rd_rft_file_type *, const char *);

int rd_rft_file_get_size__(const rd_rft_file_type *rft_file,
const char *well_pattern, time_t recording_time);
int rd_rft_file_get_size(const rd_rft_file_type *rft_file);
Expand All @@ -35,12 +27,10 @@ rd_rft_node_type *rd_rft_file_iget_node(const rd_rft_file_type *rft_file,
int index);
rd_rft_node_type *rd_rft_file_iget_well_rft(const rd_rft_file_type *rft_file,
const char *well, int index);
bool rd_rft_file_has_well(const rd_rft_file_type *rft_file, const char *well);
int rd_rft_file_get_well_occurences(const rd_rft_file_type *rft_file,
const char *well);
stringlist_type *rd_rft_file_alloc_well_list(const rd_rft_file_type *rft_file);
int rd_rft_file_get_num_wells(const rd_rft_file_type *rft_file);
void rd_rft_file_free__(void *arg);
void rd_rft_file_update(const char *rft_file_name, rd_rft_node_type **nodes,
int num_nodes, ert_rd_unit_enum unit_set);

Expand Down
3 changes: 0 additions & 3 deletions lib/include/resdata/rd_rsthead.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ rd_rsthead_type *rd_rsthead_alloc_from_kw(int report_step,
const rd_kw_type *logihead_kw);
rd_rsthead_type *rd_rsthead_alloc(const rd_file_view_type *rst_file,
int report_step);
rd_rsthead_type *rd_rsthead_alloc_empty(void);
time_t rd_rsthead_date(const rd_kw_type *intehead_kw);
void rd_rsthead_fprintf(const rd_rsthead_type *header, FILE *stream);
void rd_rsthead_fprintf_struct(const rd_rsthead_type *header, FILE *stream);
bool rd_rsthead_equal(const rd_rsthead_type *header1,
const rd_rsthead_type *header2);
double rd_rsthead_get_sim_days(const rd_rsthead_type *header);
Expand Down
66 changes: 0 additions & 66 deletions lib/include/resdata/smspec_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,66 +49,11 @@ typedef enum {

#define SMSPEC_TYPE_ID 61550451

char *smspec_alloc_block_ijk_key(const char *join_string, const char *keyword,
int i, int j, int k);
char *smspec_alloc_completion_ijk_key(const char *join_string,
const char *keyword, const char *wgname,
int i, int j, int k);
char *smspec_alloc_completion_num_key(const char *join_string,
const char *keyword, const char *wgname,
int num);
char *smspec_alloc_group_key(const char *join_string, const char *keyword,
const char *wgname);
char *smspec_alloc_well_key(const char *join_string, const char *keyword,
const char *wgname);
char *smspec_alloc_region_key(const char *join_string, const char *keyword,
int num);
char *smspec_alloc_region_2_region_r1r2_key(const char *join_string,
const char *keyword, int r1,
int r2);
char *smspec_alloc_region_2_region_num_key(const char *join_string,
const char *keyword, int num);
char *smspec_alloc_segment_key(const char *join_string, const char *keyword,
const char *wgname, int num);
char *smspec_alloc_block_num_key(const char *join_string, const char *keyword,
int num);
char *smspec_alloc_local_well_key(const char *join_string, const char *keyword,
const char *lgr_name, const char *wgname);
char *smspec_alloc_local_block_key(const char *join_string, const char *keyword,
const char *lgr_name, int i, int j, int k);
char *smspec_alloc_local_completion_key(const char *join_string,
const char *keyword,
const char *lgr_name,
const char *wgname, int i, int j,
int k);

bool smspec_node_identify_total(const char *keyword,
rd_smspec_var_type var_type);
bool smspec_node_identify_rate(const char *keyword);

bool smspec_node_equal(const void *node1, const void *node2);

void smspec_node_init(void *smspec_node, rd_smspec_var_type var_type,
const char *wgname, const char *keyword, const char *unit,
const char *key_join_string, const int grid_dims[3],
int num);

void *smspec_node_alloc(int param_index, const char *keyword,
const char *wgname, int num, const char *unit,
const int grid_dims[3], float default_value,
const char *key_join_string);

void *smspec_node_alloc_lgr(rd_smspec_var_type var_type, const char *wgname,
const char *keyword, const char *unit,
const char *lgr, const char *key_join_string,
int lgr_i, int lgr_j, int lgr_k, int param_index,
float default_value);

void *smspec_node_alloc_copy(const void *);

void smspec_node_free(void *index);
void smspec_node_free__(void *arg);
void smspec_node_set_params_index(void *smspec_node, int params_index);
int smspec_node_get_params_index(const void *smspec_node);
const char *smspec_node_get_gen_key1(const void *smspec_node);
const char *smspec_node_get_gen_key2(const void *smspec_node);
Expand All @@ -121,21 +66,10 @@ bool smspec_node_is_rate(const void *smspec_node);
bool smspec_node_is_total(const void *smspec_node);
bool smspec_node_is_historical(const void *smspec_node);
bool smspec_node_need_nums(const void *smspec_node);
void smspec_node_fprintf(const void *smspec_node, FILE *stream);

float smspec_node_get_default(const void *smspec_node);

const int *smspec_node_get_ijk(const void *smpsec_node);
const char *smspec_node_get_lgr_name(const void *smpsec_node);
const int *smspec_node_get_lgr_ijk(const void *smpsec_node);

int smspec_node_get_R1(const void *smpsec_node);
int smspec_node_get_R2(const void *smpsec_node);

bool smspec_node_lt(const void *node1, const void *node2);
bool smspec_node_gt(const void *node1, const void *node2);
int smspec_node_cmp(const void *node1, const void *node2);
int smspec_node_cmp__(const void *node1, const void *node2);

#ifdef __cplusplus
}
Expand Down
19 changes: 0 additions & 19 deletions lib/include/resdata/well/well_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ extern "C" {
typedef struct well_info_struct well_info_type;

well_info_type *well_info_alloc(const rd_grid_type *grid);
void well_info_add_UNRST_wells2(well_info_type *well_info,
rd_file_view_type *rst_view,
bool load_segment_information);
void well_info_add_UNRST_wells(well_info_type *well_info,
rd_file_type *rst_file,
bool load_segment_information);
void well_info_add_wells(well_info_type *well_info, rd_file_type *rst_file,
int report_nr, bool load_segment_information);
void well_info_add_wells2(well_info_type *well_info,
rd_file_view_type *rst_view, int report_nr,
bool load_segment_information);
void well_info_load_rstfile(well_info_type *well_info, const char *filename,
bool load_segment_information);
void well_info_load_rst_resfile(well_info_type *well_info,
Expand All @@ -38,17 +27,9 @@ const char *well_info_iget_well_name(const well_info_type *well_info,
int well_index);
bool well_info_has_well(well_info_type *well_info, const char *well_name);

well_state_type *well_info_get_state_from_time(const well_info_type *well_info,
const char *well_name,
time_t sim_time);
well_state_type *
well_info_get_state_from_report(const well_info_type *well_info,
const char *well_name, int report_step);
well_state_type *well_info_iget_state(const well_info_type *well_info,
const char *well_name, int time_index);
well_state_type *well_info_iiget_state(const well_info_type *well_info,
int well_index, int time_index);

#ifdef __cplusplus
}
#endif
Expand Down
5 changes: 0 additions & 5 deletions lib/include/resdata/well/well_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ int well_state_get_well_nr(const well_state_type *well_state);

const well_conn_type *
well_state_get_global_wellhead(const well_state_type *well_state);
const well_conn_type *
well_state_iget_wellhead(const well_state_type *well_state, int grid_nr);
const well_conn_type *well_state_get_wellhead(const well_state_type *well_state,
const char *grid_name);

well_type_enum well_state_translate_rd_type_int(int int_type);

const well_conn_collection_type *
Expand Down
21 changes: 2 additions & 19 deletions lib/resdata/rd_rft_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ rd_rft_file_type *rd_rft_file_alloc(const char *filename) {
for the new name.

*/

char *rd_rft_file_alloc_case_filename(const char *case_input) {
static char *rd_rft_file_alloc_case_filename(const char *case_input) {
rd_file_enum file_type;
bool fmt_file;
file_type = rd_get_file_type(case_input, &fmt_file, NULL);
Expand Down Expand Up @@ -173,10 +172,6 @@ void rd_rft_file_free(rd_rft_file_type *rft_vector) {
delete rft_vector;
}

void rd_rft_file_free__(void *arg) {
rd_rft_file_free(rd_rft_file_safe_cast(arg));
}

/**
Will return the number of RFT nodes in the file. If @well != NULL
only wells matching @well be included. The @well variable can
Expand All @@ -190,7 +185,6 @@ void rd_rft_file_free__(void *arg) {
If recording_time >= only rft_nodes with recording time ==
@recording_time are included.
*/

int rd_rft_file_get_size__(const rd_rft_file_type *rft_file,
const char *well_pattern, time_t recording_time) {
if ((well_pattern == NULL) && (recording_time < 0))
Expand Down Expand Up @@ -221,15 +215,10 @@ int rd_rft_file_get_size__(const rd_rft_file_type *rft_file,
Returns the total number of rft nodes in the file, not caring if
the same well occurse many times and so on.
*/

int rd_rft_file_get_size(const rd_rft_file_type *rft_file) {
return rd_rft_file_get_size__(rft_file, NULL, -1);
}

const char *rd_rft_file_get_filename(const rd_rft_file_type *rft_file) {
return rft_file->filename.c_str();
}

/**
Return rft_node number 'i' in the rft_file - not caring when this
particular RFT is from, or which well it is.
Expand All @@ -238,7 +227,6 @@ const char *rd_rft_file_get_filename(const rd_rft_file_type *rft_file) {
go up in flames - use rd_file_get_size() first if you can not
handle that.
*/

rd_rft_node_type *rd_rft_file_iget_node(const rd_rft_file_type *rft_file,
int index) {
return rft_file->data[index];
Expand All @@ -264,7 +252,7 @@ rd_rft_node_type *rd_rft_file_iget_node(const rd_rft_file_type *rft_file,

If the rft_file does not have the well, or that occurence, the
function will go down in flames with util_abort(). Use
rd_rft_file_has_well() and rd_rft_file_get_well_occurences()
rd_rft_file_get_well_occurences()
first if you can not take util_abort().
*/

Expand Down Expand Up @@ -320,14 +308,9 @@ rd_rft_file_get_well_time_rft(const rd_rft_file_type *rft_file,
}
}

bool rd_rft_file_has_well(const rd_rft_file_type *rft_file, const char *well) {
return (rft_file->well_index.find(well) != rft_file->well_index.end());
}

/**
Returns the number of occurences of 'well' in rft_file.
*/

int rd_rft_file_get_well_occurences(const rd_rft_file_type *rft_file,
const char *well) {
const auto &pair_iter = rft_file->well_index.find(well);
Expand Down
66 changes: 0 additions & 66 deletions lib/resdata/rd_rsthead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,47 +106,6 @@ rd_rsthead_type *rd_rsthead_alloc(const rd_file_view_type *rst_view,
logihead_kw);
}

rd_rsthead_type *rd_rsthead_alloc_empty() {
rd_rsthead_type *rsthead = (rd_rsthead_type *)util_malloc(sizeof *rsthead);

rsthead->day = 0;
rsthead->month = 0;
rsthead->year = 0;
rsthead->version = 0;
rsthead->phase_sum = 0;

rsthead->nx = 0;
rsthead->ny = 0;
rsthead->nz = 0;
rsthead->nactive = 0;

rsthead->nwells = 0;
rsthead->niwelz = 0;
rsthead->nzwelz = 0;

rsthead->nsconz = 0;
rsthead->niconz = 0;
rsthead->ncwmax = 0;

rsthead->nisegz = 0;
rsthead->nsegmx = 0;
rsthead->nswlmx = 0;
rsthead->nrsegz = 0;

rsthead->sim_time = 0;

rsthead->dualp = false;
rsthead->sim_days = 0.0;

return rsthead;
}

void rd_rsthead_fprintf(const rd_rsthead_type *header, FILE *stream) {
fprintf(stream, "nx %d \n", header->nx);
fprintf(stream, "nwells %d \n", header->nwells);
fprintf(stream, "niwelz %d \n\n", header->niwelz);
}

bool rd_rsthead_equal(const rd_rsthead_type *header1,
const rd_rsthead_type *header2) {
bool equal = true;
Expand Down Expand Up @@ -178,31 +137,6 @@ bool rd_rsthead_equal(const rd_rsthead_type *header1,
return equal;
}

void rd_rsthead_fprintf_struct(const rd_rsthead_type *header, FILE *stream) {
fprintf(stream, "{.day = %d,\n", header->day);
fprintf(stream, ".year = %d,\n", header->year);
fprintf(stream, ".month = %d,\n", header->month);
fprintf(stream, ".sim_time = %ld,\n", header->sim_time);
fprintf(stream, ".version = %d,\n", header->version);
fprintf(stream, ".phase_sum = %d,\n", header->phase_sum);
fprintf(stream, ".nx = %d,\n", header->nx);
fprintf(stream, ".ny = %d,\n", header->ny);
fprintf(stream, ".nz = %d,\n", header->nz);
fprintf(stream, ".nactive = %d,\n", header->nactive);
fprintf(stream, ".nwells = %d,\n", header->nwells);
fprintf(stream, ".niwelz = %d,\n", header->niwelz);
fprintf(stream, ".nzwelz = %d,\n", header->nzwelz);
fprintf(stream, ".niconz = %d,\n", header->niconz);
fprintf(stream, ".ncwmax = %d,\n", header->ncwmax);
fprintf(stream, ".nisegz = %d,\n", header->nisegz);
fprintf(stream, ".nsegmx = %d,\n", header->nsegmx);
fprintf(stream, ".nswlmx = %d,\n", header->nswlmx);
fprintf(stream, ".nlbrmx = %d,\n", header->nlbrmx);
fprintf(stream, ".nilbrz = %d,\n", header->nilbrz);
fprintf(stream, ".dualp = %d,\n", header->dualp);
fprintf(stream, ".sim_days = %g};\n", header->sim_days);
}

void rd_rsthead_free(rd_rsthead_type *rsthead) { free(rsthead); }

int rd_rsthead_get_nxconz(const rd_rsthead_type *rsthead) {
Expand Down
Loading