ecl_file.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2011 Equinor ASA, Norway.
3
4 The file 'ecl_file.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_FILE_H
20#define ERT_ECL_FILE_H
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include <stdbool.h>
27#include <time.h>
28
29
30#include <ert/ecl/ecl_kw.hpp>
33#include <ert/ecl/fortio.h>
34#include <ert/ecl/ecl_util.hpp>
35#include <ert/ecl/ecl_type.hpp>
36
37
38
39#define ECL_FILE_FLAGS_ENUM_DEFS \
40 {.value = 1 , .name="ECL_FILE_CLOSE_STREAM"}, \
41 {.value = 2 , .name="ECL_FILE_WRITABLE"}
42#define ECL_FILE_FLAGS_ENUM_SIZE 2
43
44
45
46
47 typedef struct ecl_file_struct ecl_file_type;
48 bool ecl_file_load_all( ecl_file_type * ecl_file );
49 ecl_file_type * ecl_file_open( const char * filename , int flags);
50 ecl_file_type * ecl_file_fast_open( const char * filename , const char * index_filename , int flags);
51 bool ecl_file_write_index( const ecl_file_type * ecl_file , const char * index_filename);
52 bool ecl_file_index_valid(const char * file_name, const char * index_file_name);
53 void ecl_file_close( ecl_file_type * ecl_file );
55 void ecl_file_free__(void * arg);
56 ecl_kw_type * ecl_file_icopy_named_kw( const ecl_file_type * ecl_file , const char * kw, int ith);
58 bool ecl_file_has_kw( const ecl_file_type * ecl_file , const char * kw);
59 int ecl_file_get_num_named_kw(const ecl_file_type * ecl_file , const char * kw);
60 int ecl_file_get_size( const ecl_file_type * ecl_file );
62 const char * ecl_file_iget_distinct_kw(const ecl_file_type * ecl_file , int index);
63 const char * ecl_file_get_src_file( const ecl_file_type * ecl_file );
64 int ecl_file_iget_occurence( const ecl_file_type * ecl_file , int index);
66 void ecl_file_fwrite_fortio(const ecl_file_type * ec_file , fortio_type * fortio , int offset);
67 void ecl_file_fwrite(const ecl_file_type * ecl_file , const char * , bool fmt_file );
68
69 void ecl_file_replace_kw( ecl_file_type * ecl_file , ecl_kw_type * old_kw , ecl_kw_type * new_kw , bool insert_copy);
70 int ecl_file_get_phases( const ecl_file_type * init_file );
71 void ecl_file_fprintf_kw_list( const ecl_file_type * ecl_file , FILE * stream );
72
73 bool ecl_file_writable( const ecl_file_type * ecl_file );
74 int ecl_file_get_flags( const ecl_file_type * ecl_file );
75 void ecl_file_set_flags( ecl_file_type * ecl_file, int new_flags );
76 bool ecl_file_flags_set( const ecl_file_type * ecl_file , int flags);
77
78
79
80 ecl_file_kw_type * ecl_file_iget_file_kw( const ecl_file_type * file , int global_index);
81 ecl_file_kw_type * ecl_file_iget_named_file_kw( const ecl_file_type * file , const char * kw, int ith);
82 ecl_kw_type * ecl_file_iget_kw( const ecl_file_type * file , int global_index);
83 ecl_data_type ecl_file_iget_data_type( const ecl_file_type * file , int global_index);
84 int ecl_file_iget_size( const ecl_file_type * file , int global_index);
85 const char * ecl_file_iget_header( const ecl_file_type * file , int global_index);
86 ecl_kw_type * ecl_file_iget_named_kw( const ecl_file_type * file , const char * kw, int ith);
87 ecl_data_type ecl_file_iget_named_data_type( const ecl_file_type * file , const char * kw , int ith);
88 int ecl_file_iget_named_size( const ecl_file_type * file , const char * kw , int ith);
89 void ecl_file_indexed_read(const ecl_file_type * file , const char * kw, int index, const int_vector_type * index_map, char* buffer);
90
91 ecl_file_view_type * ecl_file_get_global_blockview( ecl_file_type * ecl_file , const char * kw , int occurence);
92 ecl_file_view_type * ecl_file_alloc_global_blockview( ecl_file_type * ecl_file , const char * kw , int occurence);
95 //bool ecl_file_writable( const ecl_file_type * ecl_file );
96 bool ecl_file_save_kw( const ecl_file_type * ecl_file , const ecl_kw_type * ecl_kw);
97 bool ecl_file_has_kw_ptr( const ecl_file_type * ecl_file , const ecl_kw_type * ecl_kw);
98
99/*****************************************************************/
100/* R E S T A R T F I L E S */
101
102 double ecl_file_iget_restart_sim_days( const ecl_file_type * restart_file , int index );
103 time_t ecl_file_iget_restart_sim_date( const ecl_file_type * restart_file , int occurence );
104 int ecl_file_get_restart_index( const ecl_file_type * restart_file , time_t sim_time);
105 bool ecl_file_has_report_step( const ecl_file_type * ecl_file , int report_step);
106 bool ecl_file_has_sim_time( const ecl_file_type * ecl_file , time_t sim_time);
107
108
110
111 ecl_file_view_type * ecl_file_get_restart_view( ecl_file_type * ecl_file , int input_index, int report_step , time_t sim_time, double sim_days);
113
114/*****************************************************************/
115/* SUMMARY FILES */
116
118
119 //Deprecated:
120
123 bool ecl_file_subselect_block( ecl_file_type * ecl_file , const char * kw , int occurence);
124 bool ecl_file_select_block( ecl_file_type * ecl_file , const char * kw , int occurence);
125
126 bool ecl_file_select_rstblock_sim_time( ecl_file_type * ecl_file , time_t sim_time);
127 bool ecl_file_select_rstblock_report_step( ecl_file_type * ecl_file , int report_step);
128 bool ecl_file_iselect_rstblock( ecl_file_type * ecl_file , int seqnum_index );
129 ecl_file_type * ecl_file_open_rstblock_report_step( const char * filename , int report_step , int flags);
130 ecl_file_type * ecl_file_open_rstblock_sim_time( const char * filename , time_t sim_time , int flags);
131 ecl_file_type * ecl_file_iopen_rstblock( const char * filename , int seqnum_index , int flags);
132
133
134#ifdef __cplusplus
135}
136#endif
137#endif
struct ecl_file_struct ecl_file_type
Definition: ECLResultData.hpp:39
int index
Definition: cJSON.h:168
char * buffer
Definition: cJSON.h:161
ecl_file_view_type * ecl_file_get_active_view(ecl_file_type *ecl_file)
ecl_file_type * ecl_file_fast_open(const char *filename, const char *index_filename, int flags)
void ecl_file_replace_kw(ecl_file_type *ecl_file, ecl_kw_type *old_kw, ecl_kw_type *new_kw, bool insert_copy)
bool ecl_file_write_index(const ecl_file_type *ecl_file, const char *index_filename)
void ecl_file_fprintf_kw_list(const ecl_file_type *ecl_file, FILE *stream)
bool ecl_file_has_sim_time(const ecl_file_type *ecl_file, time_t sim_time)
bool ecl_file_iselect_rstblock(ecl_file_type *ecl_file, int seqnum_index)
bool ecl_file_index_valid(const char *file_name, const char *index_file_name)
void ecl_file_free__(void *arg)
const char * ecl_file_iget_header(const ecl_file_type *file, int global_index)
ecl_kw_type * ecl_file_icopy_named_kw(const ecl_file_type *ecl_file, const char *kw, int ith)
ecl_kw_type * ecl_file_icopy_kw(const ecl_file_type *ecl_file, int index)
bool ecl_file_has_report_step(const ecl_file_type *ecl_file, int report_step)
bool ecl_file_has_kw_ptr(const ecl_file_type *ecl_file, const ecl_kw_type *ecl_kw)
void ecl_file_set_flags(ecl_file_type *ecl_file, int new_flags)
bool ecl_file_select_rstblock_report_step(ecl_file_type *ecl_file, int report_step)
double ecl_file_iget_restart_sim_days(const ecl_file_type *restart_file, int index)
ecl_version_enum ecl_file_get_ecl_version(const ecl_file_type *file)
bool ecl_file_writable(const ecl_file_type *ecl_file)
void ecl_file_close_fortio_stream(ecl_file_type *ecl_file)
void ecl_file_close(ecl_file_type *ecl_file)
int ecl_file_get_restart_index(const ecl_file_type *restart_file, time_t sim_time)
UTIL_IS_INSTANCE_HEADER(ecl_file)
int ecl_file_get_size(const ecl_file_type *ecl_file)
bool ecl_file_has_kw(const ecl_file_type *ecl_file, const char *kw)
int ecl_file_iget_size(const ecl_file_type *file, int global_index)
ecl_file_type * ecl_file_iopen_rstblock(const char *filename, int seqnum_index, int flags)
bool ecl_file_flags_set(const ecl_file_type *ecl_file, int flags)
int ecl_file_get_num_named_kw(const ecl_file_type *ecl_file, const char *kw)
ecl_file_view_type * ecl_file_get_restart_view(ecl_file_type *ecl_file, int input_index, int report_step, time_t sim_time, double sim_days)
ecl_file_view_type * ecl_file_get_summary_view(ecl_file_type *ecl_file, int report_step)
void ecl_file_indexed_read(const ecl_file_type *file, const char *kw, int index, const int_vector_type *index_map, char *buffer)
void ecl_file_fwrite_fortio(const ecl_file_type *ec_file, fortio_type *fortio, int offset)
void ecl_file_pop_block(ecl_file_type *ecl_file)
void ecl_file_fwrite(const ecl_file_type *ecl_file, const char *, bool fmt_file)
ecl_file_type * ecl_file_open_rstblock_report_step(const char *filename, int report_step, int flags)
ecl_kw_type * ecl_file_iget_named_kw(const ecl_file_type *file, const char *kw, int ith)
int ecl_file_get_flags(const ecl_file_type *ecl_file)
int ecl_file_iget_named_size(const ecl_file_type *file, const char *kw, int ith)
bool ecl_file_load_all(ecl_file_type *ecl_file)
const char * ecl_file_iget_distinct_kw(const ecl_file_type *ecl_file, int index)
ecl_file_view_type * ecl_file_get_global_view(ecl_file_type *ecl_file)
int ecl_file_iget_occurence(const ecl_file_type *ecl_file, int index)
ecl_file_kw_type * ecl_file_iget_file_kw(const ecl_file_type *file, int global_index)
ecl_data_type ecl_file_iget_data_type(const ecl_file_type *file, int global_index)
ecl_file_view_type * ecl_file_alloc_global_blockview(ecl_file_type *ecl_file, const char *kw, int occurence)
void ecl_file_push_block(ecl_file_type *ecl_file)
ecl_file_type * ecl_file_open(const char *filename, int flags)
ecl_file_kw_type * ecl_file_iget_named_file_kw(const ecl_file_type *file, const char *kw, int ith)
ecl_file_type * ecl_file_open_rstblock_sim_time(const char *filename, time_t sim_time, int flags)
bool ecl_file_save_kw(const ecl_file_type *ecl_file, const ecl_kw_type *ecl_kw)
void ecl_file_fortio_detach(ecl_file_type *ecl_file)
bool ecl_file_select_block(ecl_file_type *ecl_file, const char *kw, int occurence)
int ecl_file_get_phases(const ecl_file_type *init_file)
ecl_file_view_type * ecl_file_get_global_blockview(ecl_file_type *ecl_file, const char *kw, int occurence)
int ecl_file_get_num_distinct_kw(const ecl_file_type *ecl_file)
bool ecl_file_select_rstblock_sim_time(ecl_file_type *ecl_file, time_t sim_time)
ecl_kw_type * ecl_file_iget_kw(const ecl_file_type *file, int global_index)
bool ecl_file_subselect_block(ecl_file_type *ecl_file, const char *kw, int occurence)
const char * ecl_file_get_src_file(const ecl_file_type *ecl_file)
time_t ecl_file_iget_restart_sim_date(const ecl_file_type *restart_file, int occurence)
ecl_data_type ecl_file_iget_named_data_type(const ecl_file_type *file, const char *kw, int ith)
struct ecl_file_kw_struct ecl_file_kw_type
Definition: ecl_file_kw.hpp:33
struct ecl_file_view_struct ecl_file_view_type
Definition: ecl_file_view.hpp:50
struct ecl_kw_struct ecl_kw_type
Definition: ecl_kw.hpp:39
ecl_version_enum
Definition: ecl_util.hpp:69
struct fortio_struct fortio_type
Definition: include/ert/ecl/fortio.h:42
Definition: ecl_type.hpp:72