ecl_util.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2011 Equinor ASA, Norway.
3
4 The file 'ecl_util.h' is part of ERT - Ensemble based Reservoir Tool.
5
6 ERT is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 ERT is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.
14
15 See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
16 for more details.
17*/
18
19#ifndef ERT_ECL_UTIL_H
20#define ERT_ECL_UTIL_H
21#ifdef __cplusplus
22extern "C" {
23#endif
24#include <stdbool.h>
25#include <time.h>
26
28#include <ert/util/time_t_vector.hpp>
29#include <ert/util/parser.hpp>
30#include <ert/ecl/ecl_type.hpp>
31
32
33typedef enum { ECL_OTHER_FILE = 0 ,
44
45
46
47 /*
48 This enum enumerates the four different ways summary and restart information
49 can be stored.
50 */
51
52
53 typedef enum { ECL_INVALID_STORAGE = 0,
58
59/*
60 The libecl library has been built and tested 99.5% with ECLIPSE100
61 as context, but in thye gravity code there is some very limited
62 functionality related to ECLIPSE100 versus ECLIPSE300 functionality.
63
64 Observe that numerical values found as part of the INTEHAD keyword
65 differ from these values, and are found in the ecl_kw_magic.h
66 header.
67*/
68
69typedef enum {
75 FRONTSIM = 5
77
78/*
79 Observe that the numerical enum VALUES matches those found in item
80 14 in the INTEHEAD keyword in the ECLIPSE INIT files; i.e. the
81 distribution of numerical values 1,2,4 can NOT BE CHANGED.
82
83 The function ecl_util_get_phase_name() can be used to lookup a
84 string name from an enum value.
85
86 The phases in a simulation will typically be a sum of these
87 fundamental phases, and represented as an integer.
88*/
89
90typedef enum {
95
96#define ECL_PHASE_ENUM_DEFS {.value = 1 , .name = "ECL_OIL_PHASE"}, {.value = 2 , .name = "ECL_GAS_PHASE"} , {.value = 4 , .name = "ECL_WATER_PHASE"}
97#define ECL_PHASE_ENUM_SIZE 3
98
99typedef enum {
105
106
107// For unformatted files:
108#define ECL_BOOL_TRUE_INT -1 // Binary representation: 11111111 11111111 11111111 1111111
109#define ECL_BOOL_FALSE_INT 0 // Binary representation: 00000000 00000000 00000000 0000000
110#define ECL_COMMENT_STRING "--"
111#define ECL_COMMENT_CHAR '-' // Need to consecutive to make an ECLIPSE comment
112#define ECL_DATA_TERMINATION "/"
113
114
115/*****************************************************************/
116bool ecl_util_unified_file(const char *filename);
117const char * ecl_util_file_type_name( ecl_file_enum file_type );
118char * ecl_util_alloc_base_guess(const char *);
120ecl_file_enum ecl_util_inspect_extension(const char * ext , bool *_fmt_file, int * _report_nr);
121ecl_file_enum ecl_util_get_file_type(const char * filename, bool * fmt_file, int * report_nr);
122char * ecl_util_alloc_filename(const char * /* path */, const char * /* base */, ecl_file_enum , bool /* fmt_file */ , int /*report_nr*/);
123char * ecl_util_alloc_exfilename(const char * /* path */, const char * /* base */, ecl_file_enum , bool /* fmt_file */ , int /*report_nr*/);
124void ecl_util_memcpy_typed_data(void *, const void * , ecl_data_type , ecl_data_type , int );
125void ecl_util_escape_kw(char * kw);
126bool ecl_util_alloc_summary_files(const char * , const char * , const char * , char ** , stringlist_type * );
127void ecl_util_alloc_summary_data_files(const char * path , const char * base , bool fmt_file , stringlist_type * filelist);
128void ecl_util_alloc_restart_files(const char * , const char * , char *** , int * , bool * , bool *);
129time_t ecl_util_get_start_date(const char * );
130int ecl_util_get_num_cpu(const char * data_file);
131bool ecl_util_fmt_file(const char * filename , bool * __fmt_file);
132char * ecl_util_alloc_exfilename_anyfmt(const char * path, const char * base , ecl_file_enum file_type , bool start_fmt , int report_nr);
133int ecl_util_get_month_nr(const char * month_name);
134int ecl_util_fname_report_cmp(const void *f1, const void *f2);
135time_t ecl_util_make_date(int mday , int month , int year);
136time_t ecl_util_make_date__(int mday , int month , int year, int * year_offset);
138
139bool ecl_util_valid_basename_fmt( const char * basename_fmt );
142
143int ecl_util_select_filelist( const char * path , const char * base , ecl_file_enum file_type , bool fmt_file , stringlist_type * filelist);
144void ecl_util_append_month_range( time_t_vector_type * date_list , time_t start_date , time_t end_date , bool force_append_end);
145void ecl_util_init_month_range( time_t_vector_type * date_list , time_t start_date , time_t end_date);
146void ecl_util_set_date_values(time_t t , int * mday , int * month , int * year);
147bool ecl_util_path_access(const char * ecl_case);
148#ifdef __cplusplus
149}
150#endif
151#endif
int ecl_util_get_month_nr(const char *month_name)
bool ecl_util_valid_basename(const char *basename)
char * ecl_util_alloc_base_guess(const char *)
void ecl_util_append_month_range(time_t_vector_type *date_list, time_t start_date, time_t end_date, bool force_append_end)
void ecl_util_memcpy_typed_data(void *, const void *, ecl_data_type, ecl_data_type, int)
bool ecl_util_valid_basename_fmt(const char *basename_fmt)
void ecl_util_set_date_values(time_t t, int *mday, int *month, int *year)
ert_ecl_unit_enum
Definition: ecl_util.hpp:99
@ ECL_PVT_M_UNITS
Definition: ecl_util.hpp:103
@ ECL_LAB_UNITS
Definition: ecl_util.hpp:102
@ ECL_METRIC_UNITS
Definition: ecl_util.hpp:100
@ ECL_FIELD_UNITS
Definition: ecl_util.hpp:101
ecl_storage_enum
Definition: ecl_util.hpp:53
@ ECL_INVALID_STORAGE
Definition: ecl_util.hpp:53
@ ECL_BINARY_UNIFIED
Definition: ecl_util.hpp:54
@ ECL_FORMATTED_UNIFIED
Definition: ecl_util.hpp:55
@ ECL_FORMATTED_NON_UNIFIED
Definition: ecl_util.hpp:57
@ ECL_BINARY_NON_UNIFIED
Definition: ecl_util.hpp:56
void ecl_util_escape_kw(char *kw)
ecl_version_enum
Definition: ecl_util.hpp:69
@ ECLIPSE300_THERMAL
Definition: ecl_util.hpp:73
@ FRONTSIM
Definition: ecl_util.hpp:75
@ INTERSECT
Definition: ecl_util.hpp:74
@ ECLIPSE100
Definition: ecl_util.hpp:71
@ ECLIPSE_UNDEFINED
Definition: ecl_util.hpp:70
@ ECLIPSE300
Definition: ecl_util.hpp:72
bool ecl_util_path_access(const char *ecl_case)
time_t ecl_util_get_start_date(const char *)
bool ecl_util_unified_file(const char *filename)
int ecl_util_get_num_cpu(const char *data_file)
bool ecl_util_alloc_summary_files(const char *, const char *, const char *, char **, stringlist_type *)
const char * ecl_util_get_phase_name(ecl_phase_enum phase)
void ecl_util_alloc_restart_files(const char *, const char *, char ***, int *, bool *, bool *)
int ecl_util_fname_report_cmp(const void *f1, const void *f2)
ecl_file_enum
Definition: ecl_util.hpp:33
@ ECL_UNIFIED_RESTART_FILE
Definition: ecl_util.hpp:35
@ ECL_RESTART_FILE
Definition: ecl_util.hpp:34
@ ECL_DATA_FILE
Definition: ecl_util.hpp:43
@ ECL_INIT_FILE
Definition: ecl_util.hpp:41
@ ECL_RFT_FILE
Definition: ecl_util.hpp:42
@ ECL_SUMMARY_FILE
Definition: ecl_util.hpp:36
@ ECL_EGRID_FILE
Definition: ecl_util.hpp:40
@ ECL_SUMMARY_HEADER_FILE
Definition: ecl_util.hpp:38
@ ECL_OTHER_FILE
Definition: ecl_util.hpp:33
@ ECL_GRID_FILE
Definition: ecl_util.hpp:39
@ ECL_UNIFIED_SUMMARY_FILE
Definition: ecl_util.hpp:37
char * ecl_util_alloc_exfilename(const char *, const char *, ecl_file_enum, bool, int)
ert_ecl_unit_enum ecl_util_get_unit_set(const char *data_file)
time_t ecl_util_make_date__(int mday, int month, int year, int *year_offset)
const char * ecl_util_file_type_name(ecl_file_enum file_type)
char * ecl_util_alloc_filename(const char *, const char *, ecl_file_enum, bool, int)
bool ecl_util_fmt_file(const char *filename, bool *__fmt_file)
time_t ecl_util_make_date(int mday, int month, int year)
void ecl_util_init_month_range(time_t_vector_type *date_list, time_t start_date, time_t end_date)
int ecl_util_select_filelist(const char *path, const char *base, ecl_file_enum file_type, bool fmt_file, stringlist_type *filelist)
int ecl_util_filename_report_nr(const char *)
ecl_file_enum ecl_util_inspect_extension(const char *ext, bool *_fmt_file, int *_report_nr)
ecl_phase_enum
Definition: ecl_util.hpp:90
@ ECL_GAS_PHASE
Definition: ecl_util.hpp:92
@ ECL_WATER_PHASE
Definition: ecl_util.hpp:93
@ ECL_OIL_PHASE
Definition: ecl_util.hpp:91
char * ecl_util_alloc_exfilename_anyfmt(const char *path, const char *base, ecl_file_enum file_type, bool start_fmt, int report_nr)
void ecl_util_alloc_summary_data_files(const char *path, const char *base, bool fmt_file, stringlist_type *filelist)
ecl_file_enum ecl_util_get_file_type(const char *filename, bool *fmt_file, int *report_nr)
constexpr const double year
Definition: custom-opm-common/opm-common/opm/parser/eclipse/Units/Units.hpp:108
std::string basename(const std::string &fname)
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t t(t+t)") define_sfop3(16
struct stringlist_struct stringlist_type
Definition: stringlist.hpp:34
Definition: ecl_type.hpp:72