mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Update ecllib from statoil master repo commit 0188b08081eb1ac4ade89ac224b8128b4c9b0481
This commit is contained in:
parent
89930e15f7
commit
d2e48ef153
@ -16,7 +16,7 @@ set(RESINSIGHT_DEV_VERSION ".109")
|
||||
set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f")
|
||||
|
||||
# https://github.com/Statoil/libecl
|
||||
set(ECL_GITHUB_SHA "b31b055af2d6b887f47aec84c65ec497a5d12973")
|
||||
set(ECL_GITHUB_SHA "0188b08081eb1ac4ade89ac224b8128b4c9b0481")
|
||||
|
||||
# https://github.com/OPM/opm-flowdiagnostics
|
||||
set(OPM_FLOWDIAGNOSTICS_SHA "7e2be931d430796ed42efcfb5c6b67a8d5962f7f")
|
||||
|
2
ThirdParty/Ert/.travis.yml
vendored
2
ThirdParty/Ert/.travis.yml
vendored
@ -24,8 +24,6 @@ env:
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- env: PYTHON_VERSION=3.6
|
||||
exclude:
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
|
10
ThirdParty/Ert/CMakeLists.txt
vendored
10
ThirdParty/Ert/CMakeLists.txt
vendored
@ -268,6 +268,13 @@ try_compile( HAVE_PID_T ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/
|
||||
try_compile( HAVE_MODE_T ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_mode_t.c )
|
||||
try_compile( ERT_HAVE_ISFINITE ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_isfinite.c)
|
||||
|
||||
if (ERT_HAVE_READLINKAT)
|
||||
try_compile( ERT_HAVE_READLINKAT_DECLARATION
|
||||
${CMAKE_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}/cmake/Tests/test_have_readlinkat_decl.c
|
||||
)
|
||||
endif()
|
||||
|
||||
set( BUILD_CXX ON )
|
||||
try_compile( HAVE_CXX_SHARED_PTR ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_shared_ptr.cpp )
|
||||
if (NOT HAVE_CXX_SHARED_PTR)
|
||||
@ -357,9 +364,6 @@ if (ENABLE_PYTHON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (INSTALL_ERT)
|
||||
install(EXPORT ecl-config DESTINATION share/cmake/ecl)
|
||||
endif()
|
||||
|
||||
export(TARGETS ecl FILE eclConfig.cmake)
|
||||
export(PACKAGE ecl)
|
||||
|
198
ThirdParty/Ert/applications/ecl/esummary.c
vendored
198
ThirdParty/Ert/applications/ecl/esummary.c
vendored
@ -1,198 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'esummary.c' is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/time_interval.h>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_sum.h>
|
||||
|
||||
|
||||
void install_SIGNALS(void) {
|
||||
signal(SIGSEGV , util_abort_signal); /* Segmentation violation, i.e. overwriting memory ... */
|
||||
signal(SIGINT , util_abort_signal); /* Control C */
|
||||
signal(SIGTERM , util_abort_signal); /* If killing the enkf program with SIGTERM (the default kill signal) you will get a backtrace. Killing with SIGKILL (-9) will not give a backtrace.*/
|
||||
}
|
||||
|
||||
void usage() {
|
||||
fprintf(stderr," The esummary.x program can be used to extract summary vectors from \n");
|
||||
fprintf(stderr," an ensemble of summary files: \n\n");
|
||||
fprintf(stderr," bash%% esummary.x ECLIPSE1.DATA ECLIPSE2.DATA KEY1 KEY2 ... \n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
#define MISSING_STRING " 0.000"
|
||||
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
install_SIGNALS();
|
||||
{
|
||||
if (argc < 3) usage();
|
||||
|
||||
{
|
||||
ecl_sum_type * first_ecl_sum = NULL; /* This governs the timing */
|
||||
vector_type * ecl_sum_list = vector_alloc_new();
|
||||
time_interval_type * time_union = NULL;
|
||||
time_interval_type * time_intersect = NULL;
|
||||
time_interval_type * time = NULL;
|
||||
bool use_time_union = true;
|
||||
|
||||
int load_count = 0;
|
||||
int nvars;
|
||||
char ** var_list;
|
||||
bool * has_var;
|
||||
|
||||
/** Loading the data */
|
||||
{
|
||||
int iarg = 1;
|
||||
/* Some sorting here??? */
|
||||
while (iarg < argc && util_file_exists( argv[iarg] )) {
|
||||
char * path , * basename;
|
||||
ecl_sum_type * ecl_sum;
|
||||
util_alloc_file_components( argv[iarg] , &path , &basename , NULL);
|
||||
fprintf(stderr,"Loading case: %s/%s" , path , basename); fflush(stderr);
|
||||
ecl_sum = ecl_sum_fread_alloc_case( argv[iarg] , ":");
|
||||
if (ecl_sum) {
|
||||
if (first_ecl_sum == NULL) {
|
||||
first_ecl_sum = ecl_sum; /* Keep track of this - might sort the vector */
|
||||
time_union = time_interval_alloc_copy( ecl_sum_get_sim_time( ecl_sum ));
|
||||
time_intersect = time_interval_alloc_copy( ecl_sum_get_sim_time( ecl_sum ));
|
||||
|
||||
if (use_time_union)
|
||||
time = time_union;
|
||||
else
|
||||
time = time_intersect;
|
||||
|
||||
vector_append_owned_ref( ecl_sum_list , ecl_sum , ecl_sum_free__ );
|
||||
load_count++;
|
||||
} else {
|
||||
const time_interval_type * ti = ecl_sum_get_sim_time( ecl_sum );
|
||||
if (time_interval_has_overlap(time , ti)) {
|
||||
time_interval_intersect( time_intersect , ti );
|
||||
time_interval_extend( time_union , ti );
|
||||
|
||||
vector_append_owned_ref( ecl_sum_list , ecl_sum , ecl_sum_free__ );
|
||||
load_count++;
|
||||
} else {
|
||||
fprintf(stderr,"** Warning case:%s has no time overlap - discarded \n",ecl_sum_get_case( ecl_sum ));
|
||||
ecl_sum_free( ecl_sum );
|
||||
}
|
||||
}
|
||||
} else
|
||||
fprintf(stderr," --- no data found?!");
|
||||
|
||||
iarg++;
|
||||
fprintf(stderr,"\n");
|
||||
util_safe_free( path );
|
||||
free( basename );
|
||||
}
|
||||
}
|
||||
if (load_count == 0)
|
||||
usage();
|
||||
|
||||
nvars = argc - load_count - 1;
|
||||
if (nvars == 0) util_exit(" --- No variables \n");
|
||||
var_list = &argv[load_count + 1];
|
||||
has_var = util_calloc( nvars , sizeof * has_var );
|
||||
|
||||
/*
|
||||
Checking that the summary files have the various variables -
|
||||
if a variable is missing from one of the cases it is
|
||||
completely discarded.
|
||||
*/
|
||||
{
|
||||
int iens,ivar;
|
||||
|
||||
/* Checking the variables */
|
||||
for (ivar = 0; ivar < nvars; ivar++)
|
||||
has_var[ivar] = true;
|
||||
|
||||
for (iens = 0; iens < vector_get_size( ecl_sum_list ); iens++) {
|
||||
const ecl_sum_type * ecl_sum = vector_iget_const( ecl_sum_list , iens );
|
||||
for (ivar = 0; ivar < nvars; ivar++) {
|
||||
if (has_var[ivar]) {
|
||||
if (!ecl_sum_has_general_var( ecl_sum , var_list[ivar] )) {
|
||||
fprintf(stderr,"** Warning: could not find variable: \'%s\' in case:%s - completely discarded.\n", var_list[ivar] , ecl_sum_get_case(ecl_sum));
|
||||
has_var[ivar] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!time_interval_equal(time_union , time_intersect )) {
|
||||
fprintf(stderr,"** Warning: not all simulations have the same length. ");
|
||||
if (use_time_union)
|
||||
fprintf(stderr,"Using %s for missing values.\n" , MISSING_STRING);
|
||||
else
|
||||
fprintf(stderr,"Only showing common time period.\n");
|
||||
}
|
||||
|
||||
/** The actual summary lookup. */
|
||||
{
|
||||
time_t_vector_type * date_list = time_t_vector_alloc(0,0);
|
||||
time_t start_time = time_interval_get_start( time );
|
||||
FILE * stream = stdout;
|
||||
int iens,ivar,itime;
|
||||
|
||||
ecl_util_init_month_range( date_list , time_interval_get_start( time ) , time_interval_get_end( time ));
|
||||
for (itime = 0; itime < time_t_vector_size( date_list ); itime++) {
|
||||
time_t current_time = time_t_vector_iget( date_list , itime );
|
||||
for (ivar = 0; ivar < nvars; ivar++) { /* Iterating over the variables */
|
||||
if (has_var[ivar]) {
|
||||
for (iens = 0; iens < vector_get_size( ecl_sum_list ); iens++) { /* Iterating over the ensemble members */
|
||||
const ecl_sum_type * ecl_sum = vector_iget_const( ecl_sum_list , iens );
|
||||
|
||||
if (ivar == 0 && iens == 0) { /* Display time info in the first columns */
|
||||
int day,month,year;
|
||||
util_set_date_values_utc( current_time , &day , &month, &year);
|
||||
fprintf(stream , "%7.2f %02d/%02d/%04d " , util_difftime_days( start_time , current_time ) , day , month , year);
|
||||
}
|
||||
|
||||
{
|
||||
const time_interval_type * sim_time = ecl_sum_get_sim_time( ecl_sum );
|
||||
|
||||
if (time_interval_arg_before( sim_time , current_time))
|
||||
fprintf(stream , " %s " , MISSING_STRING); // We are before this case has data.
|
||||
else if (time_interval_arg_after( sim_time , current_time))
|
||||
fprintf(stream , " %s " , MISSING_STRING); // We are after this case has data.
|
||||
else {
|
||||
double value = ecl_sum_get_general_var_from_sim_time(ecl_sum , current_time , var_list[ivar]);
|
||||
fprintf(stream , " %12.3f " , value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(stream , "\n");
|
||||
}
|
||||
time_t_vector_free( date_list );
|
||||
}
|
||||
vector_free( ecl_sum_list );
|
||||
free( has_var );
|
||||
}
|
||||
}
|
||||
}
|
17
ThirdParty/Ert/cmake/Tests/test_have_readlinkat_decl.c
vendored
Normal file
17
ThirdParty/Ert/cmake/Tests/test_have_readlinkat_decl.c
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NCHAR 63
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char linkname[NCHAR + 1] = { 0 };
|
||||
ssize_t r;
|
||||
|
||||
r = (argc < 2) ? -1
|
||||
: readlinkat(1, argv[1], linkname, NCHAR);
|
||||
|
||||
return (r > 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
186
ThirdParty/Ert/lib/CMakeLists.txt
vendored
186
ThirdParty/Ert/lib/CMakeLists.txt
vendored
@ -9,23 +9,23 @@ else()
|
||||
endif()
|
||||
|
||||
if (ERT_HAVE_GETUID AND ERT_HAVE_OPENDIR)
|
||||
list(APPEND opt_srcs util/test_work_area.c util/util_getuid.c)
|
||||
list(APPEND opt_srcs util/test_work_area.cpp util/util_getuid.cpp)
|
||||
endif()
|
||||
|
||||
if (ERT_HAVE_OPENDIR)
|
||||
list(APPEND opt_srcs util/util_opendir.c)
|
||||
list(APPEND opt_srcs util/util_opendir.cpp)
|
||||
endif()
|
||||
|
||||
if (ERT_HAVE_SPAWN)
|
||||
list(APPEND opt_srcs util/util_spawn.c)
|
||||
list(APPEND opt_srcs util/util_spawn.cpp)
|
||||
endif()
|
||||
|
||||
if (ERT_HAVE_LOCKF)
|
||||
list(APPEND opt_srcs util/util_lockf.c)
|
||||
list(APPEND opt_srcs util/util_lockf.cpp)
|
||||
endif ()
|
||||
|
||||
if (ERT_HAVE_UNISTD)
|
||||
list(APPEND opt_srcs util/path_stack.c)
|
||||
list(APPEND opt_srcs util/path_stack.cpp)
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
@ -36,20 +36,22 @@ foreach (type int double long time_t float)
|
||||
set(TYPE ${type})
|
||||
set(SIGNED_TYPE true)
|
||||
configure_file(vector_template.h.in include/ert/util/${type}_vector.h)
|
||||
configure_file(util/vector_template.c ${type}_vector.c)
|
||||
list(APPEND opt_srcs ${CMAKE_CURRENT_BINARY_DIR}/${type}_vector.c)
|
||||
configure_file(vector_template.hpp.in include/ert/util/${type}_vector.hpp)
|
||||
configure_file(util/vector_template.cpp ${type}_vector.cpp)
|
||||
list(APPEND opt_srcs ${CMAKE_CURRENT_BINARY_DIR}/${type}_vector.cpp)
|
||||
endforeach ()
|
||||
|
||||
foreach (type bool size_t)
|
||||
set(TYPE ${type})
|
||||
set(SIGNED_TYPE false)
|
||||
configure_file(vector_template.h.in include/ert/util/${type}_vector.h)
|
||||
configure_file(util/vector_template.c ${type}_vector.c)
|
||||
list(APPEND opt_srcs ${CMAKE_CURRENT_BINARY_DIR}/${type}_vector.c)
|
||||
configure_file(vector_template.hpp.in include/ert/util/${type}_vector.hpp)
|
||||
configure_file(util/vector_template.cpp ${type}_vector.cpp)
|
||||
list(APPEND opt_srcs ${CMAKE_CURRENT_BINARY_DIR}/${type}_vector.cpp)
|
||||
endforeach ()
|
||||
|
||||
if (ZLIB_FOUND)
|
||||
list(APPEND opt_srcs util/util_zlib.c)
|
||||
list(APPEND opt_srcs util/util_zlib.cpp)
|
||||
endif ()
|
||||
|
||||
if (ERT_BUILD_CXX)
|
||||
@ -60,95 +62,96 @@ if (ERT_BUILD_CXX)
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
||||
configure_file(build_config.h.in include/ert/util/build_config.h)
|
||||
configure_file(ert_api_config.h.in include/ert/util/ert_api_config.h)
|
||||
configure_file(build_config.hpp.in include/ert/util/build_config.hpp)
|
||||
configure_file(ert_api_config.hpp.in include/ert/util/ert_api_config.hpp)
|
||||
|
||||
add_library(ecl util/rng.c
|
||||
util/lookup_table.c
|
||||
util/statistics.c
|
||||
util/mzran.c
|
||||
util/set.c
|
||||
util/hash_node.c
|
||||
util/hash_sll.c
|
||||
util/hash.c
|
||||
util/node_data.c
|
||||
util/node_ctype.c
|
||||
add_library(ecl util/rng.cpp
|
||||
util/lookup_table.cpp
|
||||
util/statistics.cpp
|
||||
util/mzran.cpp
|
||||
util/set.cpp
|
||||
util/hash_node.cpp
|
||||
util/hash_sll.cpp
|
||||
util/hash.cpp
|
||||
util/node_data.cpp
|
||||
util/node_ctype.cpp
|
||||
util/util.c
|
||||
util/util_symlink.c
|
||||
util/util_symlink.cpp
|
||||
util/util_lfs.c
|
||||
util/util_unlink.c
|
||||
util/arg_pack.c
|
||||
util/vector.c
|
||||
util/parser.c
|
||||
util/stringlist.c
|
||||
util/buffer.c
|
||||
util/timer.c
|
||||
util/string_util.c
|
||||
util/type_vector_functions.c
|
||||
util/ecl_version.c
|
||||
util/struct_vector.c
|
||||
util/perm_vector.c
|
||||
util/test_util.c
|
||||
util/util_unlink.cpp
|
||||
util/arg_pack.cpp
|
||||
util/vector.cpp
|
||||
util/parser.cpp
|
||||
util/stringlist.cpp
|
||||
util/buffer.cpp
|
||||
util/timer.cpp
|
||||
util/string_util.cpp
|
||||
util/type_vector_functions.cpp
|
||||
util/ecl_version.cpp
|
||||
util/struct_vector.cpp
|
||||
util/perm_vector.cpp
|
||||
util/test_util.cpp
|
||||
${opt_srcs}
|
||||
|
||||
ecl/ecl_rsthead.c
|
||||
ecl/ecl_sum_tstep.c
|
||||
ecl/ecl_rst_file.c
|
||||
ecl/ecl_init_file.c
|
||||
ecl/ecl_grid_cache.c
|
||||
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_sum_data.c
|
||||
ecl/ecl_util.c
|
||||
ecl/ecl_kw.c
|
||||
ecl/ecl_sum.c
|
||||
ecl/ecl_sum_vector.c
|
||||
ecl/ecl_rsthead.cpp
|
||||
ecl/ecl_sum_tstep.cpp
|
||||
ecl/ecl_rst_file.cpp
|
||||
ecl/ecl_init_file.cpp
|
||||
ecl/ecl_grid_cache.cpp
|
||||
ecl/smspec_node.cpp
|
||||
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.cpp
|
||||
ecl/ecl_util.cpp
|
||||
ecl/ecl_kw.cpp
|
||||
ecl/ecl_sum.cpp
|
||||
ecl/ecl_sum_vector.cpp
|
||||
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/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/layer.c
|
||||
ecl/fault_block.c
|
||||
ecl/fault_block_layer.c
|
||||
ecl/ecl_type.c
|
||||
ecl/ecl_type_python.c
|
||||
ecl/well_state.c
|
||||
ecl/well_conn.c
|
||||
ecl/well_info.c
|
||||
ecl/well_ts.c
|
||||
ecl/well_conn_collection.c
|
||||
ecl/well_segment.c
|
||||
ecl/well_segment_collection.c
|
||||
ecl/well_branch_collection.c
|
||||
ecl/well_rseg_loader.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.cpp
|
||||
ecl/nnc_info.cpp
|
||||
ecl/ecl_grav_common.cpp
|
||||
ecl/nnc_vector.cpp
|
||||
ecl/ecl_nnc_export.cpp
|
||||
ecl/ecl_nnc_data.cpp
|
||||
ecl/ecl_nnc_geometry.cpp
|
||||
ecl/layer.cpp
|
||||
ecl/fault_block.cpp
|
||||
ecl/fault_block_layer.cpp
|
||||
ecl/ecl_type.cpp
|
||||
ecl/ecl_type_python.cpp
|
||||
ecl/well_state.cpp
|
||||
ecl/well_conn.cpp
|
||||
ecl/well_info.cpp
|
||||
ecl/well_ts.cpp
|
||||
ecl/well_conn_collection.cpp
|
||||
ecl/well_segment.cpp
|
||||
ecl/well_segment_collection.cpp
|
||||
ecl/well_branch_collection.cpp
|
||||
ecl/well_rseg_loader.cpp
|
||||
|
||||
geometry/geo_surface.c
|
||||
geometry/geo_util.c
|
||||
geometry/geo_pointset.c
|
||||
geometry/geo_region.c
|
||||
geometry/geo_polygon.c
|
||||
geometry/geo_polygon_collection.c
|
||||
geometry/geo_surface.cpp
|
||||
geometry/geo_util.cpp
|
||||
geometry/geo_pointset.cpp
|
||||
geometry/geo_region.cpp
|
||||
geometry/geo_polygon.cpp
|
||||
geometry/geo_polygon_collection.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(ecl PUBLIC ${m}
|
||||
@ -190,7 +193,7 @@ endif ()
|
||||
set_target_properties(ecl PROPERTIES
|
||||
VERSION ${ECL_VERSION_MAJOR}.${ECL_VERSION_MINOR}
|
||||
SOVERSION ${ECL_VERSION_MAJOR})
|
||||
if (INSTALL_ERT)
|
||||
|
||||
install(TARGETS ecl
|
||||
EXPORT ecl-config
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
@ -215,7 +218,6 @@ if (ERT_BUILD_CXX)
|
||||
PATTERN *.hpp
|
||||
)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if (NOT BUILD_TESTS)
|
||||
return ()
|
||||
|
1
ThirdParty/Ert/lib/build_config.hpp.in
vendored
Normal file
1
ThirdParty/Ert/lib/build_config.hpp.in
vendored
Normal file
@ -0,0 +1 @@
|
||||
#include <ert/util/build_config.h>
|
3
ThirdParty/Ert/lib/ecl/FortIO.cpp
vendored
3
ThirdParty/Ert/lib/ecl/FortIO.cpp
vendored
@ -19,8 +19,7 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/ecl/FortIO.hpp>
|
||||
|
||||
|
2
ThirdParty/Ert/lib/ecl/Smspec.cpp
vendored
2
ThirdParty/Ert/lib/ecl/Smspec.cpp
vendored
@ -1,4 +1,4 @@
|
||||
#include <ert/ecl/ecl_smspec.h>
|
||||
#include <ert/ecl/ecl_smspec.hpp>
|
||||
#include <ert/ecl/Smspec.hpp>
|
||||
|
||||
namespace ERT {
|
||||
|
@ -21,10 +21,10 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_box.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_box.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
#define ECL_BOX_TYPE_ID 6610643
|
||||
@ -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;
|
@ -20,12 +20,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_coarse_cell.h>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_coarse_cell.hpp>
|
||||
|
||||
/******************************************************************/
|
||||
/*
|
||||
@ -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;
|
@ -22,21 +22,21 @@
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_file_view.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_rsthead.h>
|
||||
#include <ert/ecl/ecl_file_kw.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_rsthead.hpp>
|
||||
#include <ert/ecl/ecl_file_kw.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
/**
|
||||
This file implements functionality to load an ECLIPSE file in
|
||||
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -21,12 +21,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/size_t_vector.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/size_t_vector.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_file_kw.h>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_file_kw.hpp>
|
||||
#include <ert/ecl/fortio.h>
|
||||
|
||||
/*
|
||||
@ -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 );
|
||||
@ -363,14 +363,14 @@ void ecl_file_kw_fwrite( const ecl_file_kw_type * file_kw , FILE * stream ) {
|
||||
util_fwrite_int( file_kw->kw_size , stream );
|
||||
util_fwrite_offset( file_kw->file_offset , stream );
|
||||
util_fwrite_int( ecl_type_get_type( file_kw->data_type ) , stream );
|
||||
util_fwrite_size_t( ecl_type_get_sizeof_ctype_fortio( file_kw->data_type ) , stream );
|
||||
util_fwrite_size_t( ecl_type_get_sizeof_iotype( file_kw->data_type ) , stream );
|
||||
}
|
||||
|
||||
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];
|
@ -17,17 +17,17 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_file_kw.h>
|
||||
#include <ert/ecl/ecl_file_view.h>
|
||||
#include <ert/ecl/ecl_rsthead.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_file_kw.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
#include <ert/ecl/ecl_rsthead.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
|
||||
struct ecl_file_view_struct {
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ ecl_kw_type * ecl_file_view_iget_kw( const ecl_file_view_type * ecl_file_view ,
|
||||
return ecl_file_view_get_kw(ecl_file_view, file_kw);
|
||||
}
|
||||
|
||||
void ecl_file_view_index_fload_kw(const ecl_file_view_type * ecl_file_view, const char* kw, int index, const int_vector_type * index_map, char* buffer) {
|
||||
void ecl_file_view_index_fload_kw(const ecl_file_view_type * ecl_file_view, const char* kw, int index, const int_vector_type * index_map, char* io_buffer) {
|
||||
ecl_file_kw_type * file_kw = ecl_file_view_iget_named_file_kw( ecl_file_view , kw , index);
|
||||
|
||||
if (fortio_assert_stream_open( ecl_file_view->fortio )) {
|
||||
@ -177,7 +177,7 @@ void ecl_file_view_index_fload_kw(const ecl_file_view_type * ecl_file_view, cons
|
||||
ecl_data_type data_type = ecl_file_kw_get_data_type(file_kw);
|
||||
int element_count = ecl_file_kw_get_size(file_kw);
|
||||
|
||||
ecl_kw_fread_indexed_data(ecl_file_view->fortio, offset + ECL_KW_HEADER_FORTIO_SIZE, data_type, element_count, index_map, buffer);
|
||||
ecl_kw_fread_indexed_data(ecl_file_view->fortio, offset + ECL_KW_HEADER_FORTIO_SIZE, data_type, element_count, index_map, io_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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]);
|
@ -20,19 +20,19 @@
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid_cache.h>
|
||||
#include <ert/ecl/ecl_region.h>
|
||||
#include <ert/ecl/ecl_grav.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_grav_common.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_grid_cache.hpp>
|
||||
#include <ert/ecl/ecl_region.hpp>
|
||||
#include <ert/ecl/ecl_grav.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_grav_common.hpp>
|
||||
|
||||
|
||||
/**
|
||||
@ -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 );
|
||||
}
|
||||
|
@ -20,12 +20,12 @@
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grav.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_grav.hpp>
|
||||
|
||||
|
||||
|
@ -21,13 +21,14 @@
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_region.h>
|
||||
#include <ert/ecl/ecl_grid_cache.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_region.hpp>
|
||||
#include <ert/ecl/ecl_grid_cache.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_grav_common.hpp>
|
||||
|
||||
/*
|
||||
This file contains code which is common to both the ecl_grav
|
||||
@ -36,7 +37,7 @@
|
||||
*/
|
||||
|
||||
bool * ecl_grav_common_alloc_aquifer_cell( const ecl_grid_cache_type * grid_cache , const ecl_file_type * init_file) {
|
||||
bool * aquifer_cell = util_calloc( ecl_grid_cache_get_size( grid_cache ) , sizeof * aquifer_cell );
|
||||
bool * aquifer_cell = (bool*)util_calloc( ecl_grid_cache_get_size( grid_cache ) , sizeof * aquifer_cell );
|
||||
|
||||
for (int active_index = 0; active_index < ecl_grid_cache_get_size( grid_cache ); active_index++)
|
||||
aquifer_cell[ active_index ] = false;
|
@ -22,26 +22,26 @@
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/double_vector.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/double_vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
|
||||
#include <ert/geometry/geo_util.h>
|
||||
#include <ert/geometry/geo_polygon.h>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_coarse_cell.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/grid_dims.h>
|
||||
#include <ert/ecl/nnc_info.h>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
#include <ert/ecl/ecl_coarse_cell.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/grid_dims.hpp>
|
||||
#include <ert/ecl/nnc_info.hpp>
|
||||
|
||||
|
||||
/**
|
||||
@ -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);
|
@ -21,13 +21,13 @@
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid_cache.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_grid_cache.hpp>
|
||||
|
||||
|
||||
|
||||
@ -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 );
|
||||
}
|
@ -18,15 +18,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid_dims.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_grid_dims.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
|
||||
|
||||
struct ecl_grid_dims_struct {
|
||||
@ -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 );
|
||||
}
|
||||
|
@ -31,14 +31,15 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
#include <ert/ecl/ecl_init_file.hpp>
|
||||
|
||||
static ecl_kw_type * ecl_init_file_alloc_INTEHEAD( const ecl_grid_type * ecl_grid , ert_ecl_unit_enum unit_system, int phases, time_t start_date , int simulator) {
|
||||
ecl_kw_type * intehead_kw = ecl_kw_alloc( INTEHEAD_KW , INTEHEAD_INIT_SIZE , ECL_INT );
|
@ -20,10 +20,10 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_io_config.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_io_config.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
|
||||
|
||||
/**
|
||||
@ -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;
|
@ -22,15 +22,15 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/buffer.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/buffer.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
|
||||
#define ECL_KW_TYPE_ID 6111098
|
||||
@ -162,7 +162,7 @@ void ecl_kw_set_data_type(ecl_kw_type * ecl_kw, ecl_data_type data_type);
|
||||
static char * alloc_read_fmt_string(const ecl_data_type ecl_type) {
|
||||
return util_alloc_sprintf(
|
||||
"%%%dc",
|
||||
ecl_type_get_sizeof_ctype_fortio(ecl_type)
|
||||
ecl_type_get_sizeof_iotype(ecl_type)
|
||||
);
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ static char * alloc_read_fmt(const ecl_data_type data_type ) {
|
||||
static char * alloc_write_fmt_string(const ecl_data_type ecl_type) {
|
||||
return util_alloc_sprintf(
|
||||
" '%%-%ds'",
|
||||
ecl_type_get_sizeof_ctype_fortio(ecl_type)
|
||||
ecl_type_get_sizeof_iotype(ecl_type)
|
||||
);
|
||||
}
|
||||
|
||||
@ -258,12 +258,105 @@ static void ecl_kw_assert_index(const ecl_kw_type *ecl_kw , int index, const cha
|
||||
|
||||
|
||||
|
||||
static void ecl_kw_endian_convert_data(ecl_kw_type *ecl_kw) {
|
||||
if (ecl_type_is_numeric(ecl_kw->data_type) || ecl_type_is_bool(ecl_kw->data_type))
|
||||
util_endian_flip_vector(ecl_kw->data , ecl_kw_get_sizeof_ctype(ecl_kw) , ecl_kw->size);
|
||||
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 = (char*)util_malloc( buffer_size );
|
||||
|
||||
if (ecl_type_is_bool(ecl_kw->data_type)) {
|
||||
int * int_data = (int *) buffer;
|
||||
bool * bool_data = (bool *) ecl_kw->data;
|
||||
|
||||
for (int i=0; i < ecl_kw->size; i++)
|
||||
if (bool_data[i])
|
||||
int_data[i] = ECL_BOOL_TRUE_INT;
|
||||
else
|
||||
int_data[i] = ECL_BOOL_FALSE_INT;
|
||||
|
||||
util_endian_flip_vector(buffer, sizeof_iotype, ecl_kw->size);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
if (ecl_type_is_char(ecl_kw->data_type) || ecl_type_is_string(ecl_kw->data_type)) {
|
||||
size_t sizeof_ctype = ecl_type_get_sizeof_ctype(ecl_kw->data_type);
|
||||
for (int i=0; i < ecl_kw->size; i++) {
|
||||
size_t buffer_offset = i * sizeof_iotype;
|
||||
size_t data_offset = i * sizeof_ctype;
|
||||
memcpy(&buffer[buffer_offset], &ecl_kw->data[data_offset], sizeof_iotype);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
if (ecl_type_is_mess(ecl_kw->data_type))
|
||||
return buffer;
|
||||
|
||||
memcpy(buffer, ecl_kw->data, buffer_size);
|
||||
util_endian_flip_vector(buffer, sizeof_iotype, ecl_kw->size);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
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 = (char*)util_malloc( buffer_size );
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
static void ecl_kw_load_from_input_buffer(ecl_kw_type * ecl_kw, char * buffer) {
|
||||
size_t sizeof_iotype = ecl_type_get_sizeof_iotype(ecl_kw->data_type);
|
||||
size_t sizeof_ctype = ecl_type_get_sizeof_ctype(ecl_kw->data_type);
|
||||
size_t buffer_size = ecl_kw->size * sizeof_iotype;
|
||||
if (ECL_ENDIAN_FLIP) {
|
||||
if (ecl_type_is_numeric(ecl_kw->data_type) || ecl_type_is_bool(ecl_kw->data_type))
|
||||
util_endian_flip_vector(buffer, sizeof_iotype, ecl_kw->size);
|
||||
}
|
||||
|
||||
/*
|
||||
Special case bool: Return Eclipse integer representation of bool to native bool.
|
||||
*/
|
||||
if (ecl_type_is_bool(ecl_kw->data_type)) {
|
||||
int * int_data = (int *) buffer;
|
||||
bool * bool_data = (bool *) ecl_kw->data;
|
||||
|
||||
for (int i=0; i < ecl_kw->size; i++) {
|
||||
if (int_data[i] == ECL_BOOL_TRUE_INT)
|
||||
bool_data[i] = true;
|
||||
else
|
||||
bool_data[i] = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
Special case: insert '\0' termination at end of strings loaded from file.
|
||||
*/
|
||||
if (ecl_type_is_char(ecl_kw->data_type) || ecl_type_is_string(ecl_kw->data_type)) {
|
||||
const char null_char = '\0';
|
||||
for (int i=0; i < ecl_kw->size; i++) {
|
||||
size_t buffer_offset = i * sizeof_iotype;
|
||||
size_t data_offset = i * sizeof_ctype;
|
||||
memcpy(&ecl_kw->data[data_offset], &buffer[buffer_offset], sizeof_iotype);
|
||||
ecl_kw->data[data_offset + sizeof_iotype] = null_char;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (ecl_type_is_mess(ecl_kw->data_type))
|
||||
return;
|
||||
|
||||
/*
|
||||
Plain int, double, float data - that can be copied straight over to the ->data field.
|
||||
*/
|
||||
memcpy(ecl_kw->data, buffer, buffer_size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const char * ecl_kw_get_header8(const ecl_kw_type *ecl_kw) {
|
||||
return ecl_kw->header8;
|
||||
}
|
||||
@ -282,7 +375,7 @@ bool ecl_kw_name_equal( const ecl_kw_type * ecl_kw , const char * name) {
|
||||
|
||||
|
||||
void ecl_kw_get_memcpy_data(const ecl_kw_type *ecl_kw , void *target) {
|
||||
memcpy(target , ecl_kw->data , ecl_kw->size * ecl_kw_get_sizeof_ctype(ecl_kw));
|
||||
memcpy(target , ecl_kw->data , ecl_kw->size * ecl_type_get_sizeof_ctype(ecl_kw->data_type));
|
||||
}
|
||||
|
||||
void ecl_kw_get_memcpy_int_data(const ecl_kw_type *ecl_kw , int * target) {
|
||||
@ -303,14 +396,14 @@ if (ecl_type_is_double(ecl_kw->data_type))
|
||||
|
||||
/** Allocates a untyped buffer with exactly the same content as the ecl_kw instances data. */
|
||||
void * ecl_kw_alloc_data_copy(const ecl_kw_type * ecl_kw) {
|
||||
void * buffer = util_alloc_copy( ecl_kw->data , ecl_kw->size * ecl_kw_get_sizeof_ctype(ecl_kw) );
|
||||
void * buffer = util_alloc_copy( ecl_kw->data , ecl_kw->size * ecl_type_get_sizeof_ctype(ecl_kw->data_type) );
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
void ecl_kw_set_memcpy_data(ecl_kw_type *ecl_kw , const void *src) {
|
||||
if (src != NULL)
|
||||
memcpy(ecl_kw->data , src , ecl_kw->size * ecl_kw_get_sizeof_ctype(ecl_kw));
|
||||
memcpy(ecl_kw->data , src , ecl_kw->size * ecl_type_get_sizeof_ctype(ecl_kw->data_type));
|
||||
}
|
||||
|
||||
|
||||
@ -363,7 +456,7 @@ bool ecl_kw_header_eq(const ecl_kw_type *ecl_kw1 , const ecl_kw_type * ecl_kw2)
|
||||
}
|
||||
|
||||
static bool ecl_kw_data_equal__( const ecl_kw_type * ecl_kw , const void * data , int cmp_elements) {
|
||||
int cmp = memcmp( ecl_kw->data , data , cmp_elements * ecl_kw_get_sizeof_ctype(ecl_kw));
|
||||
int cmp = memcmp( ecl_kw->data , data , cmp_elements * ecl_type_get_sizeof_ctype(ecl_kw->data_type));
|
||||
if (cmp == 0)
|
||||
return true;
|
||||
else
|
||||
@ -468,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;
|
||||
}
|
||||
|
||||
|
||||
@ -484,7 +577,7 @@ static size_t ecl_kw_fortio_data_size( const ecl_kw_type * ecl_kw) {
|
||||
const int num_blocks = ecl_kw->size / blocksize + (ecl_kw->size % blocksize == 0 ? 0 : 1);
|
||||
|
||||
return num_blocks * (4 + 4) + // Fortran fluff for each block
|
||||
ecl_kw->size * ecl_type_get_sizeof_ctype_fortio( ecl_kw->data_type ); // Actual data
|
||||
ecl_kw->size * ecl_type_get_sizeof_iotype( ecl_kw->data_type ); // Actual data
|
||||
}
|
||||
|
||||
|
||||
@ -543,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;
|
||||
@ -573,7 +666,7 @@ void ecl_kw_memcpy_data( ecl_kw_type * target , const ecl_kw_type * src) {
|
||||
if (!ecl_kw_size_and_type_equal( target , src ))
|
||||
util_abort("%s: type/size mismatch \n",__func__);
|
||||
|
||||
memcpy(target->data , src->data , target->size * ecl_kw_get_sizeof_ctype(target));
|
||||
memcpy(target->data , src->data , target->size * ecl_type_get_sizeof_ctype(target->data_type));
|
||||
}
|
||||
|
||||
|
||||
@ -589,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_;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -637,7 +730,7 @@ ecl_kw_type * ecl_kw_alloc_slice_copy( const ecl_kw_type * src, int index1, int
|
||||
int target_index = 0;
|
||||
const char * src_ptr = src->data;
|
||||
char * new_ptr = new_kw->data;
|
||||
int sizeof_ctype = ecl_kw_get_sizeof_ctype(new_kw);
|
||||
int sizeof_ctype = ecl_type_get_sizeof_ctype(new_kw->data_type);
|
||||
|
||||
while ( src_index < index2 ) {
|
||||
memcpy( &new_ptr[ target_index * sizeof_ctype ] , &src_ptr[ src_index * sizeof_ctype ] , sizeof_ctype );
|
||||
@ -658,10 +751,10 @@ void ecl_kw_resize( ecl_kw_type * ecl_kw, int new_size) {
|
||||
util_abort("%s: trying to allocate data for ecl_kw object which has been declared with shared storage - aborting \n",__func__);
|
||||
|
||||
if (new_size != ecl_kw->size) {
|
||||
size_t old_byte_size = ecl_kw->size * ecl_kw_get_sizeof_ctype(ecl_kw);
|
||||
size_t new_byte_size = new_size * ecl_kw_get_sizeof_ctype(ecl_kw);
|
||||
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);
|
||||
@ -703,18 +796,19 @@ const void * ecl_kw_copyc__(const void * void_kw) {
|
||||
|
||||
static void * ecl_kw_iget_ptr_static(const ecl_kw_type *ecl_kw , int i) {
|
||||
ecl_kw_assert_index(ecl_kw , i , __func__);
|
||||
return &ecl_kw->data[i * ecl_kw_get_sizeof_ctype(ecl_kw)];
|
||||
return &ecl_kw->data[i * ecl_type_get_sizeof_ctype(ecl_kw->data_type)];
|
||||
}
|
||||
|
||||
|
||||
static void ecl_kw_iget_static(const ecl_kw_type *ecl_kw , int i , void *iptr) {
|
||||
memcpy(iptr , ecl_kw_iget_ptr_static(ecl_kw , i) , ecl_kw_get_sizeof_ctype(ecl_kw));
|
||||
memcpy(iptr , ecl_kw_iget_ptr_static(ecl_kw , i) , ecl_type_get_sizeof_ctype(ecl_kw->data_type));
|
||||
}
|
||||
|
||||
|
||||
static void ecl_kw_iset_static(ecl_kw_type *ecl_kw , int i , const void *iptr) {
|
||||
size_t sizeof_ctype = ecl_type_get_sizeof_ctype(ecl_kw->data_type);
|
||||
ecl_kw_assert_index(ecl_kw , i , __func__);
|
||||
memcpy(&ecl_kw->data[i * ecl_kw_get_sizeof_ctype(ecl_kw)] , iptr, ecl_kw_get_sizeof_ctype(ecl_kw));
|
||||
memcpy(&ecl_kw->data[i * sizeof_ctype] , iptr, sizeof_ctype);
|
||||
}
|
||||
|
||||
|
||||
@ -768,34 +862,20 @@ ctype ecl_kw_iget_ ## ctype(const ecl_kw_type * ecl_kw, int i) {
|
||||
ECL_KW_IGET_TYPED(double , ECL_DOUBLE_TYPE);
|
||||
ECL_KW_IGET_TYPED(float , ECL_FLOAT_TYPE);
|
||||
ECL_KW_IGET_TYPED(int , ECL_INT_TYPE);
|
||||
ECL_KW_IGET_TYPED(bool , ECL_BOOL_TYPE);
|
||||
#undef ECL_KW_IGET_TYPED
|
||||
|
||||
|
||||
bool ecl_kw_iget_bool( const ecl_kw_type * ecl_kw , int i) {
|
||||
int int_value;
|
||||
if (ecl_kw_get_type(ecl_kw) != ECL_BOOL_TYPE)
|
||||
util_abort("%s: Keyword: %s is wrong type - aborting \n",__func__ , ecl_kw_get_header8(ecl_kw));
|
||||
ecl_kw_iget_static(ecl_kw , i , &int_value);
|
||||
if (int_value == ECL_BOOL_TRUE_INT)
|
||||
return true;
|
||||
else if (int_value == ECL_BOOL_FALSE_INT)
|
||||
return false;
|
||||
else {
|
||||
util_abort("%s: fuckup - wrong integer in BOOL type \n",__func__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
@ -864,7 +944,7 @@ void ecl_kw_iset_string_ptr( ecl_kw_type * ecl_kw, int index, const char * s) {
|
||||
}
|
||||
|
||||
size_t input_len = strlen(s);
|
||||
size_t type_len = ecl_type_get_sizeof_ctype_fortio(ecl_kw_get_data_type(ecl_kw));
|
||||
size_t type_len = ecl_type_get_sizeof_iotype(ecl_kw->data_type);
|
||||
|
||||
if(input_len > type_len)
|
||||
util_abort("%s: String of length %d cannot hold input string of length %d\n", __func__, type_len, input_len);
|
||||
@ -892,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;
|
||||
}
|
||||
@ -914,6 +994,7 @@ void ecl_kw_iset_ ## ctype(ecl_kw_type * ecl_kw, int i, ctype value) {
|
||||
ECL_KW_ISET_TYPED(double , ECL_DOUBLE_TYPE);
|
||||
ECL_KW_ISET_TYPED(float , ECL_FLOAT_TYPE);
|
||||
ECL_KW_ISET_TYPED(int , ECL_INT_TYPE);
|
||||
ECL_KW_ISET_TYPED(bool , ECL_BOOL_TYPE);
|
||||
#undef ECL_KW_ISET_TYPED
|
||||
|
||||
|
||||
@ -978,20 +1059,6 @@ ECL_KW_SCALE_INDEXED( int , ECL_INT_TYPE);
|
||||
#undef ECL_KW_SCALE_INDEXED
|
||||
|
||||
|
||||
void ecl_kw_iset_bool( ecl_kw_type * ecl_kw , int i , bool bool_value) {
|
||||
int int_value;
|
||||
if (ecl_kw_get_type(ecl_kw) != ECL_BOOL_TYPE)
|
||||
util_abort("%s: Keyword: %s is wrong type - aborting \n",__func__ , ecl_kw_get_header8(ecl_kw));
|
||||
|
||||
if (bool_value)
|
||||
int_value = ECL_BOOL_TRUE_INT;
|
||||
else
|
||||
int_value = ECL_BOOL_FALSE_INT;
|
||||
|
||||
ecl_kw_iset_static(ecl_kw , i , &int_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
/* Various ways to get pointers to the underlying data. */
|
||||
@ -1006,6 +1073,7 @@ ctype * ecl_kw_get_ ## ctype ## _ptr(const ecl_kw_type * ecl_kw) {
|
||||
ECL_KW_GET_TYPED_PTR(double , ECL_DOUBLE_TYPE);
|
||||
ECL_KW_GET_TYPED_PTR(float , ECL_FLOAT_TYPE);
|
||||
ECL_KW_GET_TYPED_PTR(int , ECL_INT_TYPE);
|
||||
ECL_KW_GET_TYPED_PTR(bool , ECL_BOOL_TYPE);
|
||||
#undef ECL_KW_GET_TYPED_PTR
|
||||
|
||||
void * ecl_kw_get_void_ptr(const ecl_kw_type * ecl_kw) {
|
||||
@ -1091,7 +1159,6 @@ static double __fscanf_ECL_double( FILE * stream , const char * fmt) {
|
||||
}
|
||||
|
||||
bool ecl_kw_fread_data(ecl_kw_type *ecl_kw, fortio_type *fortio) {
|
||||
const char null_char = '\0';
|
||||
bool fmt_file = fortio_fmt_file( fortio );
|
||||
if (ecl_kw->size > 0) {
|
||||
const int blocksize = get_blocksize( ecl_kw->data_type );
|
||||
@ -1113,7 +1180,7 @@ bool ecl_kw_fread_data(ecl_kw_type *ecl_kw, fortio_type *fortio) {
|
||||
ecl_kw_fscanf_qstring(
|
||||
&ecl_kw->data[offset],
|
||||
read_fmt,
|
||||
ecl_type_get_sizeof_ctype_fortio(ecl_kw_get_data_type(ecl_kw)),
|
||||
ecl_type_get_sizeof_iotype(ecl_kw_get_data_type(ecl_kw)),
|
||||
stream
|
||||
);
|
||||
break;
|
||||
@ -1121,7 +1188,10 @@ bool ecl_kw_fread_data(ecl_kw_type *ecl_kw, fortio_type *fortio) {
|
||||
{
|
||||
int iread = fscanf(stream , read_fmt , (int *) &ecl_kw->data[offset]);
|
||||
if (iread != 1)
|
||||
util_abort("%s: after reading %d values reading of keyword:%s from:%s failed - aborting \n",__func__ , offset / ecl_kw_get_sizeof_ctype(ecl_kw) , ecl_kw->header8 , fortio_filename_ref(fortio));
|
||||
util_abort("%s: after reading %d values reading of keyword:%s from:%s failed - aborting \n",__func__,
|
||||
offset / ecl_type_get_sizeof_ctype(ecl_kw->data_type),
|
||||
ecl_kw->header8,
|
||||
fortio_filename_ref(fortio));
|
||||
}
|
||||
break;
|
||||
case(ECL_FLOAT_TYPE):
|
||||
@ -1129,7 +1199,7 @@ bool ecl_kw_fread_data(ecl_kw_type *ecl_kw, fortio_type *fortio) {
|
||||
int iread = fscanf(stream , read_fmt , (float *) &ecl_kw->data[offset]);
|
||||
if (iread != 1) {
|
||||
util_abort("%s: after reading %d values reading of keyword:%s from:%s failed - aborting \n",__func__,
|
||||
offset / ecl_kw_get_sizeof_ctype(ecl_kw) ,
|
||||
offset / ecl_type_get_sizeof_ctype(ecl_kw->data_type),
|
||||
ecl_kw->header8,
|
||||
fortio_filename_ref(fortio));
|
||||
}
|
||||
@ -1161,7 +1231,7 @@ bool ecl_kw_fread_data(ecl_kw_type *ecl_kw, fortio_type *fortio) {
|
||||
default:
|
||||
util_abort("%s: Internal error: internal eclipse_type: %d not recognized - aborting \n",__func__ , ecl_kw_get_type(ecl_kw));
|
||||
}
|
||||
offset += ecl_kw_get_sizeof_ctype(ecl_kw);
|
||||
offset += ecl_type_get_sizeof_ctype(ecl_kw->data_type);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@ -1171,46 +1241,14 @@ bool ecl_kw_fread_data(ecl_kw_type *ecl_kw, fortio_type *fortio) {
|
||||
free(read_fmt);
|
||||
return true;
|
||||
} else {
|
||||
bool read_ok = true;
|
||||
if (ecl_type_is_char(ecl_kw->data_type) || ecl_type_is_mess(ecl_kw->data_type) || ecl_type_is_string(ecl_kw->data_type)) {
|
||||
const int blocks = ecl_kw->size / blocksize + (ecl_kw->size % blocksize == 0 ? 0 : 1);
|
||||
int ib = 0;
|
||||
while (true) {
|
||||
/*
|
||||
Due to the necessary terminating \0 characters there is
|
||||
not a continous file/memory mapping.
|
||||
*/
|
||||
int read_elm = util_int_min((ib + 1) * blocksize , ecl_kw->size) - ib * blocksize;
|
||||
FILE * stream = fortio_get_FILE(fortio);
|
||||
int record_size = fortio_init_read(fortio);
|
||||
if (record_size >= 0) {
|
||||
int ir;
|
||||
const int sizeof_ctype = ecl_type_get_sizeof_ctype(ecl_kw->data_type);
|
||||
const int sizeof_ctype_fortio = ecl_type_get_sizeof_ctype_fortio(ecl_kw->data_type);
|
||||
for (ir = 0; ir < read_elm; ir++) {
|
||||
util_fread( &ecl_kw->data[(ib * blocksize + ir) * sizeof_ctype] , 1 , sizeof_ctype_fortio , stream , __func__);
|
||||
ecl_kw->data[(ib * blocksize + ir) * sizeof_ctype + sizeof_ctype_fortio] = null_char;
|
||||
}
|
||||
read_ok = fortio_complete_read(fortio , record_size);
|
||||
} else
|
||||
read_ok = false;
|
||||
char * buffer = ecl_kw_alloc_input_buffer(ecl_kw);
|
||||
const int sizeof_iotype = ecl_type_get_sizeof_iotype(ecl_kw->data_type);
|
||||
bool read_ok = fortio_fread_buffer(fortio, buffer, ecl_kw->size * sizeof_iotype);
|
||||
|
||||
if (!read_ok)
|
||||
break;
|
||||
if (read_ok)
|
||||
ecl_kw_load_from_input_buffer(ecl_kw, buffer);
|
||||
|
||||
ib++;
|
||||
if (ib == blocks)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
This function handles the fuc***g blocks transparently at a
|
||||
low level.
|
||||
*/
|
||||
read_ok = fortio_fread_buffer(fortio , ecl_kw->data , ecl_kw->size * ecl_kw_get_sizeof_ctype(ecl_kw));
|
||||
if (read_ok && ECL_ENDIAN_FLIP)
|
||||
ecl_kw_endian_convert_data(ecl_kw);
|
||||
}
|
||||
free(buffer);
|
||||
return read_ok;
|
||||
}
|
||||
} else
|
||||
@ -1219,30 +1257,24 @@ bool ecl_kw_fread_data(ecl_kw_type *ecl_kw, fortio_type *fortio) {
|
||||
}
|
||||
|
||||
|
||||
void ecl_kw_fread_indexed_data(fortio_type * fortio, offset_type data_offset, ecl_data_type data_type, int element_count, const int_vector_type* index_map, char* buffer) {
|
||||
void ecl_kw_fread_indexed_data(fortio_type * fortio, offset_type data_offset, ecl_data_type data_type, int element_count, const int_vector_type* index_map, char* io_buffer) {
|
||||
const int block_size = get_blocksize(data_type);
|
||||
FILE *stream = fortio_get_FILE( fortio );
|
||||
int index;
|
||||
int element_size = ecl_type_get_sizeof_ctype(data_type);
|
||||
|
||||
if(ecl_type_is_char(data_type) || ecl_type_is_mess(data_type)) {
|
||||
element_size = ECL_STRING8_LENGTH;
|
||||
}
|
||||
|
||||
int sizeof_iotype = ecl_type_get_sizeof_iotype(data_type);
|
||||
|
||||
for(index = 0; index < int_vector_size(index_map); index++) {
|
||||
int element_index = int_vector_iget(index_map, index);
|
||||
|
||||
if(element_index < 0 || element_index >= element_count) {
|
||||
if(element_index < 0 || element_index >= element_count)
|
||||
util_abort("%s: Element index is out of range 0 <= %d < %d\n", __func__, element_index, element_count);
|
||||
}
|
||||
fortio_data_fseek(fortio, data_offset, element_index, element_size, element_count, block_size);
|
||||
util_fread(&buffer[index * element_size], element_size, 1, stream, __func__);
|
||||
|
||||
fortio_data_fseek(fortio, data_offset, element_index, sizeof_iotype, element_count, block_size);
|
||||
util_fread(&io_buffer[index * sizeof_iotype], sizeof_iotype, 1, stream, __func__);
|
||||
}
|
||||
|
||||
if (ECL_ENDIAN_FLIP) {
|
||||
util_endian_flip_vector(buffer, element_size, int_vector_size(index_map));
|
||||
}
|
||||
if (ECL_ENDIAN_FLIP)
|
||||
util_endian_flip_vector(io_buffer, sizeof_iotype, int_vector_size(index_map));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1272,7 +1304,7 @@ bool ecl_kw_fskip_data__( ecl_data_type data_type , const int element_count , fo
|
||||
} else {
|
||||
const int blocksize = get_blocksize( data_type );
|
||||
const int block_count = element_count / blocksize + (element_count % blocksize != 0);
|
||||
int element_size = ecl_type_get_sizeof_ctype_fortio(data_type);
|
||||
int element_size = ecl_type_get_sizeof_iotype(data_type);
|
||||
|
||||
if(!fortio_data_fskip(fortio, element_size, element_count, block_count))
|
||||
return false;
|
||||
@ -1452,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;
|
||||
}
|
||||
|
||||
|
||||
@ -1464,8 +1496,8 @@ void ecl_kw_alloc_data(ecl_kw_type *ecl_kw) {
|
||||
util_abort("%s: trying to allocate data for ecl_kw object which has been declared with shared storage - aborting \n",__func__);
|
||||
|
||||
{
|
||||
size_t byte_size = ecl_kw->size * ecl_kw_get_sizeof_ctype(ecl_kw);
|
||||
ecl_kw->data = util_realloc(ecl_kw->data , byte_size );
|
||||
size_t byte_size = ecl_kw->size * ecl_type_get_sizeof_ctype(ecl_kw->data_type);
|
||||
ecl_kw->data = (char*)util_realloc(ecl_kw->data , byte_size );
|
||||
memset(ecl_kw->data , 0 , byte_size);
|
||||
}
|
||||
}
|
||||
@ -1482,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);
|
||||
|
||||
@ -1491,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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1545,10 +1577,9 @@ void ecl_kw_fskip(fortio_type *fortio) {
|
||||
|
||||
|
||||
|
||||
static void ecl_kw_fwrite_data_unformatted( ecl_kw_type * ecl_kw , fortio_type * fortio ) {
|
||||
if (ECL_ENDIAN_FLIP)
|
||||
ecl_kw_endian_convert_data(ecl_kw);
|
||||
|
||||
static void ecl_kw_fwrite_data_unformatted( const ecl_kw_type * ecl_kw , fortio_type * fortio ) {
|
||||
char * iobuffer = ecl_kw_alloc_output_buffer(ecl_kw);
|
||||
int sizeof_iotype = ecl_type_get_sizeof_iotype(ecl_kw->data_type);
|
||||
{
|
||||
const int blocksize = get_blocksize( ecl_kw->data_type );
|
||||
const int num_blocks = ecl_kw->size / blocksize + (ecl_kw->size % blocksize == 0 ? 0 : 1);
|
||||
@ -1556,29 +1587,11 @@ static void ecl_kw_fwrite_data_unformatted( ecl_kw_type * ecl_kw , fortio_type *
|
||||
|
||||
for (block_nr = 0; block_nr < num_blocks; block_nr++) {
|
||||
int this_blocksize = util_int_min((block_nr + 1)*blocksize , ecl_kw->size) - block_nr*blocksize;
|
||||
if (ecl_type_is_char(ecl_kw->data_type) || ecl_type_is_mess(ecl_kw->data_type) || ecl_type_is_string(ecl_kw->data_type)) {
|
||||
/*
|
||||
Due to the terminating \0 characters there is not a
|
||||
continous file/memory mapping - the \0 characters arel
|
||||
skipped.
|
||||
*/
|
||||
FILE *stream = fortio_get_FILE(fortio);
|
||||
int word_size = ecl_type_get_sizeof_ctype_fortio(ecl_kw->data_type);
|
||||
int record_size = this_blocksize * word_size; /* The total size in bytes of the record written by the fortio layer. */
|
||||
int i;
|
||||
fortio_init_write(fortio , record_size );
|
||||
for (i = 0; i < this_blocksize; i++)
|
||||
fwrite(&ecl_kw->data[(block_nr * blocksize + i) * ecl_kw_get_sizeof_ctype(ecl_kw)] , 1 , word_size , stream);
|
||||
fortio_complete_write(fortio , record_size);
|
||||
} else {
|
||||
int record_size = this_blocksize * ecl_kw_get_sizeof_ctype(ecl_kw); /* The total size in bytes of the record written by the fortio layer. */
|
||||
fortio_fwrite_record(fortio , &ecl_kw->data[block_nr * blocksize * ecl_kw_get_sizeof_ctype(ecl_kw)] , record_size);
|
||||
int record_size = this_blocksize * sizeof_iotype; /* The total size in bytes of the record written by the fortio layer. */
|
||||
fortio_fwrite_record(fortio , &iobuffer[block_nr * blocksize * sizeof_iotype] , record_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ECL_ENDIAN_FLIP)
|
||||
ecl_kw_endian_convert_data(ecl_kw);
|
||||
free(iobuffer);
|
||||
}
|
||||
|
||||
|
||||
@ -1761,10 +1774,6 @@ ecl_data_type ecl_kw_get_data_type(const ecl_kw_type * ecl_kw) {
|
||||
return ecl_kw->data_type;
|
||||
}
|
||||
|
||||
size_t ecl_kw_get_sizeof_ctype(const ecl_kw_type * ecl_kw) {
|
||||
return ecl_type_get_sizeof_ctype(ecl_kw->data_type);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
@ -1772,14 +1781,14 @@ size_t ecl_kw_get_sizeof_ctype(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);
|
||||
ecl_kw_type * ecl_kw = ecl_kw_alloc_empty();
|
||||
ecl_kw_initialize( ecl_kw , header , size , data_type );
|
||||
ecl_kw_alloc_data(ecl_kw);
|
||||
buffer_fread(buffer , ecl_kw->data , ecl_kw_get_sizeof_ctype(ecl_kw) , ecl_kw->size);
|
||||
buffer_fread(buffer , ecl_kw->data , ecl_type_get_sizeof_ctype(ecl_kw->data_type) , ecl_kw->size);
|
||||
return ecl_kw;
|
||||
}
|
||||
|
||||
@ -1789,7 +1798,7 @@ void ecl_kw_buffer_store(const ecl_kw_type * ecl_kw , buffer_type * buffer) {
|
||||
buffer_fwrite_int( buffer , ecl_kw->size );
|
||||
buffer_fwrite_int( buffer , ecl_type_get_type(ecl_kw->data_type) );
|
||||
buffer_fwrite_int( buffer , ecl_type_get_sizeof_ctype(ecl_kw->data_type));
|
||||
buffer_fwrite( buffer , ecl_kw->data , ecl_kw_get_sizeof_ctype(ecl_kw) , ecl_kw->size);
|
||||
buffer_fwrite( buffer , ecl_kw->data , ecl_type_get_sizeof_ctype(ecl_kw->data_type) , ecl_kw->size);
|
||||
}
|
||||
|
||||
|
||||
@ -1877,7 +1886,7 @@ ecl_kw_type * ecl_kw_alloc_scatter_copy( const ecl_kw_type * src_kw , int target
|
||||
int default_int = 0;
|
||||
double default_double = 0;
|
||||
float default_float = 0;
|
||||
int default_bool = ECL_BOOL_FALSE_INT;
|
||||
bool default_bool = false;
|
||||
const char * default_char = "";
|
||||
ecl_kw_type * new_kw = ecl_kw_alloc( src_kw->header , target_size , src_kw->data_type );
|
||||
|
||||
@ -1982,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; \
|
||||
@ -1992,26 +2001,9 @@ void ecl_kw_scalar_set_ ## ctype( ecl_kw_type * ecl_kw , ctype value){ \
|
||||
ECL_KW_SCALAR_SET_TYPED( int , ECL_INT_TYPE )
|
||||
ECL_KW_SCALAR_SET_TYPED( float , ECL_FLOAT_TYPE )
|
||||
ECL_KW_SCALAR_SET_TYPED( double , ECL_DOUBLE_TYPE )
|
||||
ECL_KW_SCALAR_SET_TYPED( bool , ECL_BOOL_TYPE )
|
||||
#undef ECL_KW_SCALAR_SET_TYPED
|
||||
|
||||
void ecl_kw_scalar_set_bool( ecl_kw_type * ecl_kw , bool bool_value) {
|
||||
if (ecl_kw_get_type(ecl_kw) != ECL_BOOL_TYPE)
|
||||
util_abort("%s: Keyword: %s is wrong type - aborting \n",__func__ , ecl_kw_get_header8(ecl_kw));
|
||||
{
|
||||
int * data = ecl_kw_get_data_ref(ecl_kw);
|
||||
int int_value;
|
||||
if (bool_value)
|
||||
int_value = ECL_BOOL_TRUE_INT;
|
||||
else
|
||||
int_value = ECL_BOOL_FALSE_INT;
|
||||
{
|
||||
int i;
|
||||
for ( i=0; i < ecl_kw->size; i++)
|
||||
data[i] = int_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ecl_kw_scalar_set_float_or_double( ecl_kw_type * ecl_kw , double value ) {
|
||||
ecl_type_enum ecl_type = ecl_kw_get_type(ecl_kw);
|
||||
@ -2040,12 +2032,12 @@ void ecl_kw_scalar_set__(ecl_kw_type * ecl_kw , const void * value) {
|
||||
|
||||
void ecl_kw_alloc_double_data(ecl_kw_type * ecl_kw , double * values) {
|
||||
ecl_kw_alloc_data(ecl_kw);
|
||||
memcpy(ecl_kw->data , values , ecl_kw->size * ecl_kw_get_sizeof_ctype(ecl_kw));
|
||||
memcpy(ecl_kw->data , values , ecl_kw->size * ecl_type_get_sizeof_ctype(ecl_kw->data_type));
|
||||
}
|
||||
|
||||
void ecl_kw_alloc_float_data(ecl_kw_type * ecl_kw , float * values) {
|
||||
ecl_kw_alloc_data(ecl_kw);
|
||||
memcpy(ecl_kw->data , values , ecl_kw->size * ecl_kw_get_sizeof_ctype(ecl_kw));
|
||||
memcpy(ecl_kw->data , values , ecl_kw->size * ecl_type_get_sizeof_ctype(ecl_kw->data_type));
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
@ -2056,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++) \
|
||||
@ -2085,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++) \
|
||||
@ -2134,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 );
|
||||
@ -2154,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; \
|
||||
@ -2197,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]; \
|
||||
@ -2232,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]; \
|
||||
@ -2272,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]; \
|
||||
@ -2306,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; \
|
||||
@ -2346,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]); \
|
||||
@ -2384,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]); \
|
||||
@ -2423,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]; \
|
||||
@ -2457,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; \
|
||||
@ -2501,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]; \
|
||||
@ -2536,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; \
|
||||
@ -2582,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];
|
||||
@ -2685,14 +2677,14 @@ 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; \
|
||||
for (i=1; i < ecl_kw_get_size(ecl_kw); i++) \
|
||||
util_update_ ## type ## _max_min(data[i] , &max , &min); \
|
||||
memcpy(_max , &max , ecl_kw_get_sizeof_ctype(ecl_kw)); \
|
||||
memcpy(_min , &min , ecl_kw_get_sizeof_ctype(ecl_kw)); \
|
||||
memcpy(_max , &max , ecl_type_get_sizeof_ctype(ecl_kw->data_type)); \
|
||||
memcpy(_min , &min , ecl_type_get_sizeof_ctype(ecl_kw->data_type)); \
|
||||
}
|
||||
|
||||
|
||||
@ -2753,13 +2745,13 @@ 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 ); \
|
||||
for (int i = 0; i < size; i++) \
|
||||
sum += data[index_ptr[i]]; \
|
||||
memcpy(_sum , &sum , ecl_kw_get_sizeof_ctype(ecl_kw)); \
|
||||
memcpy(_sum , &sum , ecl_type_get_sizeof_ctype(ecl_kw->data_type)); \
|
||||
}
|
||||
|
||||
|
||||
@ -2776,12 +2768,12 @@ void ecl_kw_element_sum_indexed(const ecl_kw_type * ecl_kw , const int_vector_ty
|
||||
break;
|
||||
case(ECL_BOOL_TYPE):
|
||||
{
|
||||
const int * 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;
|
||||
for (int i = 0; i < size; i++)
|
||||
sum += (data[index_ptr[i]] == ECL_BOOL_TRUE_INT);
|
||||
sum += (data[index_ptr[i]]);
|
||||
|
||||
memcpy(_sum , &sum , sizeof sum);
|
||||
}
|
||||
@ -2801,11 +2793,11 @@ 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]; \
|
||||
memcpy(_sum , &sum , ecl_kw_get_sizeof_ctype(ecl_kw)); \
|
||||
memcpy(_sum , &sum , ecl_type_get_sizeof_ctype(ecl_kw->data_type)); \
|
||||
}
|
||||
|
||||
|
||||
@ -2872,24 +2864,13 @@ static void ecl_kw_fprintf_data_ ## ctype(const ecl_kw_type * ecl_kw , const cha
|
||||
ECL_KW_FPRINTF_DATA( int )
|
||||
ECL_KW_FPRINTF_DATA( float )
|
||||
ECL_KW_FPRINTF_DATA( double )
|
||||
ECL_KW_FPRINTF_DATA( bool )
|
||||
#undef ECL_KW_FPRINTF_DATA
|
||||
|
||||
static void ecl_kw_fprintf_data_bool( const ecl_kw_type * ecl_kw , const char * fmt , FILE * stream) {
|
||||
const int * data = (const int *) ecl_kw->data;
|
||||
int i;
|
||||
for (i=0; i < ecl_kw->size; i++) {
|
||||
if (data[i] == ECL_BOOL_TRUE_INT)
|
||||
fprintf(stream , fmt , 1);
|
||||
else
|
||||
fprintf(stream , fmt , 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ecl_kw_fprintf_data_string( const ecl_kw_type * ecl_kw , const char * fmt , FILE * stream) {
|
||||
int i;
|
||||
for (i=0; i < ecl_kw->size; i++)
|
||||
fprintf(stream , fmt , &ecl_kw->data[ i * ecl_kw_get_sizeof_ctype(ecl_kw)]);
|
||||
fprintf(stream , fmt , &ecl_kw->data[ i * ecl_type_get_sizeof_ctype(ecl_kw->data_type)]);
|
||||
}
|
||||
|
||||
|
||||
@ -2916,8 +2897,8 @@ static bool ecl_kw_elm_equal_numeric__( const ecl_kw_type * ecl_kw1 , const ecl_
|
||||
|
||||
|
||||
static bool ecl_kw_elm_equal__( const ecl_kw_type * ecl_kw1 , const ecl_kw_type * ecl_kw2 , int offset) {
|
||||
size_t data_offset = ecl_kw_get_sizeof_ctype(ecl_kw1) * offset;
|
||||
int cmp = memcmp( &ecl_kw1->data[ data_offset ] , &ecl_kw2->data[ data_offset ] , ecl_kw_get_sizeof_ctype(ecl_kw1));
|
||||
size_t data_offset = ecl_type_get_sizeof_ctype(ecl_kw1->data_type) * offset;
|
||||
int cmp = memcmp( &ecl_kw1->data[ data_offset ] , &ecl_kw2->data[ data_offset ] , ecl_type_get_sizeof_ctype(ecl_kw1->data_type));
|
||||
if (cmp == 0)
|
||||
return true;
|
||||
else
|
||||
@ -2956,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"
|
@ -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);
|
@ -19,11 +19,11 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
|
||||
#define MAX_GRDECL_HEADER_SIZE 512
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
@ -18,12 +18,12 @@
|
||||
|
||||
#define ECL_NNC_DATA_TYPE_ID 83756236
|
||||
|
||||
#include <ert/ecl/ecl_nnc_data.h>
|
||||
#include <ert/ecl/ecl_nnc_geometry.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_file_view.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_nnc_data.hpp>
|
||||
#include <ert/ecl/ecl_nnc_geometry.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
|
||||
enum kw_data_type {
|
||||
TRANS_DATA = 1,
|
||||
@ -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;
|
@ -17,13 +17,13 @@
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_nnc_export.h>
|
||||
#include <ert/ecl/nnc_info.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_nnc_export.hpp>
|
||||
#include <ert/ecl/nnc_info.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
|
||||
|
||||
int ecl_nnc_export_get_size( const ecl_grid_type * grid ) {
|
||||
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <ert/util/struct_vector.h>
|
||||
|
||||
#include <ert/ecl/ecl_nnc_geometry.h>
|
||||
#include <ert/ecl/ecl_nnc_geometry.hpp>
|
||||
|
||||
#define ECL_NNC_GEOMETRY_TYPE_ID 6124343
|
||||
|
||||
@ -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 );
|
||||
|
||||
}
|
||||
|
@ -20,17 +20,17 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/geometry/geo_util.h>
|
||||
#include <ert/geometry/geo_polygon.h>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_box.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_region.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_box.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_region.hpp>
|
||||
|
||||
|
||||
/**
|
||||
@ -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);
|
@ -23,13 +23,13 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_rft_cell.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_rft_cell.hpp>
|
||||
|
||||
|
||||
#define ECL_RFT_CELL_TYPE_ID 99164012
|
||||
@ -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 );
|
||||
}
|
@ -25,16 +25,16 @@
|
||||
#include <fnmatch.h>
|
||||
#endif
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_rft_file.h>
|
||||
#include <ert/ecl/ecl_rft_node.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_rft_file.hpp>
|
||||
#include <ert/ecl/ecl_rft_node.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
|
||||
|
||||
/**
|
||||
@ -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);
|
||||
}
|
||||
|
@ -23,18 +23,18 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_file_view.h>
|
||||
#include <ert/ecl/ecl_rft_node.h>
|
||||
#include <ert/ecl/ecl_rft_cell.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
#include <ert/ecl/ecl_rft_node.hpp>
|
||||
#include <ert/ecl/ecl_rft_cell.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
|
||||
/**
|
||||
@ -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;i<size_cells;i++){
|
||||
const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , 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);
|
@ -23,21 +23,21 @@
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_file_kw.h>
|
||||
#include <ert/ecl/ecl_rst_file.h>
|
||||
#include <ert/ecl/ecl_rsthead.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_file_kw.hpp>
|
||||
#include <ert/ecl/ecl_rst_file.hpp>
|
||||
#include <ert/ecl/ecl_rsthead.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
struct ecl_rst_file_struct {
|
||||
fortio_type * fortio;
|
||||
@ -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;
|
@ -17,13 +17,13 @@
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_file_view.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_rsthead.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_rsthead.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
|
||||
|
||||
static time_t rsthead_date( int day , int month , int year) {
|
||||
@ -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 );
|
||||
@ -88,10 +88,7 @@ ecl_rsthead_type * ecl_rsthead_alloc_from_kw( int report_step , const ecl_kw_typ
|
||||
// The only derived quantity
|
||||
rsthead->sim_time = rsthead_date( rsthead->day , rsthead->month , rsthead->year );
|
||||
}
|
||||
|
||||
if (doubhead_kw)
|
||||
rsthead->sim_days = ecl_kw_iget_double( doubhead_kw , DOUBHEAD_DAYS_INDEX );
|
||||
|
||||
if (logihead_kw)
|
||||
rsthead->dualp = ecl_kw_iget_bool( logihead_kw , LOGIHEAD_DUALP_INDEX);
|
||||
|
||||
@ -112,15 +109,12 @@ ecl_rsthead_type * ecl_rsthead_alloc_from_kw( int report_step , const ecl_kw_typ
|
||||
|
||||
ecl_rsthead_type * ecl_rsthead_alloc( const ecl_file_view_type * rst_view, int report_step) {
|
||||
const ecl_kw_type * intehead_kw = ecl_file_view_iget_named_kw( rst_view , INTEHEAD_KW , 0);
|
||||
const ecl_kw_type * doubhead_kw = NULL;
|
||||
const ecl_kw_type * doubhead_kw = ecl_file_view_iget_named_kw( rst_view , DOUBHEAD_KW , 0);
|
||||
const ecl_kw_type * logihead_kw = NULL;
|
||||
|
||||
if (ecl_file_view_has_kw(rst_view, LOGIHEAD_KW))
|
||||
logihead_kw = ecl_file_view_iget_named_kw( rst_view , LOGIHEAD_KW , 0);
|
||||
|
||||
if (ecl_file_view_has_kw(rst_view, DOUBHEAD_KW))
|
||||
doubhead_kw = ecl_file_view_iget_named_kw(rst_view, DOUBHEAD_KW, 0);
|
||||
|
||||
if (ecl_file_view_has_kw( rst_view , SEQNUM_KW)) {
|
||||
const ecl_kw_type * seqnum_kw = ecl_file_view_iget_named_kw( rst_view , SEQNUM_KW , 0);
|
||||
report_step = ecl_kw_iget_int( seqnum_kw , 0);
|
||||
@ -135,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;
|
@ -22,21 +22,21 @@
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/float_vector.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/float_vector.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_smspec.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/smspec_node.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_smspec.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/smspec_node.hpp>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
#ifdef HAVE_FNMATCH
|
||||
#include <fnmatch.h>
|
||||
@ -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 );
|
||||
}
|
||||
|
@ -22,19 +22,19 @@
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_region.h>
|
||||
#include <ert/ecl/ecl_subsidence.h>
|
||||
#include <ert/ecl/ecl_grid_cache.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_grav_common.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_region.hpp>
|
||||
#include <ert/ecl/ecl_subsidence.hpp>
|
||||
#include <ert/ecl/ecl_grid_cache.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_grav_common.hpp>
|
||||
|
||||
|
||||
/**
|
||||
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -22,23 +22,23 @@
|
||||
#include <time.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/set.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/bool_vector.h>
|
||||
#include <ert/util/time_t_vector.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/set.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/bool_vector.hpp>
|
||||
#include <ert/util/time_t_vector.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_sum.h>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_sum.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_sum_data.h>
|
||||
#include <ert/ecl/ecl_smspec.h>
|
||||
#include <ert/ecl/ecl_sum_data.h>
|
||||
#include <ert/ecl/smspec_node.h>
|
||||
#include <ert/ecl/ecl_sum_data.hpp>
|
||||
#include <ert/ecl/ecl_smspec.hpp>
|
||||
#include <ert/ecl/ecl_sum_data.hpp>
|
||||
#include <ert/ecl/smspec_node.hpp>
|
||||
|
||||
|
||||
/**
|
||||
@ -123,7 +123,7 @@ UTIL_IS_INSTANCE_FUNCTION( ecl_sum , ECL_SUM_ID );
|
||||
The actual loading is implemented in the ecl_sum_data.c file.
|
||||
*/
|
||||
|
||||
void ecl_sum_set_case( ecl_sum_type * ecl_sum , const char * ecl_case) {
|
||||
void ecl_sum_set_case( ecl_sum_type * ecl_sum , const char * input_arg) {
|
||||
util_safe_free( ecl_sum->ecl_case );
|
||||
util_safe_free( ecl_sum->path );
|
||||
util_safe_free( ecl_sum->abs_path );
|
||||
@ -132,9 +132,9 @@ void ecl_sum_set_case( ecl_sum_type * ecl_sum , const char * ecl_case) {
|
||||
{
|
||||
char *path , *base, *ext;
|
||||
|
||||
util_alloc_file_components( ecl_case , &path , &base , &ext);
|
||||
util_alloc_file_components( input_arg, &path , &base , &ext);
|
||||
|
||||
ecl_sum->ecl_case = util_alloc_string_copy( ecl_case );
|
||||
ecl_sum->ecl_case = util_alloc_filename( path, base, NULL );
|
||||
ecl_sum->path = util_alloc_string_copy( path );
|
||||
ecl_sum->base = util_alloc_string_copy( base );
|
||||
ecl_sum->ext = util_alloc_string_copy( ext );
|
||||
@ -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;
|
||||
@ -183,11 +183,17 @@ static bool ecl_sum_fread_data( ecl_sum_type * ecl_sum , const stringlist_type *
|
||||
|
||||
|
||||
static void ecl_sum_fread_history( ecl_sum_type * ecl_sum ) {
|
||||
ecl_sum_type * restart_case = ecl_sum_fread_alloc_case__( ecl_smspec_get_restart_case( ecl_sum->smspec ) , ":" , true);
|
||||
char * restart_header = ecl_util_alloc_filename(NULL,
|
||||
ecl_smspec_get_restart_case(ecl_sum->smspec),
|
||||
ECL_SUMMARY_HEADER_FILE,
|
||||
ecl_smspec_get_formatted(ecl_sum->smspec),
|
||||
-1);
|
||||
ecl_sum_type * restart_case = ecl_sum_fread_alloc_case__(restart_header, ":" , true);
|
||||
if (restart_case) {
|
||||
ecl_sum->restart_case = restart_case;
|
||||
ecl_sum_data_add_case(ecl_sum->data , restart_case->data );
|
||||
}
|
||||
free(restart_header);
|
||||
}
|
||||
|
||||
|
||||
@ -711,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);
|
||||
}
|
||||
@ -719,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) {
|
||||
@ -901,6 +913,38 @@ void ecl_sum_init_data_vector( const ecl_sum_type * ecl_sum , double_vector_type
|
||||
}
|
||||
|
||||
|
||||
void ecl_sum_init_double_vector__(const ecl_sum_type * ecl_sum, int params_index, double * data) {
|
||||
ecl_sum_data_init_double_vector(ecl_sum->data, params_index, data);
|
||||
}
|
||||
|
||||
|
||||
void ecl_sum_init_double_vector(const ecl_sum_type * ecl_sum, const char * gen_key, double * data) {
|
||||
int params_index = ecl_sum_get_general_var_params_index(ecl_sum, gen_key);
|
||||
ecl_sum_init_double_vector__(ecl_sum, params_index, data);
|
||||
}
|
||||
|
||||
void ecl_sum_init_double_vector_interp(const ecl_sum_type * ecl_sum, const char * gen_key, const time_t_vector_type * time_points, double * data) {
|
||||
const smspec_node_type * node = ecl_smspec_get_general_var_node( ecl_sum->smspec , gen_key);
|
||||
ecl_sum_data_init_double_vector_interp(ecl_sum->data, node, time_points, data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ecl_sum_init_datetime64_vector(const ecl_sum_type * ecl_sum, int64_t * data, int multiplier) {
|
||||
ecl_sum_data_init_datetime64_vector(ecl_sum->data, data, multiplier);
|
||||
}
|
||||
|
||||
void ecl_sum_init_double_frame(const ecl_sum_type * ecl_sum, const ecl_sum_vector_type * keywords, double * data) {
|
||||
ecl_sum_data_init_double_frame(ecl_sum->data, keywords, data);
|
||||
}
|
||||
|
||||
|
||||
void ecl_sum_init_double_frame_interp(const ecl_sum_type * ecl_sum, const ecl_sum_vector_type * keywords, const time_t_vector_type * time_points, double * data) {
|
||||
ecl_sum_data_init_double_frame_interp(ecl_sum->data, keywords, time_points, data);
|
||||
}
|
||||
|
||||
|
||||
double_vector_type * ecl_sum_alloc_data_vector( const ecl_sum_type * ecl_sum , int data_index , bool report_only) {
|
||||
return ecl_sum_data_alloc_data_vector( ecl_sum->data , data_index , report_only );
|
||||
}
|
||||
@ -1082,7 +1126,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)
|
||||
@ -1420,3 +1464,29 @@ time_t_vector_type * ecl_sum_alloc_time_solution( const ecl_sum_type * ecl_sum ,
|
||||
ert_ecl_unit_enum ecl_sum_get_unit_system(const ecl_sum_type * ecl_sum) {
|
||||
return ecl_smspec_get_unit_system(ecl_sum->smspec);
|
||||
}
|
||||
|
||||
double ecl_sum_iget_last_value(const ecl_sum_type * ecl_sum, int param_index) {
|
||||
return ecl_sum_data_iget_last_value(ecl_sum->data, param_index);
|
||||
}
|
||||
|
||||
double ecl_sum_get_last_value_gen_key(const ecl_sum_type * ecl_sum, const char * gen_key) {
|
||||
const smspec_node_type * node = ecl_sum_get_general_var_node( ecl_sum , gen_key );
|
||||
return ecl_sum_iget_last_value(ecl_sum, smspec_node_get_params_index(node));
|
||||
}
|
||||
|
||||
double ecl_sum_get_last_value_node(const ecl_sum_type * ecl_sum, const smspec_node_type *node) {
|
||||
return ecl_sum_iget_last_value(ecl_sum, smspec_node_get_params_index(node));
|
||||
}
|
||||
|
||||
double ecl_sum_iget_first_value(const ecl_sum_type * ecl_sum, int param_index) {
|
||||
return ecl_sum_data_iget_first_value(ecl_sum->data, param_index);
|
||||
}
|
||||
|
||||
double ecl_sum_get_first_value_gen_key(const ecl_sum_type * ecl_sum, const char * gen_key) {
|
||||
const smspec_node_type * node = ecl_sum_get_general_var_node( ecl_sum , gen_key );
|
||||
return ecl_sum_iget_first_value(ecl_sum, smspec_node_get_params_index(node));
|
||||
}
|
||||
|
||||
double ecl_sum_get_first_value_node(const ecl_sum_type * ecl_sum, const smspec_node_type *node) {
|
||||
return ecl_sum_iget_first_value(ecl_sum, smspec_node_get_params_index(node));
|
||||
}
|
@ -19,22 +19,22 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/time_t_vector.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/time_t_vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_smspec.h>
|
||||
#include <ert/ecl/ecl_sum_data.h>
|
||||
#include <ert/ecl/ecl_sum_tstep.h>
|
||||
#include <ert/ecl/smspec_node.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_sum_vector.h>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_smspec.hpp>
|
||||
#include <ert/ecl/ecl_sum_data.hpp>
|
||||
#include <ert/ecl/ecl_sum_tstep.hpp>
|
||||
#include <ert/ecl/smspec_node.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_sum_vector.hpp>
|
||||
|
||||
|
||||
|
||||
@ -258,7 +258,7 @@ static void ecl_sum_data_clear_index( ecl_sum_data_type * data ) {
|
||||
|
||||
|
||||
ecl_sum_data_type * ecl_sum_data_alloc(ecl_smspec_type * smspec) {
|
||||
ecl_sum_data_type * data = util_malloc( sizeof * data );
|
||||
ecl_sum_data_type * data = (ecl_sum_data_type*)util_malloc( sizeof * data );
|
||||
data->data = vector_alloc_new();
|
||||
data->smspec = smspec;
|
||||
|
||||
@ -293,7 +293,7 @@ ecl_sum_data_type * ecl_sum_data_alloc(ecl_smspec_type * smspec) {
|
||||
|
||||
|
||||
static ecl_sum_tstep_type * ecl_sum_data_iget_ministep( const ecl_sum_data_type * data , int internal_index ) {
|
||||
return vector_iget( data->data , internal_index );
|
||||
return (ecl_sum_tstep_type*)vector_iget( data->data , internal_index );
|
||||
}
|
||||
|
||||
|
||||
@ -709,8 +709,8 @@ static void ecl_sum_data_build_index( ecl_sum_data_type * sum_data ) {
|
||||
|
||||
/* Identify various global first and last values. */
|
||||
{
|
||||
const ecl_sum_tstep_type * first_ministep = vector_iget_const( sum_data->data, 0 );
|
||||
const ecl_sum_tstep_type * last_ministep = vector_get_last_const( sum_data->data );
|
||||
const ecl_sum_tstep_type * first_ministep = (const ecl_sum_tstep_type*)vector_iget_const( sum_data->data, 0 );
|
||||
const ecl_sum_tstep_type * last_ministep = (const ecl_sum_tstep_type*)vector_get_last_const( sum_data->data );
|
||||
/*
|
||||
In most cases the days_start and data_start_time will agree
|
||||
with the global simulation start; however in the case where we
|
||||
@ -772,7 +772,7 @@ ecl_sum_tstep_type * ecl_sum_data_add_new_tstep( ecl_sum_data_type * data , int
|
||||
ecl_sum_tstep_type * prev_tstep = NULL;
|
||||
|
||||
if (vector_get_size( data->data ) > 0)
|
||||
prev_tstep = vector_get_last( data->data );
|
||||
prev_tstep = (ecl_sum_tstep_type*)vector_get_last( data->data );
|
||||
|
||||
ecl_sum_data_append_tstep__( data , tstep );
|
||||
{
|
||||
@ -1234,7 +1234,7 @@ int ecl_sum_data_get_report_step_from_days(const ecl_sum_data_type * data , doub
|
||||
|
||||
for (i=1; i < int_vector_size( data->report_last_index ); i++) {
|
||||
int ministep_index = int_vector_iget( data->report_last_index , i );
|
||||
const ecl_sum_tstep_type * ministep = vector_iget_const( data->data , ministep_index );
|
||||
const ecl_sum_tstep_type * ministep = (const ecl_sum_tstep_type*)vector_iget_const( data->data , ministep_index );
|
||||
|
||||
double_vector_iset( days_map , i , ecl_sum_tstep_get_sim_days( ministep ));
|
||||
int_vector_iset( report_map , i , ecl_sum_tstep_get_report( ministep ));
|
||||
@ -1288,7 +1288,7 @@ int ecl_sum_data_get_report_step_from_time(const ecl_sum_data_type * data , time
|
||||
|
||||
for (i=1; i < int_vector_size( data->report_last_index ); i++) {
|
||||
int ministep_index = int_vector_iget( data->report_last_index , i );
|
||||
const ecl_sum_tstep_type * ministep = vector_iget_const( data->data , ministep_index );
|
||||
const ecl_sum_tstep_type * ministep = (const ecl_sum_tstep_type*)vector_iget_const( data->data , ministep_index );
|
||||
|
||||
time_t_vector_iset( time_map , i , ecl_sum_tstep_get_sim_time( ministep ));
|
||||
int_vector_iset( report_map , i , ecl_sum_tstep_get_report( ministep ));
|
||||
@ -1412,6 +1412,132 @@ double_vector_type * ecl_sum_data_alloc_data_vector( const ecl_sum_data_type * d
|
||||
}
|
||||
|
||||
|
||||
void ecl_sum_data_init_double_vector(const ecl_sum_data_type * data, int params_index, double * output_data) {
|
||||
int i;
|
||||
for (i = 0; i < vector_get_size(data->data); i++) {
|
||||
const ecl_sum_tstep_type * ministep = ecl_sum_data_iget_ministep( data , i );
|
||||
output_data[i] = ecl_sum_tstep_iget(ministep, params_index);
|
||||
}
|
||||
}
|
||||
|
||||
void ecl_sum_data_init_datetime64_vector(const ecl_sum_data_type * data, int64_t * output_data, int multiplier) {
|
||||
int i;
|
||||
for (i = 0; i < vector_get_size(data->data); i++) {
|
||||
const ecl_sum_tstep_type * ministep = ecl_sum_data_iget_ministep( data , i );
|
||||
output_data[i] = ecl_sum_tstep_get_sim_time(ministep) * multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
void ecl_sum_data_init_double_vector_interp(const ecl_sum_data_type * data,
|
||||
const smspec_node_type * smspec_node,
|
||||
const time_t_vector_type * time_points,
|
||||
double * output_data) {
|
||||
bool is_rate = smspec_node_is_rate(smspec_node);
|
||||
int params_index = smspec_node_get_params_index(smspec_node);
|
||||
time_t start_time = ecl_sum_data_get_data_start(data);
|
||||
time_t end_time = ecl_sum_data_get_sim_end(data);
|
||||
double start_value = 0;
|
||||
double end_value = 0;
|
||||
|
||||
if (!is_rate) {
|
||||
start_value = ecl_sum_data_iget_first_value(data, params_index);
|
||||
end_value = ecl_sum_data_iget_last_value(data, params_index);
|
||||
}
|
||||
|
||||
for (int time_index=0; time_index < time_t_vector_size(time_points); time_index++) {
|
||||
time_t sim_time = time_t_vector_iget( time_points, time_index);
|
||||
double value;
|
||||
if (sim_time < start_time)
|
||||
value = start_value;
|
||||
|
||||
else if (sim_time > end_time)
|
||||
value = end_value;
|
||||
|
||||
else {
|
||||
int time_index1, time_index2;
|
||||
double weight1, weight2;
|
||||
ecl_sum_data_init_interp_from_sim_time(data, sim_time, &time_index1, &time_index2, &weight1, &weight2);
|
||||
value = ecl_sum_data_vector_iget( data,
|
||||
sim_time,
|
||||
params_index,
|
||||
is_rate,
|
||||
time_index1,
|
||||
time_index2,
|
||||
weight1,
|
||||
weight2);
|
||||
}
|
||||
|
||||
output_data[time_index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ecl_sum_data_init_double_frame(const ecl_sum_data_type * data, const ecl_sum_vector_type * keywords, double *output_data) {
|
||||
int time_stride = ecl_sum_vector_get_size(keywords);
|
||||
int key_stride = 1;
|
||||
for (int time_index=0; time_index < vector_get_size(data->data); time_index++) {
|
||||
const ecl_sum_tstep_type * ministep = ecl_sum_data_iget_ministep(data , time_index);
|
||||
for (int key_index = 0; key_index < ecl_sum_vector_get_size(keywords); key_index++) {
|
||||
int param_index = ecl_sum_vector_iget_param_index(keywords, key_index);
|
||||
int data_index = key_index*key_stride + time_index * time_stride;
|
||||
|
||||
output_data[data_index] = ecl_sum_tstep_iget(ministep, param_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ecl_sum_data_init_double_frame_interp(const ecl_sum_data_type * data,
|
||||
const ecl_sum_vector_type * keywords,
|
||||
const time_t_vector_type * time_points,
|
||||
double * output_data) {
|
||||
int num_keywords = ecl_sum_vector_get_size(keywords);
|
||||
int time_stride = num_keywords;
|
||||
int key_stride = 1;
|
||||
time_t start_time = ecl_sum_data_get_data_start(data);
|
||||
time_t end_time = ecl_sum_data_get_sim_end(data);
|
||||
|
||||
|
||||
for (int time_index=0; time_index < time_t_vector_size(time_points); time_index++) {
|
||||
time_t sim_time = time_t_vector_iget( time_points, time_index);
|
||||
if (sim_time < start_time) {
|
||||
for (int key_index = 0; key_index < num_keywords; key_index++) {
|
||||
int param_index = ecl_sum_vector_iget_param_index(keywords, key_index);
|
||||
int data_index = key_index*key_stride + time_index*time_stride;
|
||||
bool is_rate = ecl_sum_vector_iget_is_rate(keywords, key_index);
|
||||
if (is_rate)
|
||||
output_data[data_index] = 0;
|
||||
else
|
||||
output_data[data_index] = ecl_sum_data_iget_first_value(data, param_index);
|
||||
}
|
||||
} else if (sim_time > end_time) {
|
||||
for (int key_index = 0; key_index < num_keywords; key_index++) {
|
||||
int param_index = ecl_sum_vector_iget_param_index(keywords, key_index);
|
||||
int data_index = key_index*key_stride + time_index*time_stride;
|
||||
bool is_rate = ecl_sum_vector_iget_is_rate(keywords, key_index);
|
||||
if (is_rate)
|
||||
output_data[data_index] = 0;
|
||||
else
|
||||
output_data[data_index] = ecl_sum_data_iget_last_value(data, param_index);
|
||||
}
|
||||
} else {
|
||||
double weight1, weight2;
|
||||
int time_index1, time_index2;
|
||||
|
||||
ecl_sum_data_init_interp_from_sim_time(data, sim_time, &time_index1, &time_index2, &weight1, &weight2);
|
||||
|
||||
for (int key_index = 0; key_index < num_keywords; key_index++) {
|
||||
int param_index = ecl_sum_vector_iget_param_index(keywords, key_index);
|
||||
int data_index = key_index*key_stride + time_index*time_stride;
|
||||
bool is_rate = ecl_sum_vector_iget_is_rate(keywords, key_index);
|
||||
double value = ecl_sum_data_vector_iget( data, sim_time, param_index , is_rate, time_index1, time_index2, weight1, weight2);
|
||||
output_data[data_index] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
This function will return the total number of ministeps in the
|
||||
@ -1487,3 +1613,18 @@ bool ecl_sum_data_report_step_compatible( const ecl_sum_data_type * data1 , cons
|
||||
}
|
||||
return compatible;
|
||||
}
|
||||
|
||||
|
||||
double ecl_sum_data_iget_last_value(const ecl_sum_data_type * data, int param_index) {
|
||||
const ecl_sum_tstep_type * tstep = (const ecl_sum_tstep_type*)vector_get_last_const(data->data);
|
||||
return ecl_sum_tstep_iget( tstep, param_index);
|
||||
}
|
||||
|
||||
double ecl_sum_data_get_last_value(const ecl_sum_data_type * data, int param_index) {
|
||||
return ecl_sum_data_iget_last_value(data, param_index);
|
||||
}
|
||||
|
||||
double ecl_sum_data_iget_first_value(const ecl_sum_data_type * data, int param_index) {
|
||||
const ecl_sum_tstep_type * tstep = (const ecl_sum_tstep_type*) vector_iget_const(data->data, 0);
|
||||
return ecl_sum_tstep_iget(tstep, param_index);
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_sum_index.h>
|
||||
#include <ert/ecl/ecl_sum_index.hpp>
|
||||
|
||||
/*
|
||||
This file contains all the internalized information from parsing a
|
@ -19,14 +19,14 @@
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_sum_tstep.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_smspec.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_sum_tstep.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_smspec.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
#define ECL_SUM_TSTEP_ID 88631
|
||||
|
||||
@ -72,10 +72,10 @@ struct ecl_sum_tstep_struct {
|
||||
|
||||
ecl_sum_tstep_type * ecl_sum_tstep_alloc_remap_copy( const ecl_sum_tstep_type * src , const ecl_smspec_type * new_smspec, float default_value , const int * params_map) {
|
||||
int params_size = ecl_smspec_get_params_size( new_smspec );
|
||||
ecl_sum_tstep_type * target = util_alloc_copy(src , sizeof * src );
|
||||
ecl_sum_tstep_type * target = (ecl_sum_tstep_type*)util_alloc_copy(src , sizeof * src );
|
||||
|
||||
target->smspec = new_smspec;
|
||||
target->data = util_malloc( params_size * sizeof * target->data );
|
||||
target->data = (float*)util_malloc( params_size * sizeof * target->data );
|
||||
target->data_size = params_size;
|
||||
for (int i=0; i < params_size; i++) {
|
||||
|
||||
@ -89,20 +89,20 @@ ecl_sum_tstep_type * ecl_sum_tstep_alloc_remap_copy( const ecl_sum_tstep_type *
|
||||
}
|
||||
|
||||
ecl_sum_tstep_type * ecl_sum_tstep_alloc_copy( const ecl_sum_tstep_type * src ) {
|
||||
ecl_sum_tstep_type * target = util_alloc_copy(src , sizeof * src );
|
||||
target->data = util_alloc_copy( src->data , src->data_size * sizeof * src->data );
|
||||
ecl_sum_tstep_type * target = (ecl_sum_tstep_type*)util_alloc_copy(src , sizeof * src );
|
||||
target->data = (float*)util_alloc_copy( src->data , src->data_size * sizeof * src->data );
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
static ecl_sum_tstep_type * ecl_sum_tstep_alloc( int report_step , int ministep_nr , const ecl_smspec_type * smspec) {
|
||||
ecl_sum_tstep_type * tstep = util_malloc( sizeof * tstep );
|
||||
ecl_sum_tstep_type * tstep = (ecl_sum_tstep_type*)util_malloc( sizeof * tstep );
|
||||
UTIL_TYPE_ID_INIT( tstep , ECL_SUM_TSTEP_ID);
|
||||
tstep->smspec = smspec;
|
||||
tstep->report_step = report_step;
|
||||
tstep->ministep = ministep_nr;
|
||||
tstep->data_size = ecl_smspec_get_params_size( smspec );
|
||||
tstep->data = util_calloc( tstep->data_size , sizeof * tstep->data );
|
||||
tstep->data = (float*)util_calloc( tstep->data_size , sizeof * tstep->data );
|
||||
return tstep;
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ void ecl_sum_tstep_fwrite( const ecl_sum_tstep_type * ministep , const int_vecto
|
||||
ecl_kw_type * params_kw = ecl_kw_alloc( PARAMS_KW , compact_size , ECL_FLOAT );
|
||||
|
||||
const int * index = int_vector_get_ptr( index_map );
|
||||
float * data = ecl_kw_get_ptr( params_kw );
|
||||
float * data = (float*)ecl_kw_get_ptr( params_kw );
|
||||
|
||||
{
|
||||
int i;
|
@ -16,15 +16,15 @@
|
||||
for more details.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <ert/ecl/ecl_sum_vector.h>
|
||||
#include <ert/ecl/ecl_sum.h>
|
||||
#include <ert/ecl/ecl_smspec.h>
|
||||
#include <ert/ecl/ecl_sum_vector.hpp>
|
||||
#include <ert/ecl/ecl_sum.hpp>
|
||||
#include <ert/ecl/ecl_smspec.hpp>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/bool_vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/bool_vector.hpp>
|
||||
|
||||
|
||||
#define ECL_SUM_VECTOR_TYPE_ID 8768778
|
||||
@ -59,7 +59,7 @@ static void ecl_sum_vector_add_node(ecl_sum_vector_type * vector, const smspec_n
|
||||
|
||||
|
||||
ecl_sum_vector_type * ecl_sum_vector_alloc(const ecl_sum_type * ecl_sum, bool add_keywords) {
|
||||
ecl_sum_vector_type * ecl_sum_vector = util_malloc( sizeof * ecl_sum_vector );
|
||||
ecl_sum_vector_type * ecl_sum_vector = (ecl_sum_vector_type*)util_malloc( sizeof * ecl_sum_vector );
|
||||
UTIL_TYPE_ID_INIT( ecl_sum_vector , ECL_SUM_VECTOR_TYPE_ID);
|
||||
ecl_sum_vector->ecl_sum = ecl_sum;
|
||||
ecl_sum_vector->node_index_list = int_vector_alloc(0,0);
|
@ -20,8 +20,8 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
/*****************************************************************/
|
||||
/* The string names for the different ECLIPSE low-level
|
||||
@ -37,7 +37,7 @@
|
||||
static char * alloc_string_name(const ecl_data_type ecl_type) {
|
||||
return util_alloc_sprintf(
|
||||
"C%03d",
|
||||
ecl_type_get_sizeof_ctype_fortio(ecl_type)
|
||||
ecl_type_get_sizeof_iotype(ecl_type)
|
||||
);
|
||||
}
|
||||
|
||||
@ -64,11 +64,11 @@ ecl_data_type ecl_type_create(const ecl_type_enum type, const size_t element_siz
|
||||
ecl_type_create_from_type(type)
|
||||
);
|
||||
|
||||
if(ecl_type_get_sizeof_ctype_fortio(ecl_type) != element_size)
|
||||
if(ecl_type_get_sizeof_iotype(ecl_type) != element_size)
|
||||
util_abort(
|
||||
"%s: element_size mismatch for type %d, was: %d, expected: %d\n",
|
||||
__func__, type,
|
||||
element_size, ecl_type_get_sizeof_ctype_fortio(ecl_type)
|
||||
element_size, ecl_type_get_sizeof_iotype(ecl_type)
|
||||
);
|
||||
|
||||
return ecl_type;
|
||||
@ -146,17 +146,25 @@ ecl_data_type ecl_type_create_from_name( const char * type_name ) {
|
||||
}
|
||||
|
||||
|
||||
int ecl_type_get_sizeof_ctype_fortio(const ecl_data_type ecl_type) {
|
||||
if(ecl_type_is_char(ecl_type) || ecl_type_is_string(ecl_type))
|
||||
return ecl_type.element_size - 1;
|
||||
else
|
||||
return ecl_type_get_sizeof_ctype(ecl_type);
|
||||
}
|
||||
|
||||
int ecl_type_get_sizeof_ctype(const ecl_data_type ecl_type) {
|
||||
return ecl_type.element_size;
|
||||
}
|
||||
|
||||
|
||||
int ecl_type_get_sizeof_iotype(const ecl_data_type ecl_type) {
|
||||
if (ecl_type_is_bool(ecl_type))
|
||||
return sizeof(int);
|
||||
|
||||
if (ecl_type_is_char(ecl_type))
|
||||
return ecl_type.element_size -1;
|
||||
|
||||
if (ecl_type_is_string(ecl_type))
|
||||
return ecl_type.element_size - 1;
|
||||
|
||||
return ecl_type.element_size;
|
||||
}
|
||||
|
||||
|
||||
bool ecl_type_is_numeric(const ecl_data_type ecl_type) {
|
||||
return (ecl_type_is_int(ecl_type) ||
|
||||
ecl_type_is_float(ecl_type) ||
|
@ -1,14 +1,18 @@
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_kw_grdecl.h>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_kw_grdecl.hpp>
|
||||
|
||||
/**
|
||||
*
|
||||
* Functions only to be used by the *PYTHON* prototype for EclDataType
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
ecl_data_type * ecl_type_alloc_copy_python(const ecl_data_type * src_type) {
|
||||
ecl_data_type * data_type = util_malloc(sizeof * src_type);
|
||||
ecl_data_type * data_type = (ecl_data_type*)util_malloc(sizeof * src_type);
|
||||
memcpy(data_type, src_type, sizeof * data_type);
|
||||
return data_type;
|
||||
}
|
||||
@ -40,10 +44,12 @@ const char * ecl_type_alloc_name_python(const ecl_data_type * ecl_type) {
|
||||
return ecl_type_alloc_name(*ecl_type);
|
||||
}
|
||||
|
||||
int ecl_type_get_sizeof_ctype_fortio_python(const ecl_data_type * ecl_type) {
|
||||
return ecl_type_get_sizeof_ctype_fortio(*ecl_type);
|
||||
|
||||
int ecl_type_get_sizeof_iotype_python(const ecl_data_type * ecl_type) {
|
||||
return ecl_type_get_sizeof_iotype(*ecl_type);
|
||||
}
|
||||
|
||||
|
||||
int ecl_type_get_sizeof_ctype_python(const ecl_data_type * ecl_type) {
|
||||
return ecl_type_get_sizeof_ctype(*ecl_type);
|
||||
}
|
||||
@ -106,3 +112,7 @@ ecl_data_type * ecl_kw_get_data_type_python( const ecl_kw_type * ecl_kw ) {
|
||||
void ecl_kw_fread_indexed_data_python(fortio_type * fortio, offset_type data_offset, const ecl_data_type * data_type, int element_count, const int_vector_type* index_map, char* buffer) {
|
||||
return ecl_kw_fread_indexed_data(fortio, data_offset, *data_type, element_count, index_map, buffer);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif
|
@ -24,13 +24,13 @@
|
||||
|
||||
#include <ert/util/ert_api_config.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
#include <ert/util/parser.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
#include <ert/util/parser.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
|
||||
#define ECL_PHASE_NAME_OIL "SOIL" // SHould match the keywords found in restart file
|
||||
@ -218,7 +218,7 @@ ecl_file_enum ecl_util_inspect_extension(const char * ext , bool *_fmt_file, int
|
||||
|
||||
|
||||
ecl_file_enum ecl_util_get_file_type(const char * filename, bool *fmt_file, int * report_nr) {
|
||||
char *ext = strrchr(filename , '.');
|
||||
char *ext = (char*)strrchr(filename , '.');
|
||||
if (ext == NULL)
|
||||
return ECL_OTHER_FILE;
|
||||
|
||||
@ -568,35 +568,35 @@ static bool numeric_extension_predicate(const char * filename, const char * base
|
||||
|
||||
|
||||
static bool summary_UPPERCASE_ASCII(const char * filename, const void * base) {
|
||||
return numeric_extension_predicate(filename, base, 'A');
|
||||
return numeric_extension_predicate(filename, (const char*)base, 'A');
|
||||
}
|
||||
|
||||
static bool summary_UPPERCASE_BINARY(const char * filename, const void * base) {
|
||||
return numeric_extension_predicate(filename, base, 'S');
|
||||
return numeric_extension_predicate(filename, (const char*)base, 'S');
|
||||
}
|
||||
|
||||
static bool summary_lowercase_ASCII(const char * filename, const void * base) {
|
||||
return numeric_extension_predicate(filename, base, 'a');
|
||||
return numeric_extension_predicate(filename, (const char*)base, 'a');
|
||||
}
|
||||
|
||||
static bool summary_lowercase_BINARY(const char * filename, const void * base) {
|
||||
return numeric_extension_predicate(filename, base, 's');
|
||||
return numeric_extension_predicate(filename, (const char*)base, 's');
|
||||
}
|
||||
|
||||
static bool restart_UPPERCASE_ASCII(const char * filename, const void * base) {
|
||||
return numeric_extension_predicate(filename, base, 'F');
|
||||
return numeric_extension_predicate(filename, (const char*)base, 'F');
|
||||
}
|
||||
|
||||
static bool restart_UPPERCASE_BINARY(const char * filename, const void * base) {
|
||||
return numeric_extension_predicate(filename, base, 'X');
|
||||
return numeric_extension_predicate(filename, (const char*)base, 'X');
|
||||
}
|
||||
|
||||
static bool restart_lowercase_ASCII(const char * filename, const void * base) {
|
||||
return numeric_extension_predicate(filename, base, 'f');
|
||||
return numeric_extension_predicate(filename, (const char*)base, 'f');
|
||||
}
|
||||
|
||||
static bool restart_lowercase_BINARY(const char * filename, const void * base) {
|
||||
return numeric_extension_predicate(filename, base, 'x');
|
||||
return numeric_extension_predicate(filename, (const char*)base, 'x');
|
||||
}
|
||||
|
||||
static int ecl_util_select_predicate_filelist(const char * path, const char * base, ecl_file_enum file_type, bool fmt_file, bool upper_case, stringlist_type * filelist) {
|
||||
@ -1211,7 +1211,7 @@ time_t ecl_util_get_start_date(const char * data_file) {
|
||||
util_abort("%s: sorry - could not find \"/\" termination of START keyword in data_file: \n",__func__ , data_file);
|
||||
|
||||
buffer_size = (util_ftell(stream) - start_pos) ;
|
||||
buffer = util_calloc( buffer_size + 1 , sizeof * buffer );
|
||||
buffer = (char*)util_calloc( buffer_size + 1 , sizeof * buffer );
|
||||
util_fseek( stream , start_pos , SEEK_SET);
|
||||
util_fread( buffer , sizeof * buffer , buffer_size ,stream , __func__);
|
||||
buffer[buffer_size] = '\0';
|
||||
@ -1248,7 +1248,7 @@ static int ecl_util_get_num_parallel_cpu__(basic_parser_type* parser, FILE* stre
|
||||
util_abort("%s: sorry - could not find \"/\" termination of PARALLEL keyword in data_file: \n",__func__ , data_file);
|
||||
|
||||
buffer_size = (util_ftell(stream) - start_pos) ;
|
||||
buffer = util_calloc( buffer_size + 1 , sizeof * buffer );
|
||||
buffer = (char*)util_calloc( buffer_size + 1 , sizeof * buffer );
|
||||
util_fseek( stream , start_pos , SEEK_SET);
|
||||
util_fread( buffer , sizeof * buffer , buffer_size ,stream , __func__);
|
||||
buffer[buffer_size] = '\0';
|
@ -23,11 +23,11 @@
|
||||
#include <ert/geometry/geo_polygon.h>
|
||||
#include <ert/geometry/geo_polygon_collection.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/fault_block.h>
|
||||
#include <ert/ecl/fault_block_layer.h>
|
||||
#include <ert/ecl/layer.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/fault_block.hpp>
|
||||
#include <ert/ecl/fault_block_layer.hpp>
|
||||
#include <ert/ecl/layer.hpp>
|
||||
|
||||
#define FAULT_BLOCK_ID 3297376
|
||||
|
||||
@ -52,7 +52,7 @@ static UTIL_SAFE_CAST_FUNCTION( fault_block , FAULT_BLOCK_ID )
|
||||
|
||||
|
||||
fault_block_type * fault_block_alloc( const fault_block_layer_type * parent_layer , int block_id ) {
|
||||
fault_block_type * block = util_malloc( sizeof * block );
|
||||
fault_block_type * block = (fault_block_type*)util_malloc( sizeof * block );
|
||||
UTIL_TYPE_ID_INIT( block , FAULT_BLOCK_ID );
|
||||
block->parent_layer = parent_layer;
|
||||
block->grid = fault_block_layer_get_grid( parent_layer );
|
@ -201,7 +201,7 @@ fault_block_layer_type * fault_block_layer_alloc( const ecl_grid_type * grid , i
|
||||
if ((k < 0) || (k >= ecl_grid_get_nz( grid )))
|
||||
return NULL;
|
||||
else {
|
||||
fault_block_layer_type * layer = util_malloc( sizeof * layer );
|
||||
fault_block_layer_type * layer = (fault_block_layer_type*)util_malloc( sizeof * layer );
|
||||
UTIL_TYPE_ID_INIT( layer , FAULT_BLOCK_LAYER_ID);
|
||||
layer->grid = grid;
|
||||
layer->k = k;
|
||||
@ -215,7 +215,7 @@ fault_block_layer_type * fault_block_layer_alloc( const ecl_grid_type * grid , i
|
||||
|
||||
|
||||
fault_block_type * fault_block_layer_iget_block( const fault_block_layer_type * layer , int storage_index) {
|
||||
return vector_iget( layer->blocks , storage_index );
|
||||
return (fault_block_type*)vector_iget( layer->blocks , storage_index );
|
||||
}
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@ fault_block_type * fault_block_layer_get_block( const fault_block_layer_type * l
|
||||
if (storage_index < 0)
|
||||
return NULL;
|
||||
else
|
||||
return vector_iget( layer->blocks , storage_index );
|
||||
return (fault_block_type*)vector_iget( layer->blocks , storage_index );
|
||||
}
|
||||
|
||||
|
||||
@ -233,7 +233,7 @@ fault_block_type * fault_block_layer_safe_get_block( fault_block_layer_type * la
|
||||
if (storage_index < 0)
|
||||
return fault_block_layer_add_block( layer , block_id );
|
||||
else
|
||||
return vector_iget( layer->blocks , storage_index );
|
||||
return (fault_block_type*)vector_iget( layer->blocks , storage_index );
|
||||
}
|
||||
|
||||
|
2
ThirdParty/Ert/lib/ecl/fortio.c
vendored
2
ThirdParty/Ert/lib/ecl/fortio.c
vendored
@ -97,7 +97,7 @@ UTIL_IS_INSTANCE_FUNCTION( fortio , FORTIO_ID );
|
||||
UTIL_SAFE_CAST_FUNCTION( fortio, FORTIO_ID );
|
||||
|
||||
static fortio_type * fortio_alloc__(const char *filename , bool fmt_file , bool endian_flip_header , bool stream_owner , bool writable) {
|
||||
fortio_type * fortio = util_malloc(sizeof * fortio );
|
||||
fortio_type * fortio = (fortio_type*)util_malloc(sizeof * fortio );
|
||||
UTIL_TYPE_ID_INIT( fortio, FORTIO_ID );
|
||||
fortio->filename = util_alloc_string_copy(filename);
|
||||
fortio->endian_flip_header = endian_flip_header;
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/ecl/grid_dims.h>
|
||||
#include <ert/ecl/grid_dims.hpp>
|
||||
|
||||
|
||||
void grid_dims_init( grid_dims_type * dims , int nx, int ny , int nz , int nactive) {
|
||||
@ -33,7 +33,7 @@ void grid_dims_init( grid_dims_type * dims , int nx, int ny , int nz , int nacti
|
||||
|
||||
|
||||
grid_dims_type * grid_dims_alloc( int nx, int ny , int nz , int nactive) {
|
||||
grid_dims_type * dims = util_malloc( sizeof * dims );
|
||||
grid_dims_type * dims = (grid_dims_type*)util_malloc( sizeof * dims );
|
||||
grid_dims_init( dims , nx , ny , nz , nactive );
|
||||
return dims;
|
||||
}
|
@ -18,10 +18,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
#include <ert/ecl/layer.h>
|
||||
#include <ert/ecl/layer.hpp>
|
||||
|
||||
#define LAYER_TYPE_ID 55185409
|
||||
|
||||
@ -50,14 +50,14 @@ UTIL_SAFE_CAST_FUNCTION( layer , LAYER_TYPE_ID )
|
||||
|
||||
|
||||
layer_type * layer_alloc(int nx , int ny) {
|
||||
layer_type * layer = util_malloc( sizeof * layer );
|
||||
layer_type * layer = (layer_type*)util_malloc( sizeof * layer );
|
||||
UTIL_TYPE_ID_INIT( layer , LAYER_TYPE_ID );
|
||||
layer->nx = nx;
|
||||
layer->ny = ny;
|
||||
layer->cell_sum = 0;
|
||||
{
|
||||
int data_size = (layer->nx + 1)* (layer->ny + 1);
|
||||
layer->data = util_malloc( data_size * sizeof * layer->data );
|
||||
layer->data = (cell_type*)util_malloc( data_size * sizeof * layer->data );
|
||||
{
|
||||
int g;
|
||||
for (g=0; g < data_size; g++) {
|
||||
@ -524,7 +524,7 @@ static void layer_trace_block_content__( layer_type * layer , bool erase , int i
|
||||
|
||||
static bool * layer_alloc_visited_mask( const layer_type * layer ) {
|
||||
int total_size = (layer->nx + 1)* (layer->ny + 1);
|
||||
bool * visited = util_malloc( total_size * sizeof * visited );
|
||||
bool * visited = (bool*)util_malloc( total_size * sizeof * visited );
|
||||
int g;
|
||||
for (g = 0; g < total_size; g++)
|
||||
visited[g] = false;
|
@ -18,13 +18,13 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
|
||||
#include <ert/ecl/nnc_info.h>
|
||||
#include <ert/ecl/nnc_vector.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/nnc_info.hpp>
|
||||
#include <ert/ecl/nnc_vector.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
|
||||
#define NNC_INFO_TYPE_ID 675415078
|
||||
|
||||
@ -41,7 +41,7 @@ UTIL_IS_INSTANCE_FUNCTION( nnc_info , NNC_INFO_TYPE_ID )
|
||||
|
||||
|
||||
nnc_info_type * nnc_info_alloc(int lgr_nr) {
|
||||
nnc_info_type * nnc_info = util_malloc( sizeof * nnc_info );
|
||||
nnc_info_type * nnc_info = (nnc_info_type*)util_malloc( sizeof * nnc_info );
|
||||
UTIL_TYPE_ID_INIT(nnc_info , NNC_INFO_TYPE_ID);
|
||||
nnc_info->lgr_list = vector_alloc_new();
|
||||
nnc_info->lgr_index_map = int_vector_alloc(0, -1);
|
||||
@ -56,7 +56,7 @@ nnc_info_type * nnc_info_alloc_copy( const nnc_info_type * src_info ) {
|
||||
int ivec;
|
||||
|
||||
for (ivec = 0; ivec < vector_get_size( src_info->lgr_list ); ivec++) {
|
||||
nnc_vector_type * copy_vector = nnc_vector_alloc_copy( vector_iget_const( src_info->lgr_list , ivec));
|
||||
nnc_vector_type * copy_vector = nnc_vector_alloc_copy( (const nnc_vector_type*)vector_iget_const( src_info->lgr_list , ivec));
|
||||
nnc_info_add_vector( copy_info , copy_vector );
|
||||
}
|
||||
|
||||
@ -112,12 +112,12 @@ nnc_vector_type * nnc_info_get_vector( const nnc_info_type * nnc_info , int lgr_
|
||||
if (-1 == lgr_index)
|
||||
return NULL;
|
||||
else
|
||||
return vector_iget( nnc_info->lgr_list , lgr_index );
|
||||
return (nnc_vector_type*)vector_iget( nnc_info->lgr_list , lgr_index );
|
||||
}
|
||||
|
||||
|
||||
nnc_vector_type * nnc_info_iget_vector( const nnc_info_type * nnc_info , int lgr_index) {
|
||||
return vector_iget( nnc_info->lgr_list , lgr_index );
|
||||
return (nnc_vector_type*)vector_iget( nnc_info->lgr_list , lgr_index );
|
||||
}
|
||||
|
||||
|
||||
@ -189,7 +189,7 @@ int nnc_info_get_total_size( const nnc_info_type * nnc_info ) {
|
||||
int num_nnc = 0;
|
||||
int ivec;
|
||||
for (ivec = 0; ivec < vector_get_size( nnc_info->lgr_list ); ivec++) {
|
||||
const nnc_vector_type * nnc_vector = vector_iget( nnc_info->lgr_list , ivec );
|
||||
const nnc_vector_type * nnc_vector = (const nnc_vector_type*)vector_iget( nnc_info->lgr_list , ivec );
|
||||
num_nnc += nnc_vector_get_size( nnc_vector );
|
||||
}
|
||||
return num_nnc;
|
@ -19,12 +19,12 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
#include <ert/ecl/nnc_vector.h>
|
||||
#include <ert/ecl/nnc_vector.hpp>
|
||||
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ static UTIL_SAFE_CAST_FUNCTION(nnc_vector , NNC_VECTOR_TYPE_ID)
|
||||
|
||||
|
||||
nnc_vector_type * nnc_vector_alloc(int lgr_nr) {
|
||||
nnc_vector_type * nnc_vector = util_malloc( sizeof * nnc_vector );
|
||||
nnc_vector_type * nnc_vector = (nnc_vector_type*)util_malloc( sizeof * nnc_vector );
|
||||
UTIL_TYPE_ID_INIT(nnc_vector , NNC_VECTOR_TYPE_ID);
|
||||
nnc_vector->grid_index_list = int_vector_alloc(0,0);
|
||||
nnc_vector->nnc_index_list = int_vector_alloc(0,0);
|
||||
@ -54,7 +54,7 @@ nnc_vector_type * nnc_vector_alloc(int lgr_nr) {
|
||||
}
|
||||
|
||||
nnc_vector_type * nnc_vector_alloc_copy(const nnc_vector_type * src_vector) {
|
||||
nnc_vector_type * copy_vector = util_malloc( sizeof * src_vector );
|
||||
nnc_vector_type * copy_vector = (nnc_vector_type*)util_malloc( sizeof * src_vector );
|
||||
UTIL_TYPE_ID_INIT(copy_vector , NNC_VECTOR_TYPE_ID);
|
||||
|
||||
copy_vector->lgr_nr = src_vector->lgr_nr;
|
@ -21,20 +21,20 @@
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/set.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/set.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_smspec.h>
|
||||
#include <ert/ecl/smspec_node.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_smspec.hpp>
|
||||
#include <ert/ecl/smspec_node.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
|
||||
|
||||
|
||||
@ -363,7 +363,7 @@ float smspec_node_get_default( const smspec_node_type * smspec_node ) {
|
||||
|
||||
|
||||
smspec_node_type * smspec_node_alloc_new(int params_index, float default_value) {
|
||||
smspec_node_type * node = util_malloc( sizeof * node );
|
||||
smspec_node_type * node = (smspec_node_type*)util_malloc( sizeof * node );
|
||||
|
||||
UTIL_TYPE_ID_INIT( node , SMSPEC_TYPE_ID);
|
||||
node->params_index = params_index;
|
||||
@ -404,7 +404,7 @@ static void smspec_node_set_lgr_name( smspec_node_type * index , const char * lg
|
||||
|
||||
static void smspec_node_set_lgr_ijk( smspec_node_type * index , int lgr_i , int lgr_j , int lgr_k) {
|
||||
if (index->lgr_ijk == NULL)
|
||||
index->lgr_ijk = util_calloc( 3 , sizeof * index->lgr_ijk );
|
||||
index->lgr_ijk = (int*)util_calloc( 3 , sizeof * index->lgr_ijk );
|
||||
|
||||
index->lgr_ijk[0] = lgr_i;
|
||||
index->lgr_ijk[1] = lgr_j;
|
||||
@ -434,7 +434,7 @@ static void smspec_node_set_num( smspec_node_type * index , const int grid_dims[
|
||||
index->num = num;
|
||||
if ((index->var_type == ECL_SMSPEC_COMPLETION_VAR) || (index->var_type == ECL_SMSPEC_BLOCK_VAR)) {
|
||||
int global_index = num - 1;
|
||||
index->ijk = util_calloc( 3 , sizeof * index->ijk );
|
||||
index->ijk = (int*)util_calloc( 3 , sizeof * index->ijk );
|
||||
|
||||
index->ijk[2] = global_index / ( grid_dims[0] * grid_dims[1] ); global_index -= index->ijk[2] * (grid_dims[0] * grid_dims[1]);
|
||||
index->ijk[1] = global_index / grid_dims[0] ; global_index -= index->ijk[1] * grid_dims[0];
|
||||
@ -776,7 +776,7 @@ smspec_node_type* smspec_node_alloc_copy( const smspec_node_type* node ) {
|
||||
if( !node ) return NULL;
|
||||
|
||||
{
|
||||
smspec_node_type* copy = util_malloc( sizeof * copy );
|
||||
smspec_node_type* copy = (smspec_node_type*)util_malloc( sizeof * copy );
|
||||
UTIL_TYPE_ID_INIT( copy, SMSPEC_TYPE_ID );
|
||||
copy->gen_key1 = util_alloc_string_copy( node->gen_key1 );
|
||||
copy->gen_key2 = util_alloc_string_copy( node->gen_key2 );
|
||||
@ -788,14 +788,14 @@ smspec_node_type* smspec_node_alloc_copy( const smspec_node_type* node ) {
|
||||
|
||||
copy->ijk = NULL;
|
||||
if( node->ijk ) {
|
||||
copy->ijk = util_calloc( 3 , sizeof * node->ijk );
|
||||
copy->ijk = (int*)util_calloc( 3 , sizeof * node->ijk );
|
||||
memcpy( copy->ijk, node->ijk, 3 * sizeof( * node->ijk ) );
|
||||
}
|
||||
|
||||
copy->lgr_name = util_alloc_string_copy( node->lgr_name );
|
||||
copy->lgr_ijk = NULL;
|
||||
if( node->lgr_ijk ) {
|
||||
copy->lgr_ijk = util_calloc( 3 , sizeof * node->lgr_ijk );
|
||||
copy->lgr_ijk = (int*)util_calloc( 3 , sizeof * node->lgr_ijk );
|
||||
memcpy( copy->lgr_ijk, node->lgr_ijk, 3 * sizeof( * node->lgr_ijk ) );
|
||||
}
|
||||
|
21
ThirdParty/Ert/lib/ecl/tests/ecl_kw_init.c
vendored
21
ThirdParty/Ert/lib/ecl/tests/ecl_kw_init.c
vendored
@ -18,6 +18,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/bool_vector.h>
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
@ -57,9 +58,29 @@ void test_float() {
|
||||
}
|
||||
|
||||
|
||||
void test_bool() {
|
||||
size_t N = 100;
|
||||
bool * data = util_malloc(N * sizeof * data);
|
||||
ecl_kw_type * kw = ecl_kw_alloc("BOOL", N , ECL_BOOL);
|
||||
for (int i=0; i < N/2; i++) {
|
||||
ecl_kw_iset_bool(kw, 2*i, true);
|
||||
ecl_kw_iset_bool(kw, 2*i + 1, false);
|
||||
|
||||
data[2*i] = true;
|
||||
data[2*i + 1] = false;
|
||||
}
|
||||
|
||||
const bool * internal_data = ecl_kw_get_bool_ptr(kw);
|
||||
|
||||
test_assert_int_equal( memcmp(internal_data, data, N * sizeof * data), 0);
|
||||
ecl_kw_free(kw);
|
||||
free(data);
|
||||
}
|
||||
|
||||
int main( int argc , char ** argv) {
|
||||
test_int();
|
||||
test_double();
|
||||
test_float();
|
||||
test_bool();
|
||||
exit(0);
|
||||
}
|
||||
|
131
ThirdParty/Ert/lib/ecl/tests/eclxx_kw.cpp
vendored
131
ThirdParty/Ert/lib/ecl/tests/eclxx_kw.cpp
vendored
@ -20,10 +20,13 @@
|
||||
#include <stdexcept>
|
||||
#include <fstream>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
|
||||
#include <ert/ecl/EclKW.hpp>
|
||||
#include <ert/ecl/FortIO.hpp>
|
||||
#include <ert/util/TestArea.hpp>
|
||||
|
||||
void test_kw_name() {
|
||||
ERT::EclKW< int > kw1( "short", 1 );
|
||||
@ -54,10 +57,10 @@ void test_kw_vector_string() {
|
||||
std::vector< const char* > vec = {
|
||||
"short",
|
||||
"sweet",
|
||||
"padded ",
|
||||
"verylongkeyword"
|
||||
"padded "
|
||||
};
|
||||
|
||||
std::vector<const char *> too_long = {"1234567890"};
|
||||
ERT::EclKW< const char* > kw( "XYZ", vec );
|
||||
|
||||
test_assert_size_t_equal( kw.size(), vec.size() );
|
||||
@ -65,10 +68,38 @@ void test_kw_vector_string() {
|
||||
test_assert_string_equal( kw.at( 0 ), "short " );
|
||||
test_assert_string_equal( kw.at( 1 ), "sweet " );
|
||||
test_assert_string_equal( kw.at( 2 ), vec.at( 2 ) );
|
||||
test_assert_string_equal( kw.at( 3 ), "verylong" );
|
||||
test_assert_string_not_equal( kw.at( 2 ), "verylongkeyword" );
|
||||
|
||||
test_assert_throw( ERT::EclKW<const char*>("XY", too_long), std::range_error);
|
||||
}
|
||||
|
||||
void test_kw_vector_std_string() {
|
||||
std::vector< const char* > vec = {
|
||||
"short",
|
||||
"sweet",
|
||||
"padded ",
|
||||
};
|
||||
std::vector<std::string> too_long = {"1234567890"};
|
||||
ERT::EclKW< std::string > kw( "XYZ", vec );
|
||||
|
||||
test_assert_size_t_equal( kw.size(), vec.size() );
|
||||
|
||||
test_assert_string_equal( kw.at( 0 ).c_str(), "short " );
|
||||
test_assert_string_equal( kw.at( 1 ).c_str(), "sweet " );
|
||||
test_assert_string_equal( kw.at( 2 ).c_str(), vec.at( 2 ) );
|
||||
|
||||
test_assert_throw( ERT::EclKW<std::string>("XY", too_long), std::range_error);
|
||||
}
|
||||
|
||||
void test_logical() {
|
||||
//std::vector<bool> vec = {true,false,true,false};
|
||||
// ERT::EclKW<bool> kw("BOOL", vec);
|
||||
// test_assert_int_equal(kw.size(), vec.size());
|
||||
|
||||
// for (size_t i=0; i < vec.size(); i++)
|
||||
// test_assert_true( kw.at(i) == vec[i] );
|
||||
}
|
||||
|
||||
|
||||
void test_move_semantics_no_crash() {
|
||||
std::vector< int > vec = { 1, 2, 3, 4, 5 };
|
||||
ERT::EclKW< int > kw1( "XYZ", vec );
|
||||
@ -96,13 +127,103 @@ void test_resize() {
|
||||
test_assert_int_equal( kw1.size() , 100 );
|
||||
}
|
||||
|
||||
void test_data() {
|
||||
std::vector<double> d_data = {1,2,3,4};
|
||||
std::vector<float> f_data = {10,20,30,40};
|
||||
std::vector<int> i_data = {100,200,300,400};
|
||||
std::vector<bool> b_data = {true,false};
|
||||
std::vector<std::string> s_data = {"S1", "S2", "S3"};
|
||||
|
||||
ERT::EclKW<double> d_kw("DOUBLE", d_data);
|
||||
auto d_data2 = d_kw.data();
|
||||
for (size_t i=0; i < d_data.size(); i++)
|
||||
test_assert_true(d_data[i] == d_data2[i]);
|
||||
|
||||
ERT::EclKW<float> f_kw("FLOATx", f_data);
|
||||
auto f_data2 = f_kw.data();
|
||||
for (size_t i=0; i < f_data.size(); i++)
|
||||
test_assert_true(f_data[i] == f_data2[i]);
|
||||
|
||||
ERT::EclKW<int> i_kw("INT", i_data);
|
||||
auto i_data2 = i_kw.data();
|
||||
for (size_t i=0; i < i_data.size(); i++)
|
||||
test_assert_true(i_data[i] == i_data2[i]);
|
||||
|
||||
//ERT::EclKW<bool> b_kw("bbb", b_data);
|
||||
//auto b_data2 = b_kw.data();
|
||||
//for (size_t i=0; i < b_data.size(); i++)
|
||||
// test_assert_true(b_data[i] == b_data2[i]);
|
||||
|
||||
ERT::EclKW<std::string> s_kw("sss", s_data);
|
||||
auto s_data2 = s_kw.data();
|
||||
for (size_t i=0; i < s_data.size(); i++)
|
||||
test_assert_true(s_data[i] == s_data2[i]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void test_read_write() {
|
||||
std::vector<double> d_data = {1,2,3,4};
|
||||
std::vector<float> f_data = {10,20,30,40};
|
||||
std::vector<int> i_data = {100,200,300,400};
|
||||
std::vector<bool> b_data = {true,false};
|
||||
std::vector<std::string> s_data = {"S1", "S2", "S3"};
|
||||
|
||||
{
|
||||
ERT::TestArea ta("test_fwrite");
|
||||
{
|
||||
ERT::FortIO f("test_file", std::ios_base::out);
|
||||
ERT::write_kw(f, "DOUBLE", d_data);
|
||||
ERT::write_kw(f, "FLOAT", f_data);
|
||||
ERT::write_kw(f, "INT", i_data);
|
||||
ERT::write_kw(f, "BOOL", b_data);
|
||||
ERT::write_kw(f, "STRING", s_data);
|
||||
}
|
||||
|
||||
{
|
||||
ecl_file_type * f = ecl_file_open("test_file", 0);
|
||||
ecl_kw_type * d_kw = ecl_file_iget_named_kw(f, "DOUBLE", 0);
|
||||
ecl_kw_type * f_kw = ecl_file_iget_named_kw(f, "FLOAT", 0);
|
||||
ecl_kw_type * i_kw = ecl_file_iget_named_kw(f, "INT", 0);
|
||||
ecl_kw_type * b_kw = ecl_file_iget_named_kw(f, "BOOL", 0);
|
||||
ecl_kw_type * s_kw = ecl_file_iget_named_kw(f, "STRING", 0);
|
||||
|
||||
for (size_t i=0; i < d_data.size(); i++)
|
||||
test_assert_true(d_data[i] == ecl_kw_iget_double(d_kw,i));
|
||||
|
||||
for (size_t i=0; i < f_data.size(); i++)
|
||||
test_assert_true(f_data[i] == ecl_kw_iget_float(f_kw,i));
|
||||
|
||||
for (size_t i=0; i < i_data.size(); i++)
|
||||
test_assert_true(i_data[i] == ecl_kw_iget_int(i_kw,i));
|
||||
|
||||
for (size_t i=0; i < b_data.size(); i++)
|
||||
test_assert_true(b_data[i] == ecl_kw_iget_bool(b_kw,i));
|
||||
|
||||
for (size_t i=0; i < s_data.size(); i++) {
|
||||
std::string s8 = ecl_kw_iget_char_ptr(s_kw, i);
|
||||
test_assert_int_equal(s8.size(), 8);
|
||||
s8.erase(s8.find_last_not_of(' ')+1);
|
||||
test_assert_true( s_data[i] == s8);
|
||||
}
|
||||
|
||||
ecl_file_close(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
test_kw_name();
|
||||
test_kw_vector_assign();
|
||||
test_kw_vector_string();
|
||||
test_kw_vector_std_string();
|
||||
test_logical();
|
||||
test_move_semantics_no_crash();
|
||||
test_exception_assing_ref_wrong_type();
|
||||
test_resize();
|
||||
test_data();
|
||||
test_read_write();
|
||||
}
|
||||
|
||||
|
@ -18,14 +18,14 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
#include <ert/ecl_well/well_const.h>
|
||||
#include <ert/ecl_well/well_conn.h>
|
||||
#include <ert/ecl_well/well_branch_collection.h>
|
||||
#include <ert/ecl_well/well_const.hpp>
|
||||
#include <ert/ecl_well/well_conn.hpp>
|
||||
#include <ert/ecl_well/well_branch_collection.hpp>
|
||||
|
||||
|
||||
#define WELL_BRANCH_COLLECTION_TYPE_ID 67177087
|
||||
@ -43,7 +43,7 @@ static UTIL_SAFE_CAST_FUNCTION( well_branch_collection , WELL_BRANCH_COLLECTION_
|
||||
|
||||
|
||||
well_branch_collection_type * well_branch_collection_alloc() {
|
||||
well_branch_collection_type * branch_collection = util_malloc( sizeof * branch_collection );
|
||||
well_branch_collection_type * branch_collection = (well_branch_collection_type*)util_malloc( sizeof * branch_collection );
|
||||
UTIL_TYPE_ID_INIT( branch_collection , WELL_BRANCH_COLLECTION_TYPE_ID );
|
||||
branch_collection->__start_segments = vector_alloc_new();
|
||||
branch_collection->index_map = int_vector_alloc(0 , -1 );
|
||||
@ -82,7 +82,7 @@ bool well_branch_collection_has_branch( const well_branch_collection_type * bran
|
||||
|
||||
const well_segment_type * well_branch_collection_iget_start_segment( const well_branch_collection_type * branches , int index ) {
|
||||
if (index < vector_get_size( branches->__start_segments))
|
||||
return vector_iget_const( branches->__start_segments , index);
|
||||
return (const well_segment_type*)vector_iget_const( branches->__start_segments , index);
|
||||
else
|
||||
return NULL;
|
||||
}
|
@ -19,14 +19,14 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_rsthead.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_rsthead.hpp>
|
||||
|
||||
#include <ert/ecl_well/well_const.h>
|
||||
#include <ert/ecl_well/well_conn.h>
|
||||
#include <ert/ecl_well/well_const.hpp>
|
||||
#include <ert/ecl_well/well_conn.hpp>
|
||||
|
||||
|
||||
#define WELL_CONN_NORMAL_WELL_SEGMENT_ID -999
|
||||
@ -92,7 +92,7 @@ UTIL_SAFE_CAST_FUNCTION( well_conn , WELL_CONN_TYPE_ID)
|
||||
|
||||
static well_conn_type * well_conn_alloc__( int i , int j , int k , double connection_factor , well_conn_dir_enum dir , bool open, int segment_id, bool matrix_connection) {
|
||||
if (well_conn_assert_direction( dir , matrix_connection)) {
|
||||
well_conn_type * conn = util_malloc( sizeof * conn );
|
||||
well_conn_type * conn = (well_conn_type*)util_malloc( sizeof * conn );
|
||||
UTIL_TYPE_ID_INIT( conn , WELL_CONN_TYPE_ID );
|
||||
conn->i = i;
|
||||
conn->j = j;
|
||||
@ -142,9 +142,6 @@ well_conn_type * well_conn_alloc_fracture_MSW( int i , int j , int k , double co
|
||||
return well_conn_alloc__(i , j , k , connection_factor , dir , open , segment_id , false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Observe that the (ijk) and branch values are shifted to zero offset to be
|
||||
aligned with the rest of the ert libraries.
|
||||
@ -158,25 +155,30 @@ well_conn_type * well_conn_alloc_from_kw( const ecl_kw_type * icon_kw ,
|
||||
|
||||
const int icon_offset = header->niconz * ( header->ncwmax * well_nr + conn_nr );
|
||||
int IC =ecl_kw_iget_int( icon_kw , icon_offset + ICON_IC_INDEX );
|
||||
if (IC > 0) {
|
||||
well_conn_type * conn;
|
||||
if (IC <= 0)
|
||||
return NULL; /* IC < 0: Connection not in current LGR. */
|
||||
|
||||
|
||||
/*
|
||||
Out in the wild we have encountered files where the integer value used to
|
||||
indicate direction has had an invalid value for some connections. In this
|
||||
case we just return NULL and forget about the connection - it seems to work.
|
||||
*/
|
||||
int int_direction = ecl_kw_iget_int( icon_kw , icon_offset + ICON_DIRECTION_INDEX );
|
||||
if ((int_direction < 0) || (int_direction > ICON_FRACY)) {
|
||||
fprintf(stderr,"Invalid direction value:%d encountered for well - connection ignored\n",int_direction);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int i = ecl_kw_iget_int( icon_kw , icon_offset + ICON_I_INDEX ) - 1;
|
||||
int j = ecl_kw_iget_int( icon_kw , icon_offset + ICON_J_INDEX ) - 1;
|
||||
int k = ecl_kw_iget_int( icon_kw , icon_offset + ICON_K_INDEX ) - 1;
|
||||
double connection_factor = -1;
|
||||
bool matrix_connection = true;
|
||||
bool open;
|
||||
bool is_open = (ecl_kw_iget_int(icon_kw, icon_offset + ICON_STATUS_INDEX) > 0);
|
||||
well_conn_dir_enum dir = well_conn_fracX;
|
||||
|
||||
/* Set the status */
|
||||
{
|
||||
int int_status = ecl_kw_iget_int( icon_kw , icon_offset + ICON_STATUS_INDEX );
|
||||
if (int_status > 0)
|
||||
open = true;
|
||||
else
|
||||
open = false;
|
||||
}
|
||||
|
||||
|
||||
/* Set the K value and fracture flag. */
|
||||
{
|
||||
@ -189,10 +191,7 @@ well_conn_type * well_conn_alloc_from_kw( const ecl_kw_type * icon_kw ,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Set the direction flag */
|
||||
{
|
||||
int int_direction = ecl_kw_iget_int( icon_kw , icon_offset + ICON_DIRECTION_INDEX );
|
||||
if (int_direction == ICON_DEFAULT_DIR_VALUE)
|
||||
int_direction = ICON_DEFAULT_DIR_TARGET;
|
||||
|
||||
@ -212,18 +211,17 @@ well_conn_type * well_conn_alloc_from_kw( const ecl_kw_type * icon_kw ,
|
||||
case(ICON_FRACY):
|
||||
dir = well_conn_fracY;
|
||||
break;
|
||||
default:
|
||||
util_abort("%s: icon direction value:%d not recognized\n",__func__ , int_direction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (scon_kw) {
|
||||
const int scon_offset = header->nsconz * ( header->ncwmax * well_nr + conn_nr );
|
||||
connection_factor = ecl_kw_iget_as_double(scon_kw , scon_offset + SCON_CF_INDEX);
|
||||
}
|
||||
|
||||
{
|
||||
int segment_id = ecl_kw_iget_int( icon_kw , icon_offset + ICON_SEGMENT_INDEX ) - ECLIPSE_WELL_SEGMENT_OFFSET + WELL_SEGMENT_OFFSET;
|
||||
conn = well_conn_alloc__(i,j,k,connection_factor,dir,open,segment_id,matrix_connection);
|
||||
well_conn_type * conn = well_conn_alloc__(i,j,k,connection_factor,dir,is_open,segment_id,matrix_connection);
|
||||
|
||||
if (xcon_kw) {
|
||||
const int xcon_offset = header->nxconz * (header->ncwmax * well_nr + conn_nr);
|
||||
@ -242,8 +240,7 @@ well_conn_type * well_conn_alloc_from_kw( const ecl_kw_type * icon_kw ,
|
||||
*/
|
||||
|
||||
return conn;
|
||||
} else
|
||||
return NULL; /* IC < 0: Connection not in current LGR. */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -279,9 +276,9 @@ well_conn_type * well_conn_alloc_wellhead( const ecl_kw_type * iwel_kw , const e
|
||||
}
|
||||
|
||||
if (matrix_connection)
|
||||
return well_conn_alloc( conn_i , conn_j , conn_k , connection_factor , open , well_conn_dirZ );
|
||||
return well_conn_alloc( conn_i , conn_j , conn_k , connection_factor , (well_conn_dir_enum)open , well_conn_dirZ );
|
||||
else
|
||||
return well_conn_alloc_fracture( conn_i , conn_j , conn_k , connection_factor , open , well_conn_dirZ );
|
||||
return well_conn_alloc_fracture( conn_i , conn_j , conn_k , connection_factor , (well_conn_dir_enum)open , well_conn_dirZ );
|
||||
} else
|
||||
// The well is completed in this LGR - however the wellhead is in another LGR.
|
||||
return NULL;
|
@ -18,16 +18,16 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_rsthead.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_rsthead.hpp>
|
||||
|
||||
#include <ert/ecl_well/well_const.h>
|
||||
#include <ert/ecl_well/well_conn.h>
|
||||
#include <ert/ecl_well/well_conn_collection.h>
|
||||
#include <ert/ecl_well/well_const.hpp>
|
||||
#include <ert/ecl_well/well_conn.hpp>
|
||||
#include <ert/ecl_well/well_conn_collection.hpp>
|
||||
|
||||
|
||||
#define WELL_CONN_COLLECTION_TYPE_ID 67150087
|
||||
@ -43,7 +43,7 @@ static UTIL_SAFE_CAST_FUNCTION( well_conn_collection , WELL_CONN_COLLECTION_TYPE
|
||||
|
||||
|
||||
well_conn_collection_type * well_conn_collection_alloc() {
|
||||
well_conn_collection_type * wellcc = util_malloc( sizeof * wellcc );
|
||||
well_conn_collection_type * wellcc = (well_conn_collection_type*)util_malloc( sizeof * wellcc );
|
||||
UTIL_TYPE_ID_INIT( wellcc , WELL_CONN_COLLECTION_TYPE_ID );
|
||||
wellcc->connection_list = vector_alloc_new();
|
||||
return wellcc;
|
||||
@ -86,15 +86,16 @@ int well_conn_collection_get_size( const well_conn_collection_type * wellcc ) {
|
||||
const well_conn_type * well_conn_collection_iget_const(const well_conn_collection_type * wellcc , int index) {
|
||||
int size = well_conn_collection_get_size( wellcc );
|
||||
if (index < size)
|
||||
return vector_iget_const( wellcc->connection_list , index );
|
||||
return (const well_conn_type*)vector_iget_const( wellcc->connection_list , index );
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
well_conn_type * well_conn_collection_iget(const well_conn_collection_type * wellcc , int index) {
|
||||
int size = well_conn_collection_get_size( wellcc );
|
||||
if (index < size)
|
||||
return vector_iget( wellcc->connection_list , index );
|
||||
return (well_conn_type*)vector_iget( wellcc->connection_list , index );
|
||||
else
|
||||
return NULL;
|
||||
}
|
@ -19,23 +19,23 @@
|
||||
#include <time.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_rsthead.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_file_view.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_rsthead.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
|
||||
#include <ert/ecl_well/well_const.h>
|
||||
#include <ert/ecl_well/well_conn.h>
|
||||
#include <ert/ecl_well/well_state.h>
|
||||
#include <ert/ecl_well/well_info.h>
|
||||
#include <ert/ecl_well/well_ts.h>
|
||||
#include <ert/ecl_well/well_const.hpp>
|
||||
#include <ert/ecl_well/well_conn.hpp>
|
||||
#include <ert/ecl_well/well_state.hpp>
|
||||
#include <ert/ecl_well/well_info.hpp>
|
||||
#include <ert/ecl_well/well_ts.hpp>
|
||||
|
||||
|
||||
/*
|
||||
@ -192,7 +192,7 @@ struct well_info_struct {
|
||||
*/
|
||||
|
||||
well_info_type * well_info_alloc( const ecl_grid_type * grid) {
|
||||
well_info_type * well_info = util_malloc( sizeof * well_info );
|
||||
well_info_type * well_info = (well_info_type*)util_malloc( sizeof * well_info );
|
||||
well_info->wells = hash_alloc();
|
||||
well_info->well_names = stringlist_alloc_new();
|
||||
well_info->grid = grid;
|
||||
@ -205,7 +205,7 @@ bool well_info_has_well( well_info_type * well_info , const char * well_name ) {
|
||||
}
|
||||
|
||||
well_ts_type * well_info_get_ts( const well_info_type * well_info , const char *well_name) {
|
||||
return hash_get( well_info->wells , well_name );
|
||||
return (well_ts_type*)hash_get( well_info->wells , well_name );
|
||||
}
|
||||
|
||||
static void well_info_add_new_ts( well_info_type * well_info , const char * well_name) {
|
@ -18,15 +18,15 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_file_view.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
|
||||
#include <ert/ecl_well/well_const.h>
|
||||
#include <ert/ecl_well/well_rseg_loader.h>
|
||||
#include <ert/ecl_well/well_const.hpp>
|
||||
#include <ert/ecl_well/well_rseg_loader.hpp>
|
||||
|
||||
#include <ert/ecl/fortio.h>
|
||||
|
||||
@ -41,14 +41,14 @@ struct well_rseg_loader_struct {
|
||||
|
||||
|
||||
well_rseg_loader_type * well_rseg_loader_alloc(ecl_file_view_type * rst_view) {
|
||||
well_rseg_loader_type * loader = util_malloc(sizeof * loader);
|
||||
well_rseg_loader_type * loader = (well_rseg_loader_type*)util_malloc(sizeof * loader);
|
||||
|
||||
int element_count = 4;
|
||||
|
||||
loader->rst_view = rst_view;
|
||||
loader->relative_index_map = int_vector_alloc(0, 0);
|
||||
loader->absolute_index_map = int_vector_alloc(0, 0);
|
||||
loader->buffer = util_malloc(element_count * sizeof(double));
|
||||
loader->buffer = (char*)util_malloc(element_count * sizeof(double));
|
||||
loader->kw = RSEG_KW;
|
||||
|
||||
int_vector_append(loader->relative_index_map, RSEG_DEPTH_INDEX);
|
@ -18,17 +18,17 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/hash.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_rsthead.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_rsthead.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
#include <ert/ecl_well/well_const.h>
|
||||
#include <ert/ecl_well/well_conn.h>
|
||||
#include <ert/ecl_well/well_segment.h>
|
||||
#include <ert/ecl_well/well_conn_collection.h>
|
||||
#include <ert/ecl_well/well_const.hpp>
|
||||
#include <ert/ecl_well/well_conn.hpp>
|
||||
#include <ert/ecl_well/well_segment.hpp>
|
||||
#include <ert/ecl_well/well_conn_collection.hpp>
|
||||
|
||||
#define WELL_SEGMENT_TYPE_ID 2209166
|
||||
|
||||
@ -53,7 +53,7 @@ static UTIL_SAFE_CAST_FUNCTION( well_segment , WELL_SEGMENT_TYPE_ID )
|
||||
|
||||
|
||||
well_segment_type * well_segment_alloc(int segment_id , int outlet_segment_id , int branch_id , const double * rseg_data) {
|
||||
well_segment_type * segment = util_malloc( sizeof * segment );
|
||||
well_segment_type * segment = (well_segment_type*)util_malloc( sizeof * segment );
|
||||
UTIL_TYPE_ID_INIT( segment , WELL_SEGMENT_TYPE_ID );
|
||||
|
||||
segment->link_count = 0;
|
||||
@ -212,7 +212,7 @@ bool well_segment_add_connection( well_segment_type * segment , const char * gri
|
||||
hash_insert_hash_owned_ref( segment->connections , grid_name , well_conn_collection_alloc() , well_conn_collection_free__ );
|
||||
|
||||
{
|
||||
well_conn_collection_type * connections = hash_get( segment->connections , grid_name );
|
||||
well_conn_collection_type * connections = (well_conn_collection_type*)hash_get( segment->connections , grid_name );
|
||||
well_conn_collection_add_ref( connections , conn );
|
||||
}
|
||||
return true;
|
||||
@ -223,7 +223,7 @@ bool well_segment_add_connection( well_segment_type * segment , const char * gri
|
||||
|
||||
const well_conn_collection_type * well_segment_get_connections(const well_segment_type * segment , const char * grid_name ) {
|
||||
if (well_segment_has_grid_connections( segment , grid_name))
|
||||
return hash_get( segment->connections , grid_name);
|
||||
return (const well_conn_collection_type*)hash_get( segment->connections , grid_name);
|
||||
else
|
||||
return NULL;
|
||||
}
|
@ -18,18 +18,18 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_rsthead.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_rsthead.hpp>
|
||||
|
||||
#include <ert/ecl_well/well_const.h>
|
||||
#include <ert/ecl_well/well_segment.h>
|
||||
#include <ert/ecl_well/well_conn.h>
|
||||
#include <ert/ecl_well/well_segment_collection.h>
|
||||
#include <ert/ecl_well/well_conn_collection.h>
|
||||
#include <ert/ecl_well/well_branch_collection.h>
|
||||
#include <ert/ecl_well/well_const.hpp>
|
||||
#include <ert/ecl_well/well_segment.hpp>
|
||||
#include <ert/ecl_well/well_conn.hpp>
|
||||
#include <ert/ecl_well/well_segment_collection.hpp>
|
||||
#include <ert/ecl_well/well_conn_collection.hpp>
|
||||
#include <ert/ecl_well/well_branch_collection.hpp>
|
||||
|
||||
|
||||
struct well_segment_collection_struct {
|
||||
@ -40,7 +40,7 @@ struct well_segment_collection_struct {
|
||||
|
||||
|
||||
well_segment_collection_type * well_segment_collection_alloc(void) {
|
||||
well_segment_collection_type * segment_collection = util_malloc( sizeof * segment_collection );
|
||||
well_segment_collection_type * segment_collection = (well_segment_collection_type*)util_malloc( sizeof * segment_collection );
|
||||
|
||||
segment_collection->__segment_storage = vector_alloc_new();
|
||||
segment_collection->segment_index_map = int_vector_alloc( 0 , -1 );
|
||||
@ -77,7 +77,7 @@ void well_segment_collection_add( well_segment_collection_type * segment_collect
|
||||
|
||||
|
||||
well_segment_type * well_segment_collection_iget( const well_segment_collection_type * segment_collection , int index) {
|
||||
return vector_iget( segment_collection->__segment_storage , index );
|
||||
return (well_segment_type*)vector_iget( segment_collection->__segment_storage , index );
|
||||
}
|
||||
|
||||
|
@ -25,27 +25,27 @@
|
||||
#include <time.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_rsthead.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_units.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_rsthead.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_units.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
|
||||
#include <ert/ecl_well/well_const.h>
|
||||
#include <ert/ecl_well/well_conn.h>
|
||||
#include <ert/ecl_well/well_state.h>
|
||||
#include <ert/ecl_well/well_segment_collection.h>
|
||||
#include <ert/ecl_well/well_branch_collection.h>
|
||||
#include <ert/ecl_well/well_rseg_loader.h>
|
||||
#include <ert/ecl_well/well_const.hpp>
|
||||
#include <ert/ecl_well/well_conn.hpp>
|
||||
#include <ert/ecl_well/well_state.hpp>
|
||||
#include <ert/ecl_well/well_segment_collection.hpp>
|
||||
#include <ert/ecl_well/well_branch_collection.hpp>
|
||||
#include <ert/ecl_well/well_rseg_loader.hpp>
|
||||
|
||||
/*
|
||||
|
||||
@ -193,7 +193,7 @@ UTIL_IS_INSTANCE_FUNCTION( well_state , WELL_STATE_TYPE_ID)
|
||||
|
||||
|
||||
well_state_type * well_state_alloc(const char * well_name , int global_well_nr , bool open, well_type_enum type , int report_nr, time_t valid_from) {
|
||||
well_state_type * well_state = util_malloc( sizeof * well_state );
|
||||
well_state_type * well_state = (well_state_type*)util_malloc( sizeof * well_state );
|
||||
UTIL_TYPE_ID_INIT( well_state , WELL_STATE_TYPE_ID );
|
||||
well_state->index_wellhead = vector_alloc_new();
|
||||
well_state->name_wellhead = hash_alloc();
|
||||
@ -340,7 +340,7 @@ static int well_state_get_lgr_well_nr( const well_state_type * well_state , cons
|
||||
while (true) {
|
||||
bool found = false;
|
||||
{
|
||||
char * lgr_well_name = util_alloc_strip_copy( ecl_kw_iget_ptr( zwel_kw , well_nr * header->nzwelz) );
|
||||
char * lgr_well_name = (char*)util_alloc_strip_copy( (const char*)ecl_kw_iget_ptr( zwel_kw , well_nr * header->nzwelz) );
|
||||
|
||||
if ( strcmp( well_state->name , lgr_well_name) == 0)
|
||||
found = true;
|
||||
@ -425,7 +425,7 @@ static void well_state_add_connections__( well_state_type * well_state ,
|
||||
xcon_kw = ecl_file_view_iget_named_kw(rst_view, XCON_KW, 0);
|
||||
}
|
||||
|
||||
well_conn_collection_type * wellcc = hash_get( well_state->connections , grid_name );
|
||||
well_conn_collection_type * wellcc = (well_conn_collection_type*)hash_get( well_state->connections , grid_name );
|
||||
well_conn_collection_load_from_kw( wellcc , iwel_kw , icon_kw , scon_kw, xcon_kw , well_nr , header );
|
||||
}
|
||||
ecl_rsthead_free( header );
|
||||
@ -518,7 +518,7 @@ bool well_state_add_MSW2( well_state_type * well_state ,
|
||||
hash_iter_type * grid_iter = hash_iter_alloc( well_state->connections );
|
||||
while (!hash_iter_is_complete( grid_iter )) {
|
||||
const char * grid_name = hash_iter_get_next_key( grid_iter );
|
||||
const well_conn_collection_type * connections = hash_get( well_state->connections , grid_name );
|
||||
const well_conn_collection_type * connections = (const well_conn_collection_type*)hash_get( well_state->connections , grid_name );
|
||||
well_segment_collection_add_connections( well_state->segments , grid_name , connections );
|
||||
}
|
||||
hash_iter_free( grid_iter );
|
||||
@ -581,7 +581,7 @@ well_state_type * well_state_alloc_from_file2( ecl_file_view_type * file_view ,
|
||||
|
||||
{
|
||||
const int zwel_offset = global_header->nzwelz * global_well_nr;
|
||||
name = util_alloc_strip_copy(ecl_kw_iget_ptr( global_zwel_kw , zwel_offset )); // Hardwired max 8 characters in Well Name
|
||||
name = (char*)util_alloc_strip_copy((const char*)ecl_kw_iget_ptr( global_zwel_kw , zwel_offset )); // Hardwired max 8 characters in Well Name
|
||||
}
|
||||
|
||||
well_state = well_state_alloc(name , global_well_nr , open , type , report_nr , global_header->sim_time);
|
||||
@ -631,20 +631,20 @@ time_t well_state_get_sim_time( const well_state_type * well_state ) {
|
||||
Will return NULL if no wellhead in this grid.
|
||||
*/
|
||||
const well_conn_type * well_state_iget_wellhead( const well_state_type * well_state , int grid_nr) {
|
||||
return vector_safe_iget_const( well_state->index_wellhead , grid_nr );
|
||||
return (const well_conn_type*)vector_safe_iget_const( well_state->index_wellhead , grid_nr );
|
||||
}
|
||||
|
||||
|
||||
const well_conn_type * well_state_get_wellhead( const well_state_type * well_state , const char * grid_name) {
|
||||
if (hash_has_key( well_state->name_wellhead , grid_name))
|
||||
return hash_get( well_state->name_wellhead , grid_name );
|
||||
return (const well_conn_type*)hash_get( well_state->name_wellhead , grid_name );
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const well_conn_type * well_state_get_global_wellhead( const well_state_type * well_state ) {
|
||||
if (hash_has_key( well_state->name_wellhead , ECL_GRID_GLOBAL_GRID))
|
||||
return hash_get( well_state->name_wellhead , ECL_GRID_GLOBAL_GRID );
|
||||
return (const well_conn_type*)hash_get( well_state->name_wellhead , ECL_GRID_GLOBAL_GRID );
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@ -672,7 +672,7 @@ const char * well_state_get_name( const well_state_type * well_state ) {
|
||||
|
||||
const well_conn_collection_type * well_state_get_grid_connections( const well_state_type * well_state , const char * grid_name) {
|
||||
if (hash_has_key( well_state->connections , grid_name))
|
||||
return hash_get( well_state->connections , grid_name);
|
||||
return (const well_conn_collection_type*)hash_get( well_state->connections , grid_name);
|
||||
else
|
||||
return NULL;
|
||||
}
|
@ -62,12 +62,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
|
||||
#include <ert/ecl_well/well_ts.h>
|
||||
#include <ert/ecl_well/well_const.h>
|
||||
#include <ert/ecl_well/well_state.h>
|
||||
#include <ert/ecl_well/well_ts.hpp>
|
||||
#include <ert/ecl_well/well_const.hpp>
|
||||
#include <ert/ecl_well/well_state.hpp>
|
||||
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ struct well_ts_struct {
|
||||
/******************************************************************/
|
||||
|
||||
static well_node_type * well_node_alloc( well_state_type * well_state) {
|
||||
well_node_type * node = util_malloc( sizeof * node );
|
||||
well_node_type * node = (well_node_type*)util_malloc( sizeof * node );
|
||||
UTIL_TYPE_ID_INIT( node , WELL_NODE_TYPE_ID );
|
||||
node->report_nr = well_state_get_report_nr( well_state );
|
||||
node->sim_time = well_state_get_sim_time( well_state );
|
||||
@ -131,7 +131,7 @@ static int well_node_time_cmp( const void * arg1 , const void * arg2) {
|
||||
/*****************************************************************/
|
||||
|
||||
static well_ts_type * well_ts_alloc_empty( ) {
|
||||
well_ts_type * well_ts = util_malloc( sizeof * well_ts );
|
||||
well_ts_type * well_ts = (well_ts_type*)util_malloc( sizeof * well_ts );
|
||||
UTIL_TYPE_ID_INIT( well_ts , WELL_TS_TYPE_ID );
|
||||
|
||||
well_ts->ts = vector_alloc_new();
|
||||
@ -157,8 +157,8 @@ static int well_ts_get_index__( const well_ts_type * well_ts , int report_step ,
|
||||
return 0;
|
||||
|
||||
else {
|
||||
const well_node_type * first_node = vector_iget_const( well_ts->ts , 0 );
|
||||
const well_node_type * last_node = vector_get_last_const( well_ts->ts );
|
||||
const well_node_type * first_node = (const well_node_type*)vector_iget_const( well_ts->ts , 0 );
|
||||
const well_node_type * last_node = (const well_node_type*)vector_get_last_const( well_ts->ts );
|
||||
|
||||
if (use_report) {
|
||||
if (report_step < first_node->report_nr)
|
||||
@ -181,7 +181,7 @@ static int well_ts_get_index__( const well_ts_type * well_ts , int report_step ,
|
||||
|
||||
while (true) {
|
||||
int center_index = (lower_index + upper_index) / 2;
|
||||
const well_node_type * center_node = vector_iget_const( well_ts->ts , center_index );
|
||||
const well_node_type * center_node = (const well_node_type*)vector_iget_const( well_ts->ts , center_index );
|
||||
double cmp;
|
||||
if (use_report)
|
||||
cmp = center_node->report_nr - report_step;
|
||||
@ -221,11 +221,11 @@ static int well_ts_get_index( const well_ts_type * well_ts , int report_step , t
|
||||
// Inline check that the index is correct
|
||||
{
|
||||
bool OK = true;
|
||||
const well_node_type * node = vector_iget_const( well_ts->ts , index );
|
||||
const well_node_type * node = (const well_node_type*)vector_iget_const( well_ts->ts , index );
|
||||
well_node_type * next_node = NULL;
|
||||
|
||||
if (index < (vector_get_size( well_ts->ts ) - 1))
|
||||
next_node = vector_iget( well_ts->ts , index + 1);
|
||||
next_node = (well_node_type*)vector_iget( well_ts->ts , index + 1);
|
||||
|
||||
if (use_report) {
|
||||
if (index < 0) {
|
||||
@ -268,7 +268,7 @@ void well_ts_add_well( well_ts_type * well_ts , well_state_type * well_state ) {
|
||||
vector_append_owned_ref( well_ts->ts , new_node , well_node_free__ );
|
||||
|
||||
if (vector_get_size( well_ts->ts ) > 1) {
|
||||
const well_node_type * last_node = vector_get_last_const(well_ts->ts );
|
||||
const well_node_type * last_node = (const well_node_type*)vector_get_last_const(well_ts->ts );
|
||||
if (new_node->sim_time < last_node->sim_time)
|
||||
// The new node is chronologically before the previous node;
|
||||
// i.e. we must sort the nodes in time. This should probably happen
|
||||
@ -309,7 +309,7 @@ well_state_type * well_ts_get_last_state( const well_ts_type * well_ts) {
|
||||
|
||||
|
||||
well_state_type * well_ts_iget_state( const well_ts_type * well_ts , int index) {
|
||||
well_node_type * node = vector_iget( well_ts->ts , index );
|
||||
well_node_type * node = (well_node_type*)vector_iget( well_ts->ts , index );
|
||||
|
||||
return node->well_state;
|
||||
}
|
1
ThirdParty/Ert/lib/ert_api_config.h.in
vendored
1
ThirdParty/Ert/lib/ert_api_config.h.in
vendored
@ -7,6 +7,7 @@
|
||||
#cmakedefine ERT_HAVE_OPENDIR
|
||||
#cmakedefine ERT_HAVE_SYMLINK
|
||||
#cmakedefine ERT_HAVE_READLINKAT
|
||||
#cmakedefine ERT_HAVE_READLINKAT_DECLARATION
|
||||
#cmakedefine ERT_HAVE_GLOB
|
||||
#cmakedefine ERT_HAVE_GETUID
|
||||
#cmakedefine ERT_HAVE_REGEXP
|
||||
|
1
ThirdParty/Ert/lib/ert_api_config.hpp.in
vendored
Normal file
1
ThirdParty/Ert/lib/ert_api_config.hpp.in
vendored
Normal file
@ -0,0 +1 @@
|
||||
#include <ert/util/ert_api_config.h>
|
@ -21,9 +21,9 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/geometry/geo_pointset.h>
|
||||
#include <ert/geometry/geo_pointset.hpp>
|
||||
|
||||
|
||||
#define INIT_SIZE 256
|
||||
@ -42,17 +42,17 @@ struct geo_pointset_struct {
|
||||
|
||||
|
||||
static void geo_pointset_resize( geo_pointset_type * pointset, int new_alloc_size) {
|
||||
pointset->xcoord = util_realloc( pointset->xcoord , new_alloc_size * sizeof * pointset->xcoord );
|
||||
pointset->ycoord = util_realloc( pointset->ycoord , new_alloc_size * sizeof * pointset->ycoord );
|
||||
pointset->xcoord = (double*)util_realloc( pointset->xcoord , new_alloc_size * sizeof * pointset->xcoord );
|
||||
pointset->ycoord = (double*)util_realloc( pointset->ycoord , new_alloc_size * sizeof * pointset->ycoord );
|
||||
if (pointset->internal_z)
|
||||
pointset->zcoord = util_realloc( pointset->zcoord , new_alloc_size * sizeof * pointset->zcoord);
|
||||
pointset->zcoord = (double*)util_realloc( pointset->zcoord , new_alloc_size * sizeof * pointset->zcoord);
|
||||
|
||||
pointset->alloc_size = new_alloc_size;
|
||||
}
|
||||
|
||||
|
||||
geo_pointset_type * geo_pointset_alloc( bool internal_z) {
|
||||
geo_pointset_type * pointset = util_malloc( sizeof * pointset );
|
||||
geo_pointset_type * pointset = (geo_pointset_type*)util_malloc( sizeof * pointset );
|
||||
pointset->xcoord = NULL;
|
||||
pointset->ycoord = NULL;
|
||||
pointset->zcoord = NULL;
|
@ -21,12 +21,12 @@
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/double_vector.h>
|
||||
#include <ert/util/type_vector_functions.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/double_vector.hpp>
|
||||
#include <ert/util/type_vector_functions.hpp>
|
||||
|
||||
#include <ert/geometry/geo_util.h>
|
||||
#include <ert/geometry/geo_polygon.h>
|
||||
#include <ert/geometry/geo_util.hpp>
|
||||
#include <ert/geometry/geo_polygon.hpp>
|
||||
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ UTIL_IS_INSTANCE_FUNCTION( geo_polygon , GEO_POLYGON_TYPE_ID);
|
||||
|
||||
|
||||
geo_polygon_type * geo_polygon_alloc(const char * name) {
|
||||
geo_polygon_type * polygon = util_malloc( sizeof * polygon );
|
||||
geo_polygon_type * polygon = (geo_polygon_type*)util_malloc( sizeof * polygon );
|
||||
|
||||
UTIL_TYPE_ID_INIT( polygon , GEO_POLYGON_TYPE_ID );
|
||||
polygon->xcoord = double_vector_alloc( 0 , 0 );
|
||||
@ -189,11 +189,11 @@ void geo_polygon_iget_xy(const geo_polygon_type * polygon , int index , double *
|
||||
|
||||
bool geo_polygon_segment_intersects(const geo_polygon_type * polygon , double x1 , double y1 , double x2 , double y2) {
|
||||
bool intersects = false;
|
||||
double ** points = util_malloc( 4 * sizeof * points);
|
||||
double ** points = (double**)util_malloc( 4 * sizeof * points);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; i++)
|
||||
points[i] = util_malloc( 2 * sizeof * points[i]);
|
||||
points[i] = (double*)util_malloc( 2 * sizeof * points[i]);
|
||||
}
|
||||
|
||||
points[0][0] = x1;
|
@ -20,13 +20,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/hash.hpp>
|
||||
|
||||
#include <ert/geometry/geo_polygon.h>
|
||||
#include <ert/geometry/geo_polygon_collection.h>
|
||||
#include <ert/geometry/geo_polygon.hpp>
|
||||
#include <ert/geometry/geo_polygon_collection.hpp>
|
||||
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ struct geo_polygon_collection_struct {
|
||||
UTIL_IS_INSTANCE_FUNCTION( geo_polygon_collection , GEO_POLYGON_COLLECTION_TYPE_ID)
|
||||
|
||||
geo_polygon_collection_type * geo_polygon_collection_alloc( ) {
|
||||
geo_polygon_collection_type * polygons = util_malloc( sizeof * polygons );
|
||||
geo_polygon_collection_type * polygons = (geo_polygon_collection_type*)util_malloc( sizeof * polygons );
|
||||
UTIL_TYPE_ID_INIT( polygons , GEO_POLYGON_COLLECTION_TYPE_ID );
|
||||
polygons->polygon_list = vector_alloc_new();
|
||||
polygons->polygon_map = hash_alloc();
|
||||
@ -106,10 +106,10 @@ void geo_polygon_collection_free( geo_polygon_collection_type * polygons ) {
|
||||
|
||||
|
||||
geo_polygon_type * geo_polygon_collection_iget_polygon(const geo_polygon_collection_type * polygons , int index) {
|
||||
return vector_iget( polygons->polygon_list , index );
|
||||
return (geo_polygon_type*)vector_iget( polygons->polygon_list , index );
|
||||
}
|
||||
|
||||
|
||||
geo_polygon_type * geo_polygon_collection_get_polygon(const geo_polygon_collection_type * polygons , const char * polygon_name) {
|
||||
return hash_get( polygons->polygon_map , polygon_name );
|
||||
return (geo_polygon_type*)hash_get( polygons->polygon_map , polygon_name );
|
||||
}
|
@ -20,15 +20,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/bool_vector.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/bool_vector.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
|
||||
#include <ert/geometry/geo_util.h>
|
||||
#include <ert/geometry/geo_pointset.h>
|
||||
#include <ert/geometry/geo_region.h>
|
||||
#include <ert/geometry/geo_polygon.h>
|
||||
#include <ert/geometry/geo_util.hpp>
|
||||
#include <ert/geometry/geo_pointset.hpp>
|
||||
#include <ert/geometry/geo_region.hpp>
|
||||
#include <ert/geometry/geo_polygon.hpp>
|
||||
|
||||
#define GEO_REGION_TYPE_ID 4431973
|
||||
|
||||
@ -47,14 +47,14 @@ struct geo_region_struct {
|
||||
static UTIL_SAFE_CAST_FUNCTION( geo_region , GEO_REGION_TYPE_ID )
|
||||
|
||||
geo_region_type * geo_region_alloc( const geo_pointset_type * pointset , bool preselect) {
|
||||
geo_region_type * region = util_malloc( sizeof * region );
|
||||
geo_region_type * region = (geo_region_type*)util_malloc( sizeof * region );
|
||||
UTIL_TYPE_ID_INIT( region , GEO_REGION_TYPE_ID );
|
||||
|
||||
region->pointset = pointset;
|
||||
region->pointset_size = geo_pointset_get_size( pointset );
|
||||
region->preselect = preselect;
|
||||
region->index_list = int_vector_alloc( 0, 0);
|
||||
region->active_mask = util_calloc( region->pointset_size , sizeof * region->active_mask );
|
||||
region->active_mask = (bool*)util_calloc( region->pointset_size , sizeof * region->active_mask );
|
||||
geo_region_reset( region );
|
||||
|
||||
return region;
|
@ -20,11 +20,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
|
||||
#include <ert/geometry/geo_pointset.h>
|
||||
#include <ert/geometry/geo_surface.h>
|
||||
#include <ert/geometry/geo_pointset.hpp>
|
||||
#include <ert/geometry/geo_surface.hpp>
|
||||
|
||||
#define __PI 3.14159265
|
||||
#define GEO_SURFACE_TYPE_ID 111743
|
||||
@ -61,7 +61,7 @@ static void geo_surface_copy_header( const geo_surface_type * src , geo_surface_
|
||||
}
|
||||
|
||||
static geo_surface_type * geo_surface_alloc_empty( bool internal_z ) {
|
||||
geo_surface_type * surface = util_malloc( sizeof * surface );
|
||||
geo_surface_type * surface = (geo_surface_type*)util_malloc( sizeof * surface );
|
||||
UTIL_TYPE_ID_INIT( surface , GEO_SURFACE_TYPE_ID )
|
||||
surface->pointset = geo_pointset_alloc( internal_z );
|
||||
return surface;
|
||||
@ -242,7 +242,7 @@ static bool geo_surface_fload_irap( geo_surface_type * surface , const char * fi
|
||||
double * zcoord = NULL;
|
||||
|
||||
if (loadz) {
|
||||
zcoord = util_calloc( surface->nx * surface->ny , sizeof * zcoord );
|
||||
zcoord = (double*)util_calloc( surface->nx * surface->ny , sizeof * zcoord );
|
||||
read_ok = geo_surface_fscanf_zcoord( surface , stream , zcoord );
|
||||
}
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.hpp>
|
||||
|
||||
#include <ert/geometry/geo_util.h>
|
||||
#include <ert/geometry/geo_util.hpp>
|
||||
|
||||
#define EPSILON 0.000001
|
||||
|
123
ThirdParty/Ert/lib/include/ert/ecl/EclKW.hpp
vendored
123
ThirdParty/Ert/lib/include/ert/ecl/EclKW.hpp
vendored
@ -26,11 +26,9 @@
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
|
||||
#include <ert/util/ert_unique_ptr.hpp>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/FortIO.hpp>
|
||||
|
||||
namespace ERT {
|
||||
@ -45,12 +43,27 @@ namespace ERT {
|
||||
template<> struct ecl_type< int >
|
||||
{ static const ecl_type_enum type { ECL_INT_TYPE }; };
|
||||
|
||||
template<> struct ecl_type<bool>
|
||||
{ static const ecl_type_enum type {ECL_BOOL_TYPE}; };
|
||||
|
||||
template<> struct ecl_type< char* >
|
||||
{ static const ecl_type_enum type { ECL_CHAR_TYPE }; };
|
||||
|
||||
template<> struct ecl_type< const char* >
|
||||
{ static const ecl_type_enum type { ECL_CHAR_TYPE }; };
|
||||
|
||||
/*
|
||||
Both std::string and char* are mapped to the eight character string type
|
||||
ECL_CHAR_TYPE. That implies that the variable length string type
|
||||
ECL_STRING is invisible from this API.
|
||||
*/
|
||||
|
||||
template<> struct ecl_type< std::string >
|
||||
{ static const ecl_type_enum type { ECL_CHAR_TYPE}; };
|
||||
|
||||
template<> struct ecl_type<const std::string>
|
||||
{ static const ecl_type_enum type {ECL_CHAR_TYPE}; };
|
||||
|
||||
template <typename T>
|
||||
class EclKW_ref {
|
||||
public:
|
||||
@ -98,21 +111,36 @@ namespace ERT {
|
||||
ecl_kw_type* m_kw = nullptr;
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool EclKW_ref< bool >::at( size_t i ) const {
|
||||
return ecl_kw_iget_bool( this->m_kw, i );
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
inline const char* EclKW_ref< const char* >::at( size_t i ) const {
|
||||
return ecl_kw_iget_char_ptr( this->m_kw, i );
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
inline std::string EclKW_ref< std::string >::at( size_t i ) const {
|
||||
return ecl_kw_iget_char_ptr( this->m_kw, i );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
The current implementation of "string" storage in the underlying C
|
||||
ecl_kw structure does not lend itself to easily implement
|
||||
operator[]. We have therefore explicitly deleted it here.
|
||||
The current implementation of "string" and "bool" storage in the underlying C
|
||||
ecl_kw structure does not lend itself to easily implement operator[]. We have
|
||||
therefore explicitly deleted them here.
|
||||
*/
|
||||
|
||||
template<>
|
||||
const char*& EclKW_ref< const char* >::operator[]( size_t i ) = delete;
|
||||
|
||||
template<>
|
||||
bool& EclKW_ref<bool>::operator[]( size_t i) = delete;
|
||||
|
||||
template< typename T >
|
||||
class EclKW : public EclKW_ref< T > {
|
||||
@ -151,6 +179,14 @@ class EclKW : public EclKW_ref< T > {
|
||||
target[ i ] = T( data[ i ] );
|
||||
}
|
||||
|
||||
|
||||
std::vector<T> data() const {
|
||||
const T* ptr = static_cast<T*>(ecl_kw_get_ptr(this->m_kw));
|
||||
std::vector<T> vector;
|
||||
vector.assign(ptr, ptr + this->size());
|
||||
return vector;
|
||||
}
|
||||
|
||||
static EclKW load( FortIO& fortio ) {
|
||||
ecl_kw_type* c_ptr = ecl_kw_fread_alloc( fortio.get() );
|
||||
|
||||
@ -159,17 +195,88 @@ class EclKW : public EclKW_ref< T > {
|
||||
|
||||
return EclKW( c_ptr );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<> inline
|
||||
EclKW< const char* >::EclKW( const std::string& kw,
|
||||
const std::vector< const char* >& data ) :
|
||||
EclKW( kw, data.size() )
|
||||
{
|
||||
auto* ptr = this->get();
|
||||
for( size_t i = 0; i < data.size(); ++i )
|
||||
for( size_t i = 0; i < data.size(); ++i ) {
|
||||
if (strlen(data[i]) > 8)
|
||||
throw std::range_error("Strings must be maximum 8 characters long");
|
||||
ecl_kw_iset_string8( ptr, i, data[ i ] );
|
||||
}
|
||||
}
|
||||
|
||||
template<> inline
|
||||
EclKW< std::string >::EclKW( const std::string& kw,
|
||||
const std::vector< std::string >& data ) :
|
||||
EclKW( kw, data.size() )
|
||||
{
|
||||
auto* ptr = this->get();
|
||||
for( size_t i = 0; i < data.size(); ++i ) {
|
||||
if (data[i].size() > 8)
|
||||
throw std::range_error("Strings must be maximum 8 characters long");
|
||||
ecl_kw_iset_string8( ptr, i, data[ i ].c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
template<> inline
|
||||
EclKW< std::string >::EclKW( const std::string& kw,
|
||||
const std::vector< const char* >& data ) :
|
||||
EclKW( kw, data.size() )
|
||||
{
|
||||
auto* ptr = this->get();
|
||||
for( size_t i = 0; i < data.size(); ++i) {
|
||||
if (strlen(data[i]) > 8)
|
||||
throw std::range_error("Strings must be maximum 8 characters long");
|
||||
ecl_kw_iset_string8( ptr, i, data[ i ]);
|
||||
}
|
||||
}
|
||||
|
||||
template<> inline
|
||||
EclKW<bool>::EclKW( const std::string& kw, const std::vector< bool >& data ) :
|
||||
EclKW( kw, data.size() )
|
||||
{
|
||||
for (size_t i = 0; i < data.size(); i++)
|
||||
ecl_kw_iset_bool( this->m_kw, i, data[i]);
|
||||
}
|
||||
|
||||
template<> inline
|
||||
std::vector<std::string> EclKW<std::string>::data() const
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
auto* ptr = this->get();
|
||||
for( size_t i = 0; i < this->size(); ++i ) {
|
||||
std::string s8 = ecl_kw_iget_char_ptr(ptr, i);
|
||||
s8.erase(s8.find_last_not_of(' ')+1);
|
||||
strings.push_back( s8 );
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
/*
|
||||
Will write an ecl_kw instance to the open Fortio file.
|
||||
*/
|
||||
template<typename T>
|
||||
void write_kw(FortIO& fortio, const std::string& kw, const std::vector<T>& data) {
|
||||
EclKW<T> ecl_kw(kw, data);
|
||||
ecl_kw_fwrite(ecl_kw.get(), fortio.get());
|
||||
}
|
||||
|
||||
/*
|
||||
Will write an empty ecl_kw instance of type 'MESS' to the Fortio file.
|
||||
*/
|
||||
inline void write_mess(FortIO& fortio, const std::string& kw) {
|
||||
ecl_kw_type * ecl_kw = ecl_kw_alloc(kw.c_str(), 0, ECL_MESS);
|
||||
ecl_kw_fwrite(ecl_kw, fortio.get());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_box.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_box.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_box.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_coarse_cell.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_coarse_cell.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_coarse_cell.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_endian_flip.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_endian_flip.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_file.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_file.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_file.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_file_kw.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_file_kw.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_file_kw.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_file_view.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_file_view.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_file_view.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
|
||||
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grav.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grav.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_grav.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grav_calc.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grav_calc.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_grav_calc.hpp>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grav_common.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grav_common.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_grav_common.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 );
|
||||
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grid.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grid.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grid_cache.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grid_cache.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_grid_cache.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grid_dims.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_grid_dims.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_grid_dims.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_init_file.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_init_file.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_init_file.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
|
||||
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_io_config.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_io_config.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_io_config.h>
|
8
ThirdParty/Ert/lib/include/ert/ecl/ecl_kw.h
vendored
8
ThirdParty/Ert/lib/include/ert/ecl/ecl_kw.h
vendored
@ -72,7 +72,6 @@ extern "C" {
|
||||
void ecl_kw_fwrite_data(const ecl_kw_type *_ecl_kw , fortio_type *fortio);
|
||||
bool ecl_kw_fread_realloc_data(ecl_kw_type *ecl_kw, fortio_type *fortio);
|
||||
ecl_data_type ecl_kw_get_data_type(const ecl_kw_type *);
|
||||
size_t ecl_kw_get_sizeof_ctype(const ecl_kw_type *);
|
||||
const char * ecl_kw_get_header8(const ecl_kw_type *);
|
||||
const char * ecl_kw_get_header(const ecl_kw_type * ecl_kw );
|
||||
ecl_kw_type * ecl_kw_alloc_empty(void);
|
||||
@ -88,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 *);
|
||||
@ -119,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);
|
||||
@ -140,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);
|
||||
@ -263,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 <ert/ecl/ecl_kw_grdecl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_kw.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_kw.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_sum_file.c' is part of ERT - Ensemble based Reservoir Tool.
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -16,12 +16,5 @@
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ecl_kw.h>
|
||||
#include <ecl_block.h>
|
||||
#include <ecl_fstate.h>
|
||||
#include <ecl_sum_file.h>
|
||||
|
||||
struct ecl_sum_struct {
|
||||
|
||||
};
|
||||
|
||||
#include <ert/ecl/ecl_kw_grdecl.h>
|
20
ThirdParty/Ert/lib/include/ert/ecl/ecl_kw_magic.hpp
vendored
Normal file
20
ThirdParty/Ert/lib/include/ert/ecl/ecl_kw_magic.hpp
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_data.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_data.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_nnc_data.h>
|
20
ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_export.hpp
vendored
Normal file
20
ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_export.hpp
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
|
||||
#include <ert/ecl/ecl_nnc_export.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_geometry.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_nnc_geometry.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_nnc_geometry.h>
|
14
ThirdParty/Ert/lib/include/ert/ecl/ecl_region.h
vendored
14
ThirdParty/Ert/lib/include/ert/ecl/ecl_region.h
vendored
@ -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 );
|
||||
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_region.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_region.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_region.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_rft_cell.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_rft_cell.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_rft_cell.h>
|
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_rft_file.hpp
vendored
Normal file
19
ThirdParty/Ert/lib/include/ert/ecl/ecl_rft_file.hpp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2018 Statoil ASA, Norway.
|
||||
|
||||
This file is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/ecl/ecl_rft_file.h>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user