Skip to content

Commit

Permalink
Moved ecl_type_enum back to ecl_util for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Fanebust Dregi committed Apr 3, 2017
1 parent 5328968 commit e35d99a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 53 deletions.
53 changes: 1 addition & 52 deletions libecl/include/ert/ecl/ecl_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,58 +22,7 @@
extern "C" {
#endif

#define ECL_STRING10_LENGTH 10 // Initial guess that the type C010 type is a10 character string.
#define ECL_STRING8_LENGTH 8
#define ECL_TYPE_LENGTH 4

/*****************************************************************/
/*
Observe that these type identidiers are (ab)used in both the rms and
ert/enkf libraries in situations where ECLIPSE is not at all involved.
Regarding the type ECL_C010_TYPE: In an SMSPEC file generated by IX
there was a keyword with header:
NAMES 316 C010
i.e. the type identifier was the string 'C010'. Have not found any
further documentation of that type, but assuming it is a 10
character long string the file loads ok. The ECL_C010_TYPE is
implemented on a very loose basis it is not clear if the
ten-character-long-string implementation makes sense, or if that
just happened to work for the one example we have encountered so
far. For this reason the support for this keyword type is very
limited:
- keywords of this type are not propertly internalized; they are
just cleanly skipped by ecl_kw/ecl_file implementation when
loading a file.
- it is not possible to instantiate a keyword of this type with
ecl_kw_alloc( ).
- The type is not exported to Python.
*/

typedef enum {
ECL_CHAR_TYPE = 0,
ECL_FLOAT_TYPE = 1,
ECL_DOUBLE_TYPE = 2,
ECL_INT_TYPE = 3,
ECL_BOOL_TYPE = 4,
ECL_MESS_TYPE = 5,
ECL_C010_TYPE = 6 // See comment immediately above about the limited support of this type.
} ecl_type_enum;

#define ECL_TYPE_ENUM_DEFS {.value = 0 , .name = "ECL_CHAR_TYPE"}, \
{.value = 1 , .name = "ECL_FLOAT_TYPE"} , \
{.value = 2 , .name = "ECL_DOUBLE_TYPE"}, \
{.value = 3 , .name = "ECL_INT_TYPE"}, \
{.value = 4 , .name = "ECL_BOOL_TYPE"}, \
{.value = 5 , .name = "ECL_MESS_TYPE"}

#define ECL_TYPE_ENUM_SIZE 6

#include <ert/ecl/ecl_util.h>

struct ecl_type_struct {
const ecl_type_enum type;
Expand Down
2 changes: 2 additions & 0 deletions libecl/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ set( source_files
ecl_nnc_export.c
layer.c
fault_block_layer.c
ecl_type.c
${ext_source})

set( header_files
Expand Down Expand Up @@ -81,6 +82,7 @@ set( header_files
layer.h
fault_block.h
fault_block_layer.h
ecl_type.h
${ext_header})

if (ERT_USE_OPENMP)
Expand Down
4 changes: 3 additions & 1 deletion libecl/src/ecl_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <string.h>

#include <ert/util/util.h>
#include <ert/ecl/ecl_util.h>
#include <ert/ecl/ecl_type.h>

/*****************************************************************/
Expand All @@ -35,7 +36,8 @@
#define ECL_TYPE_NAME_MESSAGE "MESS"

ecl_data_type * ecl_type_alloc_copy(const ecl_data_type * src_type) {
ecl_data_type * ecl_type = util_malloc(sizeof * ecl_type);
ecl_data_type * ecl_type;
ecl_type = util_malloc(sizeof * ecl_type);
memcpy(ecl_type, src_type, sizeof * ecl_type);
return ecl_type;
}
Expand Down

0 comments on commit e35d99a

Please sign in to comment.