From bbb42d2dfc6824e88f0d381122bb400104531ddd Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Thu, 8 Aug 2024 14:36:29 +0200 Subject: [PATCH] Remove unused rd_io_config --- lib/CMakeLists.txt | 1 - lib/include/resdata/rd_io_config.hpp | 26 ------ lib/resdata/rd_io_config.cpp | 116 --------------------------- 3 files changed, 143 deletions(-) delete mode 100644 lib/include/resdata/rd_io_config.hpp delete mode 100644 lib/resdata/rd_io_config.cpp diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 6246694c2..580e047c0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -83,7 +83,6 @@ add_library( resdata/rd_grid.cpp resdata/rd_coarse_cell.cpp resdata/rd_box.cpp - resdata/rd_io_config.cpp resdata/rd_file.cpp resdata/rd_region.cpp resdata/rd_subsidence.cpp diff --git a/lib/include/resdata/rd_io_config.hpp b/lib/include/resdata/rd_io_config.hpp deleted file mode 100644 index d1d360eef..000000000 --- a/lib/include/resdata/rd_io_config.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef ERT_RD_IO_CONFIG_H -#define ERT_RD_IO_CONFIG_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct rd_io_config_struct rd_io_config_type; - -/* Modifiers */ -void rd_io_config_set_formatted(rd_io_config_type *, bool); -void rd_io_config_set_unified_restart(rd_io_config_type *, bool); -void rd_io_config_set_unified_summary(rd_io_config_type *, bool); - -/* Accesors */ -bool rd_io_config_get_formatted(rd_io_config_type *); -bool rd_io_config_get_unified_restart(rd_io_config_type *); -bool rd_io_config_get_unified_summary(rd_io_config_type *); - -/* Allocater & destructor */ -rd_io_config_type *rd_io_config_alloc(bool, bool, bool); -void rd_io_config_free(rd_io_config_type *); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/lib/resdata/rd_io_config.cpp b/lib/resdata/rd_io_config.cpp deleted file mode 100644 index 2ebd9f8ad..000000000 --- a/lib/resdata/rd_io_config.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include -#include - -#include - -#include -#include - -/** - This file implements a pathetically small struct which is used to - pack three booleans representing eclipse IO configuration. The - three config items which are stored are: - - * formatted : whether to use formatted files. - * unified : whether unified summary || restart files should be used. - - All types are implemented by an internal enum which supports a - undefined type. The rationale for this is to provide functionality - to 'guess' type based on arbitrary input. If for instance the input - file is formatted, it is impossible to infer whether we should flip - endian ness. -*/ - -typedef enum { UNIFIED = 0, MULTIPLE = 1, UNIF_UNDEFINED = 2 } unified_type; - -typedef enum { - FORMATTED = 0, - UNFORMATTED = 1, - FMT_UNDEFINED = 2 -} formatted_type; - -struct rd_io_config_struct { - formatted_type formatted; - unified_type unified_restart; - unified_type unified_summary; -}; - -static rd_io_config_type *rd_io_config_alloc__() { - rd_io_config_type *rd_io_config = - (rd_io_config_type *)util_malloc(sizeof *rd_io_config); - - rd_io_config->formatted = FMT_UNDEFINED; - rd_io_config->unified_restart = UNIF_UNDEFINED; - rd_io_config->unified_summary = UNIF_UNDEFINED; - - return rd_io_config; -} - -void rd_io_config_set_formatted(rd_io_config_type *io_config, bool formatted) { - if (formatted) - io_config->formatted = FORMATTED; - else - io_config->formatted = UNFORMATTED; -} - -void rd_io_config_set_unified_restart(rd_io_config_type *io_config, - bool unified) { - if (unified) - io_config->unified_restart = UNIFIED; - else - io_config->unified_restart = MULTIPLE; -} - -void rd_io_config_set_unified_summary(rd_io_config_type *io_config, - bool unified) { - if (unified) - io_config->unified_summary = UNIFIED; - else - io_config->unified_summary = MULTIPLE; -} - -bool rd_io_config_get_formatted(rd_io_config_type *io_config) { - if (io_config->formatted == FORMATTED) - return true; - else if (io_config->formatted == UNFORMATTED) - return false; - else { - util_abort("%s: formatted_state == undefined - sorry \n", __func__); - return false; /* Compiler shut up */ - } -} - -bool rd_io_config_get_unified_summary(rd_io_config_type *io_config) { - if (io_config->unified_summary == UNIFIED) - return true; - else if (io_config->unified_summary == MULTIPLE) - return false; - else { - util_abort("%s: unified_state == undefined - sorry \n", __func__); - return false; /* Compiler shut up */ - } -} - -bool rd_io_config_get_unified_restart(rd_io_config_type *io_config) { - if (io_config->unified_restart == UNIFIED) - return true; - else if (io_config->unified_restart == MULTIPLE) - return false; - else { - util_abort("%s: formatted_state == undefined - sorry \n", __func__); - return false; /* Compiler shut up */ - } -} - -rd_io_config_type *rd_io_config_alloc(bool formatted, bool unified_summary, - bool unified_restart) { - rd_io_config_type *rd_io_config = rd_io_config_alloc__(); - - rd_io_config_set_formatted(rd_io_config, formatted); - rd_io_config_set_unified_restart(rd_io_config, unified_restart); - rd_io_config_set_unified_summary(rd_io_config, unified_summary); - - return rd_io_config; -} - -void rd_io_config_free(rd_io_config_type *io_config) { free(io_config); }