ecl_region.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2011 Equinor ASA, Norway.
3
4 The file 'ecl_region.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_REGION_H
20#define ERT_ECL_REGION_H
21#include <stdbool.h>
22
23#include <ert/util/int_vector.hpp>
24
26
27#include <ert/ecl/ecl_grid.hpp>
28#include <ert/ecl/layer.hpp>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34typedef enum {
51
52
53
54typedef struct ecl_region_struct ecl_region_type;
55
58 void ecl_region_reset( ecl_region_type * ecl_region );
60 ecl_region_type * ecl_region_alloc( const ecl_grid_type * ecl_grid , bool preselect);
62 void ecl_region_free__( void * __region );
63
64 const int_vector_type * ecl_region_get_active_list( ecl_region_type * region );
65 const int_vector_type * ecl_region_get_global_list( ecl_region_type * region );
66 const int_vector_type * ecl_region_get_global_active_list( ecl_region_type * region );
67
68 bool ecl_region_contains_ijk( const ecl_region_type * ecl_region , int i , int j , int k);
69 bool ecl_region_contains_global( const ecl_region_type * ecl_region , int global_index);
70 bool ecl_region_contains_active( const ecl_region_type * ecl_region , int active_index);
71
72 void ecl_region_select_true( ecl_region_type * region , const ecl_kw_type * ecl_kw);
73
77 void ecl_region_deselect_true( ecl_region_type * region , const ecl_kw_type * ecl_kw);
78 void ecl_region_select_false( ecl_region_type * region , const ecl_kw_type * ecl_kw);
79
80 void ecl_region_select_in_interval( ecl_region_type * region , const ecl_kw_type * ecl_kw, float min_value , float max_value);
81 void ecl_region_deselect_in_interval( ecl_region_type * region , const ecl_kw_type * ecl_kw, float min_value , float max_value);
82
83 void ecl_region_select_equal( ecl_region_type * region , const ecl_kw_type * ecl_kw, int value);
84 void ecl_region_deselect_equal( ecl_region_type * region , const ecl_kw_type * ecl_kw, int value);
85
90
91 void ecl_region_select_from_ijkbox( ecl_region_type * region , int i1 , int i2 , int j1 , int j2 , int k1 , int k2);
92 void ecl_region_deselect_from_ijkbox( ecl_region_type * region , int i1 , int i2 , int j1 , int j2 , int k1 , int k2);
93
94 void ecl_region_select_i1i2( ecl_region_type * region , int i1 , int i2);
95 void ecl_region_deselect_i1i2( ecl_region_type * region , int i1 , int i2);
96 void ecl_region_select_j1j2( ecl_region_type * region , int j1 , int j2);
97 void ecl_region_deselect_j1j2( ecl_region_type * region , int j1 , int i2);
98 void ecl_region_select_k1k2( ecl_region_type * region , int k1 , int k2);
99 void ecl_region_deselect_k1k2( ecl_region_type * region , int k1 , int i2);
100
101 void ecl_region_select_shallow_cells( ecl_region_type * region , double depth_limit );
102 void ecl_region_deselect_shallow_cells( ecl_region_type * region , double depth_limit );
103 void ecl_region_select_deep_cells( ecl_region_type * region , double depth_limit );
104 void ecl_region_deselect_deep_cells( ecl_region_type * region , double depth_limit );
105
106 void ecl_region_select_thin_cells( ecl_region_type * ecl_region , double dz_limit );
107 void ecl_region_deselect_thin_cells( ecl_region_type * ecl_region , double dz_limit );
108 void ecl_region_select_thick_cells( ecl_region_type * ecl_region , double dz_limit );
109 void ecl_region_deselect_thick_cells( ecl_region_type * ecl_region , double dz_limit );
110
111 void ecl_region_select_small_cells( ecl_region_type * ecl_region , double volum_limit );
112 void ecl_region_deselect_small_cells( ecl_region_type * ecl_region , double volum_limit );
113 void ecl_region_select_large_cells( ecl_region_type * ecl_region , double volum_limit );
114 void ecl_region_deselect_large_cells( ecl_region_type * ecl_region , double volum_limit );
115
116 void ecl_region_select_global_index( ecl_region_type * ecl_region , int global_index);
117 void ecl_region_deselect_global_index( ecl_region_type * ecl_region , int global_index);
118
119 void ecl_region_select_active_index( ecl_region_type * ecl_region , int active_index);
120 void ecl_region_deselect_active_index( ecl_region_type * ecl_region , int active_index);
121
122 void ecl_region_intersection( ecl_region_type * region , const ecl_region_type * new_region );
123 void ecl_region_union( ecl_region_type * region , const ecl_region_type * new_region );
124 void ecl_region_subtract( ecl_region_type * region , const ecl_region_type * new_region);
125 void ecl_region_xor( ecl_region_type * region , const ecl_region_type * new_region);
126
127 void ecl_region_select_smaller( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
128 void ecl_region_deselect_smaller( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
129 void ecl_region_select_larger( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
130 void ecl_region_deselect_larger( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , float limit);
131
132 void ecl_region_cmp_select_less( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
133 void ecl_region_cmp_deselect_less( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
134 void ecl_region_cmp_select_more( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
135 void ecl_region_cmp_deselect_more( ecl_region_type * ecl_region , const ecl_kw_type * kw1 , const ecl_kw_type * kw2);
136
137 void ecl_region_select_in_cylinder( ecl_region_type * region , double x0 , double y0, double R);
138 void ecl_region_deselect_in_cylinder( ecl_region_type * region , double x0 , double y0, double R);
139 void ecl_region_select_in_zcylinder( ecl_region_type * region , double x0 , double y0, double R , double z1 , double z2);
140 void ecl_region_deselect_in_zcylinder( ecl_region_type * region , double x0 , double y0, double R, double z1 , double z2);
141
142 void ecl_region_select_above_plane( ecl_region_type * region, const double n[3] , const double p[3]);
143 void ecl_region_select_below_plane( ecl_region_type * region, const double n[3] , const double p[3]);
144 void ecl_region_deselect_above_plane( ecl_region_type * region, const double n[3] , const double p[3]);
145 void ecl_region_deselect_below_plane( ecl_region_type * region, const double n[3] , const double p[3]);
146
151
152 void ecl_region_select_from_layer( ecl_region_type * region , const layer_type * layer , int k , int layer_value);
153 void ecl_region_deselect_from_layer( ecl_region_type * region , const layer_type * layer , int k , int layer_value);
154 void ecl_region_deselect_false( ecl_region_type * region , const ecl_kw_type * ecl_kw);
155
156
157/*****************************************************************/
158/* Functions to manipulate ecl_kw instances . */
159
160 void ecl_region_set_kw_int( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , int value, bool force_active);
161 void ecl_region_set_kw_float( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , float value , bool force_active);
162 void ecl_region_set_kw_double( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , double value , bool force_active);
163 void ecl_region_kw_copy( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , const ecl_kw_type * src_kw , bool force_active);
164 int ecl_region_get_kw_size( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , bool force_active);
165
166 void ecl_region_kw_iadd( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , const ecl_kw_type * delta_kw , bool force_active);
167 void ecl_region_kw_idiv( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , const ecl_kw_type * div_kw , bool force_active);
168 void ecl_region_kw_imul( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , const ecl_kw_type * mul_kw , bool force_active);
169 void ecl_region_kw_isub( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , const ecl_kw_type * delta_kw , bool force_active);
170
171 bool ecl_region_equal( const ecl_region_type * region1 , const ecl_region_type * region2);
172
173 void ecl_region_scale_kw_float( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , float value , bool force_active);
174 void ecl_region_scale_kw_double( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , double value , bool force_active);
175 void ecl_region_scale_kw_int( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , int value , bool force_active);
176 void ecl_region_shift_kw_int( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , int value , bool force_active);
177 void ecl_region_shift_kw_double( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , double value , bool force_active);
178 void ecl_region_shift_kw_float( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , float value , bool force_active);
179
180 const int_vector_type * ecl_region_get_kw_index_list( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , bool force_active);
181
182
183/*****************************************************************/
184/* set/get the name */
185 void ecl_region_set_name( ecl_region_type * region , const char * name );
186 const char * ecl_region_get_name( const ecl_region_type * region );
187
188/*****************************************************************/
189/* Stupid cpp compat/legacy/cruft functions. */
194
195
196/*****************************************************************/
197
198 double ecl_region_sum_kw_double( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , bool force_active);
199 int ecl_region_sum_kw_int( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , bool force_active);
200 float ecl_region_sum_kw_float( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , bool force_active);
201 int ecl_region_sum_kw_bool( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , bool force_active);
202
203
204
207
208#ifdef __cplusplus
209}
210#endif
211#endif
ecl_grid_struct ecl_grid_type
Definition: ECLGraph.hpp:43
const char *const name
Definition: cJSON.h:258
struct ecl_kw_struct ecl_kw_type
Definition: ecl_kw.hpp:39
void ecl_region_kw_copy(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, const ecl_kw_type *src_kw, bool force_active)
void ecl_region_scale_kw_float(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, float value, bool force_active)
void ecl_region_shift_kw_double(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, double value, bool force_active)
void ecl_region_deselect_deep_cells(ecl_region_type *region, double depth_limit)
void ecl_region_deselect_active_cells(ecl_region_type *region)
void ecl_region_deselect_inside_polygon(ecl_region_type *region, const geo_polygon_type *polygon)
void ecl_region_select_false(ecl_region_type *region, const ecl_kw_type *ecl_kw)
void ecl_region_kw_idiv(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, const ecl_kw_type *div_kw, bool force_active)
void ecl_region_union(ecl_region_type *region, const ecl_region_type *new_region)
void ecl_region_select_inactive_cells(ecl_region_type *region)
void ecl_region_scale_kw_double(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, double value, bool force_active)
void ecl_region_lock(ecl_region_type *region)
const int_vector_type * ecl_region_get_global_active_list(ecl_region_type *region)
void ecl_region_set_kw_double(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, double value, bool force_active)
void ecl_region_deselect_smaller(ecl_region_type *ecl_region, const ecl_kw_type *ecl_kw, float limit)
const char * ecl_region_get_name(const ecl_region_type *region)
void ecl_region_select_above_plane(ecl_region_type *region, const double n[3], const double p[3])
void ecl_region_select_thick_cells(ecl_region_type *ecl_region, double dz_limit)
void ecl_region_deselect_all(ecl_region_type *region)
void ecl_region_select_all(ecl_region_type *region)
void ecl_region_kw_imul(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, const ecl_kw_type *mul_kw, bool force_active)
void ecl_region_reset(ecl_region_type *ecl_region)
void ecl_region_select_large_cells(ecl_region_type *ecl_region, double volum_limit)
void ecl_region_deselect_large_cells(ecl_region_type *ecl_region, double volum_limit)
const int * ecl_region_get_global_list_cpp(ecl_region_type *region)
void ecl_region_deselect_global_index(ecl_region_type *ecl_region, int global_index)
void ecl_region_cmp_deselect_more(ecl_region_type *ecl_region, const ecl_kw_type *kw1, const ecl_kw_type *kw2)
void ecl_region_select_equal(ecl_region_type *region, const ecl_kw_type *ecl_kw, int value)
bool ecl_region_equal(const ecl_region_type *region1, const ecl_region_type *region2)
bool ecl_region_contains_global(const ecl_region_type *ecl_region, int global_index)
void ecl_region_select_active_index(ecl_region_type *ecl_region, int active_index)
void ecl_region_select_thin_cells(ecl_region_type *ecl_region, double dz_limit)
void ecl_region_select_in_interval(ecl_region_type *region, const ecl_kw_type *ecl_kw, float min_value, float max_value)
void ecl_region_select_shallow_cells(ecl_region_type *region, double depth_limit)
void ecl_region_deselect_active_index(ecl_region_type *ecl_region, int active_index)
void ecl_region_deselect_small_cells(ecl_region_type *ecl_region, double volum_limit)
void ecl_region_deselect_in_zcylinder(ecl_region_type *region, double x0, double y0, double R, double z1, double z2)
void ecl_region_set_kw_int(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, int value, bool force_active)
int ecl_region_sum_kw_int(ecl_region_type *ecl_region, const ecl_kw_type *ecl_kw, bool force_active)
void ecl_region_unlock(ecl_region_type *region)
void ecl_region_select_i1i2(ecl_region_type *region, int i1, int i2)
void ecl_region_deselect_in_interval(ecl_region_type *region, const ecl_kw_type *ecl_kw, float min_value, float max_value)
void ecl_region_deselect_false(ecl_region_type *region, const ecl_kw_type *ecl_kw)
void ecl_region_select_smaller(ecl_region_type *ecl_region, const ecl_kw_type *ecl_kw, float limit)
int ecl_region_sum_kw_bool(ecl_region_type *ecl_region, const ecl_kw_type *ecl_kw, bool force_active)
ecl_region_type * ecl_region_alloc(const ecl_grid_type *ecl_grid, bool preselect)
void ecl_region_deselect_above_plane(ecl_region_type *region, const double n[3], const double p[3])
int ecl_region_get_active_size_cpp(ecl_region_type *region)
bool ecl_region_contains_active(const ecl_region_type *ecl_region, int active_index)
void ecl_region_select_small_cells(ecl_region_type *ecl_region, double volum_limit)
struct ecl_region_struct ecl_region_type
Definition: ecl_region.hpp:54
void ecl_region_set_kw_float(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, float value, bool force_active)
void ecl_region_select_below_plane(ecl_region_type *region, const double n[3], const double p[3])
void ecl_region_deselect_thin_cells(ecl_region_type *ecl_region, double dz_limit)
void ecl_region_select_deep_cells(ecl_region_type *region, double depth_limit)
void ecl_region_select_j1j2(ecl_region_type *region, int j1, int j2)
void ecl_region_select_outside_polygon(ecl_region_type *region, const geo_polygon_type *polygon)
void ecl_region_select_inside_polygon(ecl_region_type *region, const geo_polygon_type *polygon)
void ecl_region_select_in_cylinder(ecl_region_type *region, double x0, double y0, double R)
void ecl_region_deselect_equal(ecl_region_type *region, const ecl_kw_type *ecl_kw, int value)
void ecl_region_select_larger(ecl_region_type *ecl_region, const ecl_kw_type *ecl_kw, float limit)
void ecl_region_select_true(ecl_region_type *region, const ecl_kw_type *ecl_kw)
void ecl_region_deselect_larger(ecl_region_type *ecl_region, const ecl_kw_type *ecl_kw, float limit)
void ecl_region_deselect_outside_polygon(ecl_region_type *region, const geo_polygon_type *polygon)
void ecl_region_kw_isub(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, const ecl_kw_type *delta_kw, bool force_active)
float ecl_region_sum_kw_float(ecl_region_type *ecl_region, const ecl_kw_type *ecl_kw, bool force_active)
void ecl_region_deselect_from_ijkbox(ecl_region_type *region, int i1, int i2, int j1, int j2, int k1, int k2)
void ecl_region_shift_kw_float(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, float value, bool force_active)
void ecl_region_deselect_inactive_cells(ecl_region_type *region)
void ecl_region_deselect_j1j2(ecl_region_type *region, int j1, int i2)
void ecl_region_free(ecl_region_type *region)
void ecl_region_invert_selection(ecl_region_type *region)
void ecl_region_select_k1k2(ecl_region_type *region, int k1, int k2)
bool ecl_region_contains_ijk(const ecl_region_type *ecl_region, int i, int j, int k)
int ecl_region_get_global_size_cpp(ecl_region_type *region)
void ecl_region_select_from_layer(ecl_region_type *region, const layer_type *layer, int k, int layer_value)
void ecl_region_shift_kw_int(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, int value, bool force_active)
void ecl_region_select_global_index(ecl_region_type *ecl_region, int global_index)
const int_vector_type * ecl_region_get_kw_index_list(ecl_region_type *ecl_region, const ecl_kw_type *ecl_kw, bool force_active)
ecl_region_type * ecl_region_alloc_copy(const ecl_region_type *ecl_region)
void ecl_region_deselect_in_cylinder(ecl_region_type *region, double x0, double y0, double R)
void ecl_region_intersection(ecl_region_type *region, const ecl_region_type *new_region)
void ecl_region_set_name(ecl_region_type *region, const char *name)
void ecl_region_deselect_k1k2(ecl_region_type *region, int k1, int i2)
void ecl_region_deselect_below_plane(ecl_region_type *region, const double n[3], const double p[3])
void ecl_region_subtract(ecl_region_type *region, const ecl_region_type *new_region)
void ecl_region_cmp_select_less(ecl_region_type *ecl_region, const ecl_kw_type *kw1, const ecl_kw_type *kw2)
void ecl_region_select_from_ijkbox(ecl_region_type *region, int i1, int i2, int j1, int j2, int k1, int k2)
void ecl_region_deselect_true(ecl_region_type *region, const ecl_kw_type *ecl_kw)
UTIL_IS_INSTANCE_HEADER(ecl_region)
double ecl_region_sum_kw_double(ecl_region_type *ecl_region, const ecl_kw_type *ecl_kw, bool force_active)
int ecl_region_get_kw_size(ecl_region_type *ecl_region, const ecl_kw_type *ecl_kw, bool force_active)
void ecl_region_scale_kw_int(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, int value, bool force_active)
void ecl_region_select_in_zcylinder(ecl_region_type *region, double x0, double y0, double R, double z1, double z2)
void ecl_region_xor(ecl_region_type *region, const ecl_region_type *new_region)
const int_vector_type * ecl_region_get_global_list(ecl_region_type *region)
void ecl_region_cmp_select_more(ecl_region_type *ecl_region, const ecl_kw_type *kw1, const ecl_kw_type *kw2)
void ecl_region_deselect_i1i2(ecl_region_type *region, int i1, int i2)
UTIL_SAFE_CAST_HEADER(ecl_region)
const int_vector_type * ecl_region_get_active_list(ecl_region_type *region)
const int * ecl_region_get_active_list_cpp(ecl_region_type *region)
ecl_region_select_cmd
Definition: ecl_region.hpp:34
@ SELECT_IN_INTERVAL
Definition: ecl_region.hpp:47
@ SELECT_FROM_IJK
Definition: ecl_region.hpp:37
@ DSELECT_FROM_K
Definition: ecl_region.hpp:44
@ DESELECT_IN_INTERVAL
Definition: ecl_region.hpp:48
@ DESELECT_EQUAL
Definition: ecl_region.hpp:46
@ DESELECT_FROM_IJK
Definition: ecl_region.hpp:38
@ DESELECT_ALL
Definition: ecl_region.hpp:36
@ SELECT_FROM_I
Definition: ecl_region.hpp:39
@ DSELECT_FROM_I
Definition: ecl_region.hpp:40
@ SELECT_EQUAL
Definition: ecl_region.hpp:45
@ INVERT_SELECTION
Definition: ecl_region.hpp:49
@ SELECT_ALL
Definition: ecl_region.hpp:35
@ SELECT_FROM_K
Definition: ecl_region.hpp:43
@ SELECT_FROM_J
Definition: ecl_region.hpp:41
@ DSELECT_FROM_J
Definition: ecl_region.hpp:42
void ecl_region_deselect_from_layer(ecl_region_type *region, const layer_type *layer, int k, int layer_value)
void ecl_region_cmp_deselect_less(ecl_region_type *ecl_region, const ecl_kw_type *kw1, const ecl_kw_type *kw2)
void ecl_region_free__(void *__region)
void ecl_region_deselect_shallow_cells(ecl_region_type *region, double depth_limit)
void ecl_region_deselect_thick_cells(ecl_region_type *ecl_region, double dz_limit)
void ecl_region_select_active_cells(ecl_region_type *region)
void ecl_region_kw_iadd(ecl_region_type *ecl_region, ecl_kw_type *ecl_kw, const ecl_kw_type *delta_kw, bool force_active)
struct geo_polygon_struct geo_polygon_type
Definition: geo_polygon.hpp:30
struct layer_struct layer_type
Definition: layer.hpp:51
T value(details::expression_node< T > *n)
Definition: exprtk.hpp:12955