diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 3f0af3f9d7..45bca71107 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -95,42 +95,42 @@ add_library(ecl util/rng.cpp util/test_util.cpp ${opt_srcs} - ecl/ecl_rsthead.c + ecl/ecl_rsthead.cpp ecl/ecl_sum_tstep.c - ecl/ecl_rst_file.c + ecl/ecl_rst_file.cpp ecl/ecl_init_file.c - ecl/ecl_grid_cache.c + ecl/ecl_grid_cache.cpp ecl/smspec_node.c - ecl/ecl_kw_grdecl.c - ecl/ecl_file_kw.c - ecl/ecl_file_view.c - ecl/ecl_grav.c - ecl/ecl_grav_calc.c - ecl/ecl_smspec.c + ecl/ecl_kw_grdecl.cpp + ecl/ecl_file_kw.cpp + ecl/ecl_file_view.cpp + ecl/ecl_grav.cpp + ecl/ecl_grav_calc.cpp + ecl/ecl_smspec.cpp ecl/ecl_sum_data.c ecl/ecl_util.c - ecl/ecl_kw.c - ecl/ecl_sum.c + ecl/ecl_kw.cpp + ecl/ecl_sum.cpp ecl/ecl_sum_vector.c ecl/fortio.c - ecl/ecl_rft_file.c - ecl/ecl_rft_node.c - ecl/ecl_rft_cell.c - ecl/ecl_grid.c - ecl/ecl_coarse_cell.c - ecl/ecl_box.c - ecl/ecl_io_config.c - ecl/ecl_file.c - ecl/ecl_region.c - ecl/ecl_subsidence.c - ecl/ecl_grid_dims.c + ecl/ecl_rft_file.cpp + ecl/ecl_rft_node.cpp + ecl/ecl_rft_cell.cpp + ecl/ecl_grid.cpp + ecl/ecl_coarse_cell.cpp + ecl/ecl_box.cpp + ecl/ecl_io_config.cpp + ecl/ecl_file.cpp + ecl/ecl_region.cpp + ecl/ecl_subsidence.cpp + ecl/ecl_grid_dims.cpp ecl/grid_dims.c ecl/nnc_info.c ecl/ecl_grav_common.c ecl/nnc_vector.c - ecl/ecl_nnc_export.c - ecl/ecl_nnc_data.c - ecl/ecl_nnc_geometry.c + ecl/ecl_nnc_export.cpp + ecl/ecl_nnc_data.cpp + ecl/ecl_nnc_geometry.cpp ecl/layer.c ecl/fault_block.c ecl/fault_block_layer.c diff --git a/lib/ecl/ecl_box.c b/lib/ecl/ecl_box.cpp similarity index 93% rename from lib/ecl/ecl_box.c rename to lib/ecl/ecl_box.cpp index 9c5b0350c1..51a49ffd31 100644 --- a/lib/ecl/ecl_box.c +++ b/lib/ecl/ecl_box.cpp @@ -60,7 +60,7 @@ UTIL_SAFE_CAST_FUNCTION( ecl_box , ECL_BOX_TYPE_ID) */ ecl_box_type * ecl_box_alloc(const ecl_grid_type * ecl_grid , int __i1,int __i2 , int __j1 , int __j2 , int __k1, int __k2) { - ecl_box_type * ecl_box = util_malloc(sizeof * ecl_box ); + ecl_box_type * ecl_box = (ecl_box_type *)util_malloc(sizeof * ecl_box ); UTIL_TYPE_ID_INIT( ecl_box , ECL_BOX_TYPE_ID); ecl_box->parent_grid = ecl_grid; /* Properties of the parent grid. */ @@ -102,8 +102,8 @@ ecl_box_type * ecl_box_alloc(const ecl_grid_type * ecl_grid , int __i1,int __i2 int global_counter = 0; int i,j,k; ecl_box->active_size = 0; - ecl_box->active_list = util_calloc( ecl_box->box_nx * ecl_box->box_ny * ecl_box->box_nz , sizeof * ecl_box->active_list ); - ecl_box->global_list = util_calloc( ecl_box->box_nx * ecl_box->box_ny * ecl_box->box_nz , sizeof * ecl_box->global_list ); + ecl_box->active_list = (int*)util_calloc( ecl_box->box_nx * ecl_box->box_ny * ecl_box->box_nz , sizeof * ecl_box->active_list ); + ecl_box->global_list = (int*)util_calloc( ecl_box->box_nx * ecl_box->box_ny * ecl_box->box_nz , sizeof * ecl_box->global_list ); for (k=k1; k <= k2; k++) for (j=j1; j <= j2; j++) for (i=i1; i <= i2; i++) { @@ -121,7 +121,7 @@ ecl_box_type * ecl_box_alloc(const ecl_grid_type * ecl_grid , int __i1,int __i2 } } - ecl_box->active_list = util_realloc( ecl_box->active_list , ecl_box->active_size * sizeof * ecl_box->active_list ); + ecl_box->active_list = (int*)util_realloc( ecl_box->active_list , ecl_box->active_size * sizeof * ecl_box->active_list ); } } return ecl_box; diff --git a/lib/ecl/ecl_coarse_cell.c b/lib/ecl/ecl_coarse_cell.cpp similarity index 99% rename from lib/ecl/ecl_coarse_cell.c rename to lib/ecl/ecl_coarse_cell.cpp index 3716b9fa0a..147dfe30c4 100644 --- a/lib/ecl/ecl_coarse_cell.c +++ b/lib/ecl/ecl_coarse_cell.cpp @@ -140,7 +140,7 @@ void ecl_coarse_cell_assert( ecl_coarse_cell_type * coarse_cell ) { ecl_coarse_cell_type * ecl_coarse_cell_alloc() { const int LARGE = 1 << 30; - ecl_coarse_cell_type * coarse_cell = util_malloc( sizeof * coarse_cell ); + ecl_coarse_cell_type * coarse_cell = (ecl_coarse_cell_type *) util_malloc( sizeof * coarse_cell ); UTIL_TYPE_ID_INIT( coarse_cell , ECL_COARSE_CELL_TYPE_ID ); coarse_cell->ijk[0] = LARGE; diff --git a/lib/ecl/ecl_file.c b/lib/ecl/ecl_file.cpp similarity index 99% rename from lib/ecl/ecl_file.c rename to lib/ecl/ecl_file.cpp index 7c9d3f652c..85d40bfbd8 100644 --- a/lib/ecl/ecl_file.c +++ b/lib/ecl/ecl_file.cpp @@ -178,7 +178,7 @@ UTIL_IS_INSTANCE_FUNCTION( ecl_file , ECL_FILE_ID) ecl_file_type * ecl_file_alloc_empty( int flags ) { - ecl_file_type * ecl_file = util_malloc( sizeof * ecl_file ); + ecl_file_type * ecl_file = (ecl_file_type *)util_malloc( sizeof * ecl_file ); UTIL_TYPE_ID_INIT(ecl_file , ECL_FILE_ID); ecl_file->map_stack = vector_alloc_new(); ecl_file->inv_view = inv_map_alloc( ); @@ -800,7 +800,6 @@ ecl_version_enum ecl_file_get_ecl_version( const ecl_file_type * file ) { return FRONTSIM; util_abort("%s: Simulator version value:%d not recognized \n",__func__ , int_value ); - return -1; } /* @@ -887,7 +886,7 @@ void ecl_file_push_block( ecl_file_type * ecl_file ) { } void ecl_file_pop_block( ecl_file_type * ecl_file ) { - ecl_file->active_view = vector_pop_back( ecl_file->map_stack ); + ecl_file->active_view = (ecl_file_view_type *)vector_pop_back( ecl_file->map_stack ); } diff --git a/lib/ecl/ecl_file_kw.c b/lib/ecl/ecl_file_kw.cpp similarity index 97% rename from lib/ecl/ecl_file_kw.c rename to lib/ecl/ecl_file_kw.cpp index c808cee005..0487233e08 100644 --- a/lib/ecl/ecl_file_kw.c +++ b/lib/ecl/ecl_file_kw.cpp @@ -69,7 +69,7 @@ struct ecl_file_kw_struct { /*****************************************************************/ inv_map_type * inv_map_alloc() { - inv_map_type * map = util_malloc( sizeof * map ); + inv_map_type * map = (inv_map_type *)util_malloc( sizeof * map ); map->file_kw_ptr = size_t_vector_alloc( 0 , 0 ); map->ecl_kw_ptr = size_t_vector_alloc( 0 , 0 ); map->sorted = false; @@ -137,7 +137,7 @@ UTIL_IS_INSTANCE_FUNCTION( ecl_file_kw , ECL_FILE_KW_TYPE_ID ) ecl_file_kw_type * ecl_file_kw_alloc0( const char * header , ecl_data_type data_type , int size , offset_type offset) { - ecl_file_kw_type * file_kw = util_malloc( sizeof * file_kw ); + ecl_file_kw_type * file_kw = (ecl_file_kw_type *)util_malloc( sizeof * file_kw ); UTIL_TYPE_ID_INIT( file_kw , ECL_FILE_KW_TYPE_ID ); file_kw->header = util_alloc_string_copy( header ); @@ -370,7 +370,7 @@ ecl_file_kw_type ** ecl_file_kw_fread_alloc_multiple( FILE * stream , int num) { size_t file_kw_size = ECL_STRING8_LENGTH + 2 * sizeof(int) + sizeof(offset_type) + sizeof(size_t); size_t buffer_size = num * file_kw_size; - char * buffer = util_malloc( buffer_size * sizeof * buffer ); + char * buffer = (char*)util_malloc( buffer_size * sizeof * buffer ); size_t num_read = fread( buffer, 1 , buffer_size , stream); if (num_read != buffer_size) { @@ -379,7 +379,7 @@ ecl_file_kw_type ** ecl_file_kw_fread_alloc_multiple( FILE * stream , int num) { } { - ecl_file_kw_type ** kw_list = util_malloc( num * sizeof * kw_list ); + ecl_file_kw_type ** kw_list = (ecl_file_kw_type **)util_malloc( num * sizeof * kw_list ); for (int ikw = 0; ikw < num; ikw++) { int buffer_offset = ikw * file_kw_size; char header[ECL_STRING8_LENGTH + 1]; diff --git a/lib/ecl/ecl_file_view.c b/lib/ecl/ecl_file_view.cpp similarity index 94% rename from lib/ecl/ecl_file_view.c rename to lib/ecl/ecl_file_view.cpp index 4229921142..4f4c706bc4 100644 --- a/lib/ecl/ecl_file_view.c +++ b/lib/ecl/ecl_file_view.cpp @@ -71,7 +71,7 @@ const char * ecl_file_view_get_src_file( const ecl_file_view_type * file_view ) ecl_file_view_type * ecl_file_view_alloc( fortio_type * fortio , int * flags , inv_map_type * inv_map , bool owner ) { - ecl_file_view_type * ecl_file_view = util_malloc( sizeof * ecl_file_view ); + ecl_file_view_type * ecl_file_view = (ecl_file_view_type*)util_malloc( sizeof * ecl_file_view ); ecl_file_view->kw_list = vector_alloc_new(); ecl_file_view->kw_index = hash_alloc(); ecl_file_view->distinct_kw = stringlist_alloc_new(); @@ -84,7 +84,7 @@ ecl_file_view_type * ecl_file_view_alloc( fortio_type * fortio , int * flags , i } int ecl_file_view_get_global_index( const ecl_file_view_type * ecl_file_view , const char * kw , int ith) { - const int_vector_type * index_vector = hash_get(ecl_file_view->kw_index , kw); + const int_vector_type * index_vector = (const int_vector_type*)hash_get(ecl_file_view->kw_index , kw); int global_index = int_vector_iget( index_vector , ith); return global_index; } @@ -106,7 +106,7 @@ void ecl_file_view_make_index( ecl_file_view_type * ecl_file_view ) { { int i; for (i=0; i < vector_get_size( ecl_file_view->kw_list ); i++) { - const ecl_file_kw_type * file_kw = vector_iget_const( ecl_file_view->kw_list , i); + const ecl_file_kw_type * file_kw = (const ecl_file_kw_type*)vector_iget_const( ecl_file_view->kw_list , i); const char * header = ecl_file_kw_get_header( file_kw ); if ( !hash_has_key( ecl_file_view->kw_index , header )) { int_vector_type * index_vector = int_vector_alloc( 0 , -1 ); @@ -115,7 +115,7 @@ void ecl_file_view_make_index( ecl_file_view_type * ecl_file_view ) { } { - int_vector_type * index_vector = hash_get( ecl_file_view->kw_index , header); + int_vector_type * index_vector = (int_vector_type*)hash_get( ecl_file_view->kw_index , header); int_vector_append( index_vector , i); } } @@ -128,7 +128,7 @@ bool ecl_file_view_has_kw( const ecl_file_view_type * ecl_file_view, const char ecl_file_kw_type * ecl_file_view_iget_file_kw( const ecl_file_view_type * ecl_file_view , int global_index) { - ecl_file_kw_type * file_kw = vector_iget( ecl_file_view->kw_list , global_index); + ecl_file_kw_type * file_kw = (ecl_file_kw_type*)vector_iget( ecl_file_view->kw_list , global_index); return file_kw; } @@ -185,7 +185,7 @@ void ecl_file_view_index_fload_kw(const ecl_file_view_type * ecl_file_view, cons int ecl_file_view_find_kw_value( const ecl_file_view_type * ecl_file_view , const char * kw , const void * value) { int global_index = -1; if ( ecl_file_view_has_kw( ecl_file_view , kw)) { - const int_vector_type * index_list = hash_get( ecl_file_view->kw_index , kw ); + const int_vector_type * index_list = (const int_vector_type*)hash_get( ecl_file_view->kw_index , kw ); int index = 0; while (index < int_vector_size( index_list )) { const ecl_kw_type * ecl_kw = ecl_file_view_iget_kw( ecl_file_view , int_vector_iget( index_list , index )); @@ -247,7 +247,7 @@ int ecl_file_view_iget_named_size( const ecl_file_view_type * ecl_file_view , co void ecl_file_view_replace_kw( ecl_file_view_type * ecl_file_view , ecl_kw_type * old_kw , ecl_kw_type * new_kw , bool insert_copy) { int index = 0; while (index < vector_get_size( ecl_file_view->kw_list )) { - ecl_file_kw_type * ikw = vector_iget( ecl_file_view->kw_list , index ); + ecl_file_kw_type * ikw = (ecl_file_kw_type*)vector_iget( ecl_file_view->kw_list , index ); if (ecl_file_kw_ptr_eq( ikw , old_kw)) { /* Found it; observe that the vector_iset() function will @@ -274,7 +274,7 @@ bool ecl_file_view_load_all( ecl_file_view_type * ecl_file_view ) { if (fortio_assert_stream_open( ecl_file_view->fortio )) { int index; for (index = 0; index < vector_get_size( ecl_file_view->kw_list); index++) { - ecl_file_kw_type * ikw = vector_iget( ecl_file_view->kw_list , index ); + ecl_file_kw_type * ikw = (ecl_file_kw_type*)vector_iget( ecl_file_view->kw_list , index ); ecl_file_kw_get_kw( ikw , ecl_file_view->fortio , ecl_file_view->inv_map); } loadOK = true; @@ -314,7 +314,7 @@ void ecl_file_view_free__( void * arg ) { int ecl_file_view_get_num_named_kw(const ecl_file_view_type * ecl_file_view , const char * kw) { if (hash_has_key(ecl_file_view->kw_index , kw)) { - const int_vector_type * index_vector = hash_get(ecl_file_view->kw_index , kw); + const int_vector_type * index_vector = (const int_vector_type*)hash_get(ecl_file_view->kw_index , kw); return int_vector_size( index_vector ); } else return 0; @@ -332,9 +332,9 @@ void ecl_file_view_fwrite( const ecl_file_view_type * ecl_file_view , fortio_typ int ecl_file_view_iget_occurence( const ecl_file_view_type * ecl_file_view , int global_index) { - const ecl_file_kw_type * file_kw = vector_iget_const( ecl_file_view->kw_list , global_index); + const ecl_file_kw_type * file_kw = (const ecl_file_kw_type*)vector_iget_const( ecl_file_view->kw_list , global_index); const char * header = ecl_file_kw_get_header( file_kw ); - const int_vector_type * index_vector = hash_get( ecl_file_view->kw_index , header ); + const int_vector_type * index_vector = (const int_vector_type*)hash_get( ecl_file_view->kw_index , header ); const int * index_data = int_vector_get_const_ptr( index_vector ); int occurence = -1; @@ -354,7 +354,7 @@ int ecl_file_view_iget_occurence( const ecl_file_view_type * ecl_file_view , int void ecl_file_view_fprintf_kw_list(const ecl_file_view_type * ecl_file_view , FILE * stream) { int i; for (i=0; i < vector_get_size( ecl_file_view->kw_list ); i++) { - const ecl_file_kw_type * file_kw = vector_iget_const( ecl_file_view->kw_list , i ); + const ecl_file_kw_type * file_kw = (const ecl_file_kw_type*)vector_iget_const( ecl_file_view->kw_list , i ); char * type_name = ecl_type_alloc_name(ecl_file_kw_get_data_type(file_kw)); fprintf(stream , "%-8s %7d:%s\n", ecl_file_kw_get_header( file_kw ) , @@ -376,7 +376,7 @@ ecl_file_view_type * ecl_file_view_alloc_blockview2(const ecl_file_view_type * e kw_index = ecl_file_view_get_global_index( ecl_file_view , start_kw , occurence ); { - ecl_file_kw_type * file_kw = vector_iget( ecl_file_view->kw_list , kw_index ); + ecl_file_kw_type * file_kw = (ecl_file_kw_type*)vector_iget( ecl_file_view->kw_list , kw_index ); while (true) { ecl_file_view_add_kw( block_map , file_kw ); @@ -385,7 +385,7 @@ ecl_file_view_type * ecl_file_view_alloc_blockview2(const ecl_file_view_type * e break; else { if (end_kw) { - file_kw = vector_iget(ecl_file_view->kw_list , kw_index); + file_kw = (ecl_file_kw_type*)vector_iget(ecl_file_view->kw_list , kw_index); if (strcmp( end_kw , ecl_file_kw_get_header( file_kw )) == 0) break; } @@ -589,7 +589,7 @@ double ecl_file_view_iget_restart_sim_days(const ecl_file_view_type * ecl_file_v int ecl_file_view_find_sim_time(const ecl_file_view_type * ecl_file_view , time_t sim_time) { int seqnum_index = -1; if ( ecl_file_view_has_kw( ecl_file_view , INTEHEAD_KW)) { - const int_vector_type * intehead_index_list = hash_get( ecl_file_view->kw_index , INTEHEAD_KW ); + const int_vector_type * intehead_index_list = (const int_vector_type *)hash_get( ecl_file_view->kw_index , INTEHEAD_KW ); int index = 0; while (index < int_vector_size( intehead_index_list )) { const ecl_kw_type * intehead_kw = ecl_file_view_iget_kw( ecl_file_view , int_vector_iget( intehead_index_list , index )); @@ -807,10 +807,10 @@ ecl_file_view_type * ecl_file_view_fread_alloc( fortio_type * fortio , int * fla ecl_file_transaction_type * ecl_file_view_start_transaction(ecl_file_view_type * file_view) { - ecl_file_transaction_type * t = util_malloc(sizeof * t); + ecl_file_transaction_type * t = (ecl_file_transaction_type *)util_malloc(sizeof * t); int size = ecl_file_view_get_size(file_view); t->file_view = file_view; - t->ref_count = util_malloc( size * sizeof * t->ref_count ); + t->ref_count = (int*)util_malloc( size * sizeof * t->ref_count ); for (int i = 0; i < size; i++) { ecl_file_kw_type * file_kw = ecl_file_view_iget_file_kw(file_view, i); ecl_file_kw_start_transaction(file_kw, &t->ref_count[i]); diff --git a/lib/ecl/ecl_grav.c b/lib/ecl/ecl_grav.cpp similarity index 95% rename from lib/ecl/ecl_grav.c rename to lib/ecl/ecl_grav.cpp index a763f111f0..451ecc96cd 100644 --- a/lib/ecl/ecl_grav.c +++ b/lib/ecl/ecl_grav.cpp @@ -157,7 +157,7 @@ static const char * get_den_kw( ecl_phase_enum phase , ecl_version_enum ecl_vers static void ecl_grav_phase_ensure_work( ecl_grav_phase_type * grav_phase) { if (grav_phase->work == NULL) - grav_phase->work = util_calloc( ecl_grid_cache_get_size( grav_phase->grid_cache ) , sizeof * grav_phase->work ); + grav_phase->work = (double*)util_calloc( ecl_grid_cache_get_size( grav_phase->grid_cache ) , sizeof * grav_phase->work ); } @@ -213,19 +213,19 @@ static ecl_grav_phase_type * ecl_grav_phase_alloc( ecl_grav_type * ecl_grav , const ecl_grid_cache_type * grid_cache = ecl_grav->grid_cache; const char * sat_kw_name = ecl_util_get_phase_name( phase ); { - ecl_grav_phase_type * grav_phase = util_malloc( sizeof * grav_phase ); + ecl_grav_phase_type * grav_phase = (ecl_grav_phase_type*)util_malloc( sizeof * grav_phase ); const int size = ecl_grid_cache_get_size( grid_cache ); UTIL_TYPE_ID_INIT( grav_phase , ECL_GRAV_PHASE_TYPE_ID ); grav_phase->grid_cache = grid_cache; grav_phase->aquifer_cell = ecl_grav->aquifer_cell; - grav_phase->fluid_mass = util_calloc( size , sizeof * grav_phase->fluid_mass ); + grav_phase->fluid_mass = (double*)util_calloc( size , sizeof * grav_phase->fluid_mass ); grav_phase->phase = phase; grav_phase->work = NULL; if (calc_type == GRAV_CALC_FIP) { ecl_kw_type * pvtnum_kw = ecl_file_iget_named_kw( init_file , PVTNUM_KW , 0 ); - double_vector_type * std_density = hash_get( ecl_grav->std_density , ecl_util_get_phase_name( phase )); + double_vector_type * std_density = (double_vector_type*)hash_get( ecl_grav->std_density , ecl_util_get_phase_name( phase )); ecl_kw_type * fip_kw; if ( phase == ECL_OIL_PHASE) @@ -349,7 +349,7 @@ static void ecl_grav_survey_add_phases( ecl_grav_type * ecl_grav , ecl_grav_surv static ecl_grav_survey_type * ecl_grav_survey_alloc_empty(const ecl_grav_type * ecl_grav , const char * name , grav_calc_type calc_type) { - ecl_grav_survey_type * survey = util_malloc( sizeof * survey ); + ecl_grav_survey_type * survey = (ecl_grav_survey_type*)util_malloc( sizeof * survey ); UTIL_TYPE_ID_INIT( survey , ECL_GRAV_SURVEY_ID ); survey->grid_cache = ecl_grav->grid_cache; survey->aquifer_cell = ecl_grav->aquifer_cell; @@ -358,7 +358,7 @@ static ecl_grav_survey_type * ecl_grav_survey_alloc_empty(const ecl_grav_type * survey->phase_map = hash_alloc(); if (calc_type & GRAV_CALC_USE_PORV) - survey->porv = util_calloc( ecl_grid_cache_get_size( ecl_grav->grid_cache ) , sizeof * survey->porv ); + survey->porv = (double*)util_calloc( ecl_grid_cache_get_size( ecl_grav->grid_cache ) , sizeof * survey->porv ); else survey->porv = NULL; @@ -549,10 +549,10 @@ static double ecl_grav_survey_eval( const ecl_grav_survey_type * base_survey, int phase_nr; double deltag = 0; for (phase_nr = 0; phase_nr < vector_get_size( base_survey->phase_list ); phase_nr++) { - ecl_grav_phase_type * base_phase = vector_iget( base_survey->phase_list , phase_nr ); + ecl_grav_phase_type * base_phase = (ecl_grav_phase_type*)vector_iget( base_survey->phase_list , phase_nr ); if (base_phase->phase & phase_mask) { if (monitor_survey != NULL) { - const ecl_grav_phase_type * monitor_phase = vector_iget_const( monitor_survey->phase_list , phase_nr ); + const ecl_grav_phase_type * monitor_phase = (const ecl_grav_phase_type*)vector_iget_const( monitor_survey->phase_list , phase_nr ); deltag += ecl_grav_phase_eval( base_phase , monitor_phase , region , utm_x , utm_y , depth ); } else deltag += ecl_grav_phase_eval( base_phase , NULL , region , utm_x , utm_y , depth ); @@ -570,7 +570,7 @@ static double ecl_grav_survey_eval( const ecl_grav_survey_type * base_survey, */ ecl_grav_type * ecl_grav_alloc( const ecl_grid_type * ecl_grid, const ecl_file_type * init_file) { - ecl_grav_type * ecl_grav = util_malloc( sizeof * ecl_grav ); + ecl_grav_type * ecl_grav = (ecl_grav_type*)util_malloc( sizeof * ecl_grav ); ecl_grav->init_file = init_file; ecl_grav->grid_cache = ecl_grid_cache_alloc( ecl_grid ); ecl_grav->aquifer_cell = ecl_grav_common_alloc_aquifer_cell( ecl_grav->grid_cache , ecl_grav->init_file ); @@ -619,7 +619,7 @@ static ecl_grav_survey_type * ecl_grav_get_survey( const ecl_grav_type * grav , return NULL; // Calling scope must determine if this is OK? else { if (hash_has_key( grav->surveys , name)) - return hash_get( grav->surveys , name ); + return (ecl_grav_survey_type*)hash_get( grav->surveys , name ); else { hash_iter_type * survey_iter = hash_iter_alloc( grav->surveys ); fprintf(stderr,"Survey name:%s not registered. Available surveys are: \n\n " , name); @@ -680,7 +680,7 @@ void ecl_grav_new_std_density( ecl_grav_type * grav , ecl_phase_enum phase , dou void ecl_grav_add_std_density( ecl_grav_type * grav , ecl_phase_enum phase , int pvtnum , double density) { - double_vector_type * std_density = hash_get( grav->std_density , ecl_util_get_phase_name( phase )); + double_vector_type * std_density = (double_vector_type*)hash_get( grav->std_density , ecl_util_get_phase_name( phase )); double_vector_iset( std_density , pvtnum , density ); } diff --git a/lib/ecl/ecl_grav_calc.c b/lib/ecl/ecl_grav_calc.cpp similarity index 100% rename from lib/ecl/ecl_grav_calc.c rename to lib/ecl/ecl_grav_calc.cpp diff --git a/lib/ecl/ecl_grid.c b/lib/ecl/ecl_grid.cpp similarity index 97% rename from lib/ecl/ecl_grid.c rename to lib/ecl/ecl_grid.cpp index d04f6715d5..3975c746fa 100644 --- a/lib/ecl/ecl_grid.c +++ b/lib/ecl/ecl_grid.cpp @@ -861,7 +861,7 @@ static void ecl_cell_fwrite_GRID(const ecl_grid_type * grid, ecl_kw_fwrite( coords_kw , fortio ); { - float * corners = ecl_kw_get_void_ptr( corners_kw ); + float * corners = (float*)ecl_kw_get_void_ptr( corners_kw ); point_type point; int c; @@ -1288,7 +1288,8 @@ static double ecl_cell_get_signed_volume( ecl_cell_type * cell) { point_type corners[ 8 ]; memcpy( corners, cell->corner_list, sizeof( point_type ) * 8 ); - tetrahedron_type tet = { .p0 = center }; + tetrahedron_type tet; + tet.p0 = center; double volume = 0; /* using both tetrahedron decompositions - gives good agreement @@ -1567,7 +1568,7 @@ static void ecl_grid_free_cells( ecl_grid_type * grid ) { } static bool ecl_grid_alloc_cells( ecl_grid_type * grid , bool init_valid) { - grid->cells = malloc(grid->size * sizeof * grid->cells ); + grid->cells = (ecl_cell_type*)malloc(grid->size * sizeof * grid->cells ); if (!grid->cells) return false; @@ -1600,7 +1601,7 @@ static ecl_grid_type * ecl_grid_alloc_empty(ecl_grid_type * global_grid, int nz, int lgr_nr, bool init_valid) { - ecl_grid_type * grid = util_malloc(sizeof * grid ); + ecl_grid_type * grid = (ecl_grid_type*)util_malloc(sizeof * grid ); UTIL_TYPE_ID_INIT(grid , ECL_GRID_ID); grid->total_active = 0; grid->total_active_fracture = 0; @@ -1845,9 +1846,9 @@ static void ecl_grid_init_index_map__(ecl_grid_type * ecl_grid, static void ecl_grid_realloc_index_map(ecl_grid_type * ecl_grid) { /* Creating the inverse mapping for the matrix cells. */ - ecl_grid->index_map = util_realloc(ecl_grid->index_map, + ecl_grid->index_map = (int*)util_realloc(ecl_grid->index_map, ecl_grid->size * sizeof * ecl_grid->index_map); - ecl_grid->inv_index_map = util_realloc(ecl_grid->inv_index_map, + ecl_grid->inv_index_map = (int*)util_realloc(ecl_grid->inv_index_map, ecl_grid->total_active * sizeof * ecl_grid->inv_index_map); ecl_grid_init_index_map__(ecl_grid, ecl_grid->index_map, @@ -1858,9 +1859,9 @@ static void ecl_grid_realloc_index_map(ecl_grid_type * ecl_grid) { /* Create the inverse mapping for the fractures. */ if (ecl_grid->dualp_flag != FILEHEAD_SINGLE_POROSITY) { - ecl_grid->fracture_index_map = util_realloc(ecl_grid->fracture_index_map, + ecl_grid->fracture_index_map = (int*)util_realloc(ecl_grid->fracture_index_map, ecl_grid->size * sizeof * ecl_grid->fracture_index_map); - ecl_grid->inv_fracture_index_map = util_realloc(ecl_grid->inv_fracture_index_map, + ecl_grid->inv_fracture_index_map = (int*)util_realloc(ecl_grid->inv_fracture_index_map, ecl_grid->total_active_fracture * sizeof * ecl_grid->inv_fracture_index_map); ecl_grid_init_index_map__(ecl_grid, ecl_grid->fracture_index_map, @@ -2023,7 +2024,7 @@ static ecl_coarse_cell_type * ecl_grid_get_or_create_coarse_cell( ecl_grid_type if (vector_safe_iget( ecl_grid->coarse_cells , coarse_nr ) == NULL) vector_iset_owned_ref( ecl_grid->coarse_cells , coarse_nr , ecl_coarse_cell_alloc() , ecl_coarse_cell_free__); - return vector_iget( ecl_grid->coarse_cells , coarse_nr ); + return (ecl_coarse_cell_type*)vector_iget( ecl_grid->coarse_cells , coarse_nr ); } @@ -2044,7 +2045,7 @@ static void ecl_grid_init_coarse_cells( ecl_grid_type * ecl_grid ) { ecl_coarse_cell_type * ecl_grid_iget_coarse_group( const ecl_grid_type * ecl_grid , int coarse_nr ) { - return vector_iget( ecl_grid->coarse_cells , coarse_nr ); + return (ecl_coarse_cell_type*)vector_iget( ecl_grid->coarse_cells , coarse_nr ); } @@ -2123,7 +2124,7 @@ static void ecl_grid_init_mapaxes( ecl_grid_type * ecl_grid , bool apply_mapaxes } ecl_grid->origo[0] = mapaxes[2]; ecl_grid->origo[1] = mapaxes[3]; - ecl_grid->mapaxes = util_malloc( 6 * sizeof * ecl_grid->mapaxes ); + ecl_grid->mapaxes = (float*)util_malloc( 6 * sizeof * ecl_grid->mapaxes ); memcpy( ecl_grid->mapaxes , mapaxes , 6 * sizeof( float )); /* @@ -2230,10 +2231,10 @@ static void ecl_grid_install_lgr_GRID(ecl_grid_type * host_grid , ecl_grid_type static void ecl_grid_set_lgr_name_EGRID(ecl_grid_type * lgr_grid , const ecl_file_type * ecl_file , int grid_nr) { ecl_kw_type * lgrname_kw = ecl_file_iget_named_kw( ecl_file , LGR_KW , grid_nr - 1); - lgr_grid->name = util_alloc_strip_copy( ecl_kw_iget_ptr( lgrname_kw , 0) ); /* trailing zeros are stripped away. */ + lgr_grid->name = (char*)util_alloc_strip_copy( (const char*)ecl_kw_iget_ptr( lgrname_kw , 0) ); /* trailing zeros are stripped away. */ if (ecl_file_has_kw( ecl_file , LGR_PARENT_KW)) { ecl_kw_type * parent_kw = ecl_file_iget_named_kw( ecl_file , LGR_PARENT_KW , grid_nr -1); - char * parent = util_alloc_strip_copy( ecl_kw_iget_ptr( parent_kw , 0)); + char * parent = (char*)util_alloc_strip_copy( (const char*)ecl_kw_iget_ptr( parent_kw , 0)); if (strlen( parent ) > 0) lgr_grid->parent_name = parent; @@ -2251,7 +2252,7 @@ static void ecl_grid_set_lgr_name_EGRID(ecl_grid_type * lgr_grid , const ecl_fil static void ecl_grid_set_lgr_name_GRID(ecl_grid_type * lgr_grid , const ecl_file_type * ecl_file , int grid_nr) { ecl_kw_type * lgr_kw = ecl_file_iget_named_kw( ecl_file , LGR_KW , grid_nr - 1); - lgr_grid->name = util_alloc_strip_copy( ecl_kw_iget_ptr( lgr_kw , 0) ); /* trailing zeros are stripped away. */ + lgr_grid->name = (char*)util_alloc_strip_copy( (const char*)ecl_kw_iget_ptr( lgr_kw , 0) ); /* trailing zeros are stripped away. */ { /** the lgr keyword can have one or two elements; in the case of two elements @@ -2259,7 +2260,7 @@ static void ecl_grid_set_lgr_name_GRID(ecl_grid_type * lgr_grid , const ecl_file only one element the current lgr is assumed to descend from the main grid */ if (ecl_kw_get_size( lgr_kw ) == 2) { - char * parent = util_alloc_strip_copy( ecl_kw_iget_ptr( lgr_kw , 1)); + char * parent = (char*)util_alloc_strip_copy( (const char*)ecl_kw_iget_ptr( lgr_kw , 1)); if ((strlen(parent) == 0) || (strcmp(parent , GLOBAL_STRING ) == 0)) free( parent ); @@ -2430,9 +2431,9 @@ static ecl_grid_type * ecl_grid_alloc_GRDECL_data__(ecl_grid_type * global_grid, static void ecl_grid_copy_mapaxes( ecl_grid_type * target_grid , const ecl_grid_type * src_grid ) { target_grid->use_mapaxes = src_grid->use_mapaxes; if (src_grid->mapaxes) - target_grid->mapaxes = util_realloc_copy(target_grid->mapaxes , src_grid->mapaxes , 6 * sizeof * src_grid->mapaxes ); + target_grid->mapaxes = (float*)util_realloc_copy(target_grid->mapaxes , src_grid->mapaxes , 6 * sizeof * src_grid->mapaxes ); else - target_grid->mapaxes = util_realloc_copy(target_grid->mapaxes , NULL , 0 ); + target_grid->mapaxes = (float*)util_realloc_copy(target_grid->mapaxes , NULL , 0 ); for (int i=0; i < 2; i++) { target_grid->unit_x[i] = src_grid->unit_x[i]; @@ -2485,7 +2486,7 @@ ecl_grid_type * ecl_grid_alloc_copy( const ecl_grid_type * src_grid ) { { int grid_nr; for (grid_nr = 0; grid_nr < vector_get_size( src_grid->LGR_list ); grid_nr++) { - const ecl_grid_type * src_lgr = vector_iget_const( src_grid->LGR_list , grid_nr); + const ecl_grid_type * src_lgr = (const ecl_grid_type*)vector_iget_const( src_grid->LGR_list , grid_nr); ecl_grid_type * copy_lgr = ecl_grid_alloc_copy__( src_lgr , copy_grid ); ecl_grid_type * host_grid; @@ -2528,12 +2529,12 @@ ecl_grid_type * ecl_grid_alloc_processed_copy( const ecl_grid_type * src_grid , } else { int nx,ny,nz,na; int zcorn_size = ecl_grid_get_zcorn_size( src_grid ); - float * zcorn_float = util_malloc( zcorn_size * sizeof * zcorn_float ); + float * zcorn_float = (float*)util_malloc( zcorn_size * sizeof * zcorn_float ); float * coord = ecl_grid_alloc_coord_data( src_grid ); float * mapaxes = NULL; if (ecl_grid_get_mapaxes( src_grid )) { - mapaxes = util_malloc( 6 * sizeof * mapaxes ); + mapaxes = (float*)util_malloc( 6 * sizeof * mapaxes ); ecl_grid_init_mapaxes_data_float(src_grid, mapaxes); } ecl_grid_get_dims( src_grid , &nx, &ny , &nz , &na); @@ -3160,8 +3161,8 @@ static ecl_grid_type * ecl_grid_alloc_GRID__(ecl_grid_type * global_grid , const int coords_size = -1; int index; - int ** coords = util_calloc( num_coords , sizeof * coords ); - float ** corners = util_calloc( num_coords , sizeof * corners ); + int ** coords = (int **)util_calloc( num_coords , sizeof * coords ); + float ** corners = (float**)util_calloc( num_coords , sizeof * corners ); for (index = 0; index < num_coords; index++) { const ecl_kw_type * coords_kw = ecl_file_iget_named_kw(ecl_file , COORDS_KW , index + cell_offset); @@ -3449,7 +3450,7 @@ ecl_grid_type * ecl_grid_alloc_dx_dy_dz_tops( int nx, int ny , int nz , const do 0, true); if (grid) { int i, j, k; - double * y0 = util_calloc( nx, sizeof * y0 ); + double * y0 = (double*)util_calloc( nx, sizeof * y0 ); for (k=0; k < nz; k++) { for (i=0; i < nx; i++) { @@ -3744,8 +3745,8 @@ static bool ecl_grid_compare_coarse_cells(const ecl_grid_type * g1 , const ecl_g int c; for (c = 0; c < vector_get_size( g1->coarse_cells ); c++) { - const ecl_coarse_cell_type * coarse_cell1 = vector_iget_const( g1->coarse_cells , c); - const ecl_coarse_cell_type * coarse_cell2 = vector_iget_const( g2->coarse_cells , c); + const ecl_coarse_cell_type * coarse_cell1 = (const ecl_coarse_cell_type*)vector_iget_const( g1->coarse_cells , c); + const ecl_coarse_cell_type * coarse_cell2 = (const ecl_coarse_cell_type*)vector_iget_const( g2->coarse_cells , c); equal = ecl_coarse_cell_equal( coarse_cell1 , coarse_cell2 ); if (!equal) @@ -3909,8 +3910,8 @@ bool ecl_grid_compare(const ecl_grid_type * g1 , const ecl_grid_type * g2 , bool if (vector_get_size( g1->LGR_list ) == vector_get_size( g2->LGR_list )) { int grid_nr; for (grid_nr = 0; grid_nr < vector_get_size( g1->LGR_list ); grid_nr++) { - const ecl_grid_type * lgr1 = vector_iget_const( g1->LGR_list , grid_nr); - const ecl_grid_type * lgr2 = vector_iget_const( g2->LGR_list , grid_nr); + const ecl_grid_type * lgr1 = (const ecl_grid_type*)vector_iget_const( g1->LGR_list , grid_nr); + const ecl_grid_type * lgr2 = (const ecl_grid_type*)vector_iget_const( g2->LGR_list , grid_nr); printf("Comparing lgr grid:%d \n",grid_nr); equal = ecl_grid_compare__(lgr1 , lgr2 , include_nnc , verbose); @@ -4185,7 +4186,7 @@ int ecl_grid_get_global_index_from_xy_bottom( const ecl_grid_type * ecl_grid , d static void ecl_grid_clear_visited( ecl_grid_type * grid ) { if (grid->visited == NULL) - grid->visited = util_calloc( grid->size , sizeof * grid->visited ); + grid->visited = (bool*)util_calloc( grid->size , sizeof * grid->visited ); { int i; @@ -4407,7 +4408,7 @@ void ecl_grid_alloc_blocking_variables(ecl_grid_type * grid, int block_dim) { else util_abort("%: valid values are two and three. Value:%d invaid \n",__func__ , block_dim); - grid->values = util_calloc( grid->block_size , sizeof * grid->values ); + grid->values = (double_vector_type**)util_calloc( grid->block_size , sizeof * grid->values ); for (index = 0; index < grid->block_size; index++) grid->values[index] = double_vector_alloc( 0 , 0.0 ); } @@ -5128,7 +5129,7 @@ ecl_grid_type * ecl_grid_get_lgr(const ecl_grid_type * main_grid, const char * _ __assert_main_grid( main_grid ); { char * lgr_name = util_alloc_strip_copy( __lgr_name ); - ecl_grid_type * lgr_grid = hash_get(main_grid->LGR_hash , lgr_name); + ecl_grid_type * lgr_grid = (ecl_grid_type*)hash_get(main_grid->LGR_hash , lgr_name); free(lgr_name); return lgr_grid; } @@ -5195,7 +5196,7 @@ int ecl_grid_get_num_lgr(const ecl_grid_type * main_grid ) { ecl_grid_type * ecl_grid_iget_lgr(const ecl_grid_type * main_grid, int lgr_index) { __assert_main_grid( main_grid ); - return vector_iget( main_grid->LGR_list , lgr_index); + return (ecl_grid_type*)vector_iget( main_grid->LGR_list , lgr_index); } /* @@ -5212,7 +5213,7 @@ ecl_grid_type * ecl_grid_get_lgr_from_lgr_nr(const ecl_grid_type * main_grid, in __assert_main_grid( main_grid ); { int lgr_index = int_vector_iget( main_grid->lgr_index_map , lgr_nr ); - return vector_iget( main_grid->LGR_list , lgr_index); + return (ecl_grid_type*)vector_iget( main_grid->LGR_list , lgr_index); } } @@ -5276,7 +5277,7 @@ stringlist_type * ecl_grid_alloc_lgr_name_list(const ecl_grid_type * ecl_grid) { const char * ecl_grid_iget_lgr_name( const ecl_grid_type * ecl_grid , int lgr_index) { __assert_main_grid( ecl_grid ); if (lgr_index < (vector_get_size( ecl_grid->LGR_list ))) { - const ecl_grid_type * lgr = vector_iget( ecl_grid->LGR_list , lgr_index); + const ecl_grid_type * lgr = (const ecl_grid_type*)vector_iget( ecl_grid->LGR_list , lgr_index); return lgr->name; } else return NULL; @@ -5421,7 +5422,7 @@ void ecl_grid_summarize(const ecl_grid_type * ecl_grid) { int grid_nr; for (grid_nr=1; grid_nr < vector_get_size( ecl_grid->LGR_list ); grid_nr++) { printf("\n"); - ecl_grid_summarize( vector_iget_const( ecl_grid->LGR_list , grid_nr )); + ecl_grid_summarize( (const ecl_grid_type*)vector_iget_const( ecl_grid->LGR_list , grid_nr )); } } ecl_grid_test_lgr_consistency( ecl_grid ); @@ -5643,7 +5644,7 @@ int ecl_grid_get_region_cells(const ecl_grid_type * ecl_grid , const ecl_kw_type int cells_found = 0; if (ecl_kw_get_size( region_kw ) == ecl_grid->size) { if (ecl_type_is_int(ecl_kw_get_data_type( region_kw ))) { - const int * region_ptr = ecl_kw_iget_ptr( region_kw , 0); + const int * region_ptr = (const int*)ecl_kw_iget_ptr( region_kw , 0); int_vector_reset( index_list ); @@ -5748,7 +5749,7 @@ bool ecl_grid_test_lgr_consistency( const ecl_grid_type * ecl_grid ) { hash_iter_type * lgr_iter = hash_iter_alloc( ecl_grid->children ); bool consistent = true; while (!hash_iter_is_complete( lgr_iter )) { - const ecl_grid_type * lgr = hash_iter_get_next_value( lgr_iter ); + const ecl_grid_type * lgr = (const ecl_grid_type*)hash_iter_get_next_value( lgr_iter ); consistent &= ecl_grid_test_lgr_consistency2( ecl_grid , lgr ); consistent &= ecl_grid_test_lgr_consistency( lgr ); } @@ -5815,7 +5816,7 @@ void ecl_grid_dump(const ecl_grid_type * grid , FILE * stream) { { int i; for (i = 0; i < vector_get_size( grid->LGR_list ); i++) - ecl_grid_dump__( vector_iget_const( grid->LGR_list , i) , stream ); + ecl_grid_dump__( (const ecl_grid_type*)vector_iget_const( grid->LGR_list , i) , stream ); } } @@ -5824,7 +5825,7 @@ void ecl_grid_dump_ascii(ecl_grid_type * grid , bool active_only , FILE * stream { int i; for (i = 0; i < vector_get_size( grid->LGR_list ); i++) - ecl_grid_dump_ascii__( vector_iget( grid->LGR_list , i) , active_only , stream ); + ecl_grid_dump_ascii__( (ecl_grid_type*)vector_iget( grid->LGR_list , i) , active_only , stream ); } } @@ -6068,7 +6069,7 @@ void ecl_grid_fwrite_GRID2( const ecl_grid_type * grid , const char * filename, { int grid_nr; for (grid_nr = 0; grid_nr < vector_get_size( grid->LGR_list ); grid_nr++) { - const ecl_grid_type * igrid = vector_iget_const( grid->LGR_list , grid_nr ); + const ecl_grid_type * igrid = (const ecl_grid_type*)vector_iget_const( grid->LGR_list , grid_nr ); ecl_grid_fwrite_GRID__( igrid , coords_size , fortio , output_unit ); } } @@ -6296,7 +6297,7 @@ void ecl_grid_init_coord_data_double( const ecl_grid_type * grid , double * coor float * ecl_grid_alloc_coord_data( const ecl_grid_type * grid ) { - float * coord = util_calloc( ecl_grid_get_coord_size(grid) , sizeof * coord ); + float * coord = (float*)util_calloc( ecl_grid_get_coord_size(grid) , sizeof * coord ); ecl_grid_init_coord_data( grid , coord ); return coord; } @@ -6304,7 +6305,7 @@ float * ecl_grid_alloc_coord_data( const ecl_grid_type * grid ) { void ecl_grid_assert_coord_kw( ecl_grid_type * grid ) { if (grid->coord_kw == NULL) { grid->coord_kw = ecl_kw_alloc( COORD_KW , ecl_grid_get_coord_size( grid ) , ECL_FLOAT); - ecl_grid_init_coord_data( grid , ecl_kw_get_void_ptr( grid->coord_kw )); + ecl_grid_init_coord_data( grid , (float*)ecl_kw_get_void_ptr( grid->coord_kw )); } } @@ -6366,7 +6367,7 @@ void ecl_grid_init_zcorn_data_double( const ecl_grid_type * grid , double * zcor float * ecl_grid_alloc_zcorn_data( const ecl_grid_type * grid ) { - float * zcorn = util_calloc( 8 * grid->size , sizeof * zcorn ); + float * zcorn = (float*)util_calloc( 8 * grid->size , sizeof * zcorn ); ecl_grid_init_zcorn_data( grid , zcorn ); return zcorn; } @@ -6375,7 +6376,7 @@ float * ecl_grid_alloc_zcorn_data( const ecl_grid_type * grid ) { ecl_kw_type * ecl_grid_alloc_zcorn_kw( const ecl_grid_type * grid ) { ecl_kw_type * zcorn_kw = ecl_kw_alloc( ZCORN_KW , ecl_grid_get_zcorn_size(grid), ECL_FLOAT); - ecl_grid_init_zcorn_data(grid , ecl_kw_get_void_ptr(zcorn_kw)); + ecl_grid_init_zcorn_data(grid , (float*)ecl_kw_get_void_ptr(zcorn_kw)); return zcorn_kw; } @@ -6444,7 +6445,7 @@ void ecl_grid_init_actnum_data( const ecl_grid_type * grid , int * actnum ) { int * ecl_grid_alloc_actnum_data( const ecl_grid_type * grid ) { - int * actnum = util_calloc( grid->size , sizeof * actnum); + int * actnum = (int*)util_calloc( grid->size , sizeof * actnum); ecl_grid_init_actnum_data( grid , actnum ); return actnum; } @@ -6453,7 +6454,7 @@ int * ecl_grid_alloc_actnum_data( const ecl_grid_type * grid ) { ecl_kw_type * ecl_grid_alloc_actnum_kw( const ecl_grid_type * grid ) { ecl_kw_type * actnum_kw = ecl_kw_alloc( ACTNUM_KW , grid->size , ECL_INT); - ecl_grid_init_actnum_data( grid , ecl_kw_get_void_ptr( actnum_kw )); + ecl_grid_init_actnum_data( grid , (int*)ecl_kw_get_void_ptr( actnum_kw )); return actnum_kw; } @@ -6499,7 +6500,7 @@ static void ecl_grid_init_hostnum_data( const ecl_grid_type * grid , int * hostn } int * ecl_grid_alloc_hostnum_data( const ecl_grid_type * grid ) { - int * hostnum = util_calloc( grid->size , sizeof * hostnum ); + int * hostnum = (int*)util_calloc( grid->size , sizeof * hostnum ); ecl_grid_init_hostnum_data( grid , hostnum ); return hostnum; } @@ -6507,7 +6508,7 @@ int * ecl_grid_alloc_hostnum_data( const ecl_grid_type * grid ) { ecl_kw_type * ecl_grid_alloc_hostnum_kw( const ecl_grid_type * grid ) { ecl_kw_type * hostnum_kw = ecl_kw_alloc( HOSTNUM_KW , grid->size , ECL_INT); - ecl_grid_init_hostnum_data( grid , ecl_kw_get_void_ptr( hostnum_kw )); + ecl_grid_init_hostnum_data( grid , (int*)ecl_kw_get_void_ptr( hostnum_kw )); return hostnum_kw; } @@ -6522,7 +6523,7 @@ static void ecl_grid_init_corsnum_data( const ecl_grid_type * grid , int * corsn } int * ecl_grid_alloc_corsnum_data( const ecl_grid_type * grid ) { - int * corsnum = util_calloc( grid->size , sizeof * corsnum ); + int * corsnum = (int*)util_calloc( grid->size , sizeof * corsnum ); ecl_grid_init_corsnum_data( grid , corsnum ); return corsnum; } @@ -6530,7 +6531,7 @@ int * ecl_grid_alloc_corsnum_data( const ecl_grid_type * grid ) { ecl_kw_type * ecl_grid_alloc_corsnum_kw( const ecl_grid_type * grid ) { ecl_kw_type * corsnum_kw = ecl_kw_alloc( CORSNUM_KW , grid->size , ECL_INT); - ecl_grid_init_corsnum_data( grid , ecl_kw_get_void_ptr( corsnum_kw )); + ecl_grid_init_corsnum_data( grid , (int*)ecl_kw_get_void_ptr( corsnum_kw )); return corsnum_kw; } @@ -6698,7 +6699,7 @@ void ecl_grid_fwrite_EGRID2( ecl_grid_type * grid , const char * filename, ert_e { int grid_nr; for (grid_nr = 0; grid_nr < vector_get_size( grid->LGR_list ); grid_nr++) { - ecl_grid_type * igrid = vector_iget( grid->LGR_list , grid_nr ); + ecl_grid_type * igrid = (ecl_grid_type*)vector_iget( grid->LGR_list , grid_nr ); ecl_grid_fwrite_EGRID__( igrid , fortio, output_unit ); } } @@ -6726,7 +6727,7 @@ void ecl_grid_fwrite_EGRID( ecl_grid_type * grid , const char * filename, bool o void ecl_grid_fwrite_depth( const ecl_grid_type * grid , fortio_type * init_file , ert_ecl_unit_enum output_unit) { ecl_kw_type * depth_kw = ecl_kw_alloc("DEPTH" , ecl_grid_get_nactive(grid) , ECL_FLOAT); { - float * depth_ptr = ecl_kw_get_ptr(depth_kw); + float * depth_ptr = (float*)ecl_kw_get_ptr(depth_kw); for (int i = 0; i < ecl_grid_get_nactive( grid ); i++) depth_ptr[i] = ecl_grid_get_cdepth1A( grid , i ); } @@ -6742,9 +6743,9 @@ void ecl_grid_fwrite_dims( const ecl_grid_type * grid , fortio_type * init_file, ecl_kw_type * dz = ecl_kw_alloc("DZ" , ecl_grid_get_nactive(grid) , ECL_FLOAT); { { - float * dx_ptr = ecl_kw_get_ptr(dx); - float * dy_ptr = ecl_kw_get_ptr(dy); - float * dz_ptr = ecl_kw_get_ptr(dz); + float * dx_ptr = (float*)ecl_kw_get_ptr(dx); + float * dy_ptr = (float*)ecl_kw_get_ptr(dy); + float * dz_ptr = (float*)ecl_kw_get_ptr(dz); for (int i = 0; i < ecl_grid_get_nactive( grid ); i++) { dx_ptr[i] = ecl_grid_get_cell_dx1A( grid , i ); @@ -6883,7 +6884,7 @@ int ecl_grid_get_num_nnc( const ecl_grid_type * grid ) { { int grid_nr; for (grid_nr = 0; grid_nr < vector_get_size( grid->LGR_list ); grid_nr++) { - ecl_grid_type * igrid = vector_iget( grid->LGR_list , grid_nr ); + ecl_grid_type * igrid = (ecl_grid_type*)vector_iget( grid->LGR_list , grid_nr ); num_nnc += ecl_grid_get_num_nnc__( igrid ); } } @@ -6894,7 +6895,7 @@ int ecl_grid_get_num_nnc( const ecl_grid_type * grid ) { static ecl_kw_type * ecl_grid_alloc_volume_kw_active( const ecl_grid_type * grid) { ecl_kw_type * volume_kw = ecl_kw_alloc("VOLUME" , ecl_grid_get_active_size(grid) , ECL_DOUBLE); { - double * volume_data = ecl_kw_get_ptr( volume_kw ); + double * volume_data = (double*)ecl_kw_get_ptr( volume_kw ); int active_index; for (active_index = 0; active_index < ecl_grid_get_active_size(grid); active_index++) { double cell_volume = ecl_grid_get_cell_volume1A(grid , active_index); @@ -6908,7 +6909,7 @@ static ecl_kw_type * ecl_grid_alloc_volume_kw_active( const ecl_grid_type * grid static ecl_kw_type * ecl_grid_alloc_volume_kw_global( const ecl_grid_type * grid) { ecl_kw_type * volume_kw = ecl_kw_alloc("VOLUME" , ecl_grid_get_global_size(grid) , ECL_DOUBLE); { - double * volume_data = ecl_kw_get_ptr( volume_kw ); + double * volume_data = (double*)ecl_kw_get_ptr( volume_kw ); int global_index; for (global_index = 0; global_index < ecl_grid_get_global_size(grid); global_index++) { double cell_volume = ecl_grid_get_cell_volume1(grid , global_index); diff --git a/lib/ecl/ecl_grid_cache.c b/lib/ecl/ecl_grid_cache.cpp similarity index 87% rename from lib/ecl/ecl_grid_cache.c rename to lib/ecl/ecl_grid_cache.cpp index 3c11f46231..b3868aaeaa 100644 --- a/lib/ecl/ecl_grid_cache.c +++ b/lib/ecl/ecl_grid_cache.cpp @@ -54,15 +54,15 @@ struct ecl_grid_cache_struct { ecl_grid_cache_type * ecl_grid_cache_alloc( const ecl_grid_type * grid ) { - ecl_grid_cache_type * grid_cache = util_malloc( sizeof * grid_cache ); + ecl_grid_cache_type * grid_cache = (ecl_grid_cache_type*)util_malloc( sizeof * grid_cache ); grid_cache->grid = grid; grid_cache->volume = NULL; grid_cache->size = ecl_grid_get_active_size( grid ); - grid_cache->xpos = util_calloc( grid_cache->size , sizeof * grid_cache->xpos ); - grid_cache->ypos = util_calloc( grid_cache->size , sizeof * grid_cache->ypos ); - grid_cache->zpos = util_calloc( grid_cache->size , sizeof * grid_cache->zpos ); - grid_cache->global_index = util_calloc( grid_cache->size , sizeof * grid_cache->global_index ); + grid_cache->xpos = (double*)util_calloc( grid_cache->size , sizeof * grid_cache->xpos ); + grid_cache->ypos = (double*)util_calloc( grid_cache->size , sizeof * grid_cache->ypos ); + grid_cache->zpos = (double*)util_calloc( grid_cache->size , sizeof * grid_cache->zpos ); + grid_cache->global_index = (int*)util_calloc( grid_cache->size , sizeof * grid_cache->global_index ); { int active_index; @@ -113,7 +113,7 @@ const double * ecl_grid_cache_get_volume( const ecl_grid_cache_type * grid_cache if (!grid_cache->volume) { // C++ style const cast. ecl_grid_cache_type * gc = (ecl_grid_cache_type *) grid_cache; - gc->volume = util_calloc( gc->size , sizeof * gc->volume ); + gc->volume = (double*)util_calloc( gc->size , sizeof * gc->volume ); for (int active_index = 0; active_index < grid_cache->size; active_index++) gc->volume[active_index] = ecl_grid_get_cell_volume1A( gc->grid , active_index ); } diff --git a/lib/ecl/ecl_grid_dims.c b/lib/ecl/ecl_grid_dims.cpp similarity index 96% rename from lib/ecl/ecl_grid_dims.c rename to lib/ecl/ecl_grid_dims.cpp index 23d4b40838..3d9849d345 100644 --- a/lib/ecl/ecl_grid_dims.c +++ b/lib/ecl/ecl_grid_dims.cpp @@ -101,7 +101,7 @@ ecl_grid_dims_type * ecl_grid_dims_alloc( const char * grid_file , const char * if ((grid_file_type == ECL_GRID_FILE) || (grid_file_type == ECL_EGRID_FILE)) { fortio_type * grid_fortio = fortio_open_reader( grid_file , grid_fmt_file , ECL_ENDIAN_FLIP ); if (grid_fortio) { - grid_dims = util_malloc( sizeof * grid_dims ); + grid_dims = (ecl_grid_dims_type*)util_malloc( sizeof * grid_dims ); grid_dims->dims_list = vector_alloc_new( ); { @@ -144,6 +144,6 @@ int ecl_grid_dims_get_num_grids( const ecl_grid_dims_type * grid_dims ) { const grid_dims_type * ecl_grid_dims_iget_dims( const ecl_grid_dims_type * grid_dims , int grid_nr ) { - return vector_iget_const( grid_dims->dims_list , grid_nr ); + return (const grid_dims_type*)vector_iget_const( grid_dims->dims_list , grid_nr ); } diff --git a/lib/ecl/ecl_io_config.c b/lib/ecl/ecl_io_config.cpp similarity index 97% rename from lib/ecl/ecl_io_config.c rename to lib/ecl/ecl_io_config.cpp index 924bc15c6b..3da3b29185 100644 --- a/lib/ecl/ecl_io_config.c +++ b/lib/ecl/ecl_io_config.cpp @@ -61,7 +61,7 @@ struct ecl_io_config_struct { /*****************************************************************/ static ecl_io_config_type * ecl_io_config_alloc__() { - ecl_io_config_type * ecl_io_config = util_malloc(sizeof * ecl_io_config ); + ecl_io_config_type * ecl_io_config = (ecl_io_config_type*)util_malloc(sizeof * ecl_io_config ); ecl_io_config->formatted = FMT_UNDEFINED; ecl_io_config->unified_restart = UNIF_UNDEFINED; diff --git a/lib/ecl/ecl_kw.c b/lib/ecl/ecl_kw.cpp similarity index 96% rename from lib/ecl/ecl_kw.c rename to lib/ecl/ecl_kw.cpp index f8007c9234..de82a3479e 100644 --- a/lib/ecl/ecl_kw.c +++ b/lib/ecl/ecl_kw.cpp @@ -261,7 +261,7 @@ static void ecl_kw_assert_index(const ecl_kw_type *ecl_kw , int index, const cha static char * ecl_kw_alloc_output_buffer(const ecl_kw_type * ecl_kw) { size_t sizeof_iotype = ecl_type_get_sizeof_iotype(ecl_kw->data_type); size_t buffer_size = ecl_kw->size * sizeof_iotype; - char * buffer = util_malloc( buffer_size ); + char * buffer = (char*)util_malloc( buffer_size ); if (ecl_type_is_bool(ecl_kw->data_type)) { int * int_data = (int *) buffer; @@ -300,7 +300,7 @@ static char * ecl_kw_alloc_output_buffer(const ecl_kw_type * ecl_kw) { static char * ecl_kw_alloc_input_buffer(const ecl_kw_type * ecl_kw) { size_t buffer_size = ecl_kw->size * ecl_type_get_sizeof_iotype(ecl_kw->data_type); - char * buffer = util_malloc( buffer_size ); + char * buffer = (char*)util_malloc( buffer_size ); return buffer; } @@ -561,7 +561,7 @@ static void ecl_kw_set_shared_ref(ecl_kw_type * ecl_kw , void *data_ptr) { util_abort("%s: can not change to shared for keyword with allocated storage - aborting \n",__func__); } ecl_kw->shared_data = true; - ecl_kw->data = data_ptr; + ecl_kw->data = (char*)data_ptr; } @@ -636,7 +636,7 @@ ecl_kw_type * ecl_kw_alloc_new_shared(const char * header , int size, ecl_data_ ecl_kw_type * ecl_kw_alloc_empty() { ecl_kw_type *ecl_kw; - ecl_kw = util_malloc(sizeof *ecl_kw ); + ecl_kw = (ecl_kw_type*)util_malloc(sizeof *ecl_kw ); ecl_kw->header = NULL; ecl_kw->header8 = NULL; ecl_kw->data = NULL; @@ -682,10 +682,10 @@ void ecl_kw_memcpy(ecl_kw_type *target, const ecl_kw_type *src) { ecl_kw_type *ecl_kw_alloc_copy(const ecl_kw_type *src) { - ecl_kw_type *new; - new = ecl_kw_alloc_empty(); - ecl_kw_memcpy(new , src); - return new; + ecl_kw_type *new_; + new_ = ecl_kw_alloc_empty(); + ecl_kw_memcpy(new_ , src); + return new_; } /** @@ -754,7 +754,7 @@ void ecl_kw_resize( ecl_kw_type * ecl_kw, int new_size) { size_t old_byte_size = ecl_kw->size * ecl_type_get_sizeof_ctype(ecl_kw->data_type); size_t new_byte_size = new_size * ecl_type_get_sizeof_ctype(ecl_kw->data_type); - ecl_kw->data = util_realloc(ecl_kw->data , new_byte_size ); + ecl_kw->data = (char*)util_realloc(ecl_kw->data , new_byte_size ); if (new_byte_size > old_byte_size) { size_t offset = old_byte_size; memset(&ecl_kw->data[offset] , 0 , new_byte_size - old_byte_size); @@ -869,13 +869,13 @@ ECL_KW_IGET_TYPED(bool , ECL_BOOL_TYPE); const char * ecl_kw_iget_char_ptr( const ecl_kw_type * ecl_kw , int i) { if (ecl_kw_get_type(ecl_kw) != ECL_CHAR_TYPE) util_abort("%s: Keyword: %s is wrong type - aborting \n",__func__ , ecl_kw_get_header8(ecl_kw)); - return ecl_kw_iget_ptr( ecl_kw , i ); + return (const char *)ecl_kw_iget_ptr( ecl_kw , i ); } const char * ecl_kw_iget_string_ptr( const ecl_kw_type * ecl_kw, int i) { if (ecl_kw_get_type(ecl_kw) != ECL_STRING_TYPE) util_abort("%s: Keyword: %s is wrong type - aborting \n",__func__ , ecl_kw_get_header8(ecl_kw)); - return ecl_kw_iget_ptr( ecl_kw , i ); + return (const char *)ecl_kw_iget_ptr( ecl_kw , i ); } @@ -972,9 +972,9 @@ void ecl_kw_iset_string_ptr( ecl_kw_type * ecl_kw, int index, const char * s) { */ bool ecl_kw_icmp_string( const ecl_kw_type * ecl_kw , int index, const char * other_string) { - const char * kw_string = ecl_kw_iget_char_ptr( ecl_kw , index ); + const char * kw_string = (const char *)ecl_kw_iget_char_ptr( ecl_kw , index ); if (strlen(other_string)) { - char * match = strstr( kw_string , other_string); + const char * match = strstr( kw_string , other_string); if (match == kw_string) return true; } @@ -1484,7 +1484,7 @@ bool ecl_kw_fseek_last_kw(const char * kw , bool abort_on_error , fortio_type *f void ecl_kw_set_data_ptr(ecl_kw_type * ecl_kw , void * data) { if (!ecl_kw->shared_data) util_safe_free( ecl_kw->data ); - ecl_kw->data = data; + ecl_kw->data = (char*)data; } @@ -1497,7 +1497,7 @@ void ecl_kw_alloc_data(ecl_kw_type *ecl_kw) { { size_t byte_size = ecl_kw->size * ecl_type_get_sizeof_ctype(ecl_kw->data_type); - ecl_kw->data = util_realloc(ecl_kw->data , byte_size ); + ecl_kw->data = (char*)util_realloc(ecl_kw->data , byte_size ); memset(ecl_kw->data , 0 , byte_size); } } @@ -1514,7 +1514,7 @@ void ecl_kw_free_data(ecl_kw_type *ecl_kw) { void ecl_kw_set_header_name(ecl_kw_type * ecl_kw , const char * header) { - ecl_kw->header8 = realloc(ecl_kw->header8 , ECL_STRING8_LENGTH + 1); + ecl_kw->header8 = (char*)realloc(ecl_kw->header8 , ECL_STRING8_LENGTH + 1); if (strlen(header) <= 8) { sprintf(ecl_kw->header8 , "%-8s" , header); @@ -1523,7 +1523,7 @@ void ecl_kw_set_header_name(ecl_kw_type * ecl_kw , const char * header) { ecl_kw->header = util_alloc_strip_copy( ecl_kw->header8 ); } else { - ecl_kw->header = util_alloc_copy(header, strlen( header ) + 1); + ecl_kw->header = (char*)util_alloc_copy(header, strlen( header ) + 1); } } @@ -1781,7 +1781,7 @@ ecl_data_type ecl_kw_get_data_type(const ecl_kw_type * ecl_kw) { ecl_kw_type * ecl_kw_buffer_alloc(buffer_type * buffer) { const char * header = buffer_fread_string( buffer ); int size = buffer_fread_int( buffer ); - ecl_type_enum ecl_type = buffer_fread_int( buffer ); + ecl_type_enum ecl_type = (ecl_type_enum)buffer_fread_int( buffer ); size_t element_size = buffer_fread_int( buffer ); ecl_data_type data_type = ecl_type_create(ecl_type, element_size); @@ -1991,7 +1991,7 @@ void ecl_kw_summarize(const ecl_kw_type * ecl_kw) { #define ECL_KW_SCALAR_SET_TYPED( ctype , ECL_TYPE ) \ void ecl_kw_scalar_set_ ## ctype( ecl_kw_type * ecl_kw , ctype value){ \ if (ecl_kw_get_type(ecl_kw) == ECL_TYPE) { \ - ctype * data = ecl_kw_get_data_ref(ecl_kw); \ + ctype * data = (ctype *)ecl_kw_get_data_ref(ecl_kw); \ int i; \ for (i=0;i < ecl_kw->size; i++) \ data[i] = value; \ @@ -2048,7 +2048,7 @@ void ecl_kw_scale_ ## ctype (ecl_kw_type * ecl_kw , ctype scale_factor) { if (ecl_kw_get_type(ecl_kw) != ECL_TYPE) \ util_abort("%s: Keyword: %s is wrong type - aborting \n",__func__ , ecl_kw_get_header8(ecl_kw)); \ { \ - ctype * data = ecl_kw_get_data_ref(ecl_kw); \ + ctype * data = (ctype *)ecl_kw_get_data_ref(ecl_kw); \ int size = ecl_kw_get_size(ecl_kw); \ int i; \ for (i=0; i < size; i++) \ @@ -2077,7 +2077,7 @@ void ecl_kw_shift_ ## ctype (ecl_kw_type * ecl_kw , ctype shift_value) { if (ecl_kw_get_type(ecl_kw) != ECL_TYPE) \ util_abort("%s: Keyword: %s is wrong type - aborting \n",__func__ , ecl_kw_get_header8(ecl_kw)); \ { \ - ctype * data = ecl_kw_get_data_ref(ecl_kw); \ + ctype * data = (ctype *)ecl_kw_get_data_ref(ecl_kw); \ int size = ecl_kw_get_size(ecl_kw); \ int i; \ for (i=0; i < size; i++) \ @@ -2126,8 +2126,8 @@ void ecl_kw_copy_indexed( ecl_kw_type * target_kw , const int_vector_type * inde if (!ecl_kw_size_and_type_equal( target_kw , src_kw )) util_abort("%s: type/size mismatch\n",__func__); { - char * target_data = ecl_kw_get_data_ref( target_kw ); - const char * src_data = ecl_kw_get_data_ref( src_kw ); + char * target_data = (char *)ecl_kw_get_data_ref( target_kw ); + const char * src_data = (const char *)ecl_kw_get_data_ref( src_kw ); int sizeof_ctype = ecl_type_get_sizeof_ctype(target_kw->data_type); int set_size = int_vector_size( index_set ); const int * index_data = int_vector_get_const_ptr( index_set ); @@ -2146,8 +2146,8 @@ static void ecl_kw_inplace_add_indexed_ ## ctype( ecl_kw_type * target_kw , cons if (!ecl_kw_assert_binary_ ## ctype( target_kw , add_kw )) \ util_abort("%s: type/size mismatch\n",__func__); \ { \ - ctype * target_data = ecl_kw_get_data_ref( target_kw ); \ - const ctype * add_data = ecl_kw_get_data_ref( add_kw ); \ + ctype * target_data = (ctype *)ecl_kw_get_data_ref( target_kw ); \ + const ctype * add_data = (const ctype *)ecl_kw_get_data_ref( add_kw ); \ int set_size = int_vector_size( index_set ); \ const int * index_data = int_vector_get_const_ptr( index_set ); \ int i; \ @@ -2189,8 +2189,8 @@ static void ecl_kw_inplace_add_ ## ctype( ecl_kw_type * target_kw , const ecl_kw if (!ecl_kw_assert_binary_ ## ctype( target_kw , add_kw )) \ util_abort("%s: type/size mismatch\n",__func__); \ { \ - ctype * target_data = ecl_kw_get_data_ref( target_kw ); \ - const ctype * add_data = ecl_kw_get_data_ref( add_kw ); \ + ctype * target_data = (ctype *)ecl_kw_get_data_ref( target_kw ); \ + const ctype * add_data = (const ctype *)ecl_kw_get_data_ref( add_kw ); \ int i; \ for (i=0; i < target_kw->size; i++) \ target_data[i] += add_data[i]; \ @@ -2224,8 +2224,8 @@ static void ecl_kw_inplace_add_squared_ ## ctype( ecl_kw_type * target_kw , cons if (!ecl_kw_assert_binary_ ## ctype( target_kw , add_kw )) \ util_abort("%s: type/size mismatch\n",__func__); \ { \ - ctype * target_data = ecl_kw_get_data_ref( target_kw ); \ - const ctype * add_data = ecl_kw_get_data_ref( add_kw ); \ + ctype * target_data = (ctype *)ecl_kw_get_data_ref( target_kw ); \ + const ctype * add_data = (const ctype *)ecl_kw_get_data_ref( add_kw ); \ int i; \ for (i=0; i < target_kw->size; i++) \ target_data[i] += add_data[i] * add_data[i]; \ @@ -2264,8 +2264,8 @@ void ecl_kw_inplace_sub_ ## ctype( ecl_kw_type * target_kw , const ecl_kw_type * if (!ecl_kw_assert_binary_ ## ctype( target_kw , sub_kw )) \ util_abort("%s: type/size mismatch\n",__func__); \ { \ - ctype * target_data = ecl_kw_get_data_ref( target_kw ); \ - const ctype * sub_data = ecl_kw_get_data_ref( sub_kw ); \ + ctype * target_data = (ctype *)ecl_kw_get_data_ref( target_kw ); \ + const ctype * sub_data = (const ctype *)ecl_kw_get_data_ref( sub_kw ); \ int i; \ for (i=0; i < target_kw->size; i++) \ target_data[i] -= sub_data[i]; \ @@ -2298,8 +2298,8 @@ static void ecl_kw_inplace_sub_indexed_ ## ctype( ecl_kw_type * target_kw , cons if (!ecl_kw_assert_binary_ ## ctype( target_kw , sub_kw )) \ util_abort("%s: type/size mismatch\n",__func__); \ { \ - ctype * target_data = ecl_kw_get_data_ref( target_kw ); \ - const ctype * sub_data = ecl_kw_get_data_ref( sub_kw ); \ + ctype * target_data = (ctype *)ecl_kw_get_data_ref( target_kw ); \ + const ctype * sub_data = (const ctype *)ecl_kw_get_data_ref( sub_kw ); \ int set_size = int_vector_size( index_set ); \ const int * index_data = int_vector_get_const_ptr( index_set ); \ int i; \ @@ -2338,7 +2338,7 @@ void ecl_kw_inplace_sub_indexed( ecl_kw_type * target_kw , const int_vector_type #define ECL_KW_TYPED_INPLACE_ABS( ctype , abs_func) \ void ecl_kw_inplace_abs_ ## ctype( ecl_kw_type * kw ) { \ - ctype * data = ecl_kw_get_data_ref( kw ); \ + ctype * data = (ctype *)ecl_kw_get_data_ref( kw ); \ int i; \ for (i=0; i < kw->size; i++) \ data[i] = abs_func(data[i]); \ @@ -2376,7 +2376,7 @@ static int sqrti(int x) { #define ECL_KW_TYPED_INPLACE_SQRT( ctype, sqrt_func ) \ void ecl_kw_inplace_sqrt_ ## ctype( ecl_kw_type * kw ) { \ - ctype * data = ecl_kw_get_data_ref( kw ); \ + ctype * data = (ctype *)ecl_kw_get_data_ref( kw ); \ int i; \ for (i=0; i < kw->size; i++) \ data[i] = sqrt_func(data[i]); \ @@ -2415,8 +2415,8 @@ void ecl_kw_inplace_mul_ ## ctype( ecl_kw_type * target_kw , const ecl_kw_type * if (!ecl_kw_assert_binary_ ## ctype( target_kw , mul_kw )) \ util_abort("%s: type/size mismatch\n",__func__); \ { \ - ctype * target_data = ecl_kw_get_data_ref( target_kw ); \ - const ctype * mul_data = ecl_kw_get_data_ref( mul_kw ); \ + ctype * target_data = (ctype *)ecl_kw_get_data_ref( target_kw ); \ + const ctype * mul_data = (const ctype *)ecl_kw_get_data_ref( mul_kw ); \ int i; \ for (i=0; i < target_kw->size; i++) \ target_data[i] *= mul_data[i]; \ @@ -2449,8 +2449,8 @@ static void ecl_kw_inplace_mul_indexed_ ## ctype( ecl_kw_type * target_kw , cons if (!ecl_kw_assert_binary_ ## ctype( target_kw , mul_kw )) \ util_abort("%s: type/size mismatch\n",__func__); \ { \ - ctype * target_data = ecl_kw_get_data_ref( target_kw ); \ - const ctype * mul_data = ecl_kw_get_data_ref( mul_kw ); \ + ctype * target_data = (ctype *)ecl_kw_get_data_ref( target_kw ); \ + const ctype * mul_data = (const ctype *)ecl_kw_get_data_ref( mul_kw ); \ int set_size = int_vector_size( index_set ); \ const int * index_data = int_vector_get_const_ptr( index_set ); \ int i; \ @@ -2493,8 +2493,8 @@ void ecl_kw_inplace_div_ ## ctype( ecl_kw_type * target_kw , const ecl_kw_type * if (!ecl_kw_assert_binary_ ## ctype( target_kw , div_kw )) \ util_abort("%s: type/size mismatch\n",__func__); \ { \ - ctype * target_data = ecl_kw_get_data_ref( target_kw ); \ - const ctype * div_data = ecl_kw_get_data_ref( div_kw ); \ + ctype * target_data = (ctype *)ecl_kw_get_data_ref( target_kw ); \ + const ctype * div_data = (const ctype *)ecl_kw_get_data_ref( div_kw ); \ int i; \ for (i=0; i < target_kw->size; i++) \ target_data[i] /= div_data[i]; \ @@ -2528,8 +2528,8 @@ static void ecl_kw_inplace_div_indexed_ ## ctype( ecl_kw_type * target_kw , cons if (!ecl_kw_assert_binary_ ## ctype( target_kw , div_kw )) \ util_abort("%s: type/size mismatch\n",__func__); \ { \ - ctype * target_data = ecl_kw_get_data_ref( target_kw ); \ - const ctype * div_data = ecl_kw_get_data_ref( div_kw ); \ + ctype * target_data = (ctype *)ecl_kw_get_data_ref( target_kw ); \ + const ctype * div_data = (const ctype *)ecl_kw_get_data_ref( div_kw ); \ int set_size = int_vector_size( index_set ); \ const int * index_data = int_vector_get_const_ptr( index_set ); \ int i; \ @@ -2574,8 +2574,8 @@ bool ecl_kw_inplace_safe_div(ecl_kw_type * target_kw, const ecl_kw_type * diviso if (ecl_kw_get_type(divisor) != ECL_INT_TYPE) return false; - float * target_data = ecl_kw_get_data_ref( target_kw ); - const int* div_data = ecl_kw_get_data_ref( divisor ); + float * target_data = (float*)ecl_kw_get_data_ref( target_kw ); + const int* div_data = (const int*)ecl_kw_get_data_ref( divisor ); for (int i=0; i < target_kw->size; i++) { if (div_data[i] != 0) target_data[i] /= div_data[i]; @@ -2677,7 +2677,7 @@ bool ecl_kw_is_kw_file(fortio_type * fortio) { #define KW_MAX_MIN(type) \ { \ - type * data = ecl_kw_get_data_ref(ecl_kw); \ + type * data = (type*)ecl_kw_get_data_ref(ecl_kw); \ type max = data[0]; \ type min = data[0]; \ int i; \ @@ -2745,7 +2745,7 @@ ECL_KW_MIN( double ) #define KW_SUM_INDEXED(type) \ { \ - const type * data = ecl_kw_get_data_ref(ecl_kw); \ + const type * data = (const type *)ecl_kw_get_data_ref(ecl_kw); \ type sum = 0; \ int size = int_vector_size( index_list ); \ const int * index_ptr = int_vector_get_const_ptr( index_list ); \ @@ -2768,7 +2768,7 @@ void ecl_kw_element_sum_indexed(const ecl_kw_type * ecl_kw , const int_vector_ty break; case(ECL_BOOL_TYPE): { - const bool * data = ecl_kw_get_data_ref(ecl_kw); + const bool * data = (const bool *)ecl_kw_get_data_ref(ecl_kw); const int * index_ptr = int_vector_get_const_ptr( index_list ); const int size = int_vector_size( index_list ); int sum = 0; @@ -2793,7 +2793,7 @@ void ecl_kw_element_sum_indexed(const ecl_kw_type * ecl_kw , const int_vector_ty #define KW_SUM(type) \ { \ - const type * data = ecl_kw_get_data_ref(ecl_kw); \ + const type * data = (const type *)ecl_kw_get_data_ref(ecl_kw); \ type sum = 0; \ for (int i=0; i < ecl_kw_get_size(ecl_kw); i++) \ sum += data[i]; \ @@ -2937,4 +2937,4 @@ int ecl_kw_first_different( const ecl_kw_type * ecl_kw1 , const ecl_kw_type * ec } } -#include "ecl_kw_functions.c" +#include "ecl_kw_functions.cpp" diff --git a/lib/ecl/ecl_kw_functions.c b/lib/ecl/ecl_kw_functions.cpp similarity index 98% rename from lib/ecl/ecl_kw_functions.c rename to lib/ecl/ecl_kw_functions.cpp index edc577d0cc..d10646fd33 100644 --- a/lib/ecl/ecl_kw_functions.c +++ b/lib/ecl/ecl_kw_functions.cpp @@ -23,7 +23,7 @@ void ecl_kw_fix_uninitialized(ecl_kw_type * ecl_kw , int nx , int ny , int nz, const int * actnum) { int i,j,k; - int * data = ecl_kw_get_ptr( ecl_kw ); + int * data = (int*)ecl_kw_get_ptr( ecl_kw ); int_vector_type * undetermined1 = int_vector_alloc(0,0); int_vector_type * undetermined2 = int_vector_alloc(0,0); diff --git a/lib/ecl/ecl_kw_grdecl.c b/lib/ecl/ecl_kw_grdecl.cpp similarity index 98% rename from lib/ecl/ecl_kw_grdecl.c rename to lib/ecl/ecl_kw_grdecl.cpp index f71b75ad6c..db07ffe84e 100644 --- a/lib/ecl/ecl_kw_grdecl.c +++ b/lib/ecl/ecl_kw_grdecl.cpp @@ -260,8 +260,8 @@ static char * fscanf_alloc_grdecl_data( const char * header , bool strict , ecl_ int data_index = 0; int sizeof_ctype = ecl_type_get_sizeof_ctype( data_type ); int data_size = init_size; - char * buffer = util_calloc( (buffer_size + 1) , sizeof * buffer ); - char * data = util_calloc( sizeof_ctype * data_size , sizeof * data ); + char * buffer = (char*)util_calloc( (buffer_size + 1) , sizeof * buffer ); + char * data = (char*)util_calloc( sizeof_ctype * data_size , sizeof * data ); while (true) { if (fscanf(stream , "%32s" , buffer) == 1) { @@ -347,7 +347,7 @@ static char * fscanf_alloc_grdecl_data( const char * header , bool strict , ecl_ data_size = util_size_t_min( ECL_KW_MAX_SIZE , 2*(data_index + multiplier)); byte_size *= data_size; - data = util_realloc( data , byte_size ); + data = (char*)util_realloc( data , byte_size ); } else { /* We are asking for more elements than can possible be adressed in @@ -371,7 +371,7 @@ static char * fscanf_alloc_grdecl_data( const char * header , bool strict , ecl_ } free( buffer ); *kw_size = data_index; - data = util_realloc( data , sizeof_ctype * data_index * sizeof * data ); + data = (char*)util_realloc( data , sizeof_ctype * data_index * sizeof * data ); return data; } diff --git a/lib/ecl/ecl_nnc_data.c b/lib/ecl/ecl_nnc_data.cpp similarity index 98% rename from lib/ecl/ecl_nnc_data.c rename to lib/ecl/ecl_nnc_data.cpp index c96f9c202c..3235177c7e 100644 --- a/lib/ecl/ecl_nnc_data.c +++ b/lib/ecl/ecl_nnc_data.cpp @@ -211,12 +211,12 @@ static bool ecl_nnc_data_set_values(ecl_nnc_data_type * data, const ecl_grid_typ } static ecl_nnc_data_type * ecl_nnc_data_alloc__(const ecl_grid_type * grid, const ecl_nnc_geometry_type * nnc_geo, const ecl_file_view_type * init_file, int kw_type) { - ecl_nnc_data_type * data = util_malloc(sizeof * data); + ecl_nnc_data_type * data = (ecl_nnc_data_type*)util_malloc(sizeof * data); int nnc_size = ecl_nnc_geometry_size( nnc_geo ); data->size = nnc_size; - data->values = util_malloc( nnc_size * sizeof(double)); + data->values = (double*)util_malloc( nnc_size * sizeof(double)); if (ecl_nnc_data_set_values(data, grid, nnc_geo, init_file, kw_type)) return data; diff --git a/lib/ecl/ecl_nnc_export.c b/lib/ecl/ecl_nnc_export.cpp similarity index 98% rename from lib/ecl/ecl_nnc_export.c rename to lib/ecl/ecl_nnc_export.cpp index ec549de43d..dbe25a15a9 100644 --- a/lib/ecl/ecl_nnc_export.c +++ b/lib/ecl/ecl_nnc_export.cpp @@ -147,7 +147,7 @@ bool ecl_nnc_equal( const ecl_nnc_type * nnc1 , const ecl_nnc_type * nnc2) { static int ecl_nnc_sort_cmp__( const void * nnc1 , const void * nnc2) { - return ecl_nnc_sort_cmp( nnc1 , nnc2 ); + return ecl_nnc_sort_cmp( (const ecl_nnc_type*)nnc1 , (const ecl_nnc_type*)nnc2 ); } diff --git a/lib/ecl/ecl_nnc_geometry.c b/lib/ecl/ecl_nnc_geometry.cpp similarity index 89% rename from lib/ecl/ecl_nnc_geometry.c rename to lib/ecl/ecl_nnc_geometry.cpp index 064862c16a..d55954a27e 100644 --- a/lib/ecl/ecl_nnc_geometry.c +++ b/lib/ecl/ecl_nnc_geometry.cpp @@ -65,12 +65,12 @@ static void ecl_nnc_geometry_add_pairs( const ecl_nnc_geometry_type * nnc_geo , int lgr_nr2 = nnc_vector_get_lgr_nr( nnc_vector ); for (int index2 = 0; index2 < nnc_vector_get_size( nnc_vector ); index2++) { - ecl_nnc_pair_type pair = {.grid_nr1 = lgr_nr1, - .global_index1 = global_index1, - .grid_nr2 = lgr_nr2, - .global_index2 = int_vector_iget( grid2_index_list , index2 ), - .input_index = int_vector_iget( nnc_index_list, index2 )}; - + ecl_nnc_pair_type pair; + pair.grid_nr1 = lgr_nr1; + pair.global_index1 = global_index1; + pair.grid_nr2 = lgr_nr2; + pair.global_index2 = int_vector_iget( grid2_index_list , index2 ); + pair.input_index = int_vector_iget( nnc_index_list, index2 ); struct_vector_append( nnc_geo->data , &pair); } } @@ -100,7 +100,7 @@ static int ecl_nnc_cmp(const void * _nnc1 , const void * _nnc2) { ecl_nnc_geometry_type * ecl_nnc_geometry_alloc( const ecl_grid_type * grid ) { - ecl_nnc_geometry_type * nnc_geo = util_malloc( sizeof * nnc_geo ); + ecl_nnc_geometry_type * nnc_geo = (ecl_nnc_geometry_type*)util_malloc( sizeof * nnc_geo ); UTIL_TYPE_ID_INIT( nnc_geo , ECL_NNC_GEOMETRY_TYPE_ID ); nnc_geo->data = struct_vector_alloc( sizeof( struct ecl_nnc_pair_struct )); @@ -121,7 +121,7 @@ void ecl_nnc_geometry_free( ecl_nnc_geometry_type * nnc_geo) { const ecl_nnc_pair_type * ecl_nnc_geometry_iget( const ecl_nnc_geometry_type * nnc_geo , int index) { - return struct_vector_iget_ptr( nnc_geo->data , index ); + return (const ecl_nnc_pair_type*)struct_vector_iget_ptr( nnc_geo->data , index ); } diff --git a/lib/ecl/ecl_region.c b/lib/ecl/ecl_region.cpp similarity index 99% rename from lib/ecl/ecl_region.c rename to lib/ecl/ecl_region.cpp index 08410ddfc4..8a2276d050 100644 --- a/lib/ecl/ecl_region.c +++ b/lib/ecl/ecl_region.cpp @@ -137,12 +137,12 @@ void ecl_region_unlock( ecl_region_type * region ){ ecl_region_type * ecl_region_alloc( const ecl_grid_type * ecl_grid , bool preselect) { - ecl_region_type * region = util_malloc( sizeof * region ); + ecl_region_type * region = (ecl_region_type*)util_malloc( sizeof * region ); UTIL_TYPE_ID_INIT( region , ECL_REGION_TYPE_ID); region->parent_grid = ecl_grid; ecl_grid_get_dims( ecl_grid , ®ion->grid_nx , ®ion->grid_ny , ®ion->grid_nz , ®ion->grid_active); region->grid_vol = region->grid_nx * region->grid_ny * region->grid_nz; - region->active_mask = util_calloc(region->grid_vol , sizeof * region->active_mask ); + region->active_mask = (bool*)util_calloc(region->grid_vol , sizeof * region->active_mask ); region->active_index_list = int_vector_alloc(0 , 0); region->global_index_list = int_vector_alloc(0 , 0); region->global_active_list = int_vector_alloc(0 , 0); diff --git a/lib/ecl/ecl_rft_cell.c b/lib/ecl/ecl_rft_cell.cpp similarity index 96% rename from lib/ecl/ecl_rft_cell.c rename to lib/ecl/ecl_rft_cell.cpp index 0a2bced36e..41640ea9cd 100644 --- a/lib/ecl/ecl_rft_cell.c +++ b/lib/ecl/ecl_rft_cell.cpp @@ -78,7 +78,7 @@ struct plt_data_struct { /*****************************************************************/ static rft_data_type * rft_data_alloc( double swat , double sgas) { - rft_data_type * data = util_malloc( sizeof * data ); + rft_data_type * data = (rft_data_type*)util_malloc( sizeof * data ); UTIL_TYPE_ID_INIT( data , RFT_DATA_TYPE_ID ); data->swat = swat; @@ -98,7 +98,7 @@ static UTIL_IS_INSTANCE_FUNCTION( rft_data , RFT_DATA_TYPE_ID) /*****************************************************************/ static plt_data_type * plt_data_alloc( double orat , double grat , double wrat,double connection_start, double connection_end, double flowrate , double oil_flowrate , double gas_flowrate , double water_flowrate) { - plt_data_type * data = util_malloc( sizeof * data ); + plt_data_type * data = (plt_data_type*)util_malloc( sizeof * data ); UTIL_TYPE_ID_INIT( data , PLT_DATA_TYPE_ID ); data->orat = orat; @@ -133,7 +133,7 @@ UTIL_IS_INSTANCE_FUNCTION( ecl_rft_cell , ECL_RFT_CELL_TYPE_ID) static ecl_rft_cell_type * ecl_rft_cell_alloc_common(int i , int j , int k , double depth , double pressure) { - ecl_rft_cell_type * cell = util_malloc( sizeof * cell ); + ecl_rft_cell_type * cell = (ecl_rft_cell_type*)util_malloc( sizeof * cell ); UTIL_TYPE_ID_INIT( cell , ECL_RFT_CELL_TYPE_ID ); cell->i = i; @@ -180,9 +180,9 @@ ecl_rft_cell_type * ecl_rft_cell_alloc_PLT( int i , void ecl_rft_cell_free( ecl_rft_cell_type * cell ) { if (rft_data_is_instance( cell->data )) - rft_data_free( cell->data ); + rft_data_free( (rft_data_type*)cell->data ); else if (plt_data_is_instance( cell->data )) - plt_data_free( cell->data ); + plt_data_free( (plt_data_type*)cell->data ); free( cell ); } diff --git a/lib/ecl/ecl_rft_file.c b/lib/ecl/ecl_rft_file.cpp similarity index 94% rename from lib/ecl/ecl_rft_file.c rename to lib/ecl/ecl_rft_file.cpp index 17c381087a..ca89e3dcaf 100644 --- a/lib/ecl/ecl_rft_file.c +++ b/lib/ecl/ecl_rft_file.cpp @@ -63,7 +63,7 @@ struct ecl_rft_file_struct { static ecl_rft_file_type * ecl_rft_file_alloc_empty(const char * filename) { - ecl_rft_file_type * rft_vector = util_malloc(sizeof * rft_vector ); + ecl_rft_file_type * rft_vector = (ecl_rft_file_type*)util_malloc(sizeof * rft_vector ); UTIL_TYPE_ID_INIT( rft_vector , ECL_RFT_FILE_ID ); rft_vector->data = vector_alloc_new(); rft_vector->filename = util_alloc_string_copy(filename); @@ -106,7 +106,7 @@ ecl_rft_file_type * ecl_rft_file_alloc(const char * filename) { if (!hash_has_key( rft_vector->well_index , well_name)) hash_insert_hash_owned_ref( rft_vector->well_index , well_name , int_vector_alloc( 0 , 0 ) , int_vector_free__); { - int_vector_type * index_list = hash_get( rft_vector->well_index , well_name ); + int_vector_type * index_list = (int_vector_type*)hash_get( rft_vector->well_index , well_name ); int_vector_append(index_list , global_index); } global_index++; @@ -228,7 +228,7 @@ int ecl_rft_file_get_size__( const ecl_rft_file_type * rft_file, const char * we int match_count = 0; int i; for ( i=0; i < vector_get_size( rft_file->data ); i++) { - const ecl_rft_node_type * rft = vector_iget_const( rft_file->data , i); + const ecl_rft_node_type * rft = (const ecl_rft_node_type*)vector_iget_const( rft_file->data , i); if (well_pattern) { if (util_fnmatch( well_pattern , ecl_rft_node_get_well_name( rft )) != 0) @@ -274,7 +274,7 @@ const char * ecl_rft_file_get_filename( const ecl_rft_file_type * rft_file ) { */ ecl_rft_node_type * ecl_rft_file_iget_node( const ecl_rft_file_type * rft_file , int index) { - return vector_iget( rft_file->data , index ); + return (ecl_rft_node_type*)vector_iget( rft_file->data , index ); } @@ -306,7 +306,7 @@ ecl_rft_node_type * ecl_rft_file_iget_node( const ecl_rft_file_type * rft_file , ecl_rft_node_type * ecl_rft_file_iget_well_rft( const ecl_rft_file_type * rft_file , const char * well, int index) { - const int_vector_type * index_vector = hash_get(rft_file->well_index , well); + const int_vector_type * index_vector = (const int_vector_type*)hash_get(rft_file->well_index , well); return ecl_rft_file_iget_node( rft_file , int_vector_iget(index_vector , index)); } @@ -314,7 +314,7 @@ ecl_rft_node_type * ecl_rft_file_iget_well_rft( const ecl_rft_file_type * rft_fi static int ecl_rft_file_get_node_index_time_rft( const ecl_rft_file_type * rft_file , const char * well , time_t recording_time) { int global_index = -1; if (hash_has_key( rft_file->well_index , well)) { - const int_vector_type * index_vector = hash_get(rft_file->well_index , well); + const int_vector_type * index_vector = (const int_vector_type*)hash_get(rft_file->well_index , well); int well_index = 0; while (true) { if (well_index == int_vector_size( index_vector )) @@ -364,7 +364,7 @@ bool ecl_rft_file_has_well( const ecl_rft_file_type * rft_file , const char * we */ int ecl_rft_file_get_well_occurences( const ecl_rft_file_type * rft_file , const char * well) { - const int_vector_type * index_vector = hash_get(rft_file->well_index , well); + const int_vector_type * index_vector = (const int_vector_type*)hash_get(rft_file->well_index , well); return int_vector_size( index_vector ); } @@ -423,7 +423,7 @@ void ecl_rft_file_update(const char * rft_file_name, ecl_rft_node_type ** nodes, vector_sort(rft_file->data,(vector_cmp_ftype *) ecl_rft_node_cmp); for(node_index=0; node_index < vector_get_size( rft_file->data ); node_index++) { - const ecl_rft_node_type *new_node = vector_iget_const(rft_file->data, node_index); + const ecl_rft_node_type *new_node = (const ecl_rft_node_type*)vector_iget_const(rft_file->data, node_index); ecl_rft_node_fwrite(new_node, fortio, unit_set); } diff --git a/lib/ecl/ecl_rft_node.c b/lib/ecl/ecl_rft_node.cpp similarity index 94% rename from lib/ecl/ecl_rft_node.c rename to lib/ecl/ecl_rft_node.cpp index dc19a5ea30..d158ab8252 100644 --- a/lib/ecl/ecl_rft_node.c +++ b/lib/ecl/ecl_rft_node.cpp @@ -106,7 +106,7 @@ static ecl_rft_enum translate_from_sting_to_ecl_rft_enum(const char * data_type_ ecl_rft_node_type * ecl_rft_node_alloc_new(const char * well_name, const char * data_type_string, const time_t recording_date, const double days){ ecl_rft_enum data_type = translate_from_sting_to_ecl_rft_enum(data_type_string); - ecl_rft_node_type * rft_node = util_malloc(sizeof * rft_node ); + ecl_rft_node_type * rft_node = (ecl_rft_node_type*)util_malloc(sizeof * rft_node ); UTIL_TYPE_ID_INIT( rft_node , ECL_RFT_NODE_ID ); rft_node->well_name = util_alloc_string_copy(well_name); rft_node->cells = vector_alloc_new(); @@ -130,7 +130,7 @@ static ecl_rft_node_type * ecl_rft_node_alloc_empty(const char * data_type_strin } { - ecl_rft_node_type * rft_node = util_malloc(sizeof * rft_node ); + ecl_rft_node_type * rft_node = (ecl_rft_node_type*)util_malloc(sizeof * rft_node ); UTIL_TYPE_ID_INIT( rft_node , ECL_RFT_NODE_ID ); rft_node->cells = vector_alloc_new(); @@ -269,11 +269,11 @@ static void ecl_rft_node_init_cells( ecl_rft_node_type * rft_node , const ecl_fi ecl_rft_node_type * ecl_rft_node_alloc(const ecl_file_view_type * rft_view) { ecl_kw_type * welletc = ecl_file_view_iget_named_kw(rft_view , WELLETC_KW , 0); - ecl_rft_node_type * rft_node = ecl_rft_node_alloc_empty(ecl_kw_iget_ptr(welletc , WELLETC_TYPE_INDEX)); + ecl_rft_node_type * rft_node = ecl_rft_node_alloc_empty((const char*)ecl_kw_iget_ptr(welletc , WELLETC_TYPE_INDEX)); if (rft_node != NULL) { ecl_kw_type * date_kw = ecl_file_view_iget_named_kw( rft_view , DATE_KW , 0); - rft_node->well_name = util_alloc_strip_copy( ecl_kw_iget_ptr(welletc , WELLETC_NAME_INDEX)); + rft_node->well_name = (char*)util_alloc_strip_copy( (const char*)ecl_kw_iget_ptr(welletc , WELLETC_NAME_INDEX)); /* Time information. */ { @@ -325,7 +325,7 @@ ecl_rft_enum ecl_rft_node_get_type(const ecl_rft_node_type * rft_node) { return /* various functions to access properties at the cell level */ const ecl_rft_cell_type * ecl_rft_node_iget_cell( const ecl_rft_node_type * rft_node , int index) { - return vector_iget_const( rft_node->cells , index ); + return (const ecl_rft_cell_type*)vector_iget_const( rft_node->cells , index ); } @@ -349,7 +349,7 @@ const ecl_rft_cell_type * ecl_rft_node_iget_cell_sorted( ecl_rft_node_type * rft if (!rft_node->sort_perm_in_sync) ecl_rft_node_create_sort_perm( rft_node ); - return vector_iget_const( rft_node->cells , int_vector_iget( rft_node->sort_perm , index )); + return (const ecl_rft_cell_type*)vector_iget_const( rft_node->cells , int_vector_iget( rft_node->sort_perm , index )); } } @@ -403,7 +403,7 @@ static void assert_type_and_index( const ecl_rft_node_type * rft_node , ecl_rft_ double ecl_rft_node_iget_sgas( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , RFT , index ); { - const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index ); + const ecl_rft_cell_type * cell = (const ecl_rft_cell_type*)vector_iget_const( rft_node->cells , index ); return ecl_rft_cell_get_sgas( cell ); } } @@ -412,7 +412,7 @@ double ecl_rft_node_iget_sgas( const ecl_rft_node_type * rft_node , int index) { double ecl_rft_node_iget_swat( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , RFT , index ); { - const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index ); + const ecl_rft_cell_type * cell = (const ecl_rft_cell_type*)vector_iget_const( rft_node->cells , index ); return ecl_rft_cell_get_swat( cell ); } } @@ -424,7 +424,7 @@ double ecl_rft_node_get_days(const ecl_rft_node_type * rft_node ){ double ecl_rft_node_iget_soil( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , RFT , index ); { - const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index ); + const ecl_rft_cell_type * cell = (const ecl_rft_cell_type*)vector_iget_const( rft_node->cells , index ); return ecl_rft_cell_get_soil( cell ); } } @@ -435,7 +435,7 @@ double ecl_rft_node_iget_soil( const ecl_rft_node_type * rft_node , int index) { double ecl_rft_node_iget_orat( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , PLT , index ); { - const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index ); + const ecl_rft_cell_type * cell = (const ecl_rft_cell_type*)vector_iget_const( rft_node->cells , index ); return ecl_rft_cell_get_orat( cell ); } } @@ -444,7 +444,7 @@ double ecl_rft_node_iget_orat( const ecl_rft_node_type * rft_node , int index) { double ecl_rft_node_iget_wrat( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , PLT , index ); { - const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index); + const ecl_rft_cell_type * cell = (const ecl_rft_cell_type*)vector_iget_const( rft_node->cells , index); return ecl_rft_cell_get_wrat( cell ); } } @@ -453,7 +453,7 @@ double ecl_rft_node_iget_wrat( const ecl_rft_node_type * rft_node , int index) { double ecl_rft_node_iget_grat( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , PLT , index ); { - const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index); + const ecl_rft_cell_type * cell = (const ecl_rft_cell_type*)vector_iget_const( rft_node->cells , index); return ecl_rft_cell_get_grat( cell ); } } @@ -594,7 +594,7 @@ void ecl_rft_node_fwrite(const ecl_rft_node_type * rft_node, fortio_type * forti int i; for(i =0;icells , i); + const ecl_rft_cell_type * cell = (const ecl_rft_cell_type*)vector_iget_const( rft_node->cells , i); ecl_kw_iset_int(conipos, i, ecl_rft_cell_get_i(cell)+1); ecl_kw_iset_int(conjpos, i, ecl_rft_cell_get_j(cell)+1); ecl_kw_iset_int(conkpos, i, ecl_rft_cell_get_k(cell)+1); diff --git a/lib/ecl/ecl_rst_file.c b/lib/ecl/ecl_rst_file.cpp similarity index 99% rename from lib/ecl/ecl_rst_file.c rename to lib/ecl/ecl_rst_file.cpp index 2bc6fd70cd..3a1fd0ff33 100644 --- a/lib/ecl/ecl_rst_file.c +++ b/lib/ecl/ecl_rst_file.cpp @@ -50,7 +50,7 @@ struct ecl_rst_file_struct { static ecl_rst_file_type * ecl_rst_file_alloc( const char * filename ) { bool unified = ecl_util_unified_file( filename ); bool fmt_file; - ecl_rst_file_type * rst_file = util_malloc( sizeof * rst_file ); + ecl_rst_file_type * rst_file = (ecl_rst_file_type*)util_malloc( sizeof * rst_file ); if (ecl_util_fmt_file( filename , &fmt_file)) { rst_file->unified = unified; diff --git a/lib/ecl/ecl_rsthead.c b/lib/ecl/ecl_rsthead.cpp similarity index 98% rename from lib/ecl/ecl_rsthead.c rename to lib/ecl/ecl_rsthead.cpp index e8d9cef33a..eb808c891e 100644 --- a/lib/ecl/ecl_rsthead.c +++ b/lib/ecl/ecl_rsthead.cpp @@ -55,7 +55,7 @@ int ecl_rsthead_get_report_step( const ecl_rsthead_type * header ) { ecl_rsthead_type * ecl_rsthead_alloc_from_kw( int report_step , const ecl_kw_type * intehead_kw , const ecl_kw_type * doubhead_kw , const ecl_kw_type * logihead_kw ) { - ecl_rsthead_type * rsthead = util_malloc( sizeof * rsthead ); + ecl_rsthead_type * rsthead = (ecl_rsthead_type*)util_malloc( sizeof * rsthead ); rsthead->report_step = report_step; { const int * data = (const int *) ecl_kw_get_void_ptr( intehead_kw ); @@ -129,7 +129,7 @@ ecl_rsthead_type * ecl_rsthead_alloc( const ecl_file_view_type * rst_view, int r ecl_rsthead_type * ecl_rsthead_alloc_empty() { - ecl_rsthead_type * rsthead = util_malloc( sizeof * rsthead ); + ecl_rsthead_type * rsthead = (ecl_rsthead_type*)util_malloc( sizeof * rsthead ); rsthead->day = 0; rsthead->month = 0; diff --git a/lib/ecl/ecl_smspec.c b/lib/ecl/ecl_smspec.cpp similarity index 94% rename from lib/ecl/ecl_smspec.c rename to lib/ecl/ecl_smspec.cpp index ebdd880dee..19862da0f5 100644 --- a/lib/ecl/ecl_smspec.c +++ b/lib/ecl/ecl_smspec.cpp @@ -251,7 +251,7 @@ static const char* smspec_required_keywords[] = { ecl_smspec_type * ecl_smspec_alloc_empty(bool write_mode , const char * key_join_string) { ecl_smspec_type *ecl_smspec; - ecl_smspec = util_malloc(sizeof *ecl_smspec ); + ecl_smspec = (ecl_smspec_type*)util_malloc(sizeof *ecl_smspec ); UTIL_TYPE_ID_INIT(ecl_smspec , ECL_SMSPEC_ID); ecl_smspec->well_var_index = hash_alloc(); @@ -295,7 +295,7 @@ ecl_smspec_type * ecl_smspec_alloc_empty(bool write_mode , const char * key_join int * ecl_smspec_alloc_mapping( const ecl_smspec_type * self, const ecl_smspec_type * other) { int params_size = ecl_smspec_get_params_size( self ); - int * mapping = util_malloc( params_size * sizeof * mapping ); + int * mapping = (int*)util_malloc( params_size * sizeof * mapping ); for (int i = 0; i < params_size; i++) mapping[i] = -1; @@ -326,7 +326,7 @@ int * ecl_smspec_alloc_mapping( const ecl_smspec_type * self, const ecl_smspec_t const smspec_node_type * ecl_smspec_iget_node( const ecl_smspec_type * smspec , int index ) { - return vector_iget_const( smspec->smspec_nodes , index ); + return (const smspec_node_type*)vector_iget_const( smspec->smspec_nodes , index ); } int ecl_smspec_num_nodes( const ecl_smspec_type * smspec) { @@ -844,13 +844,13 @@ static void ecl_smspec_install_special_keys( ecl_smspec_type * ecl_smspec , smsp if (!hash_has_key(ecl_smspec->well_completion_var_index , well)) hash_insert_hash_owned_ref(ecl_smspec->well_completion_var_index , well , hash_alloc() , hash_free__); { - hash_type * cell_hash = hash_get(ecl_smspec->well_completion_var_index , well); + hash_type * cell_hash = (hash_type*)hash_get(ecl_smspec->well_completion_var_index , well); char cell_str[16]; sprintf(cell_str , "%d" , num); if (!hash_has_key(cell_hash , cell_str)) hash_insert_hash_owned_ref(cell_hash , cell_str , hash_alloc() , hash_free__); { - hash_type * var_hash = hash_get(cell_hash , cell_str); + hash_type * var_hash = (hash_type*)hash_get(cell_hash , cell_str); hash_insert_ref(var_hash , keyword , smspec_node ); } } @@ -865,7 +865,7 @@ static void ecl_smspec_install_special_keys( ecl_smspec_type * ecl_smspec , smsp if (!hash_has_key(ecl_smspec->group_var_index , group)) hash_insert_hash_owned_ref(ecl_smspec->group_var_index , group, hash_alloc() , hash_free__); { - hash_type * var_hash = hash_get(ecl_smspec->group_var_index , group); + hash_type * var_hash = (hash_type*)hash_get(ecl_smspec->group_var_index , group); hash_insert_ref(var_hash , keyword , smspec_node ); } break; @@ -873,7 +873,7 @@ static void ecl_smspec_install_special_keys( ecl_smspec_type * ecl_smspec , smsp if (!hash_has_key(ecl_smspec->region_var_index , keyword)) hash_insert_hash_owned_ref( ecl_smspec->region_var_index , keyword , hash_alloc() , hash_free__); { - hash_type * var_hash = hash_get(ecl_smspec->region_var_index , keyword); + hash_type * var_hash = (hash_type*)hash_get(ecl_smspec->region_var_index , keyword); char num_str[16]; sprintf( num_str , "%d" , num); hash_insert_ref(var_hash , num_str , smspec_node); @@ -884,7 +884,7 @@ static void ecl_smspec_install_special_keys( ecl_smspec_type * ecl_smspec , smsp if (!hash_has_key(ecl_smspec->well_var_index , well)) hash_insert_hash_owned_ref(ecl_smspec->well_var_index , well , hash_alloc() , hash_free__); { - hash_type * var_hash = hash_get(ecl_smspec->well_var_index , well); + hash_type * var_hash = (hash_type*)hash_get(ecl_smspec->well_var_index , well); hash_insert_ref(var_hash , keyword , smspec_node ); } break; @@ -897,7 +897,7 @@ static void ecl_smspec_install_special_keys( ecl_smspec_type * ecl_smspec , smsp if (!hash_has_key(ecl_smspec->block_var_index , keyword)) hash_insert_hash_owned_ref(ecl_smspec->block_var_index , keyword , hash_alloc() , hash_free__); { - hash_type * block_hash = hash_get(ecl_smspec->block_var_index , keyword); + hash_type * block_hash = (hash_type*)hash_get(ecl_smspec->block_var_index , keyword); char block_nr[16]; sprintf( block_nr , "%d" , num ); hash_insert_ref(block_hash , block_nr , smspec_node); @@ -1018,8 +1018,8 @@ bool ecl_smspec_equal(const ecl_smspec_type * self, return false; for (int i=0; i < vector_get_size( self->smspec_nodes ); i++) { - const smspec_node_type * node1 = vector_iget_const(self->smspec_nodes, i); - const smspec_node_type * node2 = vector_iget_const(other->smspec_nodes, i); + const smspec_node_type * node1 = (const smspec_node_type*)vector_iget_const(self->smspec_nodes, i); + const smspec_node_type * node2 = (const smspec_node_type*)vector_iget_const(other->smspec_nodes, i); if (!smspec_node_equal(node1, node2)) return false; @@ -1039,7 +1039,7 @@ static void ecl_smspec_load_restart( ecl_smspec_type * ecl_smspec , const ecl_fi int i; tmp_base[0] = '\0'; for (i=0; i < ecl_kw_get_size( restart_kw ); i++) - strcat( tmp_base , ecl_kw_iget_ptr( restart_kw , i )); + strcat( tmp_base , (const char*)ecl_kw_iget_ptr( restart_kw , i )); restart_base = util_alloc_strip_copy( tmp_base ); if (strlen(restart_base)) { /* We ignore the empty ones. */ @@ -1204,7 +1204,7 @@ static bool ecl_smspec_fread_header(ecl_smspec_type * ecl_smspec, const char * h if (ecl_file_has_kw(header, INTEHEAD_KW)) { const ecl_kw_type * intehead = ecl_file_iget_named_kw(header, INTEHEAD_KW, 0); - ecl_smspec->unit_system = ecl_kw_iget_int(intehead, INTEHEAD_SMSPEC_UNIT_INDEX); + ecl_smspec->unit_system = (ert_ecl_unit_enum)ecl_kw_iget_int(intehead, INTEHEAD_SMSPEC_UNIT_INDEX); /* The second item in the INTEHEAD vector is an integer designating which simulator has been used for the current simulation, that is currently @@ -1240,9 +1240,9 @@ static bool ecl_smspec_fread_header(ecl_smspec_type * ecl_smspec, const char * h for (params_index=0; params_index < ecl_kw_get_size(wells); params_index++) { float default_value = PARAMS_GLOBAL_DEFAULT; int num = SMSPEC_NUMS_INVALID; - char * well = util_alloc_strip_copy(ecl_kw_iget_ptr(wells , params_index)); - char * kw = util_alloc_strip_copy(ecl_kw_iget_ptr(keywords , params_index)); - char * unit = util_alloc_strip_copy(ecl_kw_iget_ptr(units , params_index)); + char * well = (char*)util_alloc_strip_copy((const char*)ecl_kw_iget_ptr(wells , params_index)); + char * kw = (char*)util_alloc_strip_copy((const char*)ecl_kw_iget_ptr(keywords , params_index)); + char * unit = (char*)util_alloc_strip_copy((const char*)ecl_kw_iget_ptr(units , params_index)); char * lgr_name = NULL; smspec_node_type * smspec_node; @@ -1252,7 +1252,7 @@ static bool ecl_smspec_fread_header(ecl_smspec_type * ecl_smspec, const char * h int lgr_i = ecl_kw_iget_int( numlx , params_index ); int lgr_j = ecl_kw_iget_int( numly , params_index ); int lgr_k = ecl_kw_iget_int( numlz , params_index ); - lgr_name = util_alloc_strip_copy( ecl_kw_iget_ptr( lgrs , params_index )); + lgr_name = (char*)util_alloc_strip_copy( (const char*)ecl_kw_iget_ptr( lgrs , params_index )); smspec_node = smspec_node_alloc_lgr( var_type , well , kw , unit , lgr_name , ecl_smspec->key_join_string , lgr_i , lgr_j , lgr_k , params_index, default_value); } else smspec_node = smspec_node_alloc( var_type , well , kw , unit , ecl_smspec->key_join_string , ecl_smspec->grid_dims , num , params_index , default_value); @@ -1293,7 +1293,7 @@ ecl_smspec_type * ecl_smspec_fread_alloc(const char *header_file, const char * k if (ecl_smspec_fread_header(ecl_smspec , header_file , include_restart)) { if (hash_has_key( ecl_smspec->misc_var_index , "TIME")) { - const smspec_node_type * time_node = hash_get(ecl_smspec->misc_var_index , "TIME"); + const smspec_node_type * time_node = (const smspec_node_type*)hash_get(ecl_smspec->misc_var_index , "TIME"); const char * time_unit = smspec_node_get_unit( time_node ); ecl_smspec->time_index = smspec_node_get_params_index( time_node ); @@ -1306,9 +1306,9 @@ ecl_smspec_type * ecl_smspec_fread_alloc(const char *header_file, const char * k } if (hash_has_key(ecl_smspec->misc_var_index , "DAY")) { - ecl_smspec->day_index = smspec_node_get_params_index( hash_get(ecl_smspec->misc_var_index , "DAY") ); - ecl_smspec->month_index = smspec_node_get_params_index( hash_get(ecl_smspec->misc_var_index , "MONTH") ); - ecl_smspec->year_index = smspec_node_get_params_index( hash_get(ecl_smspec->misc_var_index , "YEAR") ); + ecl_smspec->day_index = smspec_node_get_params_index( (const smspec_node_type*)hash_get(ecl_smspec->misc_var_index , "DAY") ); + ecl_smspec->month_index = smspec_node_get_params_index( (const smspec_node_type*)hash_get(ecl_smspec->misc_var_index , "MONTH") ); + ecl_smspec->year_index = smspec_node_get_params_index( (const smspec_node_type*)hash_get(ecl_smspec->misc_var_index , "YEAR") ); } if ((ecl_smspec->time_index == -1) && ( ecl_smspec->day_index == -1)) { @@ -1392,9 +1392,9 @@ int ecl_smspec_get_num_regions(const ecl_smspec_type * ecl_smspec) { const smspec_node_type * ecl_smspec_get_well_var_node( const ecl_smspec_type * smspec , const char * well , const char * var) { const smspec_node_type * node = NULL; if (hash_has_key( smspec->well_var_index , well)) { - hash_type * var_hash = hash_get(smspec->well_var_index , well); + hash_type * var_hash = (hash_type*)hash_get(smspec->well_var_index , well); if (hash_has_key(var_hash , var)) - node = hash_get(var_hash , var); + node = (const smspec_node_type*)hash_get(var_hash , var); } return node; } @@ -1419,9 +1419,9 @@ bool ecl_smspec_has_well_var(const ecl_smspec_type * ecl_smspec , const char * w const smspec_node_type * ecl_smspec_get_group_var_node( const ecl_smspec_type * smspec , const char * group , const char * var) { const smspec_node_type * node = NULL; if (hash_has_key(smspec->group_var_index , group)) { - hash_type * var_hash = hash_get(smspec->group_var_index , group); + hash_type * var_hash = (hash_type*)hash_get(smspec->group_var_index , group); if (hash_has_key(var_hash , var)) - node = hash_get(var_hash , var); + node = (const smspec_node_type*)hash_get(var_hash , var); } return node; } @@ -1445,7 +1445,7 @@ bool ecl_smspec_has_group_var(const ecl_smspec_type * ecl_smspec , const char * const smspec_node_type * ecl_smspec_get_field_var_node(const ecl_smspec_type * ecl_smspec , const char *var) { const smspec_node_type * node = NULL; if (hash_has_key(ecl_smspec->field_var_index , var)) - node = hash_get(ecl_smspec->field_var_index , var); + node = (const smspec_node_type*)hash_get(ecl_smspec->field_var_index , var); return node; } @@ -1479,9 +1479,9 @@ static const smspec_node_type * ecl_smspec_get_block_var_node_string(const ecl_s const smspec_node_type * node = NULL; if (hash_has_key(ecl_smspec->block_var_index , block_var)) { - hash_type * block_hash = hash_get(ecl_smspec->block_var_index , block_var); + hash_type * block_hash = (hash_type*)hash_get(ecl_smspec->block_var_index , block_var); if (hash_has_key(block_hash , block_str)) - node = hash_get(block_hash , block_str); + node = (const smspec_node_type*)hash_get(block_hash , block_str); } return node; @@ -1539,9 +1539,9 @@ const smspec_node_type * ecl_smspec_get_region_var_node(const ecl_smspec_type * if (hash_has_key(ecl_smspec->region_var_index , region_var)) { char * nr_str = util_alloc_sprintf( "%d" , region_nr ); - hash_type * nr_hash = hash_get(ecl_smspec->region_var_index , region_var); + hash_type * nr_hash = (hash_type*)hash_get(ecl_smspec->region_var_index , region_var); if (hash_has_key( nr_hash , nr_str)) - node = hash_get( nr_hash , nr_str ); + node = (const smspec_node_type*)hash_get( nr_hash , nr_str ); free( nr_str ); } @@ -1567,7 +1567,7 @@ const smspec_node_type * ecl_smspec_get_misc_var_node(const ecl_smspec_type * ec const smspec_node_type * node = NULL; if (hash_has_key(ecl_smspec->misc_var_index , var)) - node = hash_get(ecl_smspec->misc_var_index , var); + node = (const smspec_node_type*)hash_get(ecl_smspec->misc_var_index , var); return node; } @@ -1593,12 +1593,12 @@ const smspec_node_type * ecl_smspec_get_well_completion_var_node(const ecl_smspe char * cell_str = util_alloc_sprintf("%d" , cell_nr); if (hash_has_key(ecl_smspec->well_completion_var_index , well)) { - hash_type * cell_hash = hash_get(ecl_smspec->well_completion_var_index , well); + hash_type * cell_hash = (hash_type*)hash_get(ecl_smspec->well_completion_var_index , well); if (hash_has_key(cell_hash , cell_str)) { - hash_type * var_hash = hash_get(cell_hash , cell_str); + hash_type * var_hash = (hash_type*)hash_get(cell_hash , cell_str); if (hash_has_key(var_hash , var)) - node = hash_get( var_hash , var); + node = (const smspec_node_type*)hash_get( var_hash , var); } } free(cell_str); @@ -1630,7 +1630,7 @@ int ecl_smspec_get_well_completion_var_params_index(const ecl_smspec_type * ecl const smspec_node_type * ecl_smspec_get_general_var_node( const ecl_smspec_type * smspec , const char * lookup_kw ) { if (hash_has_key( smspec->gen_var_index , lookup_kw )) { - const smspec_node_type * smspec_node = hash_get( smspec->gen_var_index , lookup_kw ); + const smspec_node_type * smspec_node = (const smspec_node_type*)hash_get( smspec->gen_var_index , lookup_kw ); return smspec_node; } else return NULL; @@ -1651,7 +1651,7 @@ bool ecl_smspec_has_general_var(const ecl_smspec_type * ecl_smspec , const char /** DIES if the lookup_kw is not present. */ const char * ecl_smspec_get_general_var_unit( const ecl_smspec_type * ecl_smspec , const char * lookup_kw) { - const smspec_node_type * smspec_node = hash_get( ecl_smspec->gen_var_index , lookup_kw ); + const smspec_node_type * smspec_node = (const smspec_node_type*)hash_get( ecl_smspec->gen_var_index , lookup_kw ); return smspec_node_get_unit( smspec_node ); } @@ -1768,7 +1768,7 @@ int ecl_smspec_get_date_year_index( const ecl_smspec_type * smspec ) { bool ecl_smspec_general_is_total( const ecl_smspec_type * smspec , const char * gen_key) { - const smspec_node_type * smspec_node = hash_get( smspec->gen_var_index , gen_key ); + const smspec_node_type * smspec_node = (const smspec_node_type*)hash_get( smspec->gen_var_index , gen_key ); return smspec_node_is_total( smspec_node ); } @@ -1914,7 +1914,7 @@ stringlist_type * ecl_smspec_alloc_group_list( const ecl_smspec_type * smspec , stringlist_type * ecl_smspec_alloc_well_var_list( const ecl_smspec_type * smspec ) { hash_iter_type * well_iter = hash_iter_alloc( smspec->well_var_index ); - hash_type * var_hash = hash_iter_get_next_value( well_iter ); + hash_type * var_hash = (hash_type*)hash_iter_get_next_value( well_iter ); hash_iter_free( well_iter ); return hash_alloc_stringlist( var_hash ); } @@ -1949,7 +1949,7 @@ void ecl_smspec_sort( ecl_smspec_type * smspec ) { vector_sort( smspec->smspec_nodes , smspec_node_cmp__); for (int i=0; i < vector_get_size( smspec->smspec_nodes ); i++) { - smspec_node_type * node = vector_iget( smspec->smspec_nodes , i ); + smspec_node_type * node = (smspec_node_type*)vector_iget( smspec->smspec_nodes , i ); smspec_node_set_params_index( node , i ); } diff --git a/lib/ecl/ecl_subsidence.c b/lib/ecl/ecl_subsidence.cpp similarity index 94% rename from lib/ecl/ecl_subsidence.c rename to lib/ecl/ecl_subsidence.cpp index 4fe053f6f9..f0d48478eb 100644 --- a/lib/ecl/ecl_subsidence.c +++ b/lib/ecl/ecl_subsidence.cpp @@ -84,14 +84,14 @@ struct ecl_subsidence_survey_struct { static ecl_subsidence_survey_type * ecl_subsidence_survey_alloc_empty(const ecl_subsidence_type * sub, const char * name) { - ecl_subsidence_survey_type * survey = util_malloc( sizeof * survey ); + ecl_subsidence_survey_type * survey = (ecl_subsidence_survey_type*)util_malloc( sizeof * survey ); UTIL_TYPE_ID_INIT( survey , ECL_SUBSIDENCE_SURVEY_ID ); survey->grid_cache = sub->grid_cache; survey->aquifer_cell = sub->aquifer_cell; survey->name = util_alloc_string_copy( name ); - survey->porv = util_calloc( ecl_grid_cache_get_size( sub->grid_cache ) , sizeof * survey->porv ); - survey->pressure = util_calloc( ecl_grid_cache_get_size( sub->grid_cache ) , sizeof * survey->pressure ); + survey->porv = (double*)util_calloc( ecl_grid_cache_get_size( sub->grid_cache ) , sizeof * survey->porv ); + survey->pressure = (double*)util_calloc( ecl_grid_cache_get_size( sub->grid_cache ) , sizeof * survey->pressure ); return survey; } @@ -144,7 +144,7 @@ static double ecl_subsidence_survey_eval( const ecl_subsidence_survey_type * bas const ecl_grid_cache_type * grid_cache = base_survey->grid_cache; const int size = ecl_grid_cache_get_size( grid_cache ); - double * weight = util_calloc( size , sizeof * weight ); + double * weight = (double*)util_calloc( size , sizeof * weight ); double deltaz; int index; @@ -174,7 +174,7 @@ static double ecl_subsidence_survey_eval_geertsma( const ecl_subsidence_survey_t const double * cell_volume = ecl_grid_cache_get_volume( grid_cache ); const int size = ecl_grid_cache_get_size( grid_cache ); double scale_factor = 1e4 *(1 + poisson_ratio) * ( 1 - 2*poisson_ratio) / ( 4*M_PI*( 1 - poisson_ratio) * youngs_modulus ); - double * weight = util_calloc( size , sizeof * weight ); + double * weight = (double*)util_calloc( size , sizeof * weight ); double deltaz; for (int index = 0; index < size; index++) { @@ -202,7 +202,7 @@ static double ecl_subsidence_survey_eval_geertsma( const ecl_subsidence_survey_t */ ecl_subsidence_type * ecl_subsidence_alloc( const ecl_grid_type * ecl_grid, const ecl_file_type * init_file) { - ecl_subsidence_type * ecl_subsidence = util_malloc( sizeof * ecl_subsidence ); + ecl_subsidence_type * ecl_subsidence = (ecl_subsidence_type*)util_malloc( sizeof * ecl_subsidence ); ecl_subsidence->init_file = init_file; ecl_subsidence->grid_cache = ecl_grid_cache_alloc( ecl_grid ); ecl_subsidence->aquifer_cell = ecl_grav_common_alloc_aquifer_cell( ecl_subsidence->grid_cache , init_file ); @@ -232,7 +232,7 @@ static ecl_subsidence_survey_type * ecl_subsidence_get_survey( const ecl_subside if (name == NULL) return NULL; // Calling scope must determine if this is OK? else - return hash_get( subsidence->surveys , name ); + return (ecl_subsidence_survey_type*)hash_get( subsidence->surveys , name ); } diff --git a/lib/ecl/ecl_sum.c b/lib/ecl/ecl_sum.c index 13ad14dc46..dabfa9b123 100644 --- a/lib/ecl/ecl_sum.c +++ b/lib/ecl/ecl_sum.c @@ -154,7 +154,7 @@ static ecl_sum_type * ecl_sum_alloc__( const char * input_arg , const char * key if (!ecl_util_path_access(input_arg)) return NULL; - ecl_sum_type * ecl_sum = util_malloc( sizeof * ecl_sum ); + ecl_sum_type * ecl_sum = (ecl_sum_type*)util_malloc( sizeof * ecl_sum ); UTIL_TYPE_ID_INIT( ecl_sum , ECL_SUM_ID ); ecl_sum->ecl_case = NULL; @@ -717,6 +717,9 @@ double ecl_sum_get_general_var(const ecl_sum_type * ecl_sum , int time_index , c return ecl_sum_data_iget( ecl_sum->data , time_index , params_index); } +#ifdef __cplusplus +extern "C" { + void ecl_sum_get_interp_vector(const ecl_sum_type * ecl_sum, time_t sim_time, const ecl_sum_vector_type * key_words, double_vector_type * data){ ecl_sum_data_get_interp_vector(ecl_sum->data, sim_time, key_words, data); } @@ -725,6 +728,9 @@ void ecl_sum_fwrite_interp_csv_line(const ecl_sum_type * ecl_sum, time_t sim_tim ecl_sum_data_fwrite_interp_csv_line(ecl_sum->data, sim_time, key_words, fp); } +} +#endif + double ecl_sum_get_general_var_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const char * var) { @@ -1088,7 +1094,7 @@ static void ecl_sum_fprintf_header( const ecl_sum_type * ecl_sum , const stringl void ecl_sum_fprintf(const ecl_sum_type * ecl_sum , FILE * stream , const stringlist_type * var_list , bool report_only , const ecl_sum_fmt_type * fmt) { bool_vector_type * has_var = bool_vector_alloc( stringlist_get_size( var_list ), false ); int_vector_type * var_index = int_vector_alloc( stringlist_get_size( var_list ), -1 ); - char * date_string = util_malloc( DATE_STRING_LENGTH * sizeof * date_string); + char * date_string = (char*)util_malloc( DATE_STRING_LENGTH * sizeof * date_string); char * current_locale = NULL; if (fmt->locale != NULL) diff --git a/lib/include/ert/ecl/ecl_grav.h b/lib/include/ert/ecl/ecl_grav.h index c3f78f2029..67c44b9bfb 100644 --- a/lib/include/ert/ecl/ecl_grav.h +++ b/lib/include/ert/ecl/ecl_grav.h @@ -18,7 +18,7 @@ #ifndef ERT_ECL_GRAV_H #define ERT_ECL_GRAV_H -#ifdef __plusplus +#ifdef __cplusplus extern "C" { #endif @@ -36,11 +36,12 @@ ecl_grav_type * ecl_grav_alloc( const ecl_grid_type * ecl_grid, const ecl ecl_grav_survey_type * ecl_grav_add_survey_FIP( ecl_grav_type * grav , const char * name , const ecl_file_view_type * restart_file ); ecl_grav_survey_type * ecl_grav_add_survey_PORMOD( ecl_grav_type * grav , const char * name , const ecl_file_view_type * restart_file ); ecl_grav_survey_type * ecl_grav_add_survey_RPORV( ecl_grav_type * grav , const char * name , const ecl_file_view_type * restart_file ); +ecl_grav_survey_type * ecl_grav_add_survey_RFIP( ecl_grav_type * grav , const char * name , const ecl_file_view_type * restart_file ); double ecl_grav_eval( const ecl_grav_type * grav , const char * base, const char * monitor , ecl_region_type * region , double utm_x, double utm_y , double depth, int phase_mask); void ecl_grav_new_std_density( ecl_grav_type * grav , ecl_phase_enum phase , double default_density); void ecl_grav_add_std_density( ecl_grav_type * grav , ecl_phase_enum phase , int pvtnum , double density); -#ifdef __plusplus +#ifdef __cplusplus } #endif #endif diff --git a/lib/include/ert/ecl/ecl_grid.h b/lib/include/ert/ecl/ecl_grid.h index 0e8689fa6f..5ae7b115db 100644 --- a/lib/include/ert/ecl/ecl_grid.h +++ b/lib/include/ert/ecl/ecl_grid.h @@ -76,6 +76,7 @@ extern "C" { double ecl_grid_get_cell_dz3( const ecl_grid_type * grid , int i , int j , int k); double ecl_grid_get_cell_thickness3( const ecl_grid_type * grid , int i , int j , int k); + void ecl_grid_get_distance(const ecl_grid_type * grid , int global_index1, int global_index2 , double *dx , double *dy , double *dz); double ecl_grid_get_cdepth1A(const ecl_grid_type * grid , int active_index); double ecl_grid_get_cdepth1(const ecl_grid_type * grid , int global_index); double ecl_grid_get_cdepth3(const ecl_grid_type * grid , int i, int j , int k); @@ -118,6 +119,9 @@ extern "C" { ecl_grid_type * ecl_grid_alloc_regular( int nx, int ny , int nz , const double * ivec, const double * jvec , const double * kvec , const int * actnum); ecl_grid_type * ecl_grid_alloc_dxv_dyv_dzv( int nx, int ny , int nz , const double * dxv , const double * dyv , const double * dzv , const int * actnum); ecl_grid_type * ecl_grid_alloc_dxv_dyv_dzv_depthz( int nx, int ny , int nz , const double * dxv , const double * dyv , const double * dzv , const double * depthz , const int * actnum); + ecl_kw_type * ecl_grid_alloc_volume_kw( const ecl_grid_type * grid , bool active_size); + ecl_kw_type * ecl_grid_alloc_mapaxes_kw( const ecl_grid_type * grid ); + ecl_kw_type * ecl_grid_alloc_coord_kw( const ecl_grid_type * grid); bool ecl_grid_exists( const char * case_input ); char * ecl_grid_alloc_case_filename( const char * case_input ); diff --git a/lib/include/ert/ecl/ecl_io_config.h b/lib/include/ert/ecl/ecl_io_config.h index 6792346101..c33f01274b 100644 --- a/lib/include/ert/ecl/ecl_io_config.h +++ b/lib/include/ert/ecl/ecl_io_config.h @@ -18,6 +18,9 @@ #ifndef ERT_ECL_IO_CONFIG_H #define ERT_ECL_IO_CONFIG_H +#ifdef __cplusplus +extern "C" { +#endif typedef struct ecl_io_config_struct ecl_io_config_type; @@ -38,4 +41,7 @@ bool ecl_io_config_get_unified_summary(ecl_io_config_type *); ecl_io_config_type * ecl_io_config_alloc(bool ,bool ,bool); void ecl_io_config_free(ecl_io_config_type * ); +#ifdef __cplusplus +} +#endif #endif diff --git a/lib/include/ert/ecl/ecl_kw.h b/lib/include/ert/ecl/ecl_kw.h index fc53df142d..21b22bd385 100644 --- a/lib/include/ert/ecl/ecl_kw.h +++ b/lib/include/ert/ecl/ecl_kw.h @@ -87,6 +87,7 @@ extern "C" { bool ecl_kw_fread_realloc(ecl_kw_type *, fortio_type *); void ecl_kw_fread(ecl_kw_type * , fortio_type * ); ecl_kw_type * ecl_kw_fread_alloc(fortio_type *); + ecl_kw_type * ecl_kw_alloc_actnum(const ecl_kw_type * porv_kw, float porv_limit); void ecl_kw_free_data(ecl_kw_type *); void ecl_kw_fread_indexed_data(fortio_type * fortio, offset_type data_offset, ecl_data_type, int element_count, const int_vector_type* index_map, char* buffer); void ecl_kw_free(ecl_kw_type *); @@ -118,6 +119,7 @@ extern "C" { ecl_kw_type * ecl_kw_alloc( const char * header , int size , ecl_data_type ); ecl_kw_type * ecl_kw_alloc_new(const char * , int , ecl_data_type , const void * ); ecl_kw_type * ecl_kw_alloc_new_shared(const char * , int , ecl_data_type , void * ); + ecl_kw_type * ecl_kw_alloc_global_copy(const ecl_kw_type * src, const ecl_kw_type * actnum); void ecl_kw_fwrite_param(const char * , bool , const char * , ecl_data_type , int , void * ); void ecl_kw_fwrite_param_fortio(fortio_type *, const char * , ecl_data_type , int , void * ); void ecl_kw_summarize(const ecl_kw_type * ecl_kw); @@ -139,6 +141,9 @@ extern "C" { bool ecl_kw_fskip_data(ecl_kw_type *ecl_kw, fortio_type *fortio); bool ecl_kw_fread_data(ecl_kw_type *ecl_kw, fortio_type *fortio); void ecl_kw_fskip_header( fortio_type * fortio); + bool ecl_kw_size_and_numeric_type_equal( const ecl_kw_type * kw1, const ecl_kw_type * kw2); + bool ecl_kw_inplace_safe_div(ecl_kw_type * target_kw, const ecl_kw_type * divisor); + void ecl_kw_inplace_sqrt( ecl_kw_type * kw ); bool ecl_kw_is_kw_file(fortio_type * fortio); @@ -262,6 +267,8 @@ extern "C" { void ecl_kw_fix_uninitialized(ecl_kw_type * ecl_kw , int nx , int ny , int nz, const int * actnum); + ecl_type_enum ecl_kw_get_type(const ecl_kw_type *); + #include #ifdef __cplusplus diff --git a/lib/include/ert/ecl/ecl_region.h b/lib/include/ert/ecl/ecl_region.h index 87be80a3a0..9ad8e40310 100644 --- a/lib/include/ert/ecl/ecl_region.h +++ b/lib/include/ert/ecl/ecl_region.h @@ -70,10 +70,13 @@ typedef struct ecl_region_struct ecl_region_type; bool ecl_region_contains_global( const ecl_region_type * ecl_region , int global_index); bool ecl_region_contains_active( const ecl_region_type * ecl_region , int active_index); + void ecl_region_select_true( ecl_region_type * region , const ecl_kw_type * ecl_kw); void ecl_region_invert_selection( ecl_region_type * region ); void ecl_region_select_all( ecl_region_type * region); void ecl_region_deselect_all( ecl_region_type * region ); + void ecl_region_deselect_true( ecl_region_type * region , const ecl_kw_type * ecl_kw); + void ecl_region_select_false( ecl_region_type * region , const ecl_kw_type * ecl_kw); 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_deselect_in_interval( ecl_region_type * region , const ecl_kw_type * ecl_kw, float min_value , float max_value); @@ -152,6 +155,7 @@ typedef struct ecl_region_struct ecl_region_type; void ecl_region_select_from_layer( ecl_region_type * region , const layer_type * layer , int k , int layer_value); void ecl_region_deselect_from_layer( ecl_region_type * region , const layer_type * layer , int k , int layer_value); + void ecl_region_deselect_false( ecl_region_type * region , const ecl_kw_type * ecl_kw); /*****************************************************************/ @@ -170,6 +174,16 @@ typedef struct ecl_region_struct ecl_region_type; bool ecl_region_equal( const ecl_region_type * region1 , const ecl_region_type * region2); + void ecl_region_scale_kw_float( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , float value , bool force_active); + void ecl_region_scale_kw_double( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , double value , 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_shift_kw_int( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , int 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_shift_kw_float( ecl_region_type * ecl_region , ecl_kw_type * ecl_kw , float value , bool force_active); + + const int_vector_type * ecl_region_get_kw_index_list( ecl_region_type * ecl_region , const ecl_kw_type * ecl_kw , bool force_active); + + /*****************************************************************/ /* set/get the name */ void ecl_region_set_name( ecl_region_type * region , const char * name ); diff --git a/lib/include/ert/ecl/ecl_rft_node.h b/lib/include/ert/ecl/ecl_rft_node.h index 8faef7cda0..b7f6418cbd 100644 --- a/lib/include/ert/ecl/ecl_rft_node.h +++ b/lib/include/ert/ecl/ecl_rft_node.h @@ -67,6 +67,8 @@ int ecl_rft_node_cmp( const ecl_rft_node_type * n1 , const ecl_rft_node_type * n void ecl_rft_node_append_cell( ecl_rft_node_type * rft_node , ecl_rft_cell_type * cell); ecl_rft_node_type * ecl_rft_node_alloc_new(const char * well_name, const char * data_type_string, const time_t recording_date, const double days); +ecl_rft_enum ecl_rft_node_get_type(const ecl_rft_node_type * rft_node); + #ifdef __cplusplus } #endif diff --git a/lib/include/ert/ecl/ecl_rsthead.h b/lib/include/ert/ecl/ecl_rsthead.h index 28aa0dbaee..cf58ec3e53 100644 --- a/lib/include/ert/ecl/ecl_rsthead.h +++ b/lib/include/ert/ecl/ecl_rsthead.h @@ -95,6 +95,8 @@ extern "C" { double ecl_rsthead_get_sim_days( const ecl_rsthead_type * header ); int ecl_rsthead_get_report_step( const ecl_rsthead_type * header ); time_t ecl_rsthead_get_sim_time( const ecl_rsthead_type * header ); + int ecl_rsthead_get_nxconz( const ecl_rsthead_type * rsthead ); + int ecl_rsthead_get_ncwmax( const ecl_rsthead_type * rsthead ); #ifdef __cplusplus } diff --git a/lib/include/ert/ecl/ecl_subsidence.h b/lib/include/ert/ecl/ecl_subsidence.h index 7da533e338..71d0747a1f 100644 --- a/lib/include/ert/ecl/ecl_subsidence.h +++ b/lib/include/ert/ecl/ecl_subsidence.h @@ -19,7 +19,7 @@ #ifndef ERT_ECL_SUBSIDENCE_H #define ERT_ECL_SUBSIDENCE_H -#ifdef __plusplus +#ifdef __cplusplus extern "C" { #endif @@ -43,8 +43,12 @@ extern "C" { ecl_region_type * region , double utm_x, double utm_y , double depth, double compressibility, double poisson_ratio); + double ecl_subsidence_eval_geertsma( const ecl_subsidence_type * subsidence , const char * base, const char * monitor , ecl_region_type * region , + double utm_x, double utm_y , double depth, + double youngs_modulus, double poisson_ratio, double seabed); -#ifdef __plusplus + +#ifdef __cplusplus } #endif #endif diff --git a/lib/include/ert/ecl/ecl_sum.h b/lib/include/ert/ecl/ecl_sum.h index 49835013e6..70e5a85742 100644 --- a/lib/include/ert/ecl/ecl_sum.h +++ b/lib/include/ert/ecl/ecl_sum.h @@ -136,6 +136,8 @@ typedef struct ecl_sum_struct ecl_sum_type; double ecl_sum_get_general_var_from_sim_days( const ecl_sum_type * ecl_sum , double sim_days , const char * var); double ecl_sum_get_general_var_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const char * var); const char * ecl_sum_get_general_var_unit( const ecl_sum_type * ecl_sum , const char * var); + ert_ecl_unit_enum ecl_sum_get_unit_system(const ecl_sum_type * ecl_sum); + /***************/ void ecl_sum_fprintf(const ecl_sum_type * , FILE * , const stringlist_type * , bool report_only , const ecl_sum_fmt_type * fmt); @@ -143,6 +145,7 @@ typedef struct ecl_sum_struct ecl_sum_type; /* Time related functions */ + int ecl_sum_get_restart_step(const ecl_sum_type * ecl_sum); int ecl_sum_get_first_gt( const ecl_sum_type * ecl_sum , int param_index , double limit); int ecl_sum_get_first_lt( const ecl_sum_type * ecl_sum , int param_index , double limit); int ecl_sum_get_last_report_step( const ecl_sum_type * ecl_sum );