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 #1016

Merged
merged 5 commits into from
Aug 30, 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
11 changes: 0 additions & 11 deletions lib/include/resdata/rd_coarse_cell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,9 @@ void rd_coarse_cell_update(rd_coarse_cell_type *coarse_cell, int i, int j,
void rd_coarse_cell_free(rd_coarse_cell_type *coarse_cell);
void rd_coarse_cell_free__(void *arg);

int rd_coarse_cell_get_i1(const rd_coarse_cell_type *coarse_cell);
int rd_coarse_cell_get_j1(const rd_coarse_cell_type *coarse_cell);
int rd_coarse_cell_get_k1(const rd_coarse_cell_type *coarse_cell);
int rd_coarse_cell_get_i2(const rd_coarse_cell_type *coarse_cell);
int rd_coarse_cell_get_j2(const rd_coarse_cell_type *coarse_cell);
int rd_coarse_cell_get_k2(const rd_coarse_cell_type *coarse_cell);
const int *rd_coarse_cell_get_box_ptr(const rd_coarse_cell_type *coarse_cell);

int rd_coarse_cell_get_size(const rd_coarse_cell_type *coarse_cell);
int rd_coarse_cell_iget_cell_index(rd_coarse_cell_type *coarse_cell,
int group_index);
const int *rd_coarse_cell_get_index_ptr(rd_coarse_cell_type *coarse_cell);
const int_vector_type *
rd_coarse_cell_get_index_vector(rd_coarse_cell_type *coarse_cell);
Expand All @@ -42,9 +34,6 @@ int rd_coarse_cell_iget_active_cell_index(
int rd_coarse_cell_iget_active_value(const rd_coarse_cell_type *coarse_cell,
int index);
int rd_coarse_cell_get_num_active(const rd_coarse_cell_type *coarse_cell);
void rd_coarse_cell_fprintf(const rd_coarse_cell_type *coarse_cell,
FILE *stream);

#ifdef __cplusplus
}
#endif
Expand Down
13 changes: 0 additions & 13 deletions lib/include/resdata/rd_sum_index.hpp

This file was deleted.

1 change: 0 additions & 1 deletion lib/include/resdata/well/well_branch_collection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ typedef struct well_branch_collection_struct well_branch_collection_type;

well_branch_collection_type *well_branch_collection_alloc(void);
void well_branch_collection_free(well_branch_collection_type *branches);
void well_branch_collection_free__(void *arg);
bool well_branch_collection_has_branch(
const well_branch_collection_type *branches, int branch_id);
int well_branch_collection_get_size(
Expand Down
1 change: 0 additions & 1 deletion lib/include/resdata/well/well_segment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ well_segment_alloc_from_kw(const rd_kw_type *iseg_kw,
well_segment_type *well_segment_alloc(int segment_id, int outlet_segment_id,
int branch_id, const double *rseg_data);
void well_segment_free(well_segment_type *segment);
void well_segment_free__(void *arg);

bool well_segment_active(const well_segment_type *segment);
bool well_segment_main_stem(const well_segment_type *segment);
Expand Down
4 changes: 0 additions & 4 deletions lib/include/resdata/well/well_ts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ typedef struct well_ts_struct well_ts_type;
void well_ts_free(well_ts_type *well_ts);
void well_ts_add_well(well_ts_type *well_ts, well_state_type *well_state);
well_ts_type *well_ts_alloc(const char *well_name);
void well_ts_free__(void *arg);
well_state_type *well_ts_get_state_from_sim_time(const well_ts_type *well_ts,
time_t sim_time);
well_state_type *well_ts_get_state_from_report(const well_ts_type *well_ts,
int report_nr);
well_state_type *well_ts_iget_state(const well_ts_type *well_ts, int index);
int well_ts_get_size(const well_ts_type *well_ts);
const char *well_ts_get_name(const well_ts_type *well_ts);
well_state_type *well_ts_get_first_state(const well_ts_type *well_ts);
well_state_type *well_ts_get_last_state(const well_ts_type *well_ts);

#ifdef __cplusplus
Expand Down
75 changes: 17 additions & 58 deletions lib/resdata/rd_coarse_cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,7 @@ struct rd_coarse_cell_struct {
int_vector_type *active_values;
};

static UTIL_SAFE_CAST_FUNCTION(rd_coarse_cell, RD_COARSE_CELL_TYPE_ID)

void rd_coarse_cell_assert(rd_coarse_cell_type *coarse_cell) {
int box_size = (1 + coarse_cell->ijk[1] - coarse_cell->ijk[0]) *
(1 + coarse_cell->ijk[2] - coarse_cell->ijk[3]) *
(1 + coarse_cell->ijk[4] - coarse_cell->ijk[5]);

if (box_size != int_vector_size(coarse_cell->cell_list))
util_abort("%s: using invalid coarse cell. Box size:%d cells. "
"cell_list:%d cells \n",
__func__, box_size, int_vector_size(coarse_cell->cell_list));
}
static UTIL_SAFE_CAST_FUNCTION(rd_coarse_cell, RD_COARSE_CELL_TYPE_ID);

rd_coarse_cell_type *rd_coarse_cell_alloc() {
const int LARGE = 1 << 30;
Expand All @@ -134,6 +123,22 @@ rd_coarse_cell_type *rd_coarse_cell_alloc() {
return coarse_cell;
}

static void rd_coarse_cell_fprintf(const rd_coarse_cell_type *coarse_cell,
FILE *stream) {
fprintf(stream, "Coarse box: \n");
fprintf(stream, " i : %3d - %3d\n", coarse_cell->ijk[0],
coarse_cell->ijk[1]);
fprintf(stream, " j : %3d - %3d\n", coarse_cell->ijk[2],
coarse_cell->ijk[3]);
fprintf(stream, " k : %3d - %3d\n", coarse_cell->ijk[4],
coarse_cell->ijk[5]);
fprintf(stream, " active_cells : ");
int_vector_fprintf(coarse_cell->active_cells, stream, "", "%5d ");
fprintf(stream, " active_values : ");
int_vector_fprintf(coarse_cell->active_values, stream, "", "%5d ");
//fprintf(stream," Cells : " ); int_vector_fprintf( coarse_cell->cell_list , stream , "" , "%5d ");
}

bool rd_coarse_cell_equal(const rd_coarse_cell_type *coarse_cell1,
const rd_coarse_cell_type *coarse_cell2) {
bool equal = true;
Expand Down Expand Up @@ -211,12 +216,6 @@ int rd_coarse_cell_get_size(const rd_coarse_cell_type *coarse_cell) {
return int_vector_size(coarse_cell->cell_list);
}

int rd_coarse_cell_iget_cell_index(rd_coarse_cell_type *coarse_cell,
int group_index) {
rd_coarse_cell_sort(coarse_cell);
return int_vector_iget(coarse_cell->cell_list, group_index);
}

const int *rd_coarse_cell_get_index_ptr(rd_coarse_cell_type *coarse_cell) {
rd_coarse_cell_sort(coarse_cell);
return int_vector_get_const_ptr(coarse_cell->cell_list);
Expand All @@ -228,30 +227,6 @@ rd_coarse_cell_get_index_vector(rd_coarse_cell_type *coarse_cell) {
return coarse_cell->cell_list;
}

int rd_coarse_cell_get_i1(const rd_coarse_cell_type *coarse_cell) {
return coarse_cell->ijk[0];
}

int rd_coarse_cell_get_i2(const rd_coarse_cell_type *coarse_cell) {
return coarse_cell->ijk[1];
}

int rd_coarse_cell_get_j1(const rd_coarse_cell_type *coarse_cell) {
return coarse_cell->ijk[2];
}

int rd_coarse_cell_get_j2(const rd_coarse_cell_type *coarse_cell) {
return coarse_cell->ijk[3];
}

int rd_coarse_cell_get_k1(const rd_coarse_cell_type *coarse_cell) {
return coarse_cell->ijk[4];
}

int rd_coarse_cell_get_k2(const rd_coarse_cell_type *coarse_cell) {
return coarse_cell->ijk[5];
}

const int *rd_coarse_cell_get_box_ptr(const rd_coarse_cell_type *coarse_cell) {
return coarse_cell->ijk;
}
Expand Down Expand Up @@ -317,19 +292,3 @@ int rd_coarse_cell_iget_active_value(const rd_coarse_cell_type *coarse_cell,
int rd_coarse_cell_get_num_active(const rd_coarse_cell_type *coarse_cell) {
return int_vector_size(coarse_cell->active_cells);
}

void rd_coarse_cell_fprintf(const rd_coarse_cell_type *coarse_cell,
FILE *stream) {
fprintf(stream, "Coarse box: \n");
fprintf(stream, " i : %3d - %3d\n", coarse_cell->ijk[0],
coarse_cell->ijk[1]);
fprintf(stream, " j : %3d - %3d\n", coarse_cell->ijk[2],
coarse_cell->ijk[3]);
fprintf(stream, " k : %3d - %3d\n", coarse_cell->ijk[4],
coarse_cell->ijk[5]);
fprintf(stream, " active_cells : ");
int_vector_fprintf(coarse_cell->active_cells, stream, "", "%5d ");
fprintf(stream, " active_values : ");
int_vector_fprintf(coarse_cell->active_values, stream, "", "%5d ");
//fprintf(stream," Cells : " ); int_vector_fprintf( coarse_cell->cell_list , stream , "" , "%5d ");
}
23 changes: 0 additions & 23 deletions lib/resdata/rd_sum_index.cpp

This file was deleted.

6 changes: 0 additions & 6 deletions lib/resdata/well_branch_collection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ void well_branch_collection_free(well_branch_collection_type *branches) {
delete branches;
}

void well_branch_collection_free__(void *arg) {
well_branch_collection_type *branches =
well_branch_collection_safe_cast(arg);
well_branch_collection_free(branches);
}

int well_branch_collection_get_size(
const well_branch_collection_type *branches) {
return branches->__start_segments.size();
Expand Down
19 changes: 0 additions & 19 deletions lib/resdata/well_segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,32 +98,13 @@ well_segment_alloc_from_kw(const rd_kw_type *iseg_kw,
}
}

/*
if (iseg_kw != NULL) {
if (conn->segment != WELL_CONN_NORMAL_WELL_SEGMENT_ID) {

} else {
conn->branch = 0;
conn->outlet_segment = 0;
}
} else {
conn->branch = 0;
conn->outlet_segment = 0;
}
*/

void well_segment_free(well_segment_type *segment) {
for (auto &pair : segment->connections)
well_conn_collection_free(pair.second);

delete segment;
}

void well_segment_free__(void *arg) {
well_segment_type *segment = well_segment_safe_cast(arg);
well_segment_free(segment);
}

bool well_segment_active(const well_segment_type *segment) {
if (segment->branch_id == WELL_SEGMENT_BRANCH_INACTIVE_VALUE)
return false;
Expand Down
18 changes: 0 additions & 18 deletions lib/resdata/well_ts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,8 @@ void well_ts_free(well_ts_type *well_ts) {
delete well_ts;
}

void well_ts_free__(void *arg) {
well_ts_type *well_ts = well_ts_safe_cast(arg);
well_ts_free(well_ts);
}

int well_ts_get_size(const well_ts_type *well_ts) { return well_ts->ts.size(); }

well_state_type *well_ts_get_first_state(const well_ts_type *well_ts) {
return well_ts_iget_state(well_ts, 0);
}

well_state_type *well_ts_get_last_state(const well_ts_type *well_ts) {
return well_ts_iget_state(well_ts, well_ts->ts.size() - 1);
}
Expand All @@ -273,12 +264,3 @@ well_state_type *well_ts_get_state_from_report(const well_ts_type *well_ts,
else
return well_ts_iget_state(well_ts, index);
}

well_state_type *well_ts_get_state_from_sim_time(const well_ts_type *well_ts,
time_t sim_time) {
int index = well_ts_get_index(well_ts, -1, sim_time, false);
if (index < 0)
return NULL;
else
return well_ts_iget_state(well_ts, index);
}