mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Update ecllib from statoil master repo commit a165d636552fa0c0f96219d341f7f2c17c08dc9d
This commit is contained in:
parent
bffdef1c78
commit
23024b790f
@ -16,7 +16,7 @@ set(RESINSIGHT_DEV_VERSION ".04")
|
||||
set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f")
|
||||
|
||||
# https://github.com/Statoil/libecl
|
||||
set(ECL_GITHUB_SHA "0188b08081eb1ac4ade89ac224b8128b4c9b0481")
|
||||
set(ECL_GITHUB_SHA "a165d636552fa0c0f96219d341f7f2c17c08dc9d")
|
||||
|
||||
# https://github.com/OPM/opm-flowdiagnostics
|
||||
set(OPM_FLOWDIAGNOSTICS_SHA "f8af0914f8b1ddcda41f040f539c945a6057f5e4")
|
||||
|
57
ThirdParty/Ert/CMakeLists.txt
vendored
57
ThirdParty/Ert/CMakeLists.txt
vendored
@ -1,7 +1,8 @@
|
||||
cmake_minimum_required( VERSION 2.8.12 )
|
||||
cmake_minimum_required( VERSION 2.8.12 ) # If you are creating Python wrappers for Windows, the actual version requirement is 3.4
|
||||
project( ERT C CXX )
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(TestBigEndian)
|
||||
|
||||
if(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 OLD)
|
||||
@ -115,7 +116,7 @@ endif()
|
||||
# Treat warnings as errors if not on Windows
|
||||
if (NOT ERT_WINDOWS)
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wno-unknown-pragmas ")
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall " )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas -Wno-unused-result -Wno-unused-parameter" )
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
@ -191,11 +192,6 @@ if (SHLWAPI_LIBRARY)
|
||||
set(shlwapi ${SHLWAPI_LIBRARY})
|
||||
endif ()
|
||||
|
||||
find_library(WS2_32_LIBRARY NAMES Ws2_32)
|
||||
if (WS2_32_LIBRARY)
|
||||
set(ws2_32 ${WS2_32_LIBRARY})
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
# feature tests
|
||||
@ -227,9 +223,6 @@ check_function_exists( mkdir HAVE_POSIX_MKDIR)
|
||||
check_function_exists( _mkdir HAVE_WINDOWS_MKDIR)
|
||||
check_function_exists( opendir ERT_HAVE_OPENDIR )
|
||||
check_function_exists( posix_spawn ERT_HAVE_SPAWN )
|
||||
check_function_exists( pthread_timedjoin_np HAVE_TIMEDJOIN)
|
||||
check_function_exists( pthread_yield HAVE_YIELD)
|
||||
check_function_exists( pthread_yield_np HAVE_YIELD_NP)
|
||||
check_function_exists( readlinkat ERT_HAVE_READLINKAT )
|
||||
check_function_exists( realpath HAVE_REALPATH )
|
||||
check_function_exists( regexec ERT_HAVE_REGEXP )
|
||||
@ -247,10 +240,7 @@ check_include_file(execinfo.h HAVE_EXECINFO)
|
||||
check_include_file(getopt.h ERT_HAVE_GETOPT)
|
||||
check_include_file(unistd.h ERT_HAVE_UNISTD)
|
||||
|
||||
# Portability checks; look for htons function
|
||||
check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
|
||||
check_include_file("arpa/inet.h" HAVE_ARPA_INET_H)
|
||||
check_include_file("winsock2.h" HAVE_WINSOCK2_H)
|
||||
test_big_endian(BIG_ENDIAN)
|
||||
|
||||
check_type_size(time_t SIZE_OF_TIME_T)
|
||||
if (${SIZE_OF_TIME_T} EQUAL 8)
|
||||
@ -329,33 +319,31 @@ if (MSVC)
|
||||
add_definitions( -D__func__="\\"????\\"")
|
||||
endif()
|
||||
|
||||
if (ERT_WINDOWS)
|
||||
message(WARNING "Python is not supported on Windows")
|
||||
set( ENABLE_PYTHON OFF )
|
||||
endif ()
|
||||
|
||||
if (ERT_LINUX)
|
||||
add_definitions( -DHAVE_PROC )
|
||||
endif()
|
||||
|
||||
add_subdirectory( external/catch2 )
|
||||
add_subdirectory( lib )
|
||||
add_subdirectory( applications )
|
||||
add_subdirectory( bin )
|
||||
|
||||
if (ENABLE_PYTHON)
|
||||
if (ERT_WINDOWS)
|
||||
message(WARNING "Python is not supported on Windows")
|
||||
set( ENABLE_PYTHON OFF )
|
||||
else()
|
||||
# If finding the Python interpreter and required packages
|
||||
# fails in the python/CMakeLists.txt file the ENABLE_PYTHON
|
||||
# will be set to OFF.
|
||||
add_subdirectory( python )
|
||||
if (ENABLE_PYTHON AND ERT_WINDOWS)
|
||||
if ((NOT MSVC) OR (MSVC_VERSION LESS 1900))
|
||||
message(FATAL_ERROR "The Python wrappers require Visual Studio 2015 or newer")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (ENABLE_PYTHON)
|
||||
# If finding the Python interpreter and required packages
|
||||
# fails in the python/CMakeLists.txt file the ENABLE_PYTHON
|
||||
# will be set to OFF.
|
||||
add_subdirectory( python )
|
||||
|
||||
if(RST_DOC)
|
||||
add_subdirectory( docs )
|
||||
endif()
|
||||
|
||||
if(RST_DOC)
|
||||
add_subdirectory( docs )
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (ENABLE_PYTHON)
|
||||
@ -364,9 +352,6 @@ if (ENABLE_PYTHON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (INSTALL_ERT)
|
||||
install(EXPORT ecl-config DESTINATION share/cmake/ecl)
|
||||
endif()
|
||||
|
||||
install(EXPORT ecl-config DESTINATION share/cmake/ecl)
|
||||
export(TARGETS ecl FILE eclConfig.cmake)
|
||||
export(PACKAGE ecl)
|
||||
|
2
ThirdParty/Ert/applications/ecl/ecl_pack.c
vendored
2
ThirdParty/Ert/applications/ecl/ecl_pack.c
vendored
@ -99,7 +99,7 @@ int main(int argc, char ** argv) {
|
||||
if (seqnum_kw != NULL) ecl_kw_free(seqnum_kw);
|
||||
}
|
||||
free(ecl_base);
|
||||
util_safe_free(path);
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
2
ThirdParty/Ert/applications/ecl/ecl_unpack.c
vendored
2
ThirdParty/Ert/applications/ecl/ecl_unpack.c
vendored
@ -93,7 +93,7 @@ void unpack_file(const char * filename) {
|
||||
block_index++;
|
||||
}
|
||||
ecl_file_close( src_file );
|
||||
util_safe_free(path);
|
||||
free(path);
|
||||
free(base);
|
||||
}
|
||||
}
|
||||
|
14
ThirdParty/Ert/applications/ecl/kw_extract.c
vendored
14
ThirdParty/Ert/applications/ecl/kw_extract.c
vendored
@ -20,9 +20,9 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ert/util/set.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/hash.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/fortio.h>
|
||||
@ -47,12 +47,14 @@ int main(int argc, char ** argv) {
|
||||
{
|
||||
const char * src_file = argv[1];
|
||||
const char * target_file = argv[2];
|
||||
const char ** kw_list = (const char **) &argv[3];
|
||||
int num_kw = argc - 3;
|
||||
fortio_type * fortio_src;
|
||||
fortio_type * fortio_target;
|
||||
bool fmt_src , fmt_target;
|
||||
set_type * kw_set = set_alloc( num_kw , kw_list );
|
||||
stringlist_type * kw_set = stringlist_alloc_new();
|
||||
|
||||
|
||||
for (int iarg=3; iarg < argc; iarg++)
|
||||
stringlist_append_ref(kw_set, argv[iarg]);
|
||||
|
||||
if (!ecl_util_fmt_file(src_file, &fmt_src))
|
||||
util_exit("Hmm - could not determine formatted/unformatted status for:%s \n",src_file);
|
||||
@ -66,7 +68,7 @@ int main(int argc, char ** argv) {
|
||||
while (true) {
|
||||
if (ecl_kw_fread_header( ecl_kw , fortio_src ) == ECL_KW_READ_OK) {
|
||||
const char * header = ecl_kw_get_header( ecl_kw );
|
||||
if (set_has_key( kw_set , header )) {
|
||||
if (stringlist_contains( kw_set , header )) {
|
||||
ecl_kw_fread_realloc_data(ecl_kw , fortio_src );
|
||||
ecl_kw_fwrite( ecl_kw , fortio_target );
|
||||
} else
|
||||
@ -79,6 +81,6 @@ int main(int argc, char ** argv) {
|
||||
|
||||
fortio_fclose(fortio_src);
|
||||
fortio_fclose(fortio_target);
|
||||
set_free( kw_set );
|
||||
stringlist_free( kw_set );
|
||||
}
|
||||
}
|
||||
|
2
ThirdParty/Ert/applications/ecl/make_grid.c
vendored
2
ThirdParty/Ert/applications/ecl/make_grid.c
vendored
@ -63,7 +63,7 @@ int main(int argc, char ** argv) {
|
||||
}
|
||||
|
||||
free( basename );
|
||||
util_safe_free( path );
|
||||
free( path );
|
||||
ecl_grid_free( ecl_grid );
|
||||
}
|
||||
}
|
||||
|
@ -442,9 +442,9 @@ ecl_file_type ** load_restart_info(const char ** input, /* Input taken
|
||||
|
||||
*arg_offset = 3;
|
||||
|
||||
util_safe_free( file1 );
|
||||
util_safe_free( file2 );
|
||||
util_safe_free( unified_file );
|
||||
free( file1 );
|
||||
free( file2 );
|
||||
free( unified_file );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
67
ThirdParty/Ert/applications/ecl/sum_write.c
vendored
67
ThirdParty/Ert/applications/ecl/sum_write.c
vendored
@ -163,11 +163,6 @@ int main( int argc , char ** argv) {
|
||||
int nz = 10;
|
||||
|
||||
|
||||
smspec_node_type * wwct_wellx;
|
||||
smspec_node_type * wopr_wellx;
|
||||
vector_type * blank_nodes = vector_alloc_new();
|
||||
|
||||
|
||||
/*
|
||||
We create a new summary case which will be used for writing. The
|
||||
arguments are:
|
||||
@ -211,9 +206,7 @@ int main( int argc , char ** argv) {
|
||||
|
||||
3. The WGNAME value for this variable. WGNAME is the well or
|
||||
group name; if the variable in question is neither a well nor
|
||||
a group variable you can just send in NULL. The WGNAME value
|
||||
can be changed runtime with the ecl_sum_update_wgname()
|
||||
function.
|
||||
a group variable you can just send in NULL.
|
||||
|
||||
4. The NUMS value for this variable.
|
||||
|
||||
@ -221,15 +214,6 @@ int main( int argc , char ** argv) {
|
||||
|
||||
6. A defualt value for this variable.
|
||||
|
||||
Observe that as an alternative to ecl_sum_add_var() you can use
|
||||
the combination:
|
||||
|
||||
smspec_node_type * var = ecl_sum_add_blank_var( ecl_sum , DEFAULT_VALUE );
|
||||
.....
|
||||
ecl_sum_init_var( ecl_sum , var , keyword , wgname , num , unit );
|
||||
|
||||
This is an alternative when e.g. the name of wells is not known in
|
||||
advance.
|
||||
*/
|
||||
ecl_sum_add_var( ecl_sum , "FOPT" , NULL , 0 , "Barrels" , 99.0 );
|
||||
ecl_sum_add_var( ecl_sum , "BPR" , NULL , 567 , "BARS" , 0.0 );
|
||||
@ -257,43 +241,10 @@ int main( int argc , char ** argv) {
|
||||
then later on call one of the smspec_node_get_params_index()
|
||||
or smspec_node_get_gen_key1() functions.
|
||||
|
||||
If you wish to change the WGNAME value with
|
||||
ecl_sum_update_wgname() a later stage you must hold on to
|
||||
the smspec_node instance.
|
||||
|
||||
ECLIPSE supports the 'dynamic' creation of wells, however you must
|
||||
specify up-front how many wells (max) you will have, and then the
|
||||
name will be specified as the wells 'pop up' in the Schedule
|
||||
file. In the current implementation this is supported by requering
|
||||
that you first add all wells/groups with ecl_sum_add_var(), and
|
||||
then you can subsequently update the WGNAME value later. This is
|
||||
illustrated with the two lines below where we add the WWCT and
|
||||
WOPR variables for a well without name, and then call
|
||||
ecl_sum_update_wganme() further down in the code.
|
||||
*/
|
||||
|
||||
wwct_wellx = ecl_sum_add_var( ecl_sum , "WWCT" , NULL , 0 , "(1)" , 0.0);
|
||||
wopr_wellx = ecl_sum_add_var( ecl_sum , "WOPR" , NULL , 0 , "Barrels" , 0.0);
|
||||
|
||||
/*
|
||||
Here we add a collection of ten variables which are not
|
||||
initialized. Before they can be actually used you must initialize
|
||||
them with:
|
||||
|
||||
ecl_sum_init_var( ecl_sum , node , keyword , wgname , num , unit );
|
||||
|
||||
If you do not init them at all they will appear in the SMSPEC file
|
||||
as WWCT variable of the DUMMY_WELL (i.e. they will be discarded in
|
||||
a subsequent load, but the will be there).
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < 10; i++) {
|
||||
smspec_node_type * blank_node = ecl_sum_add_blank_var( ecl_sum , i * 1.0 );
|
||||
vector_append_ref( blank_nodes , blank_node );
|
||||
}
|
||||
}
|
||||
|
||||
smspec_node_type * wwct_wellx = ecl_sum_add_var( ecl_sum , "WWCT" , NULL , 0 , "(1)" , 0.0);
|
||||
smspec_node_type * wopr_wellx = ecl_sum_add_var( ecl_sum , "WOPR" , NULL , 0 , "Barrels" , 0.0);
|
||||
|
||||
|
||||
{
|
||||
@ -341,25 +292,19 @@ int main( int argc , char ** argv) {
|
||||
smpec_get_gen_key1() function:
|
||||
*/
|
||||
ecl_sum_tstep_set_from_key( tstep , "WWCT:OP-1" , sim_days / 10);
|
||||
if (report_step >= 5)
|
||||
if (report_step >= 5) {
|
||||
/*
|
||||
We can use the smspec_node value from the
|
||||
ecl_sum_add_var() function directly:
|
||||
*/
|
||||
ecl_sum_tstep_set_from_node( tstep , wwct_wellx , sim_days );
|
||||
ecl_sum_tstep_set_from_node( tstep, wopr_wellx, sim_days * 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Suddenly someone calls in and tell us the name of the mystery
|
||||
well:
|
||||
*/
|
||||
ecl_sum_update_wgname( ecl_sum , wwct_wellx , "OPX");
|
||||
ecl_sum_update_wgname( ecl_sum , wopr_wellx , "OPX");
|
||||
|
||||
vector_free( blank_nodes ); // Only frees the container - the actual nodes are handled by the ecl_sum instance.
|
||||
ecl_sum_fwrite( ecl_sum );
|
||||
ecl_sum_free( ecl_sum );
|
||||
}
|
||||
|
@ -26,10 +26,10 @@
|
||||
#endif
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/stringlist.h>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_sum.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_sum.hpp>
|
||||
|
||||
|
||||
|
||||
@ -201,7 +201,7 @@ int main(int argc , char ** argv) {
|
||||
const char ** arg_list = (const char **) &argv[arg_offset + 1];
|
||||
|
||||
|
||||
ecl_sum = ecl_sum_fread_alloc_case__( data_file , ":" , include_restart);
|
||||
ecl_sum = ecl_sum_fread_alloc_case2__( data_file , ":" , include_restart, true);
|
||||
/** If no keys have been presented the function will list available keys. */
|
||||
if (num_keys == 0)
|
||||
list_mode = true;
|
||||
|
2
ThirdParty/Ert/applications/ecl/vprofile.c
vendored
2
ThirdParty/Ert/applications/ecl/vprofile.c
vendored
@ -223,7 +223,7 @@ int main (int argc , char ** argv) {
|
||||
vprofile( i - 1, j - 1, ecl_grid , ecl_file , kw , tstep , output_fmt );
|
||||
|
||||
if (!unified)
|
||||
util_safe_free( restart_file );
|
||||
free( restart_file );
|
||||
} else
|
||||
fprintf(stderr,"** The string: \'%s\' was not interpreted as a time-step - ignored \n",tlist[it]);
|
||||
}
|
||||
|
31
ThirdParty/Ert/appveyor.yml
vendored
31
ThirdParty/Ert/appveyor.yml
vendored
@ -1,12 +1,27 @@
|
||||
version: 1.0.{build}
|
||||
|
||||
clone_depth: 1
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
||||
os: Visual Studio 2015
|
||||
image: Visual Studio 2015
|
||||
|
||||
platform:
|
||||
- x64
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
build_script:
|
||||
- cmd: >-
|
||||
mkdir build
|
||||
- IF "%platform%" == "x64" set W64="-GVisual Studio 14 2015 Win64"
|
||||
- cmake %W64% -DBUILD_SHARED_LIBS=ON
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DENABLE_PYTHON=ON
|
||||
-DERT_BUILD_CXX=OFF
|
||||
-DBUILD_APPLICATIONS=ON
|
||||
- cmake --build . --config %configuration% --target install
|
||||
|
||||
cd build
|
||||
|
||||
cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DERT_BUILD_CXX=OFF -DENABLE_PYTHON=OFF -DBUILD_APPLICATIONS=ON
|
||||
|
||||
|
||||
msbuild /m /p:Configuration=Release /p:Platform="x64" ERT.sln
|
||||
test_script:
|
||||
- ctest --config %configuration% --output-on-failure
|
||||
|
5
ThirdParty/Ert/debian/control
vendored
5
ThirdParty/Ert/debian/control
vendored
@ -2,7 +2,8 @@ Source: ecl
|
||||
Priority: extra
|
||||
Maintainer: Arne Morten Kvarving <arne.morten.kvarving@sintef.no>
|
||||
Build-Depends: debhelper (>= 8.0.0), cmake, liblapack-dev, libquadmath0,
|
||||
iputils-ping, zlib1g-dev, git, python-dev, python-numpy, python-cwrap
|
||||
iputils-ping, zlib1g-dev, git, python-dev, python-numpy, python-cwrap,
|
||||
python-pandas
|
||||
Standards-Version: 3.9.2
|
||||
Section: libs
|
||||
Homepage: http://ert.nr.no
|
||||
@ -26,6 +27,6 @@ Description: libecl Eclipse IO library
|
||||
Package: python-ecl
|
||||
Section: python
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libecl1, python-cwrap
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libecl1, python-cwrap, python-pandas, python-numpy
|
||||
Description: libecl Eclipse IO library - Python bindings
|
||||
libecl is a package for reading and writing the result files from the Eclipse reservoir simulator.
|
||||
|
7
ThirdParty/Ert/external/catch2/CMakeLists.txt
vendored
Normal file
7
ThirdParty/Ert/external/catch2/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
project(catch2 CXX)
|
||||
|
||||
# Dummy source file added because INTERFACE type
|
||||
# library is not available in CMake 2.8.12
|
||||
add_library(catch2 dummy.cpp)
|
||||
target_include_directories(catch2 SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
13287
ThirdParty/Ert/external/catch2/catch/catch.hpp
vendored
Normal file
13287
ThirdParty/Ert/external/catch2/catch/catch.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
0
ThirdParty/Ert/external/catch2/dummy.cpp
vendored
Normal file
0
ThirdParty/Ert/external/catch2/dummy.cpp
vendored
Normal file
175
ThirdParty/Ert/lib/CMakeLists.txt
vendored
175
ThirdParty/Ert/lib/CMakeLists.txt
vendored
@ -71,7 +71,6 @@ 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
|
||||
@ -107,7 +106,9 @@ add_library(ecl util/rng.cpp
|
||||
ecl/ecl_grav.cpp
|
||||
ecl/ecl_grav_calc.cpp
|
||||
ecl/ecl_smspec.cpp
|
||||
ecl/ecl_unsmry_loader.cpp
|
||||
ecl/ecl_sum_data.cpp
|
||||
ecl/ecl_sum_file_data.cpp
|
||||
ecl/ecl_util.cpp
|
||||
ecl/ecl_kw.cpp
|
||||
ecl/ecl_sum.cpp
|
||||
@ -152,15 +153,23 @@ add_library(ecl util/rng.cpp
|
||||
geometry/geo_region.cpp
|
||||
geometry/geo_polygon.cpp
|
||||
geometry/geo_polygon_collection.cpp
|
||||
|
||||
src/fortio.cpp
|
||||
)
|
||||
|
||||
if (ERT_WINDOWS)
|
||||
set_target_properties(ecl PROPERTIES PREFIX "lib")
|
||||
if (MSVC)
|
||||
set_target_properties(ecl PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
target_link_libraries(ecl PUBLIC ${m}
|
||||
${dl}
|
||||
${pthread}
|
||||
${blas}
|
||||
${zlib}
|
||||
${shlwapi}
|
||||
${ws2_32}
|
||||
)
|
||||
|
||||
target_include_directories(ecl
|
||||
@ -170,6 +179,8 @@ target_include_directories(ecl
|
||||
PRIVATE ${ZLIB_INCLUDE_DIRS}
|
||||
util
|
||||
include
|
||||
e3
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/private-include
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include
|
||||
)
|
||||
|
||||
@ -179,21 +190,22 @@ target_compile_definitions(ecl PRIVATE
|
||||
-DECL_VERSION_MAJOR=${ECL_VERSION_MAJOR}
|
||||
-DECL_VERSION_MINOR=${ECL_VERSION_MINOR}
|
||||
-DECL_VERSION_MICRO=${ECL_VERSION_MICRO}
|
||||
$<$<BOOL:${BIG_ENDIAN}>:HOST_BIG_ENDIAN>
|
||||
)
|
||||
|
||||
target_compile_options(ecl PUBLIC ${pthreadarg})
|
||||
|
||||
|
||||
if (ERT_USE_OPENMP)
|
||||
target_compile_options(ecl PUBLIC ${OpenMP_C_FLAGS})
|
||||
set_property(TARGET ecl APPEND PROPERTY LINK_FLAGS ${OpenMP_C_FLAGS})
|
||||
target_compile_options(ecl PUBLIC ${OpenMP_CXX_FLAGS})
|
||||
set_property(TARGET ecl APPEND PROPERTY LINK_FLAGS ${OpenMP_CXX_FLAGS})
|
||||
target_link_libraries( ecl PUBLIC ${OpenMP_EXE_LINKER_FLAGS})
|
||||
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}
|
||||
@ -218,12 +230,21 @@ if (ERT_BUILD_CXX)
|
||||
PATTERN *.hpp
|
||||
)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if (NOT BUILD_TESTS)
|
||||
return ()
|
||||
endif ()
|
||||
|
||||
add_executable(ecl3-testsuite test/testsuite.cpp
|
||||
test/fortio.cpp
|
||||
)
|
||||
target_include_directories(ecl3-testsuite
|
||||
PRIVATE e3
|
||||
)
|
||||
target_link_libraries(ecl3-testsuite catch2 ecl)
|
||||
|
||||
add_test(NAME ecl3 COMMAND ecl3-testsuite)
|
||||
|
||||
foreach (name ert_util_alloc_file_components
|
||||
ert_util_approx_equal
|
||||
ert_util_arg_pack
|
||||
@ -238,7 +259,6 @@ foreach (name ert_util_alloc_file_components
|
||||
ert_util_realpath
|
||||
ert_util_relpath_test
|
||||
ert_util_rng
|
||||
ert_util_sprintf_escape
|
||||
ert_util_sscan_test
|
||||
ert_util_statistics
|
||||
ert_util_strcat_test
|
||||
@ -249,19 +269,20 @@ foreach (name ert_util_alloc_file_components
|
||||
ert_util_vector_test
|
||||
ert_util_datetime
|
||||
ert_util_normal_path
|
||||
ert_util_mkdir_p
|
||||
)
|
||||
|
||||
add_executable(${name} util/tests/${name}.c)
|
||||
add_executable(${name} util/tests/${name}.cpp)
|
||||
target_link_libraries(${name} ecl)
|
||||
add_test(NAME ${name} COMMAND ${name})
|
||||
endforeach ()
|
||||
|
||||
add_executable(ecl_smspec_node ecl/tests/ecl_smspec_node.c)
|
||||
add_executable(ecl_smspec_node ecl/tests/ecl_smspec_node.cpp)
|
||||
target_link_libraries( ecl_smspec_node ecl)
|
||||
add_test(NAME ecl_smspec_node COMMAND ecl_smspec_node)
|
||||
|
||||
|
||||
add_executable(ert_util_work_area util/tests/ert_util_work_area.c)
|
||||
add_executable(ert_util_work_area util/tests/ert_util_work_area.cpp)
|
||||
target_link_libraries(ert_util_work_area ecl)
|
||||
add_test(NAME ert_util_work_area
|
||||
COMMAND ert_util_work_area data2/file1
|
||||
@ -270,48 +291,48 @@ add_test(NAME ert_util_work_area
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/util/tests
|
||||
)
|
||||
|
||||
add_executable(ert_util_cwd_test util/tests/ert_util_cwd_test.c)
|
||||
add_executable(ert_util_cwd_test util/tests/ert_util_cwd_test.cpp)
|
||||
target_link_libraries(ert_util_cwd_test ecl)
|
||||
add_test(NAME ert_util_cwd_test COMMAND ert_util_cwd_test ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(ert_util_copy_file util/tests/ert_util_copy_file.c)
|
||||
add_executable(ert_util_copy_file util/tests/ert_util_copy_file.cpp)
|
||||
target_link_libraries(ert_util_copy_file ecl)
|
||||
add_test(NAME ert_util_copy_file
|
||||
COMMAND ert_util_copy_file
|
||||
$<TARGET_FILE:ert_util_copy_file>)
|
||||
|
||||
add_executable(ert_util_file_readable util/tests/ert_util_file_readable.c)
|
||||
add_executable(ert_util_file_readable util/tests/ert_util_file_readable.cpp)
|
||||
target_link_libraries(ert_util_file_readable ecl)
|
||||
add_test(NAME ert_util_file_readable COMMAND ert_util_file_readable)
|
||||
|
||||
add_executable(ert_util_path_stack_test util/tests/ert_util_path_stack_test.c)
|
||||
add_executable(ert_util_path_stack_test util/tests/ert_util_path_stack_test.cpp)
|
||||
target_link_libraries(ert_util_path_stack_test ecl)
|
||||
add_test(NAME ert_util_path_stack_test COMMAND ert_util_path_stack_test
|
||||
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
|
||||
if (HAVE_BACKTRACE)
|
||||
add_executable(ert_util_abort_gnu_tests util/tests/ert_util_abort_gnu_tests.c)
|
||||
add_executable(ert_util_abort_gnu_tests util/tests/ert_util_abort_gnu_tests.cpp)
|
||||
target_link_libraries(ert_util_abort_gnu_tests ecl)
|
||||
add_test(NAME ert_util_abort_gnu_tests COMMAND ert_util_abort_gnu_tests)
|
||||
|
||||
add_executable(ert_util_addr2line util/tests/ert_util_addr2line.c)
|
||||
add_executable(ert_util_addr2line util/tests/ert_util_addr2line.cpp)
|
||||
target_link_libraries(ert_util_addr2line ecl)
|
||||
add_test(NAME ert_util_addr2line COMMAND ert_util_addr2line)
|
||||
endif()
|
||||
|
||||
if (HAVE_UTIL_ABORT_INTERCEPT)
|
||||
add_executable(ert_util_struct_vector util/tests/ert_util_struct_vector.c)
|
||||
add_executable(ert_util_struct_vector util/tests/ert_util_struct_vector.cpp)
|
||||
target_link_libraries(ert_util_struct_vector ecl)
|
||||
add_test(NAME ert_util_struct_vector COMMAND ert_util_struct_vector)
|
||||
|
||||
add_executable(ert_util_type_vector_test util/tests/ert_util_type_vector_test.c)
|
||||
add_executable(ert_util_type_vector_test util/tests/ert_util_type_vector_test.cpp)
|
||||
target_link_libraries(ert_util_type_vector_test ecl)
|
||||
add_test(NAME ert_util_type_vector_test COMMAND ert_util_type_vector_test)
|
||||
endif()
|
||||
|
||||
if (ERT_HAVE_SPAWN)
|
||||
add_executable(ert_util_spawn util/tests/ert_util_spawn.c)
|
||||
add_executable(ert_util_spawn util/tests/ert_util_spawn.cpp)
|
||||
target_link_libraries(ert_util_spawn ecl)
|
||||
add_test(NAME ert_util_spawn COMMAND ert_util_spawn)
|
||||
endif()
|
||||
@ -362,26 +383,35 @@ foreach (name ecl_alloc_cpgrid
|
||||
well_segment_collection
|
||||
ecl_file
|
||||
)
|
||||
add_executable(${name} ecl/tests/${name}.c)
|
||||
add_executable(${name} ecl/tests/${name}.cpp)
|
||||
target_link_libraries(${name} ecl)
|
||||
add_test(NAME ${name} COMMAND ${name})
|
||||
endforeach ()
|
||||
|
||||
add_executable(ecl_grid_cell_contains ecl/tests/ecl_grid_cell_contains.c)
|
||||
add_executable(ecl_unsmry_loader ecl/tests/ecl_unsmry_loader_test.cpp)
|
||||
target_link_libraries(ecl_unsmry_loader ecl)
|
||||
target_include_directories(ecl_unsmry_loader PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/private-include)
|
||||
add_test(NAME ecl_unsmry_loader COMMAND ecl_unsmry_loader)
|
||||
|
||||
add_executable(ecl_sum_data_intermediate ecl/tests/ecl_sum_data_intermediate_test.cpp)
|
||||
target_link_libraries(ecl_sum_data_intermediate ecl)
|
||||
add_test(NAME ecl_sum_data_intermediate COMMAND ecl_sum_data_intermediate)
|
||||
|
||||
add_executable(ecl_grid_cell_contains ecl/tests/ecl_grid_cell_contains.cpp)
|
||||
target_link_libraries(ecl_grid_cell_contains ecl)
|
||||
add_test(NAME ecl_grid_cell_contains1 COMMAND ecl_grid_cell_contains)
|
||||
|
||||
if (HAVE_UTIL_ABORT_INTERCEPT)
|
||||
add_executable(ecl_grid_corner ecl/tests/ecl_grid_corner.c)
|
||||
add_executable(ecl_grid_corner ecl/tests/ecl_grid_corner.cpp)
|
||||
target_link_libraries(ecl_grid_corner ecl)
|
||||
add_test(NAME ecl_grid_corner COMMAND ecl_grid_corner)
|
||||
|
||||
add_executable(ecl_layer ecl/tests/ecl_layer.c)
|
||||
add_executable(ecl_layer ecl/tests/ecl_layer.cpp)
|
||||
target_link_libraries(ecl_layer ecl)
|
||||
add_test(NAME ecl_layer COMMAND ecl_layer)
|
||||
endif()
|
||||
|
||||
add_executable(ecl_get_num_cpu ecl/tests/ecl_get_num_cpu_test.c)
|
||||
add_executable(ecl_get_num_cpu ecl/tests/ecl_get_num_cpu_test.cpp)
|
||||
target_link_libraries(ecl_get_num_cpu ecl)
|
||||
add_test(NAME ecl_get_num_cpu COMMAND ecl_get_num_cpu
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ecl/tests/data/num_cpu1
|
||||
@ -392,7 +422,7 @@ add_test(NAME ecl_get_num_cpu COMMAND ecl_get_num_cpu
|
||||
# The ecl_win64 application is not built as a proper test integrated
|
||||
# into the CTEST system. Should be invoked manually on Windows.
|
||||
if (ERT_WINDOWS)
|
||||
add_executable(ecl_lfs ecl/tests/ecl_lfs.c)
|
||||
add_executable(ecl_lfs ecl/tests/ecl_lfs.cpp)
|
||||
target_link_libraries(ecl_lfs ecl)
|
||||
endif()
|
||||
|
||||
@ -402,7 +432,7 @@ endif()
|
||||
|
||||
|
||||
foreach (name geo_util_xlines geo_polygon geo_polygon_collection)
|
||||
add_executable(${name} geometry/tests/${name}.c)
|
||||
add_executable(${name} geometry/tests/${name}.cpp)
|
||||
target_link_libraries(${name} ecl)
|
||||
add_test(NAME ${name} COMMAND ${name})
|
||||
endforeach ()
|
||||
@ -431,24 +461,24 @@ endif()
|
||||
#
|
||||
|
||||
|
||||
add_executable(ecl_coarse_test ecl/tests/ecl_coarse_test.c)
|
||||
add_executable(ecl_coarse_test ecl/tests/ecl_coarse_test.cpp)
|
||||
target_link_libraries(ecl_coarse_test ecl)
|
||||
add_test(NAME ecl_coarse_test COMMAND ecl_coarse_test
|
||||
${_eclpath}/LGCcase/LGC_TESTCASE2)
|
||||
|
||||
add_executable(ecl_grid_layer_contains ecl/tests/ecl_grid_layer_contains.c)
|
||||
add_executable(ecl_grid_layer_contains ecl/tests/ecl_grid_layer_contains.cpp)
|
||||
target_link_libraries(ecl_grid_layer_contains ecl)
|
||||
add_test(NAME ecl_grid_layer_contains1 COMMAND ecl_grid_layer_contains
|
||||
${_eclpath}/Gurbat/ECLIPSE.EGRID)
|
||||
add_test(NAME ecl_grid_layer_contains2 COMMAND ecl_grid_layer_contains
|
||||
${_eclpath}/Mariner/MARINER.EGRID)
|
||||
|
||||
add_executable(ecl_restart_test ecl/tests/ecl_restart_test.c)
|
||||
add_executable(ecl_restart_test ecl/tests/ecl_restart_test.cpp)
|
||||
target_link_libraries(ecl_restart_test ecl)
|
||||
add_test(NAME ecl_restart_test COMMAND ecl_restart_test
|
||||
${_eclpath}/Gurbat/ECLIPSE.UNRST)
|
||||
|
||||
add_executable(ecl_nnc_export ecl/tests/ecl_nnc_export.c)
|
||||
add_executable(ecl_nnc_export ecl/tests/ecl_nnc_export.cpp)
|
||||
target_link_libraries(ecl_nnc_export ecl)
|
||||
add_test(NAME ecl_nnc_export1 COMMAND ecl_nnc_export ${_eclpath}/Gurbat/ECLIPSE TRUE)
|
||||
add_test(NAME ecl_nnc_export2 COMMAND ecl_nnc_export ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC TRUE)
|
||||
@ -458,23 +488,23 @@ add_test(NAME ecl_nnc_export5 COMMAND ecl_nnc_export ${_eclpath}/DualPoro/DUALPO
|
||||
add_test(NAME ecl_nnc_export6 COMMAND ecl_nnc_export ${_eclpath}/nestedLGRcase/TESTCASE_NESTEDLGR TRUE)
|
||||
add_test(NAME ecl_nnc_export7 COMMAND ecl_nnc_export ${_eclpath}/TYRIHANS/BASE20150218_MULTFLT FALSE)
|
||||
|
||||
add_executable(ecl_nnc_export_get_tran ecl/tests/ecl_nnc_export_get_tran.c)
|
||||
add_executable(ecl_nnc_export_get_tran ecl/tests/ecl_nnc_export_get_tran.cpp)
|
||||
target_link_libraries(ecl_nnc_export_get_tran ecl)
|
||||
add_test(NAME ecl_nnc_export_get_tran COMMAND ecl_nnc_export_get_tran
|
||||
${_eclpath}/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3)
|
||||
|
||||
add_executable(ecl_nnc_data_statoil_root ecl/tests/test_ecl_nnc_data_statoil_root.c)
|
||||
add_executable(ecl_nnc_data_statoil_root ecl/tests/test_ecl_nnc_data_statoil_root.cpp)
|
||||
target_link_libraries(ecl_nnc_data_statoil_root ecl)
|
||||
add_test(NAME ecl_nnc_data_statoil_root COMMAND ecl_nnc_data_statoil_root
|
||||
${_eclpath}/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3
|
||||
${_eclpath}/flow-nnc/Simple4/SIMPLE_SUMMARY4
|
||||
${_eclpath}/flow-nnc/Gullfaks/GF_ACT_NEW_TEMP)
|
||||
|
||||
add_executable(ecl_util_make_date_shift ecl/tests/ecl_util_make_date_shift.c)
|
||||
add_executable(ecl_util_make_date_shift ecl/tests/ecl_util_make_date_shift.cpp)
|
||||
target_link_libraries(ecl_util_make_date_shift ecl)
|
||||
add_test(NAME ecl_util_make_date_shift COMMAND ecl_util_make_date_shift)
|
||||
|
||||
add_executable(ecl_sum_case_exists ecl/tests/ecl_sum_case_exists.c)
|
||||
add_executable(ecl_sum_case_exists ecl/tests/ecl_sum_case_exists.cpp)
|
||||
target_link_libraries(ecl_sum_case_exists ecl)
|
||||
add_test(NAME ecl_sum_case_exists COMMAND ecl_sum_case_exists
|
||||
${_eclpath}/Gurbat/ECLIPSE
|
||||
@ -482,12 +512,12 @@ add_test(NAME ecl_sum_case_exists COMMAND ecl_sum_case_exists
|
||||
${_eclpath}/GurbatSummary/missingData/ECLIPSE)
|
||||
|
||||
|
||||
add_executable(ecl_grid_lgr_name ecl/tests/ecl_grid_lgr_name.c)
|
||||
add_executable(ecl_grid_lgr_name ecl/tests/ecl_grid_lgr_name.cpp)
|
||||
target_link_libraries(ecl_grid_lgr_name ecl)
|
||||
add_test(NAME ecl_grid_lgr_name COMMAND ecl_grid_lgr_name
|
||||
${_eclpath}/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID)
|
||||
|
||||
add_executable(ecl_region ecl/tests/ecl_region.c)
|
||||
add_executable(ecl_region ecl/tests/ecl_region.cpp)
|
||||
target_link_libraries(ecl_region ecl)
|
||||
add_test(NAME ecl_region COMMAND ecl_region ${_eclpath}/Gurbat/ECLIPSE.EGRID)
|
||||
|
||||
@ -495,48 +525,43 @@ add_test(NAME ecl_grid_cell_contains2 COMMAND ecl_grid_cell_contains ${_eclpath}
|
||||
add_test(NAME ecl_grid_cell_contains3 COMMAND ecl_grid_cell_contains ${_eclpath}/FF12/FF12_2013B2.EGRID)
|
||||
add_test(NAME ecl_grid_cell_contains4 COMMAND ecl_grid_cell_contains ${_eclpath}/Brazil/R3_ICD.EGRID)
|
||||
|
||||
add_executable(ecl_grid_cell_contains_wellpath ecl/tests/ecl_grid_cell_contains_wellpath.c)
|
||||
add_executable(ecl_grid_cell_contains_wellpath ecl/tests/ecl_grid_cell_contains_wellpath.cpp)
|
||||
target_link_libraries(ecl_grid_cell_contains_wellpath ecl)
|
||||
add_test(NAME ecl_grid_cell_contains_wellpath1
|
||||
COMMAND ecl_grid_cell_contains_wellpath
|
||||
${_eclpath}/CellContains/model/SMS-0.EGRID
|
||||
${_eclpath}/CellContains/R_PB-4H.jira)
|
||||
|
||||
add_executable(ecl_grid_cell_volume ecl/tests/ecl_grid_cell_volume.c)
|
||||
target_link_libraries(ecl_grid_cell_volume ecl)
|
||||
add_test(NAME ecl_grid_cell_volume1 COMMAND ecl_grid_cell_volume)
|
||||
add_test(NAME ecl_grid_cell_volume2 COMMAND ecl_grid_cell_volume ${_eclpath}/Gurbat/ECLIPSE.EGRID)
|
||||
add_test(NAME ecl_grid_cell_volume3 COMMAND ecl_grid_cell_volume ${_eclpath}/Heidrun/Summary/FF12_2013B3_CLEAN_RS.EGRID)
|
||||
|
||||
add_executable(ecl_region2region ecl/tests/ecl_region2region_test.c)
|
||||
add_executable(ecl_region2region ecl/tests/ecl_region2region_test.cpp)
|
||||
target_link_libraries(ecl_region2region ecl)
|
||||
add_test(NAME ecl_region2region COMMAND ecl_region2region ${_eclpath}/R2R/R2R.SMSPEC)
|
||||
|
||||
add_executable(ecl_grid_case ecl/tests/ecl_grid_case.c)
|
||||
add_executable(ecl_grid_case ecl/tests/ecl_grid_case.cpp)
|
||||
target_link_libraries(ecl_grid_case ecl)
|
||||
add_test(NAME ecl_grid_case COMMAND ecl_grid_case
|
||||
${_eclpath}/Gurbat/ECLIPSE.EGRID
|
||||
${_eclpath}/Gurbat/ECLIPSE)
|
||||
|
||||
add_executable(ecl_lgr_test ecl/tests/ecl_lgr_test.c)
|
||||
add_executable(ecl_lgr_test ecl/tests/ecl_lgr_test.cpp)
|
||||
target_link_libraries(ecl_lgr_test ecl)
|
||||
add_test(NAME ecl_lgr_test1 COMMAND ecl_lgr_test ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.EGRID)
|
||||
add_test(NAME ecl_lgr_test2 COMMAND ecl_lgr_test ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.GRID)
|
||||
add_test(NAME ecl_lgr_test3 COMMAND ecl_lgr_test ${_eclpath}/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID)
|
||||
|
||||
add_executable(ecl_grid_simple ecl/tests/ecl_grid_simple.c)
|
||||
add_executable(ecl_grid_simple ecl/tests/ecl_grid_simple.cpp)
|
||||
target_link_libraries(ecl_grid_simple ecl)
|
||||
add_test(NAME ecl_grid_simple COMMAND ecl_grid_simple ${_eclpath}/Gurbat/ECLIPSE.EGRID)
|
||||
|
||||
add_test(NAME ecl_grid_ecl2015_2 COMMAND ecl_grid_simple
|
||||
${_eclpath}/Eclipse2015_NNC_BUG/FF15_2015B2_LGRM_RDI15_HIST_RDIREAL1_20142.EGRID)
|
||||
|
||||
add_executable(ecl_grid_export_statoil ecl/tests/ecl_grid_export.c)
|
||||
add_executable(ecl_grid_export_statoil ecl/tests/ecl_grid_export.cpp)
|
||||
target_link_libraries(ecl_grid_export_statoil ecl)
|
||||
add_test(NAME ecl_grid_export_statoil
|
||||
COMMAND ecl_grid_export_statoil ${_eclpath}/Gurbat/ECLIPSE.EGRID)
|
||||
|
||||
add_executable(ecl_grid_volume ecl/tests/ecl_grid_volume.c)
|
||||
add_executable(ecl_grid_volume ecl/tests/ecl_grid_volume.cpp)
|
||||
target_link_libraries(ecl_grid_volume ecl)
|
||||
add_test(NAME ecl_grid_volume1 COMMAND ecl_grid_volume ${_eclpath}/Gurbat/ECLIPSE)
|
||||
add_test(NAME ecl_grid_volume2 COMMAND ecl_grid_volume ${_eclpath}/VolumeTest/TEST1)
|
||||
@ -550,7 +575,7 @@ add_test(NAME ecl_grid_volume4 COMMAND ecl_grid_volume ${_eclpath}/Norne/reservo
|
||||
# algorithm gets volumes ~ 0 whereas ECLIPSE reports ~10^9 for the same cell.
|
||||
# add_test( ecl_grid_volume5 ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_volume ${_eclpath}/Heidrun/Summary/FF12_2013B3_CLEAN_RS)
|
||||
|
||||
add_executable(ecl_grid_dims ecl/tests/ecl_grid_dims.c)
|
||||
add_executable(ecl_grid_dims ecl/tests/ecl_grid_dims.cpp)
|
||||
target_link_libraries(ecl_grid_dims ecl)
|
||||
add_test(NAME ecl_grid_dims0 COMMAND ecl_grid_dims)
|
||||
add_test(NAME ecl_grid_dims1 COMMAND ecl_grid_dims ${_eclpath}/Gurbat/ECLIPSE.EGRID ${_eclpath}/Gurbat/ECLIPSE.INIT)
|
||||
@ -559,7 +584,7 @@ add_test(NAME ecl_grid_dims3 COMMAND ecl_grid_dims ${_eclpath}/Gurbat/ECLIPSE.EG
|
||||
add_test(NAME ecl_grid_dims4 COMMAND ecl_grid_dims ${_eclpath}/Gurbat/ECLIPSE.GRID )
|
||||
add_test(NAME ecl_grid_dims5 COMMAND ecl_grid_dims ${_eclpath}/AmalgLGRcase/TESTCASE_AMALG_LGR.EGRID)
|
||||
|
||||
add_executable(ecl_nnc_test ecl/tests/ecl_nnc_test.c)
|
||||
add_executable(ecl_nnc_test ecl/tests/ecl_nnc_test.cpp)
|
||||
target_link_libraries(ecl_nnc_test ecl)
|
||||
add_test(NAME ecl_nnc_test1 COMMAND ecl_nnc_test ${_eclpath}/Gurbat/ECLIPSE.EGRID )
|
||||
add_test(NAME ecl_nnc_test2 COMMAND ecl_nnc_test ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.EGRID )
|
||||
@ -567,21 +592,21 @@ add_test(NAME ecl_nnc_test3 COMMAND ecl_nnc_test ${_eclpath}/Troll/MSW_LGR/2BRAN
|
||||
add_test(NAME ecl_nnc_test4 COMMAND ecl_nnc_test ${_eclpath}/DualPoro/DUAL_DIFF.EGRID )
|
||||
add_test(NAME ecl_nnc_test5 COMMAND ecl_nnc_test ${_eclpath}/nestedLGRcase/TESTCASE_NESTEDLGR.EGRID)
|
||||
|
||||
add_executable(ecl_layer_statoil ecl/tests/ecl_layer_statoil.c)
|
||||
add_executable(ecl_layer_statoil ecl/tests/ecl_layer_statoil.cpp)
|
||||
target_link_libraries(ecl_layer_statoil ecl)
|
||||
add_test(NAME ecl_layer_statoil COMMAND ecl_layer_statoil
|
||||
${_eclpath}/Mariner/MARINER.EGRID
|
||||
${_eclpath}/Mariner/faultblock.grdecl)
|
||||
|
||||
add_executable(ecl_dualp ecl/tests/ecl_dualp.c)
|
||||
add_executable(ecl_dualp ecl/tests/ecl_dualp.cpp)
|
||||
target_link_libraries(ecl_dualp ecl)
|
||||
add_test(NAME ecl_dualp COMMAND ecl_dualp ${_eclpath}/LGCcase/LGC_TESTCASE2)
|
||||
|
||||
add_executable(ecl_sum_test ecl/tests/ecl_sum_test.c)
|
||||
add_executable(ecl_sum_test ecl/tests/ecl_sum_test.cpp)
|
||||
target_link_libraries(ecl_sum_test ecl)
|
||||
add_test(NAME ecl_sum_test COMMAND ecl_sum_test ${_eclpath}/Gurbat/ECLIPSE)
|
||||
|
||||
add_executable(ecl_sum_report_step_equal ecl/tests/ecl_sum_report_step_equal.c)
|
||||
add_executable(ecl_sum_report_step_equal ecl/tests/ecl_sum_report_step_equal.cpp)
|
||||
target_link_libraries(ecl_sum_report_step_equal ecl)
|
||||
add_test(NAME ecl_sum_report_step_equal1 COMMAND ecl_sum_report_step_equal ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/Snorre/SNORRE FALSE)
|
||||
add_test(NAME ecl_sum_report_step_equal2 COMMAND ecl_sum_report_step_equal ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/Gurbat/ECLIPSE TRUE)
|
||||
@ -590,7 +615,7 @@ add_test(NAME ecl_sum_report_step_equal4 COMMAND ecl_sum_report_step_equal ${_ec
|
||||
add_test(NAME ecl_sum_report_step_equal5 COMMAND ecl_sum_report_step_equal ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/modGurbat/enkf/ECLIPSE FALSE)
|
||||
add_test(NAME ecl_sum_report_step_equal6 COMMAND ecl_sum_report_step_equal ${_eclpath}/Snorre/SNORRE ${_eclpath}/Snorre2/SNORRE2 FALSE)
|
||||
|
||||
add_executable(ecl_sum_report_step_compatible ecl/tests/ecl_sum_report_step_compatible.c)
|
||||
add_executable(ecl_sum_report_step_compatible ecl/tests/ecl_sum_report_step_compatible.cpp)
|
||||
target_link_libraries(ecl_sum_report_step_compatible ecl)
|
||||
add_test(NAME ecl_sum_report_step_compatible1 COMMAND ecl_sum_report_step_compatible ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/Snorre/SNORRE FALSE)
|
||||
add_test(NAME ecl_sum_report_step_compatible2 COMMAND ecl_sum_report_step_compatible ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/Gurbat/ECLIPSE TRUE)
|
||||
@ -599,32 +624,32 @@ add_test(NAME ecl_sum_report_step_compatible4 COMMAND ecl_sum_report_step_compat
|
||||
add_test(NAME ecl_sum_report_step_compatible5 COMMAND ecl_sum_report_step_compatible ${_eclpath}/Gurbat/ECLIPSE ${_eclpath}/modGurbat/enkf/ECLIPSE TRUE)
|
||||
add_test(NAME ecl_sum_report_step_compatible6 COMMAND ecl_sum_report_step_equal ${_eclpath}/Snorre/SNORRE ${_eclpath}/Snorre2/SNORRE2 FALSE)
|
||||
|
||||
add_executable(ecl_file_statoil ecl/tests/ecl_file_statoil.c)
|
||||
add_executable(ecl_file_statoil ecl/tests/ecl_file_statoil.cpp)
|
||||
target_link_libraries(ecl_file_statoil ecl)
|
||||
add_test(NAME ecl_file_statoil
|
||||
COMMAND ecl_file_statoil ${_eclpath}/Gurbat/ECLIPSE.UNRST ECLIPSE.UNRST)
|
||||
|
||||
add_executable(ecl_fmt ecl/tests/ecl_fmt.c)
|
||||
add_executable(ecl_fmt ecl/tests/ecl_fmt.cpp)
|
||||
target_link_libraries(ecl_fmt ecl)
|
||||
add_test(NAME ecl_fmt COMMAND ecl_fmt
|
||||
${_eclpath}/Gurbat/ECLIPSE.UNRST
|
||||
${_eclpath}/Gurbat/ECLIPSE.DATA)
|
||||
|
||||
|
||||
add_executable(ecl_rsthead ecl/tests/ecl_rsthead.c)
|
||||
add_executable(ecl_rsthead ecl/tests/ecl_rsthead.cpp)
|
||||
target_link_libraries(ecl_rsthead ecl)
|
||||
add_test(NAME ecl_rsthead COMMAND ecl_rsthead
|
||||
${_eclpath}/Gurbat/ECLIPSE.UNRST
|
||||
${_eclpath}/DualPoro/DUALPORO.X0005)
|
||||
|
||||
add_executable(ecl_smspec ecl/tests/ecl_smspec.c)
|
||||
add_executable(ecl_smspec ecl/tests/ecl_smspec.cpp)
|
||||
target_link_libraries(ecl_smspec ecl)
|
||||
add_test(NAME ecl_smspec COMMAND ecl_smspec
|
||||
${_eclpath}/Gurbat/ECLIPSE.SMSPEC
|
||||
${_eclpath}/Heidrun/Summary/FF12_2013B3_CLEAN_RS.SMSPEC)
|
||||
|
||||
|
||||
add_executable(ecl_rft ecl/tests/ecl_rft.c)
|
||||
add_executable(ecl_rft ecl/tests/ecl_rft.cpp)
|
||||
target_link_libraries(ecl_rft ecl)
|
||||
add_test(NAME ecl_rft_rft COMMAND ecl_rft ${_eclpath}/Gurbat/ECLIPSE.RFT RFT)
|
||||
add_test(NAME ecl_rft_rft_rw COMMAND ecl_rft ${_eclpath}/Gurbat/ECLIPSE.RFT RFT_RW)
|
||||
@ -632,7 +657,7 @@ add_test(NAME ecl_rft_plt COMMAND ecl_rft ${_eclpath}/RFT/TEST1_1A.RFT PLT)
|
||||
add_test(NAME ecl_rft_mswplt COMMAND ecl_rft ${_eclpath}/RFT/RFT2.RFT MSW-PLT)
|
||||
add_test(NAME ecl_rft_alloc COMMAND ecl_rft ${_eclpath}/RFT/NORNE_ATW2013_RFTPLT_V2.RFT SIMPLE)
|
||||
|
||||
add_executable(ecl_grid_copy_statoil ecl/tests/ecl_grid_copy_statoil.c)
|
||||
add_executable(ecl_grid_copy_statoil ecl/tests/ecl_grid_copy_statoil.cpp)
|
||||
target_link_libraries(ecl_grid_copy_statoil ecl)
|
||||
|
||||
add_test(NAME ecl_grid_copy_statoil1 COMMAND ecl_grid_copy_statoil ${_eclpath}/Gurbat/ECLIPSE.EGRID)
|
||||
@ -640,22 +665,22 @@ add_test(NAME ecl_grid_copy_statoil2 COMMAND ecl_grid_copy_statoil ${_eclpath}/M
|
||||
add_test(NAME ecl_grid_copy_statoil3 COMMAND ecl_grid_copy_statoil ${_eclpath}/LGCcase/LGC_TESTCASE2.EGRID)
|
||||
add_test(NAME ecl_grid_copy_statoil4 COMMAND ecl_grid_copy_statoil ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.EGRID)
|
||||
|
||||
add_executable(ecl_fault_block_layer_statoil ecl/tests/ecl_fault_block_layer_statoil.c)
|
||||
add_executable(ecl_fault_block_layer_statoil ecl/tests/ecl_fault_block_layer_statoil.cpp)
|
||||
target_link_libraries(ecl_fault_block_layer_statoil ecl)
|
||||
add_test(NAME ecl_fault_block_layer_statoil COMMAND ecl_fault_block_layer_statoil
|
||||
${_eclpath}/Mariner/MARINER.EGRID
|
||||
${_eclpath}/Mariner/faultblock.grdecl)
|
||||
|
||||
if (HAVE_UTIL_ABORT_INTERCEPT)
|
||||
add_executable(ecl_fortio ecl/tests/ecl_fortio.c)
|
||||
add_executable(ecl_fortio ecl/tests/ecl_fortio.cpp)
|
||||
target_link_libraries( ecl_fortio ecl)
|
||||
add_test(NAME ecl_fortio COMMAND ecl_fortio ${_eclpath}/Gurbat/ECLIPSE.UNRST)
|
||||
endif()
|
||||
|
||||
add_executable(well_state_load ecl/tests/well_state_load.c)
|
||||
add_executable(well_state_load ecl/tests/well_state_load.cpp)
|
||||
target_link_libraries( well_state_load ecl)
|
||||
|
||||
add_executable(well_state_load_missing_RSEG ecl/tests/well_state_load_missing_RSEG.c)
|
||||
add_executable(well_state_load_missing_RSEG ecl/tests/well_state_load_missing_RSEG.cpp)
|
||||
target_link_libraries(well_state_load_missing_RSEG ecl)
|
||||
|
||||
add_test(NAME well_state_load1 COMMAND well_state_load ${_eclpath}/Gurbat/ECLIPSE.EGRID
|
||||
@ -675,25 +700,25 @@ add_test(NAME well_state_load_missing_RSEG2
|
||||
COMMAND well_state_load_missing_RSEG ${_eclpath}/Troll/MSW/MSW.EGRID
|
||||
${_eclpath}/Troll/MSW/MSW.X0123)
|
||||
|
||||
add_executable(well_segment_load ecl/tests/well_segment_load.c)
|
||||
add_executable(well_segment_load ecl/tests/well_segment_load.cpp)
|
||||
target_link_libraries(well_segment_load ecl)
|
||||
add_test(NAME well_segment_load
|
||||
COMMAND well_segment_load ${_eclpath}/MSWcase/MSW_CASE.X0021)
|
||||
|
||||
add_executable(well_segment_branch_conn_load ecl/tests/well_segment_branch_conn_load.c)
|
||||
|
||||
add_executable(well_segment_branch_conn_load ecl/tests/well_segment_branch_conn_load.cpp)
|
||||
target_link_libraries(well_segment_branch_conn_load ecl)
|
||||
add_test(NAME well_segment_branch_conn_load
|
||||
COMMAND well_segment_branch_conn_load ${_eclpath}/MSWcase/MSW_CASE.X0021)
|
||||
|
||||
add_executable(well_info ecl/tests/well_info.c)
|
||||
add_executable(well_info ecl/tests/well_info.cpp)
|
||||
target_link_libraries(well_info ecl)
|
||||
add_test(NAME well_info COMMAND well_info ${_eclpath}/Gurbat/ECLIPSE.EGRID)
|
||||
|
||||
add_executable(well_conn_CF ecl/tests/well_conn_CF.c)
|
||||
add_executable(well_conn_CF ecl/tests/well_conn_CF.cpp)
|
||||
target_link_libraries(well_conn_CF ecl)
|
||||
add_test(NAME well_conn_CF COMMAND well_conn_CF ${_eclpath}/Gurbat/ECLIPSE.X0060)
|
||||
|
||||
add_executable(well_conn_load ecl/tests/well_conn_load.c)
|
||||
add_executable(well_conn_load ecl/tests/well_conn_load.cpp)
|
||||
target_link_libraries(well_conn_load ecl)
|
||||
add_test(NAME well_conn_load1 COMMAND well_conn_load ${_eclpath}/Gurbat/ECLIPSE.X0030 F)
|
||||
add_test(NAME well_conn_load2 COMMAND well_conn_load ${_eclpath}/10kcase/TEST10K_FLT_LGR_NNC.X0021 F)
|
||||
@ -702,17 +727,17 @@ add_test(NAME well_conn_load4 COMMAND well_conn_load ${_eclpath}/AmalgLGRcase/TE
|
||||
add_test(NAME well_conn_load5 COMMAND well_conn_load ${_eclpath}/DualPoro/DUALPORO.X0009 F)
|
||||
add_test(NAME well_conn_load6 COMMAND well_conn_load ${_eclpath}/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.X0003 F)
|
||||
|
||||
add_executable(well_ts ecl/tests/well_ts.c)
|
||||
add_executable(well_ts ecl/tests/well_ts.cpp)
|
||||
target_link_libraries(well_ts ecl)
|
||||
add_test(NAME well_ts COMMAND well_ts ${_eclpath}/CO2case/BASE_CASE)
|
||||
|
||||
add_executable(well_dualp ecl/tests/well_dualp.c)
|
||||
add_executable(well_dualp ecl/tests/well_dualp.cpp)
|
||||
target_link_libraries(well_dualp ecl)
|
||||
add_test(NAME well_dualp COMMAND well_dualp
|
||||
${_eclpath}/Gurbat/ECLIPSE.UNRST
|
||||
${_eclpath}/DualPoro/DUALPORO.X0005)
|
||||
|
||||
add_executable(well_lgr_load ecl/tests/well_lgr_load.c)
|
||||
add_executable(well_lgr_load ecl/tests/well_lgr_load.cpp)
|
||||
target_link_libraries(well_lgr_load ecl)
|
||||
|
||||
add_test(NAME well_lgr_load1 COMMAND well_lgr_load ${_eclpath}/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.EGRID
|
||||
@ -723,7 +748,7 @@ add_test(NAME well_lgr_load2 COMMAND well_lgr_load ${_eclpath}/AmalgLGRcase/TEST
|
||||
#
|
||||
# geometry
|
||||
#
|
||||
add_executable(geo_surface geometry/tests/geo_surface.c)
|
||||
add_executable(geo_surface geometry/tests/geo_surface.cpp)
|
||||
target_link_libraries(geo_surface ecl)
|
||||
add_test(NAME geo_surface COMMAND geo_surface
|
||||
${_geopath}/Surface.irap
|
||||
|
6
ThirdParty/Ert/lib/build_config.h.in
vendored
6
ThirdParty/Ert/lib/build_config.h.in
vendored
@ -2,9 +2,6 @@
|
||||
#cmakedefine HAVE_TIMEGM
|
||||
#cmakedefine HAVE_LOCALTIME_R
|
||||
#cmakedefine HAVE_REALPATH
|
||||
#cmakedefine HAVE_TIMEDJOIN
|
||||
#cmakedefine HAVE_YIELD_NP
|
||||
#cmakedefine HAVE_YIELD
|
||||
#cmakedefine HAVE__USLEEP
|
||||
#cmakedefine HAVE_FNMATCH
|
||||
#cmakedefine HAVE_FTRUNCATE
|
||||
@ -29,9 +26,6 @@
|
||||
#cmakedefine HAVE_CXX_SHARED_PTR
|
||||
#cmakedefine HAVE_POSIX_UNLINK
|
||||
#cmakedefine HAVE_WINDOWS_UNLINK
|
||||
#cmakedefine HAVE_NETINET_IN_H
|
||||
#cmakedefine HAVE_ARPA_INET_H
|
||||
#cmakedefine HAVE_WINSOCK2_H
|
||||
|
||||
|
||||
#cmakedefine HAVE_POSIX_ACCESS
|
||||
|
183
ThirdParty/Ert/lib/e3/ecl/fortio.h
vendored
Normal file
183
ThirdParty/Ert/lib/e3/ecl/fortio.h
vendored
Normal file
@ -0,0 +1,183 @@
|
||||
#ifndef ECL_FORTIO_H
|
||||
#define ECL_FORTIO_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* As per the gnu fortran manual, int32 is sufficient for the record byte
|
||||
* marker. optionally we could support 8-byte markers with either compile-time
|
||||
* configuration or a run-time switch
|
||||
*
|
||||
* http://gcc.gnu.org/onlinedocs/gfortran/File-format-of-unformatted-sequential-files.html
|
||||
*
|
||||
* By default, all functions assume strict fortran compatibility (i.e. with
|
||||
* trailing record size) and network (big-endian) byte order.
|
||||
*
|
||||
*
|
||||
* A Fortran program writes unformatted data to file in a statemente like:
|
||||
*
|
||||
* integer array(100)
|
||||
* write(unit) array
|
||||
*
|
||||
* it actually writes a head and tail in addition to the actual
|
||||
* data. The header and tail is a 4 byte integer, which value is the
|
||||
* number of bytes in the immediately following record. I.e. what is
|
||||
* actually found on disk after the Fortran code above is:
|
||||
*
|
||||
* | 400 | array ...... | 400 |
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* The ecl_fio functions are exception safe, that is, if a function fails, the
|
||||
* file pointer is rewinded to before the function was called, and output
|
||||
* parameters are not modified, as if the function was never called.
|
||||
*
|
||||
* This comes with a few exceptions:
|
||||
* 1. if ECL_ERR_SEEK is returned, the roll-back of the file pointer itself
|
||||
* failed and NOTHING IS GUARANTEED. The file stream is left in an unspecified
|
||||
* state, and must be recovered accordingly.
|
||||
* 2. in eclfio_get, the output record buffer must always be considered dirty
|
||||
* and incomplete unless the function suceeds, or ECL_EINVAL is returned.
|
||||
*
|
||||
*
|
||||
* ECL_ERR_SEEK should be rather rare, but to provide strong guarantees, this
|
||||
* error must be handled carefully.
|
||||
*/
|
||||
|
||||
/*
|
||||
* every function takes a const char* opts parameter. This is a tiny
|
||||
* configuration language inspired by printf and fopen. every character not in
|
||||
* the set of keys is ignored. the opts parameter must be null terminated.
|
||||
*
|
||||
* if two options setting the same parameter (e.g. i and f, or e and E), the
|
||||
* last one in the option string takes effect.
|
||||
*
|
||||
* options
|
||||
* -------
|
||||
* record data types:
|
||||
* c - characters, sizeof(char)
|
||||
* i - (signed)integers, sizeof(int32_t), default
|
||||
* f - single-precision float, sizeof(float)
|
||||
* d - double-precision float, sizeof(double)
|
||||
*
|
||||
* behaviour:
|
||||
* E - assume big-endian record data (default)
|
||||
* e - assume little-endian record data
|
||||
* t - transform/byteswap data according to data type (default)
|
||||
* T - don't transform/byteswap data (does not affect heads/tails)
|
||||
*
|
||||
* endianness parameter applies to both head, tail, and data, but head/tail can
|
||||
* be interepreted with endianness byteswapping data by disabling transform
|
||||
*
|
||||
* fault tolerance:
|
||||
* # - ignore size hint
|
||||
* ~ - force no-tail (assume only head)
|
||||
* $ - allow no-tail (don't fail on missing tail)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Get the size (number of elements) of the current record. The file position
|
||||
* is approperiately rewinded afterwards, as if the function was never called.
|
||||
*
|
||||
* If this function fails, out is not modified.
|
||||
*
|
||||
* If the read fails, ECL_ERR_READ is returned.
|
||||
*
|
||||
* This function is largely intended for peeking the size of the next record,
|
||||
* to approperiately allocate a large enough buffer, which is useful when
|
||||
* dealing with unknown files. If it is know in advance how large the records
|
||||
* are, it is not necessary to call this function before reading a record.
|
||||
*/
|
||||
int eclfio_sizeof( FILE*, const char* opts, int32_t* out );
|
||||
|
||||
/*
|
||||
* Advance the file position n records. The file position is reset if the
|
||||
* function fails, as if the function was never called.
|
||||
*
|
||||
* Returns ECL_OK if all records were skipped. If it fails, either
|
||||
* ECL_INVALID_RECORD or ECL_ERR_READ is returned, depending on the source of
|
||||
* the error, same rules as that of eclfio_get.
|
||||
*
|
||||
* This function does not distinguish seek errors for any n not +-1, so to
|
||||
* figure out which record fails, one record at a time must be skipped.
|
||||
*/
|
||||
int eclfio_skip( FILE*, const char* opts, int n );
|
||||
|
||||
/*
|
||||
* Get the next record, and its number of elements.
|
||||
*
|
||||
* The record buffer is generally assumed to be of approperiate size, which can
|
||||
* be queried with eclfio_sizeof.
|
||||
*
|
||||
* On success, the value of recordsize denotes the number of elements read,
|
||||
* whose size is determined by the "cifd" options. It is generally assumed that
|
||||
* recordsize upon calling this function contains the size of the record
|
||||
* buffer, as a failsafe mechanism - if a record is larger than this value, the
|
||||
* read will be aborted and the file position rolled back. To opt out of this
|
||||
* check, add # to opts.
|
||||
*
|
||||
* Both recordsize and record can be NULL, in which case the number of elements
|
||||
* read is not returned, and no data is returned respectively. This allows
|
||||
* precise reporting on how many elements each skipped records contains.
|
||||
*
|
||||
* If the elementsize is larger than 1, and transformation has not been
|
||||
* explicitly disabled, endianness will be converted appropriately.
|
||||
*
|
||||
* It is assumed that all record has an appropriate head and tail. If it is
|
||||
* know that no record has a tail, force this by passing ~ in opts. However, if
|
||||
* it is uncertain if all records has tails, or it's alternating between tail
|
||||
* and no-tail, the $ option tries to recover from missing tails by assuming
|
||||
* the current position is the start of the next record.
|
||||
*
|
||||
* The contents of record* is unspecified in case of read failures, and may not
|
||||
* be relied upon. If the function returns ECL_EINVAL, the output record is
|
||||
* untouched.
|
||||
*
|
||||
* This function returns ECL_OK upon success, ECL_ERR_READ in case of read- or
|
||||
* seek errors, ECL_INVALID_RECORD if either the record tail is broken and
|
||||
* options is set accordingly. The list of error codes is not exhaustive, and
|
||||
* robust code should have fallthrough error handling cases.
|
||||
*/
|
||||
int eclfio_get( FILE*, const char* opts, int32_t* recordsize, void* record );
|
||||
|
||||
/*
|
||||
* Put a record of nmemb elements
|
||||
*
|
||||
* This function will write both head and tail, unless tail writing is
|
||||
* explicitly disabled with ~. If (nmemb * elemsize) overflows int32, the write
|
||||
* is aborted and ECL_EINVAL is returned.
|
||||
*
|
||||
* put largely follows the same rules as get, including those of endianness.
|
||||
* The file pointer is rolled back if any part of the function should fail, as
|
||||
* if the function was never called.
|
||||
*
|
||||
* If a write fails after partial writes, no attempts are made to roll back
|
||||
* written changes.
|
||||
*
|
||||
* Returns ECL_OK on success, or ECL_ERR_WRITE on failure. If ECL_ERR_SEEK is
|
||||
* returned, the integrity of the file stream can not be guaranteed, and its
|
||||
* state is considered unspecified.
|
||||
*/
|
||||
int eclfio_put( FILE*, const char* opts, int nmemb, const void* );
|
||||
|
||||
enum ecl_errno {
|
||||
ECL_OK = 0,
|
||||
ECL_ERR_UNKNOWN,
|
||||
ECL_ERR_SEEK,
|
||||
ECL_ERR_READ,
|
||||
ECL_ERR_WRITE,
|
||||
ECL_INVALID_RECORD,
|
||||
ECL_EINVAL,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //ECL_FORTIO_H
|
2
ThirdParty/Ert/lib/ecl/FortIO.cpp
vendored
2
ThirdParty/Ert/lib/ecl/FortIO.cpp
vendored
@ -19,7 +19,7 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/FortIO.hpp>
|
||||
|
||||
|
70
ThirdParty/Ert/lib/ecl/ecl_box.cpp
vendored
70
ThirdParty/Ert/lib/ecl/ecl_box.cpp
vendored
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_box.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_box.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.
|
||||
*/
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_box.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
@ -33,10 +33,10 @@ struct ecl_box_struct {
|
||||
UTIL_TYPE_ID_DECLARATION;
|
||||
int grid_nx , grid_ny , grid_nz;
|
||||
int grid_sx , grid_sy , grid_sz; /* xxx_sx : x stride */
|
||||
|
||||
|
||||
int i1,i2,j1,j2,k1,k2;
|
||||
int box_nx , box_ny , box_nz;
|
||||
int box_sx , box_sy , box_sz;
|
||||
int box_sx , box_sy , box_sz;
|
||||
int box_offset;
|
||||
int active_size;
|
||||
int *active_list; /* This is a list with active_size elements containing the index active index of the elemtents in the box. Will be NULL if there are no active elements. */
|
||||
@ -85,12 +85,12 @@ ecl_box_type * ecl_box_alloc(const ecl_grid_type * ecl_grid , int __i1,int __i2
|
||||
ecl_box->j2 = j2;
|
||||
ecl_box->k1 = k1;
|
||||
ecl_box->k2 = k2;
|
||||
|
||||
|
||||
/*Properties of the box: */
|
||||
ecl_box->box_nx = i2 - i1 + 1;
|
||||
ecl_box->box_ny = j2 - j1 + 1;
|
||||
ecl_box->box_nz = k2 - k1 + 1;
|
||||
|
||||
|
||||
ecl_box->box_sx = 1;
|
||||
ecl_box->box_sy = ecl_box->box_nx;
|
||||
ecl_box->box_sz = ecl_box->box_nx * ecl_box->box_ny;
|
||||
@ -104,7 +104,7 @@ ecl_box_type * ecl_box_alloc(const ecl_grid_type * ecl_grid , int __i1,int __i2
|
||||
ecl_box->active_size = 0;
|
||||
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 (k=k1; k <= k2; k++)
|
||||
for (j=j1; j <= j2; j++)
|
||||
for (i=i1; i <= i2; i++) {
|
||||
{
|
||||
@ -120,7 +120,7 @@ ecl_box_type * ecl_box_alloc(const ecl_grid_type * ecl_grid , int __i1,int __i2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ecl_box->active_list = (int*)util_realloc( ecl_box->active_list , ecl_box->active_size * sizeof * ecl_box->active_list );
|
||||
}
|
||||
}
|
||||
@ -134,38 +134,38 @@ ecl_box_type * ecl_box_alloc(const ecl_grid_type * ecl_grid , int __i1,int __i2
|
||||
|
||||
ijk: These are zero offset.
|
||||
ijk: Which are ON one of the box surfaces will return true.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
bool ecl_box_contains(const ecl_box_type * box , int i , int j , int k) {
|
||||
|
||||
|
||||
return (( box->i1 >= i ) && (i <= box->i2) &&
|
||||
( box->j1 >= j ) && (j <= box->j2) &&
|
||||
( box->k1 >= k ) && (k <= box->k2));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ecl_box_free(ecl_box_type * ecl_box) {
|
||||
util_safe_free(ecl_box->active_list );
|
||||
util_safe_free(ecl_box->global_list );
|
||||
free(ecl_box);
|
||||
void ecl_box_free(ecl_box_type * ecl_box) {
|
||||
free(ecl_box->active_list );
|
||||
free(ecl_box->global_list );
|
||||
free(ecl_box);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void ecl_kw_merge(ecl_kw_type * main_kw , const ecl_kw_type * sub_kw , const ecl_box_type * ecl_box) {
|
||||
if (main_kw->sizeof_ctype != sub_kw->sizeof_ctype)
|
||||
if (main_kw->sizeof_ctype != sub_kw->sizeof_ctype)
|
||||
util_abort("%s: trying to combine two different underlying datatypes - aborting \n",__func__);
|
||||
|
||||
if (ecl_kw_get_size(main_kw) != ecl_box_get_total_size(ecl_box))
|
||||
if (ecl_kw_get_size(main_kw) != ecl_box_get_total_size(ecl_box))
|
||||
util_abort("%s box size and total_kw mismatch - aborting \n",__func__);
|
||||
|
||||
if (ecl_kw_get_size(sub_kw) != ecl_box_get_box_size(ecl_box))
|
||||
if (ecl_kw_get_size(sub_kw) != ecl_box_get_box_size(ecl_box))
|
||||
util_abort("%s box size and total_kw mismatch - aborting \n",__func__);
|
||||
|
||||
ecl_box_set_values(ecl_box , ecl_kw_get_data_ref(main_kw) , ecl_kw_get_data_ref(sub_kw) , main_kw->sizeof_ctype);
|
||||
@ -175,7 +175,7 @@ void ecl_kw_merge(ecl_kw_type * main_kw , const ecl_kw_type * sub_kw , const ecl
|
||||
void ecl_box_set_values(const ecl_box_type * ecl_box , char * main_field , const char * sub_field , int element_size) {
|
||||
int i,j,k;
|
||||
|
||||
for (k=0; k < ecl_box->box_nz; k++)
|
||||
for (k=0; k < ecl_box->box_nz; k++)
|
||||
for(j=0; j < ecl_box->box_ny; j++)
|
||||
for (i=0; i < ecl_box->box_nx; i++) {
|
||||
int grid_index = k*ecl_box->grid_sz + j*ecl_box->grid_sy + i*ecl_box->grid_sx + ecl_box->box_offset;
|
||||
@ -186,7 +186,7 @@ void ecl_box_set_values(const ecl_box_type * ecl_box , char * main_field , const
|
||||
|
||||
|
||||
/*
|
||||
Return the number of active element in the box.
|
||||
Return the number of active element in the box.
|
||||
*/
|
||||
int ecl_box_get_active_size( const ecl_box_type * ecl_box ) {
|
||||
return ecl_box->active_size;
|
||||
@ -199,7 +199,7 @@ const int * ecl_box_get_active_list( const ecl_box_type * ecl_box ) {
|
||||
|
||||
|
||||
/*
|
||||
Return the number of global element in the box.
|
||||
Return the number of global element in the box.
|
||||
*/
|
||||
int ecl_box_get_global_size( const ecl_box_type * ecl_box ) {
|
||||
return ecl_box->box_nx * ecl_box->box_ny * ecl_box->box_nz;
|
||||
|
28
ThirdParty/Ert/lib/ecl/ecl_coarse_cell.cpp
vendored
28
ThirdParty/Ert/lib/ecl/ecl_coarse_cell.cpp
vendored
@ -20,7 +20,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
the cells represents the cells global index.
|
||||
|
||||
- The grid contains a coarse cell of dimensions 4 x 3, the coarse
|
||||
cell is in the global region: i \in [1,4] and j \in [1,3].
|
||||
cell is in the global region: i \in [1,4] and j \in [1,3].
|
||||
|
||||
- When solving the dynamical equations the properties of the coarse
|
||||
cell will enter as one entity, but when defining the grid initially
|
||||
@ -68,7 +68,7 @@
|
||||
- In the global grid the cells marked with [X] are active, i.e. when
|
||||
counting from zero the coarse cell will be the fourth active
|
||||
cell. This particular grid has a total of ten normal active cells
|
||||
(i.e. 10 x [X]) and one coarse cell which is active.
|
||||
(i.e. 10 x [X]) and one coarse cell which is active.
|
||||
|
||||
|
||||
- The dynamic variables like PRESSURE and SWAT are only represented
|
||||
@ -100,7 +100,7 @@ following content:
|
||||
cell_list = {7,8,9,10,13,14,15,16,19,20,21,22}
|
||||
active_cells = {13,15,21}
|
||||
active_values = {1,1,1} <= This can 2/3 for dual porosity.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ struct ecl_coarse_cell_struct {
|
||||
int active_index;
|
||||
int active_fracture_index;
|
||||
|
||||
bool __cell_list_sorted;
|
||||
bool __cell_list_sorted;
|
||||
int_vector_type * cell_list;
|
||||
int_vector_type * active_cells;
|
||||
int_vector_type * active_values;
|
||||
@ -168,16 +168,16 @@ bool ecl_coarse_cell_equal( const ecl_coarse_cell_type * coarse_cell1 , const ec
|
||||
|
||||
if (coarse_cell1->active_fracture_index != coarse_cell2->active_fracture_index)
|
||||
equal = false;
|
||||
|
||||
|
||||
if (equal) {
|
||||
if (memcmp( coarse_cell1->ijk , coarse_cell2->ijk , 6 * sizeof * coarse_cell1->ijk) != 0)
|
||||
equal = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (equal)
|
||||
equal = int_vector_equal(coarse_cell1->active_cells , coarse_cell2->active_cells);
|
||||
|
||||
|
||||
if (equal)
|
||||
equal = int_vector_equal(coarse_cell1->active_values , coarse_cell2->active_values);
|
||||
|
||||
@ -188,7 +188,7 @@ bool ecl_coarse_cell_equal( const ecl_coarse_cell_type * coarse_cell1 , const ec
|
||||
ecl_coarse_cell_fprintf( coarse_cell1 , stdout );
|
||||
ecl_coarse_cell_fprintf( coarse_cell2 , stdout );
|
||||
}
|
||||
|
||||
|
||||
return equal;
|
||||
}
|
||||
|
||||
@ -295,17 +295,17 @@ void ecl_coarse_cell_update_index( ecl_coarse_cell_type * coarse_cell , int glob
|
||||
(*active_index) += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (active_value & CELL_ACTIVE_FRACTURE) {
|
||||
if (coarse_cell->active_fracture_index == -1) {
|
||||
coarse_cell->active_fracture_index = *active_fracture_index;
|
||||
(*active_fracture_index) += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int_vector_append( coarse_cell->active_cells , global_index );
|
||||
int_vector_append( coarse_cell->active_values , active_value );
|
||||
|
||||
|
||||
if (int_vector_size( coarse_cell->active_values ) > 1) {
|
||||
if (int_vector_reverse_iget( coarse_cell->active_values , -2 ) != active_value)
|
||||
util_abort("%s: Sorry - current coarse cell implementation requires that all active cells have the same active value\n",__func__);
|
||||
@ -346,7 +346,7 @@ void ecl_coarse_cell_fprintf( const ecl_coarse_cell_type * coarse_cell , FILE *
|
||||
fprintf(stream," i : %3d - %3d\n",coarse_cell->ijk[0] , coarse_cell->ijk[1]);
|
||||
fprintf(stream," j : %3d - %3d\n",coarse_cell->ijk[2] , coarse_cell->ijk[3]);
|
||||
fprintf(stream," k : %3d - %3d\n",coarse_cell->ijk[4] , coarse_cell->ijk[5]);
|
||||
fprintf(stream," active_cells : " ); int_vector_fprintf( coarse_cell->active_cells , stream , "" , "%5d ");
|
||||
fprintf(stream," active_values : " ); int_vector_fprintf( coarse_cell->active_values , stream , "" , "%5d ");
|
||||
fprintf(stream," active_cells : " ); int_vector_fprintf( coarse_cell->active_cells , stream , "" , "%5d ");
|
||||
fprintf(stream," active_values : " ); int_vector_fprintf( coarse_cell->active_values , stream , "" , "%5d ");
|
||||
//fprintf(stream," Cells : " ); int_vector_fprintf( coarse_cell->cell_list , stream , "" , "%5d ");
|
||||
}
|
||||
|
3
ThirdParty/Ert/lib/ecl/ecl_file.cpp
vendored
3
ThirdParty/Ert/lib/ecl/ecl_file.cpp
vendored
@ -23,7 +23,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
@ -800,6 +800,7 @@ 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 (ecl_version_enum)0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
2
ThirdParty/Ert/lib/ecl/ecl_file_kw.cpp
vendored
2
ThirdParty/Ert/lib/ecl/ecl_file_kw.cpp
vendored
@ -22,7 +22,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/size_t_vector.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
|
6
ThirdParty/Ert/lib/ecl/ecl_file_view.cpp
vendored
6
ThirdParty/Ert/lib/ecl/ecl_file_view.cpp
vendored
@ -558,7 +558,7 @@ bool ecl_file_view_has_report_step( const ecl_file_view_type * ecl_file_view , i
|
||||
|
||||
time_t ecl_file_view_iget_restart_sim_date(const ecl_file_view_type * ecl_file_view , int seqnum_index) {
|
||||
time_t sim_time = -1;
|
||||
ecl_file_view_type * seqnum_map = seqnum_map = ecl_file_view_alloc_blockview( ecl_file_view , SEQNUM_KW , seqnum_index);
|
||||
ecl_file_view_type * seqnum_map = ecl_file_view_alloc_blockview( ecl_file_view , SEQNUM_KW , seqnum_index);
|
||||
|
||||
if (seqnum_map != NULL) {
|
||||
ecl_kw_type * intehead_kw = ecl_file_view_iget_named_kw( seqnum_map , INTEHEAD_KW , 0);
|
||||
@ -778,7 +778,7 @@ void ecl_file_view_fclose_stream( ecl_file_view_type * file_view ) {
|
||||
void ecl_file_view_write_index(const ecl_file_view_type * file_view, FILE * ostream) {
|
||||
int size = ecl_file_view_get_size(file_view);
|
||||
util_fwrite_int( size , ostream);
|
||||
|
||||
|
||||
ecl_file_kw_type * file_kw;
|
||||
for (int i = 0; i < size; i++) {
|
||||
file_kw = ecl_file_view_iget_file_kw( file_view, i );
|
||||
@ -791,7 +791,7 @@ ecl_file_view_type * ecl_file_view_fread_alloc( fortio_type * fortio , int * fla
|
||||
int index_size = util_fread_int(istream);
|
||||
ecl_file_kw_type ** file_kw_list = ecl_file_kw_fread_alloc_multiple( istream, index_size);
|
||||
if (file_kw_list) {
|
||||
ecl_file_view_type * file_view = ecl_file_view_alloc( fortio , flags , inv_map , true );
|
||||
ecl_file_view_type * file_view = ecl_file_view_alloc( fortio , flags , inv_map , true );
|
||||
for (int i=0; i < index_size; i++)
|
||||
ecl_file_view_add_kw(file_view , file_kw_list[i]);
|
||||
|
||||
|
6
ThirdParty/Ert/lib/ecl/ecl_grav.cpp
vendored
6
ThirdParty/Ert/lib/ecl/ecl_grav.cpp
vendored
@ -20,7 +20,7 @@
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
|
||||
@ -305,7 +305,7 @@ static ecl_grav_phase_type * ecl_grav_phase_alloc( ecl_grav_type * ecl_grav ,
|
||||
|
||||
|
||||
static void ecl_grav_phase_free( ecl_grav_phase_type * grav_phase ) {
|
||||
util_safe_free( grav_phase->work );
|
||||
free( grav_phase->work );
|
||||
free( grav_phase->fluid_mass );
|
||||
free( grav_phase );
|
||||
}
|
||||
@ -529,7 +529,7 @@ static ecl_grav_survey_type * ecl_grav_survey_alloc_RFIP(ecl_grav_type * ecl_gra
|
||||
|
||||
static void ecl_grav_survey_free( ecl_grav_survey_type * grav_survey ) {
|
||||
free( grav_survey->name );
|
||||
util_safe_free( grav_survey->porv );
|
||||
free( grav_survey->porv );
|
||||
vector_free( grav_survey->phase_list );
|
||||
hash_free( grav_survey->phase_map );
|
||||
free( grav_survey );
|
||||
|
2
ThirdParty/Ert/lib/ecl/ecl_grav_calc.cpp
vendored
2
ThirdParty/Ert/lib/ecl/ecl_grav_calc.cpp
vendored
@ -20,7 +20,7 @@
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
|
2
ThirdParty/Ert/lib/ecl/ecl_grav_common.cpp
vendored
2
ThirdParty/Ert/lib/ecl/ecl_grav_common.cpp
vendored
@ -21,7 +21,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
|
262
ThirdParty/Ert/lib/ecl/ecl_grid.cpp
vendored
262
ThirdParty/Ert/lib/ecl/ecl_grid.cpp
vendored
@ -22,15 +22,15 @@
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#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/geometry/geo_util.hpp>
|
||||
#include <ert/geometry/geo_polygon.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
@ -763,6 +763,10 @@ struct ecl_grid_struct {
|
||||
int eclipse_version;
|
||||
};
|
||||
|
||||
ert_ecl_unit_enum ecl_grid_get_unit_system(const ecl_grid_type * grid) {
|
||||
return grid->unit_system;
|
||||
}
|
||||
|
||||
static void ecl_cell_compare(const ecl_cell_type * c1 , const ecl_cell_type * c2, bool include_nnc , bool * equal) {
|
||||
int i;
|
||||
|
||||
@ -1167,7 +1171,7 @@ static double C(double *r,int f1,int f2,int f3){
|
||||
}
|
||||
|
||||
|
||||
static double ecl_cell_get_volume_tskille( ecl_cell_type * cell ) {
|
||||
static double ecl_cell_get_volume( ecl_cell_type * cell ) {
|
||||
double volume = 0;
|
||||
int pb,pg,qa,qg,ra,rb;
|
||||
double X[8];
|
||||
@ -1269,79 +1273,6 @@ static bool tetrahedron_contains(tetrahedron_type tet, const point_type p) {
|
||||
return (fabs(tetra_volume - decomposition_volume) < epsilon);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function used to account for a significant amount of execution time
|
||||
* when used in opm-parser and has been optimised significantly. This means
|
||||
* inlining several operations, e.g. vector operations, and other tricks.
|
||||
*/
|
||||
static double ecl_cell_get_signed_volume( ecl_cell_type * cell) {
|
||||
if (GET_CELL_FLAG(cell , CELL_FLAG_VOLUME))
|
||||
return cell->volume;
|
||||
|
||||
ecl_cell_assert_center( cell );
|
||||
{
|
||||
/*
|
||||
* We make an activation record local copy of the cell's corners for less
|
||||
* jumping in memory and better cache performance.
|
||||
*/
|
||||
point_type center = cell->center;
|
||||
point_type corners[ 8 ];
|
||||
memcpy( corners, cell->corner_list, sizeof( point_type ) * 8 );
|
||||
|
||||
tetrahedron_type tet;
|
||||
tet.p0 = center;
|
||||
double volume = 0;
|
||||
/*
|
||||
using both tetrahedron decompositions - gives good agreement
|
||||
with porv from eclipse init files.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The order of these loops is intentional and guided by profiling. It's much
|
||||
* faster to access method, then the number, rather than the other way
|
||||
* around. If you are to change this, please measure performance impact.
|
||||
*/
|
||||
for( int method = 0; method < 2; ++method ) {
|
||||
for( int itet = 0; itet < 12; ++itet ) {
|
||||
const int point0 = tetrahedron_permutations[ method ][ itet ][ 0 ];
|
||||
const int point1 = tetrahedron_permutations[ method ][ itet ][ 1 ];
|
||||
const int point2 = tetrahedron_permutations[ method ][ itet ][ 2 ];
|
||||
|
||||
tet.p1 = corners[ point0 ];
|
||||
tet.p2 = corners[ point1 ];
|
||||
tet.p3 = corners[ point2 ];
|
||||
volume += tetrahedron_volume6( tet ) / 6;
|
||||
}
|
||||
}
|
||||
|
||||
/* The volume of a tetrahedron is
|
||||
* |a·(b x c)|
|
||||
* V = -----------
|
||||
* 6
|
||||
* Since sum( |a·(b x c)| ) / 6 is equal to
|
||||
* sum( |a·(b x c)| / 6 ) we can do the (rather expensive) division only once
|
||||
* and still get the correct result. We multiply by 0.5 because we've now
|
||||
* considered two decompositions of the tetrahedron, and want their average.
|
||||
*
|
||||
*
|
||||
* Note added: these volume calculations are used to calculate pore
|
||||
* volumes in OPM, it turns out that opm is very sensitive to these
|
||||
* volumes. Extracting the divison by 6.0 was actually enough to
|
||||
* induce a regression test failure in flow, this has therefore been
|
||||
* reverted.
|
||||
*/
|
||||
|
||||
cell->volume = volume * 0.5;
|
||||
SET_CELL_FLAG( cell , CELL_FLAG_VOLUME );
|
||||
}
|
||||
return cell->volume;
|
||||
}
|
||||
|
||||
|
||||
static double ecl_cell_get_volume( ecl_cell_type * cell ) {
|
||||
return fabs( ecl_cell_get_signed_volume(cell));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2299,6 +2230,80 @@ int ecl_grid_zcorn_index__(int nx, int ny , int i, int j , int k , int c) {
|
||||
int ecl_grid_zcorn_index(const ecl_grid_type * grid , int i, int j , int k , int c) {
|
||||
return ecl_grid_zcorn_index__( grid->nx, grid->ny , i , j , k , c );
|
||||
}
|
||||
static void ecl_grid_init_GRDECL_data_jslice(ecl_grid_type * ecl_grid,
|
||||
const double * zcorn,
|
||||
const double * coord,
|
||||
const int * actnum,
|
||||
const int * corsnum,
|
||||
int j) {
|
||||
const int nx = ecl_grid->nx;
|
||||
const int ny = ecl_grid->ny;
|
||||
const int nz = ecl_grid->nz;
|
||||
int i;
|
||||
|
||||
|
||||
for (i=0; i < nx; i++) {
|
||||
point_type pillars[4][2];
|
||||
int pillar_index[4];
|
||||
pillar_index[0] = 6 * ( j * (nx + 1) + i );
|
||||
pillar_index[1] = 6 * ( j * (nx + 1) + i + 1);
|
||||
pillar_index[2] = 6 * ((j + 1) * (nx + 1) + i );
|
||||
pillar_index[3] = 6 * ((j + 1) * (nx + 1) + i + 1);
|
||||
|
||||
{
|
||||
int ip;
|
||||
for (ip = 0; ip < 4; ip++) {
|
||||
int index = pillar_index[ip];
|
||||
point_set(&pillars[ip][0] , coord[index] , coord[index + 1] , coord[index + 2]);
|
||||
|
||||
index += 3;
|
||||
point_set(&pillars[ip][1] , coord[index] , coord[index + 1] , coord[index + 2]);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
double ex[4];
|
||||
double ey[4];
|
||||
double ez[4];
|
||||
int k;
|
||||
|
||||
{
|
||||
int ip;
|
||||
for (ip = 0; ip < 4; ip++) {
|
||||
ex[ip] = pillars[ip][1].x - pillars[ip][0].x;
|
||||
ey[ip] = pillars[ip][1].y - pillars[ip][0].y;
|
||||
ez[ip] = pillars[ip][1].z - pillars[ip][0].z;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (k=0; k < nz; k++) {
|
||||
double x[4][2];
|
||||
double y[4][2];
|
||||
double z[4][2];
|
||||
|
||||
{
|
||||
int c;
|
||||
for (c = 0; c < 2; c++) {
|
||||
z[0][c] = zcorn[k*8*nx*ny + j*4*nx + 2*i + c*4*nx*ny];
|
||||
z[1][c] = zcorn[k*8*nx*ny + j*4*nx + 2*i + 1 + c*4*nx*ny];
|
||||
z[2][c] = zcorn[k*8*nx*ny + j*4*nx + 2*nx + 2*i + c*4*nx*ny];
|
||||
z[3][c] = zcorn[k*8*nx*ny + j*4*nx + 2*nx + 2*i + 1 + c*4*nx*ny];
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int ip;
|
||||
for (ip = 0; ip < 4; ip++)
|
||||
ecl_grid_pillar_cross_planes(&pillars[ip][0] , ex[ip], ey[ip] , ez[ip] , z[ip] , x[ip] , y[ip]);
|
||||
}
|
||||
|
||||
ecl_grid_set_cell_EGRID(ecl_grid , i , j , k , x , y , z , actnum , corsnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void ecl_grid_init_GRDECL_data_jslice(ecl_grid_type * ecl_grid,
|
||||
@ -2375,6 +2380,19 @@ static void ecl_grid_init_GRDECL_data_jslice(ecl_grid_type * ecl_grid,
|
||||
}
|
||||
}
|
||||
|
||||
void ecl_grid_init_GRDECL_data(ecl_grid_type * ecl_grid,
|
||||
const double * zcorn,
|
||||
const double * coord,
|
||||
const int * actnum,
|
||||
const int * corsnum) {
|
||||
const int ny = ecl_grid->ny;
|
||||
int j;
|
||||
#pragma omp parallel for
|
||||
for ( j=0; j < ny; j++)
|
||||
ecl_grid_init_GRDECL_data_jslice( ecl_grid , zcorn, coord , actnum , corsnum , j );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ecl_grid_init_GRDECL_data(ecl_grid_type * ecl_grid,
|
||||
const float * zcorn,
|
||||
@ -2396,6 +2414,42 @@ void ecl_grid_init_GRDECL_data(ecl_grid_type * ecl_grid,
|
||||
0---1
|
||||
*/
|
||||
|
||||
static ecl_grid_type * ecl_grid_alloc_GRDECL_data__(ecl_grid_type * global_grid,
|
||||
int dualp_flag,
|
||||
bool apply_mapaxes,
|
||||
int nx,
|
||||
int ny,
|
||||
int nz,
|
||||
const double * zcorn,
|
||||
const double * coord,
|
||||
const int * actnum,
|
||||
const float * mapaxes,
|
||||
const int * corsnum,
|
||||
int lgr_nr) {
|
||||
|
||||
ecl_grid_type * ecl_grid = ecl_grid_alloc_empty(global_grid , dualp_flag , nx,ny,nz,lgr_nr,true);
|
||||
if (ecl_grid) {
|
||||
if (mapaxes != NULL)
|
||||
ecl_grid_init_mapaxes( ecl_grid , apply_mapaxes, mapaxes );
|
||||
|
||||
if (corsnum != NULL)
|
||||
ecl_grid->coarsening_active = true;
|
||||
|
||||
ecl_grid->coord_kw = ecl_kw_alloc("COORD" , 6*(nx + 1) * (ny + 1) , ECL_FLOAT);
|
||||
{
|
||||
float * coord_float = (float *)ecl_kw_get_ptr(ecl_grid->coord_kw);
|
||||
for (int i=0; i < ecl_kw_get_size(ecl_grid->coord_kw); i++)
|
||||
coord_float[i] = coord[i];
|
||||
}
|
||||
ecl_grid_init_GRDECL_data( ecl_grid , zcorn , coord , actnum , corsnum);
|
||||
|
||||
ecl_grid_init_coarse_cells( ecl_grid );
|
||||
ecl_grid_update_index( ecl_grid );
|
||||
ecl_grid_taint_cells( ecl_grid );
|
||||
}
|
||||
return ecl_grid;
|
||||
}
|
||||
|
||||
static ecl_grid_type * ecl_grid_alloc_GRDECL_data__(ecl_grid_type * global_grid,
|
||||
int dualp_flag,
|
||||
bool apply_mapaxes,
|
||||
@ -2428,6 +2482,8 @@ 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)
|
||||
@ -2582,6 +2638,33 @@ ecl_grid_type * ecl_grid_alloc_GRDECL_data(int nx,
|
||||
0);
|
||||
}
|
||||
|
||||
namespace ecl {
|
||||
|
||||
ecl_grid_type * ecl_grid_alloc_GRDECL_data(int nx,
|
||||
int ny,
|
||||
int nz,
|
||||
const double * zcorn,
|
||||
const double * coord,
|
||||
const int * actnum,
|
||||
bool apply_mapaxes,
|
||||
const float * mapaxes) {
|
||||
|
||||
return ecl_grid_alloc_GRDECL_data__(NULL,
|
||||
FILEHEAD_SINGLE_POROSITY,
|
||||
apply_mapaxes,
|
||||
nx,
|
||||
ny,
|
||||
nz,
|
||||
zcorn,
|
||||
coord,
|
||||
actnum,
|
||||
mapaxes,
|
||||
NULL,
|
||||
0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
const float * ecl_grid_get_mapaxes_from_kw__(const ecl_kw_type * mapaxes_kw) {
|
||||
const float * mapaxes_data = ecl_kw_get_float_ptr(mapaxes_kw);
|
||||
@ -4458,12 +4541,12 @@ int ecl_grid_get_block_count3d(const ecl_grid_type * grid , int i , int j, int k
|
||||
|
||||
void ecl_grid_free(ecl_grid_type * grid) {
|
||||
ecl_grid_free_cells( grid );
|
||||
util_safe_free(grid->index_map);
|
||||
util_safe_free(grid->inv_index_map);
|
||||
free(grid->index_map);
|
||||
free(grid->inv_index_map);
|
||||
|
||||
util_safe_free(grid->fracture_index_map);
|
||||
util_safe_free(grid->inv_fracture_index_map);
|
||||
util_safe_free(grid->mapaxes);
|
||||
free(grid->fracture_index_map);
|
||||
free(grid->inv_fracture_index_map);
|
||||
free(grid->mapaxes);
|
||||
|
||||
if (grid->values != NULL) {
|
||||
int i;
|
||||
@ -4481,9 +4564,9 @@ void ecl_grid_free(ecl_grid_type * grid) {
|
||||
|
||||
vector_free( grid->coarse_cells );
|
||||
hash_free( grid->children );
|
||||
util_safe_free( grid->parent_name );
|
||||
util_safe_free( grid->visited );
|
||||
util_safe_free( grid->name );
|
||||
free( grid->parent_name );
|
||||
free( grid->visited );
|
||||
free( grid->name );
|
||||
free( grid );
|
||||
}
|
||||
|
||||
@ -5389,15 +5472,6 @@ double ecl_grid_get_cell_volume1A( const ecl_grid_type * ecl_grid, int active_in
|
||||
|
||||
|
||||
|
||||
double ecl_grid_get_cell_volume1_tskille( const ecl_grid_type * ecl_grid, int global_index ) {
|
||||
ecl_cell_type * cell = ecl_grid_get_cell( ecl_grid , global_index );
|
||||
return ecl_cell_get_volume_tskille( cell );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
double ecl_grid_get_cell_volume3( const ecl_grid_type * ecl_grid, int i , int j , int k) {
|
||||
int global_index = ecl_grid_get_global_index3( ecl_grid , i , j , k);
|
||||
return ecl_grid_get_cell_volume1( ecl_grid , global_index );
|
||||
|
2
ThirdParty/Ert/lib/ecl/ecl_grid_cache.cpp
vendored
2
ThirdParty/Ert/lib/ecl/ecl_grid_cache.cpp
vendored
@ -21,7 +21,7 @@
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
|
66
ThirdParty/Ert/lib/ecl/ecl_grid_dims.cpp
vendored
66
ThirdParty/Ert/lib/ecl/ecl_grid_dims.cpp
vendored
@ -1,24 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_dims.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_dims.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid_dims.hpp>
|
||||
@ -40,11 +40,11 @@ static void ecl_grid_dims_read_EGRID( ecl_grid_dims_type * grid_dims , fortio_ty
|
||||
grid_dims_type * dims;
|
||||
{
|
||||
ecl_kw_type * gridhead_kw = ecl_kw_fread_alloc( grid_fortio );
|
||||
|
||||
|
||||
int nx = ecl_kw_iget_int( gridhead_kw , GRIDHEAD_NX_INDEX );
|
||||
int ny = ecl_kw_iget_int( gridhead_kw , GRIDHEAD_NY_INDEX );
|
||||
int nz = ecl_kw_iget_int( gridhead_kw , GRIDHEAD_NZ_INDEX );
|
||||
|
||||
|
||||
dims = grid_dims_alloc( nx , ny , nz , 0 );
|
||||
ecl_kw_free( gridhead_kw );
|
||||
}
|
||||
@ -56,9 +56,9 @@ static void ecl_grid_dims_read_EGRID( ecl_grid_dims_type * grid_dims , fortio_ty
|
||||
ecl_kw_free( intehead_kw );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vector_append_owned_ref( grid_dims->dims_list , dims, grid_dims_free__ );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -68,11 +68,11 @@ static void ecl_grid_dims_read_GRID( ecl_grid_dims_type * grid_dims , fortio_typ
|
||||
grid_dims_type * dims;
|
||||
{
|
||||
ecl_kw_type * dimens_kw = ecl_kw_fread_alloc( grid_fortio );
|
||||
|
||||
|
||||
int nx = ecl_kw_iget_int( dimens_kw , DIMENS_NX_INDEX );
|
||||
int ny = ecl_kw_iget_int( dimens_kw , DIMENS_NY_INDEX );
|
||||
int nz = ecl_kw_iget_int( dimens_kw , DIMENS_NZ_INDEX );
|
||||
|
||||
|
||||
dims = grid_dims_alloc( nx , ny , nz , 0 );
|
||||
ecl_kw_free( dimens_kw );
|
||||
}
|
||||
@ -84,9 +84,9 @@ static void ecl_grid_dims_read_GRID( ecl_grid_dims_type * grid_dims , fortio_typ
|
||||
ecl_kw_free( intehead_kw );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vector_append_owned_ref( grid_dims->dims_list , dims, grid_dims_free__ );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -96,37 +96,37 @@ ecl_grid_dims_type * ecl_grid_dims_alloc( const char * grid_file , const char *
|
||||
ecl_grid_dims_type * grid_dims = NULL;
|
||||
bool grid_fmt_file;
|
||||
ecl_file_enum grid_file_type = ecl_util_get_file_type( grid_file , &grid_fmt_file , NULL );
|
||||
|
||||
|
||||
|
||||
|
||||
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 = (ecl_grid_dims_type*)util_malloc( sizeof * grid_dims );
|
||||
grid_dims->dims_list = vector_alloc_new( );
|
||||
|
||||
|
||||
{
|
||||
fortio_type * data_fortio = NULL;
|
||||
bool data_fmt_file;
|
||||
|
||||
|
||||
if (data_file) {
|
||||
ecl_util_get_file_type( data_file , &data_fmt_file , NULL );
|
||||
data_fortio = fortio_open_reader( data_file , data_fmt_file , ECL_ENDIAN_FLIP );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (grid_file_type == ECL_EGRID_FILE)
|
||||
ecl_grid_dims_read_EGRID( grid_dims , grid_fortio , data_fortio );
|
||||
else
|
||||
ecl_grid_dims_read_GRID( grid_dims , grid_fortio , data_fortio );
|
||||
|
||||
|
||||
if (data_fortio)
|
||||
fortio_fclose( data_fortio );
|
||||
|
||||
|
||||
}
|
||||
fortio_fclose( grid_fortio );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return grid_dims;
|
||||
}
|
||||
|
||||
|
2
ThirdParty/Ert/lib/ecl/ecl_init_file.cpp
vendored
2
ThirdParty/Ert/lib/ecl/ecl_init_file.cpp
vendored
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
|
46
ThirdParty/Ert/lib/ecl/ecl_io_config.cpp
vendored
46
ThirdParty/Ert/lib/ecl/ecl_io_config.cpp
vendored
@ -1,26 +1,26 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_io_config.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_io_config.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 <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_io_config.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
* formatted : whether to use formatted files.
|
||||
* unified : whether unified summary || restart files should be used.
|
||||
|
||||
|
||||
All types are implemented by an internal enum which supports a
|
||||
undefined type. The rationale for this is to provide functionality
|
||||
to 'guess' type based on arbitrary input. If for instance the input
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
typedef enum { UNIFIED = 0,
|
||||
MULTIPLE = 1,
|
||||
MULTIPLE = 1,
|
||||
UNIF_UNDEFINED = 2 } unified_type;
|
||||
|
||||
typedef enum { FORMATTED = 0,
|
||||
@ -142,11 +142,11 @@ ecl_io_config_type * ecl_io_config_alloc(bool formatted , bool unified_summary
|
||||
|
||||
return ecl_io_config;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ecl_io_config_free(ecl_io_config_type * io_config) {
|
||||
free(io_config);
|
||||
}
|
||||
|
||||
|
||||
|
20
ThirdParty/Ert/lib/ecl/ecl_kw.cpp
vendored
20
ThirdParty/Ert/lib/ecl/ecl_kw.cpp
vendored
@ -22,7 +22,7 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/buffer.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
@ -651,8 +651,8 @@ ecl_kw_type * ecl_kw_alloc_empty() {
|
||||
|
||||
|
||||
void ecl_kw_free(ecl_kw_type *ecl_kw) {
|
||||
util_safe_free( ecl_kw->header );
|
||||
util_safe_free(ecl_kw->header8);
|
||||
free( ecl_kw->header );
|
||||
free(ecl_kw->header8);
|
||||
ecl_kw_free_data(ecl_kw);
|
||||
free(ecl_kw);
|
||||
}
|
||||
@ -951,7 +951,7 @@ void ecl_kw_iset_string_ptr( ecl_kw_type * ecl_kw, int index, const char * s) {
|
||||
|
||||
{
|
||||
char * ecl_string = (char *) ecl_kw_iget_ptr(ecl_kw, index);
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
for(i = 0; i < input_len; ++i)
|
||||
ecl_string[i] = s[i];
|
||||
@ -1376,7 +1376,9 @@ ecl_read_status_enum ecl_kw_fread_header(ecl_kw_type *ecl_kw , fortio_type * for
|
||||
return ECL_KW_READ_FAIL;
|
||||
|
||||
memcpy( header , &buffer[0] , ECL_STRING8_LENGTH);
|
||||
size = *( (int *) &buffer[ECL_STRING8_LENGTH] );
|
||||
void * ptr = &buffer[ECL_STRING8_LENGTH];
|
||||
size = *((int*)ptr);
|
||||
|
||||
memcpy( ecl_type_str , &buffer[ECL_STRING8_LENGTH + sizeof(size)] , ECL_TYPE_LENGTH);
|
||||
|
||||
if(!fortio_complete_read(fortio , record_size))
|
||||
@ -1483,7 +1485,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 );
|
||||
free( ecl_kw->data );
|
||||
ecl_kw->data = (char*)data;
|
||||
}
|
||||
|
||||
@ -1506,7 +1508,7 @@ void ecl_kw_alloc_data(ecl_kw_type *ecl_kw) {
|
||||
|
||||
void ecl_kw_free_data(ecl_kw_type *ecl_kw) {
|
||||
if (!ecl_kw->shared_data)
|
||||
util_safe_free(ecl_kw->data);
|
||||
free(ecl_kw->data);
|
||||
|
||||
ecl_kw->data = NULL;
|
||||
}
|
||||
@ -1519,7 +1521,7 @@ void ecl_kw_set_header_name(ecl_kw_type * ecl_kw , const char * header) {
|
||||
sprintf(ecl_kw->header8 , "%-8s" , header);
|
||||
|
||||
/* Internalizing a header without the trailing spaces as well. */
|
||||
util_safe_free( ecl_kw->header );
|
||||
free( ecl_kw->header );
|
||||
ecl_kw->header = util_alloc_strip_copy( ecl_kw->header8 );
|
||||
}
|
||||
else {
|
||||
@ -1932,7 +1934,7 @@ ecl_kw_type * ecl_kw_alloc_global_copy(const ecl_kw_type * src, const ecl_kw_typ
|
||||
return NULL;
|
||||
|
||||
const int global_size = ecl_kw_get_size(actnum);
|
||||
ecl_kw_type * global_copy = ecl_kw_alloc( ecl_kw_get_header(src), global_size, src->data_type);
|
||||
ecl_kw_type * global_copy = ecl_kw_alloc( ecl_kw_get_header(src), global_size, src->data_type);
|
||||
const int * mapping = ecl_kw_get_int_ptr(actnum);
|
||||
const int src_size = ecl_kw_get_size(src);
|
||||
int src_index = 0;
|
||||
|
10
ThirdParty/Ert/lib/ecl/ecl_kw_grdecl.cpp
vendored
10
ThirdParty/Ert/lib/ecl/ecl_kw_grdecl.cpp
vendored
@ -19,7 +19,7 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
@ -259,7 +259,7 @@ static char * fscanf_alloc_grdecl_data( const char * header , bool strict , ecl_
|
||||
int buffer_size = 64;
|
||||
int data_index = 0;
|
||||
int sizeof_ctype = ecl_type_get_sizeof_ctype( data_type );
|
||||
int data_size = init_size;
|
||||
size_t data_size = init_size;
|
||||
char * buffer = (char*)util_calloc( (buffer_size + 1) , sizeof * buffer );
|
||||
char * data = (char*)util_calloc( sizeof_ctype * data_size , sizeof * data );
|
||||
|
||||
@ -394,9 +394,9 @@ static char * fscanf_alloc_grdecl_data( const char * header , bool strict , ecl_
|
||||
|
||||
The ecl_kw class has a quite deeply wired assumption that the
|
||||
header is a string of length 8 (I hope/think that is an ECLIPSE
|
||||
limitation). The class cannot read/write kw with headers longer than 8 bytes.
|
||||
limitation). The class cannot read/write kw with headers longer than 8 bytes.
|
||||
ecl_kw_grdecl is a workaround allowing for reading/writing kw with long
|
||||
headers.
|
||||
headers.
|
||||
|
||||
-----------------------------------------------------------------
|
||||
|
||||
@ -454,7 +454,7 @@ static ecl_kw_type * __ecl_kw_fscanf_alloc_grdecl__(FILE * stream , const char *
|
||||
// Verify size
|
||||
if (size > 0)
|
||||
if (size != kw_size) {
|
||||
util_safe_free( data );
|
||||
free( data );
|
||||
util_abort("%s: size mismatch when loading:%s. File:%d elements. Requested:%d elements \n",
|
||||
__func__ , file_header , kw_size , size);
|
||||
}
|
||||
|
24
ThirdParty/Ert/lib/ecl/ecl_nnc_data.cpp
vendored
24
ThirdParty/Ert/lib/ecl/ecl_nnc_data.cpp
vendored
@ -26,9 +26,9 @@
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
|
||||
enum kw_data_type {
|
||||
TRANS_DATA = 1,
|
||||
WTR_FLUX_DATA = 2,
|
||||
OIL_FLUX_DATA = 3,
|
||||
TRANS_DATA = 1,
|
||||
WTR_FLUX_DATA = 2,
|
||||
OIL_FLUX_DATA = 3,
|
||||
GAS_FLUX_DATA = 4
|
||||
};
|
||||
|
||||
@ -40,8 +40,8 @@ struct ecl_nnc_data_struct {
|
||||
|
||||
|
||||
static const char * ecl_nnc_data_get_str_kw(int kw_type, int grid1, int grid2) {
|
||||
char * kw = NULL;
|
||||
switch (kw_type) {
|
||||
const char * kw = NULL;
|
||||
switch (kw_type) {
|
||||
|
||||
case TRANS_DATA:
|
||||
if (grid1 == grid2)
|
||||
@ -65,11 +65,11 @@ static const char * ecl_nnc_data_get_str_kw(int kw_type, int grid1, int grid2) {
|
||||
if (grid1 == grid2)
|
||||
kw = FLROILNNC_KW;
|
||||
else if (grid1 == 0)
|
||||
kw = FLROILLG_KW;
|
||||
kw = FLROILLG_KW;
|
||||
else
|
||||
kw = FLROILLL_KW;
|
||||
break;
|
||||
|
||||
|
||||
case GAS_FLUX_DATA:
|
||||
if (grid1 == grid2)
|
||||
kw = FLRGASNNC_KW;
|
||||
@ -92,7 +92,7 @@ static ecl_kw_type * ecl_nnc_data_get_gl_kw( const ecl_file_view_type * init_fil
|
||||
return NULL;
|
||||
|
||||
if (lgr_nr == 0) {
|
||||
if(ecl_file_view_has_kw(init_file_view, kw))
|
||||
if(ecl_file_view_has_kw(init_file_view, kw))
|
||||
return ecl_file_view_iget_named_kw(init_file_view, kw, 0);
|
||||
else
|
||||
return NULL;
|
||||
@ -180,20 +180,20 @@ static bool ecl_nnc_data_set_values(ecl_nnc_data_type * data, const ecl_grid_typ
|
||||
ecl_kw_type * current_kw = NULL;
|
||||
int correct_kw_count = 0;
|
||||
int kw_count = 0;
|
||||
int nnc_size = ecl_nnc_geometry_size( nnc_geo );
|
||||
int nnc_size = ecl_nnc_geometry_size( nnc_geo );
|
||||
|
||||
for (int nnc_index = 0; nnc_index < nnc_size; nnc_index++) {
|
||||
const ecl_nnc_pair_type * pair = ecl_nnc_geometry_iget( nnc_geo, nnc_index );
|
||||
int grid1 = pair->grid_nr1;
|
||||
int grid2 = pair->grid_nr2;
|
||||
|
||||
|
||||
if (grid1 != current_grid1 || grid2 != current_grid2) {
|
||||
current_grid1 = grid1;
|
||||
current_grid2 = grid2;
|
||||
assert_correct_kw_count(current_kw, __func__, correct_kw_count, kw_count);
|
||||
current_kw = ecl_nnc_data_get_kw( grid, init_file, grid1 , grid2 , kw_type);
|
||||
kw_count = 0;
|
||||
if (current_kw) {
|
||||
if (current_kw) {
|
||||
correct_kw_count = ecl_kw_get_size( current_kw );
|
||||
}
|
||||
else {
|
||||
@ -204,7 +204,7 @@ static bool ecl_nnc_data_set_values(ecl_nnc_data_type * data, const ecl_grid_typ
|
||||
data->values[nnc_index] = ecl_kw_iget_as_double(current_kw, pair->input_index);
|
||||
kw_count++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
assert_correct_kw_count(current_kw, __func__, correct_kw_count, kw_count);
|
||||
return true;
|
||||
|
2
ThirdParty/Ert/lib/ecl/ecl_nnc_geometry.cpp
vendored
2
ThirdParty/Ert/lib/ecl/ecl_nnc_geometry.cpp
vendored
@ -16,7 +16,7 @@
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/util/struct_vector.h>
|
||||
#include <ert/util/struct_vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_nnc_geometry.hpp>
|
||||
|
||||
|
8
ThirdParty/Ert/lib/ecl/ecl_region.cpp
vendored
8
ThirdParty/Ert/lib/ecl/ecl_region.cpp
vendored
@ -21,10 +21,10 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/geometry/geo_util.h>
|
||||
#include <ert/geometry/geo_polygon.h>
|
||||
#include <ert/geometry/geo_util.hpp>
|
||||
#include <ert/geometry/geo_polygon.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
@ -170,7 +170,7 @@ void ecl_region_free( ecl_region_type * region ) {
|
||||
int_vector_free( region->active_index_list );
|
||||
int_vector_free( region->global_index_list );
|
||||
int_vector_free( region->global_active_list );
|
||||
util_safe_free( region->name );
|
||||
free( region->name );
|
||||
free( region );
|
||||
}
|
||||
|
||||
|
122
ThirdParty/Ert/lib/ecl/ecl_rft_cell.cpp
vendored
122
ThirdParty/Ert/lib/ecl/ecl_rft_cell.cpp
vendored
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_rft_cell.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_rft_cell.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 <math.h>
|
||||
@ -23,7 +23,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
@ -43,7 +43,7 @@ struct ecl_rft_cell_struct {
|
||||
int i,j,k;
|
||||
double pressure;
|
||||
double depth;
|
||||
|
||||
|
||||
void * data;
|
||||
};
|
||||
|
||||
@ -67,7 +67,7 @@ struct plt_data_struct {
|
||||
double wrat;
|
||||
double grat;
|
||||
double connection_start;
|
||||
double connection_end;
|
||||
double connection_end;
|
||||
double flowrate;
|
||||
double oil_flowrate;
|
||||
double gas_flowrate;
|
||||
@ -83,7 +83,7 @@ static rft_data_type * rft_data_alloc( double swat , double sgas) {
|
||||
|
||||
data->swat = swat;
|
||||
data->sgas = sgas;
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -108,9 +108,9 @@ static UTIL_IS_INSTANCE_FUNCTION( rft_data , RFT_DATA_TYPE_ID)
|
||||
data->connection_end = connection_end;
|
||||
data->flowrate = flowrate;
|
||||
data->oil_flowrate = oil_flowrate;
|
||||
data->gas_flowrate = gas_flowrate;
|
||||
data->gas_flowrate = gas_flowrate;
|
||||
data->water_flowrate = water_flowrate;
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ static ecl_rft_cell_type * ecl_rft_cell_alloc_common(int i , int j , int k , dou
|
||||
cell->k = k;
|
||||
cell->depth = depth;
|
||||
cell->pressure = pressure;
|
||||
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
@ -155,19 +155,19 @@ ecl_rft_cell_type * ecl_rft_cell_alloc_RFT( int i , int j , int k , double depth
|
||||
}
|
||||
|
||||
|
||||
ecl_rft_cell_type * ecl_rft_cell_alloc_PLT( int i ,
|
||||
int j ,
|
||||
int k ,
|
||||
double depth ,
|
||||
double pressure ,
|
||||
double orat ,
|
||||
double grat ,
|
||||
double wrat,
|
||||
double connection_start,
|
||||
ecl_rft_cell_type * ecl_rft_cell_alloc_PLT( int i ,
|
||||
int j ,
|
||||
int k ,
|
||||
double depth ,
|
||||
double pressure ,
|
||||
double orat ,
|
||||
double grat ,
|
||||
double wrat,
|
||||
double connection_start,
|
||||
double connection_end,
|
||||
double flowrate ,
|
||||
double oil_flowrate ,
|
||||
double gas_flowrate ,
|
||||
double oil_flowrate ,
|
||||
double gas_flowrate ,
|
||||
double water_flowrate) {
|
||||
|
||||
ecl_rft_cell_type * cell = ecl_rft_cell_alloc_common( i , j , k , depth , pressure );
|
||||
@ -226,107 +226,107 @@ double ecl_rft_cell_get_pressure( const ecl_rft_cell_type * cell ) {
|
||||
|
||||
double ecl_rft_cell_get_swat( const ecl_rft_cell_type * cell ) {
|
||||
const rft_data_type * data = rft_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return data->swat;
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
||||
double ecl_rft_cell_get_sgas( const ecl_rft_cell_type * cell ) {
|
||||
const rft_data_type * data = rft_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return data->sgas;
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
||||
double ecl_rft_cell_get_soil( const ecl_rft_cell_type * cell ) {
|
||||
const rft_data_type * data = rft_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return 1 - (data->swat + data->sgas);
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
double ecl_rft_cell_get_orat( const ecl_rft_cell_type * cell ) {
|
||||
const plt_data_type * data = plt_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return data->orat;
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
||||
double ecl_rft_cell_get_grat( const ecl_rft_cell_type * cell ) {
|
||||
const plt_data_type * data = plt_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return data->grat;
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
||||
double ecl_rft_cell_get_wrat( const ecl_rft_cell_type * cell ) {
|
||||
const plt_data_type * data = plt_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return data->wrat;
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
double ecl_rft_cell_get_connection_start( const ecl_rft_cell_type * cell ) {
|
||||
const plt_data_type * data = plt_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return data->connection_start;
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
double ecl_rft_cell_get_connection_end( const ecl_rft_cell_type * cell ) {
|
||||
const plt_data_type * data = plt_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return data->connection_end;
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
double ecl_rft_cell_get_flowrate( const ecl_rft_cell_type * cell ) {
|
||||
const plt_data_type * data = plt_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return data->flowrate;
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
||||
double ecl_rft_cell_get_oil_flowrate( const ecl_rft_cell_type * cell ) {
|
||||
const plt_data_type * data = plt_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return data->oil_flowrate;
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
||||
double ecl_rft_cell_get_gas_flowrate( const ecl_rft_cell_type * cell ) {
|
||||
const plt_data_type * data = plt_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return data->gas_flowrate;
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
||||
double ecl_rft_cell_get_water_flowrate( const ecl_rft_cell_type * cell ) {
|
||||
const plt_data_type * data = plt_data_try_cast_const( cell->data );
|
||||
if (data)
|
||||
if (data)
|
||||
return data->water_flowrate;
|
||||
else
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
return ECL_RFT_CELL_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
||||
@ -338,14 +338,14 @@ double ecl_rft_cell_get_water_flowrate( const ecl_rft_cell_type * cell ) {
|
||||
|
||||
|
||||
bool ecl_rft_cell_ijk_equal( const ecl_rft_cell_type * cell , int i , int j , int k) {
|
||||
return ( (i == cell->i) &&
|
||||
(j == cell->j) &&
|
||||
return ( (i == cell->i) &&
|
||||
(j == cell->j) &&
|
||||
(k == cell->k) );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Currently only comparison based on connection length along PLT is supported.
|
||||
Currently only comparison based on connection length along PLT is supported.
|
||||
*/
|
||||
int ecl_rft_cell_cmp( const ecl_rft_cell_type * cell1 , const ecl_rft_cell_type * cell2) {
|
||||
double val1 = ecl_rft_cell_get_connection_start( cell1 );
|
||||
@ -357,7 +357,7 @@ int ecl_rft_cell_cmp( const ecl_rft_cell_type * cell1 , const ecl_rft_cell_type
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
2
ThirdParty/Ert/lib/ecl/ecl_rft_file.cpp
vendored
2
ThirdParty/Ert/lib/ecl/ecl_rft_file.cpp
vendored
@ -25,7 +25,7 @@
|
||||
#include <fnmatch.h>
|
||||
#endif
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
6
ThirdParty/Ert/lib/ecl/ecl_rft_node.cpp
vendored
6
ThirdParty/Ert/lib/ecl/ecl_rft_node.cpp
vendored
@ -23,7 +23,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
@ -166,7 +166,7 @@ static ecl_kw_type * ecl_rft_node_get_pressure_kw( ecl_rft_node_type * rft_node
|
||||
else {
|
||||
fprintf(stderr, "WARNING: %s returned a CONPRES_KW with all values at zero. PRESSURE_KW not found.\n", __func__);
|
||||
return conpres_kw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -541,7 +541,7 @@ void ecl_rft_node_fwrite(const ecl_rft_node_type * rft_node, fortio_type * forti
|
||||
ecl_rft_enum type = ecl_rft_node_get_type(rft_node);
|
||||
if (type != RFT)
|
||||
util_abort("%s: sorry - only writing of simple RFT is currently implemented",__func__);
|
||||
|
||||
|
||||
{
|
||||
ecl_kw_type * time = ecl_kw_alloc(TIME_KW, 1, ECL_FLOAT);
|
||||
ecl_kw_iset_float(time, 0, ecl_rft_node_get_days(rft_node));
|
||||
|
2
ThirdParty/Ert/lib/ecl/ecl_rst_file.cpp
vendored
2
ThirdParty/Ert/lib/ecl/ecl_rst_file.cpp
vendored
@ -24,7 +24,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
|
12
ThirdParty/Ert/lib/ecl/ecl_rsthead.cpp
vendored
12
ThirdParty/Ert/lib/ecl/ecl_rsthead.cpp
vendored
@ -17,7 +17,7 @@
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
@ -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 );
|
||||
|
||||
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);
|
||||
|
124
ThirdParty/Ert/lib/ecl/ecl_smspec.cpp
vendored
124
ThirdParty/Ert/lib/ecl/ecl_smspec.cpp
vendored
@ -23,7 +23,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/float_vector.hpp>
|
||||
@ -117,7 +117,6 @@ struct ecl_smspec_struct {
|
||||
vector_type * smspec_nodes;
|
||||
bool write_mode;
|
||||
bool need_nums;
|
||||
bool locked;
|
||||
int_vector_type * index_map;
|
||||
|
||||
/*-----------------------------------------------------------------*/
|
||||
@ -217,7 +216,10 @@ Completion var: VAR_TYPE:WELL_NAME:NUM
|
||||
*/
|
||||
|
||||
static const char* special_vars[] = {"NEWTON",
|
||||
"NAIMFRAC",
|
||||
"NLINEARS",
|
||||
"NLINSMIN",
|
||||
"NLINSMAX",
|
||||
"ELAPSED",
|
||||
"MAXDPR",
|
||||
"MAXDSO",
|
||||
@ -272,7 +274,6 @@ ecl_smspec_type * ecl_smspec_alloc_empty(bool write_mode , const char * key_join
|
||||
ecl_smspec->day_index = -1;
|
||||
ecl_smspec->year_index = -1;
|
||||
ecl_smspec->month_index = -1;
|
||||
ecl_smspec->locked = false;
|
||||
ecl_smspec->time_seconds = -1;
|
||||
|
||||
/*
|
||||
@ -303,14 +304,12 @@ int * ecl_smspec_alloc_mapping( const ecl_smspec_type * self, const ecl_smspec_t
|
||||
|
||||
for (int i=0; i < ecl_smspec_num_nodes( self ); i++) {
|
||||
const smspec_node_type * self_node = ecl_smspec_iget_node( self , i );
|
||||
if (smspec_node_is_valid( self_node )) {
|
||||
int self_index = smspec_node_get_params_index( self_node );
|
||||
const char * key = smspec_node_get_gen_key1( self_node );
|
||||
if (ecl_smspec_has_general_var( other , key)) {
|
||||
const smspec_node_type * other_node = ecl_smspec_get_general_var_node( other , key);
|
||||
int other_index = smspec_node_get_params_index(other_node);
|
||||
mapping[ self_index ] = other_index;
|
||||
}
|
||||
int self_index = smspec_node_get_params_index( self_node );
|
||||
const char * key = smspec_node_get_gen_key1( self_node );
|
||||
if (ecl_smspec_has_general_var( other , key)) {
|
||||
const smspec_node_type * other_node = ecl_smspec_get_general_var_node( other , key);
|
||||
int other_index = smspec_node_get_params_index(other_node);
|
||||
mapping[ self_index ] = other_index;
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,21 +333,6 @@ int ecl_smspec_num_nodes( const ecl_smspec_type * smspec) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
In the current implementation it is impossible to mix calls to
|
||||
ecl_sum_add_var() and ecl_sum_add_tstep() - i.e. one must first add
|
||||
*all* the variables with ecl_sum_add_var() calls, and then
|
||||
subsequently add timesteps with ecl_sum_add_tstep().
|
||||
|
||||
The locked property of the smspec structure is to ensure that no new
|
||||
variables are added to the ecl_smspec structure after the first
|
||||
timestep has been added.
|
||||
*/
|
||||
|
||||
void ecl_smspec_lock( ecl_smspec_type * smspec ) {
|
||||
smspec->locked = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ecl data type for which all names will fit. If the maximum name
|
||||
* length is at most 8, an ECL_CHAR is returned and otherwise a large enough
|
||||
@ -358,11 +342,9 @@ static ecl_data_type get_wgnames_type(const ecl_smspec_type * smspec) {
|
||||
size_t max_len = 0;
|
||||
for(int i = 0; i < ecl_smspec_num_nodes(smspec); ++i) {
|
||||
const smspec_node_type * node = ecl_smspec_iget_node(smspec, i);
|
||||
if (smspec_node_is_valid( node )) {
|
||||
const char * name = smspec_node_get_wgname( node );
|
||||
if(name)
|
||||
max_len = util_size_t_max(max_len, strlen(name));
|
||||
}
|
||||
const char * name = smspec_node_get_wgname( node );
|
||||
if(name)
|
||||
max_len = util_size_t_max(max_len, strlen(name));
|
||||
}
|
||||
|
||||
return max_len <= ECL_STRING8_LENGTH ? ECL_CHAR : ECL_STRING(max_len);
|
||||
@ -510,7 +492,7 @@ void ecl_smspec_fwrite( const ecl_smspec_type * smspec , const char * ecl_case ,
|
||||
fortio_type * fortio = fortio_open_writer( filename , fmt_file , ECL_ENDIAN_FLIP);
|
||||
|
||||
if (!fortio) {
|
||||
char * error_fmt_msg = "%s: Unable to open fortio file %s, error: %s .\n";
|
||||
const char * error_fmt_msg = "%s: Unable to open fortio file %s, error: %s .\n";
|
||||
util_abort( error_fmt_msg , __func__ , filename , strerror( errno ) );
|
||||
}
|
||||
|
||||
@ -922,6 +904,7 @@ static void ecl_smspec_install_special_keys( ecl_smspec_type * ecl_smspec , smsp
|
||||
case(ECL_SMSPEC_AQUIFER_VAR):
|
||||
break;
|
||||
default:
|
||||
smspec_node_fprintf(smspec_node, stderr);
|
||||
util_abort("%: Internal error - should never be here ?? \n",__func__);
|
||||
break;
|
||||
}
|
||||
@ -1077,8 +1060,8 @@ static void ecl_smspec_load_restart( ecl_smspec_type * ecl_smspec , const ecl_fi
|
||||
}
|
||||
}
|
||||
|
||||
util_safe_free( path );
|
||||
util_safe_free( smspec_header );
|
||||
free( path );
|
||||
free( smspec_header );
|
||||
}
|
||||
free( restart_base );
|
||||
}
|
||||
@ -1087,18 +1070,11 @@ static void ecl_smspec_load_restart( ecl_smspec_type * ecl_smspec , const ecl_fi
|
||||
|
||||
|
||||
void ecl_smspec_index_node( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node) {
|
||||
/*
|
||||
It is possible crate a node which is not fully specified, e.g. the
|
||||
well or group name can be left at NULL. In that case the node is
|
||||
not installed in the different indexes.
|
||||
*/
|
||||
if (smspec_node_is_valid( smspec_node )) {
|
||||
ecl_smspec_install_gen_keys( ecl_smspec , smspec_node );
|
||||
ecl_smspec_install_special_keys( ecl_smspec , smspec_node );
|
||||
ecl_smspec_install_gen_keys( ecl_smspec , smspec_node );
|
||||
ecl_smspec_install_special_keys( ecl_smspec , smspec_node );
|
||||
|
||||
if (smspec_node_need_nums( smspec_node ))
|
||||
ecl_smspec->need_nums = true;
|
||||
}
|
||||
if (smspec_node_need_nums( smspec_node ))
|
||||
ecl_smspec->need_nums = true;
|
||||
}
|
||||
|
||||
|
||||
@ -1110,30 +1086,27 @@ static void ecl_smspec_set_params_size( ecl_smspec_type * ecl_smspec , int param
|
||||
|
||||
|
||||
void ecl_smspec_insert_node(ecl_smspec_type * ecl_smspec, smspec_node_type * smspec_node){
|
||||
if (!ecl_smspec->locked) {
|
||||
int internal_index = vector_get_size( ecl_smspec->smspec_nodes );
|
||||
int internal_index = vector_get_size( ecl_smspec->smspec_nodes );
|
||||
|
||||
/* This IF test should only apply in write_mode. */
|
||||
if (smspec_node_get_params_index( smspec_node ) < 0) {
|
||||
if (!ecl_smspec->write_mode)
|
||||
util_abort("%s: internal error \n",__func__);
|
||||
smspec_node_set_params_index( smspec_node , internal_index);
|
||||
/* This IF test should only apply in write_mode. */
|
||||
if (smspec_node_get_params_index( smspec_node ) < 0) {
|
||||
if (!ecl_smspec->write_mode)
|
||||
util_abort("%s: internal error \n",__func__);
|
||||
smspec_node_set_params_index( smspec_node , internal_index);
|
||||
|
||||
if (internal_index >= ecl_smspec->params_size)
|
||||
ecl_smspec_set_params_size( ecl_smspec , internal_index + 1);
|
||||
}
|
||||
vector_append_owned_ref( ecl_smspec->smspec_nodes , smspec_node , smspec_node_free__ );
|
||||
if (internal_index >= ecl_smspec->params_size)
|
||||
ecl_smspec_set_params_size( ecl_smspec , internal_index + 1);
|
||||
}
|
||||
vector_append_owned_ref( ecl_smspec->smspec_nodes , smspec_node , smspec_node_free__ );
|
||||
|
||||
{
|
||||
int params_index = smspec_node_get_params_index( smspec_node );
|
||||
{
|
||||
int params_index = smspec_node_get_params_index( smspec_node );
|
||||
|
||||
/* This indexing must be used when writing. */
|
||||
int_vector_iset( ecl_smspec->index_map , internal_index , params_index);
|
||||
/* This indexing must be used when writing. */
|
||||
int_vector_iset( ecl_smspec->index_map , internal_index , params_index);
|
||||
|
||||
float_vector_iset( ecl_smspec->params_default , params_index , smspec_node_get_default(smspec_node) );
|
||||
}
|
||||
} else
|
||||
util_abort("%s: sorry - the smspec header has been locked (can not mix ecl_sum_add_var() and ecl_sum_add_tstep() calls.)\n",__func__);
|
||||
float_vector_iset( ecl_smspec->params_default , params_index , smspec_node_get_default(smspec_node) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1168,7 +1141,7 @@ static const char * get_active_keyword_alias(ecl_file_type * header, const char
|
||||
|
||||
static bool ecl_smspec_check_header( ecl_file_type * header ) {
|
||||
bool OK = true;
|
||||
for (int i=0; i < num_req_keywords && OK; i++) {
|
||||
for (size_t i=0; i < num_req_keywords && OK; i++) {
|
||||
OK &= ecl_file_has_kw(
|
||||
header,
|
||||
get_active_keyword_alias(header, smspec_required_keywords[i])
|
||||
@ -1257,13 +1230,13 @@ static bool ecl_smspec_fread_header(ecl_smspec_type * ecl_smspec, const char * h
|
||||
} 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);
|
||||
|
||||
|
||||
ecl_smspec_add_node( ecl_smspec , smspec_node );
|
||||
if (smspec_node)
|
||||
ecl_smspec_add_node( ecl_smspec , smspec_node );
|
||||
|
||||
free( kw );
|
||||
free( well );
|
||||
free( unit );
|
||||
util_safe_free( lgr_name );
|
||||
free( lgr_name );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1287,7 +1260,7 @@ ecl_smspec_type * ecl_smspec_fread_alloc(const char *header_file, const char * k
|
||||
char *path;
|
||||
util_alloc_file_components(header_file , &path , NULL , NULL);
|
||||
ecl_smspec = ecl_smspec_alloc_empty(false , key_join_string);
|
||||
util_safe_free(path);
|
||||
free(path);
|
||||
}
|
||||
|
||||
if (ecl_smspec_fread_header(ecl_smspec , header_file , include_restart)) {
|
||||
@ -1710,6 +1683,13 @@ int ecl_smspec_get_restart_step(const ecl_smspec_type * ecl_smspec) {
|
||||
return ecl_smspec->restart_step;
|
||||
}
|
||||
|
||||
int ecl_smspec_get_first_step(const ecl_smspec_type * ecl_smspec) {
|
||||
if (ecl_smspec->restart_step > 0)
|
||||
return ecl_smspec->restart_step + 1;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
const char * ecl_smspec_get_restart_case( const ecl_smspec_type * ecl_smspec) {
|
||||
return ecl_smspec->restart_case;
|
||||
@ -1731,7 +1711,7 @@ void ecl_smspec_free(ecl_smspec_type *ecl_smspec) {
|
||||
hash_free(ecl_smspec->misc_var_index);
|
||||
hash_free(ecl_smspec->block_var_index);
|
||||
hash_free(ecl_smspec->gen_var_index);
|
||||
util_safe_free( ecl_smspec->header_file );
|
||||
free( ecl_smspec->header_file );
|
||||
int_vector_free( ecl_smspec->index_map );
|
||||
float_vector_free( ecl_smspec->params_default );
|
||||
vector_free( ecl_smspec->smspec_nodes );
|
||||
@ -1932,10 +1912,6 @@ const int * ecl_smspec_get_grid_dims( const ecl_smspec_type * smspec ) {
|
||||
}
|
||||
|
||||
|
||||
void ecl_smspec_update_wgname( ecl_smspec_type * smspec , smspec_node_type * node , const char * wgname ) {
|
||||
smspec_node_update_wgname( node , wgname , smspec->key_join_string);
|
||||
ecl_smspec_index_node( smspec , node );
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
|
6
ThirdParty/Ert/lib/ecl/ecl_subsidence.cpp
vendored
6
ThirdParty/Ert/lib/ecl/ecl_subsidence.cpp
vendored
@ -23,7 +23,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
@ -123,8 +123,8 @@ static ecl_subsidence_survey_type * ecl_subsidence_survey_alloc_PRESSURE(ecl_sub
|
||||
|
||||
static void ecl_subsidence_survey_free( ecl_subsidence_survey_type * subsidence_survey ) {
|
||||
free( subsidence_survey->name );
|
||||
util_safe_free( subsidence_survey->porv );
|
||||
util_safe_free( subsidence_survey->pressure );
|
||||
free( subsidence_survey->porv );
|
||||
free( subsidence_survey->pressure );
|
||||
free( subsidence_survey );
|
||||
}
|
||||
|
||||
|
137
ThirdParty/Ert/lib/ecl/ecl_sum.cpp
vendored
137
ThirdParty/Ert/lib/ecl/ecl_sum.cpp
vendored
@ -16,6 +16,8 @@
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
@ -23,9 +25,8 @@
|
||||
#include <locale.h>
|
||||
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/set.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/bool_vector.hpp>
|
||||
@ -124,11 +125,11 @@ UTIL_IS_INSTANCE_FUNCTION( ecl_sum , ECL_SUM_ID );
|
||||
*/
|
||||
|
||||
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 );
|
||||
util_safe_free( ecl_sum->base );
|
||||
util_safe_free( ecl_sum->ext );
|
||||
free( ecl_sum->ecl_case );
|
||||
free( ecl_sum->path );
|
||||
free( ecl_sum->abs_path );
|
||||
free( ecl_sum->base );
|
||||
free( ecl_sum->ext );
|
||||
{
|
||||
char *path , *base, *ext;
|
||||
|
||||
@ -143,9 +144,9 @@ void ecl_sum_set_case( ecl_sum_type * ecl_sum , const char * input_arg) {
|
||||
else
|
||||
ecl_sum->abs_path = util_alloc_cwd();
|
||||
|
||||
util_safe_free( base );
|
||||
util_safe_free( path );
|
||||
util_safe_free( ext );
|
||||
free( base );
|
||||
free( path );
|
||||
free( ext );
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,22 +174,22 @@ static ecl_sum_type * ecl_sum_alloc__( const char * input_arg , const char * key
|
||||
}
|
||||
|
||||
|
||||
static bool ecl_sum_fread_data( ecl_sum_type * ecl_sum , const stringlist_type * data_files , bool include_restart) {
|
||||
static bool ecl_sum_fread_data( ecl_sum_type * ecl_sum , const stringlist_type * data_files , bool include_restart, bool lazy_load) {
|
||||
if (ecl_sum->data != NULL)
|
||||
ecl_sum_free_data( ecl_sum );
|
||||
|
||||
ecl_sum->data = ecl_sum_data_alloc( ecl_sum->smspec );
|
||||
return ecl_sum_data_fread( ecl_sum->data , data_files);
|
||||
return ecl_sum_data_fread( ecl_sum->data , data_files, lazy_load);
|
||||
}
|
||||
|
||||
|
||||
static void ecl_sum_fread_history( ecl_sum_type * ecl_sum ) {
|
||||
static void ecl_sum_fread_history( ecl_sum_type * ecl_sum, bool lazy_load) {
|
||||
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);
|
||||
ecl_sum_type * restart_case = ecl_sum_fread_alloc_case2__(restart_header, ":" , true, lazy_load);
|
||||
if (restart_case) {
|
||||
ecl_sum->restart_case = restart_case;
|
||||
ecl_sum_data_add_case(ecl_sum->data , restart_case->data );
|
||||
@ -198,7 +199,7 @@ static void ecl_sum_fread_history( ecl_sum_type * ecl_sum ) {
|
||||
|
||||
|
||||
|
||||
static bool ecl_sum_fread(ecl_sum_type * ecl_sum , const char *header_file , const stringlist_type *data_files , bool include_restart) {
|
||||
static bool ecl_sum_fread(ecl_sum_type * ecl_sum , const char *header_file , const stringlist_type *data_files , bool include_restart, bool lazy_load) {
|
||||
ecl_sum->smspec = ecl_smspec_fread_alloc( header_file , ecl_sum->key_join_string , include_restart);
|
||||
if (ecl_sum->smspec) {
|
||||
bool fmt_file;
|
||||
@ -207,7 +208,7 @@ static bool ecl_sum_fread(ecl_sum_type * ecl_sum , const char *header_file , con
|
||||
} else
|
||||
return false;
|
||||
|
||||
if (ecl_sum_fread_data( ecl_sum , data_files , include_restart )) {
|
||||
if (ecl_sum_fread_data( ecl_sum , data_files , include_restart, lazy_load )) {
|
||||
ecl_file_enum file_type = ecl_util_get_file_type( stringlist_iget( data_files , 0 ) , NULL , NULL);
|
||||
|
||||
if (file_type == ECL_SUMMARY_FILE)
|
||||
@ -220,13 +221,13 @@ static bool ecl_sum_fread(ecl_sum_type * ecl_sum , const char *header_file , con
|
||||
return false;
|
||||
|
||||
if (include_restart && ecl_smspec_get_restart_case( ecl_sum->smspec ))
|
||||
ecl_sum_fread_history( ecl_sum );
|
||||
ecl_sum_fread_history( ecl_sum, lazy_load);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static bool ecl_sum_fread_case( ecl_sum_type * ecl_sum , bool include_restart) {
|
||||
static bool ecl_sum_fread_case( ecl_sum_type * ecl_sum , bool include_restart, bool lazy_load) {
|
||||
char * header_file;
|
||||
stringlist_type * summary_file_list = stringlist_alloc_new();
|
||||
|
||||
@ -234,9 +235,9 @@ static bool ecl_sum_fread_case( ecl_sum_type * ecl_sum , bool include_restart) {
|
||||
|
||||
ecl_util_alloc_summary_files( ecl_sum->path , ecl_sum->base , ecl_sum->ext , &header_file , summary_file_list );
|
||||
if ((header_file != NULL) && (stringlist_get_size( summary_file_list ) > 0)) {
|
||||
caseOK = ecl_sum_fread( ecl_sum , header_file , summary_file_list , include_restart );
|
||||
caseOK = ecl_sum_fread( ecl_sum , header_file , summary_file_list , include_restart, lazy_load );
|
||||
}
|
||||
util_safe_free( header_file );
|
||||
free( header_file );
|
||||
stringlist_free( summary_file_list );
|
||||
|
||||
return caseOK;
|
||||
@ -254,10 +255,10 @@ static bool ecl_sum_fread_case( ecl_sum_type * ecl_sum , bool include_restart) {
|
||||
*/
|
||||
|
||||
|
||||
ecl_sum_type * ecl_sum_fread_alloc(const char *header_file , const stringlist_type *data_files , const char * key_join_string, bool include_restart) {
|
||||
ecl_sum_type * ecl_sum_fread_alloc(const char *header_file , const stringlist_type *data_files , const char * key_join_string, bool include_restart, bool lazy_load) {
|
||||
ecl_sum_type * ecl_sum = ecl_sum_alloc__( header_file , key_join_string );
|
||||
if (ecl_sum) {
|
||||
if (!ecl_sum_fread( ecl_sum , header_file , data_files , include_restart)) {
|
||||
if (!ecl_sum_fread( ecl_sum , header_file , data_files , include_restart, lazy_load)) {
|
||||
ecl_sum_free( ecl_sum );
|
||||
ecl_sum = NULL;
|
||||
}
|
||||
@ -277,14 +278,24 @@ void ecl_sum_set_fmt_case( ecl_sum_type * ecl_sum , bool fmt_case ) {
|
||||
}
|
||||
|
||||
|
||||
void ecl_sum_init_var( ecl_sum_type * ecl_sum , smspec_node_type * smspec_node , const char * keyword , const char * wgname , int num , const char * unit) {
|
||||
ecl_smspec_init_var( ecl_sum->smspec , smspec_node , keyword , wgname , num, unit );
|
||||
}
|
||||
|
||||
|
||||
smspec_node_type * ecl_sum_add_var( ecl_sum_type * ecl_sum , const char * keyword , const char * wgname , int num , const char * unit , float default_value) {
|
||||
smspec_node_type * smspec_node = ecl_sum_add_blank_var( ecl_sum , default_value );
|
||||
ecl_sum_init_var( ecl_sum , smspec_node , keyword , wgname , num , unit );
|
||||
if (ecl_sum_data_get_length(ecl_sum->data) > 0)
|
||||
throw std::invalid_argument("Can not interchange variable adding and timesteps.\n");
|
||||
|
||||
|
||||
smspec_node_type * smspec_node = smspec_node_alloc( ecl_smspec_identify_var_type(keyword),
|
||||
wgname,
|
||||
keyword,
|
||||
unit,
|
||||
ecl_sum->key_join_string,
|
||||
ecl_smspec_get_grid_dims(ecl_sum->smspec),
|
||||
num,
|
||||
-1,
|
||||
default_value);
|
||||
ecl_smspec_add_node(ecl_sum->smspec, smspec_node);
|
||||
ecl_sum_data_reset_self_map( ecl_sum->data );
|
||||
return smspec_node;
|
||||
}
|
||||
|
||||
@ -298,11 +309,6 @@ smspec_node_type * ecl_sum_add_smspec_node(ecl_sum_type * ecl_sum, const smspec_
|
||||
}
|
||||
|
||||
|
||||
smspec_node_type * ecl_sum_add_blank_var( ecl_sum_type * ecl_sum , float default_value) {
|
||||
smspec_node_type * smspec_node = smspec_node_alloc_new( -1 , default_value );
|
||||
ecl_smspec_add_node( ecl_sum->smspec , smspec_node );
|
||||
return smspec_node;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -371,6 +377,10 @@ void ecl_sum_fwrite( const ecl_sum_type * ecl_sum ) {
|
||||
}
|
||||
|
||||
|
||||
bool ecl_sum_can_write(const ecl_sum_type * ecl_sum) {
|
||||
return ecl_sum_data_can_write(ecl_sum->data);
|
||||
}
|
||||
|
||||
void ecl_sum_fwrite_smspec( const ecl_sum_type * ecl_sum ) {
|
||||
ecl_smspec_fwrite( ecl_sum->smspec , ecl_sum->ecl_case , ecl_sum->fmt_case );
|
||||
}
|
||||
@ -400,9 +410,9 @@ void ecl_sum_free( ecl_sum_type * ecl_sum ) {
|
||||
if (ecl_sum->smspec)
|
||||
ecl_smspec_free( ecl_sum->smspec );
|
||||
|
||||
util_safe_free( ecl_sum->path );
|
||||
util_safe_free( ecl_sum->ext );
|
||||
util_safe_free( ecl_sum->abs_path );
|
||||
free( ecl_sum->path );
|
||||
free( ecl_sum->ext );
|
||||
free( ecl_sum->abs_path );
|
||||
|
||||
free( ecl_sum->base );
|
||||
free( ecl_sum->ecl_case );
|
||||
@ -441,12 +451,12 @@ void ecl_sum_free__(void * __ecl_sum) {
|
||||
*/
|
||||
|
||||
|
||||
ecl_sum_type * ecl_sum_fread_alloc_case__(const char * input_file , const char * key_join_string , bool include_restart){
|
||||
ecl_sum_type * ecl_sum_fread_alloc_case2__(const char * input_file , const char * key_join_string , bool include_restart, bool lazy_load){
|
||||
ecl_sum_type * ecl_sum = ecl_sum_alloc__(input_file , key_join_string);
|
||||
if (!ecl_sum)
|
||||
return NULL;
|
||||
|
||||
if (ecl_sum_fread_case( ecl_sum , include_restart))
|
||||
if (ecl_sum_fread_case( ecl_sum , include_restart, lazy_load))
|
||||
return ecl_sum;
|
||||
else {
|
||||
/*
|
||||
@ -458,11 +468,16 @@ ecl_sum_type * ecl_sum_fread_alloc_case__(const char * input_file , const char *
|
||||
}
|
||||
}
|
||||
|
||||
ecl_sum_type * ecl_sum_fread_alloc_case__(const char * input_file , const char * key_join_string , bool include_restart) {
|
||||
bool lazy_load = true;
|
||||
return ecl_sum_fread_alloc_case2__(input_file, key_join_string, include_restart, lazy_load);
|
||||
}
|
||||
|
||||
|
||||
ecl_sum_type * ecl_sum_fread_alloc_case(const char * input_file , const char * key_join_string){
|
||||
bool include_restart = true;
|
||||
return ecl_sum_fread_alloc_case__( input_file , key_join_string , include_restart );
|
||||
bool lazy_load = true;
|
||||
return ecl_sum_fread_alloc_case2__( input_file , key_join_string , include_restart, lazy_load );
|
||||
}
|
||||
|
||||
|
||||
@ -477,10 +492,10 @@ bool ecl_sum_case_exists( const char * input_file ) {
|
||||
util_alloc_file_components( input_file , &path , &basename , &extension);
|
||||
case_exists = ecl_util_alloc_summary_files( path , basename , extension , &smspec_file , data_files );
|
||||
|
||||
util_safe_free( path );
|
||||
util_safe_free( basename );
|
||||
util_safe_free( extension );
|
||||
util_safe_free( smspec_file );
|
||||
free( path );
|
||||
free( basename );
|
||||
free( extension );
|
||||
free( smspec_file );
|
||||
stringlist_free( data_files );
|
||||
|
||||
return case_exists;
|
||||
@ -755,7 +770,7 @@ const char * ecl_sum_get_general_var_unit( const ecl_sum_type * ecl_sum , const
|
||||
ecl_sum_type * ecl_sum_alloc_resample(const ecl_sum_type * ecl_sum, const char * ecl_case, const time_t_vector_type * times) {
|
||||
time_t start_time = ecl_sum_get_data_start(ecl_sum);
|
||||
|
||||
if ( time_t_vector_get_first(times) < start_time )
|
||||
if ( time_t_vector_get_first(times) < start_time )
|
||||
return NULL;
|
||||
if ( time_t_vector_get_last(times) > ecl_sum_get_end_time(ecl_sum) )
|
||||
return NULL;
|
||||
@ -778,9 +793,6 @@ ecl_sum_type * ecl_sum_alloc_resample(const ecl_sum_type * ecl_sum, const char *
|
||||
if (util_string_equal(smspec_node_get_gen_key1(node), "TIME"))
|
||||
continue;
|
||||
|
||||
if (!smspec_node_is_valid(node))
|
||||
continue;
|
||||
|
||||
ecl_sum_add_smspec_node( ecl_sum_resampled, node );
|
||||
}
|
||||
|
||||
@ -885,33 +897,17 @@ int ecl_sum_iget_report_end( const ecl_sum_type * ecl_sum, int report_step) {
|
||||
return ecl_sum_data_iget_report_end(ecl_sum->data , report_step );
|
||||
}
|
||||
|
||||
int ecl_sum_iget_report_start( const ecl_sum_type * ecl_sum, int report_step) {
|
||||
return ecl_sum_data_iget_report_start(ecl_sum->data , report_step );
|
||||
}
|
||||
|
||||
int ecl_sum_iget_report_step( const ecl_sum_type * ecl_sum , int internal_index ){
|
||||
return ecl_sum_data_iget_report_step( ecl_sum->data , internal_index );
|
||||
}
|
||||
|
||||
|
||||
int ecl_sum_iget_mini_step( const ecl_sum_type * ecl_sum , int internal_index ){
|
||||
return ecl_sum_data_iget_mini_step( ecl_sum->data , internal_index );
|
||||
}
|
||||
|
||||
|
||||
void ecl_sum_init_time_vector( const ecl_sum_type * ecl_sum , time_t_vector_type * time_vector , bool report_only ) {
|
||||
ecl_sum_data_init_time_vector( ecl_sum->data , time_vector , report_only );
|
||||
}
|
||||
|
||||
|
||||
time_t_vector_type * ecl_sum_alloc_time_vector( const ecl_sum_type * ecl_sum , bool report_only) {
|
||||
return ecl_sum_data_alloc_time_vector( ecl_sum->data , report_only );
|
||||
}
|
||||
|
||||
void ecl_sum_init_data_vector( const ecl_sum_type * ecl_sum , double_vector_type * data_vector , int data_index , bool report_only ) {
|
||||
ecl_sum_data_init_data_vector( ecl_sum->data , data_vector , data_index , report_only );
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
@ -1259,8 +1255,8 @@ bool ecl_sum_same_case( const ecl_sum_type * ecl_sum , const char * input_file )
|
||||
}
|
||||
}
|
||||
|
||||
util_safe_free( path );
|
||||
util_safe_free( base );
|
||||
free( path );
|
||||
free( base );
|
||||
}
|
||||
return same_case;
|
||||
}
|
||||
@ -1346,14 +1342,6 @@ int ecl_sum_get_data_length( const ecl_sum_type * ecl_sum ) {
|
||||
return ecl_sum_data_get_length( ecl_sum->data );
|
||||
}
|
||||
|
||||
void ecl_sum_scale_vector( ecl_sum_type * ecl_sum, int index, double scalar ) {
|
||||
ecl_sum_data_scale_vector( ecl_sum->data, index, scalar );
|
||||
}
|
||||
|
||||
void ecl_sum_shift_vector( ecl_sum_type * ecl_sum, int index, double addend ) {
|
||||
ecl_sum_data_shift_vector( ecl_sum->data, index, addend );
|
||||
}
|
||||
|
||||
bool ecl_sum_check_sim_time( const ecl_sum_type * sum , time_t sim_time) {
|
||||
return ecl_sum_data_check_sim_time( sum->data , sim_time );
|
||||
}
|
||||
@ -1381,9 +1369,6 @@ const ecl_smspec_type * ecl_sum_get_smspec( const ecl_sum_type * ecl_sum ) {
|
||||
return ecl_sum->smspec;
|
||||
}
|
||||
|
||||
void ecl_sum_update_wgname( ecl_sum_type * ecl_sum , smspec_node_type * node , const char * wgname ) {
|
||||
ecl_smspec_update_wgname( ecl_sum->smspec ,node , wgname );
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
|
1301
ThirdParty/Ert/lib/ecl/ecl_sum_data.cpp
vendored
1301
ThirdParty/Ert/lib/ecl/ecl_sum_data.cpp
vendored
File diff suppressed because it is too large
Load Diff
731
ThirdParty/Ert/lib/ecl/ecl_sum_file_data.cpp
vendored
Normal file
731
ThirdParty/Ert/lib/ecl/ecl_sum_file_data.cpp
vendored
Normal file
@ -0,0 +1,731 @@
|
||||
#include <stdexcept>
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include <ert/ecl/ecl_sum_tstep.hpp>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
|
||||
#include "detail/ecl/ecl_sum_file_data.hpp"
|
||||
#include "detail/ecl/ecl_unsmry_loader.hpp"
|
||||
|
||||
/*
|
||||
This file implements the type ecl_sum_data_type. The data structure
|
||||
is involved with holding all the actual summary data (i.e. the
|
||||
PARAMS vectors in ECLIPSE speak), in addition the time-information
|
||||
with MINISTEPS / REPORT_STEPS and so on is implemented here.
|
||||
|
||||
This file has no information about how to index into the PARAMS
|
||||
vector, i.e. at which location can the WWCT for well P6 be found,
|
||||
that is responsability of the ecl_smspec_type.
|
||||
|
||||
The time direction in this system is implemented in terms of
|
||||
ministeps. There are some query / convert functons based on report
|
||||
steps.
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
/*
|
||||
About ministeps and report steps.
|
||||
---------------------------------
|
||||
|
||||
A sequence of summary data will typically look like this:
|
||||
|
||||
------------------
|
||||
SEQHDR \
|
||||
MINISTEP 0 |
|
||||
PARAMS ..... |
|
||||
MINISTEP 1 |==> This is REPORT STEP 1, in file BASE.S00001
|
||||
PARAMS ..... |
|
||||
MINISTEP 2 |
|
||||
PARAMS ..... /
|
||||
------------------
|
||||
SEQHDR \
|
||||
MINISTEP 3 |
|
||||
PARAMS ..... |
|
||||
MINISTEP 4 |
|
||||
PARAMS ..... |
|
||||
MINISTEP 5 |==> This is REPORT STEP 2, in file BASE.S0002
|
||||
PARAMS ..... |
|
||||
MINISTEP 6 |
|
||||
PARAMS ..... |
|
||||
SEQHDR |
|
||||
MINISTEP 7 |
|
||||
PARAMS ..... /
|
||||
------------------
|
||||
|
||||
|
||||
Observe the following:
|
||||
|
||||
* The MINISTEP counter runs continously, and does not
|
||||
differentiate between unified files and not unified files.
|
||||
|
||||
* When using multiple files we can read off the report number
|
||||
from the filename, for unified files this is IMPOSSIBLE, and we
|
||||
just have to assume that the first block corresponds to
|
||||
report_step 1 and then count afterwards.
|
||||
|
||||
* When asking for a summary variable at a particular REPORT STEP
|
||||
(as we do in enkf) it is ambigous as to which ministep within
|
||||
the block one should use. The convention we have employed
|
||||
(which corresponds to the old RPTONLY based behaviour) is to
|
||||
use the last ministep in the block.
|
||||
|
||||
* There is no BASE.SOOOO file
|
||||
|
||||
* The report steps are halfopen intervals in the "wrong way":
|
||||
(....]
|
||||
|
||||
|
||||
|
||||
|
||||
About MINISTEP, REPORTSTEP, rates and continous sim_time/sim_days:
|
||||
------------------------------------------------------------------
|
||||
|
||||
For ECLIPSE summary files the smallest unit of time resolution is
|
||||
called the ministep - a ministep corresponds to a time step in the
|
||||
underlying partial differential equation, i.e. the length of the
|
||||
timesteps is controlled by the simulator itself - there is no finer
|
||||
temporal resolution.
|
||||
|
||||
The user has told the simulator to store (i.e. save to file
|
||||
results) the results at reportsteps. A reportstep will typically
|
||||
consist of several ministeps. The timeline below shows a simulation
|
||||
consisting of two reportsteps:
|
||||
|
||||
|
||||
S0001 S0002
|
||||
||------|------|------------|------------------||----------------------|----------------------||
|
||||
M1 M2 M3 M4 M5 M6
|
||||
|
||||
The first reportstep consist of four ministeps, the second
|
||||
reportstep consits of only two ministeps. As a user you have no
|
||||
control over the length/number of ministeps apart from:
|
||||
|
||||
1. Indirectly through the TUNING keywords.
|
||||
2. A ministep will always end at a report step.
|
||||
|
||||
|
||||
RPTONLY: In conjunction with enkf it has been customary to use the
|
||||
keyword RPTONLY. This is purely a storage directive, the effect is
|
||||
that only the ministep ending at the REPORT step is reported,
|
||||
i.e. in the case above we would get the ministeps [M4 , M6], where
|
||||
the ministeps M4 and M6 will be unchanged, and there will be many
|
||||
'holes' in the timeline.
|
||||
|
||||
About truetime: The ministeps have a finite length; this implies
|
||||
that
|
||||
|
||||
[rates]: The ministep value is NOT actually an instantaneous
|
||||
value, it is the total production during the ministepd period
|
||||
- divided by the length of the ministep. I.e. it is an average
|
||||
value. (I.e. the differential time element dt is actually quite
|
||||
looong).
|
||||
|
||||
[state]: For state variables (this will include total production
|
||||
of various phases), the ministep value corresponds to the
|
||||
reservoir state at THE END OF THE MINISTEP.
|
||||
|
||||
This difference between state variables and rates implies a
|
||||
difference in how continous time-variables (in the middle of a
|
||||
ministep) are reported, i.e.
|
||||
|
||||
|
||||
S0000 S0001
|
||||
||--------------|---------------|------------X-------------||
|
||||
M1 M2 /|\ M3
|
||||
|
|
||||
|
|
||||
|
||||
We have enteeed the sim_days/sim_time cooresponding to the location
|
||||
of 'X' on the timeline, i.e. in the middle of ministep M3. If we
|
||||
are interested in the rate at this time the function:
|
||||
|
||||
ecl_sum_data_get_from_sim_time()
|
||||
|
||||
will just return the M3 value, whereas if you are interested in
|
||||
e.g. pressure at this time the function will return a weighted
|
||||
average of the M2 and M3 values. Whether a variable in question is
|
||||
interpreted as a 'rate' is effectively determined by the
|
||||
ecl_smspec_set_rate_var() function in ecl_smspec.c.
|
||||
|
||||
|
||||
|
||||
Indexing and _get() versus _iget()
|
||||
----------------------------------
|
||||
As already mentionded the set of ministeps is not necessarrily a
|
||||
continous series, we can easily have a series of ministeps with
|
||||
"holes" in it, and the series can also start on a non-zero
|
||||
value. Internally all the ministeps are stored in a dense, zero
|
||||
offset vector instance; and we must be able to translate back and
|
||||
forth between ministep_nr and internal index.
|
||||
|
||||
Partly due to EnKF heritage the MINISTEP nr has been the main
|
||||
method to access the time dimension of the data, i.e. all the
|
||||
functions like ecl_sum_get_general_var() expect the time direction
|
||||
to be given as a ministep; however it is also possible to get the
|
||||
data by giving an internal (not that internal ...) index. In
|
||||
ecl_sum_data.c the latter functions have _iget():
|
||||
|
||||
|
||||
ecl_sum_data_get_xxx : Expects the time direction given as a ministep_nr.
|
||||
ecl_sum_data_iget_xxx: Expects the time direction given as an internal index.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
namespace ecl {
|
||||
|
||||
|
||||
ecl_sum_file_data::ecl_sum_file_data(const ecl_smspec_type * smspec) :
|
||||
ecl_smspec( smspec ),
|
||||
data( vector_alloc_new() )
|
||||
{
|
||||
}
|
||||
|
||||
ecl_sum_file_data::~ecl_sum_file_data() {
|
||||
vector_free( data );
|
||||
}
|
||||
|
||||
|
||||
int ecl_sum_file_data::length() const {
|
||||
if (this->loader)
|
||||
return this->loader->length();
|
||||
else
|
||||
return this->index.size();
|
||||
}
|
||||
|
||||
|
||||
int ecl_sum_file_data::length_before(time_t end_time) const {
|
||||
int offset = 0;
|
||||
while (true) {
|
||||
time_t itime = this->iget_sim_time(offset);
|
||||
if (itime >= end_time)
|
||||
return offset;
|
||||
|
||||
offset += 1;
|
||||
if (offset == this->length())
|
||||
return offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int ecl_sum_file_data::report_before(time_t end_time) const {
|
||||
if (end_time < this->first_report())
|
||||
throw std::invalid_argument("time argument before first report step");
|
||||
|
||||
int r = this->first_report();
|
||||
int last_report = this->last_report();
|
||||
while (true) {
|
||||
if (r == last_report)
|
||||
return last_report;
|
||||
|
||||
auto next_range = this->index.report_range(r + 1);
|
||||
if (this->iget_sim_time(next_range.first) > end_time)
|
||||
return r;
|
||||
|
||||
r += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int ecl_sum_file_data::first_report() const{
|
||||
const auto& node = this->index[0];
|
||||
return node.report_step;
|
||||
}
|
||||
|
||||
int ecl_sum_file_data::last_report() const {
|
||||
const auto& node = this->index.back();
|
||||
return node.report_step;
|
||||
}
|
||||
|
||||
|
||||
|
||||
time_t ecl_sum_file_data::get_data_start() const {
|
||||
const auto& node = this->index[0];
|
||||
return node.sim_time;
|
||||
}
|
||||
|
||||
|
||||
time_t ecl_sum_file_data::get_sim_end() const {
|
||||
const auto& node = this->index.back();
|
||||
return node.sim_time;
|
||||
}
|
||||
|
||||
time_t ecl_sum_file_data::iget_sim_time(int time_index) const {
|
||||
const auto& node = this->index[time_index];
|
||||
return node.sim_time;
|
||||
}
|
||||
|
||||
/*
|
||||
Will return the length of the simulation in whatever units were used in input.
|
||||
*/
|
||||
double ecl_sum_file_data::get_sim_length() const {
|
||||
const auto& node = this->index.back();
|
||||
return node.sim_seconds / ecl_smspec_get_time_seconds( this->ecl_smspec );
|
||||
}
|
||||
|
||||
double ecl_sum_file_data::iget( int time_index , int params_index ) const {
|
||||
if (this->loader)
|
||||
return this->loader->iget(time_index, params_index);
|
||||
else {
|
||||
const ecl_sum_tstep_type * ministep_data = iget_ministep( time_index );
|
||||
return ecl_sum_tstep_iget( ministep_data , params_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ecl_sum_file_data::append_tstep(ecl_sum_tstep_type * tstep) {
|
||||
/*
|
||||
Here the tstep is just appended naively, the vector will be
|
||||
sorted by ministep_nr before the data instance is returned.
|
||||
*/
|
||||
|
||||
vector_append_owned_ref( data , tstep , ecl_sum_tstep_free__);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This function is meant to be called in write mode; and will create a
|
||||
new and empty tstep which is appended to the current data. The tstep
|
||||
will also be returned, so the calling scope can call
|
||||
ecl_sum_tstep_iset() to set elements in the tstep.
|
||||
*/
|
||||
|
||||
ecl_sum_tstep_type * ecl_sum_file_data::add_new_tstep( int report_step , double sim_seconds) {
|
||||
int ministep_nr = vector_get_size( data );
|
||||
ecl_sum_tstep_type * tstep = ecl_sum_tstep_alloc_new( report_step , ministep_nr , sim_seconds , ecl_smspec );
|
||||
ecl_sum_tstep_type * prev_tstep = NULL;
|
||||
|
||||
if (vector_get_size( data ) > 0)
|
||||
prev_tstep = (ecl_sum_tstep_type*) vector_get_last( data );
|
||||
|
||||
append_tstep( tstep );
|
||||
|
||||
|
||||
bool rebuild_index = true;
|
||||
/*
|
||||
In the simple case that we just add another timestep to the
|
||||
currently active report_step, we do a limited update of the
|
||||
index, otherwise we call ecl_sum_data_build_index() to get a
|
||||
full recalculation of the index.
|
||||
*/
|
||||
if (!prev_tstep)
|
||||
goto exit;
|
||||
|
||||
if (ecl_sum_tstep_get_report(prev_tstep) != ecl_sum_tstep_get_report( tstep ))
|
||||
goto exit;
|
||||
|
||||
if (ecl_sum_tstep_get_sim_days( prev_tstep ) >= ecl_sum_tstep_get_sim_days( tstep ))
|
||||
goto exit;
|
||||
|
||||
this->index.add(ecl_sum_tstep_get_sim_time(tstep), sim_seconds, report_step);
|
||||
rebuild_index = false;
|
||||
|
||||
exit:
|
||||
if (rebuild_index)
|
||||
this->build_index();
|
||||
|
||||
return tstep;
|
||||
}
|
||||
|
||||
|
||||
ecl_sum_tstep_type * ecl_sum_file_data::iget_ministep( int internal_index ) const {
|
||||
return (ecl_sum_tstep_type*)vector_iget( data , internal_index );
|
||||
}
|
||||
|
||||
double ecl_sum_file_data::iget_sim_days(int time_index ) const {
|
||||
const auto& node = this->index[time_index];
|
||||
return node.sim_seconds / 86400;
|
||||
}
|
||||
|
||||
double ecl_sum_file_data::iget_sim_seconds(int time_index ) const {
|
||||
const auto& node = this->index[time_index];
|
||||
return node.sim_seconds;
|
||||
}
|
||||
|
||||
|
||||
static int cmp_ministep( const void * arg1 , const void * arg2) {
|
||||
const ecl_sum_tstep_type * ministep1 = ecl_sum_tstep_safe_cast_const( arg1 );
|
||||
const ecl_sum_tstep_type * ministep2 = ecl_sum_tstep_safe_cast_const( arg2 );
|
||||
|
||||
time_t time1 = ecl_sum_tstep_get_sim_time( ministep1 );
|
||||
time_t time2 = ecl_sum_tstep_get_sim_time( ministep2 );
|
||||
|
||||
if (time1 < time2)
|
||||
return -1;
|
||||
else if (time1 == time2)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ecl_sum_file_data::build_index( ) {
|
||||
this->index.clear();
|
||||
|
||||
if (this->loader) {
|
||||
int offset = ecl_smspec_get_first_step(this->ecl_smspec) - 1;
|
||||
std::vector<int> report_steps = this->loader->report_steps(offset);
|
||||
std::vector<time_t> sim_time = this->loader->sim_time();
|
||||
std::vector<double> sim_seconds = this->loader->sim_seconds();
|
||||
|
||||
for (int i=0; i < this->loader->length(); i++) {
|
||||
this->index.add(sim_time[i],
|
||||
sim_seconds[i],
|
||||
report_steps[i]);
|
||||
}
|
||||
} else {
|
||||
vector_sort( data , cmp_ministep );
|
||||
for (int internal_index = 0; internal_index < vector_get_size( data ); internal_index++) {
|
||||
const ecl_sum_tstep_type * ministep = iget_ministep( internal_index );
|
||||
this->index.add(ecl_sum_tstep_get_sim_time(ministep),
|
||||
ecl_sum_tstep_get_sim_seconds(ministep),
|
||||
ecl_sum_tstep_get_report(ministep));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ecl_sum_file_data::get_time(int length, time_t * data) {
|
||||
for (int time_index=0; time_index < length; time_index++)
|
||||
data[time_index] = this->iget_sim_time(time_index);
|
||||
}
|
||||
|
||||
|
||||
int ecl_sum_file_data::get_time_report(int end_index, time_t *data) {
|
||||
int offset = 0;
|
||||
|
||||
for (int report_step = this->first_report(); report_step <= this->last_report(); report_step++) {
|
||||
const auto& range = this->report_range(report_step);
|
||||
int time_index = range.second;
|
||||
if (time_index >= end_index)
|
||||
break;
|
||||
|
||||
data[offset] = this->iget_sim_time(time_index);
|
||||
|
||||
offset += 1;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ecl_sum_file_data::get_data(int params_index, int length, double *data) {
|
||||
if (this->loader) {
|
||||
const auto tmp_data = loader->get_vector(params_index);
|
||||
memcpy(data, tmp_data.data(), length * sizeof data);
|
||||
} else {
|
||||
for (int time_index=0; time_index < length; time_index++)
|
||||
data[time_index] = this->iget(time_index, params_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int ecl_sum_file_data::get_data_report(int params_index, int end_index, double *data, double default_value) {
|
||||
int offset = 0;
|
||||
|
||||
for (int report_step = this->first_report(); report_step <= this->last_report(); report_step++) {
|
||||
int time_index = this->index.report_range(report_step).second;
|
||||
if (time_index >= end_index)
|
||||
break;
|
||||
|
||||
if (params_index >= 0)
|
||||
data[offset] = this->iget(time_index, params_index);
|
||||
else
|
||||
data[offset] = default_value;
|
||||
|
||||
offset += 1;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ecl_sum_file_data::has_report(int report_step ) const {
|
||||
return this->index.has_report(report_step);
|
||||
}
|
||||
|
||||
|
||||
// ******************** Start writing ***************************************************
|
||||
|
||||
|
||||
std::pair<int,int> ecl_sum_file_data::report_range(int report_step) const {
|
||||
return this->index.report_range(report_step);
|
||||
}
|
||||
|
||||
|
||||
void ecl_sum_file_data::fwrite_report( int report_step , fortio_type * fortio) const {
|
||||
{
|
||||
ecl_kw_type * seqhdr_kw = ecl_kw_alloc( SEQHDR_KW , SEQHDR_SIZE , ECL_INT );
|
||||
ecl_kw_iset_int( seqhdr_kw , 0 , 0 );
|
||||
ecl_kw_fwrite( seqhdr_kw , fortio );
|
||||
ecl_kw_free( seqhdr_kw );
|
||||
}
|
||||
|
||||
{
|
||||
auto range = this->report_range( report_step );
|
||||
for (int index = range.first; index <= range.second; index++) {
|
||||
const ecl_sum_tstep_type * tstep = iget_ministep( index );
|
||||
ecl_sum_tstep_fwrite( tstep , ecl_smspec_get_index_map( ecl_smspec ) , fortio );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ecl_sum_file_data::fwrite_unified( fortio_type * fortio ) const {
|
||||
if (this->length() == 0)
|
||||
return;
|
||||
|
||||
for (int report_step = first_report(); report_step <= last_report(); report_step++) {
|
||||
if (has_report( report_step ))
|
||||
fwrite_report( report_step , fortio );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ecl_sum_file_data::fwrite_multiple( const char * ecl_case , bool fmt_case ) const {
|
||||
if (this->length() == 0)
|
||||
return;
|
||||
|
||||
for (int report_step = this->first_report(); report_step <= this->last_report(); report_step++) {
|
||||
if (this->has_report( report_step )) {
|
||||
char * filename = ecl_util_alloc_filename( NULL , ecl_case , ECL_SUMMARY_FILE , fmt_case , report_step );
|
||||
fortio_type * fortio = fortio_open_writer( filename , fmt_case , ECL_ENDIAN_FLIP );
|
||||
|
||||
fwrite_report( report_step , fortio );
|
||||
|
||||
fortio_fclose( fortio );
|
||||
free( filename );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ecl_sum_file_data::can_write() const {
|
||||
if (this->loader)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
double ecl_sum_file_data::get_days_start() const {
|
||||
const auto& node = this->index[0];
|
||||
return node.sim_seconds * 86400;
|
||||
}
|
||||
|
||||
|
||||
// ***************************** End writing *************************************
|
||||
|
||||
// **************************** Start Reading ************************************
|
||||
|
||||
bool ecl_sum_file_data::check_file( ecl_file_type * ecl_file ) {
|
||||
return ecl_file_has_kw( ecl_file , PARAMS_KW ) &&
|
||||
(ecl_file_get_num_named_kw( ecl_file , PARAMS_KW ) == ecl_file_get_num_named_kw( ecl_file , MINISTEP_KW));
|
||||
}
|
||||
|
||||
/**
|
||||
Malformed/incomplete files:
|
||||
----------------------------
|
||||
Observe that ECLIPSE works in the following way:
|
||||
|
||||
1. At the start of a report step a summary data section
|
||||
containing only the 'SEQHDR' keyword is written - this is
|
||||
currently an 'invalid' summary section.
|
||||
|
||||
2. ECLIPSE simulates as best it can.
|
||||
|
||||
3. When the time step is complete data is written to the summary
|
||||
file.
|
||||
|
||||
Now - if ECLIPSE goes down in flames during step 2 a malformed
|
||||
summary file will be left around, to handle this situation
|
||||
reasonably gracefully we check that the ecl_file instance has at
|
||||
least one "PARAMS" keyword.
|
||||
|
||||
One ecl_file corresponds to one report_step (limited by SEQHDR); in
|
||||
the case of non unfied summary files these objects correspond to
|
||||
one BASE.Annnn or BASE.Snnnn file, in the case of unified files the
|
||||
calling routine will read the unified summary file partly.
|
||||
*/
|
||||
|
||||
void ecl_sum_file_data::add_ecl_file(int report_step, const ecl_file_view_type * summary_view, const ecl_smspec_type * smspec) {
|
||||
|
||||
int num_ministep = ecl_file_view_get_num_named_kw( summary_view , PARAMS_KW);
|
||||
if (num_ministep > 0) {
|
||||
int ikw;
|
||||
|
||||
for (ikw = 0; ikw < num_ministep; ikw++) {
|
||||
ecl_kw_type * ministep_kw = ecl_file_view_iget_named_kw( summary_view , MINISTEP_KW , ikw);
|
||||
ecl_kw_type * params_kw = ecl_file_view_iget_named_kw( summary_view , PARAMS_KW , ikw);
|
||||
|
||||
{
|
||||
int ministep_nr = ecl_kw_iget_int( ministep_kw , 0 );
|
||||
ecl_sum_tstep_type * tstep = ecl_sum_tstep_alloc_from_file( report_step ,
|
||||
ministep_nr ,
|
||||
params_kw ,
|
||||
ecl_file_view_get_src_file( summary_view ),
|
||||
smspec );
|
||||
|
||||
if (tstep)
|
||||
append_tstep( tstep );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ecl_sum_file_data::fread(const stringlist_type * filelist, bool lazy_load) {
|
||||
if (stringlist_get_size( filelist ) == 0)
|
||||
return false;
|
||||
|
||||
ecl_file_enum file_type = ecl_util_get_file_type( stringlist_iget( filelist , 0 ) , NULL , NULL);
|
||||
if ((stringlist_get_size( filelist ) > 1) && (file_type != ECL_SUMMARY_FILE))
|
||||
util_abort("%s: internal error - when calling with more than one file - you can not supply a unified file - come on?! \n",__func__);
|
||||
|
||||
if (file_type == ECL_SUMMARY_FILE) {
|
||||
|
||||
/* Not unified. */
|
||||
for (int filenr = 0; filenr < stringlist_get_size( filelist ); filenr++) {
|
||||
const char * data_file = stringlist_iget( filelist , filenr);
|
||||
ecl_file_enum file_type;
|
||||
int report_step;
|
||||
file_type = ecl_util_get_file_type( data_file , NULL , &report_step);
|
||||
if (file_type != ECL_SUMMARY_FILE)
|
||||
util_abort("%s: file:%s has wrong type \n",__func__ , data_file);
|
||||
{
|
||||
ecl_file_type * ecl_file = ecl_file_open( data_file , 0);
|
||||
if (ecl_file && check_file( ecl_file )) {
|
||||
add_ecl_file( report_step , ecl_file_get_global_view( ecl_file ) , ecl_smspec);
|
||||
ecl_file_close( ecl_file );
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (file_type == ECL_UNIFIED_SUMMARY_FILE) {
|
||||
if (lazy_load) {
|
||||
try {
|
||||
this->loader.reset( new unsmry_loader( this->ecl_smspec, stringlist_iget(filelist, 0)) );
|
||||
}
|
||||
catch(const std::bad_alloc& e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
||||
// Is this correct for a restarted chain of UNSMRY files? Looks like the
|
||||
// report step sequence will be restarted?
|
||||
ecl_file_type * ecl_file = ecl_file_open( stringlist_iget(filelist ,0 ) , 0);
|
||||
if (ecl_file && check_file( ecl_file )) {
|
||||
int first_report_step = ecl_smspec_get_first_step(this->ecl_smspec);
|
||||
int block_index = 0;
|
||||
while (true) {
|
||||
/*
|
||||
Observe that there is a number discrepancy between ECLIPSE
|
||||
and the ecl_file_select_smryblock() function. ECLIPSE
|
||||
starts counting report steps at 1; whereas the first
|
||||
SEQHDR block in the unified summary file is block zero (in
|
||||
ert counting).
|
||||
*/
|
||||
ecl_file_view_type * summary_view = ecl_file_get_summary_view(ecl_file , block_index);
|
||||
if (summary_view) {
|
||||
add_ecl_file(block_index + first_report_step , summary_view , ecl_smspec);
|
||||
block_index++;
|
||||
} else break;
|
||||
}
|
||||
ecl_file_close( ecl_file );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build_index();
|
||||
return (length() > 0);
|
||||
}
|
||||
|
||||
const ecl_smspec_type * ecl_sum_file_data::smspec() const {
|
||||
return this->ecl_smspec;
|
||||
}
|
||||
|
||||
|
||||
bool ecl_sum_file_data::report_step_equal( const ecl_sum_file_data& other, bool strict) const {
|
||||
if (strict && this->first_report() != other.first_report())
|
||||
return false;
|
||||
|
||||
if (strict && (this->last_report() != other.last_report()))
|
||||
return false;
|
||||
|
||||
int report_step = std::max(this->first_report(), other.first_report());
|
||||
int last_report = std::min(this->last_report(), other.last_report());
|
||||
while (true) {
|
||||
int time_index1 = this->report_range(report_step).second;
|
||||
int time_index2 = other.report_range(report_step).second;
|
||||
|
||||
if ((time_index1 != INVALID_MINISTEP_NR) && (time_index2 != INVALID_MINISTEP_NR)) {
|
||||
time_t time1 = this->iget_sim_time(time_index1);
|
||||
time_t time2 = other.iget_sim_time(time_index2);
|
||||
|
||||
if (time1 != time2)
|
||||
return false;
|
||||
|
||||
} else if (time_index1 != time_index2) {
|
||||
if (strict)
|
||||
return false;
|
||||
}
|
||||
|
||||
report_step++;
|
||||
if (report_step > last_report)
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ***************************** End reading *************************************
|
||||
|
||||
int ecl_sum_file_data::report_step_from_days(double sim_days) const {
|
||||
int report_step = this->first_report();
|
||||
double sim_seconds = sim_days * 86400;
|
||||
while (true) {
|
||||
const auto& range = this->index.report_range(report_step);
|
||||
if (range.second >= 0) {
|
||||
const auto& node = this->index[range.second];
|
||||
|
||||
// Warning - this is a double == comparison!
|
||||
if (sim_seconds == node.sim_seconds)
|
||||
return report_step;
|
||||
|
||||
report_step++;
|
||||
if (report_step > this->last_report())
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ecl_sum_file_data::report_step_from_time(time_t sim_time) const {
|
||||
int report_step = this->first_report();
|
||||
while (true) {
|
||||
const auto& range = this->index.report_range(report_step);
|
||||
if (range.second >= 0) {
|
||||
const auto& node = this->index[range.second];
|
||||
if (sim_time == node.sim_time)
|
||||
return report_step;
|
||||
|
||||
report_step++;
|
||||
if (report_step > this->last_report())
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ecl_sum_file_data::iget_report(int time_index) const {
|
||||
const auto& index_node = this->index[time_index];
|
||||
return index_node.report_step;
|
||||
}
|
||||
|
||||
|
||||
} //end namespace
|
||||
|
||||
|
36
ThirdParty/Ert/lib/ecl/ecl_sum_index.cpp
vendored
36
ThirdParty/Ert/lib/ecl/ecl_sum_index.cpp
vendored
@ -1,24 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_sum_index.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.
|
||||
Copyright (C) 2011 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_sum_index.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 <ert/ecl/ecl_sum_index.hpp>
|
||||
|
||||
/*
|
||||
/*
|
||||
This file contains all the internalized information from parsing a
|
||||
SMSPEC file. In most cases the ecl_sum object will contain a
|
||||
ecl_sum_index_type instance, and the end-user will not have direct
|
||||
@ -30,11 +30,11 @@
|
||||
struct ecl_sum_index_type {
|
||||
hash_type * well_var_index; /* Indexes for all well variables. */
|
||||
hash_type * well_completion_var_index; /* Indexes for completion indexes .*/
|
||||
hash_type * group_var_index; /* Indexes for group variables. */
|
||||
hash_type * group_var_index; /* Indexes for group variables. */
|
||||
hash_type * field_var_index; /* Indexes for field variables. */
|
||||
hash_type * region_var_index; /* The stored index is an offset. */
|
||||
hash_type * misc_var_index; /* Indexes for misceallous variables - typically date. */
|
||||
hash_type * block_var_index; /* Indexes for block variables. */
|
||||
|
||||
|
||||
hash_type * unit_hash; /* Units for the various measurements. */
|
||||
};
|
||||
|
6
ThirdParty/Ert/lib/ecl/ecl_sum_tstep.cpp
vendored
6
ThirdParty/Ert/lib/ecl/ecl_sum_tstep.cpp
vendored
@ -19,7 +19,7 @@
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_sum_tstep.hpp>
|
||||
@ -147,10 +147,10 @@ void ecl_sum_tstep_free__( void * __ministep) {
|
||||
will select the DAYS variety if both are present.
|
||||
*/
|
||||
|
||||
static void ecl_sum_tstep_set_time_info_from_seconds( ecl_sum_tstep_type * tstep , time_t sim_start , float sim_seconds) {
|
||||
static void ecl_sum_tstep_set_time_info_from_seconds( ecl_sum_tstep_type * tstep , time_t sim_start , double sim_seconds) {
|
||||
tstep->sim_seconds = sim_seconds;
|
||||
tstep->sim_time = sim_start;
|
||||
util_inplace_forward_seconds_utc( &tstep->sim_time , tstep->sim_seconds );
|
||||
util_inplace_forward_seconds_utc( &tstep->sim_time , tstep->sim_seconds);
|
||||
}
|
||||
|
||||
|
||||
|
5
ThirdParty/Ert/lib/ecl/ecl_sum_vector.cpp
vendored
5
ThirdParty/Ert/lib/ecl/ecl_sum_vector.cpp
vendored
@ -20,7 +20,7 @@
|
||||
#include <ert/ecl/ecl_sum.hpp>
|
||||
#include <ert/ecl/ecl_smspec.hpp>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
@ -69,9 +69,6 @@ ecl_sum_vector_type * ecl_sum_vector_alloc(const ecl_sum_type * ecl_sum, bool ad
|
||||
const ecl_smspec_type * smspec = ecl_sum_get_smspec(ecl_sum);
|
||||
for (int i=0; i < ecl_smspec_num_nodes(smspec); i++) {
|
||||
const smspec_node_type * node = ecl_smspec_iget_node( smspec , i );
|
||||
if (!smspec_node_is_valid(node))
|
||||
continue;
|
||||
|
||||
const char * key = smspec_node_get_gen_key1(node);
|
||||
/*
|
||||
The TIME keyword is special case handled to not be included; that is
|
||||
|
14
ThirdParty/Ert/lib/ecl/ecl_type.cpp
vendored
14
ThirdParty/Ert/lib/ecl/ecl_type.cpp
vendored
@ -20,7 +20,7 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
/*****************************************************************/
|
||||
@ -64,7 +64,7 @@ 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_iotype(ecl_type) != element_size)
|
||||
if((size_t)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,
|
||||
@ -202,7 +202,7 @@ bool ecl_type_is_double(const ecl_data_type ecl_type) {
|
||||
bool ecl_type_is_mess(const ecl_data_type ecl_type) {
|
||||
return (ecl_type.type == ECL_MESS_TYPE);
|
||||
}
|
||||
|
||||
|
||||
bool ecl_type_is_bool(const ecl_data_type ecl_type) {
|
||||
return (ecl_type.type == ECL_BOOL_TYPE);
|
||||
}
|
||||
@ -212,7 +212,7 @@ bool ecl_type_is_string(const ecl_data_type ecl_type) {
|
||||
}
|
||||
|
||||
// Temporary fixup for OPM.
|
||||
char * ecl_type_get_name(const ecl_data_type ecl_type) {
|
||||
return ecl_type_alloc_name( ecl_type );
|
||||
}
|
||||
|
||||
char * ecl_type_get_name(const ecl_data_type ecl_type) {
|
||||
return ecl_type_alloc_name( ecl_type );
|
||||
}
|
||||
|
||||
|
174
ThirdParty/Ert/lib/ecl/ecl_unsmry_loader.cpp
vendored
Normal file
174
ThirdParty/Ert/lib/ecl/ecl_unsmry_loader.cpp
vendored
Normal file
@ -0,0 +1,174 @@
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
|
||||
#include "detail/ecl/ecl_unsmry_loader.hpp"
|
||||
|
||||
|
||||
namespace ecl {
|
||||
|
||||
unsmry_loader::unsmry_loader(const ecl_smspec_type * smspec, const std::string& filename) :
|
||||
size(ecl_smspec_get_params_size(smspec)),
|
||||
time_index(ecl_smspec_get_time_index(smspec)),
|
||||
time_seconds(ecl_smspec_get_time_seconds(smspec)),
|
||||
sim_start(ecl_smspec_get_start_time(smspec))
|
||||
{
|
||||
int options = 0;
|
||||
ecl_file_type * file = ecl_file_open(filename.c_str(), options);
|
||||
if (!file)
|
||||
throw std::bad_alloc();
|
||||
|
||||
if (!ecl_file_has_kw(file, PARAMS_KW)) {
|
||||
ecl_file_close(file);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
if (ecl_file_get_num_named_kw(file, PARAMS_KW) != ecl_file_get_num_named_kw(file, MINISTEP_KW)) {
|
||||
ecl_file_close(file);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
this->date_index = {{ ecl_smspec_get_date_day_index(smspec),
|
||||
ecl_smspec_get_date_month_index(smspec),
|
||||
ecl_smspec_get_date_year_index(smspec) }};
|
||||
this->file = ecl_file_open(filename.c_str(), 0);
|
||||
this->file_view = ecl_file_get_global_view( this->file );
|
||||
this->m_length = ecl_file_view_get_num_named_kw(this->file_view, PARAMS_KW);
|
||||
}
|
||||
|
||||
|
||||
unsmry_loader::~unsmry_loader() {
|
||||
ecl_file_close(file);
|
||||
}
|
||||
|
||||
|
||||
int unsmry_loader::length() const {
|
||||
return this->m_length;
|
||||
}
|
||||
|
||||
|
||||
std::vector<double> unsmry_loader::get_vector(int pos) const {
|
||||
if (pos >= size)
|
||||
throw std::invalid_argument("unsmry_loader::get_vector: argument 'pos' mst be less than size of PARAMS.");
|
||||
|
||||
std::vector<double> data(this->length());
|
||||
int_vector_type * index_map = int_vector_alloc( 1 , pos);
|
||||
char buffer[4];
|
||||
|
||||
for (int index = 0; index < this->length(); index++) {
|
||||
ecl_file_view_index_fload_kw(file_view, PARAMS_KW, index, index_map, buffer);
|
||||
float * data_value = (float*) buffer;
|
||||
data[index] = *data_value;
|
||||
}
|
||||
int_vector_free( index_map );
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
// This is horribly inefficient
|
||||
double unsmry_loader::iget(int time_index, int params_index) const {
|
||||
int_vector_type * index_map = int_vector_alloc( 1 , params_index);
|
||||
float value;
|
||||
ecl_file_view_index_fload_kw(this->file_view, PARAMS_KW, time_index, index_map, (char *) &value);
|
||||
int_vector_free(index_map);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
time_t unsmry_loader::iget_sim_time(int time_index) const {
|
||||
if (this->time_index >= 0) {
|
||||
double sim_seconds = this->iget_sim_seconds(time_index);
|
||||
time_t sim_time = this->sim_start;
|
||||
util_inplace_forward_seconds_utc( &sim_time , sim_seconds ) ;
|
||||
return sim_time;
|
||||
} else {
|
||||
int_vector_type * index_map = int_vector_alloc(3,0);
|
||||
int_vector_iset(index_map, 0, this->date_index[0]);
|
||||
int_vector_iset(index_map, 1, this->date_index[1]);
|
||||
int_vector_iset(index_map, 2, this->date_index[2]);
|
||||
|
||||
float values[3];
|
||||
ecl_file_view_index_fload_kw(this->file_view, PARAMS_KW, time_index, index_map, (char *) &values);
|
||||
int_vector_free(index_map);
|
||||
|
||||
return ecl_util_make_date(util_roundf( values[0] ),
|
||||
util_roundf( values[1] ),
|
||||
util_roundf( values[2] ));
|
||||
}
|
||||
}
|
||||
|
||||
double unsmry_loader::iget_sim_seconds(int time_index) const {
|
||||
if (this->time_index >= 0) {
|
||||
double raw_time = this->iget(time_index, this->time_index);
|
||||
return raw_time * this->time_seconds;
|
||||
} else {
|
||||
time_t sim_time = this->iget_sim_time(time_index);
|
||||
return util_difftime_seconds(this->sim_start, sim_time);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<int> unsmry_loader::report_steps(int offset) const {
|
||||
std::vector<int> report_steps;
|
||||
int current_step = offset;
|
||||
for (int i=0; i < ecl_file_view_get_size(this->file_view); i++) {
|
||||
const ecl_file_kw_type * file_kw = ecl_file_view_iget_file_kw(this->file_view, i);
|
||||
if (util_string_equal(SEQHDR_KW, ecl_file_kw_get_header(file_kw)))
|
||||
current_step++;
|
||||
|
||||
if (util_string_equal(PARAMS_KW, ecl_file_kw_get_header(file_kw)))
|
||||
report_steps.push_back(current_step);
|
||||
}
|
||||
return report_steps;
|
||||
}
|
||||
|
||||
std::vector<time_t> unsmry_loader::sim_time() const {
|
||||
if (this->time_index >= 0) {
|
||||
const std::vector<double> sim_seconds = this->sim_seconds();
|
||||
std::vector<time_t> st(this->length(), this->sim_start);
|
||||
|
||||
for (size_t i=0; i < st.size(); i++)
|
||||
util_inplace_forward_seconds_utc(&st[i], sim_seconds[i]);
|
||||
|
||||
return st;
|
||||
|
||||
} else {
|
||||
const auto day = this->get_vector(this->date_index[0]);
|
||||
const auto month = this->get_vector(this->date_index[1]);
|
||||
const auto year = this->get_vector(this->date_index[2]);
|
||||
std::vector<time_t> st(this->length());
|
||||
|
||||
for (size_t i=0; i < st.size(); i++)
|
||||
st[i] = ecl_util_make_date(util_round(day[i]),
|
||||
util_round(month[i]),
|
||||
util_round(year[i]));
|
||||
|
||||
return st;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::vector<double> unsmry_loader::sim_seconds() const {
|
||||
if (this->time_index >= 0) {
|
||||
std::vector<double> seconds = this->get_vector(this->time_index);
|
||||
for (size_t i=0; i < seconds.size(); i++)
|
||||
seconds[i] *= this->time_seconds;
|
||||
|
||||
return seconds;
|
||||
} else {
|
||||
std::vector<time_t> st = this->sim_time();
|
||||
std::vector<double> seconds(st.size());
|
||||
|
||||
for (size_t i=0; i < st.size(); i++)
|
||||
seconds[i] = util_difftime_seconds(this->sim_start, st[i]);
|
||||
|
||||
return seconds;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
20
ThirdParty/Ert/lib/ecl/ecl_util.cpp
vendored
20
ThirdParty/Ert/lib/ecl/ecl_util.cpp
vendored
@ -22,9 +22,9 @@
|
||||
#include <ctype.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/ert_api_config.h>
|
||||
#include <ert/util/ert_api_config.hpp>
|
||||
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
#include <ert/util/parser.hpp>
|
||||
@ -342,7 +342,7 @@ static bool valid_base(const char * input_base, bool * upper_case) {
|
||||
if (base == NULL)
|
||||
base = input_base;
|
||||
|
||||
for (int i=0; i < strlen(base); i++) {
|
||||
for (size_t i=0; i < strlen(base); i++) {
|
||||
unsigned char c = base[i];
|
||||
|
||||
if (isupper(c))
|
||||
@ -455,7 +455,7 @@ static char * ecl_util_alloc_filename_static(const char * path, const char * bas
|
||||
}
|
||||
|
||||
if (!upper_case) {
|
||||
for (int i=0; i < strlen(ext); i++)
|
||||
for (size_t i=0; i < strlen(ext); i++)
|
||||
ext[i] = tolower(ext[i]);
|
||||
}
|
||||
|
||||
@ -499,7 +499,7 @@ char * ecl_util_alloc_exfilename_anyfmt(const char * path, const char * base , e
|
||||
}
|
||||
|
||||
if (! util_file_exists(filename)) {
|
||||
util_safe_free( filename );
|
||||
free( filename );
|
||||
filename = NULL;
|
||||
}
|
||||
|
||||
@ -660,7 +660,7 @@ int ecl_util_select_filelist( const char * path , const char * base , ecl_file_e
|
||||
char * file_pattern;
|
||||
|
||||
if (!upper_case) {
|
||||
for (int i=0; i < strlen(ext_pattern); i++)
|
||||
for (size_t i=0; i < strlen(ext_pattern); i++)
|
||||
ext_pattern[i] = tolower(ext_pattern[i]);
|
||||
}
|
||||
|
||||
@ -809,7 +809,7 @@ void ecl_util_alloc_summary_data_files(const char * path , const char * base , b
|
||||
stringlist_clear( filelist ); /* Clear out all the BASE.Snnnn selections. */
|
||||
stringlist_append_copy( filelist , unif_data_file );
|
||||
}
|
||||
util_safe_free( unif_data_file );
|
||||
free( unif_data_file );
|
||||
}
|
||||
|
||||
|
||||
@ -936,10 +936,10 @@ bool ecl_util_alloc_summary_files(const char * path , const char * _base , const
|
||||
|
||||
if (fmt_file) {
|
||||
header_file = fsmspec_file;
|
||||
util_safe_free( smspec_file );
|
||||
free( smspec_file );
|
||||
} else {
|
||||
header_file = smspec_file;
|
||||
util_safe_free( fsmspec_file );
|
||||
free( fsmspec_file );
|
||||
}
|
||||
|
||||
if (header_file == NULL)
|
||||
@ -1106,7 +1106,7 @@ safely used as filenames, i.e for instance the substitution:
|
||||
The escape process is done 'in-place' memory-wise.
|
||||
*/
|
||||
void ecl_util_escape_kw(char * kw) {
|
||||
int index;
|
||||
size_t index;
|
||||
for (index = 0; index < strlen(kw); index++) {
|
||||
switch (kw[index]) {
|
||||
case('/'):
|
||||
|
12
ThirdParty/Ert/lib/ecl/fault_block.cpp
vendored
12
ThirdParty/Ert/lib/ecl/fault_block.cpp
vendored
@ -16,12 +16,12 @@
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#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/geometry/geo_util.h>
|
||||
#include <ert/geometry/geo_polygon.h>
|
||||
#include <ert/geometry/geo_polygon_collection.h>
|
||||
#include <ert/geometry/geo_util.hpp>
|
||||
#include <ert/geometry/geo_polygon.hpp>
|
||||
#include <ert/geometry/geo_polygon_collection.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
@ -257,7 +257,7 @@ static bool fault_block_connected_neighbour( const fault_block_type * block , in
|
||||
*/
|
||||
if (!ecl_grid_cell_active3( block->grid , i2,j2,block->k))
|
||||
return false;
|
||||
|
||||
|
||||
{
|
||||
int cell_id = layer_iget_cell_value( layer , i1 , j1 );
|
||||
int neighbour_id = layer_iget_cell_value(layer , i2 , j2);
|
||||
|
18
ThirdParty/Ert/lib/ecl/fault_block_layer.cpp
vendored
18
ThirdParty/Ert/lib/ecl/fault_block_layer.cpp
vendored
@ -16,16 +16,16 @@
|
||||
for more details.
|
||||
*/
|
||||
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/int_vector.h>
|
||||
#include <ert/util/double_vector.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/double_vector.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/fault_block_layer.h>
|
||||
#include <ert/ecl/fault_block.h>
|
||||
#include <ert/ecl/layer.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/fault_block_layer.hpp>
|
||||
#include <ert/ecl/fault_block.hpp>
|
||||
#include <ert/ecl/layer.hpp>
|
||||
|
||||
#define FAULT_BLOCK_LAYER_ID 2297476
|
||||
|
||||
|
250
ThirdParty/Ert/lib/ecl/fortio.c
vendored
250
ThirdParty/Ert/lib/ecl/fortio.c
vendored
@ -23,9 +23,10 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/ecl/fortio.h>
|
||||
|
||||
#include <ecl/fortio.h>
|
||||
|
||||
#define FORTIO_ID 345116
|
||||
|
||||
@ -90,6 +91,7 @@ struct fortio_struct {
|
||||
*/
|
||||
bool writable;
|
||||
offset_type read_size;
|
||||
char opts[3];
|
||||
};
|
||||
|
||||
|
||||
@ -105,6 +107,7 @@ static fortio_type * fortio_alloc__(const char *filename , bool fmt_file , bool
|
||||
fortio->stream_owner = stream_owner;
|
||||
fortio->writable = writable;
|
||||
fortio->read_size = 0;
|
||||
strcpy( fortio->opts, endian_flip_header ? "c" : "ce" );
|
||||
|
||||
return fortio;
|
||||
}
|
||||
@ -116,13 +119,9 @@ static fortio_type * fortio_alloc__(const char *filename , bool fmt_file , bool
|
||||
*/
|
||||
|
||||
static bool __read_int(FILE * stream , int * value, bool endian_flip) {
|
||||
/* This fread() can legitemately fail - can not use util_fread() here. */
|
||||
if (fread(value , sizeof * value , 1 , stream) == 1) {
|
||||
if (endian_flip)
|
||||
util_endian_flip_vector(value , sizeof * value , 1);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
int ok = eclfio_sizeof( stream, endian_flip ? "c" : "ce", value );
|
||||
fseek( stream, sizeof( int32_t ), SEEK_CUR );
|
||||
return !ok;
|
||||
}
|
||||
|
||||
|
||||
@ -396,7 +395,7 @@ bool fortio_assert_stream_open( fortio_type * fortio ) {
|
||||
|
||||
|
||||
static void fortio_free__(fortio_type * fortio) {
|
||||
util_safe_free(fortio->filename);
|
||||
free(fortio->filename);
|
||||
free(fortio);
|
||||
}
|
||||
|
||||
@ -416,30 +415,14 @@ void fortio_fclose(fortio_type *fortio) {
|
||||
|
||||
|
||||
bool fortio_is_fortio_file(fortio_type * fortio) {
|
||||
offset_type init_pos = fortio_ftell(fortio);
|
||||
int elm_read;
|
||||
bool is_fortio_file = false;
|
||||
int record_size;
|
||||
elm_read = fread(&record_size , sizeof(record_size) , 1 , fortio->stream);
|
||||
if (elm_read == 1) {
|
||||
int trailer;
|
||||
fpos_t init_pos;
|
||||
fgetpos( fortio->stream, &init_pos );
|
||||
|
||||
if (fortio->endian_flip_header)
|
||||
util_endian_flip_vector(&record_size , sizeof record_size , 1);
|
||||
int err = eclfio_get( fortio->stream, fortio->opts, NULL, NULL );
|
||||
|
||||
if (fortio_fseek(fortio , (offset_type) record_size , SEEK_CUR) == 0) {
|
||||
if (fread(&trailer , sizeof(record_size) , 1 , fortio->stream) == 1) {
|
||||
if (fortio->endian_flip_header)
|
||||
util_endian_flip_vector(&trailer , sizeof trailer , 1);
|
||||
fsetpos( fortio->stream, &init_pos );
|
||||
|
||||
if (trailer == record_size)
|
||||
is_fortio_file = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fortio_fseek(fortio , init_pos , SEEK_SET);
|
||||
return is_fortio_file;
|
||||
return err == ECL_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -451,26 +434,17 @@ bool fortio_is_fortio_file(fortio_type * fortio) {
|
||||
*/
|
||||
|
||||
int fortio_init_read(fortio_type *fortio) {
|
||||
int elm_read;
|
||||
int record_size;
|
||||
|
||||
elm_read = fread(&record_size , sizeof(record_size) , 1 , fortio->stream);
|
||||
if (elm_read == 1) {
|
||||
if (fortio->endian_flip_header)
|
||||
util_endian_flip_vector(&record_size , sizeof record_size , 1);
|
||||
|
||||
return record_size;
|
||||
} else
|
||||
return -1;
|
||||
int32_t record_size;
|
||||
int err = eclfio_sizeof( fortio->stream, fortio->opts, &record_size );
|
||||
// this function exposes successful reads as advanced file pointers
|
||||
if( err == 0 ) fseek( fortio->stream, 4, SEEK_CUR );
|
||||
return err ? -1 : record_size;
|
||||
}
|
||||
|
||||
|
||||
bool fortio_data_fskip(fortio_type* fortio, const int element_size, const int element_count, const int block_count) {
|
||||
int headers = block_count * 4;
|
||||
int trailers = block_count * 4;
|
||||
int bytes_to_skip = headers + trailers + (element_size * element_count);
|
||||
return !eclfio_skip( fortio->stream, fortio->opts, block_count );
|
||||
|
||||
return fortio_fseek(fortio, bytes_to_skip, SEEK_CUR);
|
||||
}
|
||||
|
||||
|
||||
@ -478,14 +452,16 @@ void fortio_data_fseek(fortio_type* fortio, offset_type data_offset, size_t data
|
||||
if(data_element >= element_count) {
|
||||
util_abort("%s: Element index is out of range: 0 <= %d < %d \n", __func__, data_element, element_count);
|
||||
}
|
||||
{
|
||||
int block_index = data_element / block_size;
|
||||
int headers = (block_index + 1) * 4;
|
||||
int trailers = block_index * 4;
|
||||
offset_type bytes_to_skip = data_offset + headers + trailers + (data_element * element_size);
|
||||
|
||||
fortio_fseek(fortio, bytes_to_skip, SEEK_SET);
|
||||
}
|
||||
fseek( fortio->stream, data_offset, SEEK_SET );
|
||||
int block_index = data_element / block_size;
|
||||
int err = eclfio_skip( fortio->stream, fortio->opts, block_index );
|
||||
if( err ) util_abort( "%s: error skipping %d sub reords\n",
|
||||
__func__,
|
||||
block_index );
|
||||
int item_index = (data_element % block_size) * element_size;
|
||||
int header_size = sizeof( int32_t );
|
||||
fseek( fortio->stream, header_size + item_index, SEEK_CUR );
|
||||
}
|
||||
|
||||
int fortio_fclean(fortio_type * fortio) {
|
||||
@ -515,28 +491,6 @@ bool fortio_complete_read(fortio_type *fortio , int record_size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function reads one record from the fortio stream, and fills
|
||||
the buffer with the content. The return value is the number of
|
||||
bytes read; the function will return -1 on failure.
|
||||
*/
|
||||
|
||||
static int fortio_fread_record(fortio_type *fortio , char *buffer) {
|
||||
int record_size = fortio_init_read(fortio);
|
||||
if (record_size >= 0) {
|
||||
size_t items_read = fread(buffer , 1 , record_size , fortio->stream);
|
||||
if (items_read == record_size) {
|
||||
bool complete_ok = fortio_complete_read(fortio , record_size);
|
||||
if (!complete_ok)
|
||||
record_size = -1;
|
||||
} else
|
||||
record_size = -1; /* Failure */
|
||||
}
|
||||
return record_size;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function fills the buffer with 'buffer_size' bytes from the
|
||||
fortio stream. The function works by repeated calls to
|
||||
@ -547,75 +501,107 @@ static int fortio_fread_record(fortio_type *fortio , char *buffer) {
|
||||
*/
|
||||
|
||||
bool fortio_fread_buffer(fortio_type * fortio, char * buffer , int buffer_size) {
|
||||
int total_bytes_read = 0;
|
||||
int total_bytes_read = 0;
|
||||
|
||||
while (true) {
|
||||
char * buffer_ptr = &buffer[total_bytes_read];
|
||||
int bytes_read = fortio_fread_record(fortio , buffer_ptr);
|
||||
while( true ) {
|
||||
int32_t record_size = buffer_size - total_bytes_read;
|
||||
int err = eclfio_get( fortio->stream,
|
||||
fortio->opts,
|
||||
&record_size,
|
||||
buffer );
|
||||
|
||||
if (bytes_read < 0)
|
||||
break;
|
||||
else {
|
||||
total_bytes_read += bytes_read;
|
||||
if (total_bytes_read >= buffer_size)
|
||||
break;
|
||||
if( err == ECL_EINVAL ) {
|
||||
err = eclfio_sizeof( fortio->stream, fortio->opts, &record_size );
|
||||
if( err ) util_abort("%s: unable to determine size of record, "
|
||||
"%d bytes read\n",
|
||||
__func__,
|
||||
total_bytes_read );
|
||||
|
||||
if( total_bytes_read + record_size > buffer_size )
|
||||
util_abort("%s: internal inconsistency: "
|
||||
"buffer_size:%d, would read %d bytes\n",
|
||||
__func__,
|
||||
buffer_size,
|
||||
total_bytes_read + record_size );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if( err ) return false;
|
||||
|
||||
buffer += record_size;
|
||||
total_bytes_read += record_size;
|
||||
|
||||
if( total_bytes_read == buffer_size )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (total_bytes_read == buffer_size)
|
||||
return true;
|
||||
|
||||
if (total_bytes_read < buffer_size)
|
||||
return false;
|
||||
|
||||
util_abort("%s: internal inconsistency: buffer_size:%d read %d bytes \n",__func__ , buffer_size , total_bytes_read);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int fortio_fskip_record(fortio_type *fortio) {
|
||||
int record_size = fortio_init_read(fortio);
|
||||
fortio_fseek(fortio , (offset_type) record_size , SEEK_CUR);
|
||||
fortio_complete_read(fortio , record_size);
|
||||
return record_size;
|
||||
int32_t size = 0;
|
||||
const int err = eclfio_get( fortio->stream, fortio->opts, &size, NULL );
|
||||
if( err ) return -1;
|
||||
return size;
|
||||
}
|
||||
|
||||
void fortio_fskip_buffer(fortio_type * fortio, int buffer_size) {
|
||||
int bytes_skipped = 0;
|
||||
while (bytes_skipped < buffer_size)
|
||||
bytes_skipped += fortio_fskip_record(fortio);
|
||||
while (bytes_skipped < buffer_size) {
|
||||
int size = fortio_fskip_record(fortio);
|
||||
|
||||
if( size < 0 ) util_abort( "%s: broken record in %s. "
|
||||
"%d bytes skipped so far\n",
|
||||
__func__,
|
||||
fortio->filename,
|
||||
bytes_skipped );
|
||||
|
||||
bytes_skipped += fortio_fskip_record(fortio);
|
||||
}
|
||||
|
||||
if (bytes_skipped > buffer_size)
|
||||
util_abort("%s: hmmmm - something is broken. The individual records in %s did not sum up to the expected buffer size \n",__func__ , fortio->filename);
|
||||
}
|
||||
|
||||
|
||||
void fortio_copy_record(fortio_type * src_stream , fortio_type * target_stream , int buffer_size , void * buffer , bool *at_eof) {
|
||||
int bytes_read;
|
||||
int record_size = fortio_init_read(src_stream);
|
||||
fortio_init_write(target_stream , record_size);
|
||||
void fortio_copy_record(fortio_type * src_stream , fortio_type * target_stream , int buffer_size , void * ext_buffer, bool *at_eof) {
|
||||
int bytes_read = 0;
|
||||
|
||||
bytes_read = 0;
|
||||
while (bytes_read < record_size) {
|
||||
int bytes;
|
||||
if (record_size > buffer_size)
|
||||
bytes = buffer_size;
|
||||
else
|
||||
bytes = record_size - bytes_read;
|
||||
|
||||
util_fread(buffer , 1 , bytes , src_stream->stream , __func__);
|
||||
util_fwrite(buffer , 1 , bytes , target_stream->stream , __func__);
|
||||
int32_t size = 0;
|
||||
int err = eclfio_sizeof( src_stream->stream, src_stream->opts, &size );
|
||||
if( err ) {
|
||||
util_abort( "%s: could not peek record size after %d bytes\n",
|
||||
__func__,
|
||||
bytes_read );
|
||||
}
|
||||
|
||||
bytes_read += bytes;
|
||||
}
|
||||
void* buffer = ext_buffer;
|
||||
if( buffer_size < size ) {
|
||||
buffer = malloc( size );
|
||||
ext_buffer = NULL;
|
||||
}
|
||||
|
||||
fortio_complete_read(src_stream , record_size);
|
||||
fortio_complete_write(target_stream , record_size);
|
||||
err = eclfio_get( src_stream->stream, src_stream->opts, &size, buffer );
|
||||
if( err ) {
|
||||
util_abort( "%s: could not read record after %d bytes\n",
|
||||
__func__,
|
||||
bytes_read );
|
||||
}
|
||||
|
||||
if (feof(src_stream->stream))
|
||||
*at_eof = true;
|
||||
else
|
||||
*at_eof = false;
|
||||
err = eclfio_put( target_stream->stream,
|
||||
target_stream->opts,
|
||||
size,
|
||||
buffer );
|
||||
if( err ) {
|
||||
util_abort( "%s: could not write record after %d bytes\n",
|
||||
__func__,
|
||||
bytes_read );
|
||||
}
|
||||
|
||||
if( !ext_buffer ) free( buffer );
|
||||
|
||||
*at_eof = feof( src_stream->stream );
|
||||
}
|
||||
|
||||
|
||||
@ -640,19 +626,23 @@ void fortio_complete_write(fortio_type *fortio , int record_size) {
|
||||
|
||||
|
||||
void fortio_fwrite_record(fortio_type *fortio, const char *buffer , int record_size) {
|
||||
fortio_init_write(fortio , record_size);
|
||||
util_fwrite( buffer , 1 , record_size , fortio->stream , __func__);
|
||||
fortio_complete_write(fortio , record_size);
|
||||
int err = eclfio_put( fortio->stream,
|
||||
fortio->opts,
|
||||
record_size,
|
||||
buffer );
|
||||
|
||||
if( err ) util_abort( "%s: unable to write %d byte record\n",
|
||||
__func__,
|
||||
record_size );
|
||||
}
|
||||
|
||||
|
||||
void * fortio_fread_alloc_record(fortio_type * fortio) {
|
||||
void * buffer;
|
||||
int record_size = fortio_init_read(fortio);
|
||||
buffer = util_malloc( record_size );
|
||||
util_fread(buffer , 1 , record_size , fortio->stream , __func__);
|
||||
fortio_complete_read(fortio , record_size);
|
||||
return buffer;
|
||||
int32_t record_size = 0;
|
||||
eclfio_sizeof( fortio->stream, fortio->opts, &record_size );
|
||||
void* buffer = calloc( 1, record_size );
|
||||
eclfio_get( fortio->stream, fortio->opts, &record_size, buffer );
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
|
32
ThirdParty/Ert/lib/ecl/grid_dims.cpp
vendored
32
ThirdParty/Ert/lib/ecl/grid_dims.cpp
vendored
@ -1,24 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'grid_dims.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'grid_dims.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 <ert/util/util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/grid_dims.hpp>
|
||||
|
||||
|
74
ThirdParty/Ert/lib/ecl/nnc_info.cpp
vendored
74
ThirdParty/Ert/lib/ecl/nnc_info.cpp
vendored
@ -1,25 +1,25 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'nnc_info.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'nnc_info.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 <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
|
||||
#include <ert/ecl/nnc_info.hpp>
|
||||
@ -33,8 +33,8 @@ struct nnc_info_struct {
|
||||
UTIL_TYPE_ID_DECLARATION;
|
||||
vector_type * lgr_list; /*List of int vector * for nnc connections for LGRs*/
|
||||
int_vector_type * lgr_index_map; /* A vector that maps LGR-nr to index into the LGR_list.*/
|
||||
int lgr_nr; /* The lgr_nr of the cell holding this nnc_info structure. */
|
||||
};
|
||||
int lgr_nr; /* The lgr_nr of the cell holding this nnc_info structure. */
|
||||
};
|
||||
|
||||
static void nnc_info_add_vector( nnc_info_type * nnc_info , nnc_vector_type * nnc_vector);
|
||||
UTIL_IS_INSTANCE_FUNCTION( nnc_info , NNC_INFO_TYPE_ID )
|
||||
@ -43,10 +43,10 @@ UTIL_IS_INSTANCE_FUNCTION( nnc_info , NNC_INFO_TYPE_ID )
|
||||
nnc_info_type * nnc_info_alloc(int lgr_nr) {
|
||||
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);
|
||||
nnc_info->lgr_list = vector_alloc_new();
|
||||
nnc_info->lgr_index_map = int_vector_alloc(0, -1);
|
||||
nnc_info->lgr_nr = lgr_nr;
|
||||
return nnc_info;
|
||||
return nnc_info;
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ nnc_info_type * nnc_info_alloc(int lgr_nr) {
|
||||
nnc_info_type * nnc_info_alloc_copy( const nnc_info_type * src_info ) {
|
||||
nnc_info_type * copy_info = nnc_info_alloc( src_info->lgr_nr );
|
||||
int ivec;
|
||||
|
||||
|
||||
for (ivec = 0; ivec < vector_get_size( 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 );
|
||||
@ -67,30 +67,30 @@ nnc_info_type * nnc_info_alloc_copy( const nnc_info_type * src_info ) {
|
||||
bool nnc_info_equal( const nnc_info_type * nnc_info1 , const nnc_info_type * nnc_info2 ) {
|
||||
if (nnc_info1 == nnc_info2)
|
||||
return true;
|
||||
|
||||
|
||||
if ((nnc_info1 == NULL) || (nnc_info2 == NULL))
|
||||
return false;
|
||||
|
||||
{
|
||||
if (nnc_info1->lgr_nr != nnc_info2->lgr_nr)
|
||||
return false;
|
||||
|
||||
|
||||
if ((int_vector_size( nnc_info1->lgr_index_map ) > 0) && (int_vector_size( nnc_info2->lgr_index_map ) > 0)) {
|
||||
int max_lgr_nr = util_int_max( int_vector_size( nnc_info1->lgr_index_map ),
|
||||
int max_lgr_nr = util_int_max( int_vector_size( nnc_info1->lgr_index_map ),
|
||||
int_vector_size( nnc_info2->lgr_index_map ) );
|
||||
int lgr_nr = 0;
|
||||
|
||||
|
||||
while (true) {
|
||||
nnc_vector_type * vector1 = nnc_info_get_vector( nnc_info1 , lgr_nr );
|
||||
nnc_vector_type * vector2 = nnc_info_get_vector( nnc_info2 , lgr_nr );
|
||||
|
||||
|
||||
if (!nnc_vector_equal(vector1 , vector2))
|
||||
return false;
|
||||
|
||||
|
||||
lgr_nr++;
|
||||
if (lgr_nr > max_lgr_nr)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (int_vector_size( nnc_info1->lgr_index_map ) == int_vector_size( nnc_info2->lgr_index_map ))
|
||||
return true;
|
||||
@ -102,9 +102,9 @@ bool nnc_info_equal( const nnc_info_type * nnc_info1 , const nnc_info_type * nnc
|
||||
|
||||
|
||||
void nnc_info_free( nnc_info_type * nnc_info ) {
|
||||
vector_free(nnc_info->lgr_list);
|
||||
int_vector_free(nnc_info->lgr_index_map);
|
||||
free (nnc_info);
|
||||
vector_free(nnc_info->lgr_list);
|
||||
int_vector_free(nnc_info->lgr_index_map);
|
||||
free (nnc_info);
|
||||
}
|
||||
|
||||
nnc_vector_type * nnc_info_get_vector( const nnc_info_type * nnc_info , int lgr_nr) {
|
||||
@ -148,9 +148,9 @@ void nnc_info_add_nnc(nnc_info_type * nnc_info, int lgr_nr, int global_cell_numb
|
||||
nnc_vector_add_nnc( nnc_vector , global_cell_number , nnc_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const int_vector_type * nnc_info_get_grid_index_list(const nnc_info_type * nnc_info, int lgr_nr) {
|
||||
|
||||
const int_vector_type * nnc_info_get_grid_index_list(const nnc_info_type * nnc_info, int lgr_nr) {
|
||||
nnc_vector_type * nnc_vector = nnc_info_get_vector( nnc_info , lgr_nr );
|
||||
if (nnc_vector)
|
||||
return nnc_vector_get_grid_index_list( nnc_vector );
|
||||
@ -159,7 +159,7 @@ const int_vector_type * nnc_info_get_grid_index_list(const nnc_info_type * nnc_i
|
||||
}
|
||||
|
||||
|
||||
const int_vector_type * nnc_info_iget_grid_index_list(const nnc_info_type * nnc_info, int lgr_index) {
|
||||
const int_vector_type * nnc_info_iget_grid_index_list(const nnc_info_type * nnc_info, int lgr_index) {
|
||||
nnc_vector_type * nnc_vector = nnc_info_iget_vector( nnc_info , lgr_index );
|
||||
if (nnc_vector)
|
||||
return nnc_vector_get_grid_index_list( nnc_vector );
|
||||
@ -169,7 +169,7 @@ const int_vector_type * nnc_info_iget_grid_index_list(const nnc_info_type * nnc_
|
||||
|
||||
|
||||
|
||||
const int_vector_type * nnc_info_get_self_grid_index_list(const nnc_info_type * nnc_info) {
|
||||
const int_vector_type * nnc_info_get_self_grid_index_list(const nnc_info_type * nnc_info) {
|
||||
return nnc_info_get_grid_index_list( nnc_info , nnc_info->lgr_nr );
|
||||
}
|
||||
|
||||
|
52
ThirdParty/Ert/lib/ecl/nnc_vector.cpp
vendored
52
ThirdParty/Ert/lib/ecl/nnc_vector.cpp
vendored
@ -1,26 +1,26 @@
|
||||
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'nnc_vector.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'nnc_vector.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 <ert/util/util.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
|
||||
@ -36,7 +36,7 @@ struct nnc_vector_struct {
|
||||
int lgr_nr;
|
||||
int_vector_type * grid_index_list;
|
||||
int_vector_type * nnc_index_list;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
UTIL_IS_INSTANCE_FUNCTION( nnc_vector , NNC_VECTOR_TYPE_ID )
|
||||
@ -50,14 +50,14 @@ nnc_vector_type * nnc_vector_alloc(int lgr_nr) {
|
||||
nnc_vector->grid_index_list = int_vector_alloc(0,0);
|
||||
nnc_vector->nnc_index_list = int_vector_alloc(0,0);
|
||||
nnc_vector->lgr_nr = lgr_nr;
|
||||
return nnc_vector;
|
||||
return nnc_vector;
|
||||
}
|
||||
|
||||
nnc_vector_type * nnc_vector_alloc_copy(const nnc_vector_type * 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;
|
||||
copy_vector->lgr_nr = src_vector->lgr_nr;
|
||||
copy_vector->grid_index_list = int_vector_alloc_copy( src_vector->grid_index_list );
|
||||
copy_vector->nnc_index_list = int_vector_alloc_copy( src_vector->nnc_index_list );
|
||||
return copy_vector;
|
||||
@ -67,20 +67,20 @@ nnc_vector_type * nnc_vector_alloc_copy(const nnc_vector_type * src_vector) {
|
||||
bool nnc_vector_equal( const nnc_vector_type * nnc_vector1 , const nnc_vector_type * nnc_vector2) {
|
||||
if (nnc_vector1 == nnc_vector2)
|
||||
return true;
|
||||
|
||||
|
||||
if ((nnc_vector1 == NULL) || (nnc_vector2 == NULL))
|
||||
return false;
|
||||
|
||||
{
|
||||
if (nnc_vector1->lgr_nr != nnc_vector2->lgr_nr)
|
||||
return false;
|
||||
|
||||
|
||||
if (!int_vector_equal( nnc_vector1->grid_index_list , nnc_vector2->grid_index_list))
|
||||
return false;
|
||||
|
||||
|
||||
if (!int_vector_equal( nnc_vector1->nnc_index_list , nnc_vector2->nnc_index_list))
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ bool nnc_vector_equal( const nnc_vector_type * nnc_vector1 , const nnc_vector_ty
|
||||
void nnc_vector_free( nnc_vector_type * nnc_vector ) {
|
||||
int_vector_free( nnc_vector->grid_index_list );
|
||||
int_vector_free( nnc_vector->nnc_index_list );
|
||||
free( nnc_vector );
|
||||
free( nnc_vector );
|
||||
}
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ void nnc_vector_add_nnc(nnc_vector_type * nnc_vector, int global_cell_number , i
|
||||
int_vector_append( nnc_vector->grid_index_list , global_cell_number );
|
||||
int_vector_append( nnc_vector->nnc_index_list , nnc_index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const int_vector_type * nnc_vector_get_grid_index_list(const nnc_vector_type * nnc_vector) {
|
||||
return nnc_vector->grid_index_list;
|
||||
|
8
ThirdParty/Ert/lib/ecl/readme.overview
vendored
8
ThirdParty/Ert/lib/ecl/readme.overview
vendored
@ -3,10 +3,10 @@ functionalities. The different libraries depend on eachother, and the
|
||||
libraries must be built in correct order. The dependencies is as
|
||||
follows:
|
||||
|
||||
libhash :
|
||||
libhash :
|
||||
libutil : libhash
|
||||
libecl : libhash libutil
|
||||
librms : libecl libutil libhash
|
||||
librms : libecl libutil libhash
|
||||
libsched : libecl linutil libhash
|
||||
libenkf : libecl libsched librm linutil libhash
|
||||
|
||||
@ -16,7 +16,7 @@ libhash: This library implements the classes hash_type, set_type and
|
||||
|
||||
libutil: This library is a collection utility routines. Observe that
|
||||
this library only implements routines, and not statefull
|
||||
objects.
|
||||
objects.
|
||||
|
||||
libecl: This library implements functions for reading/writing ECLIPSE
|
||||
restart/summary/init/grid files.
|
||||
@ -27,7 +27,7 @@ librms: This library implements (basic) reader and writer for binary
|
||||
RMS ROFF files.
|
||||
|
||||
libenkf: This library implements various high level objects for EnKF
|
||||
functionality.
|
||||
functionality.
|
||||
|
||||
-----------------------------------------------------------------
|
||||
|
||||
|
240
ThirdParty/Ert/lib/ecl/smspec_node.cpp
vendored
240
ThirdParty/Ert/lib/ecl/smspec_node.cpp
vendored
@ -22,8 +22,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <ert/util/hash.hpp>
|
||||
#include <ert/util/util.hpp>
|
||||
#include <ert/util/set.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/int_vector.hpp>
|
||||
#include <ert/util/stringlist.hpp>
|
||||
@ -70,7 +69,6 @@ struct smspec_node_struct {
|
||||
bool historical; /* Does the name end with 'H'? */
|
||||
int params_index; /* The index of this variable (applies to all the vectors - in particular the PARAMS vectors of the summary files *.Snnnn / *.UNSMRY ). */
|
||||
float default_value; /* Default value for this variable. */
|
||||
bool valid;
|
||||
};
|
||||
|
||||
|
||||
@ -79,6 +77,22 @@ bool smspec_node_equal( const smspec_node_type * node1, const smspec_node_type
|
||||
return smspec_node_cmp( node1 , node2 ) == 0;
|
||||
}
|
||||
|
||||
static bool smspec_node_need_wgname(ecl_smspec_var_type var_type) {
|
||||
if (var_type == ECL_SMSPEC_COMPLETION_VAR ||
|
||||
var_type == ECL_SMSPEC_GROUP_VAR ||
|
||||
var_type == ECL_SMSPEC_WELL_VAR ||
|
||||
var_type == ECL_SMSPEC_SEGMENT_VAR)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool smspec_node_type_supported(ecl_smspec_var_type var_type) {
|
||||
if (var_type == ECL_SMSPEC_NETWORK_VAR)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
@ -274,39 +288,31 @@ static void smspec_node_set_invalid_flags( smspec_node_type * smspec_node) {
|
||||
smspec_node->rate_variable = false;
|
||||
smspec_node->total_variable = false;
|
||||
smspec_node->historical = false;
|
||||
smspec_node->valid = false;
|
||||
}
|
||||
|
||||
static char LAST_CHAR(const char * s) {
|
||||
return s[ strlen(s) - 1];
|
||||
}
|
||||
|
||||
static void smspec_node_set_flags( smspec_node_type * smspec_node) {
|
||||
/*
|
||||
Check if this is a rate variabel - that info is used when
|
||||
interpolating results to true_time between ministeps.
|
||||
*/
|
||||
{
|
||||
const char *rate_vars[] = {"OPR" , "GPR" , "WPR" , "GOR" , "WCT"};
|
||||
int num_rate_vars = sizeof( rate_vars ) / sizeof( rate_vars[0] );
|
||||
bool is_rate = false;
|
||||
int ivar;
|
||||
for (ivar = 0; ivar < num_rate_vars; ivar++) {
|
||||
const char * var_substring = &smspec_node->keyword[1];
|
||||
if (strncmp( rate_vars[ivar] , var_substring , strlen( rate_vars[ivar] )) == 0) {
|
||||
is_rate = true;
|
||||
break;
|
||||
}
|
||||
|
||||
bool smspec_node_identify_rate(const char * keyword) {
|
||||
const char *rate_vars[] = {"OPR" , "GPR" , "WPR" , "LPR", "OIR", "GIR", "WIR", "LIR", "GOR" , "WCT"};
|
||||
int num_rate_vars = sizeof( rate_vars ) / sizeof( rate_vars[0] );
|
||||
bool is_rate = false;
|
||||
int ivar;
|
||||
for (ivar = 0; ivar < num_rate_vars; ivar++) {
|
||||
const char * var_substring = &keyword[1];
|
||||
if (strncmp( rate_vars[ivar] , var_substring , strlen( rate_vars[ivar] )) == 0) {
|
||||
is_rate = true;
|
||||
break;
|
||||
}
|
||||
smspec_node->rate_variable = is_rate;
|
||||
}
|
||||
return is_rate;
|
||||
}
|
||||
|
||||
{
|
||||
if (LAST_CHAR(smspec_node->keyword) == 'H')
|
||||
smspec_node->historical = true;
|
||||
}
|
||||
|
||||
/*
|
||||
bool smspec_node_identify_total(const char * keyword, ecl_smspec_var_type var_type) {
|
||||
/*
|
||||
This code checks in a predefined list whether a certain WGNAMES
|
||||
variable represents a total accumulated quantity. Only the last three
|
||||
characters in the variable is considered (i.e. the leading 'W', 'G' or
|
||||
@ -316,34 +322,45 @@ static void smspec_node_set_flags( smspec_node_type * smspec_node) {
|
||||
the tables 2.7 - 2.11 in the ECLIPSE fileformat documentation. Have
|
||||
skipped some of the most exotic keywords.
|
||||
*/
|
||||
{
|
||||
bool is_total = false;
|
||||
if (smspec_node->var_type == ECL_SMSPEC_WELL_VAR ||
|
||||
smspec_node->var_type == ECL_SMSPEC_GROUP_VAR ||
|
||||
smspec_node->var_type == ECL_SMSPEC_FIELD_VAR ||
|
||||
smspec_node->var_type == ECL_SMSPEC_REGION_VAR ||
|
||||
smspec_node->var_type == ECL_SMSPEC_COMPLETION_VAR ) {
|
||||
const char *total_vars[] = {"OPT" , "GPT" , "WPT" , "GIT", "WIT", "OPTF" , "OPTS" , "OIT" , "OVPT" , "OVIT" , "MWT" ,
|
||||
"WVPT" , "WVIT" , "GMT" , "GPTF" , "SGT" , "GST" , "FGT" , "GCT" , "GIMT" ,
|
||||
"WGPT" , "WGIT" , "EGT" , "EXGT" , "GVPT" , "GVIT" , "LPT" , "VPT" , "VIT" , "NPT" , "NIT"};
|
||||
bool is_total = false;
|
||||
if (var_type == ECL_SMSPEC_WELL_VAR ||
|
||||
var_type == ECL_SMSPEC_GROUP_VAR ||
|
||||
var_type == ECL_SMSPEC_FIELD_VAR ||
|
||||
var_type == ECL_SMSPEC_REGION_VAR ||
|
||||
var_type == ECL_SMSPEC_COMPLETION_VAR ) {
|
||||
const char *total_vars[] = {"OPT" , "GPT" , "WPT" , "GIT", "WIT", "OPTF" , "OPTS" , "OIT" , "OVPT" , "OVIT" , "MWT" ,
|
||||
"WVPT" , "WVIT" , "GMT" , "GPTF" , "SGT" , "GST" , "FGT" , "GCT" , "GIMT" ,
|
||||
"WGPT" , "WGIT" , "EGT" , "EXGT" , "GVPT" , "GVIT" , "LPT" , "VPT" , "VIT" , "NPT" , "NIT",
|
||||
"CPT", "CIT"};
|
||||
|
||||
int num_total_vars = sizeof( total_vars ) / sizeof( total_vars[0] );
|
||||
int ivar;
|
||||
for (ivar = 0; ivar < num_total_vars; ivar++) {
|
||||
const char * var_substring = &smspec_node->keyword[1];
|
||||
/*
|
||||
We want to mark both FOPT and FOPTH as historical variables;
|
||||
we use strncmp() to make certain that the trailing 'H' is
|
||||
not included in the comparison.
|
||||
*/
|
||||
if (strncmp( total_vars[ivar] , var_substring , strlen( total_vars[ivar] )) == 0) {
|
||||
is_total = true;
|
||||
break;
|
||||
}
|
||||
int num_total_vars = sizeof( total_vars ) / sizeof( total_vars[0] );
|
||||
int ivar;
|
||||
for (ivar = 0; ivar < num_total_vars; ivar++) {
|
||||
const char * var_substring = &keyword[1];
|
||||
/*
|
||||
We want to mark both FOPT and FOPTH as total variables;
|
||||
we use strncmp() to make certain that the trailing 'H' is
|
||||
not included in the comparison.
|
||||
*/
|
||||
if (strncmp( total_vars[ivar] , var_substring , strlen( total_vars[ivar] )) == 0) {
|
||||
is_total = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
smspec_node->total_variable = is_total;
|
||||
}
|
||||
return is_total;
|
||||
}
|
||||
|
||||
|
||||
static void smspec_node_set_flags( smspec_node_type * smspec_node) {
|
||||
/*
|
||||
Check if this is a rate variabel - that info is used when
|
||||
interpolating results to true_time between ministeps.
|
||||
*/
|
||||
smspec_node->rate_variable = smspec_node_identify_rate(smspec_node->keyword);
|
||||
if (LAST_CHAR(smspec_node->keyword) == 'H')
|
||||
smspec_node->historical = true;
|
||||
smspec_node->total_variable = smspec_node_identify_total(smspec_node->keyword, smspec_node->var_type);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -387,12 +404,7 @@ smspec_node_type * smspec_node_alloc_new(int params_index, float default_value)
|
||||
|
||||
|
||||
static void smspec_node_set_wgname( smspec_node_type * index , const char * wgname ) {
|
||||
if (wgname == NULL) {
|
||||
util_safe_free( index->wgname );
|
||||
index->wgname = NULL;
|
||||
} else {
|
||||
index->wgname = util_realloc_string_copy(index->wgname , wgname );
|
||||
}
|
||||
index->wgname = util_realloc_string_copy(index->wgname , wgname );
|
||||
}
|
||||
|
||||
|
||||
@ -544,18 +556,10 @@ static void smspec_node_set_gen_keys( smspec_node_type * smspec_node , const cha
|
||||
default:
|
||||
util_abort("%s: internal error - should not be here? \n" , __func__);
|
||||
}
|
||||
smspec_node->valid = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void smspec_node_update_wgname( smspec_node_type * index , const char * wgname , const char * key_join_string) {
|
||||
smspec_node_set_wgname( index , wgname );
|
||||
util_safe_free( index->gen_key1 );
|
||||
util_safe_free( index->gen_key2 );
|
||||
smspec_node_set_gen_keys( index , key_join_string );
|
||||
}
|
||||
|
||||
static void smspec_node_common_init( smspec_node_type * node , ecl_smspec_var_type var_type , const char * keyword , const char * unit ) {
|
||||
if (node->var_type == ECL_SMSPEC_INVALID_VAR) {
|
||||
smspec_node_set_unit( node , unit );
|
||||
@ -568,22 +572,16 @@ static void smspec_node_common_init( smspec_node_type * node , ecl_smspec_var_ty
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This *should* become static.
|
||||
*/
|
||||
void smspec_node_init( smspec_node_type * smspec_node,
|
||||
ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * key_join_string ,
|
||||
const int grid_dims[3] ,
|
||||
int num) {
|
||||
static bool smspec_node_init__( smspec_node_type * smspec_node,
|
||||
ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * key_join_string ,
|
||||
const int grid_dims[3] ,
|
||||
int num) {
|
||||
|
||||
bool initOK = true;
|
||||
bool wgnameOK = true;
|
||||
if ((wgname != NULL) && (IS_DUMMY_WELL(wgname)))
|
||||
wgnameOK = false;
|
||||
|
||||
smspec_node_common_init( smspec_node , var_type , keyword , unit );
|
||||
switch (var_type) {
|
||||
@ -591,23 +589,21 @@ void smspec_node_init( smspec_node_type * smspec_node,
|
||||
/* Completion variable : WGNAME & NUM */
|
||||
smspec_node_set_num( smspec_node , grid_dims , num );
|
||||
smspec_node_set_wgname( smspec_node , wgname );
|
||||
if (!wgnameOK || num < 0)
|
||||
if (num < 0)
|
||||
initOK = false;
|
||||
break;
|
||||
case(ECL_SMSPEC_GROUP_VAR):
|
||||
/* Group variable : WGNAME */
|
||||
smspec_node_set_wgname( smspec_node , wgname );
|
||||
initOK = wgnameOK;
|
||||
break;
|
||||
case(ECL_SMSPEC_WELL_VAR):
|
||||
/* Well variable : WGNAME */
|
||||
smspec_node_set_wgname( smspec_node , wgname );
|
||||
initOK = wgnameOK;
|
||||
break;
|
||||
case(ECL_SMSPEC_SEGMENT_VAR):
|
||||
smspec_node_set_wgname( smspec_node , wgname );
|
||||
smspec_node_set_num( smspec_node , grid_dims , num );
|
||||
if (!wgnameOK || num < 0)
|
||||
if (num < 0)
|
||||
initOK = false;
|
||||
break;
|
||||
case(ECL_SMSPEC_FIELD_VAR):
|
||||
@ -654,6 +650,31 @@ void smspec_node_init( smspec_node_type * smspec_node,
|
||||
|
||||
if (initOK)
|
||||
smspec_node_set_gen_keys( smspec_node , key_join_string );
|
||||
|
||||
return initOK;
|
||||
}
|
||||
|
||||
/*
|
||||
This function should be removed from the public API.
|
||||
*/
|
||||
void smspec_node_init( smspec_node_type * smspec_node,
|
||||
ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * key_join_string ,
|
||||
const int grid_dims[3] ,
|
||||
int num) {
|
||||
|
||||
smspec_node_init__(smspec_node,
|
||||
var_type,
|
||||
wgname,
|
||||
keyword,
|
||||
unit,
|
||||
key_join_string,
|
||||
grid_dims,
|
||||
num);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -673,12 +694,12 @@ void smspec_node_init( smspec_node_type * smspec_node,
|
||||
|
||||
|
||||
smspec_node_type * smspec_node_alloc( ecl_smspec_var_type var_type ,
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * key_join_string ,
|
||||
const int grid_dims[3] ,
|
||||
int num , int param_index, float default_value) {
|
||||
const char * wgname ,
|
||||
const char * keyword ,
|
||||
const char * unit ,
|
||||
const char * key_join_string ,
|
||||
const int grid_dims[3] ,
|
||||
int num , int param_index, float default_value) {
|
||||
/*
|
||||
Well and group names in the wgname parameter is quite messy. The
|
||||
situation is as follows:
|
||||
@ -709,8 +730,22 @@ smspec_node_type * smspec_node_alloc( ecl_smspec_var_type var_type ,
|
||||
completely.
|
||||
*/
|
||||
|
||||
if (smspec_node_need_wgname(var_type) && IS_DUMMY_WELL(wgname))
|
||||
return NULL;
|
||||
|
||||
if (!smspec_node_type_supported(var_type))
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
TODO: The alloc_new and init functions should be joined in one function.
|
||||
*/
|
||||
smspec_node_type * smspec_node = smspec_node_alloc_new( param_index , default_value );
|
||||
smspec_node_init( smspec_node , var_type , wgname , keyword , unit , key_join_string , grid_dims, num);
|
||||
bool initOK = smspec_node_init__( smspec_node , var_type , wgname , keyword , unit , key_join_string , grid_dims, num);
|
||||
if (!initOK) {
|
||||
smspec_node_free(smspec_node);
|
||||
smspec_node = NULL;
|
||||
}
|
||||
|
||||
return smspec_node;
|
||||
}
|
||||
|
||||
@ -799,7 +834,6 @@ smspec_node_type* smspec_node_alloc_copy( const smspec_node_type* node ) {
|
||||
memcpy( copy->lgr_ijk, node->lgr_ijk, 3 * sizeof( * node->lgr_ijk ) );
|
||||
}
|
||||
|
||||
copy->valid = node->valid;
|
||||
copy->rate_variable = node->rate_variable;
|
||||
copy->total_variable = node->total_variable;
|
||||
copy->historical = node->historical;
|
||||
@ -810,14 +844,14 @@ smspec_node_type* smspec_node_alloc_copy( const smspec_node_type* node ) {
|
||||
}
|
||||
|
||||
void smspec_node_free( smspec_node_type * index ) {
|
||||
util_safe_free( index->unit );
|
||||
util_safe_free( index->keyword );
|
||||
util_safe_free( index->ijk );
|
||||
util_safe_free( index->gen_key1 );
|
||||
util_safe_free( index->gen_key2 );
|
||||
util_safe_free( index->wgname );
|
||||
util_safe_free( index->lgr_name );
|
||||
util_safe_free( index->lgr_ijk );
|
||||
free( index->unit );
|
||||
free( index->keyword );
|
||||
free( index->ijk );
|
||||
free( index->gen_key1 );
|
||||
free( index->gen_key2 );
|
||||
free( index->wgname );
|
||||
free( index->lgr_name );
|
||||
free( index->lgr_ijk );
|
||||
free( index );
|
||||
}
|
||||
|
||||
@ -880,19 +914,13 @@ bool smspec_node_is_historical( const smspec_node_type * smspec_node ){
|
||||
return smspec_node->historical;
|
||||
}
|
||||
|
||||
|
||||
bool smspec_node_is_valid( const smspec_node_type * smspec_node ){
|
||||
return smspec_node->valid;
|
||||
}
|
||||
|
||||
|
||||
const char * smspec_node_get_unit( const smspec_node_type * smspec_node) {
|
||||
return smspec_node->unit;
|
||||
}
|
||||
|
||||
void smspec_node_set_unit( smspec_node_type * smspec_node , const char * unit ) {
|
||||
// ECLIPSE Standard: Max eight characters - everything beyond is silently dropped
|
||||
util_safe_free( smspec_node->unit );
|
||||
free( smspec_node->unit );
|
||||
smspec_node->unit = util_alloc_substring_copy( unit , 0 , 8);
|
||||
}
|
||||
|
||||
@ -964,6 +992,8 @@ void smspec_node_fprintf( const smspec_node_type * smspec_node , FILE * stream)
|
||||
fprintf(stream, "KEYWORD: %s \n",smspec_node->keyword);
|
||||
fprintf(stream, "WGNAME : %s \n",smspec_node->wgname);
|
||||
fprintf(stream, "UNIT : %s \n",smspec_node->unit);
|
||||
fprintf(stream, "TYPE : %d \n",smspec_node->var_type);
|
||||
fprintf(stream, "NUM : %d \n\n",smspec_node->num);
|
||||
}
|
||||
|
||||
|
||||
|
2
ThirdParty/Ert/lib/ecl/tests/data/num_cpu3
vendored
2
ThirdParty/Ert/lib/ecl/tests/data/num_cpu3
vendored
@ -6,4 +6,4 @@ SLAVES
|
||||
-- "slaves token" position doesn't brake parsing
|
||||
-- Testing comments in middle
|
||||
'RES-R5' 'base' 'sg-indigo' '/usr/models/res5' 10 /
|
||||
/testRubbish -- this line also counts
|
||||
/testRubbish -- this line also counts
|
||||
|
@ -20,11 +20,11 @@
|
||||
#include <stdbool.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
|
||||
void test_grid(int nx, int ny, int nz) {
|
@ -20,8 +20,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
void test_grid() {
|
||||
const int nx = 5, ny = 6, nz = 7;
|
@ -1,29 +1,29 @@
|
||||
/*
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_coarse_test.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.
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_coarse_test.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_coarse_cell.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_coarse_cell.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
|
||||
|
||||
|
||||
@ -40,13 +40,13 @@ void test_coarse_cell(const ecl_grid_type * grid , ecl_coarse_cell_type * cell )
|
||||
/* The coordinates are right */
|
||||
ecl_grid_get_ijk1( grid , gi , &i , &j , &k);
|
||||
if ((i < ijk[0]) || (i > ijk[1]))
|
||||
test_error_exit("i:%d not inside range [%d,%d] \n",i , ijk[0] , ijk[1]);
|
||||
test_error_exit("i:%d not inside range [%d,%d] \n",i , ijk[0] , ijk[1]);
|
||||
|
||||
if ((j < ijk[2]) || (j > ijk[3]))
|
||||
test_error_exit("j:%d not inside range [%d,%d] \n",j , ijk[2] , ijk[3]);
|
||||
test_error_exit("j:%d not inside range [%d,%d] \n",j , ijk[2] , ijk[3]);
|
||||
|
||||
if ((k < ijk[4]) || (k > ijk[5]))
|
||||
test_error_exit("k:%d not inside range [%d,%d] \n",k , ijk[4] , ijk[4]);
|
||||
test_error_exit("k:%d not inside range [%d,%d] \n",k , ijk[4] , ijk[4]);
|
||||
|
||||
if (c == 0)
|
||||
prev_active = ecl_grid_get_active_index1( grid , gi );
|
||||
@ -67,7 +67,7 @@ int main(int argc , char ** argv) {
|
||||
char * egrid_file = ecl_util_alloc_filename( NULL , case_path , ECL_EGRID_FILE , false , 0 );
|
||||
char * rst_file = ecl_util_alloc_filename( NULL , case_path , ECL_RESTART_FILE , false , 0 );
|
||||
char * init_file = ecl_util_alloc_filename( NULL , case_path , ECL_INIT_FILE , false , 0 );
|
||||
|
||||
|
||||
ecl_grid_type * GRID = ecl_grid_alloc(egrid_file );
|
||||
ecl_file_type * RST_file = ecl_file_open( rst_file , 0);
|
||||
ecl_file_type * INIT_file = ecl_file_open( init_file , 0);
|
||||
@ -80,11 +80,11 @@ int main(int argc , char ** argv) {
|
||||
{
|
||||
const ecl_kw_type * swat0 = ecl_file_iget_named_kw( RST_file , "SWAT" , 0 );
|
||||
const ecl_kw_type * porv = ecl_file_iget_named_kw( INIT_file , "PORV" , 0 );
|
||||
|
||||
|
||||
test_assert_int_equal( ecl_kw_get_size( swat0 ) , ecl_grid_get_active_size( GRID ) );
|
||||
test_assert_int_equal( ecl_kw_get_size( porv ) , ecl_grid_get_global_size( GRID ) );
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
int ic;
|
||||
for (ic = 0; ic < ecl_grid_get_num_coarse_groups(GRID); ic++) {
|
||||
@ -92,8 +92,8 @@ int main(int argc , char ** argv) {
|
||||
test_coarse_cell( GRID , coarse_cell );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ecl_file_close( INIT_file );
|
||||
ecl_file_close( RST_file );
|
@ -1,36 +1,36 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_dualp.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_dualp.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_kw_magic.hpp>
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
const char * case_path = argv[1];
|
||||
char * grid_file = ecl_util_alloc_filename( NULL , case_path , ECL_EGRID_FILE , false , 0 );
|
||||
char * init_file = ecl_util_alloc_filename( NULL , case_path , ECL_INIT_FILE , false , 0 );
|
||||
char * rst_file = ecl_util_alloc_filename( NULL , case_path , ECL_RESTART_FILE , false , 0 );
|
||||
|
||||
|
||||
ecl_grid_type * ecl_grid = ecl_grid_alloc( grid_file );
|
||||
ecl_file_type * RST_file = ecl_file_open( rst_file , 0);
|
||||
ecl_file_type * INIT_file = ecl_file_open( init_file , 0 );
|
||||
@ -66,8 +66,8 @@ int main(int argc , char ** argv) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ecl_file_close( RST_file );
|
||||
ecl_file_close( INIT_file );
|
||||
ecl_grid_free( ecl_grid );
|
@ -1,29 +1,29 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_fault_block_collection_statoil.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_fault_block_collection_statoil.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 <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/fault_block_collection.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/fault_block_collection.hpp>
|
||||
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ int main(int argc , char ** argv) {
|
||||
fclose( stream );
|
||||
}
|
||||
|
||||
|
||||
|
||||
test_create( ecl_grid , fault_blk_kw );
|
||||
test_get_layer( ecl_grid , fault_blk_kw );
|
||||
|
@ -1,32 +1,32 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_fault_block_layer.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_fault_block_layer.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 <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/geometry/geo_polygon_collection.h>
|
||||
#include <ert/geometry/geo_polygon_collection.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/fault_block_layer.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/fault_block_layer.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
|
||||
|
||||
@ -34,10 +34,10 @@
|
||||
void test_create( const ecl_grid_type * grid , ecl_kw_type * fault_block_kw) {
|
||||
int k = 0;
|
||||
int i,j;
|
||||
|
||||
|
||||
for (j=0; j < ecl_grid_get_ny( grid ); j++) {
|
||||
for (i = 0; i < ecl_grid_get_nx( grid ); i++) {
|
||||
|
||||
|
||||
int g = ecl_grid_get_global_index3( grid , i,j,k);
|
||||
ecl_kw_iset_int( fault_block_kw , g , 9 );
|
||||
}
|
||||
@ -54,7 +54,7 @@ void test_create( const ecl_grid_type * grid , ecl_kw_type * fault_block_kw) {
|
||||
test_assert_double_equal( x , fault_block_get_xc( block ));
|
||||
test_assert_double_equal( y , fault_block_get_yc( block ));
|
||||
}
|
||||
|
||||
|
||||
fault_block_layer_free( layer );
|
||||
}
|
||||
}
|
||||
@ -64,9 +64,9 @@ void test_create( const ecl_grid_type * grid , ecl_kw_type * fault_block_kw) {
|
||||
|
||||
void test_create_invalid( const ecl_grid_type * grid ) {
|
||||
ecl_kw_type * fault_blk_kw = ecl_kw_alloc("FAULTBLK" , ecl_grid_get_global_size( grid ) - 1, ECL_INT);
|
||||
|
||||
|
||||
test_assert_NULL( fault_block_layer_alloc( grid , 7 ));
|
||||
|
||||
|
||||
ecl_kw_free( fault_blk_kw );
|
||||
}
|
||||
|
||||
@ -78,18 +78,18 @@ void test_trace_edge( const ecl_grid_type * grid) {
|
||||
double_vector_type * y_list = double_vector_alloc( 0,0);
|
||||
fault_block_type * block = fault_block_layer_safe_get_block( layer , 99);
|
||||
int_vector_type * cell_list = int_vector_alloc(0,0);
|
||||
|
||||
|
||||
test_assert_false( fault_block_trace_edge( block , x_list , y_list , cell_list));
|
||||
fault_block_add_cell( block , 0,0);
|
||||
test_assert_true( fault_block_trace_edge( block , x_list , y_list , cell_list));
|
||||
test_assert_int_equal( 4 , double_vector_size( x_list ));
|
||||
test_assert_int_equal( 4 , double_vector_size( y_list ));
|
||||
|
||||
|
||||
test_assert_double_equal( 0 , double_vector_iget( x_list , 0 ));
|
||||
test_assert_double_equal( 1 , double_vector_iget( x_list , 1 ));
|
||||
test_assert_double_equal( 1 , double_vector_iget( x_list , 2 ));
|
||||
test_assert_double_equal( 0 , double_vector_iget( x_list , 3 ));
|
||||
|
||||
|
||||
test_assert_double_equal( 0 , double_vector_iget( y_list , 0 ));
|
||||
test_assert_double_equal( 0 , double_vector_iget( y_list , 1 ));
|
||||
test_assert_double_equal( 1 , double_vector_iget( y_list , 2 ));
|
||||
@ -110,7 +110,7 @@ void test_export( const ecl_grid_type * grid) {
|
||||
ecl_kw_type * ecl_kw2 = ecl_kw_alloc("FAULTBLK" , ecl_grid_get_global_size( grid ) + 1 , ECL_INT);
|
||||
ecl_kw_type * ecl_kw3 = ecl_kw_alloc("FAULTBLK" , ecl_grid_get_global_size( grid ) , ECL_FLOAT);
|
||||
fault_block_type * block = fault_block_layer_add_block( layer , 10 );
|
||||
|
||||
|
||||
fault_block_add_cell( block , 0 , 0 );
|
||||
fault_block_add_cell( block , 1 , 0 );
|
||||
fault_block_add_cell( block , 1 , 1 );
|
||||
@ -123,7 +123,7 @@ void test_export( const ecl_grid_type * grid) {
|
||||
|
||||
{
|
||||
int nx = ecl_grid_get_nx( grid );
|
||||
|
||||
|
||||
test_assert_int_equal( ecl_kw_iget_int( ecl_kw1 , 0 ) , 10 );
|
||||
test_assert_int_equal( ecl_kw_iget_int( ecl_kw1 , 1 ) , 10 );
|
||||
test_assert_int_equal( ecl_kw_iget_int( ecl_kw1 , nx ) , 10 );
|
||||
@ -150,7 +150,7 @@ void test_neighbours( const ecl_grid_type * grid) {
|
||||
ecl_kw_iset_int( ecl_kw , ecl_grid_get_global_index3( grid , 5,3,k) , 4);
|
||||
ecl_kw_iset_int( ecl_kw , ecl_grid_get_global_index3( grid , 4,2,k) , 5);
|
||||
fault_block_layer_load_kw( layer , ecl_kw);
|
||||
|
||||
|
||||
{
|
||||
int_vector_type * neighbours = int_vector_alloc( 0,0);
|
||||
{
|
||||
@ -169,15 +169,15 @@ void test_neighbours( const ecl_grid_type * grid) {
|
||||
test_assert_true( int_vector_contains( neighbours , 3 ));
|
||||
}
|
||||
int_vector_free( neighbours );
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
geo_polygon_collection_free( polylines );
|
||||
fault_block_layer_free( layer );
|
||||
fault_block_layer_free( layer );
|
||||
ecl_kw_free( ecl_kw );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
@ -1,44 +1,44 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_fault_block_layer_statoil.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_fault_block_layer_statoil.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 <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/fault_block_layer.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/fault_block_layer.hpp>
|
||||
|
||||
|
||||
void test_create( const ecl_grid_type * grid , const ecl_kw_type * fault_block_kw) {
|
||||
test_assert_NULL( fault_block_layer_alloc( grid , -1 ));
|
||||
test_assert_NULL( fault_block_layer_alloc( grid , ecl_grid_get_nz( grid )));
|
||||
|
||||
{
|
||||
|
||||
{
|
||||
int k;
|
||||
for (k = 0; k < ecl_grid_get_nz( grid ); k++) {
|
||||
fault_block_layer_type * layer = fault_block_layer_alloc( grid , k);
|
||||
test_assert_true( fault_block_layer_is_instance( layer ));
|
||||
|
||||
|
||||
fault_block_layer_scan_kw( layer , fault_block_kw);
|
||||
{
|
||||
int max_block_id = fault_block_layer_get_max_id( layer );
|
||||
int max_block_id = fault_block_layer_get_max_id( layer );
|
||||
int block_id;
|
||||
|
||||
for (block_id = 0; block_id <= max_block_id; block_id++) {
|
||||
@ -49,7 +49,7 @@ void test_create( const ecl_grid_type * grid , const ecl_kw_type * fault_block_k
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
int index;
|
||||
for (index = 0; index < fault_block_layer_get_size( layer ); index++) {
|
||||
@ -58,7 +58,7 @@ void test_create( const ecl_grid_type * grid , const ecl_kw_type * fault_block_k
|
||||
fault_block_get_yc( block );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fault_block_layer_free( layer );
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@ int main(int argc , char ** argv) {
|
||||
fclose( stream );
|
||||
}
|
||||
|
||||
|
||||
|
||||
test_create( ecl_grid , fault_blk_kw );
|
||||
|
||||
ecl_grid_free( ecl_grid );
|
@ -20,26 +20,26 @@
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_file_view.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
|
||||
void test_writable(size_t data_size) {
|
||||
test_work_area_type * work_area = test_work_area_alloc("ecl_file_writable");
|
||||
const char * data_file_name = "test_file";
|
||||
|
||||
ecl_kw_type * kw = ecl_kw_alloc("TEST_KW", data_size, ECL_INT);
|
||||
for(int i = 0; i < data_size; ++i)
|
||||
for(size_t i = 0; i < data_size; ++i)
|
||||
ecl_kw_iset_int(kw, i, ((i*37)+11)%data_size);
|
||||
|
||||
fortio_type * fortio = fortio_open_writer(data_file_name, false, true);
|
||||
ecl_kw_fwrite(kw, fortio);
|
||||
ecl_kw_fwrite(kw, fortio);
|
||||
fortio_fclose(fortio);
|
||||
|
||||
for(int i = 0; i < 4; ++i) {
|
@ -20,15 +20,15 @@
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_file_view.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
|
||||
|
||||
void test_flags( const char * filename) {
|
@ -19,14 +19,14 @@
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_file_view.h>
|
||||
#include <ert/ecl/ecl_file_kw.h>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
#include <ert/ecl/ecl_file_kw.hpp>
|
||||
|
||||
void test_file_kw_equal() {
|
||||
ecl_file_kw_type * kw1 = ecl_file_kw_alloc0( "PRESSURE" , ECL_FLOAT, 1000 , 66);
|
||||
@ -106,7 +106,7 @@ void test_create_file_kw() {
|
||||
ecl_file_kw_free( file_kw0 );
|
||||
ecl_file_kw_free( file_kw1 );
|
||||
ecl_file_kw_free( file_kw2 );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,29 +1,29 @@
|
||||
/*
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_fmt.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.
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_fmt.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 <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
|
||||
void test_content( test_work_area_type * work_area , const char * src_file , bool fmt_file ) {
|
||||
test_work_area_install_file( work_area , src_file );
|
||||
@ -32,7 +32,7 @@ void test_content( test_work_area_type * work_area , const char * src_file , boo
|
||||
bool fmt;
|
||||
util_alloc_file_components( src_file , NULL , &base_name , NULL);
|
||||
util_copy_file( src_file , base_name );
|
||||
|
||||
|
||||
test_assert_true( ecl_util_fmt_file( base_name , &fmt ));
|
||||
test_assert_bool_equal( fmt , fmt_file );
|
||||
}
|
||||
@ -43,11 +43,11 @@ void test_content( test_work_area_type * work_area , const char * src_file , boo
|
||||
|
||||
void test_small( ) {
|
||||
bool fmt;
|
||||
|
||||
|
||||
FILE * stream = util_fopen("small.txt" , "w");
|
||||
fprintf(stream , "Some bytes\n");
|
||||
fclose( stream );
|
||||
|
||||
|
||||
test_assert_false( ecl_util_fmt_file( "small.txt" , &fmt ));
|
||||
}
|
||||
|
||||
@ -71,10 +71,10 @@ int main(int argc , char ** argv) {
|
||||
test_assert_true( fmt_file );
|
||||
|
||||
test_assert_true( ecl_util_fmt_file( "TEST.EGRID" , &fmt_file ));
|
||||
test_assert_false( fmt_file );
|
||||
test_assert_false( fmt_file );
|
||||
|
||||
test_assert_true( ecl_util_fmt_file( "TEST.FEGRID" , &fmt_file ));
|
||||
test_assert_true( fmt_file );
|
||||
test_assert_true( fmt_file );
|
||||
|
||||
test_assert_false(ecl_util_fmt_file( "TEST_DOES_NOT_EXIST" , &fmt_file ));
|
||||
|
@ -18,13 +18,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/vector.hpp>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
|
||||
void test_existing_read(const char * filename) {
|
||||
fortio_type * fortio = fortio_open_reader( filename , false , ECL_ENDIAN_FLIP);
|
||||
@ -114,7 +114,7 @@ void test_fread_truncated_data() {
|
||||
test_work_area_type * work_area = test_work_area_alloc("fortio_truncated" );
|
||||
{
|
||||
const size_t buffer_size = 1000;
|
||||
void * buffer = util_malloc( buffer_size );
|
||||
char * buffer = (char *) util_malloc( buffer_size );
|
||||
{
|
||||
fortio_type * fortio = fortio_open_writer( "PRESSURE" , false , true );
|
||||
|
||||
@ -149,7 +149,7 @@ void test_fread_truncated_head() {
|
||||
|
||||
{
|
||||
fortio_type * fortio = fortio_open_reader( "PRESSURE" , false , true );
|
||||
void * buffer = NULL;
|
||||
char * buffer = NULL;
|
||||
int buffer_size = 10;
|
||||
test_assert_false( fortio_fread_buffer( fortio , buffer , buffer_size ));
|
||||
test_assert_true( fortio_read_at_eof( fortio ));
|
||||
@ -164,7 +164,7 @@ void test_fread_truncated_tail() {
|
||||
test_work_area_type * work_area = test_work_area_alloc("fortio_truncated2" );
|
||||
{
|
||||
const size_t buffer_size = 1000;
|
||||
void * buffer = util_malloc( buffer_size );
|
||||
char * buffer = (char *) util_malloc( buffer_size );
|
||||
{
|
||||
fortio_type * fortio = fortio_open_writer( "PRESSURE" , false , true );
|
||||
|
||||
@ -190,7 +190,7 @@ void test_fread_truncated_tail() {
|
||||
void test_fread_invalid_tail() {
|
||||
test_work_area_type * work_area = test_work_area_alloc("fortio_invalid" );
|
||||
int record_size = 10;
|
||||
void * buffer = util_malloc( record_size );
|
||||
char * buffer = (char *) util_malloc( record_size );
|
||||
{
|
||||
FILE * stream = util_fopen("PRESSURE" , "w");
|
||||
|
||||
@ -224,7 +224,7 @@ void test_at_eof() {
|
||||
test_work_area_type * work_area = test_work_area_alloc("fortio_truncated2" );
|
||||
{
|
||||
fortio_type * fortio = fortio_open_writer("PRESSURE" , false , true);
|
||||
void * buffer = util_malloc( 100 );
|
||||
char * buffer = (char *) util_malloc( 100 );
|
||||
|
||||
fortio_fwrite_record( fortio , buffer , 100);
|
||||
free( buffer );
|
||||
@ -251,7 +251,7 @@ void test_fseek() {
|
||||
test_work_area_type * work_area = test_work_area_alloc("fortio_fseek" );
|
||||
{
|
||||
fortio_type * fortio = fortio_open_writer("PRESSURE" , false , true);
|
||||
void * buffer = util_malloc( 100 );
|
||||
char * buffer = (char *) util_malloc( 100 );
|
||||
|
||||
fortio_fwrite_record( fortio , buffer , 100);
|
||||
free( buffer );
|
||||
@ -280,7 +280,7 @@ void test_write_failure() {
|
||||
test_work_area_type * work_area = test_work_area_alloc("fortio_fseek" );
|
||||
{
|
||||
fortio_type * fortio = fortio_open_writer("PRESSURE" , false , true);
|
||||
void * buffer = util_malloc( 100 );
|
||||
char * buffer = (char *) util_malloc( 100 );
|
||||
|
||||
fortio_fwrite_record( fortio , buffer , 100);
|
||||
test_assert_true( util_file_exists( "PRESSURE"));
|
@ -1,26 +1,26 @@
|
||||
/*
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_get_num_cpu_test.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.
|
||||
Copyright (C) 2012 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_get_num_cpu_test.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
const char * filename1 = argv[1];
|
@ -1,27 +1,27 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_DEPTHZ.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_DEPTHZ.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 <stdbool.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
double zfunc(double x , double y) {
|
||||
@ -33,7 +33,7 @@ double center_sum(const double * DV, int index) {
|
||||
|
||||
for (int i=0; i < index; i++)
|
||||
sum += DV[i];
|
||||
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
@ -44,10 +44,10 @@ void test_create() {
|
||||
int ny = 100;
|
||||
int nz = 10;
|
||||
|
||||
double * DXV = util_malloc( nx * sizeof * DXV );
|
||||
double * DYV = util_malloc( ny * sizeof * DYV );
|
||||
double * DZV = util_malloc( nz * sizeof * DZV );
|
||||
double * DEPTHZ = util_malloc( (nx + 1) * (ny + 1) * sizeof * DEPTHZ);
|
||||
double * DXV = (double *) util_malloc( nx * sizeof * DXV );
|
||||
double * DYV = (double *) util_malloc( ny * sizeof * DYV );
|
||||
double * DZV = (double *) util_malloc( nz * sizeof * DZV );
|
||||
double * DEPTHZ = (double *) util_malloc( (nx + 1) * (ny + 1) * sizeof * DEPTHZ);
|
||||
|
||||
for (int i=0; i < nx; i++)
|
||||
DXV[i] = 1.0 / nx;
|
||||
@ -57,19 +57,19 @@ void test_create() {
|
||||
|
||||
for (int k=0; k < nz; k++)
|
||||
DZV[k] = 3.0 / nz;
|
||||
|
||||
|
||||
|
||||
for (int j=0; j <= ny; j++) {
|
||||
double y = center_sum(DYV , j);
|
||||
for (int i=0; i <= nx; i++) {
|
||||
double x = center_sum(DXV , i);
|
||||
|
||||
|
||||
DEPTHZ[i + j*(nx + 1)] = zfunc( x,y );
|
||||
}
|
||||
}
|
||||
|
||||
ecl_grid = ecl_grid_alloc_dxv_dyv_dzv_depthz( nx,ny,nz,DXV , DYV , DZV , DEPTHZ , NULL);
|
||||
|
||||
|
||||
for (int k=0; k < nz; k++) {
|
||||
double z0 = center_sum(DZV , k ) - 0.5*DZV[0];
|
||||
for (int j=0; j < ny; j++) {
|
||||
@ -78,8 +78,8 @@ void test_create() {
|
||||
double x0 = center_sum(DXV , i );
|
||||
double xc,yc,zc;
|
||||
int g = ecl_grid_get_global_index3( ecl_grid , i , j , k );
|
||||
|
||||
ecl_grid_get_xyz1( ecl_grid , g , &xc , &yc , &zc);
|
||||
|
||||
ecl_grid_get_xyz1( ecl_grid , g , &xc , &yc , &zc);
|
||||
test_assert_double_equal( x0 , xc );
|
||||
test_assert_double_equal( y0 , yc );
|
||||
|
||||
@ -117,10 +117,10 @@ void test_compare() {
|
||||
ecl_grid_type * grid2;
|
||||
|
||||
{
|
||||
double * DX = util_malloc( V * sizeof * DX );
|
||||
double * DY = util_malloc( V * sizeof * DY );
|
||||
double * DZ = util_malloc( V * sizeof * DZ );
|
||||
double * TOPS = util_malloc( V * sizeof * TOPS );
|
||||
double * DX = (double *) util_malloc( V * sizeof * DX );
|
||||
double * DY = (double *) util_malloc( V * sizeof * DY );
|
||||
double * DZ = (double *) util_malloc( V * sizeof * DZ );
|
||||
double * TOPS = (double *) util_malloc( V * sizeof * TOPS );
|
||||
|
||||
for (int i = 0; i < V; i++) {
|
||||
DX[i] = dx;
|
||||
@ -149,31 +149,31 @@ void test_compare() {
|
||||
}
|
||||
|
||||
{
|
||||
double * DXV = util_malloc( nx * sizeof * DXV );
|
||||
double * DYV = util_malloc( ny * sizeof * DYV );
|
||||
double * DZV = util_malloc( nz * sizeof * DZV );
|
||||
double * DEPTHZ = util_malloc( (nx + 1)*(ny + 1) * sizeof * DEPTHZ);
|
||||
double * DXV = (double *) util_malloc( nx * sizeof * DXV );
|
||||
double * DYV = (double *) util_malloc( ny * sizeof * DYV );
|
||||
double * DZV = (double *) util_malloc( nz * sizeof * DZV );
|
||||
double * DEPTHZ = (double *) util_malloc( (nx + 1)*(ny + 1) * sizeof * DEPTHZ);
|
||||
|
||||
for (int i = 0; i < nx; i++)
|
||||
for (int i = 0; i < nx; i++)
|
||||
DXV[i] = dx;
|
||||
|
||||
for (int i = 0; i < ny; i++)
|
||||
for (int i = 0; i < ny; i++)
|
||||
DYV[i] = dy;
|
||||
|
||||
for (int i = 0; i < nz; i++)
|
||||
for (int i = 0; i < nz; i++)
|
||||
DZV[i] = dz;
|
||||
|
||||
for (int i = 0; i < (nx + 1)*(ny+ 1); i++)
|
||||
|
||||
for (int i = 0; i < (nx + 1)*(ny+ 1); i++)
|
||||
DEPTHZ[i] = z0;
|
||||
|
||||
|
||||
|
||||
grid2 = ecl_grid_alloc_dxv_dyv_dzv_depthz( nx , ny , nz , DXV , DYV , DZV , DEPTHZ , NULL );
|
||||
free( DXV );
|
||||
free( DYV );
|
||||
free( DZV );
|
||||
free( DEPTHZ );
|
||||
}
|
||||
|
||||
|
||||
test_assert_true( ecl_grid_compare( grid1 , grid2 , true , true , true));
|
||||
ecl_grid_free( grid1 );
|
||||
ecl_grid_free( grid2 );
|
@ -18,11 +18,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
void verify_simple_nnc( const ecl_grid_type * grid) {
|
@ -1,26 +1,26 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_case.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_case.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
void test_grid( const char * input , bool expected) {
|
||||
@ -36,11 +36,11 @@ void test_grid( const char * input , bool expected) {
|
||||
int main(int argc , char ** argv) {
|
||||
const char * grid_file = argv[1];
|
||||
const char * case_path = argv[2];
|
||||
|
||||
|
||||
test_grid( grid_file , true );
|
||||
test_grid( case_path , true );
|
||||
test_grid( "/tmp/does/not/exists/file.EGRID" , false );
|
||||
test_grid( "/tmp/does/not/exists/CASE" , false );
|
||||
|
||||
|
||||
exit(0);
|
||||
}
|
@ -21,8 +21,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
bool get_test_point1(const ecl_grid_type * grid , int global_index, double *_xpos , double *_ypos , double *_zpos) {
|
@ -21,9 +21,9 @@
|
||||
#include <stdbool.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/util/vector.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/util/vector.hpp>
|
||||
|
||||
|
||||
typedef struct {
|
||||
@ -50,7 +50,7 @@ vector_type * load_expected( const ecl_grid_type * grid, const char * filename )
|
||||
int i,j,k,skip;
|
||||
|
||||
if (fscanf( stream , "%lg %lg %lg %d %d %d %d" , &x,&y,&z,&i,&j,&k,&skip) == 7) {
|
||||
point_type * p = util_malloc( sizeof * p );
|
||||
point_type * p = (point_type *) util_malloc( sizeof * p );
|
||||
p->x = x;
|
||||
p->y = y;
|
||||
p->z = z;
|
||||
@ -71,7 +71,7 @@ vector_type * load_expected( const ecl_grid_type * grid, const char * filename )
|
||||
}
|
||||
|
||||
|
||||
void test_well_point(const ecl_grid_type * grid, const point_type * expected) {
|
||||
void test_well_point(ecl_grid_type * grid, const point_type * expected) {
|
||||
int g = ecl_grid_get_global_index_from_xyz(grid , expected->x, expected->y , expected->z , 0 );
|
||||
if (g != ecl_grid_get_global_index3(grid, expected->i,expected->j, expected->k)) {
|
||||
int i,j,k;
|
||||
@ -98,7 +98,7 @@ int main(int argc , char ** argv) {
|
||||
vector_type * expected = load_expected( grid, argv[2] );
|
||||
|
||||
for (int c=0; c < vector_get_size( expected ); c++) {
|
||||
const point_type * p = vector_iget_const( expected , c );
|
||||
const point_type * p = (const point_type *) vector_iget_const( expected , c );
|
||||
test_well_point(grid, p);
|
||||
}
|
||||
ecl_grid_free( grid );
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_cell_contains.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
|
||||
|
||||
void test_cells( const ecl_grid_type * grid ) {
|
||||
int error_count = 0;
|
||||
int global_index;
|
||||
for (global_index = 0; global_index < ecl_grid_get_global_size( grid ); global_index++) {
|
||||
if ((abs(ecl_grid_get_cell_volume1( grid , global_index)) + abs(ecl_grid_get_cell_volume1_tskille( grid , global_index))) > 1e-9) {
|
||||
if (!test_check_double_equal( ecl_grid_get_cell_volume1( grid , global_index) , ecl_grid_get_cell_volume1_tskille( grid , global_index))) {
|
||||
fprintf(stderr," Global index:%d \n",global_index);
|
||||
error_count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
test_assert_int_equal(0 , error_count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
ecl_grid_type * grid;
|
||||
|
||||
if (argc == 1)
|
||||
grid = ecl_grid_alloc_rectangular(6,6,6,1,2,3,NULL);
|
||||
else
|
||||
grid = ecl_grid_alloc( argv[1] );
|
||||
|
||||
test_cells( grid );
|
||||
ecl_grid_free( grid );
|
||||
exit(0);
|
||||
}
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_copy.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_copy.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.
|
||||
*/
|
||||
|
||||
|
||||
@ -24,11 +24,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/time_t_vector.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/time_t_vector.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
void test_copy_grid( const ecl_grid_type * grid ) {
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_copy_statoil.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_copy_statoil.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.
|
||||
*/
|
||||
|
||||
|
||||
@ -24,11 +24,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/time_t_vector.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/time_t_vector.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
void test_copy_grid( const char * filename ) {
|
@ -18,9 +18,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
void invalid_call1( void * arg ) {
|
@ -1,28 +1,28 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_create.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_create.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 <stdbool.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
|
||||
@ -30,15 +30,15 @@ void test_create2() {
|
||||
int nx = 10;
|
||||
int ny = 8;
|
||||
int nz = 5;
|
||||
double * dx = util_calloc( nx*ny*nz , sizeof * dx );
|
||||
double * dy = util_calloc( nx*ny*nz , sizeof * dy );
|
||||
double * dz = util_calloc( nx*ny*nz , sizeof * dz );
|
||||
double * tops = util_calloc( nx*ny*nz , sizeof * dz );
|
||||
double * dx = (double *) util_calloc( nx*ny*nz , sizeof * dx );
|
||||
double * dy = (double *) util_calloc( nx*ny*nz , sizeof * dy );
|
||||
double * dz = (double *) util_calloc( nx*ny*nz , sizeof * dz );
|
||||
double * tops = (double *) util_calloc( nx*ny*nz , sizeof * dz );
|
||||
for (int k=0; k< nz; k++) {
|
||||
for (int j=0; j < ny; j++) {
|
||||
for (int i=0; i < nx; i++) {
|
||||
int g = k*nx*ny + j*nx + i;
|
||||
|
||||
|
||||
dx[g] = (i+1);
|
||||
dy[g] = (j+1);
|
||||
dz[g] = (k+1);
|
||||
@ -49,25 +49,25 @@ void test_create2() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
ecl_grid_type * grid = ecl_grid_alloc_dx_dy_dz_tops( nx , ny , nz , dx , dy , dz , tops , NULL );
|
||||
|
||||
|
||||
test_assert_int_equal( nx*ny*nz , ecl_grid_get_global_size( grid ));
|
||||
test_assert_int_equal( nx*ny*nz , ecl_grid_get_active_size( grid ));
|
||||
|
||||
|
||||
for (int k=0; k< nz; k++) {
|
||||
for (int j=0; j < ny; j++) {
|
||||
for (int i=0; i < nx; i++) {
|
||||
int g = k*nx*ny + j*nx + i;
|
||||
|
||||
|
||||
test_assert_double_equal( ecl_grid_get_cell_volume1( grid , g ) , dx[g] * dy[g] * dz[g]);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
double x,y,z;
|
||||
|
||||
|
||||
ecl_grid_get_xyz1(grid , 0 , &x , &y , &z);
|
||||
test_assert_double_equal( x , dx[0] * 0.5 );
|
||||
test_assert_double_equal( y , dy[0] * 0.5 );
|
||||
@ -86,15 +86,15 @@ void test_create1() {
|
||||
int nx = 10;
|
||||
int ny = 10;
|
||||
int nz = 10;
|
||||
double * dx = util_calloc( nx*ny*nz , sizeof * dx );
|
||||
double * dy = util_calloc( nx*ny*nz , sizeof * dy );
|
||||
double * dz = util_calloc( nx*ny*nz , sizeof * dz );
|
||||
double * tops = util_calloc( nx*ny*nz , sizeof * tops );
|
||||
double * dx = (double *) util_calloc( nx*ny*nz , sizeof * dx );
|
||||
double * dy = (double *) util_calloc( nx*ny*nz , sizeof * dy );
|
||||
double * dz = (double *) util_calloc( nx*ny*nz , sizeof * dz );
|
||||
double * tops = (double *) util_calloc( nx*ny*nz , sizeof * tops );
|
||||
for (int k=0; k< nz; k++) {
|
||||
for (int j=0; j < ny; j++) {
|
||||
for (int i=0; i < nx; i++) {
|
||||
int g = k*nx*ny + j*nx + i;
|
||||
|
||||
|
||||
dx[g] = 1;
|
||||
dy[g] = 1;
|
||||
dz[g] = 1;
|
||||
@ -105,18 +105,18 @@ void test_create1() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
ecl_grid_type * grid = ecl_grid_alloc_dx_dy_dz_tops( nx , ny , nz , dx , dy , dz , tops , NULL );
|
||||
|
||||
|
||||
test_assert_int_equal( nx*ny*nz , ecl_grid_get_global_size( grid ));
|
||||
test_assert_int_equal( nx*ny*nz , ecl_grid_get_active_size( grid ));
|
||||
|
||||
|
||||
for (int k=0; k< nz; k++) {
|
||||
for (int j=0; j < ny; j++) {
|
||||
for (int i=0; i < nx; i++) {
|
||||
int g = k*nx*ny + j*nx + i;
|
||||
|
||||
|
||||
test_assert_double_equal( ecl_grid_get_cell_volume1( grid , g ) , dx[g] * dy[g] * dz[g]);
|
||||
|
||||
{
|
@ -1,29 +1,29 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_dims.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_dims.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 <stdbool.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid_dims.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_grid_dims.hpp>
|
||||
|
||||
|
||||
|
||||
@ -34,10 +34,10 @@ void test_grid( const char * grid_filename , const char * data_filename) {
|
||||
test_assert_not_NULL( grid_dims );
|
||||
test_assert_int_equal( ecl_grid_get_num_lgr( ecl_grid ) + 1 , ecl_grid_dims_get_num_grids( grid_dims ));
|
||||
for (int i=0; i < ecl_grid_dims_get_num_grids( grid_dims ); i++) {
|
||||
|
||||
|
||||
grid_dims_type d1 = ecl_grid_iget_dims( ecl_grid , i);
|
||||
const grid_dims_type * d2 = ecl_grid_dims_iget_dims( grid_dims , i );
|
||||
|
||||
|
||||
test_assert_int_equal( d1.nx , d2->nx );
|
||||
test_assert_int_equal( d1.ny , d2->ny );
|
||||
test_assert_int_equal( d1.nz , d2->nz );
|
||||
@ -51,14 +51,14 @@ void test_grid( const char * grid_filename , const char * data_filename) {
|
||||
void test_dims() {
|
||||
grid_dims_type d1;
|
||||
grid_dims_type * d2 = grid_dims_alloc( 100 , 100 , 100 , 0);
|
||||
|
||||
|
||||
grid_dims_init(&d1 , 100 , 100 , 100 , 0 );
|
||||
|
||||
|
||||
test_assert_int_equal( d1.nx , d2->nx );
|
||||
test_assert_int_equal( d1.ny , d2->ny );
|
||||
test_assert_int_equal( d1.nz , d2->nz );
|
||||
test_assert_int_equal( d1.nactive , d2->nactive );
|
||||
|
||||
|
||||
grid_dims_free( d2 );
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ int main(int argc , char ** argv) {
|
||||
} else {
|
||||
const char * GRID_file = argv[1];
|
||||
char * data_file;
|
||||
|
||||
|
||||
if (argc == 3)
|
||||
data_file = argv[2];
|
||||
else
|
||||
@ -82,6 +82,6 @@ int main(int argc , char ** argv) {
|
||||
|
||||
test_grid( GRID_file , data_file );
|
||||
}
|
||||
|
||||
|
||||
exit(0);
|
||||
}
|
@ -18,17 +18,17 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
|
||||
|
||||
void export_actnum( const ecl_grid_type * ecl_grid , ecl_file_type * ecl_file ) {
|
||||
ecl_kw_type * actnum_kw = ecl_file_iget_named_kw( ecl_file , "ACTNUM" , 0 );
|
||||
int * actnum = util_malloc( ecl_kw_get_size( actnum_kw ) * sizeof * actnum );
|
||||
int * actnum = (int *) util_malloc( ecl_kw_get_size( actnum_kw ) * sizeof * actnum );
|
||||
|
||||
ecl_grid_init_actnum_data( ecl_grid , actnum );
|
||||
for (int i=0; i < ecl_kw_get_size( actnum_kw); i++)
|
||||
@ -42,8 +42,8 @@ void export_coord( const ecl_grid_type * grid , ecl_file_type * ecl_file ) {
|
||||
ecl_kw_type * coord_kw = ecl_file_iget_named_kw( ecl_file , "COORD" , 0);
|
||||
test_assert_int_equal( ecl_kw_get_size( coord_kw ) , ecl_grid_get_coord_size( grid ));
|
||||
{
|
||||
float * coord_float = util_malloc( ecl_grid_get_coord_size( grid ) * sizeof * coord_float );
|
||||
double * coord_double = util_malloc( ecl_grid_get_coord_size( grid ) * sizeof * coord_double );
|
||||
float * coord_float = (float *) util_malloc( ecl_grid_get_coord_size( grid ) * sizeof * coord_float );
|
||||
double * coord_double = (double *) util_malloc( ecl_grid_get_coord_size( grid ) * sizeof * coord_double );
|
||||
|
||||
ecl_grid_init_coord_data( grid , coord_float );
|
||||
ecl_grid_init_coord_data_double( grid , coord_double );
|
||||
@ -61,8 +61,8 @@ void export_zcorn( const ecl_grid_type * grid , ecl_file_type * ecl_file ) {
|
||||
ecl_kw_type * zcorn_kw = ecl_file_iget_named_kw( ecl_file , "ZCORN" , 0);
|
||||
test_assert_int_equal( ecl_kw_get_size( zcorn_kw ) , ecl_grid_get_zcorn_size( grid ));
|
||||
{
|
||||
float * zcorn_float = util_malloc( ecl_grid_get_zcorn_size( grid ) * sizeof * zcorn_float );
|
||||
double * zcorn_double = util_malloc( ecl_grid_get_zcorn_size( grid ) * sizeof * zcorn_double );
|
||||
float * zcorn_float = (float *) util_malloc( ecl_grid_get_zcorn_size( grid ) * sizeof * zcorn_float );
|
||||
double * zcorn_double = (double *) util_malloc( ecl_grid_get_zcorn_size( grid ) * sizeof * zcorn_double );
|
||||
|
||||
ecl_grid_init_zcorn_data( grid , zcorn_float );
|
||||
ecl_grid_init_zcorn_data_double( grid , zcorn_double );
|
||||
@ -88,7 +88,7 @@ void copy_processed( const ecl_grid_type * src ) {
|
||||
|
||||
|
||||
{
|
||||
int * actnum = util_malloc( ecl_grid_get_global_size( src ) * sizeof * actnum );
|
||||
int * actnum = (int *) util_malloc( ecl_grid_get_global_size( src ) * sizeof * actnum );
|
||||
int index = 0;
|
||||
ecl_grid_init_actnum_data( src , actnum );
|
||||
|
||||
@ -110,7 +110,7 @@ void copy_processed( const ecl_grid_type * src ) {
|
||||
|
||||
|
||||
{
|
||||
double * zcorn_double = util_malloc( ecl_grid_get_zcorn_size( src ) * sizeof * zcorn_double );
|
||||
double * zcorn_double = (double *) util_malloc( ecl_grid_get_zcorn_size( src ) * sizeof * zcorn_double );
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
@ -122,7 +122,7 @@ void copy_processed( const ecl_grid_type * src ) {
|
||||
ecl_grid_free( copy );
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int c = 0; c < 4; c++) {
|
||||
double dz = zcorn_double[ ecl_grid_zcorn_index( src , i , j , k , c + 4 ) ] - zcorn_double[ ecl_grid_zcorn_index( src , i , j , k , c ) ];
|
||||
zcorn_double[ ecl_grid_zcorn_index( src , i , j , k , c + 4 ) ] += dz;
|
||||
@ -156,8 +156,8 @@ void export_mapaxes( const ecl_grid_type * grid , ecl_file_type * ecl_file ) {
|
||||
int main(int argc , char ** argv) {
|
||||
test_work_area_type * work_area = test_work_area_alloc("grid_export");
|
||||
{
|
||||
char * test_grid = "TEST.EGRID";
|
||||
char * grid_file;
|
||||
const char * test_grid = "TEST.EGRID";
|
||||
const char * grid_file;
|
||||
if (argc == 1) {
|
||||
ecl_grid_type * grid = ecl_grid_alloc_rectangular(4,4,2,1,1,1,NULL);
|
||||
grid_file = test_grid;
|
||||
@ -168,6 +168,8 @@ int main(int argc , char ** argv) {
|
||||
|
||||
{
|
||||
ecl_grid_type * ecl_grid = ecl_grid_alloc( grid_file );
|
||||
if (argc == 1)
|
||||
test_assert_true( ecl_grid_get_unit_system(ecl_grid) == ECL_METRIC_UNITS );
|
||||
ecl_file_type * ecl_file = ecl_file_open( grid_file , 0) ;
|
||||
|
||||
export_actnum( ecl_grid , ecl_file );
|
@ -1,33 +1,33 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_kw_fwrite.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_kw_fwrite.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
void test_fwrite_EGRID(ecl_grid_type * grid ) {
|
||||
test_work_area_type * work_area = test_work_area_alloc("grid-has-mapaxes");
|
||||
|
||||
|
||||
ecl_grid_fwrite_EGRID2( grid , "TEST.EGRID", ECL_METRIC_UNITS);
|
||||
{
|
||||
ecl_grid_type * copy = ecl_grid_alloc( "TEST.EGRID" );
|
||||
@ -41,7 +41,7 @@ void test_fwrite_EGRID(ecl_grid_type * grid ) {
|
||||
int main( int argc , char **argv) {
|
||||
const char * src_file = argv[1];
|
||||
ecl_grid_type * grid = ecl_grid_alloc( src_file );
|
||||
|
||||
|
||||
test_fwrite_EGRID( grid );
|
||||
|
||||
ecl_grid_free( grid );
|
@ -18,15 +18,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
|
||||
|
||||
|
@ -1,32 +1,32 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_layer_contains' 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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_layer_contains' 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 <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
void test_layer(const ecl_grid_type * grid ) {
|
||||
int g;
|
||||
|
||||
|
||||
for (g=0; g < ecl_grid_get_global_size( grid ); g += 25) {
|
||||
double x,y,z;
|
||||
int i,j,k;
|
||||
@ -39,7 +39,7 @@ void test_layer(const ecl_grid_type * grid ) {
|
||||
test_assert_int_equal( i , find_i );
|
||||
test_assert_int_equal( j , find_j );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,48 +1,48 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_lgr_name.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_lgr_name.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
/*
|
||||
Name ..................: LG003017
|
||||
Grid nr ...............: 104
|
||||
Name ..................: LG003017
|
||||
Grid nr ...............: 104
|
||||
|
||||
Name ..................: LG006024
|
||||
Grid nr ...............: 2
|
||||
Name ..................: LG006024
|
||||
Grid nr ...............: 2
|
||||
|
||||
Name ..................: LG005025
|
||||
Grid nr ...............: 4
|
||||
Name ..................: LG005025
|
||||
Grid nr ...............: 4
|
||||
|
||||
Name ..................: LG011029
|
||||
Grid nr ...............: 82
|
||||
Name ..................: LG011029
|
||||
Grid nr ...............: 82
|
||||
|
||||
Name ..................: LG007021
|
||||
Grid nr ...............: 100
|
||||
Name ..................: LG007021
|
||||
Grid nr ...............: 100
|
||||
|
||||
Name ..................: LG003014
|
||||
Grid nr ...............: 110
|
||||
Name ..................: LG003014
|
||||
Grid nr ...............: 110
|
||||
|
||||
Name ..................: /private/joaho/ERT/git/ert/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID
|
||||
Name ..................: /private/joaho/ERT/git/ert/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID
|
||||
*/
|
||||
|
||||
|
@ -1,26 +1,26 @@
|
||||
/*
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_reset_actnum.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.
|
||||
Copyright (C) 2014 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_reset_actnum.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ int main(int argc , char ** argv) {
|
||||
const int actnum2[] = {0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0};
|
||||
ecl_grid_type * grid = ecl_grid_alloc_rectangular(nx , ny , nz , 1 , 1 , 1 , actnum1 );
|
||||
|
||||
|
||||
|
||||
test_assert_int_equal( g , ecl_grid_get_nactive( grid ));
|
||||
ecl_grid_reset_actnum(grid , actnum2 );
|
||||
test_assert_int_equal( nactive , ecl_grid_get_nactive( grid ));
|
||||
@ -58,8 +58,8 @@ int main(int argc , char ** argv) {
|
||||
test_assert_int_equal( 1 , ecl_grid_get_global_index1A( grid , 1 ));
|
||||
test_assert_int_equal( 2 , ecl_grid_get_global_index1A( grid , 2 ));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ecl_grid_free( grid );
|
||||
exit(0);
|
||||
}
|
@ -1,33 +1,33 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_simple.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_grid_simple.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
const char * grid_file = argv[1];
|
||||
ecl_grid_type * ecl_grid = ecl_grid_alloc( grid_file );
|
||||
|
||||
|
||||
test_assert_int_equal( ecl_grid_get_nactive_fracture( ecl_grid ) , 0 );
|
||||
test_assert_int_equal( ecl_grid_get_active_fracture_index1( ecl_grid , 10 ) , -1 );
|
||||
|
@ -20,12 +20,12 @@
|
||||
#include <signal.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
|
||||
|
||||
|
@ -19,16 +19,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_init_file.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_grid.hpp>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_init_file.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
|
||||
void test_write_header() {
|
@ -19,9 +19,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
|
||||
|
@ -1,27 +1,27 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_kw_equal.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_kw_equal.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_type.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/ecl_type.hpp>
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
@ -35,7 +35,7 @@ int main(int argc , char ** argv) {
|
||||
|
||||
{
|
||||
ecl_kw_type * ecl_kw2 = ecl_kw_alloc_copy( ecl_kw1 );
|
||||
|
||||
|
||||
test_assert_true( ecl_kw_equal( ecl_kw1 , ecl_kw2 ));
|
||||
|
||||
ecl_kw_iset_int( ecl_kw2 , 1 , 77 );
|
||||
@ -56,11 +56,11 @@ int main(int argc , char ** argv) {
|
||||
test_assert_true( ecl_kw_content_equal( ecl_kw1 , ecl_ikw ));
|
||||
test_assert_false( ecl_kw_content_equal( ecl_kw1 , ecl_fkw ));
|
||||
}
|
||||
|
||||
|
||||
test_assert_true( ecl_kw_data_equal( ecl_kw1 , data ));
|
||||
data[0] = 99;
|
||||
test_assert_false( ecl_kw_data_equal( ecl_kw1 , data ));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -18,15 +18,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_endian_flip.hpp>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
#include <ert/ecl/fortio.h>
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_file_view.h>
|
||||
#include <ert/ecl/ecl_file.hpp>
|
||||
#include <ert/ecl/ecl_file_view.hpp>
|
||||
|
||||
|
||||
void test_truncated(const char * filename , offset_type truncate_size) {
|
||||
@ -79,7 +79,7 @@ void test_fread_alloc() {
|
||||
|
||||
void test_kw_io_charlength() {
|
||||
test_work_area_type * work_area = test_work_area_alloc("ecl_kw_io_charlength");
|
||||
{
|
||||
{
|
||||
const char * KW0 = "QWERTYUI";
|
||||
const char * KW1 = "ABCDEFGHIJTTTTTTTTTTTTTTTTTTTTTTABCDEFGHIJKLMNOP";
|
||||
ecl_kw_type * ecl_kw_out0 = ecl_kw_alloc(KW0 , 5, ECL_FLOAT);
|
||||
@ -99,13 +99,13 @@ void test_kw_io_charlength() {
|
||||
{
|
||||
test_assert_false( util_file_exists( "TEST1"));
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
FILE * file = util_fopen("TEST2", "w");
|
||||
ecl_kw_fprintf_grdecl(ecl_kw_out1 , file);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
FILE * file = util_fopen("TEST2", "r");
|
||||
ecl_kw_type * ecl_kw_in = ecl_kw_fscanf_alloc_grdecl( file , KW1 , -1 , ECL_FLOAT);
|
||||
@ -117,7 +117,7 @@ void test_kw_io_charlength() {
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
|
||||
ecl_kw_free( ecl_kw_out0 );
|
||||
ecl_kw_free( ecl_kw_out1 );
|
||||
}
|
@ -1,34 +1,34 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_kw_grdecl.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.
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'ecl_kw_grdecl.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 <stdbool.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_work_area.h>
|
||||
#include <ert/util/test_work_area.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
int main(int argc , char ** argv) {
|
||||
int i;
|
||||
ecl_kw_type * ecl_kw = ecl_kw_alloc("HEAD" , 10 , ECL_INT);
|
||||
|
||||
for (i=0; i < 10; i++)
|
||||
for (i=0; i < 10; i++)
|
||||
ecl_kw_iset_int(ecl_kw , i , i );
|
||||
|
||||
{
|
||||
@ -37,11 +37,11 @@ int main(int argc , char ** argv) {
|
||||
|
||||
ecl_kw_fprintf_grdecl(ecl_kw , stream );
|
||||
fclose(stream);
|
||||
|
||||
|
||||
stream = util_fopen( "FILE.grdecl" , "r");
|
||||
{
|
||||
ecl_kw_type * ecl_kw2 = ecl_kw_fscanf_alloc_grdecl( stream , "HEAD" , 10 , ECL_INT);
|
||||
|
||||
|
||||
test_assert_not_NULL( ecl_kw2 );
|
||||
test_assert_true( ecl_kw_equal( ecl_kw , ecl_kw2));
|
||||
ecl_kw_free( ecl_kw2 );
|
||||
@ -55,11 +55,11 @@ int main(int argc , char ** argv) {
|
||||
stream = util_fopen( "FILE.grdecl" , "r");
|
||||
{
|
||||
ecl_kw_type * ecl_kw2 = ecl_kw_fscanf_alloc_grdecl( stream , "HEAD" , 10 , ECL_INT);
|
||||
|
||||
|
||||
test_assert_NULL( ecl_kw2 );
|
||||
ecl_kw2 = ecl_kw_fscanf_alloc_grdecl( stream , "HEAD1234" , 10 , ECL_INT);
|
||||
test_assert_not_NULL( ecl_kw2 );
|
||||
|
||||
|
||||
test_assert_string_equal( ecl_kw_get_header( ecl_kw2 ) , "HEAD1234" );
|
||||
test_assert_true( ecl_kw_content_equal( ecl_kw , ecl_kw2 ));
|
||||
ecl_kw_free( ecl_kw2 );
|
||||
@ -68,6 +68,6 @@ int main(int argc , char ** argv) {
|
||||
test_work_area_free( work_area );
|
||||
}
|
||||
ecl_kw_free( ecl_kw );
|
||||
|
||||
|
||||
exit(0);
|
||||
}
|
@ -18,15 +18,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/bool_vector.h>
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/bool_vector.hpp>
|
||||
#include <ert/util/test_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_kw.hpp>
|
||||
|
||||
|
||||
void test_int() {
|
||||
size_t N = 1000;
|
||||
int N = 1000;
|
||||
int i;
|
||||
ecl_kw_type * kw = ecl_kw_alloc("KW" , N , ECL_INT);
|
||||
for (i=0; i < N; i++)
|
||||
@ -37,7 +37,7 @@ void test_int() {
|
||||
|
||||
|
||||
void test_double() {
|
||||
size_t N = 1000;
|
||||
int N = 1000;
|
||||
double i;
|
||||
ecl_kw_type * kw = ecl_kw_alloc("KW" , N , ECL_DOUBLE);
|
||||
for (i=0; i < N; i++)
|
||||
@ -48,7 +48,7 @@ void test_double() {
|
||||
|
||||
|
||||
void test_float() {
|
||||
size_t N = 1000;
|
||||
int N = 1000;
|
||||
int i;
|
||||
ecl_kw_type * kw = ecl_kw_alloc("KW" , N , ECL_FLOAT);
|
||||
for (i=0; i < N; i++)
|
||||
@ -59,8 +59,8 @@ void test_float() {
|
||||
|
||||
|
||||
void test_bool() {
|
||||
size_t N = 100;
|
||||
bool * data = util_malloc(N * sizeof * data);
|
||||
int N = 100;
|
||||
bool * data = (bool *) 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);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user