Updated ERT to GIT version a39d4b4a9e597532b2dbf845751a70ffe1de3805

p4#: 20194
This commit is contained in:
Magne Sjaastad 2013-01-18 08:53:37 +01:00
parent c74619e79a
commit 2cf0e32d4b
371 changed files with 3585 additions and 67776 deletions

View File

@ -217,7 +217,7 @@ set( LINK_LIBRARIES
LibCore
ecl
util
ert_util
geometry
well

View File

@ -67,7 +67,7 @@ set( LINK_LIBRARIES
LibCore
ecl
util
ert_util
geometry
well

View File

@ -38,7 +38,7 @@ set( LINK_LIBRARIES
ecl
well
util
ert_util
${QT_LIBRARIES}
)

View File

@ -49,10 +49,10 @@ add_subdirectory(ThirdParty/Ert/devel)
include_directories(
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/src
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libutil/src
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libert_util/src
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libgeometry/src
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libwell/src
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libutil/src
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/src
)

View File

@ -1,6 +1,7 @@
cmake_minimum_required( VERSION 2.6 )
project( ERT C CXX )
include( CheckFunctionExists )
ENABLE_TESTING()
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@ -29,6 +30,9 @@ else()
set( LIBRARY_TYPE STATIC )
endif()
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
#-----------------------------------------------------------------
find_library( ZLIB_LIBRARY NAMES z )
find_path( ZLIB_HEADER zlib.h /usr/include )
@ -152,10 +156,6 @@ if (HAVE_LOCKF)
add_definitions( -DHAVE_LOCKF )
endif()
check_function_exists( isfinite HAVE_ISFINITE )
if (HAVE_ISFINITE)
add_definitions( -DHAVE_ISFINITE )
endif()
check_function_exists( glob HAVE_GLOB )
if (HAVE_GLOB)
@ -177,6 +177,8 @@ if (HAVE_SETENV)
add_definitions( -DPOSIX_SETENV )
endif()
check_function_exists( opendir HAVE_OPENDIR )
if (HAVE_OPENDIR)
add_definitions( -DHAVE_OPENDIR )
@ -187,6 +189,11 @@ if (HAVE_OPENDIR)
add_definitions( -DHAVE_USLEEP )
endif()
try_compile( HAVE_ISFINITE ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/CMake/Tests/test_isfinite.c )
if (HAVE_ISFINITE)
add_definitions( -DHAVE_ISFINITE )
endif()
try_compile( MKDIR_POSIX ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/CMake/Tests/test_mkdir.c )
if (MKDIR_POSIX)
add_definitions( -DMKDIR_POSIX )
@ -199,7 +206,6 @@ endif()
try_compile( HAVE_VA_COPY ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/CMake/Tests/test_va_copy.c )
if (HAVE_VA_COPY)
message("Have va_copy() macro")
add_definitions( -DHAVE_VA_COPY )
endif()
@ -212,6 +218,7 @@ endif()
if (ERT_LINUX)
set( NEED_LIBM TRUE )
set( LINK_STATIC FALSE )
add_definitions( -DHAVE_PROC )
else()
set( NEED_LIBM FALSE )
set( LINK_STATIC TRUE )
@ -221,34 +228,41 @@ endif()
configure_file( ${PROJECT_SOURCE_DIR}/CMake/config/ert_build_config.h.in
${PROJECT_BINARY_DIR}/ert_build_config.h )
set( libert_util_build_path ${PROJECT_BINARY_DIR}/libutil/src )
set( libert_util_src_path ${PROJECT_SOURCE_DIR}/libutil/src )
set( libert_util_build_path ${PROJECT_BINARY_DIR}/libert_util/src )
set( libert_util_src_path ${PROJECT_SOURCE_DIR}/libert_util/src )
set( libecl_src_path ${PROJECT_SOURCE_DIR}/libecl/src )
set( libgeometry_src_path ${PROJECT_SOURCE_DIR}/libgeometry/src )
set( libwell_src_path ${PROJECT_SOURCE_DIR}/libwell/src )
set( libplot_src_path ${PROJECT_SOURCE_DIR}/libplot/src )
set( BUILD_CXX ON )
set( BUILD_ERT OFF)
include_directories( ${libert_util_build_path})
include_directories( ${libert_util_src_path} )
add_subdirectory( libutil )
add_subdirectory( libert_util )
add_subdirectory( libgeometry )
add_subdirectory( libecl )
add_subdirectory( libwell )
option( BUILD_ERT "Build the full ERT application - Linux only" OFF)
option( BUILD_ENS_PLOT "Build small Eclipse plotting program - no" OFF)
#-----------------------------------------------------------------
if (BUILD_ERT)
#-----------------------------------------------------------------
try_compile( DLOPEN ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/CMake/Tests/test_dlopen.c )
if (DLOPEN)
set(NEED_LIBDL OFF)
else()
set(NEED_LIBDL ON)
endif()
option(USE_LSF "Include support for LSF" ON)
set( libconfig_src_path ${CMAKE_SOURCE_DIR}/libconfig/src )
set( libsched_src_path ${CMAKE_SOURCE_DIR}/libsched/src )
set( librms_src_path ${CMAKE_SOURCE_DIR}/librms/src )
set( libanalysis_src_path ${CMAKE_SOURCE_DIR}/libanalysis/src )
set( libjob_queue_src_path ${CMAKE_SOURCE_DIR}/libjob_queue/src )
set( libplot_src_path ${CMAKE_SOURCE_DIR}/libplot/src )
set( libenkf_src_path ${CMAKE_SOURCE_DIR}/libenkf/src )
add_subdirectory( libconfig )
@ -259,22 +273,22 @@ if (BUILD_ERT)
add_subdirectory( libplot )
add_subdirectory( libenkf)
add_dependencies( config_shared util_shared )
#add_dependencies( analysis_shared util_shared )
add_dependencies( rms_shared geometry_shared util_shared )
add_dependencies( sched_shared util_shared ecl_shared )
add_dependencies( job_queue_shared config_shared util )
add_dependencies( plot_shared util_shared )
add_dependencies( enkf_shared plot_shared ecl_shared util_shared config_shared sched_shared rms_shared analysis job_queue_shared )
add_dependencies( ert_shared enkf_shared plot_shared )
add_dependencies( config_static util_static )
#add_dependencies( analysis_static util_static )
add_dependencies( rms_static geometry_static util_static )
add_dependencies( sched_static util_static ecl_static )
add_dependencies( job_queue_static config_static util )
add_dependencies( plot_static util_static )
add_dependencies( enkf_static plot_static ecl_static util_static config_static sched_static rms_static analysis job_queue_static )
add_dependencies( ert enkf_static plot_static )
#add_dependencies( config_shared util_shared )
##add_dependencies( analysis_shared util_shared )
#add_dependencies( rms_shared geometry_shared util_shared )
#add_dependencies( sched_shared util_shared ecl_shared )
#add_dependencies( job_queue_shared config_shared util )
#add_dependencies( plot_shared util_shared )
#add_dependencies( enkf_shared plot_shared ecl_shared util_shared config_shared sched_shared rms_shared analysis job_queue_shared )
#add_dependencies( ert_shared enkf_shared plot_shared )
#
#add_dependencies( config_static util_static )
##add_dependencies( analysis_static util_static )
#add_dependencies( rms_static geometry_static util_static )
#add_dependencies( sched_static util_static ecl_static )
#add_dependencies( job_queue_static config_static util )
#add_dependencies( plot_static util_static )
#add_dependencies( enkf_static plot_static ecl_static util_static config_static sched_static rms_static analysis job_queue_static )
#add_dependencies( ert enkf_static plot_static )
endif()

View File

@ -1,15 +0,0 @@
SConscript(["libsched/SConstruct",
"librms/SConstruct",
"libecl/SConstruct",
"libwell/SConstruct",
"libanalysis/SConstruct",
"libgeometry/SConstruct",
"libjob_queue/SConstruct",
"libplot/SConstruct",
"libutil/SConstruct",
"libconfig/SConstruct",
"libenkf/SConstruct"])

View File

@ -1,7 +1,5 @@
set( ANALYSIS_INSTALL_PREFIX "" CACHE STRING "Prefix for installation of libanalysis")
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src )
include_directories( ${libutil_build_path} )
include_directories( ${libutil_src_path} )
add_subdirectory( src )

View File

@ -1 +0,0 @@
SConscript(["src/SConstruct", "applications/SConstruct"])

View File

@ -1,26 +0,0 @@
import os
import os.path
import sys
sys.path += ["../../build"]
import global_config
from global_config import LIBUTIL
from global_config import LIBANALYSIS
from global_config import get_target
from global_config import add_program
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 2)
env = Environment()
lib_list = ["lapack" , "blas" , "m" , "z" , "pthread" , "dl"]
if conf.g2c:
lib_list.append( "g2c" )
conf.update_env( env , [ LIBANALYSIS , LIBUTIL ] , ext_liblist = lib_list , link = True)
add_program(env , conf , bin_path , "analysis.x" , "main_test.c" )
add_program(env , conf , bin_path , "module_test" , "module_test.c" )
Default( bin_path )

View File

@ -1,10 +1,14 @@
# Common libanalysis library
set( source_files analysis_module.c enkf_linalg.c std_enkf.c sqrt_enkf.c cv_enkf.c bootstrap_enkf.c null_enkf.c)
set( source_files analysis_module.c enkf_linalg.c std_enkf.c sqrt_enkf.c cv_enkf.c bootstrap_enkf.c null_enkf.c fwd_step_enkf.c )
set( header_files analysis_module.h enkf_linalg.h analysis_table.h)
add_library( analysis SHARED ${source_files} )
set_target_properties( analysis PROPERTIES COMPILE_DEFINITIONS INTERNAL_LINK)
target_link_libraries( analysis )
target_link_libraries( analysis ert_util )
if (NEED_LIBDL)
target_link_libraries( analysis dl )
endif()
# List of modules
@ -15,11 +19,11 @@ add_library( sqrt_enkf MODULE sqrt_enkf.c )
#-----------------------------------------------------------------
if (ANALYSIS_INSTALL_PREFIX)
install(TARGETS analysis DESTINATION ${INSTALL_ROOT}/${ANALYSIS_INSTALL_PREFIX}/lib)
install(FILES ${header_files} DESTINATION ${INSTALL_ROOT}/${ANALYSIS_INSTALL_PREFIX}/include)
install(TARGETS analysis DESTINATION ${ANALYSIS_INSTALL_PREFIX}/lib)
install(FILES ${header_files} DESTINATION ${ANALYSIS_INSTALL_PREFIX}/include)
else()
install(TARGETS analysis DESTINATION ${INSTALL_ROOT}/lib)
install(FILES ${header_files} DESTINATION ${INSTALL_ROOT}/include)
install(TARGETS analysis DESTINATION lib)
install(FILES ${header_files} DESTINATION include)
endif()

View File

@ -1,48 +0,0 @@
import os
import os.path
import sys
sys.path += ["../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBANALYSIS
from global_config import add_static_library
from global_config import add_shared_library
from global_config import add_header
from global_config import get_target
from global_config import add_program
package = "analysis"
lib_path = "../lib"
slib_path = "../lib"
include_path = "../include"
module_path = "../modules"
conf = global_config.get_conf(os.getcwd() , 2)
env = Environment()
conf.update_env( env , [ LIBUTIL , LIBANALYSIS ] , link = False)
src_list = Split("analysis_module.c enkf_linalg.c")
src_list.append("std_enkf.c")
src_list.append("sqrt_enkf.c")
src_list.append("cv_enkf.c")
src_list.append("bootstrap_enkf.c")
src_list.append("null_enkf.c")
src_list.append("fwd_step_enkf.c")
header_list = Split("analysis_module.h analysis_table.h enkf_linalg.h")
add_shared_library( env , conf , slib_path , package , src_list)
add_header( env , conf , include_path , header_list )
env['SHLIBPREFIX'] = ""
add_shared_library( env , conf , module_path , "std_enkf.so" , ["std_enkf.c"] )
add_shared_library( env , conf , module_path , "sqrt_enkf.so" , ["sqrt_enkf.c"] )
add_shared_library( env , conf , module_path , "cv_enkf.so" , ["cv_enkf.c"] )
add_shared_library( env , conf , module_path , "bootstrap_enkf.so" , ["bootstrap_enkf.c"] )
add_shared_library( env , conf , module_path , "null_enkf.so" , ["null_enkf.c"] )
add_shared_library( env , conf , module_path , "fwd_step_enkf.so" , ["fwd_step_enkf.c"] )
Default( include_path , slib_path , module_path )

View File

@ -1 +0,0 @@
SConscript(["SConscript"])

View File

@ -1,2 +0,0 @@
SConscript(["src/SConstruct", "applications/SConstruct"])

View File

@ -1,24 +0,0 @@
import os
import os.path
import sys
sys.path += ["../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBCONFIG
from global_config import get_target
from global_config import add_program
lib_path = "../lib"
include_path = "../include"
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 2)
env = Environment()
conf.update_env( env , [LIBCONFIG , LIBUTIL] , ext_liblist = ["m","z","pthread"] , link = True)
add_program(env , conf , bin_path , "config_test" , "config_test.c")
add_program(env , conf , bin_path , "conf_test" , "conf_test.c" )
Default( bin_path )

View File

@ -25,23 +25,23 @@
int main(void) {
const char * config_file = "config_test_input";
config_type * config = config_alloc();
config_item_type * item;
config_schema_item_type * item;
item = config_add_item(config , "KEY1" , true , true);
item = config_add_item(config , "KEY2" , true , false);
config_item_set_argc_minmax(item , 1 , 4 , 4 , (const config_item_types [4]) {CONFIG_EXECUTABLE , CONFIG_EXISTING_FILE , CONFIG_BOOLEAN , CONFIG_BOOLEAN});
item = config_add_schema_item(config , "KEY1" , true , true);
item = config_add_schema_item(config , "KEY2" , true , false);
config_schema_item_set_argc_minmax(item , 1 , 4 , 4 , (const config_item_types [4]) {CONFIG_EXECUTABLE , CONFIG_EXISTING_FILE , CONFIG_BOOLEAN , CONFIG_BOOLEAN});
item = config_add_item(config , "FATHER" , false , false);
item = config_add_schema_item(config , "FATHER" , false , false);
{
stringlist_type * children = stringlist_alloc_argv_ref( (const char *[2]) {"CHILD1" , "CHILD2"} , 2);
config_item_set_required_children(item , children);
config_schema_item_set_required_children(item , children);
stringlist_free(children);
}
item = config_add_item(config , "CHILD1" , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
item = config_add_schema_item(config , "CHILD1" , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
config_parse(config , config_file , "--" , "INCLUDE" , NULL , true, true , true);
config_parse(config , config_file , "--" , "INCLUDE" , NULL , true, true);

View File

@ -1,30 +0,0 @@
import os
import os.path
import sys
sys.path += ["../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import add_shared_library
from global_config import add_static_library
from global_config import add_header
from global_config import get_target
package = "config"
lib_path = "../lib"
slib_path = "../slib"
include_path = "../include"
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 2)
env = Environment()
conf.update_env( env , [ LIBUTIL ] , link = False)
src_list = Split("config.c conf.c conf_util.c conf_data.c")
header_list = Split("config.h conf.h conf_data.h")
add_static_library( env , conf , lib_path , package , src_list)
add_shared_library( env , conf , slib_path , package , src_list)
add_header( env , conf , include_path , header_list )
Default( lib_path , include_path , slib_path )

File diff suppressed because it is too large Load Diff

View File

@ -43,80 +43,78 @@ typedef enum {CONFIG_STRING = 0,
CONFIG_BOOLEAN = 5,
CONFIG_CONFIG = 6,
CONFIG_BYTESIZE = 7,
CONFIG_EXECUTABLE = 8 } config_item_types;
CONFIG_EXECUTABLE = 8 ,
CONFIG_INVALID = 1000 } config_item_types;
typedef struct config_struct config_type;
typedef struct config_item_struct config_item_type;
typedef struct config_item_node_struct config_item_node_type;
typedef struct config_struct config_type;
typedef struct config_schema_item_struct config_schema_item_type;
config_item_node_type * config_iget_item_node( const config_type * config , const char * kw , int item_index);
char ** config_alloc_active_list(const config_type *, int *);
void config_free(config_type *);
config_type * config_alloc( );
char ** config_alloc_active_list(const config_type * , int * );
void config_parse(config_type * , const char * , const char * , const char * , const char * , bool , bool , bool );
bool config_has_item(const config_type * config , const char * kw);
char ** config_alloc_active_list(const config_type *, int *);
void config_free(config_type *);
config_type * config_alloc( );
char ** config_alloc_active_list(const config_type * , int * );
void config_parse(config_type * , const char * , const char * , const char * , const char * , bool , bool );
bool config_has_schema_item(const config_type * config , const char * kw);
void config_clear(config_type * config);
/*****************************************************************/
void config_item_set_envvar_expansion( config_item_type * item , bool expand_envvar );
bool config_item_set(const config_type * , const char * );
void config_item_free__ (void * );
void config_item_free( config_item_type * );
config_item_type * config_item_alloc(const char * , bool , bool);
config_item_type * config_get_item(const config_type *, const char *);
void config_add_alias(config_type * , const char * , const char * );
void config_install_message(config_type * , const char * , const char * );
const char * config_safe_get(const config_type * , const char *);
char * config_alloc_joined_string(const config_type * , const char * , const char * );
void config_add_define( config_type * config , const char * key , const char * value );
bool config_item_is_set(const config_item_type * );
void config_item_set_argc_minmax(config_item_type * , int , int , int type_map_size , const config_item_types * );
void config_item_set_common_selection_set(config_item_type * , int argc , const char ** argv);
void config_item_set_indexed_selection_set(config_item_type * item , int , int , const char ** );
void config_item_set_required_children(config_item_type * , stringlist_type * );
void config_item_set_required_children_on_value(config_item_type * , const char * , stringlist_type * );
void config_item_add_required_children(config_item_type * item , const char * child_key);
config_item_type * config_add_item(config_type *,
const char * ,
bool ,
bool);
bool config_has_keys(const config_type *,
const char **,
int ,
bool );
hash_type * config_pop_auto_items( config_type * config );
const char * config_safe_iget(const config_type * config , const char *kw, int occurence , int index);
const char * config_iget(const config_type * , const char * , int occurence , int index);
bool config_iget_as_bool(const config_type * , const char * , int occurence , int index);
double config_iget_as_double(const config_type * , const char * , int occurence , int index);
int config_iget_as_int(const config_type * , const char *, int occurence , int index);
stringlist_type * config_alloc_complete_stringlist(const config_type* , const char * );
stringlist_type * config_alloc_stringlist(const config_type * config , const char * );
hash_type * config_alloc_hash(const config_type * , const char * );
const stringlist_type * config_get_stringlist_ref(const config_type * , const char * );
stringlist_type * config_iget_stringlist_ref(const config_type * , const char * , int );
bool config_has_set_item(const config_type * , const char * );
int config_get_occurences(const config_type * , const char * );
int config_get_occurence_size( const config_type * config , const char * kw , int occurence);
config_item_type * config_add_key_value( config_type * config , const char * key , bool required , config_item_types item_type);
bool config_get_value_as_bool(const config_type * config , const char * kw);
int config_get_value_as_int(const config_type * config , const char * kw);
double config_get_value_as_double(const config_type * config , const char * kw);
const char * config_get_value(const config_type * config , const char * kw);
void config_fprintf_item_list(const config_type * config , FILE * stream);
void config_schema_item_set_envvar_expansion( config_schema_item_type * item , bool expand_envvar );
bool config_item_set(const config_type * , const char * );
void config_schema_item_free__ (void * );
void config_schema_item_free( config_schema_item_type * );
config_schema_item_type * config_schema_item_alloc(const char * , bool , bool);
config_schema_item_type * config_get_schema_item(const config_type *, const char *);
void config_add_alias(config_type * , const char * , const char * );
void config_install_message(config_type * , const char * , const char * );
const char * config_safe_get(const config_type * , const char *);
char * config_alloc_joined_string(const config_type * , const char * , const char * );
void config_add_define( config_type * config , const char * key , const char * value );
bool config_schema_item_is_set(const config_schema_item_type * );
void config_schema_item_set_argc_minmax(config_schema_item_type * , int , int , int type_map_size , const config_item_types * );
void config_schema_item_set_common_selection_set(config_schema_item_type * , int argc , const char ** argv);
void config_schema_item_set_indexed_selection_set(config_schema_item_type * item , int , int , const char ** );
void config_schema_item_set_required_children(config_schema_item_type * , stringlist_type * );
void config_schema_item_set_required_children_on_value(config_schema_item_type * , const char * , stringlist_type * );
void config_schema_item_add_required_children(config_schema_item_type * item , const char * child_key);
config_schema_item_type * config_add_schema_item(config_type *,
const char * ,
bool ,
bool);
bool config_has_keys(const config_type *,
const char **,
int ,
bool );
const char * config_safe_iget(const config_type * config , const char *kw, int occurence , int index);
const char * config_iget(const config_type * , const char * , int occurence , int index);
bool config_iget_as_bool(const config_type * , const char * , int occurence , int index);
double config_iget_as_double(const config_type * , const char * , int occurence , int index);
int config_iget_as_int(const config_type * , const char *, int occurence , int index);
stringlist_type * config_alloc_complete_stringlist(const config_type* , const char * );
stringlist_type * config_alloc_stringlist(const config_type * config , const char * );
hash_type * config_alloc_hash(const config_type * , const char * );
const stringlist_type * config_get_stringlist_ref(const config_type * , const char * );
stringlist_type * config_iget_stringlist_ref(const config_type * , const char * , int );
bool config_has_set_item(const config_type * , const char * );
int config_get_occurences(const config_type * , const char * );
int config_get_occurence_size( const config_type * config , const char * kw , int occurence);
config_schema_item_type * config_add_key_value( config_type * config , const char * key , bool required , config_item_types item_type);
bool config_get_value_as_bool(const config_type * config , const char * kw);
int config_get_value_as_int(const config_type * config , const char * kw);
double config_get_value_as_double(const config_type * config , const char * kw);
const char * config_get_value(const config_type * config , const char * kw);
void config_fprintf_item_list(const config_type * config , FILE * stream);
const char * config_get_config_file( const config_type * config , bool abs_path);
#ifdef __cplusplus
}
#endif

View File

@ -1,13 +1,10 @@
set( ECL_INSTALL_PREFIX "" CACHE STRING "Prefix for installation of libecl")
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src )
include_directories( ${libutil_build_path} )
include_directories( ${libutil_src_path} )
include_directories( ${libgeometry_src_path} )
add_subdirectory( src )
add_subdirectory( applications )
add_subdirectory( tests )
#if (BUILD_CXX)
# add_subdirectory( cxx )
#endif()

View File

@ -1,2 +0,0 @@
SConscript(["src/SConstruct", "applications/SConstruct","cxx/SConstruct"])

View File

@ -1,6 +1,7 @@
add_executable( sum_write sum_write.c )
add_executable( make_grid make_grid.c )
add_executable( grdecl_grid grdecl_grid.c )
add_executable( summary2csv summary2csv.c )
if (ERT_LINUX)
add_executable( convert.x convert.c )
add_executable( grdecl_test.x grdecl_test.c )
@ -12,7 +13,7 @@ if (ERT_LINUX)
add_executable( summary.x view_summary.c )
add_executable( select_test.x select_test.c )
add_executable( load_test.x load_test.c )
set(program_list kw_extract.x grdecl_grid make_grid sum_write load_test.x grdecl_test.x grid_dump_ascii.x select_test.x grid_dump.x convert.x kw_list.x grid_info.x summary.x)
set(program_list summary2csv kw_extract.x grdecl_grid make_grid sum_write load_test.x grdecl_test.x grid_dump_ascii.x select_test.x grid_dump.x convert.x kw_list.x grid_info.x summary.x)
else()
# The stupid .x extension creates problems on windows
add_executable( convert convert.c )
@ -25,12 +26,12 @@ else()
add_executable( summary view_summary.c )
add_executable( select_test select_test.c )
add_executable( load_test load_test.c )
set(program_list kw_extract grdecl_grid make_grid sum_write load_test grdecl_test grid_dump_ascii select_test grid_dump convert kw_list grid_info summary)
set(program_list summary2csv kw_extract grdecl_grid make_grid sum_write load_test grdecl_test grid_dump_ascii select_test grid_dump convert kw_list grid_info summary)
endif()
foreach(prog ${program_list})
target_link_libraries( ${prog} ecl util geometry )
target_link_libraries( ${prog} ecl ert_util geometry )
#-----------------------------------------------------------------
if (ECL_INSTALL_PREFIX)
@ -45,3 +46,23 @@ foreach(prog ${program_list})
install(CODE "EXECUTE_PROCESS(COMMAND chmod g+w ${destination}/${prog})")
endif()
endforeach()
if (BUILD_ENS_PLOT)
include_directories( ${PLPLOT_HEADER} )
include_directories( ${libplot_src_path} )
add_executable( ens_plot.x ens_plot.c )
target_link_libraries( ens_plot.x plot ecl util)
if (ECL_INSTALL_PREFIX)
set (destination ${CMAKE_INSTALL_PREFIX}/${ECL_INSTALL_PREFIX}/bin)
else()
set (destination ${CMAKE_INSTALL_PREFIX}/bin)
endif()
install(TARGETS ens_plot.x DESTINATION ${destination})
if (INSTALL_GROUP)
install(CODE "EXECUTE_PROCESS(COMMAND chgrp ${INSTALL_GROUP} ${destination}/ens_plot.x)")
install(CODE "EXECUTE_PROCESS(COMMAND chmod g+w ${destination}/ens_plot.x)")
endif()
endif()

View File

@ -1,57 +0,0 @@
import os
import os.path
import sys
sys.path += ["../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBECL
from global_config import LIBPLOT
from global_config import LIBCONFIG
from global_config import LIBGEOMETRY
from global_config import get_target
from global_config import add_program
lib_path = "../lib"
include_path = "../include"
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 2)
env = Environment()
lib_list = ["lapack" , "blas" , "plplotd" , "m" , "z" , "pthread"]
if conf.g2c:
lib_list.append( "g2c" )
conf.update_env( env , [ LIBECL , LIBPLOT , LIBCONFIG , LIBGEOMETRY , LIBUTIL ] , ext_liblist = lib_list , link = True)
env.Append( CPPPATH = conf.PLPLOT_INCLUDE_PATH )
env.Append( LIBPATH = conf.PLPLOT_LIB_PATH )
add_program(env , conf , bin_path , "make_grid" , "make_grid.c" )
add_program(env , conf , bin_path , "grdecl_grid" , "grdecl_grid.c" )
add_program(env , conf , bin_path , "sum_write" , "sum_write.c" )
add_program(env , conf , bin_path , "grdecl_test.x" , "grdecl_test.c")
add_program(env , conf , bin_path , "load_test.x" , "load_test.c")
add_program(env , conf , bin_path , "select_test.x" , "select_test.c")
add_program(env , conf , bin_path , "key_list.x" , "key_list.c")
add_program(env , conf , bin_path , "ecl_quantile" , "ecl_quantile.c" )
add_program(env , conf , bin_path , "convert.x" , "convert.c" )
add_program(env , conf , bin_path , "ecl_pack.x" , "ecl_pack.c" )
add_program(env , conf , bin_path , "ecl_test.x" , "ecl_test.c" )
add_program(env , conf , bin_path , "ecl_unpack.x" , "ecl_unpack.c" )
add_program(env , conf , bin_path , "esummary.x" , "esummary.c" )
add_program(env , conf , bin_path , "grid_info.x" , "grid_info.c" )
add_program(env , conf , bin_path , "grid_dump.x" , "grid_dump.c" )
add_program(env , conf , bin_path , "grid_dump_ascii.x" , "grid_dump_ascii.c" )
add_program(env , conf , bin_path , "grid_layer.x" , "grid_layer.c" )
add_program(env , conf , bin_path , "kw_extract.x" , "kw_extract.c" )
add_program(env , conf , bin_path , "kw_list.x" , "kw_list.c" )
add_program(env , conf , bin_path , "run_gravity.x" , "run_gravity.c" )
add_program(env , conf , bin_path , "view_restart.x" , "view_restart.c" )
add_program(env , conf , bin_path , "view_rft.x" , "view_rft.c" )
add_program(env , conf , bin_path , "summary.x" , "view_summary.c" )
add_program(env , conf , bin_path , "vprofile.x" , "vprofile.c" )
add_program(env , conf , bin_path , "ens_plot.x" , "ens_plot.c" , CPPDEFINES = "\'VIEWER=\"/usr/bin/display\"\'")
Default( bin_path )

View File

@ -707,14 +707,14 @@ void output_table_run( hash_type * output_table , ensemble_type * ensemble ) {
void config_init( config_type * config ) {
config_add_item( config , "CASE_LIST" , true , true );
config_add_schema_item( config , "CASE_LIST" , true , true );
config_add_key_value( config , "NUM_INTERP" , false , CONFIG_INT);
{
config_item_type * item;
item = config_add_item( config , "OUTPUT" , true , true );
config_item_set_argc_minmax( item , 2 , -1 , 0 , NULL );
config_item_set_indexed_selection_set( item , 1 , 3 , (const char *[3]) { S3GRAPH_STRING , HEADER_STRING , PLAIN_STRING });
config_schema_item_type * item;
item = config_add_schema_item( config , "OUTPUT" , true , true );
config_schema_item_set_argc_minmax( item , 2 , -1 , 0 , NULL );
config_schema_item_set_indexed_selection_set( item , 1 , 3 , (const char *[3]) { S3GRAPH_STRING , HEADER_STRING , PLAIN_STRING });
}
}
@ -815,7 +815,7 @@ int main( int argc , char ** argv ) {
const char * config_arg = argv[1];
config_init( config );
config_parse( config , config_arg , "--" , NULL , NULL , true , false , true );
config_parse( config , config_arg , "--" , NULL , NULL , true , true );
{
char * config_path;

View File

@ -286,6 +286,7 @@ Q | Quit
*/
#define VIEWER "/usr/bin/display"
#define CREATE_ENS_CMD "C"
#define PLOT_CMD "P"
@ -965,7 +966,7 @@ void plot_ensemble(const ens_type * ens , plot_type * plot , const char * user_k
plot_dataset_append_point_xy( plot_dataset ,
//ecl_sum_iget_sim_days( ecl_sum , time_index ),
ecl_sum_iget_sim_time( ecl_sum , time_index ),
ecl_sum_iiget( ecl_sum , time_index , param_index ));
ecl_sum_iget( ecl_sum , time_index , param_index ));
}
plot_dataset_set_style ( plot_dataset , ens->plot_style);

View File

@ -155,7 +155,7 @@ int main(int argc , char ** argv) {
util_set_date_values(ecl_sum_iget_sim_time(ecl_sum , end_index) , &day , &month, &year);
fprintf(stream , "%7.2f %02d/%02d/%04d " , ecl_sum_iget_sim_days(ecl_sum , end_index) , day , month , year);
}
value = ecl_sum_iget_general_var(ecl_sum , end_index , var_list[ivar]);
value = ecl_sum_get_general_var(ecl_sum , end_index , var_list[ivar]);
}
}
fprintf(stream , " %12.3f " , value);

View File

@ -40,7 +40,7 @@ int main(int argc, char ** argv) {
if (argc >= 3) {
ecl_grid_type * grid2 = ecl_grid_alloc( argv[2] );
if (ecl_grid_compare( ecl_grid , grid2 , true))
if (ecl_grid_compare( ecl_grid , grid2 , true , false))
printf("\nThe grids %s %s are IDENTICAL.\n" , argv[1] , argv[2]);
else {
printf("\n");
@ -58,6 +58,7 @@ int main(int argc, char ** argv) {
}
printf("----\n");
*/
ecl_grid_fwrite_EGRID( ecl_grid , "/tmp/INFO.EGRID");
ecl_grid_free(ecl_grid);
}
}

View File

@ -49,7 +49,6 @@ int main(int argc, char ** argv) {
int num_kw = argc - 3;
fortio_type * fortio_src;
fortio_type * fortio_target;
int ikw;
bool fmt_src , fmt_target;
set_type * kw_set = set_alloc( num_kw , kw_list );

View File

@ -144,9 +144,10 @@ int main(int argc , char ** argv) {
bool report_only = false;
bool list_mode = false;
bool include_restart = true;
bool print_header = true;
ecl_sum_fmt_type fmt;
int arg_offset = 1;
ecl_sum_fmt_init_summary_x( &fmt );
#ifdef HAVE_GETOPT
if (argc == 1)
print_help_and_exit();
@ -179,7 +180,7 @@ int main(int argc , char ** argv) {
list_mode = true;
break;
case 'x':
print_header = false;
fmt.print_header = false;
break;
case 'h':
print_help_and_exit();
@ -226,7 +227,7 @@ int main(int argc , char ** argv) {
{
int columns = 5;
int i;
int i;
for (i=0; i< stringlist_get_size( keys ); i++) {
printf("%-24s ",stringlist_iget( keys , i ));
if ((i % columns) == 4)
@ -239,7 +240,8 @@ int main(int argc , char ** argv) {
/* Normal operation print results for the various keys on stdout. */
stringlist_type * key_list = stringlist_alloc_new( );
build_key_list( ecl_sum , key_list , num_keys , arg_list);
ecl_sum_fprintf(ecl_sum , stdout , key_list , report_only , print_header);
ecl_sum_fprintf(ecl_sum , stdout , key_list , report_only , &fmt);
stringlist_free( key_list );
}
ecl_sum_free(ecl_sum);

View File

@ -1 +0,0 @@
SConscript(["src/SConstruct"])

View File

@ -1,38 +0,0 @@
import os
import os.path
import sys
sys.path += ["../../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBECL
from global_config import LIBGEOMETRY
from global_config import add_static_library
from global_config import add_shared_library
from global_config import add_header
from global_config import get_target
package = "eclxx"
lib_path = "../lib"
slib_path = "../slib"
include_path = "../include"
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 3)
env = Environment()
conf.update_env( env , [ LIBGEOMETRY , LIBECL , LIBUTIL] , link = False)
src_list = Split("fortio.cxx ecl_kw.cxx")
# tetrahedron.h and point.h are not installed.
header_list = Split("fortio.hpp ecl_kw.hpp")
add_static_library( env , conf , lib_path , package , src_list)
add_shared_library( env , conf , slib_path , package , src_list)
add_header( env , conf , include_path , header_list )
Default( lib_path , include_path , slib_path )

View File

@ -2,9 +2,9 @@ include_directories( ext )
file(GLOB ext_source "ext/*.c" )
file(GLOB ext_header "ext/*.h" )
set( source_files ecl_sum_tstep.c ecl_rst_file.c ecl_init_file.c ecl_grid_cache.c smspec_node.c ecl_kw_grdecl.c ecl_file_kw.c ecl_grav.c ecl_grav_calc.c ecl_smspec.c ecl_sum_data.c ecl_util.c ecl_kw.c ecl_sum.c fortio.c ecl_rft_file.c ecl_rft_node.c ecl_grid.c ecl_box.c ecl_io_config.c ecl_file.c ecl_region.c point.c tetrahedron.c ecl_intehead.c ecl_subsidence.c ecl_grav_common.c ${ext_source})
set( source_files ecl_sum_tstep.c ecl_rst_file.c ecl_init_file.c ecl_grid_cache.c smspec_node.c ecl_kw_grdecl.c ecl_file_kw.c ecl_grav.c ecl_grav_calc.c ecl_smspec.c ecl_sum_data.c ecl_util.c ecl_kw.c ecl_sum.c fortio.c ecl_rft_file.c ecl_rft_node.c ecl_grid.c ecl_coarse_cell.c ecl_box.c ecl_io_config.c ecl_file.c ecl_region.c point.c tetrahedron.c ecl_intehead.c ecl_subsidence.c ecl_grav_common.c ${ext_source})
set( header_files ecl_sum_tstep.h ecl_rst_file.h ecl_init_file.h smspec_node.h ecl_grid_cache.h ecl_kw_grdecl.h ecl_file_kw.h ecl_grav.h ecl_grav_calc.h ecl_endian_flip.h ecl_smspec.h ecl_sum_data.h ecl_util.h ecl_kw.h ecl_sum.h fortio.h ecl_rft_file.h ecl_rft_node.h ecl_box.h ecl_grid.h ecl_io_config.h ecl_file.h ecl_region.h ecl_intehead.h ecl_kw_magic.h ecl_subsidence.h ${ext_header} ecl_grav_common.h)
set( header_files ecl_sum_tstep.h ecl_rst_file.h ecl_init_file.h smspec_node.h ecl_grid_cache.h ecl_kw_grdecl.h ecl_file_kw.h ecl_grav.h ecl_grav_calc.h ecl_endian_flip.h ecl_smspec.h ecl_sum_data.h ecl_util.h ecl_kw.h ecl_sum.h fortio.h ecl_rft_file.h ecl_rft_node.h ecl_box.h ecl_coarse_cell.h ecl_grid.h ecl_io_config.h ecl_file.h ecl_region.h ecl_intehead.h ecl_kw_magic.h ecl_subsidence.h ${ext_header} ecl_grav_common.h)
@ -24,7 +24,7 @@ endif()
if (OPENMP)
target_link_libraries( ecl gomp )
endif()
target_link_libraries( ecl geometry util )
target_link_libraries( ecl geometry ert_util )
#-----------------------------------------------------------------
if (ECL_INSTALL_PREFIX)

View File

@ -1,40 +0,0 @@
import os
import os.path
import sys
sys.path += ["../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBECL
from global_config import LIBGEOMETRY
from global_config import add_static_library
from global_config import add_shared_library
from global_config import add_header
from global_config import get_target
package = "ecl"
lib_path = "../lib"
slib_path = "../slib"
include_path = "../include"
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 2)
env = Environment()
conf.update_env( env , [ LIBGEOMETRY , LIBECL , LIBUTIL] , link = False)
src_list = Split("ecl_sum_tstep.c ecl_rst_file.c ecl_init_file.c ecl_grid_cache.c smspec_node.c ecl_intehead.c ecl_kw_grdecl.c ecl_file_kw.c ecl_grav.c ecl_grav_calc.c ecl_smspec.c ecl_sum_data.c ecl_util.c ecl_kw.c ecl_sum.c fortio.c ecl_rft_file.c ecl_rft_node.c ecl_grid.c ecl_box.c ecl_io_config.c ecl_file.c ecl_region.c point.c tetrahedron.c ecl_subsidence.c ecl_grav_common.c")
src_list.append( Glob("ext/*.c") )
# tetrahedron.h and point.h are not installed.
header_list = Split("ecl_sum_tstep.h ecl_rst_file.h ecl_init_file.h ecl_grid_cache.h smspec_node.h ecl_intehead.h ecl_kw_grdecl.h ecl_file_kw.h ecl_grav.h ecl_grav_calc.h ecl_endian_flip.h ecl_smspec.h ecl_sum_data.h ecl_util.h ecl_kw.h ecl_sum.h fortio.h ecl_rft_file.h ecl_rft_node.h ecl_box.h ecl_grid.h ecl_io_config.h ecl_file.h ecl_region.h ecl_kw_magic.h ecl_subsidence.h ecl_grav_common.h")
header_list.append( Glob("ext/*.h") )
add_static_library( env , conf , lib_path , package , src_list)
add_shared_library( env , conf , slib_path , package , src_list)
add_header( env , conf , include_path , header_list )
Default( lib_path , include_path , slib_path )

View File

@ -836,6 +836,7 @@ static ecl_file_type * ecl_file_open__( const char * filename , bool read_only)
ecl_file->fortio = fortio_open_readwrite( filename , fmt_file , ECL_ENDIAN_FLIP);
ecl_file->global_map = file_map_alloc( ecl_file->fortio , ecl_file->inv_map , true );
ecl_file_add_map( ecl_file , ecl_file->global_map );
ecl_file_scan( ecl_file );
ecl_file_select_global( ecl_file );
@ -848,9 +849,25 @@ ecl_file_type * ecl_file_open( const char * filename ) {
return ecl_file_open__(filename , true );
}
ecl_file_type * ecl_file_try_open( const char * filename) {
if (util_entry_readable( filename ))
return ecl_file_open( filename );
else
return NULL;
}
/**
This function opens the file in a mode where it can be updated and
modified, but it must still exist and be readable. I.e. this should
not compared with the normal: fopen(filename , "w") where an
existing file is truncated to zero upon successfull open.
*/
ecl_file_type * ecl_file_open_writable( const char * filename ) {
return ecl_file_open__(filename , false );
if (util_entry_readable( filename ) && util_entry_writable( filename ))
return ecl_file_open__(filename , false );
else
return NULL;
}

View File

@ -38,6 +38,7 @@ extern "C" {
void ecl_file_push_block( ecl_file_type * ecl_file );
void ecl_file_pop_block( ecl_file_type * ecl_file );
ecl_file_type * ecl_file_open( const char * filename );
ecl_file_type * ecl_file_try_open( const char * filename);
ecl_file_type * ecl_file_open_writable( const char * filename );
void ecl_file_close( ecl_file_type * ecl_file );
void ecl_file_fortio_detach( ecl_file_type * ecl_file );

File diff suppressed because it is too large Load Diff

View File

@ -27,12 +27,22 @@ extern "C" {
#include <int_vector.h>
#include <stringlist.h>
#include <ecl_coarse_cell.h>
#include <ecl_kw.h>
typedef double (block_function_ftype) ( const double_vector_type *);
typedef struct ecl_grid_struct ecl_grid_type;
bool ecl_grid_have_coarse_cells( const ecl_grid_type * main_grid );
bool ecl_grid_cell_in_coarse_group1( const ecl_grid_type * main_grid , int global_index );
bool ecl_grid_cell_in_coarse_group3( const ecl_grid_type * main_grid , int i , int j , int k);
int ecl_grid_get_num_coarse_groups( const ecl_grid_type * main_grid );
ecl_coarse_cell_type * ecl_grid_iget_coarse_group( const ecl_grid_type * ecl_grid , int coarse_nr );
ecl_coarse_cell_type * ecl_grid_get_cell_coarse_group1( const ecl_grid_type * ecl_grid , int global_index);
ecl_coarse_cell_type * ecl_grid_get_cell_coarse_group3( const ecl_grid_type * ecl_grid , int i , int j , int k);
void ecl_grid_get_column_property(const ecl_grid_type * ecl_grid , const ecl_kw_type * ecl_kw , int i , int j, double_vector_type * column);
int ecl_grid_get_global_index_from_xy_top( const ecl_grid_type * ecl_grid , double x , double y);
int ecl_grid_get_global_index_from_xy_bottom( const ecl_grid_type * ecl_grid , double x , double y);
@ -56,12 +66,15 @@ extern "C" {
const char * ecl_grid_get_name( const ecl_grid_type * );
int ecl_grid_get_active_index3(const ecl_grid_type * ecl_grid , int i , int j , int k);
int ecl_grid_get_active_index1(const ecl_grid_type * ecl_grid , int global_index);
int ecl_grid_get_active_fracture_index3(const ecl_grid_type * ecl_grid , int i , int j , int k);
int ecl_grid_get_active_fracture_index1(const ecl_grid_type * ecl_grid , int global_index);
bool ecl_grid_cell_active3(const ecl_grid_type * , int , int , int );
bool ecl_grid_cell_active1(const ecl_grid_type * , int);
bool ecl_grid_ijk_valid(const ecl_grid_type * , int , int , int );
int ecl_grid_get_global_index3(const ecl_grid_type * , int , int , int );
int ecl_grid_get_global_index1A(const ecl_grid_type * ecl_grid , int active_index);
int ecl_grid_get_global_index1F(const ecl_grid_type * ecl_grid , int active_fracture_index);
ecl_grid_type * ecl_grid_alloc_GRDECL_kw( int nx, int ny , int nz , const ecl_kw_type * zcorn_kw , const ecl_kw_type * coord_kw , const ecl_kw_type * actnum_kw , const ecl_kw_type * mapaxes_kw );
ecl_grid_type * ecl_grid_alloc_GRDECL_data(int , int , int , const float * , const float * , const int * , const float * mapaxes);
ecl_grid_type * ecl_grid_alloc_GRID_data(int num_coords , int nx, int ny , int nz , int coords_size , int ** coords , float ** corners , const float * mapaxes);
@ -80,6 +93,7 @@ extern "C" {
int ecl_grid_get_nx( const ecl_grid_type * grid );
int ecl_grid_get_ny( const ecl_grid_type * grid );
int ecl_grid_get_nactive( const ecl_grid_type * grid );
int ecl_grid_get_nactive_fracture( const ecl_grid_type * grid );
int ecl_grid_get_active_index(const ecl_grid_type * , int , int , int );
void ecl_grid_summarize(const ecl_grid_type * );
void ecl_grid_get_ijk1(const ecl_grid_type * , int global_index , int *, int * , int *);
@ -89,7 +103,7 @@ extern "C" {
void ecl_grid_get_xyz1(const ecl_grid_type * grid , int global_index , double *xpos , double *ypos , double *zpos);
void ecl_grid_get_xyz1A(const ecl_grid_type * grid , int active_index , double *xpos , double *ypos , double *zpos);
int ecl_grid_get_global_size( const ecl_grid_type * ecl_grid );
bool ecl_grid_compare(const ecl_grid_type * g1 , const ecl_grid_type * g2 , bool include_lgr);
bool ecl_grid_compare(const ecl_grid_type * g1 , const ecl_grid_type * g2 , bool include_lgr, bool verbose);
int ecl_grid_get_active_size( const ecl_grid_type * ecl_grid );
double ecl_grid_get_bottom1(const ecl_grid_type * grid , int global_index);
@ -138,13 +152,12 @@ extern "C" {
void ecl_grid_grdecl_fprintf_kw( const ecl_grid_type * ecl_grid , const ecl_kw_type * ecl_kw , FILE * stream , double double_default);
bool ecl_grid_test_lgr_consistency( const ecl_grid_type * ecl_grid );
void ecl_grid_fwrite_EGRID( const ecl_grid_type * grid , const char * filename);
void ecl_grid_fwrite_EGRID( ecl_grid_type * grid , const char * filename);
void ecl_grid_fwrite_GRID( const ecl_grid_type * grid , const char * filename);
void ecl_grid_fprintf_grdecl( const ecl_grid_type * grid , FILE * stream );
void ecl_grid_fprintf_grdecl( ecl_grid_type * grid , FILE * stream );
void ecl_grid_fwrite_EGRID_header__( int dims[3] , const float mapaxes[6], int dualp_flag , fortio_type * fortio);
void ecl_grid_fwrite_EGRID_header( int dims[3] , const float mapaxes[6], fortio_type * fortio);
float * ecl_grid_alloc_coord_data( const ecl_grid_type * grid );
ecl_kw_type * ecl_grid_alloc_coord_kw( const ecl_grid_type * grid );
float * ecl_grid_alloc_zcorn_data( const ecl_grid_type * grid );
ecl_kw_type * ecl_grid_alloc_zcorn_kw( const ecl_grid_type * grid );
int * ecl_grid_alloc_actnum_data( const ecl_grid_type * grid );
@ -154,6 +167,8 @@ extern "C" {
void ecl_grid_ri_export( const ecl_grid_type * ecl_grid , double * ri_points);
void ecl_grid_cell_ri_export( const ecl_grid_type * ecl_grid , int global_index , double * ri_points);
bool ecl_grid_dual_grid( const ecl_grid_type * ecl_grid );
#ifdef __cplusplus
}

View File

@ -336,7 +336,7 @@ bool ecl_kw_ichar_eq(const ecl_kw_type *ecl_kw , int i , const char *value) {
}
static bool ecl_kw_header_eq(const ecl_kw_type *ecl_kw1 , const ecl_kw_type * ecl_kw2) {
bool ecl_kw_header_eq(const ecl_kw_type *ecl_kw1 , const ecl_kw_type * ecl_kw2) {
bool equal = true;
if (strcmp(ecl_kw1->header8 , ecl_kw2->header8) != 0)
@ -382,6 +382,70 @@ bool ecl_kw_equal(const ecl_kw_type *ecl_kw1, const ecl_kw_type *ecl_kw2) {
}
#define CMP(ctype) \
static bool CMP_ ## ctype( ctype v1, ctype v2 , ctype epsilon) { \
if ((abs(v1) + abs(v2)) == 0) \
return true; \
else { \
ctype d = fabs(v1 - v2) / (fabs(v1) + fabs(v2)); \
if (d < epsilon) \
return true; \
else \
return false; \
} \
}
CMP(float)
CMP(double)
#undef CMP
#define ECL_KW_NUMERIC_CMP(ctype) \
static bool ecl_kw_numeric_equal_ ## ctype( const ecl_kw_type * ecl_kw1 , const ecl_kw_type * ecl_kw2 , ctype rel_diff) { \
int index; \
bool equal = true; \
{ \
const ctype * data1 = (const ctype *) ecl_kw1->data; \
const ctype * data2 = (const ctype *) ecl_kw2->data; \
for (index = 0; index < ecl_kw1->size; index++) { \
equal = CMP_ ## ctype( data1[index] , data2[index] , rel_diff); \
if (!equal) \
break; \
} \
} \
return equal; \
}
ECL_KW_NUMERIC_CMP( float )
ECL_KW_NUMERIC_CMP( double )
#undef ECL_KW_NUMERIC_CMP
/**
This function compares the data of two ecl_kw instances, and
returns true if the relative numerical difference is less than
@rel_diff. Does not consider consider the kw header.
*/
bool ecl_kw_numeric_equal(const ecl_kw_type *ecl_kw1, const ecl_kw_type *ecl_kw2 , double rel_diff) {
bool equal = true;
if ( ecl_kw1->ecl_type != ecl_kw2->ecl_type)
equal = false;
if ( ecl_kw1->size != ecl_kw2->size)
equal = false;
if (equal) {
if (ecl_kw1->ecl_type == ECL_FLOAT_TYPE)
equal = ecl_kw_numeric_equal_float( ecl_kw1 , ecl_kw2 , rel_diff );
else if (ecl_kw1->ecl_type == ECL_DOUBLE_TYPE)
equal = ecl_kw_numeric_equal_double( ecl_kw1 , ecl_kw2 , rel_diff );
else
equal = ecl_kw_data_equal( ecl_kw1 , ecl_kw2->data );
}
return equal;
}
bool ecl_kw_block_equal( const ecl_kw_type * ecl_kw1 , const ecl_kw_type * ecl_kw2 , int cmp_elements) {
if (ecl_kw_header_eq( ecl_kw1 , ecl_kw2)) {
if (cmp_elements == 0)
@ -531,7 +595,6 @@ ecl_kw_type *ecl_kw_alloc_copy(const ecl_kw_type *src) {
return new;
}
/**
This function will allocate a new copy of @src, where only the
elements corresponding to the slice [index1:index2) is included.
@ -544,8 +607,6 @@ ecl_kw_type *ecl_kw_alloc_copy(const ecl_kw_type *src) {
If index1 > index2 it will fail hard; the same applies if stride is
<= 0.
*/
@ -591,6 +652,36 @@ ecl_kw_type * ecl_kw_alloc_slice_copy( const ecl_kw_type * src, int index1, int
}
/**
Will allocate a copy of the src_kw. Will copy @count elements
starting at @offset. If @count < 0 all remaining elements from
@offset will be copied. If new_kw == NULL the new keyword will have
the same header as the @src, otherwise the value @new_kw will be
used.
*/
ecl_kw_type * ecl_kw_alloc_sub_copy( const ecl_kw_type * src, const char * new_kw , int offset , int count) {
if (new_kw == NULL)
new_kw = src->header;
if (count < 0)
count = src->size - offset;
if ((offset < 0) || (offset >= src->size)) util_abort("%s: invalid offset - limits: [%d,%d) \n",__func__ , 0 , src->size);
if ((count + offset) > src->size) util_abort("%s: invalid count value: %d \n",__func__ , count);
{
void * src_data = ecl_kw_iget_ptr( src , offset );
return ecl_kw_alloc_new( new_kw , count , src->ecl_type , src_data );
}
}
const void * ecl_kw_copyc__(const void * void_kw) {
return ecl_kw_alloc_copy((const ecl_kw_type *) void_kw);
}

View File

@ -62,6 +62,7 @@ extern "C" {
void ecl_kw_free(ecl_kw_type *);
void ecl_kw_free__(void *);
ecl_kw_type * ecl_kw_alloc_copy (const ecl_kw_type *);
ecl_kw_type * ecl_kw_alloc_sub_copy( const ecl_kw_type * src, const char * new_kw , int offset , int count);
const void * ecl_kw_copyc__(const void *);
ecl_kw_type * ecl_kw_alloc_slice_copy( const ecl_kw_type * src, int index1, int index2, int stride);
//void * ecl_kw_get_data_ref(const ecl_kw_type *);
@ -92,7 +93,9 @@ extern "C" {
double ecl_kw_iget_as_double(const ecl_kw_type * ecl_kw , int i);
void ecl_kw_get_data_as_double(const ecl_kw_type *, double *);
void ecl_kw_get_data_as_float(const ecl_kw_type * ecl_kw , float * float_data);
bool ecl_kw_header_eq(const ecl_kw_type *ecl_kw1 , const ecl_kw_type * ecl_kw2);
bool ecl_kw_equal(const ecl_kw_type *ecl_kw1, const ecl_kw_type *ecl_kw2);
bool ecl_kw_numeric_equal(const ecl_kw_type *ecl_kw1, const ecl_kw_type *ecl_kw2 , double rel_diff);
bool ecl_kw_block_equal( const ecl_kw_type * ecl_kw1 , const ecl_kw_type * ecl_kw2 , int cmp_elements);
bool ecl_kw_data_equal( const ecl_kw_type * ecl_kw , const void * data);
void ecl_kw_fskip_data__( ecl_type_enum ecl_type , int size , fortio_type * fortio);

View File

@ -395,10 +395,25 @@ static char * fscanf_alloc_grdecl_data( const char * header , bool strict , ecl_
util_abort("%s: Malformed content:\"%s\" when reading keyword:%s \n",__func__ , buffer , header);
}
value_ptr = &value;
} else if (ecl_type == ECL_DOUBLE_TYPE) {
double value;
if (sscanf(buffer , "%d*%lg" , &multiplier , &value) == 2)
{}
else if (sscanf( buffer , "%lg" , &value) == 1)
multiplier = 1;
else {
char_input = true;
if (strict)
util_abort("%s: Malformed content:\"%s\" when reading keyword:%s \n",__func__ , buffer , header);
}
value_ptr = &value;
} else
util_abort("%s: sorry type:%s not supported \n",__func__ , ecl_util_get_type_name(ecl_type));
if (char_input)
fprintf(stderr,"Warning: character string: \'%s\' ignored when reading keyword:%s \n",buffer , header);
else {
@ -484,8 +499,8 @@ static char * fscanf_alloc_grdecl_data( const char * header , bool strict , ecl_
static ecl_kw_type * __ecl_kw_fscanf_alloc_grdecl__(FILE * stream , const char * header , bool strict , int size , ecl_type_enum ecl_type) {
if (!(ecl_type == ECL_FLOAT_TYPE || ecl_type == ECL_INT_TYPE))
util_abort("%s: sorry only types FLOAT and INT supported\n",__func__);
if (! (ecl_type == ECL_FLOAT_TYPE || ecl_type == ECL_INT_TYPE || ecl_type == ECL_DOUBLE_TYPE))
util_abort("%s: sorry only types FLOAT, INT and DOUBLE supported\n",__func__);
if (header != NULL)
if (!ecl_kw_grdecl_fseek_kw( header , true , stream ))

View File

@ -276,6 +276,7 @@ extern "C" {
#define FILEHEAD_KW "FILEHEAD"
#define ENDGRID_KW "ENDGRID"
#define ENDLGR_KW "ENDLGR"
#define CORSNUM_KW "CORSNUM"
/* GRID keywords */
#define GRIDHEAD_KW "GRIDHEAD" /* Header information for GRID files. */
@ -309,8 +310,19 @@ extern "C" {
#define GRIDHEAD_GRIDTYPE_CORNERPOINT 1 /* <----\ */
/* | Fucking hysterical! */
#define FILEHEAD_GRIDTYPE_CORNERPOINT 0 /* <----/ */
#define FILEHEAD_SINGLE_POROSITY 0
#define FILEHEAD_ORGTYPE_CORNERPOINT 1
#define FILEHEAD_SINGLE_POROSITY 0
#define FILEHEAD_DUAL_POROSITY 1
#define FILEHEAD_DUAL_PERMEABILITY 2
#define INACTIVE 0
#define ACTIVE_MATRIX 1
#define ACTIVE ACTIVE_MATRIX
#define ACTIVE_FRACTURE 2
#ifdef __cplusplus
}

View File

@ -169,20 +169,20 @@ static time_t file_map_iget_restart_sim_date(const file_map_type * file_map , in
static int file_map_find_sim_time(const file_map_type * file_map , time_t sim_time) {
int global_index = -1;
int seqnum_index = -1;
if ( file_map_has_kw( file_map , INTEHEAD_KW)) {
const int_vector_type * intehead_index_list = hash_get( file_map->kw_index , INTEHEAD_KW );
int index = 0;
while (index < int_vector_size( intehead_index_list )) {
const ecl_kw_type * intehead_kw = file_map_iget_kw( file_map , int_vector_iget( intehead_index_list , index ));
if (ecl_intehead_date( intehead_kw ) == sim_time) {
global_index = int_vector_iget( intehead_index_list , index );
seqnum_index = index;
break;
}
index++;
}
}
return global_index;
return seqnum_index;
}
@ -297,6 +297,42 @@ bool ecl_file_has_sim_time( const ecl_file_type * ecl_file , time_t sim_time) {
}
/*
This function will determine the restart block corresponding to the
world time @sim_time; if @sim_time can not be found the function
will return 0.
The returned index is the 'occurence number' in the restart file,
i.e. in the (quite typical case) that not all report steps are
present the return value will not agree with report step.
The return value from this function can then be used to get a
corresponding solution field directly, or the file map can
restricted to this block.
Direct access:
int index = ecl_file_get_restart_index( ecl_file , sim_time );
if (index >= 0) {
ecl_kw_type * pressure_kw = ecl_file_iget_named_kw( ecl_file , "PRESSURE" , index );
....
}
Using block restriction:
int index = ecl_file_get_restart_index( ecl_file , sim_time );
if (index >= 0) {
ecl_file_iselect_rstblock( ecl_file , index );
{
ecl_kw_type * pressure_kw = ecl_file_iget_named_kw( ecl_file , "PRESSURE" , 0 );
....
}
}
Specially in the case of LGRs the block restriction should be used.
*/
int ecl_file_get_restart_index( const ecl_file_type * ecl_file , time_t sim_time) {
int active_index = file_map_find_sim_time( ecl_file->active_map , sim_time );
return active_index;

View File

@ -1662,6 +1662,12 @@ const char * ecl_smspec_get_join_string( const ecl_smspec_type * smspec) {
Returns a stringlist instance with all the (valid) well names. It
is the responsability of the calling scope to free the stringlist
with stringlist_free();
If @pattern is different from NULL only wells which 'match' the
pattern is included; if @pattern == NULL all wells are
included. The match is done with function fnmatch() -
i.e. standard shell wildcards.
*/
stringlist_type * ecl_smspec_alloc_well_list( const ecl_smspec_type * smspec , const char * pattern) {
@ -1739,3 +1745,10 @@ void ecl_smspec_update_wgname( ecl_smspec_type * smspec , smspec_node_type * nod
smspec_node_update_wgname( node , wgname , smspec->key_join_string);
ecl_smspec_index_node( smspec , node );
}
/*****************************************************************/
char * ecl_smspec_alloc_well_key( const ecl_smspec_type * smspec , const char * keyword , const char * wgname) {
return smspec_alloc_well_key( smspec->key_join_string , keyword , wgname );
}

View File

@ -136,6 +136,9 @@ typedef struct ecl_smspec_struct ecl_smspec_type;
const smspec_node_type * ecl_smspec_iget_node( const ecl_smspec_type * smspec , int index );
void ecl_smspec_lock( ecl_smspec_type * smspec );
char * ecl_smspec_alloc_well_key( const ecl_smspec_type * smspec , const char * keyword , const char * wgname);
#ifdef __cplusplus
}
#endif

View File

@ -20,6 +20,7 @@
#include <stdbool.h>
#include <math.h>
#include <time.h>
#include <locale.h>
#include <hash.h>
#include <util.h>
@ -612,15 +613,13 @@ bool ecl_sum_has_key(const ecl_sum_type * ecl_sum , const char * lookup_kw) {
return ecl_sum_has_general_var( ecl_sum , lookup_kw );
}
double ecl_sum_get_general_var(const ecl_sum_type * ecl_sum , int time_index , const char * lookup_kw) {
int params_index = ecl_sum_get_general_var_params_index(ecl_sum , lookup_kw);
return ecl_sum_data_iget( ecl_sum->data , time_index , params_index);
return ecl_sum_data_iget( ecl_sum->data , time_index , params_index);
}
double ecl_sum_iget_general_var(const ecl_sum_type * ecl_sum , int internal_index , const char * lookup_kw) {
int params_index = ecl_sum_get_general_var_params_index(ecl_sum , lookup_kw);
return ecl_sum_data_iget( ecl_sum->data , internal_index , params_index);
}
double ecl_sum_get_general_var_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const char * var) {
const smspec_node_type * node = ecl_sum_get_general_var_node( ecl_sum , var );
@ -632,6 +631,7 @@ double ecl_sum_get_general_var_from_sim_days( const ecl_sum_type * ecl_sum , dou
return ecl_sum_data_get_from_sim_days( ecl_sum->data , sim_days , node );
}
const char * ecl_sum_get_general_var_unit( const ecl_sum_type * ecl_sum , const char * var) {
const smspec_node_type * node = ecl_sum_get_general_var_node( ecl_sum , var );
return smspec_node_get_unit( node );
@ -639,8 +639,8 @@ const char * ecl_sum_get_general_var_unit( const ecl_sum_type * ecl_sum , const
/*****************************************************************/
double ecl_sum_iiget( const ecl_sum_type * ecl_sum , int internal_index , int param_index) {
return ecl_sum_data_iget(ecl_sum->data , internal_index , param_index);
double ecl_sum_iget( const ecl_sum_type * ecl_sum , int time_index , int param_index) {
return ecl_sum_data_iget(ecl_sum->data , time_index , param_index);
}
/*****************************************************************/
@ -830,51 +830,109 @@ double ecl_sum_iget_sim_days( const ecl_sum_type * ecl_sum , int index ) {
/*****************************************************************/
/* This is essentially the summary.x program. */
#define DAYS_DATE_FORMAT "%7.2f %02d/%02d/%04d "
#define FLOAT_FORMAT " %15.6g "
#define HEADER_FORMAT " %15s "
#define DATE_HEADER "-- Days dd/mm/yyyy "
#define DATE_DASH "-----------------------"
#define FLOAT_DASH "-----------------"
void ecl_sum_fmt_init_csv( ecl_sum_fmt_type * fmt ) {
fmt->locale = "Norwegian";
fmt->sep = "\t";
fmt->date_fmt = "%d/%m/%y";
fmt->value_fmt = "%g";
fmt->days_fmt = "%7.2f";
fmt->header_fmt = "%s";
static void __ecl_sum_fprintf_line( const ecl_sum_type * ecl_sum , FILE * stream , int internal_index , const bool_vector_type * has_var , const int_vector_type * var_index ) {
int ivar , day,month,year;
util_set_date_values(ecl_sum_iget_sim_time(ecl_sum , internal_index ) , &day , &month, &year);
fprintf(stream , DAYS_DATE_FORMAT , ecl_sum_iget_sim_days(ecl_sum , internal_index) , day , month , year);
for (ivar = 0; ivar < int_vector_size( var_index ); ivar++)
if (bool_vector_iget( has_var , ivar ))
fprintf(stream , FLOAT_FORMAT , ecl_sum_iiget(ecl_sum , internal_index, int_vector_iget( var_index , ivar )));
fprintf(stream , "\n");
fmt->newline = "\r\n";
fmt->date_header = "DAYS\tDATE";
fmt->print_header = true;
fmt->print_dash = false;
}
static void ecl_sum_fprintf_header( const ecl_sum_type * ecl_sum , const stringlist_type * key_list , const bool_vector_type * has_var , FILE * stream) {
fprintf(stream , DATE_HEADER);
void ecl_sum_fmt_init_summary_x( ecl_sum_fmt_type * fmt ) {
fmt->locale = NULL;
fmt->sep = "";
fmt->date_fmt = "%d/%m/%Y ";
fmt->value_fmt = " %15.6g ";
fmt->days_fmt = "%7.2f ";
fmt->header_fmt = " %15s ";
fmt->newline = "\n";
fmt->print_header= true;
fmt->print_dash = true;
fmt->date_dash = "-----------------------";
fmt->value_dash = "-----------------";
fmt->date_header= "-- Days dd/mm/yyyy ";
}
/*#define DAYS_DATE_FORMAT "%7.2f %02d/%02d/%04d "
#define FLOAT_FORMAT " %15.6g "
#define HEADER_FORMAT " %15s "
#define DATE_DASH "-----------------------"
#define FLOAT_DASH "-----------------"
*/
#define DATE_HEADER "-- Days dd/mm/yyyy "
#define DATE_STRING_LENGTH 128
static void __ecl_sum_fprintf_line( const ecl_sum_type * ecl_sum , FILE * stream , int internal_index , const bool_vector_type * has_var , const int_vector_type * var_index , char * date_string , const ecl_sum_fmt_type * fmt) {
int ivar , day,month,year;
util_set_date_values(ecl_sum_iget_sim_time(ecl_sum , internal_index ) , &day , &month, &year);
fprintf(stream , fmt->days_fmt , ecl_sum_iget_sim_days(ecl_sum , internal_index));
fprintf(stream , fmt->sep );
{
struct tm ts;
time_t sim_time = ecl_sum_iget_sim_time(ecl_sum , internal_index );
util_localtime( &sim_time , &ts);
strftime( date_string , DATE_STRING_LENGTH - 1 , fmt->date_fmt , &ts);
fprintf(stream , date_string );
}
for (ivar = 0; ivar < int_vector_size( var_index ); ivar++) {
if (bool_vector_iget( has_var , ivar )) {
fprintf(stream , fmt->sep);
fprintf(stream , fmt->value_fmt , ecl_sum_iget(ecl_sum , internal_index, int_vector_iget( var_index , ivar )));
}
}
fprintf(stream , fmt->newline);
}
static void ecl_sum_fprintf_header( const ecl_sum_type * ecl_sum , const stringlist_type * key_list , const bool_vector_type * has_var , FILE * stream, const ecl_sum_fmt_type * fmt) {
fprintf(stream , fmt->date_header);
{
int i;
for (i=0; i < stringlist_get_size( key_list ); i++)
if (bool_vector_iget( has_var , i ))
fprintf(stream , HEADER_FORMAT , stringlist_iget( key_list , i ));
if (bool_vector_iget( has_var , i )) {
fprintf(stream , fmt->sep);
fprintf(stream , fmt->header_fmt , stringlist_iget( key_list , i ));
}
}
fprintf( stream , "\n");
fprintf(stream , DATE_DASH);
{
int i;
for (i=0; i < stringlist_get_size( key_list ); i++)
if (bool_vector_iget( has_var , i ))
fprintf(stream , FLOAT_DASH);
fprintf( stream , fmt->newline);
if (fmt->print_dash) {
fprintf(stream , fmt->date_dash);
{
int i;
for (i=0; i < stringlist_get_size( key_list ); i++)
if (bool_vector_iget( has_var , i ))
fprintf(stream , fmt->value_dash);
}
fprintf( stream , fmt->newline);
}
fprintf( stream , "\n");
}
void ecl_sum_fprintf(const ecl_sum_type * ecl_sum , FILE * stream , const stringlist_type * var_list , bool report_only , bool print_header) {
void ecl_sum_fprintf(const ecl_sum_type * ecl_sum , FILE * stream , const stringlist_type * var_list , bool report_only , const ecl_sum_fmt_type * fmt) {
bool_vector_type * has_var = bool_vector_alloc( stringlist_get_size( var_list ), false );
int_vector_type * var_index = int_vector_alloc( stringlist_get_size( var_list ), -1 );
char * date_string = util_malloc( DATE_STRING_LENGTH * sizeof * date_string);
char * current_locale = NULL;
if (fmt->locale != NULL)
current_locale = setlocale(LC_NUMERIC , fmt->locale);
{
int ivar;
@ -889,8 +947,8 @@ void ecl_sum_fprintf(const ecl_sum_type * ecl_sum , FILE * stream , const string
}
}
if (print_header)
ecl_sum_fprintf_header( ecl_sum , var_list , has_var , stream );
if (fmt->print_header)
ecl_sum_fprintf_header( ecl_sum , var_list , has_var , stream , fmt);
if (report_only) {
int first_report = ecl_sum_get_first_report_step( ecl_sum );
@ -899,20 +957,23 @@ void ecl_sum_fprintf(const ecl_sum_type * ecl_sum , FILE * stream , const string
for (report = first_report; report <= last_report; report++) {
if (ecl_sum_data_has_report_step(ecl_sum->data , report)) {
int internal_index;
internal_index = ecl_sum_data_iget_report_end( ecl_sum->data , report );
__ecl_sum_fprintf_line( ecl_sum , stream , internal_index , has_var , var_index );
int time_index;
time_index = ecl_sum_data_iget_report_end( ecl_sum->data , report );
__ecl_sum_fprintf_line( ecl_sum , stream , time_index , has_var , var_index , date_string , fmt);
}
}
} else {
int internal_index;
for (internal_index = 0; internal_index < ecl_sum_get_data_length( ecl_sum ); internal_index++)
__ecl_sum_fprintf_line( ecl_sum , stream , internal_index , has_var , var_index );
int time_index;
for (time_index = 0; time_index < ecl_sum_get_data_length( ecl_sum ); time_index++)
__ecl_sum_fprintf_line( ecl_sum , stream , time_index , has_var , var_index , date_string , fmt);
}
int_vector_free( var_index );
bool_vector_free( has_var );
if (current_locale != NULL)
setlocale( LC_NUMERIC , current_locale);
}
#undef DATE_STRING_LENGTH
const char * ecl_sum_get_case(const ecl_sum_type * ecl_sum) {
@ -1080,3 +1141,22 @@ void ecl_sum_update_wgname( ecl_sum_type * ecl_sum , smspec_node_type * node , c
ecl_smspec_update_wgname( ecl_sum->smspec ,node , wgname );
}
/*****************************************************************/
/*
The functions below are extremly simple functions which only serve
as an easy access to the smspec_alloc_xxx_key() functions which
know how to create the various composite keys.
*/
char * ecl_sum_alloc_well_key( const ecl_sum_type * ecl_sum , const char * keyword , const char * wgname) {
return ecl_smspec_alloc_well_key( ecl_sum->smspec , keyword , wgname );
}

View File

@ -36,6 +36,25 @@ extern "C" {
#include <smspec_node.h>
typedef struct {
char * locale;
char * sep;
char * newline;
char * value_fmt;
char * date_fmt;
char * days_fmt;
char * header_fmt;
bool print_header;
bool print_dash;
char * date_header;
char * date_dash;
char * value_dash;
} ecl_sum_fmt_type;
void ecl_sum_fmt_init_csv( ecl_sum_fmt_type * fmt );
void ecl_sum_fmt_init_summary_x( ecl_sum_fmt_type * fmt );
/*****************************************************************/
typedef struct ecl_sum_struct ecl_sum_type;
double ecl_sum_get_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const smspec_node_type * node);
@ -53,7 +72,7 @@ typedef struct ecl_sum_struct ecl_sum_type;
const char * ecl_sum_get_unit( const ecl_sum_type * sum , const char * gen_key );
int ecl_sum_get_num( const ecl_sum_type * sum , const char * gen_key );
double ecl_sum_iiget( const ecl_sum_type * ecl_sum , int internal_index , int param_index);
double ecl_sum_iget( const ecl_sum_type * ecl_sum , int time_index , int param_index);
int ecl_sum_iget_num( const ecl_sum_type * sum , int param_index );
const char * ecl_sum_iget_wgname( const ecl_sum_type * sum , int param_index );
const char * ecl_sum_iget_keyword( const ecl_sum_type * sum , int param_index );
@ -114,7 +133,7 @@ typedef struct ecl_sum_struct ecl_sum_type;
double ecl_sum_get_general_var_from_sim_time( const ecl_sum_type * ecl_sum , time_t sim_time , const char * var);
const char * ecl_sum_get_general_var_unit( const ecl_sum_type * ecl_sum , const char * var);
/***************/
void ecl_sum_fprintf(const ecl_sum_type * , FILE * , const stringlist_type * , bool report_only , bool print_header);
void ecl_sum_fprintf(const ecl_sum_type * , FILE * , const stringlist_type * , bool report_only , const ecl_sum_fmt_type * fmt);
@ -178,6 +197,7 @@ typedef struct ecl_sum_struct ecl_sum_type;
ecl_sum_tstep_type * ecl_sum_add_tstep( ecl_sum_type * ecl_sum , int report_step , double sim_days);
void ecl_sum_update_wgname( ecl_sum_type * ecl_sum , smspec_node_type * node , const char * wgname );
char * ecl_sum_alloc_well_key( const ecl_sum_type * ecl_sum , const char * keyword , const char * wgname);
UTIL_IS_INSTANCE_HEADER( ecl_sum );
#ifdef __cplusplus

View File

@ -38,7 +38,8 @@ void point_mapaxes_invtransform( point_type * p , const double origo[2], const d
double dx = p->x - origo[0];
double dy = p->y - origo[1];
double org_x = (dx*unit_y[1] - dy*unit_y[0]) * norm;
double org_x = (dx*unit_y[1] - dy*unit_y[0]) * norm;
double org_y = (-dx*unit_x[1] + dy*unit_x[0]) * norm;
p->x = org_x;
@ -47,12 +48,12 @@ void point_mapaxes_invtransform( point_type * p , const double origo[2], const d
void point_compare( const point_type *p1 , const point_type * p2, bool * equal) {
const double tolerance = 0.0001;
if ((abs(p1->x - p2->x) + abs(p1->y - p2->y) + abs(p1->z - p2->z)) > tolerance) {
if ((abs(p1->x - p2->x) + abs(p1->y - p2->y) + abs(p1->z - p2->z)) > tolerance)
*equal = false;
printf("Setting different: (%g , %g , %g) (%g , %g , %g) \n",p1->x,p1->y , p1->z , p2->x , p2->y , p2->z);
}
}

View File

@ -1,9 +1,8 @@
set( ENKF_INSTALL_PREFIX "" CACHE STRING "Prefix for installation of libenkf")
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src/plot )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src )
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/src )
include_directories( ${libutil_build_path})
include_directories( ${libutil_src_path} )
include_directories( ${libecl_src_path} )
include_directories( ${librms_src_path} )
include_directories( ${libconfig_src_path} )

View File

@ -1 +0,0 @@
SConscript(["src/SConscript", "applications/SConstruct"])

View File

@ -1 +0,0 @@
SConscript(["ert_tui/SConstruct"])

View File

@ -1,2 +0,0 @@
#define SITE_CONFIG_FILE "@SITE_CONFIG_FILE@"

View File

@ -49,7 +49,7 @@ tui_objects = env.Object( ["enkf_tui_main.c" , "enkf_tui_fs.c" ,
"enkf_tui_plot_util.c" , "enkf_tui_run.c",
"enkf_tui_util.c" , "enkf_tui_init.c" ,
"enkf_tui_export.c" , "enkf_tui_analysis.c" ,
"enkf_tui_QC.c"])
"enkf_tui_QC.c" , "enkf_tui_help.c"])
define_fmt = "\'%s=\"%s\"\'"
main_object = env.Object("main.c" , CPPDEFINES = "DEVEL_VERSION")

View File

@ -34,7 +34,7 @@
#include <msg.h>
#include <gen_data.h>
#include <gen_data_config.h>
#include <enkf_tui_help.h>
#define PROMPT_LEN 60
@ -780,6 +780,7 @@ void enkf_tui_export_menu(void * arg) {
menu_add_item(menu , "Export GEN_DATA/GEN_PARAM to file" , "dD" , enkf_tui_export_gen_data , enkf_main , NULL);
menu_add_separator( menu );
menu_add_item(menu , "EclWrite mean and std" , "mM" , enkf_tui_export_stat , enkf_main , NULL );
menu_add_item(menu , "Help" , "hH" , enkf_tui_help_menu_export , enkf_main , NULL );
menu_run(menu);
menu_free(menu);
}

View File

@ -30,7 +30,7 @@
#include <enkf_types.h>
#include <enkf_fs.h>
#include <ranking_table.h>
#include <enkf_tui_help.h>
void enkf_tui_fs_ls_case(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
@ -414,7 +414,7 @@ void enkf_tui_fs_menu(void * arg) {
/* Are these two in use??? */
menu_add_item(menu, "Copy full ensemble to another case", "eE", enkf_tui_fs_copy_ensemble, enkf_main, NULL);
menu_add_item(menu, "Copy ensemble of parameters to another case", "oO", enkf_tui_fs_copy_ensemble_of_parameters, enkf_main, NULL);
menu_add_item(menu , "Help" , "hH" , enkf_tui_help_menu_cases , enkf_main , NULL);
menu_run(menu);
menu_free(menu);

View File

@ -37,7 +37,7 @@
void enkf_tui_init(enkf_main_type * enkf_main, bool all_members , bool all_parameters) {
void enkf_tui_init(enkf_main_type * enkf_main, bool all_members , bool all_parameters , bool interval ) {
const int prompt_len = 35;
const ensemble_config_type * ensemble_config = enkf_main_get_ensemble_config(enkf_main);
int ens_size = enkf_main_get_ensemble_size( enkf_main );
@ -50,13 +50,27 @@ void enkf_tui_init(enkf_main_type * enkf_main, bool all_members , bool all_param
iens2 = ens_size - 1;
iens_valid = true;
} else {
char * iens1char = util_scanf_int_with_limits_return_char("Initialize ensemble member" , prompt_len , 0 , ens_size - 1);
if (strlen(iens1char)) {
util_sscanf_int(iens1char , &iens1);
iens2 = iens1;
iens_valid = true;
if( interval ) {
char * iens1char = util_scanf_int_with_limits_return_char("First ensemble member in interval" , prompt_len , 0 , ens_size - 1);
if (strlen(iens1char)) {
util_sscanf_int(iens1char , &iens1);
char * iens2char = util_scanf_int_with_limits_return_char("Second ensemble member in interval" , prompt_len , iens1 , ens_size - 1);
if (strlen(iens2char)) {
util_sscanf_int(iens2char , &iens2);
iens_valid = true;
}
free(iens2char);
}
free(iens1char);
} else {
char * iens1char = util_scanf_int_with_limits_return_char("Initialize ensemble member" , prompt_len , 0 , ens_size - 1);
if (strlen(iens1char)) {
util_sscanf_int(iens1char , &iens1);
iens2 = iens1;
iens_valid = true;
}
free(iens1char);
}
free(iens1char);
}
if (iens_valid) {
@ -80,32 +94,39 @@ void enkf_tui_init(enkf_main_type * enkf_main, bool all_members , bool all_param
static void enkf_tui_init1(void * enkf_main) {
enkf_tui_init(enkf_main, true , true);
enkf_tui_init(enkf_main, true , true , false);
}
static void enkf_tui_init2(void * enkf_main) {
enkf_tui_init(enkf_main , true , false);
enkf_tui_init(enkf_main , true , false , false);
}
static void enkf_tui_init3(void * enkf_main) {
enkf_tui_init(enkf_main , false , true );
enkf_tui_init(enkf_main , false , true , false);
}
static void enkf_tui_init4(void * enkf_main) {
enkf_tui_init(enkf_main , false , false);
enkf_tui_init(enkf_main , false , false, false);
}
static void enkf_tui_init5(void * enkf_main) {
enkf_tui_init(enkf_main , false , true, true);
}
static void enkf_tui_init6(void * enkf_main) {
enkf_tui_init(enkf_main , false , false, true);
}
void enkf_tui_init_menu(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast(arg);
menu_type * menu = menu_alloc("Initialize from scratch" , "Back" , "bB");
menu_add_item(menu , "Initialize all members/all parameters" , "1" , enkf_tui_init1 , enkf_main , NULL);
menu_add_item(menu , "Initialize all members/one parameter" , "2" , enkf_tui_init2 , enkf_main , NULL);
menu_add_item(menu , "Initialize one member/all parameters" , "3" , enkf_tui_init3 , enkf_main , NULL);
menu_add_item(menu , "Initialize one member/one parameter" , "4" , enkf_tui_init4 , enkf_main , NULL);
menu_add_item(menu , "Initialize all members/all parameters" , "1" , enkf_tui_init1 , enkf_main , NULL);
menu_add_item(menu , "Initialize all members/one parameter" , "2" , enkf_tui_init2 , enkf_main , NULL);
menu_add_item(menu , "Initialize one member/all parameters" , "3" , enkf_tui_init3 , enkf_main , NULL);
menu_add_item(menu , "Initialize one member/one parameter" , "4" , enkf_tui_init4 , enkf_main , NULL);
menu_add_item(menu , "Initialize interval of ensemble members/all parameters" , "5" , enkf_tui_init5 , enkf_main , NULL);
menu_add_item(menu , "Initialize interval of ensemble members/one parameter" , "6" , enkf_tui_init6 , enkf_main , NULL);
menu_run(menu);
menu_free(menu);

View File

@ -30,7 +30,9 @@
#include <enkf_tui_fs.h>
#include <enkf_tui_ranking.h>
#include <enkf_tui_QC.h>
#include <enkf_tui_help.h>
#include <enkf_tui_misc.h>
#include <enkf_tui_simple.h>
#include <enkf_main.h>
#include <enkf_sched.h>
@ -53,15 +55,16 @@
void enkf_tui_main_menu(enkf_main_type * enkf_main) {
menu_type * menu = menu_alloc("Main menu" , "Quit" , "qQ");
menu_add_item(menu , "Manage cases" , "cC" , enkf_tui_fs_menu , enkf_main , NULL);
menu_add_item(menu , "Run, restart or analyse experiment" , "rR" , enkf_tui_run_menu , enkf_main , NULL);
menu_add_item(menu , "Prior quality check" , "uU" , enkf_tui_QC_menu , enkf_main , NULL);
menu_add_item(menu , "Plot results" , "pP" , enkf_tui_plot_menu , enkf_main , NULL);
menu_add_item(menu , "Rank results" , "aA" , enkf_tui_ranking_menu, enkf_main , NULL);
menu_add_item(menu , "Export data to other formats" , "eE" , enkf_tui_export_menu , enkf_main , NULL);
menu_add_item(menu , "Table of results" , "tT" , enkf_tui_table_menu , enkf_main , NULL);
menu_add_item(menu , "Miscellanous" , "mM" , enkf_tui_misc_menu , enkf_main , NULL);
menu_add_item(menu , "Manage cases" , "cC" , enkf_tui_fs_menu , enkf_main , NULL);
menu_add_item(menu , "Run, restart or analyse experiment" , "rR" , enkf_tui_run_menu , enkf_main , NULL);
menu_add_item(menu , "Prior quality check" , "uU" , enkf_tui_QC_menu , enkf_main , NULL);
menu_add_item(menu , "Plot results" , "pP" , enkf_tui_plot_menu , enkf_main , NULL);
menu_add_item(menu , "Rank results" , "aA" , enkf_tui_ranking_menu , enkf_main , NULL);
menu_add_item(menu , "Export data to other formats" , "eE" , enkf_tui_export_menu , enkf_main , NULL);
menu_add_item(menu , "Table of results" , "tT" , enkf_tui_table_menu , enkf_main , NULL);
menu_add_item(menu , "Miscellanous" , "mM" , enkf_tui_misc_menu , enkf_main , NULL);
menu_add_item(menu , "Help" , "hH" , enkf_tui_help_menu_main , enkf_main , NULL);
menu_add_item(menu , "Simple menu" , "sS" , enkf_tui_simple_menu , enkf_main , NULL);
menu_run(menu);
menu_free(menu);
}

View File

@ -24,7 +24,7 @@
#include <enkf_tui_misc.h>
#include <ext_joblist.h>
#include <ext_job.h>
#include <enkf_tui_help.h>
static void enkf_tui_misc_printf_subst_list(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
@ -68,6 +68,7 @@ void enkf_tui_misc_menu( void * arg) {
menu_type * menu = menu_alloc( "Misceallanous stuff" , "Back" , "bB");
menu_add_item(menu , "List all \'magic\' <...> strings" , "lL" , enkf_tui_misc_printf_subst_list , enkf_main , NULL);
menu_add_item(menu , "List all available forward model jobs","jJ" , enkf_tui_misc_list_jobs , enkf_main , NULL );
menu_add_item(menu , "Help","hH" , enkf_tui_help_menu_misc , enkf_main , NULL );
menu_run(menu);
menu_free(menu);
}

View File

@ -62,7 +62,7 @@
#include <enkf_tui_plot_util.h>
#include <enkf_tui_plot.h>
#include <enkf_tui_fs.h>
#include <enkf_tui_help.h>
/**
The final plot path consists of three parts:
@ -577,34 +577,70 @@ void enkf_tui_plot_all_GEN_KW(void * arg) {
void enkf_tui_plot_histogram__(enkf_main_type * enkf_main , enkf_fs_type * fs , char * user_key , state_enum plot_state , int report_step){
const ensemble_config_type * ensemble_config = enkf_main_get_ensemble_config(enkf_main);
const plot_config_type * plot_config = enkf_main_get_plot_config( enkf_main );
const char * case_name = enkf_main_get_current_fs( enkf_main );
{
const enkf_config_node_type * config_node;
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
char * key_index;
double * count = util_calloc(ens_size , sizeof * count );
int iens;
char * plot_file = enkf_tui_plot_alloc_plot_file( plot_config , case_name , user_key );
plot_type * plot = enkf_tui_plot_alloc(plot_config , user_key , "#" ,user_key , plot_file);
config_node = ensemble_config_user_get_node( ensemble_config , user_key , &key_index);
if (config_node == NULL) {
fprintf(stderr,"** Sorry - could not find any nodes with the key:%s \n",user_key);
util_safe_free(key_index);
return;
}
{
int active_size = 0;
enkf_node_type * node = enkf_node_alloc( config_node );
node_id_type node_id = {.report_step = report_step ,
.iens = 0 ,
.state = plot_state };
for (iens = 0; iens < ens_size; iens++) {
node_id.iens = iens;
if (enkf_node_user_get( node , fs , key_index , node_id , &count[active_size]))
active_size++;
}
enkf_node_free( node );
{
plot_dataset_type * d = plot_alloc_new_dataset( plot , NULL , PLOT_HIST);
plot_dataset_append_vector_hist(d , active_size , count);
if(plot_dataset_get_size(d) > 0){
enkf_tui_show_plot(plot , plot_config , plot_file);}
else{
fprintf(stderr,"** There is no data to plot. Are you trying to plot analyzed data after a forward run with option x? \n");}
}
}
free(count);
util_safe_free(key_index);
}
}
void enkf_tui_plot_histogram(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
const ensemble_config_type * ensemble_config = enkf_main_get_ensemble_config(enkf_main);
enkf_fs_type * fs = enkf_main_get_fs(enkf_main);
const time_map_type * time_map = enkf_fs_get_time_map( fs );
const plot_config_type * plot_config = enkf_main_get_plot_config( enkf_main );
const char * case_name = enkf_main_get_current_fs( enkf_main );
enkf_fs_type * fs = enkf_main_get_fs( enkf_main );
const time_map_type * time_map = enkf_fs_get_time_map( fs );
{
const char * prompt = "What do you want to plot (KEY:INDEX)";
const enkf_config_node_type * config_node;
char * user_key;
util_printf_prompt(prompt , PROMPT_LEN , '=' , "=> ");
user_key = util_alloc_stdin_line();
if (user_key != NULL) {
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
state_enum plot_state = ANALYZED; /* Compiler shut up */
char * key_index;
const int last_report = time_map_get_last_step( time_map );
double * count = util_calloc(ens_size , sizeof * count );
int iens , report_step;
char * plot_file = enkf_tui_plot_alloc_plot_file( plot_config , case_name , user_key );
plot_type * plot = enkf_tui_plot_alloc(plot_config , user_key , "#" ,user_key , plot_file);
int report_step;
config_node = ensemble_config_user_get_node( ensemble_config , user_key , &key_index);
if (config_node == NULL) {
fprintf(stderr,"** Sorry - could not find any nodes with the key:%s \n",user_key);
@ -614,34 +650,26 @@ void enkf_tui_plot_histogram(void * arg) {
report_step = util_scanf_int_with_limits("Report step: ", PROMPT_LEN , 0 , last_report);
{
enkf_var_type var_type = enkf_config_node_get_var_type(config_node);
if ((var_type == DYNAMIC_STATE) || (var_type == DYNAMIC_RESULT))
if ((var_type == DYNAMIC_STATE) || (var_type == DYNAMIC_RESULT)) {
plot_state = enkf_tui_util_scanf_state("Plot Forecast/Analyzed: [F|A]" , PROMPT_LEN , false);
else if (var_type == PARAMETER)
enkf_tui_plot_histogram__(enkf_main , fs , user_key , plot_state, report_step);
}
else if (var_type == PARAMETER){
plot_state = ANALYZED;
gen_kw_config_type * gen_kw_config = enkf_config_node_get_ref( config_node );
stringlist_type * key_list = gen_kw_config_alloc_name_list( gen_kw_config );
int ikw;
for (ikw = 0; ikw < stringlist_get_size( key_list ); ikw++) {
char * user_key = gen_kw_config_alloc_user_key( gen_kw_config , ikw );
enkf_tui_plot_histogram__(enkf_main , fs , user_key , plot_state, report_step);
free( user_key );
}
stringlist_free( key_list );
}
else
util_abort("%s: can not plot this type \n",__func__);
}
{
int active_size = 0;
enkf_node_type * node = enkf_node_alloc( config_node );
node_id_type node_id = {.report_step = report_step ,
.iens = 0 ,
.state = plot_state };
for (iens = 0; iens < ens_size; iens++) {
node_id.iens = iens;
if (enkf_node_user_get( node , fs , key_index , node_id , &count[active_size]))
active_size++;
}
enkf_node_free( node );
{
plot_dataset_type * d = plot_alloc_new_dataset( plot , NULL , PLOT_HIST);
plot_dataset_append_vector_hist(d , active_size , count);
}
enkf_tui_show_plot(plot , plot_config , plot_file);
}
free(count);
util_safe_free(key_index);
}
util_safe_free( user_key );
@ -722,7 +750,59 @@ static void * enkf_tui_plot_ensemble_mt( void * void_arg ) {
arg_pack_iget_int( arg , 9 ));
return NULL;
}
void enkf_tui_plot_all_summary__( enkf_main_type * enkf_main , int iens1 , int iens2 , int step1 , int step2 , bool prediction_mode) {
/*
This code is prepared for multithreaded creation of plots;
however the low level PLPlot library is not thread safe, we
therefor must limit the the number of threads in the thread pool
to 0 - i.e. serial excution.
*/
//thread_pool_type * tp = thread_pool_alloc( 0 , true );
const ensemble_config_type * ensemble_config = enkf_main_get_ensemble_config(enkf_main);
const plot_config_type * plot_config = enkf_main_get_plot_config( enkf_main );
stringlist_type * summary_keys = ensemble_config_alloc_keylist_from_impl_type(ensemble_config , SUMMARY);
arg_pack_type ** arg_list = util_calloc( stringlist_get_size( summary_keys ) , sizeof * arg_list );
{
char * plot_path = util_alloc_filename( plot_config_get_path( plot_config ) , enkf_main_get_current_fs( enkf_main ) , NULL );
util_make_path( plot_path );
free( plot_path );
}
for (int ikey = 0; ikey < stringlist_get_size( summary_keys ); ikey++) {
const char * key = stringlist_iget( summary_keys , ikey);
arg_list[ikey] = arg_pack_alloc( );
{
arg_pack_type * arg = arg_list[ikey];
arg_pack_append_ptr( arg , enkf_main );
arg_pack_append_ptr( arg , ensemble_config_get_node( ensemble_config , key ));
arg_pack_append_ptr( arg , key );
arg_pack_append_ptr( arg , NULL );
arg_pack_append_int( arg , step1 );
arg_pack_append_int( arg , step2 );
arg_pack_append_bool( arg , prediction_mode );
arg_pack_append_int( arg , iens1 );
arg_pack_append_int( arg , iens2 );
arg_pack_append_int( arg , BOTH );
enkf_tui_plot_ensemble_mt( arg );
//thread_pool_add_job( tp , enkf_tui_plot_ensemble_mt , arg );
}
}
//thread_pool_join( tp );
for (int ikey = 0; ikey < stringlist_get_size( summary_keys ); ikey++)
arg_pack_free( arg_list[ikey] );
free( arg_list );
stringlist_free( summary_keys );
//thread_pool_free( tp );
}
void enkf_tui_plot_all_summary(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
@ -743,54 +823,7 @@ void enkf_tui_plot_all_summary(void * arg) {
}
if (step1 != -2 && step2 != -2){
enkf_tui_util_scanf_iens_range("Realizations members to plot(0 - %d) [default: all]" , enkf_main_get_ensemble_size( enkf_main ) , PROMPT_LEN , &iens1 , &iens2);
{
/*
This code is prepared for multithreaded creation of plots;
however the low level PLPlot library is not thread safe, we
therefor must limit the the number of threads in the thread pool
to 0 - i.e. serial excution.
*/
//thread_pool_type * tp = thread_pool_alloc( 0 , true );
stringlist_type * summary_keys = ensemble_config_alloc_keylist_from_impl_type(ensemble_config , SUMMARY);
arg_pack_type ** arg_list = util_calloc( stringlist_get_size( summary_keys ) , sizeof * arg_list );
{
char * plot_path = util_alloc_filename( plot_config_get_path( plot_config ) , enkf_main_get_current_fs( enkf_main ) , NULL );
util_make_path( plot_path );
free( plot_path );
}
for (int ikey = 0; ikey < stringlist_get_size( summary_keys ); ikey++) {
const char * key = stringlist_iget( summary_keys , ikey);
arg_list[ikey] = arg_pack_alloc( );
{
arg_pack_type * arg = arg_list[ikey];
arg_pack_append_ptr( arg , enkf_main );
arg_pack_append_ptr( arg , ensemble_config_get_node( ensemble_config , key ));
arg_pack_append_ptr( arg , key );
arg_pack_append_ptr( arg , NULL );
arg_pack_append_int( arg , step1 );
arg_pack_append_int( arg , step2 );
arg_pack_append_bool( arg , prediction_mode );
arg_pack_append_int( arg , iens1 );
arg_pack_append_int( arg , iens2 );
arg_pack_append_int( arg , BOTH );
enkf_tui_plot_ensemble_mt( arg );
//thread_pool_add_job( tp , enkf_tui_plot_ensemble_mt , arg );
}
}
//thread_pool_join( tp );
for (int ikey = 0; ikey < stringlist_get_size( summary_keys ); ikey++)
arg_pack_free( arg_list[ikey] );
free( arg_list );
stringlist_free( summary_keys );
//thread_pool_free( tp );
}
enkf_tui_plot_all_summary__( enkf_main , iens1 , iens2 , step1 , step2 , prediction_mode);
}
}
@ -1138,6 +1171,66 @@ void enkf_tui_plot_reports( void * arg ) {
}
/*****************************************************************/
void enkf_tui_plot_simple_menu(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
plot_config_type * plot_config = enkf_main_get_plot_config( enkf_main );
{
const char * plot_path = plot_config_get_path( plot_config );
util_make_path( plot_path );
}
{
menu_type * menu;
{
char * title = util_alloc_sprintf("Plot results [case:%s]" , enkf_main_get_current_fs( enkf_main ));
menu = menu_alloc(title , "Back" , "bB");
free(title);
}
menu_add_item(menu , "Ensemble plot" , "eE" , enkf_tui_plot_ensemble , enkf_main , NULL);
menu_add_item(menu , "Ensemble plot of ALL summary variables" , "aA" , enkf_tui_plot_all_summary , enkf_main , NULL);
menu_add_item(menu , "Ensemble plot of GEN_KW parameter" , "g" , enkf_tui_plot_GEN_KW , enkf_main , NULL);
menu_add_item(menu , "Ensemble plot of ALL GEN_KW parameters" , "G" , enkf_tui_plot_all_GEN_KW , enkf_main , NULL);
menu_add_item(menu , "Observation plot" , "oO" , enkf_tui_plot_observation , enkf_main , NULL);
/* menu_add_separator( menu );
menu_add_item(menu , "Plot RFT and simulated pressure vs. TVD" , "tT" , enkf_tui_plot_RFT_sim_all_TVD , enkf_main , NULL);
menu_add_item(menu , "Plot RFT and simulated pressure vs. MD" , "mM" , enkf_tui_plot_RFT_sim_all_MD , enkf_main , NULL);
menu_add_separator( menu );
menu_add_item(menu , "Plot block observation (~RFT) versus depth" , "dD" , enkf_tui_plot_RFT_depth , enkf_main , NULL);
menu_add_item(menu , "Plot block observation (~RFT) versus time" , "iI" , enkf_tui_plot_RFT_time , enkf_main , NULL);
menu_add_item(menu , "Plot all block observations (~RFT) versus depth" , "rR" , enkf_tui_plot_all_RFT , enkf_main , NULL);
menu_add_separator( menu );*/
menu_add_item(menu , "Sensitivity plot" , "sS" , enkf_tui_plot_sensitivity , enkf_main , NULL);
menu_add_item(menu , "Histogram" , "H" , enkf_tui_plot_histogram , enkf_main , NULL);
menu_add_separator(menu);
{
menu_item_type * menu_item;
arg_pack_type * arg_pack = arg_pack_alloc();
menu_item = menu_add_item(menu , "" , "lL" , enkf_tui_toggle_logy , arg_pack , arg_pack_free__);
arg_pack_append_ptr( arg_pack , plot_config );
arg_pack_append_ptr( arg_pack , menu_item );
plot_config_toggle_logy( plot_config );
enkf_tui_toggle_logy( arg_pack ); /* This sets the label */
}
/* menu_add_separator(menu);
{
menu_item_type * menu_item = menu_add_item( menu , "Create pdf reports" , "pP" , enkf_tui_plot_reports , enkf_main , NULL );
ert_report_list_type * report_list = enkf_main_get_report_list( enkf_main );
if (ert_report_list_get_num( report_list ) == 0)
menu_item_disable( menu_item );
}*/
menu_add_item(menu , "Help" , "h" , enkf_tui_help_menu_plot , enkf_main , NULL);
menu_run(menu);
menu_free(menu);
}
}
/*****************************************************************/
void enkf_tui_plot_menu(void * arg) {
@ -1159,7 +1252,7 @@ void enkf_tui_plot_menu(void * arg) {
menu_add_item(menu , "Ensemble plot" , "eE" , enkf_tui_plot_ensemble , enkf_main , NULL);
menu_add_item(menu , "Ensemble plot of ALL summary variables" , "aA" , enkf_tui_plot_all_summary , enkf_main , NULL);
menu_add_item(menu , "Ensemble plot of GEN_KW parameter" , "g" , enkf_tui_plot_GEN_KW , enkf_main , NULL);
menu_add_item(menu , "Ensemble plot of ALL ALL GEN_KW parameters" , "G" , enkf_tui_plot_all_GEN_KW , enkf_main , NULL);
menu_add_item(menu , "Ensemble plot of ALL GEN_KW parameters" , "G" , enkf_tui_plot_all_GEN_KW , enkf_main , NULL);
menu_add_item(menu , "Observation plot" , "oO" , enkf_tui_plot_observation , enkf_main , NULL);
menu_add_separator( menu );
menu_add_item(menu , "Plot RFT and simulated pressure vs. TVD" , "tT" , enkf_tui_plot_RFT_sim_all_TVD , enkf_main , NULL);
@ -1170,7 +1263,7 @@ void enkf_tui_plot_menu(void * arg) {
menu_add_item(menu , "Plot all block observations (~RFT) versus depth" , "rR" , enkf_tui_plot_all_RFT , enkf_main , NULL);
menu_add_separator( menu );
menu_add_item(menu , "Sensitivity plot" , "sS" , enkf_tui_plot_sensitivity , enkf_main , NULL);
menu_add_item(menu , "Histogram" , "hH" , enkf_tui_plot_histogram , enkf_main , NULL);
menu_add_item(menu , "Histogram" , "H" , enkf_tui_plot_histogram , enkf_main , NULL);
menu_add_separator(menu);
{
menu_item_type * menu_item;
@ -1191,7 +1284,7 @@ void enkf_tui_plot_menu(void * arg) {
menu_item_disable( menu_item );
}
menu_add_item(menu , "Help" , "h" , enkf_tui_help_menu_plot , enkf_main , NULL);
menu_run(menu);
menu_free(menu);
}

View File

@ -22,9 +22,9 @@
#include <matrix.h>
#include <enkf_main.h>
void enkf_tui_plot_simple_menu(void * );
void enkf_tui_plot_menu(void * );
void enkf_tui_plot_PC( enkf_main_type * enkf_main , const char * plot_name , const matrix_type * PC , const matrix_type * PC_obs);
void enkf_tui_plot_reports(void *);
void enkf_tui_plot_all_summary__( enkf_main_type * enkf_main , int iens1 , int iens2 , int step1 , int step2 , bool prediction_mode);
#endif

View File

@ -29,7 +29,7 @@
#include <enkf_tui_util.h>
#include <ranking_table.h>
#include <misfit_ensemble.h>
#include <enkf_tui_help.h>
static void enkf_tui_ranking_make_misfit_ensemble( void * arg) {
arg_pack_type * arg_pack = arg_pack_safe_cast( arg );
@ -202,6 +202,7 @@ void enkf_tui_ranking_menu(void * arg) {
if (!misfit_ensemble_initialized( misfit_ensemble ))
menu_item_disable( obs_item );
}
menu_add_item(menu , "Help" , "hH" , enkf_tui_help_menu_rank , enkf_main , NULL);
menu_run(menu);
menu_free(menu);
}

View File

@ -38,7 +38,7 @@
#include <enkf_tui_analysis.h>
#include <ert_tui_const.h>
#include <ecl_config.h>
#include <enkf_tui_help.h>
/*
Set runpath runtime - disabled.
@ -61,7 +61,7 @@ static void enkf_tui_run_set_runpath(void * arg) {
void enkf_tui_run_start__(void * enkf_main) {
void enkf_tui_run_start(void * enkf_main) {
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
bool_vector_type * iactive = bool_vector_alloc(0,true);
bool_vector_iset( iactive , ens_size - 1 , true );
@ -105,13 +105,13 @@ void enkf_tui_run_restart__(void * enkf_main) {
void enkf_tui_run_smoother__(void * arg) {
void enkf_tui_run_smoother(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
enkf_main_run_smoother(enkf_main , true , "AUTO-SMOOTHER" , true );
enkf_main_run_smoother(enkf_main , "AUTO-SMOOTHER" , true );
}
void enkf_tui_run_iterated_ES__(void * enkf_main) {
void enkf_tui_run_iterated_ES(void * enkf_main) {
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
const int last_report = enkf_main_get_history_length( enkf_main );
@ -193,7 +193,7 @@ void enkf_tui_run_iterated_ES__(void * enkf_main) {
void enkf_tui_run_exp__(void * enkf_main) {
void enkf_tui_run_exp(void * enkf_main) {
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
bool_vector_type * iactive = bool_vector_alloc(0,true);
bool_vector_iset( iactive , ens_size - 1 , true );
@ -202,6 +202,7 @@ void enkf_tui_run_exp__(void * enkf_main) {
int start_report = 0;
int init_step_parameters = 0;
char * select_string;
{
char * prompt = util_alloc_sprintf("Which realizations to simulate (Ex: 1,3-5) <Enter for all> [M to return to menu] : " , ens_size);
util_printf_prompt(prompt , PROMPT_LEN , '=' , "=> ");
@ -265,7 +266,7 @@ void enkf_tui_run_manual_load__( void * arg ) {
step1 = 0;
step2 = last_report; /** Observe that for the summary data it will load all the available data anyway. */
{
char * prompt = util_alloc_sprintf("Which realizations to load [ensemble size:%d] : " , ens_size);
char * prompt = util_alloc_sprintf("Which realizations to load (Ex: 1,3-5) <Enter for all> [M to return to menu] : [ensemble size:%d] : " , ens_size);
char * select_string;
util_printf_prompt(prompt , PROMPT_LEN , '=' , "=> ");
select_string = util_alloc_stdin_line();
@ -273,6 +274,10 @@ void enkf_tui_run_manual_load__( void * arg ) {
free( prompt );
free( select_string );
}
{
int iens;
arg_pack_type ** arg_list = util_calloc( ens_size , sizeof * arg_list );
@ -328,16 +333,16 @@ void enkf_tui_run_menu(void * arg) {
menu = menu_alloc(title , "Back" , "bB");
free(title);
}
menu_add_item(menu , "Ensemble run: history" , "xX" , enkf_tui_run_exp__ , enkf_main , NULL);
menu_add_item(menu , "Ensemble run: history" , "xX" , enkf_tui_run_exp , enkf_main , NULL);
menu_add_separator( menu );
{
const ecl_config_type * ecl_config = enkf_main_get_ecl_config( enkf_main );
const model_config_type * model_config = enkf_main_get_model_config( enkf_main );
menu_item_type * enkf_item = menu_add_item(menu , "Start EnKF run from beginning" , "sS" , enkf_tui_run_start__ , enkf_main , NULL);
menu_item_type * enkf_item = menu_add_item(menu , "Start EnKF run from beginning" , "sS" , enkf_tui_run_start , enkf_main , NULL);
menu_item_type * restart_enkf_item = menu_add_item(menu , "Restart EnKF run from arbitrary state" , "rR" , enkf_tui_run_restart__ , enkf_main , NULL);
menu_item_type * ES_item = menu_add_item(menu , "Integrated smoother update" , "iI" , enkf_tui_run_smoother__ , enkf_main , NULL);
menu_item_type * it_ES_item = menu_add_item(menu , "Iterated smoother [RML-EnKF]" , "tT" , enkf_tui_run_iterated_ES__ , enkf_main , NULL);
menu_item_type * ES_item = menu_add_item(menu , "Integrated smoother update" , "iI" , enkf_tui_run_smoother , enkf_main , NULL);
menu_item_type * it_ES_item = menu_add_item(menu , "Iterated smoother [RML-EnKF]" , "tT" , enkf_tui_run_iterated_ES , enkf_main , NULL);
if (!ecl_config_has_schedule( ecl_config )) {
menu_item_disable( enkf_item );
@ -375,6 +380,7 @@ void enkf_tui_run_menu(void * arg) {
free(runpath_label);
}
*/
menu_add_item(menu , "Help" , "hH" , enkf_tui_help_menu_run , enkf_main , NULL);
menu_run(menu);
menu_free(menu);

View File

@ -20,6 +20,9 @@
#define __ENKF_TUI_RUN_H__
void enkf_tui_run_menu(void *);
void enkf_tui_run_exp(void *);
void enkf_tui_run_start(void *);
void enkf_tui_run_smoother(void *);
void enkf_tui_run_iterated_ES(void *);
#endif

View File

@ -37,7 +37,7 @@
#include <ensemble_config.h>
#include <msg.h>
#include <gen_kw_config.h>
#include <enkf_tui_help.h>
@ -243,6 +243,7 @@ void enkf_tui_table_menu(void * arg) {
menu_add_item(menu , "Ensemble of parameters" , "eE" , enkf_tui_table_ensemble , enkf_main , NULL);
menu_add_item(menu , "GEN_KW ensemble" , "gG" , enkf_tui_table_GEN_KW_ensemble , enkf_main , NULL);
menu_add_item(menu , "Time development of parameters" , "tT" , enkf_tui_table_time , enkf_main , NULL);
menu_add_item(menu , "Help" , "hH" , enkf_tui_help_menu_table , enkf_main , NULL);
menu_run(menu);
menu_free(menu);
}

View File

@ -37,8 +37,7 @@
#include <enkf_types.h>
#include <enkf_sched.h>
#include <enkf_tui_main.h>
#include <ert_build_info.h>
#include <site_config_file.h>
void text_splash() {
const int usleep_time = 1000;
@ -75,13 +74,11 @@ void devel_warning() {
/*
SVN_VERSION and COMPILE_TIME_STAMP are env variables set by the
GIT_COMMIT and COMPILE_TIME_STAMP are env variables set by the
makefile. Will exit if the config file does not exist.
*/
void enkf_welcome(const char * config_file) {
if (util_file_exists( config_file )) {
char * svn_version = util_alloc_sprintf("svn version..........: %s \n",SVN_VERSION);
char * compile_time = util_alloc_sprintf("Compile time.........: %s \n",COMPILE_TIME_STAMP);
char * abs_path = util_alloc_realpath( config_file );
char * config_file_msg = util_alloc_sprintf("Configuration file...: %s \n",abs_path);
@ -91,8 +88,6 @@ void enkf_welcome(const char * config_file) {
free(config_file_msg);
free(abs_path);
free(svn_version);
free(compile_time);
} else util_exit(" ** Sorry: can not locate configuration file: %s \n\n" , config_file);
}
@ -119,19 +114,35 @@ void enkf_usage() {
static void init_debug( const char * executable ) {
char * git_commit = util_alloc_sprintf("git commit...........: %s \n",GIT_COMMIT);
char * compile_time = util_alloc_sprintf("Compile time.........: %s \n",COMPILE_TIME_STAMP);
/* This will be printed if/when util_abort() is called on a later stage. */
util_abort_append_version_info( git_commit );
util_abort_append_version_info( compile_time );
free(git_commit);
free(compile_time);
if (executable != NULL)
util_abort_set_executable( executable );
}
int main (int argc , char ** argv) {
devel_warning();
text_splash();
init_debug( NULL );
printf("\n");
printf("Documentation : %s \n","http://ert.nr.no");
printf("svn version : %s \n",SVN_VERSION);
printf("git commit : %s \n",GIT_COMMIT);
printf("compile time : %s \n",COMPILE_TIME_STAMP);
printf("site config : %s \n\n",SITE_CONFIG_FILE);
enkf_main_install_SIGNALS(); /* Signals common to both tui and gui. */
signal(SIGINT , util_abort_signal); /* Control C - tui only. */
enkf_main_init_debug( NULL );
if (argc != 2) {
enkf_usage();
exit(1);
@ -148,4 +159,5 @@ int main (int argc , char ** argv) {
util_abort_free_version_info(); /* No fucking leaks ... */
}
}

View File

@ -55,16 +55,16 @@
config_type * create_config( ) {
config_type * config = config_alloc( );
config_item_type * item;
config_schema_item_type * item;
item = config_add_item(config , ENSPATH_KEY , true , false);
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , ENSPATH_KEY , true , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , NUM_REALIZATIONS_KEY , true , false);
config_item_set_argc_minmax(item , 1 , 1 , 1, (const config_item_types [1]) {CONFIG_INT});
item = config_add_schema_item(config , NUM_REALIZATIONS_KEY , true , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1, (const config_item_types [1]) {CONFIG_INT});
item = config_add_item(config , REFCASE_KEY , true , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , NULL );
item = config_add_schema_item(config , REFCASE_KEY , true , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , NULL );
return config;
}
@ -268,7 +268,7 @@ int main (int argc , char ** argv) {
ecl_sum_type * refcase;
{
config_type * config = create_config();
config_parse( config , model_config_file , "--" , "INCLUDE" , "DEFINE" , false , false , true );
config_parse( config , model_config_file , "--" , "INCLUDE" , "DEFINE" , false , true );
{
char * path;
util_alloc_file_components(model_config_file , &path , NULL , NULL);

View File

@ -1,30 +1,23 @@
set( source_files ert_report.c time_map.c rng_config.c trans_func.c enkf_types.c enkf_obs.c obs_data.c block_obs.c enkf_config_node.c field_config.c field.c ecl_static_kw.c enkf_state.c enkf_util.c enkf_node.c gen_kw_config.c gen_kw.c enkf_fs.c fs_driver.c meas_data.c summary_obs.c summary.c summary_config.c gen_data_config.c gen_data.c gen_common.c gen_obs.c enkf_sched.c enkf_serialize.c ecl_config.c enkf_defaults.c ensemble_config.c model_config.c site_config.c active_list.c obs_vector.c field_trans.c plain_driver.c config_parser.c enkf_analysis.c local_ministep.c local_updatestep.c container_config.c container.c local_context.c local_config.c analysis_config.c misfit_ensemble.c misfit_member.c misfit_ts.c data_ranking.c misfit_ranking.c fs_types.c block_fs_driver.c plot_config.c ert_template.c member_config.c enkf_main.c local_dataset.c local_obsset.c surface.c surface_config.c plot/enkf_plot_data.c plot/enkf_plot_member.c)
set( source_files ert_report.c time_map.c rng_config.c trans_func.c enkf_types.c enkf_obs.c obs_data.c block_obs.c enkf_config_node.c field_config.c field.c ecl_static_kw.c enkf_state.c enkf_util.c enkf_node.c gen_kw_config.c gen_kw.c enkf_fs.c fs_driver.c meas_data.c summary_obs.c summary.c summary_config.c gen_data_config.c gen_data.c gen_common.c gen_obs.c enkf_sched.c enkf_serialize.c ecl_config.c enkf_defaults.c ensemble_config.c model_config.c site_config.c active_list.c obs_vector.c field_trans.c plain_driver.c config_parser.c enkf_analysis.c local_ministep.c local_updatestep.c container_config.c container.c local_context.c local_config.c analysis_config.c misfit_ensemble.c misfit_member.c misfit_ts.c data_ranking.c misfit_ranking.c ranking_table.c fs_types.c block_fs_driver.c plot_config.c ert_template.c member_config.c enkf_main.c local_dataset.c local_obsset.c surface.c surface_config.c plot/enkf_plot_data.c plot/enkf_plot_member.c qc_config.c ert_report_list.c plot/enkf_plot_arg.c)
set( header_files ert_report.h time_map.h rng_config.h enkf_fs_type.h trans_func.h enkf_obs.h obs_data.h enkf_config_node.h block_obs.h field_config.h field.h enkf_macros.h ecl_static_kw.h enkf_state.h enkf_util.h enkf_main.h enkf_node.h enkf_fs.h gen_kw_config.h gen_kw.h enkf_types.h fs_driver.h meas_data.h summary_obs.h summary_config.h summary_config.h gen_data_config.h gen_data.h gen_common.h gen_obs.h enkf_sched.h fs_types.h enkf_serialize.h plain_driver.h ecl_config.h ensemble_config.h model_config.h site_config.h active_list.h obs_vector.h field_trans.h plain_driver.h config_parser.h enkf_analysis.h local_ministep.h container.h local_updatestep.h local_config.h analysis_config.h misfit_ensemble.h misfit_ensemble_typedef.h misfit_ts.h misfit_member.h data_ranking.h ranking_common.h misfit_ranking.h block_fs_driver.h field_common.h gen_kw_common.h gen_data_common.h plot_config.h ert_template.h member_config.h enkf_defaults.h ert_build_info.h container_config.h local_dataset.h local_obsset.h surface.h surface_config.h local_context.h plot/enkf_plot_data.h plot/enkf_plot_member.h)
set( header_files ert_report.h time_map.h rng_config.h enkf_fs_type.h trans_func.h enkf_obs.h obs_data.h enkf_config_node.h block_obs.h field_config.h field.h enkf_macros.h ecl_static_kw.h enkf_state.h enkf_util.h enkf_main.h enkf_node.h enkf_fs.h gen_kw_config.h gen_kw.h enkf_types.h fs_driver.h meas_data.h summary_obs.h summary_config.h summary_config.h gen_data_config.h gen_data.h gen_common.h gen_obs.h enkf_sched.h fs_types.h enkf_serialize.h plain_driver.h ecl_config.h ensemble_config.h model_config.h site_config.h active_list.h obs_vector.h field_trans.h plain_driver.h config_parser.h enkf_analysis.h local_ministep.h container.h local_updatestep.h local_config.h analysis_config.h misfit_ensemble.h misfit_ensemble_typedef.h misfit_ts.h misfit_member.h data_ranking.h ranking_table.h ranking_common.h misfit_ranking.h block_fs_driver.h field_common.h gen_kw_common.h gen_data_common.h plot_config.h ert_template.h member_config.h enkf_defaults.h container_config.h local_dataset.h local_obsset.h surface.h surface_config.h local_context.h plot/enkf_plot_data.h plot/enkf_plot_member.h qc_config.h ert_report_list.h plot/enkf_plot_arg.h)
add_library( enkf_static STATIC ${source_files} )
add_library( enkf_shared SHARED ${source_files} )
add_library( enkf ${LIBRARY_TYPE} ${source_files} )
set_target_properties( enkf_static PROPERTIES OUTPUT_NAME enkf )
set_target_properties( enkf_shared PROPERTIES OUTPUT_NAME enkf )
exec_program( svnversion ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE SVN_VERSION)
exec_program( date OUTPUT_VARIABLE COMPILE_TIME_STAMP)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CMake/config/ert_build_info.h.in
${CMAKE_CURRENT_BINARY_DIR}/ert_build_info.h )
#configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CMake/config/ert_build_info.h.in
# ${CMAKE_CURRENT_BINARY_DIR}/ert_build_info.h )
#list( APPEND src_files ${CMAKE_CURRENT_BINARY_DIR}/ert_build_info.h )
#target_link_libraries( enkf_static ${util_static} ${ecl_static} ${geometry_static} ${sched_static} ${analysis} ${rms_static} ${plot_static} ${config_static} ${job_queue_static} )
#target_link_libraries( enkf_shared ${util_shared} ${ecl_shared} ${geometry_shared} ${sched_shared} ${analysis} ${rms_shared} ${plot_shared} ${config_shared} ${job_queue_shared} )
target_link_libraries( enkf ecl geometry sched analysis rms plot config job_queue )
#-----------------------------------------------------------------
if (ENKF_INSTALL_PREFIX)
install(TARGETS enkf_static DESTINATION ${INSTALL_ROOT}/${ENKF_INSTALL_PREFIX}/lib)
install(FILES ${header_files} DESTINATION ${INSTALL_ROOT}/${ENKF_INSTALL_PREFIX}/include)
install(TARGETS enkf DESTINATION ${ENKF_INSTALL_PREFIX}/lib)
install(FILES ${header_files} DESTINATION ${ENKF_INSTALL_PREFIX}/include)
else()
install(TARGETS enkf_static DESTINATION ${INSTALL_ROOT}/lib)
install(FILES ${header_files} DESTINATION ${INSTALL_ROOT}/include)
install(TARGETS enkf DESTINATION lib)
install(FILES ${header_files} DESTINATION include)
endif()

View File

@ -38,9 +38,9 @@ env = Environment()
conf.update_env( env , [ LIBANALYSIS , LIBJOB_QUEUE , LIBCONFIG , LIBRMS , LIBSCHED , LIBECL , LIBGEOMETRY , LIBPLOT , LIBUTIL ] , link = False)
env.Append(CPPPATH = "plot")
src_list = Split("ert_report_list.c ert_report.c time_map.c rng_config.c trans_func.c enkf_types.c enkf_obs.c obs_data.c block_obs.c enkf_config_node.c container_config.c container.c field_config.c field.c ecl_static_kw.c enkf_state.c enkf_util.c enkf_node.c gen_kw_config.c gen_kw.c enkf_fs.c fs_driver.c meas_data.c summary_obs.c summary.c summary_config.c gen_data_config.c gen_data.c gen_common.c gen_obs.c enkf_sched.c enkf_serialize.c ecl_config.c enkf_defaults.c ensemble_config.c model_config.c site_config.c active_list.c obs_vector.c field_trans.c plain_driver.c config_parser.c enkf_analysis.c local_ministep.c local_updatestep.c local_context.c local_config.c analysis_config.c data_ranking.c ranking_table.c misfit_ts.c misfit_ranking.c misfit_member.c misfit_ensemble.c fs_types.c block_fs_driver.c plot_config.c ert_template.c member_config.c enkf_main.c local_dataset.c local_obsset.c surface.c surface_config.c plot/enkf_plot_data.c plot/enkf_plot_member.c plot/enkf_plot_arg.c")
src_list = Split("ert_report_list.c ert_report.c time_map.c rng_config.c trans_func.c enkf_types.c enkf_obs.c obs_data.c block_obs.c enkf_config_node.c container_config.c container.c field_config.c field.c ecl_static_kw.c enkf_state.c enkf_util.c enkf_node.c gen_kw_config.c gen_kw.c enkf_fs.c fs_driver.c meas_data.c summary_obs.c summary.c summary_config.c gen_data_config.c gen_data.c gen_common.c gen_obs.c enkf_sched.c enkf_serialize.c ecl_config.c enkf_defaults.c ensemble_config.c model_config.c site_config.c active_list.c obs_vector.c field_trans.c plain_driver.c config_parser.c enkf_analysis.c local_ministep.c local_updatestep.c local_context.c local_config.c analysis_config.c data_ranking.c ranking_table.c misfit_ts.c misfit_ranking.c misfit_member.c misfit_ensemble.c fs_types.c block_fs_driver.c plot_config.c ert_template.c member_config.c enkf_main.c local_dataset.c local_obsset.c surface.c surface_config.c plot/enkf_plot_data.c plot/enkf_plot_member.c plot/enkf_plot_arg.c qc_config.c")
header_list = Split("ert_report_list.h ert_report.h time_map.h rng_config.h enkf_fs_type.h trans_func.h enkf_obs.h obs_data.h enkf_config_node.h container_config.h container.h block_obs.h field_config.h field.h enkf_macros.h ecl_static_kw.h enkf_state.h enkf_util.h enkf_main.h enkf_node.h enkf_fs.h gen_kw_config.h gen_kw.h enkf_types.h fs_driver.h meas_data.h summary_obs.h summary_config.h summary_config.h gen_data_config.h gen_data.h gen_common.h gen_obs.h enkf_sched.h fs_types.h enkf_serialize.h ecl_config.h ensemble_config.h model_config.h site_config.h active_list.h obs_vector.h field_trans.h plain_driver.h config_parser.h enkf_analysis.h local_ministep.h local_updatestep.h ranking_common.h data_ranking.h ranking_table.h local_config.h analysis_config.h misfit_ranking.c misfit_ensemble_typedef.h misfit_ensemble.h misfit_member.h block_fs_driver.h misfit_ts.h field_common.h gen_kw_common.h gen_data_common.h plot_config.h ert_template.h member_config.h enkf_defaults.h ert_build_info.h local_dataset.h local_obsset.h surface.h surface_config.h local_context.h config_keys.h plot/enkf_plot_data.h plot/enkf_plot_member.h plot/enkf_plot_arg.h")
header_list = Split("ert_report_list.h ert_report.h time_map.h rng_config.h enkf_fs_type.h trans_func.h enkf_obs.h obs_data.h enkf_config_node.h container_config.h container.h block_obs.h field_config.h field.h enkf_macros.h ecl_static_kw.h enkf_state.h enkf_util.h enkf_main.h enkf_node.h enkf_fs.h gen_kw_config.h gen_kw.h enkf_types.h fs_driver.h meas_data.h summary_obs.h summary_config.h summary_config.h gen_data_config.h gen_data.h gen_common.h gen_obs.h enkf_sched.h fs_types.h enkf_serialize.h ecl_config.h ensemble_config.h model_config.h site_config.h active_list.h obs_vector.h field_trans.h plain_driver.h config_parser.h enkf_analysis.h local_ministep.h local_updatestep.h ranking_common.h data_ranking.h ranking_table.h local_config.h analysis_config.h misfit_ranking.c misfit_ensemble_typedef.h misfit_ensemble.h misfit_member.h block_fs_driver.h misfit_ts.h field_common.h gen_kw_common.h gen_data_common.h plot_config.h ert_template.h member_config.h enkf_defaults.h ert_build_info.h local_dataset.h local_obsset.h surface.h surface_config.h local_context.h config_keys.h plot/enkf_plot_data.h plot/enkf_plot_member.h plot/enkf_plot_arg.h qc_config.h")
add_static_library( env , conf , lib_path , package , src_list )
add_shared_library( env , conf , slib_path , package , src_list )

View File

@ -1 +0,0 @@
SConscript(["SConscript", "test/SConstruct" , "../applications/ert_tui/SConstruct"])

View File

@ -463,7 +463,7 @@ analysis_config_type * analysis_config_alloc_default( rng_type * rng ) {
*/
void analysis_config_add_config_items( config_type * config ) {
config_item_type * item;
config_schema_item_type * item;
config_add_key_value( config , ENKF_ALPHA_KEY , false , CONFIG_FLOAT);
config_add_key_value( config , STD_CUTOFF_KEY , false , CONFIG_FLOAT);
@ -486,14 +486,14 @@ void analysis_config_add_config_items( config_type * config ) {
config_add_key_value( config , ANALYSIS_SELECT_KEY , false , CONFIG_STRING);
item = config_add_item( config , ANALYSIS_LOAD_KEY , false , true );
config_item_set_argc_minmax( item , 2 , 2 , 0 , NULL );
item = config_add_schema_item( config , ANALYSIS_LOAD_KEY , false , true );
config_schema_item_set_argc_minmax( item , 2 , 2 , 0 , NULL );
item = config_add_item( config , ANALYSIS_COPY_KEY , false , true );
config_item_set_argc_minmax( item , 2 , 2 , 0 , NULL );
item = config_add_schema_item( config , ANALYSIS_COPY_KEY , false , true );
config_schema_item_set_argc_minmax( item , 2 , 2 , 0 , NULL );
item = config_add_item( config , ANALYSIS_SET_VAR_KEY , false , true );
config_item_set_argc_minmax( item , 3 , -1 , 0 , NULL );
item = config_add_schema_item( config , ANALYSIS_SET_VAR_KEY , false , true );
config_schema_item_set_argc_minmax( item , 3 , -1 , 0 , NULL );
}

View File

@ -116,6 +116,7 @@ extern "C" {
#define PRE_CLEAR_RUNPATH_KEY "PRE_CLEAR_RUNPATH"
#define QUEUE_SYSTEM_KEY "QUEUE_SYSTEM"
#define QUEUE_OPTION_KEY "QUEUE_OPTION"
#define QC_PATH_KEY "QC_PATH"
#define REFCASE_KEY "REFCASE"
#define REPORT_CONTEXT_KEY "REPORT_CONTEXT"
#define REPORT_SEARCH_PATH_KEY "REPORT_SEARCH_PATH"

View File

@ -643,42 +643,42 @@ bool ecl_config_get_unified_summary(const ecl_config_type * ecl_config) { retur
void ecl_config_add_config_items( config_type * config ) {
config_item_type * item;
config_schema_item_type * item;
item = config_add_item(config , SCHEDULE_FILE_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_EXISTING_FILE});
item = config_add_schema_item(config , SCHEDULE_FILE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_EXISTING_FILE});
/*
Observe that SCHEDULE_PREDICTION_FILE - which is implemented as a
GEN_KW is added in ensemble_config.c
*/
item = config_add_item( config , IGNORE_SCHEDULE_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_BOOLEAN });
item = config_add_schema_item( config , IGNORE_SCHEDULE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_BOOLEAN });
item = config_add_item(config , ECLBASE_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , ECLBASE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , DATA_FILE_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_EXISTING_FILE});
item = config_add_schema_item(config , DATA_FILE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_EXISTING_FILE});
item = config_add_item(config , STATIC_KW_KEY , false , true);
config_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_schema_item(config , STATIC_KW_KEY , false , true);
config_schema_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_item(config , ADD_FIXED_LENGTH_SCHEDULE_KW_KEY , false , true);
config_item_set_argc_minmax(item , 2 , 2 , 2 , (const config_item_types [2]) { CONFIG_STRING , CONFIG_INT});
item = config_add_schema_item(config , ADD_FIXED_LENGTH_SCHEDULE_KW_KEY , false , true);
config_schema_item_set_argc_minmax(item , 2 , 2 , 2 , (const config_item_types [2]) { CONFIG_STRING , CONFIG_INT});
item = config_add_item(config , REFCASE_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , NULL );
item = config_add_schema_item(config , REFCASE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , NULL );
item = config_add_item(config , GRID_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_EXISTING_FILE});
item = config_add_schema_item(config , GRID_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_EXISTING_FILE});
item = config_add_item(config , INIT_SECTION_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_FILE});
item = config_add_schema_item(config , INIT_SECTION_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_FILE});
config_add_alias(config , INIT_SECTION_KEY , "EQUIL_INIT_FILE");
item = config_add_item(config , END_DATE_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL );
item = config_add_schema_item(config , END_DATE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL );
}

View File

@ -118,6 +118,7 @@
#define DEFAULT_ANALYSIS_MODULE "STD_ENKF"
/* Default directories. */
#define DEFAULT_QC_PATH "QC"
#define DEFAULT_REPORT_PATH "reports"
#define DEFAULT_PLOT_PATH "plots"
#define DEFAULT_RUNPATH "simulations/realization%d"
@ -237,6 +238,8 @@
#define DEFAULT_START_TAG "<"
#define DEFAULT_END_TAG ">"
#define DEFAULT_MANUAL_URL "http://ert.nr.no/wiki/index.php/User_Manual"
#define DEFAULT_BROWSER "firefox"
/*****************************************************************/
@ -249,6 +252,7 @@
Name of the default case.
*/
#define CASE_LOG "case-log"
#define CURRENT_CASE "current"
#define DEFAULT_CASE "default"

View File

@ -412,18 +412,16 @@ void enkf_fs_create_fs( const char * mount_point, fs_driver_impl driver_id , voi
static void enkf_fs_fsync_time_map( enkf_fs_type * fs ) {
FILE * stream = enkf_fs_open_case_file( fs , TIME_MAP_FILE , "w");
time_map_fwrite( fs->time_map , stream );
fclose( stream );
char * filename = enkf_fs_alloc_case_filename( fs , TIME_MAP_FILE );
time_map_fwrite( fs->time_map , filename );
free( filename );
}
static void enkf_fs_fread_time_map( enkf_fs_type * fs ) {
FILE * stream = enkf_fs_open_excase_file( fs , TIME_MAP_FILE );
if (stream != NULL) {
time_map_fread( fs->time_map , stream );
fclose( stream );
}
char * filename = enkf_fs_alloc_case_filename( fs , TIME_MAP_FILE );
time_map_fread( fs->time_map , filename );
free( filename );
}

View File

@ -83,6 +83,7 @@
#include <plot_config.h>
#include <ensemble_config.h>
#include <model_config.h>
#include <qc_config.h>
#include <site_config.h>
#include <active_config.h>
#include <enkf_analysis.h>
@ -92,7 +93,6 @@
#include <local_dataset.h>
#include <misfit_ensemble.h>
#include <ert_template.h>
#include <ert_build_info.h>
#include <rng_config.h>
#include <enkf_plot_data.h>
#include <ert_report_list.h>
@ -100,7 +100,7 @@
#include "enkf_defaults.h"
#include "config_keys.h"
/**/
/**
This object should contain **everything** needed to run a enkf
@ -138,6 +138,7 @@ struct enkf_main_struct {
char * current_fs_case;
enkf_fs_type * dbase; /* The internalized information. */
ensemble_config_type * ensemble_config; /* The config objects for the various enkf nodes.*/
qc_config_type * qc_config;
model_config_type * model_config;
ecl_config_type * ecl_config;
site_config_type * site_config;
@ -391,6 +392,7 @@ void enkf_main_free(enkf_main_type * enkf_main) {
analysis_config_free(enkf_main->analysis_config);
ecl_config_free(enkf_main->ecl_config);
model_config_free( enkf_main->model_config);
qc_config_free( enkf_main->qc_config );
site_config_free( enkf_main->site_config);
ensemble_config_free( enkf_main->ensemble_config );
@ -1259,77 +1261,8 @@ static void enkf_main_report_load_failure( const enkf_main_type * enkf_main , in
/**
The function enkf_main_run_step() is quite heavily multithreaded
involving one designated worker thread (queue_thread) and two
thread_pools. In the diagram below we have attempted to illustrate
the multithreaded behaviour of the function enkf_main_run_step():
o The execution path does not leave a 'box' before the thread / thread_pool
has been joined.
o An 'X' is meant to indicate a join.
o Dotted lines indicate communication; specifically the queue_thread running
the queue is "the owner" of all the job status information.
o The thread pool spawns many individual worker threads, these are
administrated by the thread_pool and not shown in the diagram.
main_thread: enkf_main_run_step
-------------------------------
|
|
|------------------------------------->--------------------------+
| |
| |
| |
| |
| |
| _____________|____________________
___________|_______ thread pool __________________ / \
/ \ | queue_thread: job_queue_run_jobs |
| submit_threads: enkf_state_start_forward_model |...........\__________________________________/
\__________________________________________________/ . . |
| . . |
| . . |
| . . |
| . . |
| . . |
+---------+ . . |
| . . |
| . . |
| . . |
. . |
main_thread: enkf_main_wait_loop()...................... . |
---------------------------------- . |
| . |
| . |
_________________| thread pool ____________________ . |
/ \ . |
| load_threads: enkf_state_complete_forward_model() |................ |
\___________________________________________________/ |
| |
| |
| |
+---------+ |
| |
| |
X---------------------------------------<------------------------+
|
|
\|/
Some single threaded clean up.
In addition to the trivial speed up (on a multi CPU box) the
multithreading allows for asyncronous treatmeant of the queue,
loading of results e.t.c. The latter is probably the most important
argument for using a multithreaded approach.
If all simulations have completed successfully the function will
return true, otherwise it will return false.
return true, otherwise it will return false.
*/
@ -1514,6 +1447,30 @@ void enkf_main_init_run( enkf_main_type * enkf_main, run_mode_type run_mode) {
}
/*
This function checks if no parameters have been initialized. If as much as one parameter
has been initialized the function will return false.
*/
bool enkf_main_is_not_initialized_at_all( const enkf_main_type * enkf_main ) {
stringlist_type * parameter_keys = ensemble_config_alloc_keylist_from_var_type( enkf_main->ensemble_config , PARAMETER );
bool initialized;
bool not_initialized_at_all = true;
int ikey, iens;
for (ikey = 0 ; ikey < stringlist_get_size( parameter_keys ) ; ikey++){
const enkf_config_node_type * config_node = ensemble_config_get_node( enkf_main->ensemble_config , stringlist_iget( parameter_keys , ikey) );
for ( iens = 0 ; iens < enkf_main->ens_size ; iens++ ){
node_id_type node_id = {.report_step = 0 , .iens = iens , .state = ANALYZED };
initialized = enkf_config_node_has_node( config_node , enkf_main->dbase , node_id);
if (initialized)
not_initialized_at_all = false;
}
}
return not_initialized_at_all;
}
void enkf_main_run_exp(enkf_main_type * enkf_main ,
@ -1521,7 +1478,13 @@ void enkf_main_run_exp(enkf_main_type * enkf_main ,
int init_step_parameters ,
int start_report ,
state_enum start_state) {
bool initialize = enkf_main_is_not_initialized_at_all( enkf_main );
int ens_size = enkf_main_get_ensemble_size( enkf_main );
if (initialize) {
stringlist_type * param_list = ensemble_config_alloc_keylist_from_var_type( enkf_main->ensemble_config , PARAMETER );
enkf_main_initialize_from_scratch( enkf_main , param_list , 0 , ens_size - 1);
stringlist_free( param_list );
}
enkf_main_init_run( enkf_main , ENSEMBLE_EXPERIMENT );
{
const enkf_sched_type * enkf_sched = model_config_get_enkf_sched(enkf_main->model_config);
@ -1540,7 +1503,13 @@ void enkf_main_run_assimilation(enkf_main_type * enkf_main ,
int init_step_parameters ,
int start_report ,
state_enum start_state) {
bool initialize = enkf_main_is_not_initialized_at_all( enkf_main );
int ens_size = enkf_main_get_ensemble_size( enkf_main );
if (initialize) {
stringlist_type * param_list = ensemble_config_alloc_keylist_from_var_type( enkf_main->ensemble_config , PARAMETER );
enkf_main_initialize_from_scratch( enkf_main , param_list , 0 , ens_size - 1);
stringlist_free( param_list );
}
bool rerun = analysis_config_get_rerun( enkf_main->analysis_config );
int rerun_start = analysis_config_get_rerun_start( enkf_main->analysis_config );
enkf_main_init_run( enkf_main , ENKF_ASSIMILATION);
@ -1630,7 +1599,8 @@ void enkf_main_run_assimilation(enkf_main_type * enkf_main ,
}
void enkf_main_run_smoother(enkf_main_type * enkf_main , bool initialize , const char * target_fs_name , bool rerun) {
void enkf_main_run_smoother(enkf_main_type * enkf_main , const char * target_fs_name , bool rerun) {
bool initialize = enkf_main_is_not_initialized_at_all( enkf_main );
int ens_size = enkf_main_get_ensemble_size( enkf_main );
if (initialize) {
stringlist_type * param_list = ensemble_config_alloc_keylist_from_var_type( enkf_main->ensemble_config , PARAMETER );
@ -1825,9 +1795,11 @@ void enkf_main_initialize_from_scratch(enkf_main_type * enkf_main , const string
int start_iens = i * ens_sub_size;
int end_iens = start_iens + ens_sub_size;
if (i == (num_cpu - 1))
if (i == (num_cpu - 1)){
end_iens = iens2 + 1; /* Input is upper limit inclusive. */
if(ens_sub_size == 0)
start_iens = iens1; /* Don't necessarily want to start from zero when ens_sub_size = 0*/
}
arg_pack_append_int( arg_list[i] , start_iens );
arg_pack_append_int( arg_list[i] , end_iens );
}
@ -1925,10 +1897,10 @@ void enkf_main_create_all_active_config( const enkf_main_type * enkf_main ,
static config_type * enkf_main_alloc_config( bool site_only , bool strict ) {
config_type * config = config_alloc();
config_item_type * item;
config_schema_item_type * item;
/*****************************************************************/
/* config_add_item(): */
/* config_add_schema_item(): */
/* */
/* 1. boolean - required? */
/* 2. boolean - append? */
@ -1949,8 +1921,8 @@ static config_type * enkf_main_alloc_config( bool site_only , bool strict ) {
/*****************************************************************/
/* Required keywords from the ordinary model_config file */
item = config_add_item(config , CASE_TABLE_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1, (const config_item_types [1]) {CONFIG_EXISTING_FILE});
item = config_add_schema_item(config , CASE_TABLE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1, (const config_item_types [1]) {CONFIG_EXISTING_FILE});
config_add_key_value( config , LOG_LEVEL_KEY , false , CONFIG_INT);
config_add_key_value( config , LOG_FILE_KEY , false , CONFIG_STRING);
@ -1958,8 +1930,8 @@ static config_type * enkf_main_alloc_config( bool site_only , bool strict ) {
config_add_key_value(config , MAX_RESAMPLE_KEY , false , CONFIG_INT);
item = config_add_item(config , NUM_REALIZATIONS_KEY , true , false);
config_item_set_argc_minmax(item , 1 , 1 , 1, (const config_item_types [1]) {CONFIG_INT});
item = config_add_schema_item(config , NUM_REALIZATIONS_KEY , true , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1, (const config_item_types [1]) {CONFIG_INT});
config_add_alias(config , NUM_REALIZATIONS_KEY , "SIZE");
config_add_alias(config , NUM_REALIZATIONS_KEY , "NUM_REALISATIONS");
config_install_message(config , "SIZE" , "** Warning: \'SIZE\' is depreceated - use \'NUM_REALIZATIONS\' instead.");
@ -1968,81 +1940,86 @@ static config_type * enkf_main_alloc_config( bool site_only , bool strict ) {
/*****************************************************************/
/* Optional keywords from the model config file */
item = config_add_item( config , RUN_TEMPLATE_KEY , false , true );
config_item_set_argc_minmax(item , 2 , -1 , 2 , (const config_item_types [2]) { CONFIG_EXISTING_FILE , CONFIG_STRING }); /* Force the template to exist at boot time. */
item = config_add_schema_item( config , RUN_TEMPLATE_KEY , false , true );
config_schema_item_set_argc_minmax(item , 2 , -1 , 2 , (const config_item_types [2]) { CONFIG_EXISTING_FILE , CONFIG_STRING }); /* Force the template to exist at boot time. */
config_add_key_value(config , RUNPATH_KEY , false , CONFIG_STRING);
config_add_key_value(config , RERUN_PATH_KEY , false , CONFIG_STRING);
item = config_add_item(config , ENSPATH_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , ENSPATH_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item( config , JOBNAME_KEY , false , false );
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item( config , JOBNAME_KEY , false , false );
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , SELECT_CASE_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , SELECT_CASE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , DBASE_TYPE_KEY , false , false);
config_item_set_argc_minmax(item , 1, 1 , 0 , NULL);
config_item_set_common_selection_set(item , 3 , (const char *[3]) {"PLAIN" , "SQLITE" , "BLOCK_FS"});
item = config_add_schema_item(config , DBASE_TYPE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1, 1 , 0 , NULL);
config_schema_item_set_common_selection_set(item , 3 , (const char *[3]) {"PLAIN" , "SQLITE" , "BLOCK_FS"});
item = config_add_item(config , FORWARD_MODEL_KEY , false , true);
config_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_schema_item(config , FORWARD_MODEL_KEY , false , true);
config_schema_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_item(config , DATA_KW_KEY , false , true);
config_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
item = config_add_schema_item(config , DATA_KW_KEY , false , true);
config_schema_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
item = config_add_item(config , KEEP_RUNPATH_KEY , false , false);
config_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_schema_item(config , KEEP_RUNPATH_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
config_add_key_value(config , PRE_CLEAR_RUNPATH_KEY , false , CONFIG_BOOLEAN);
item = config_add_item(config , DELETE_RUNPATH_KEY , false , false);
config_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_schema_item(config , DELETE_RUNPATH_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_item(config , OBS_CONFIG_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_EXISTING_FILE});
item = config_add_schema_item(config , OBS_CONFIG_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_EXISTING_FILE});
item = config_add_item(config , RFT_CONFIG_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_EXISTING_FILE});
item = config_add_schema_item(config , RFT_CONFIG_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_EXISTING_FILE});
item = config_add_item(config , RFTPATH_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , RFTPATH_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , LOCAL_CONFIG_KEY , false , true);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_EXISTING_FILE});
item = config_add_schema_item(config , LOCAL_CONFIG_KEY , false , true);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_EXISTING_FILE});
item = config_add_item(config , ENKF_SCHED_FILE_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_EXISTING_FILE});
item = config_add_schema_item(config , ENKF_SCHED_FILE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_EXISTING_FILE});
item = config_add_item(config , HISTORY_SOURCE_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , HISTORY_SOURCE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
{
stringlist_type * refcase_dep = stringlist_alloc_argv_ref( (const char *[1]) { REFCASE_KEY } , 1);
config_item_set_common_selection_set(item , 3 , (const char *[3]) {"SCHEDULE" , "REFCASE_SIMULATED" , "REFCASE_HISTORY"});
config_item_set_required_children_on_value(item , "REFCASE_SIMULATED" , refcase_dep);
config_item_set_required_children_on_value(item , "REFCASE_HISTORY" , refcase_dep);
config_schema_item_set_common_selection_set(item , 3 , (const char *[3]) {"SCHEDULE" , "REFCASE_SIMULATED" , "REFCASE_HISTORY"});
config_schema_item_set_required_children_on_value(item , "REFCASE_SIMULATED" , refcase_dep);
config_schema_item_set_required_children_on_value(item , "REFCASE_HISTORY" , refcase_dep);
stringlist_free(refcase_dep);
}
/*****************************************************************/
/* Report */
item = config_add_item(config , REPORT_LIST_KEY , false , true);
config_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_schema_item(config , REPORT_LIST_KEY , false , true);
config_schema_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_item(config , REPORT_CONTEXT_KEY , false , true);
config_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
item = config_add_schema_item(config , REPORT_CONTEXT_KEY , false , true);
config_schema_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
item = config_add_item(config , REPORT_PATH_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , REPORT_PATH_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item( config , REPORT_WELL_LIST_KEY , false , true );
config_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_schema_item( config , REPORT_WELL_LIST_KEY , false , true );
config_schema_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_schema_item( config , REPORT_GROUP_LIST_KEY , false , true );
config_schema_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
/*****************************************************************/
/* QC */
item = config_add_schema_item( config , QC_PATH_KEY , false , false );
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item( config , REPORT_GROUP_LIST_KEY , false , true );
config_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
return config;
}
@ -2189,6 +2166,7 @@ static enkf_main_type * enkf_main_alloc_empty( ) {
enkf_main->site_config = site_config_alloc_empty();
enkf_main->ensemble_config = ensemble_config_alloc_empty();
enkf_main->ecl_config = ecl_config_alloc_empty();
enkf_main->qc_config = qc_config_alloc( DEFAULT_QC_PATH );
enkf_main->model_config = model_config_alloc_empty();
enkf_main->analysis_config = analysis_config_alloc_default( enkf_main->rng ); /* This is ready for use. */
enkf_main->plot_config = plot_config_alloc_default(); /* This is ready for use. */
@ -2346,15 +2324,58 @@ void enkf_main_create_fs( enkf_main_type * enkf_main , const char * fs_path) {
static void enkf_main_link_current_fs__( enkf_main_type * enkf_main , const char * case_path) {
const char * ens_path = model_config_get_enspath( enkf_main->model_config);
char * current_link = util_alloc_filename( ens_path , CURRENT_CASE , NULL );
/* 1: Create a symlink pointing to the currently open case. */
{
if (util_entry_exists( current_link ))
unlink( current_link );
symlink( case_path , current_link );
char * current_link = util_alloc_filename( ens_path , CURRENT_CASE , NULL );
{
if (util_entry_exists( current_link ))
unlink( current_link );
symlink( case_path , current_link );
}
free( current_link );
}
/* 2: Update a small text file with the name of the host currently
running ert, the pid number of the process, the active case
and when it started.
If the previous shutdown was unclean the file will be around,
and we will need the info from the previous invocation which
is in the file. For that reason we open with mode 'a' instead
of 'w'.
*/
{
int buffer_size = 256;
char * current_host = util_alloc_filename( ens_path , CASE_LOG , NULL );
FILE * stream = util_fopen( current_host , "a");
fprintf(stream , "CASE:%-16s " , case_path );
fprintf(stream , "PID:%-8d " , getpid());
{
char hostname[buffer_size];
gethostname( hostname , buffer_size );
fprintf(stream , "HOST:%-16s " , hostname );
}
{
int year,month,day,hour,minute,second;
time_t now = time( NULL );
util_set_datetime_values( now , &second , &minute , &hour , &day , &month , &year );
fprintf(stream , "TIME:%02d/%02d/%4d-%02d.%02d.%02d\n" , day , month , year , hour , minute , second);
}
fclose( stream );
free( current_host );
}
free( current_link );
}
static void enkf_main_close_fs( enkf_main_type * enkf_main ) {
enkf_fs_close( enkf_main->dbase );
enkf_main->dbase = NULL;
@ -2365,6 +2386,7 @@ enkf_fs_type * enkf_main_get_fs(const enkf_main_type * enkf_main) {
return enkf_main->dbase;
}
char * enkf_main_alloc_mount_point( const enkf_main_type * enkf_main , const char * case_path) {
char * mount_point;
if (util_is_abs_path( case_path ))
@ -2382,6 +2404,7 @@ void enkf_main_set_fs( enkf_main_type * enkf_main , enkf_fs_type * fs , const ch
enkf_main_link_current_fs__( enkf_main , case_path);
enkf_main->current_fs_case = util_realloc_string_copy( enkf_main->current_fs_case , case_path);
enkf_main_gen_data_special( enkf_main );
}
}
@ -2463,10 +2486,8 @@ void enkf_main_gen_data_special( enkf_main_type * enkf_main ) {
void enkf_main_select_fs( enkf_main_type * enkf_main , const char * case_path ) {
enkf_fs_type * new_fs = enkf_main_get_alt_fs( enkf_main , case_path , false , true );
if (new_fs != NULL) {
if (new_fs != NULL)
enkf_main_set_fs( enkf_main , new_fs , case_path);
enkf_main_gen_data_special( enkf_main );
}
else {
const char * ens_path = model_config_get_enspath( enkf_main->model_config );
util_exit("%s: select filesystem %s:%s failed \n",__func__ , ens_path , case_path );
@ -2686,7 +2707,7 @@ static void enkf_main_bootstrap_site(enkf_main_type * enkf_main , const char * s
{
config_type * config = enkf_main_alloc_config( true , strict );
config_parse(config , site_config_file , "--" , INCLUDE_KEY , DEFINE_KEY , true , false , true);
config_parse(config , site_config_file , "--" , INCLUDE_KEY , DEFINE_KEY , true , false);
site_config_init( enkf_main->site_config , config , false); /* <---- site_config : first pass. */
ert_report_list_site_init( enkf_main->report_list , config );
config_free( config );
@ -2791,7 +2812,7 @@ enkf_main_type * enkf_main_bootstrap(const char * _site_config, const char * _mo
config = enkf_main_alloc_config( false , strict );
site_config_init_user_mode( enkf_main->site_config );
config_parse(config , model_config , "--" , INCLUDE_KEY , DEFINE_KEY , true , false , true);
config_parse(config , model_config , "--" , INCLUDE_KEY , DEFINE_KEY , true , true);
site_config_init( enkf_main->site_config , config , true ); /* <---- model_config : second pass. */
/*****************************************************************/
@ -2816,6 +2837,7 @@ enkf_main_type * enkf_main_bootstrap(const char * _site_config, const char * _mo
ecl_config_init( enkf_main->ecl_config , config );
plot_config_init( enkf_main->plot_config , config );
ensemble_config_init( enkf_main->ensemble_config , config , ecl_config_get_grid( enkf_main->ecl_config ) , ecl_config_get_refcase( enkf_main->ecl_config) );
qc_config_init( enkf_main->qc_config , config );
model_config_init( enkf_main->model_config ,
config ,
enkf_main_get_ensemble_size( enkf_main ),
@ -3302,6 +3324,8 @@ bool enkf_main_is_initialized( const enkf_main_type * enkf_main , bool_vector_ty
}
void enkf_main_log_fprintf_config( const enkf_main_type * enkf_main , FILE * stream ) {
fprintf( stream , CONFIG_COMMENTLINE_FORMAT );
fprintf( stream , CONFIG_COMMENT_FORMAT , "Here comes configuration information about the ERT logging.");
@ -3327,20 +3351,6 @@ void enkf_main_install_SIGNALS(void) {
}
void enkf_main_init_debug( const char * executable ) {
char * svn_version = util_alloc_sprintf("svn version..........: %s \n",SVN_VERSION);
char * compile_time = util_alloc_sprintf("Compile time.........: %s \n",COMPILE_TIME_STAMP);
/* This will be printed if/when util_abort() is called on a later stage. */
util_abort_append_version_info( svn_version );
util_abort_append_version_info( compile_time );
free(svn_version);
free(compile_time);
if (executable != NULL)
util_abort_set_executable( executable );
}
ert_templates_type * enkf_main_get_templates( enkf_main_type * enkf_main ) {

View File

@ -120,7 +120,7 @@ extern "C" {
int start_report ,
state_enum start_state);
void enkf_main_run_smoother(enkf_main_type * enkf_main , bool initialize , const char * target_fs_name , bool rerun);
void enkf_main_run_smoother(enkf_main_type * enkf_main , const char * target_fs_name , bool rerun);
void enkf_main_set_data_kw(enkf_main_type * , const char * , const char *);
void enkf_main_set_state_run_path(const enkf_main_type * , int );
@ -210,7 +210,6 @@ extern "C" {
void enkf_main_install_SIGNALS(void);
const char * enkf_main_get_SVN_VERSION( void );
const char * enkf_main_get_COMPILE_TIME( void );
void enkf_main_init_debug( const char * executable) ;
bool enkf_main_is_initialized( const enkf_main_type * enkf_main ,bool_vector_type * __mask);
void enkf_main_del_node(enkf_main_type * enkf_main , const char * key);
void enkf_main_update_node( enkf_main_type * enkf_main , const char * key );

View File

@ -279,8 +279,6 @@ static void shared_info_free(shared_info_type * shared_info) {
/** Helper classes complete - starting on the enkf_state proper object. */
/*****************************************************************/
void enkf_state_initialize(enkf_state_type * enkf_state , enkf_fs_type * fs , const stringlist_type * param_list) {
int ip;
for (ip = 0; ip < stringlist_get_size(param_list); ip++) {
@ -332,7 +330,6 @@ member_config_type * enkf_state_get_member_config(const enkf_state_type * enkf_s
}
static UTIL_SAFE_CAST_FUNCTION( enkf_state , ENKF_STATE_TYPE_ID )
@ -469,7 +466,6 @@ enkf_state_type * enkf_state_alloc(int iens,
enkf_state->subst_list = subst_list_alloc( subst_parent );
enkf_state->rng = rng_alloc( rng_get_type( main_rng ) , INIT_DEFAULT );
rng_rng_init( enkf_state->rng , main_rng ); /* <- Not thread safe */
/*
The user MUST specify an INIT_FILE, and for the first timestep the
<INIT> tag in the data file will be replaced by an
@ -1029,6 +1025,12 @@ static void enkf_state_internalize_results(enkf_state_type * enkf_state , enkf_f
if (enkf_state_internalize_dynamic_results(enkf_state , fs , model_config , loadOK, interactive , msg_list)) {
int last_report = time_map_get_last_step( enkf_fs_get_time_map( fs ));
/*
If we are in true assimilation mode we use the step2 setting, otherwise we are
just in plain gready-load-mode. */
if (run_info->run_mode == ENKF_ASSIMILATION)
last_report = run_info->step2;
/* Ensure that the last step is internalized? */
model_config_set_internalize_state( model_config , last_report);
@ -1933,14 +1935,18 @@ static bool enkf_state_complete_forward_modelEXIT(enkf_state_type * enkf_state ,
bool enkf_state_complete_forward_modelOK__(void * arg ) {
enkf_state_type * enkf_state;
enkf_fs_type * fs;
{
arg_pack_type * arg_pack = arg_pack_safe_cast( arg );
enkf_state = arg_pack_iget_ptr( arg_pack , 0 );
fs = arg_pack_iget_ptr( arg_pack , 1 );
arg_pack_free( arg_pack );
}
arg_pack_type * arg_pack = arg_pack_safe_cast( arg );
return enkf_state_complete_forward_modelOK( enkf_state , fs );
enkf_state = arg_pack_iget_ptr( arg_pack , 0 );
fs = arg_pack_iget_ptr( arg_pack , 1 );
{
bool callbackOK = enkf_state_complete_forward_modelOK( enkf_state , fs );
if (callbackOK)
arg_pack_free( arg_pack );
return callbackOK;
}
}

View File

@ -284,54 +284,54 @@ void ensemble_config_clear_obs_keys(ensemble_config_type * ensemble_config) {
void ensemble_config_add_config_items(config_type * config) {
config_item_type * item;
config_schema_item_type * item;
/**
the two fault types are just added to the config object only to
be able to print suitable messages before exiting.
*/
item = config_add_item(config , "HAVANA_FAULT" , false , true);
config_item_set_argc_minmax(item , 2 , 2 , 0 , NULL );
item = config_add_schema_item(config , "HAVANA_FAULT" , false , true);
config_schema_item_set_argc_minmax(item , 2 , 2 , 0 , NULL );
item = config_add_item(config , "MULTFLT" , false , true);
config_item_set_argc_minmax(item , 3 , 3 , 3 , (const config_item_types [3]) { CONFIG_STRING , CONFIG_STRING , CONFIG_EXISTING_FILE});
item = config_add_schema_item(config , "MULTFLT" , false , true);
config_schema_item_set_argc_minmax(item , 3 , 3 , 3 , (const config_item_types [3]) { CONFIG_STRING , CONFIG_STRING , CONFIG_EXISTING_FILE});
/*****************************************************************/
item = config_add_item(config , GEN_KW_KEY , false , true);
config_item_set_argc_minmax(item , 4 , 6 , 6 , (const config_item_types [6]) { CONFIG_STRING , CONFIG_EXISTING_FILE , CONFIG_STRING , CONFIG_EXISTING_FILE , CONFIG_STRING , CONFIG_STRING});
item = config_add_schema_item(config , GEN_KW_KEY , false , true);
config_schema_item_set_argc_minmax(item , 4 , 6 , 6 , (const config_item_types [6]) { CONFIG_STRING , CONFIG_EXISTING_FILE , CONFIG_STRING , CONFIG_EXISTING_FILE , CONFIG_STRING , CONFIG_STRING});
item = config_add_key_value( config , GEN_KW_TAG_FORMAT_KEY , false , CONFIG_STRING);
item = config_add_item(config , SCHEDULE_PREDICTION_FILE_KEY , false , false);
item = config_add_schema_item(config , SCHEDULE_PREDICTION_FILE_KEY , false , false);
/* scedhule_prediction_file filename <parameters:> <init_files:> */
config_item_set_argc_minmax(item , 1 , 3 , 3 , (const config_item_types [3]) { CONFIG_EXISTING_FILE , CONFIG_STRING , CONFIG_STRING});
config_schema_item_set_argc_minmax(item , 1 , 3 , 3 , (const config_item_types [3]) { CONFIG_EXISTING_FILE , CONFIG_STRING , CONFIG_STRING});
item = config_add_item(config , GEN_PARAM_KEY , false , true);
config_item_set_argc_minmax(item , 5 , -1 , 0 , NULL);
item = config_add_schema_item(config , GEN_PARAM_KEY , false , true);
config_schema_item_set_argc_minmax(item , 5 , -1 , 0 , NULL);
item = config_add_item(config , GEN_DATA_KEY , false , true);
config_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_schema_item(config , GEN_DATA_KEY , false , true);
config_schema_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_item(config , SUMMARY_KEY , false , true); /* can have several summary keys on each line. */
config_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_schema_item(config , SUMMARY_KEY , false , true); /* can have several summary keys on each line. */
config_schema_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_item(config , CONTAINER_KEY , false , true); /* can have several summary keys on each line. */
config_item_set_argc_minmax(item , 2 , -1 , 0 , NULL);
item = config_add_schema_item(config , CONTAINER_KEY , false , true); /* can have several summary keys on each line. */
config_schema_item_set_argc_minmax(item , 2 , -1 , 0 , NULL);
item = config_add_item( config , SURFACE_KEY , false , true );
config_item_set_argc_minmax(item , 4 , 5 , 0 , NULL);
item = config_add_schema_item( config , SURFACE_KEY , false , true );
config_schema_item_set_argc_minmax(item , 4 , 5 , 0 , NULL);
/*
the way config info is entered for fields is unfortunate because
it is difficult/impossible to let the config system handle run
time validation of the input.
*/
item = config_add_item(config , FIELD_KEY , false , true);
config_item_set_argc_minmax(item , 2 , -1 , 0 , NULL);
config_item_add_required_children(item , GRID_KEY); /* if you are using a field - you must have a grid. */
item = config_add_schema_item(config , FIELD_KEY , false , true);
config_schema_item_set_argc_minmax(item , 2 , -1 , 0 , NULL);
config_schema_item_add_required_children(item , GRID_KEY); /* if you are using a field - you must have a grid. */
}
@ -791,18 +791,20 @@ enkf_config_node_type * ensemble_config_add_surface( ensemble_config_type * ense
/*
If key == NULL the function will create a random key.
*/
enkf_config_node_type * ensemble_config_add_container( ensemble_config_type * ensemble_config , char * key) {
bool random_key = false;
enkf_config_node_type * ensemble_config_add_container( ensemble_config_type * ensemble_config , const char * key) {
char * local_key = key;
bool random_key = false;
if (key == NULL) {
key = util_calloc( 11 , sizeof * key );
sprintf(key , "%ld" , random() % 10000000 );
local_key = util_calloc( 11 , sizeof * local_key );
sprintf(local_key , "%ld" , random() % 10000000 );
random_key = true;
}
}
{
enkf_config_node_type * config_node = enkf_config_node_new_container( key );
enkf_config_node_type * config_node = enkf_config_node_new_container( local_key );
ensemble_config_add_node__( ensemble_config , config_node );
if (random_key)
free( key );
free( local_key );
return config_node;
}
}

View File

@ -41,7 +41,7 @@ typedef struct ensemble_config_struct ensemble_config_type;
void ensemble_config_set_refcase( ensemble_config_type * ensemble_config , const ecl_sum_type * refcase);
void ensemble_config_set_gen_kw_format( ensemble_config_type * ensemble_config , const char * gen_kw_format_string);
const char * ensemble_config_get_gen_kw_format( const ensemble_config_type * ensemble_config );
enkf_config_node_type * ensemble_config_add_container( ensemble_config_type * ensemble_config , char * key);
enkf_config_node_type * ensemble_config_add_container( ensemble_config_type * ensemble_config , const char * key);
enkf_config_node_type * ensemble_config_add_surface( ensemble_config_type * ensemble_config , const char * key );
enkf_config_node_type * ensemble_config_add_gen_data( ensemble_config_type * config , const char * key );
enkf_config_node_type * ensemble_config_add_summary(ensemble_config_type * ensemble_config , const char * key, load_fail_type load_fail);

View File

@ -212,10 +212,10 @@ void gen_data_deserialize(gen_data_type * gen_data , node_id_type node_id , cons
static void gen_data_set_data__(gen_data_type * gen_data , int size, int report_step , ecl_type_enum load_type , const void * data) {
gen_data_assert_size(gen_data , size, report_step);
if (gen_data_config_is_dynamic( gen_data->config )) {
printf("Dynamic:%d \n",gen_data_config_is_dynamic( gen_data ));
if (gen_data_config_is_dynamic( gen_data->config ))
gen_data_config_update_active( gen_data->config , report_step , gen_data->active_mask);
}
gen_data_realloc_data(gen_data);
if (size > 0) {
@ -317,8 +317,21 @@ void gen_data_fload( gen_data_type * gen_data , const char * filename) {
/**
The gen_data_forward_load() function is called by enkf_node objects
which represent dynamic data. The gen_data objects are very weakly
structured; and in particular we do not know in advance whether a
particular file should be present or not, it is therefor not an
error as such if a file can not be found. For this reason this
function must return true unconditionally, otherwise the scalling
scope will interpret a false return value as an error and signal
load failure.
*/
bool gen_data_forward_load(gen_data_type * gen_data , const char * ecl_file , const ecl_sum_type * ecl_sum, const ecl_file_type * restart_file , int report_step) {
return gen_data_fload_with_report_step( gen_data , ecl_file , report_step );
gen_data_fload_with_report_step( gen_data , ecl_file , report_step );
return true;
}

View File

@ -246,15 +246,6 @@ void * model_config_get_dbase_args( const model_config_type * model_config ) {
return NULL;
}
void model_config_set_max_resample( model_config_type * model_config , int max_resample ) {
model_config->max_internal_submit = max_resample;
}
int model_config_get_max_resample(const model_config_type * model_config ) {
return model_config->max_internal_submit;
}
void model_config_set_refcase( model_config_type * model_config , const ecl_sum_type * refcase ) {
model_config->refcase = refcase;
@ -290,6 +281,13 @@ void model_config_select_refcase_history( model_config_type * model_config , con
util_abort("%s: internal error - trying to load history from REFCASE - but no REFCASE has been loaded.\n",__func__);
}
int model_config_get_max_internal_submit( const model_config_type * config ) {
return config->max_internal_submit;
}
static void model_config_set_max_internal_submit( model_config_type * model_config , int max_resample ) {
model_config->max_internal_submit = max_resample;
}
@ -322,7 +320,7 @@ model_config_type * model_config_alloc_empty() {
model_config_set_enspath( model_config , DEFAULT_ENSPATH );
model_config_set_rftpath( model_config , DEFAULT_RFTPATH );
model_config_set_dbase_type( model_config , DEFAULT_DBASE_TYPE );
model_config_set_max_resample( model_config , DEFAULT_MAX_INTERNAL_SUBMIT);
model_config_set_max_internal_submit( model_config , DEFAULT_MAX_INTERNAL_SUBMIT);
model_config_add_runpath( model_config , DEFAULT_RUNPATH_KEY , DEFAULT_RUNPATH);
model_config_select_runpath( model_config , DEFAULT_RUNPATH_KEY );
@ -424,7 +422,7 @@ void model_config_init(model_config_type * model_config ,
model_config_set_dbase_type( model_config , config_get_value(config , DBASE_TYPE_KEY));
if (config_item_set( config , MAX_RESAMPLE_KEY))
model_config_set_max_resample( model_config , config_get_value_as_int( config , MAX_RESAMPLE_KEY ));
model_config_set_max_internal_submit( model_config , config_get_value_as_int( config , MAX_RESAMPLE_KEY ));
}
@ -534,9 +532,7 @@ bool model_config_load_state( const model_config_type * config , int report_step
}
int model_config_get_max_internal_submit( const model_config_type * config ) {
return config->max_internal_submit;
}
void model_config_fprintf_config( const model_config_type * model_config , int ens_size , FILE * stream ) {

View File

@ -70,10 +70,10 @@ extern "C" {
bool model_config_internalize_state( const model_config_type *, int );
bool model_config_load_state( const model_config_type *, int );
void model_config_set_enkf_sched(model_config_type * , const ext_joblist_type * , run_mode_type );
int model_config_get_max_internal_submit( const model_config_type * config );
const char * model_config_iget_casename( const model_config_type * model_config , int index);
void model_config_set_max_resample( model_config_type * model_config , int max_resample );
int model_config_get_max_resample(const model_config_type * model_config );
//void model_config_set_max_resample( model_config_type * model_config , int max_resample );
//int model_config_get_max_resample(const model_config_type * model_config );
int model_config_get_max_internal_submit( const model_config_type * config );
bool model_config_select_runpath( model_config_type * model_config , const char * path_key);
void model_config_add_runpath( model_config_type * model_config , const char * path_key , const char * fmt );
const char * model_config_get_runpath_as_char( const model_config_type * model_config );

View File

@ -1 +0,0 @@
SConscript(["../SConstruct"])

View File

@ -228,17 +228,17 @@ void plot_config_add_config_items( config_type * config ) {
config_add_key_value(config , PLOT_PATH_KEY , false , CONFIG_STRING);
config_add_key_value(config , PLOT_REFCASE_KEY , false , CONFIG_STRING);
config_add_key_value(config , IMAGE_VIEWER_KEY , false , CONFIG_FILE);
config_add_key_value(config , PLOT_ERRORBAR_KEY, false , CONFIG_BOOLEAN);
config_add_key_value(config , PLOT_ERRORBAR_KEY , false , CONFIG_BOOLEAN);
config_add_key_value(config , PLOT_ERRORBAR_MAX_KEY , false , CONFIG_INT);
{
config_item_type * item;
config_schema_item_type * item;
item = config_add_key_value(config , IMAGE_TYPE_KEY , false , CONFIG_STRING);
config_item_set_common_selection_set( item , 3 , (const char *[3]) {"png" , "jpg" , "psc"});
config_schema_item_set_common_selection_set( item , 3 , (const char *[3]) {"png" , "jpg" , "psc"});
item = config_add_key_value(config , PLOT_DRIVER_KEY , false , CONFIG_STRING);
config_item_set_common_selection_set( item , 2 , (const char *[2]) {"PLPLOT" , "TEXT"});
config_schema_item_set_common_selection_set( item , 2 , (const char *[2]) {"PLPLOT" , "TEXT"});
}
}

View File

@ -80,13 +80,13 @@ void rng_config_free( rng_config_type * rng) {
/*****************************************************************/
void rng_config_add_config_items( config_type * config ) {
config_item_type * item;
config_schema_item_type * item;
item= config_add_item( config , STORE_SEED_KEY , false , false );
config_item_set_argc_minmax(item , 1 , 1 , 1 , NULL );
item= config_add_schema_item( config , STORE_SEED_KEY , false , false );
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , NULL );
item = config_add_item( config , LOAD_SEED_KEY , false , false );
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_EXISTING_FILE});
item = config_add_schema_item( config , LOAD_SEED_KEY , false , false );
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) { CONFIG_EXISTING_FILE});
}

View File

@ -18,21 +18,26 @@
#include <stdlib.h>
#include <string.h>
#include <job_queue.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <util.h>
#include <stringlist.h>
#include <vector.h>
#include <job_queue.h>
#include <ext_job.h>
#include <ext_joblist.h>
#include <stringlist.h>
#include <config.h>
#include <site_config.h>
#include <local_driver.h>
#include <lsf_driver.h>
#include <rsh_driver.h>
#include <local_driver.h>
#include <queue_driver.h>
#include <sys/types.h>
#include <vector.h>
#include <sys/stat.h>
#include <lsf_driver.h>
#include <config.h>
#include <site_config.h>
#include "enkf_defaults.h"
#include "config_keys.h"
@ -111,6 +116,9 @@ struct site_config_struct {
int max_submit_site;
char * job_script;
char * job_script_site;
char * manual_url;
char * default_browser;
queue_driver_type * current_driver;
hash_type * queue_drivers;
@ -184,14 +192,17 @@ site_config_type * site_config_alloc_empty() {
site_config->__license_root_path = NULL;
site_config->job_script = NULL;
site_config->job_script_site = NULL;
site_config->manual_url = NULL;
site_config->default_browser = NULL;
site_config->user_mode = false;
site_config->driver_type = NULL_DRIVER;
/* Some hooops to get the current umask. */
site_config->umask = umask( 0 );
site_config_set_umask( site_config , site_config->umask );
site_config_set_manual_url( site_config , DEFAULT_MANUAL_URL );
site_config_set_default_browser( site_config , DEFAULT_BROWSER );
site_config->env_variables_user = hash_alloc();
site_config->env_variables_site = hash_alloc();
@ -209,6 +220,7 @@ const char * site_config_get_license_root_path( const site_config_type * site_co
}
/**
Observe that this variable can not "really" be set to different
values during a simulation, when creating ext_job instances they
@ -628,6 +640,22 @@ const char * site_config_get_job_script( const site_config_type * site_config )
return site_config->job_script;
}
const char * site_config_get_manual_url( const site_config_type * site_config ) {
return site_config->manual_url;
}
void site_config_set_manual_url( site_config_type * site_config , const char * manual_url ) {
site_config->manual_url = util_realloc_string_copy( site_config->manual_url , manual_url );
}
const char * site_config_get_default_browser( const site_config_type * site_config ) {
return site_config->default_browser;
}
void site_config_set_default_browser( site_config_type * site_config , const char * default_browser ) {
site_config->default_browser = util_realloc_string_copy( site_config->default_browser , default_browser );
}
void site_config_set_max_submit( site_config_type * site_config , int max_submit ) {
site_config->max_submit = max_submit;
@ -711,6 +739,10 @@ void site_config_init(site_config_type * site_config , const config_type * confi
util_abort("%s: failed to parse:\"%s\" as a valid octal literal \n",__func__ , string_mask);
}
if (config_item_set(config , MAX_SUBMIT_KEY))
site_config_set_max_submit( site_config , config_get_value_as_int( config , MAX_SUBMIT_KEY ));
/* LSF options */
{
if (config_item_set(config , LSF_QUEUE_KEY))
@ -772,7 +804,7 @@ void site_config_init(site_config_type * site_config , const config_type * confi
/* Parsing local options */
if (config_item_set( config , MAX_RUNNING_LOCAL_KEY))
site_config_set_max_running_local( site_config , config_iget_as_int( config , MAX_RUNNING_LOCAL_KEY , 0,0));
if (config_item_set(config , JOB_SCRIPT_KEY))
site_config_set_job_script( site_config , config_iget( config , JOB_SCRIPT_KEY , 0 , 0));
@ -818,6 +850,7 @@ void site_config_free(site_config_type * site_config) {
if (site_config->__license_root_path != NULL)
util_clear_directory( site_config->__license_root_path , true , true );
util_safe_free( site_config->manual_url );
util_safe_free( site_config->license_root_path );
util_safe_free( site_config->license_root_path_site );
util_safe_free( site_config->__license_root_path );
@ -976,20 +1009,20 @@ void site_config_fprintf_config( const site_config_type * site_config , FILE * s
void site_config_add_config_items( config_type * config , bool site_only) {
config_item_type * item;
config_schema_item_type * item;
item = config_add_item(config , QUEUE_SYSTEM_KEY , site_only , false);
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , QUEUE_SYSTEM_KEY , site_only , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
{
stringlist_type * lsf_dep = stringlist_alloc_argv_ref( (const char *[2]) {"LSF_QUEUE" , "MAX_RUNNING_LSF"} , 2);
stringlist_type * rsh_dep = stringlist_alloc_argv_ref( (const char *[3]) {"RSH_HOST" , "RSH_COMMAND" , "MAX_RUNNING_RSH"} , 2);
stringlist_type * local_dep = stringlist_alloc_argv_ref( (const char *[1]) {"MAX_RUNNING_LOCAL"} , 1);
if (site_only) {
config_item_set_common_selection_set( item , 3 , (const char *[3]) {LSF_DRIVER_NAME , LOCAL_DRIVER_NAME , RSH_DRIVER_NAME});
config_item_set_required_children_on_value( item , LSF_DRIVER_NAME , lsf_dep);
config_item_set_required_children_on_value( item , RSH_DRIVER_NAME , rsh_dep);
config_item_set_required_children_on_value( item , LOCAL_DRIVER_NAME , local_dep);
config_schema_item_set_common_selection_set( item , 3 , (const char *[3]) {LSF_DRIVER_NAME , LOCAL_DRIVER_NAME , RSH_DRIVER_NAME});
config_schema_item_set_required_children_on_value( item , LSF_DRIVER_NAME , lsf_dep);
config_schema_item_set_required_children_on_value( item , RSH_DRIVER_NAME , rsh_dep);
config_schema_item_set_required_children_on_value( item , LOCAL_DRIVER_NAME , local_dep);
}
stringlist_free(lsf_dep);
@ -997,8 +1030,8 @@ void site_config_add_config_items( config_type * config , bool site_only) {
stringlist_free(local_dep);
}
item = config_add_item(config , MAX_SUBMIT_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
item = config_add_schema_item(config , MAX_SUBMIT_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
/*
@ -1006,66 +1039,66 @@ void site_config_add_config_items( config_type * config , bool site_only) {
run-time environment. Can unfortunately not use constructions
like PATH=$PATH:/some/new/path, use the UPDATE_PATH function instead.
*/
item = config_add_item(config , SETENV_KEY , false , true);
config_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
config_item_set_envvar_expansion( item , false ); /* Do not expand $VAR expressions (that is done in util_interp_setenv()). */
item = config_add_schema_item(config , SETENV_KEY , false , true);
config_schema_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
config_schema_item_set_envvar_expansion( item , false ); /* Do not expand $VAR expressions (that is done in util_interp_setenv()). */
item = config_add_item(config , UMASK_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , UMASK_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
/**
UPDATE_PATH LD_LIBRARY_PATH /path/to/some/funky/lib
Will prepend "/path/to/some/funky/lib" at the front of LD_LIBRARY_PATH.
*/
item = config_add_item(config , UPDATE_PATH_KEY , false , true);
config_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
config_item_set_envvar_expansion( item , false ); /* Do not expand $VAR expressions (that is done in util_interp_setenv()). */
item = config_add_schema_item(config , UPDATE_PATH_KEY , false , true);
config_schema_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
config_schema_item_set_envvar_expansion( item , false ); /* Do not expand $VAR expressions (that is done in util_interp_setenv()). */
item = config_add_item( config , LICENSE_PATH_KEY , site_only , false );
config_item_set_argc_minmax(item , 1 , 1, 0 , NULL );
item = config_add_schema_item( config , LICENSE_PATH_KEY , site_only , false );
config_schema_item_set_argc_minmax(item , 1 , 1, 0 , NULL );
/*****************************************************************/
/* Items related to running jobs with lsf/rsh/local ... */
/* These must be set IFF QUEUE_SYSTEM == LSF */
item = config_add_item(config , LSF_QUEUE_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , LSF_QUEUE_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , LSF_RESOURCES_KEY , false , false);
config_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_schema_item(config , LSF_RESOURCES_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_item(config , MAX_RUNNING_LSF_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
item = config_add_schema_item(config , MAX_RUNNING_LSF_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
item = config_add_item(config , LSF_SERVER_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_STRING});
item = config_add_schema_item(config , LSF_SERVER_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_STRING});
/* These must be set IFF QUEUE_SYSTEM == RSH */
if (!site_only)
config_add_item(config , RSH_HOST_KEY , false , false); /* Only added when user parse. */
item = config_add_item(config , RSH_COMMAND_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_EXECUTABLE});
item = config_add_item(config , MAX_RUNNING_RSH_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
config_add_schema_item(config , RSH_HOST_KEY , false , false); /* Only added when user parse. */
item = config_add_schema_item(config , RSH_COMMAND_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_EXECUTABLE});
item = config_add_schema_item(config , MAX_RUNNING_RSH_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
/* These must be set IFF QUEUE_SYSTEM == LOCAL */
item = config_add_item(config , MAX_RUNNING_LOCAL_KEY , false , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
item = config_add_schema_item(config , MAX_RUNNING_LOCAL_KEY , false , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
/*****************************************************************/
item = config_add_item(config , QUEUE_OPTION_KEY , false , true);
config_item_set_argc_minmax(item , 3 , -1 , 0 , NULL);
item = config_add_schema_item(config , QUEUE_OPTION_KEY , false , true);
config_schema_item_set_argc_minmax(item , 3 , -1 , 0 , NULL);
item = config_add_item(config , JOB_SCRIPT_KEY , site_only , false);
config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_EXISTING_FILE});
item = config_add_schema_item(config , JOB_SCRIPT_KEY , site_only , false);
config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_EXISTING_FILE});
item = config_add_item(config , INSTALL_JOB_KEY , false , true);
config_item_set_argc_minmax(item , 2 , 2 , 2 , (const config_item_types [2]) {CONFIG_STRING , CONFIG_EXISTING_FILE});
item = config_add_schema_item(config , INSTALL_JOB_KEY , false , true);
config_schema_item_set_argc_minmax(item , 2 , 2 , 2 , (const config_item_types [2]) {CONFIG_STRING , CONFIG_EXISTING_FILE});
/* Items related to the reports. */
item = config_add_item( config , REPORT_SEARCH_PATH_KEY , false , true );
config_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
item = config_add_schema_item( config , REPORT_SEARCH_PATH_KEY , false , true );
config_schema_item_set_argc_minmax(item , 1 , -1 , 0 , NULL);
}

View File

@ -22,71 +22,80 @@
extern "C" {
#endif
#include <config.h>
#include <ext_joblist.h>
#include <stringlist.h>
#include <forward_model.h>
#include <stdbool.h>
#include <stringlist.h>
#include <config.h>
#include <ext_joblist.h>
#include <forward_model.h>
typedef struct site_config_struct site_config_type;
const char * site_config_get_license_root_path( const site_config_type * site_config );
void site_config_set_license_root_path( site_config_type * site_config , const char * license_root_path);
void site_config_init_user_mode( site_config_type * site_config );
void site_config_set_num_cpu( site_config_type * site_config , int num_cpu );
void site_config_update_lsf_request(site_config_type * , const forward_model_type *);
void site_config_init(site_config_type * site_config , const config_type * config, bool user_config);
void site_config_free(site_config_type *);
ext_joblist_type * site_config_get_installed_jobs( const site_config_type * );
job_queue_type * site_config_get_job_queue( const site_config_type * );
void site_config_set_ens_size( site_config_type * site_config , int ens_size );
void site_config_set_max_running_lsf( site_config_type * site_config , int max_running_lsf);
int site_config_get_max_running_lsf( const site_config_type * site_config );
void site_config_set_max_running_rsh( site_config_type * site_config , int max_running_rsh);
int site_config_get_max_running_rsh( const site_config_type * site_config);
void site_config_set_max_running_local( site_config_type * site_config , int max_running_local);
int site_config_get_max_running_local( const site_config_type * site_config );
void site_config_setenv( site_config_type * site_config , const char * variable, const char * value);
hash_type * site_config_get_env_hash( const site_config_type * site_config );
void site_config_clear_env( site_config_type * site_config );
void site_config_clear_pathvar( site_config_type * site_config );
stringlist_type * site_config_get_path_variables( const site_config_type * site_config );
stringlist_type * site_config_get_path_values( const site_config_type * site_config );
void site_config_clear_rsh_host_list( site_config_type * site_config );
hash_type * site_config_get_rsh_host_list( const site_config_type * site_config );
void site_config_add_rsh_host( site_config_type * site_config , const char * rsh_host , int max_running);
void site_config_set_lsf_queue( site_config_type * site_config , const char * lsf_queue);
const char * site_config_get_lsf_queue( const site_config_type * site_config );
void site_config_set_lsf_request( site_config_type * site_config , const char * lsf_request);
const char * site_config_get_lsf_request( const site_config_type * site_config );
const char * site_config_get_job_queue_name( const site_config_type * site_config );
void site_config_set_job_queue( site_config_type * site_config , const char * queue_name );
void site_config_set_rsh_command( site_config_type * site_config , const char * rsh_command);
const char * site_config_get_rsh_command( const site_config_type * site_config );
void site_config_set_job_script( site_config_type * site_config , const char * job_script );
const char * site_config_get_job_script( const site_config_type * site_config );
void site_config_set_max_submit( site_config_type * site_config , int max_submit );
int site_config_get_max_submit(const site_config_type * site_config );
bool site_config_queue_is_running( const site_config_type * site_config );
int site_config_install_job(site_config_type * site_config , const char * job_name , const char * install_file);
bool site_config_del_job( site_config_type * site_config , const char * job_name );
void site_config_set_umask( site_config_type * site_config , mode_t umask);
mode_t site_config_get_umask( const site_config_type * site_config );
void site_config_fprintf_config( const site_config_type * site_config , FILE * stream );
site_config_type * site_config_alloc_empty();
void site_config_add_config_items( config_type * config , bool site_only);
const char * site_config_get_manual_url( const site_config_type * site_config );
void site_config_set_manual_url( site_config_type * site_config , const char * manual_url );
const char * site_config_get_default_browser( const site_config_type * site_config );
void site_config_set_default_browser( site_config_type * site_config , const char * default_browser );
const char * site_config_get_license_root_path( const site_config_type * site_config );
void site_config_set_license_root_path( site_config_type * site_config , const char * license_root_path);
void site_config_init_user_mode( site_config_type * site_config );
void site_config_set_num_cpu( site_config_type * site_config , int num_cpu );
void site_config_update_lsf_request(site_config_type * , const forward_model_type *);
void site_config_init(site_config_type * site_config , const config_type * config, bool user_config);
void site_config_free(site_config_type *);
ext_joblist_type * site_config_get_installed_jobs( const site_config_type * );
job_queue_type * site_config_get_job_queue( const site_config_type * );
void site_config_set_ens_size( site_config_type * site_config , int ens_size );
void site_config_set_max_running_lsf( site_config_type * site_config , int max_running_lsf);
int site_config_get_max_running_lsf( const site_config_type * site_config );
void site_config_set_max_running_rsh( site_config_type * site_config , int max_running_rsh);
int site_config_get_max_running_rsh( const site_config_type * site_config);
void site_config_set_max_running_local( site_config_type * site_config , int max_running_local);
int site_config_get_max_running_local( const site_config_type * site_config );
void site_config_setenv( site_config_type * site_config , const char * variable, const char * value);
hash_type * site_config_get_env_hash( const site_config_type * site_config );
void site_config_clear_env( site_config_type * site_config );
void site_config_clear_pathvar( site_config_type * site_config );
stringlist_type * site_config_get_path_variables( const site_config_type * site_config );
stringlist_type * site_config_get_path_values( const site_config_type * site_config );
void site_config_clear_rsh_host_list( site_config_type * site_config );
hash_type * site_config_get_rsh_host_list( const site_config_type * site_config );
void site_config_add_rsh_host( site_config_type * site_config , const char * rsh_host , int max_running);
void site_config_set_lsf_queue( site_config_type * site_config , const char * lsf_queue);
const char * site_config_get_lsf_queue( const site_config_type * site_config );
void site_config_set_lsf_request( site_config_type * site_config , const char * lsf_request);
const char * site_config_get_lsf_request( const site_config_type * site_config );
const char * site_config_get_job_queue_name( const site_config_type * site_config );
void site_config_set_job_queue( site_config_type * site_config , const char * queue_name );
void site_config_set_rsh_command( site_config_type * site_config , const char * rsh_command);
const char * site_config_get_rsh_command( const site_config_type * site_config );
void site_config_set_job_script( site_config_type * site_config , const char * job_script );
const char * site_config_get_job_script( const site_config_type * site_config );
void site_config_set_max_submit( site_config_type * site_config , int max_submit );
int site_config_get_max_submit(const site_config_type * site_config );
bool site_config_queue_is_running( const site_config_type * site_config );
int site_config_install_job(site_config_type * site_config , const char * job_name , const char * install_file);
bool site_config_del_job( site_config_type * site_config , const char * job_name );
void site_config_set_umask( site_config_type * site_config , mode_t umask);
mode_t site_config_get_umask( const site_config_type * site_config );
void site_config_fprintf_config( const site_config_type * site_config , FILE * stream );
site_config_type * site_config_alloc_empty();
void site_config_add_config_items( config_type * config , bool site_only);
#ifdef __cplusplus
}
#endif

View File

@ -250,7 +250,7 @@ bool summary_forward_load(summary_type * summary , const char * ecl_file_name ,
int last_report_index = ecl_sum_iget_report_end( ecl_sum , report_step );
if (ecl_sum_has_general_var(ecl_sum , var_key)) {
load_value = ecl_sum_iget_general_var(ecl_sum , last_report_index ,var_key );
load_value = ecl_sum_get_general_var(ecl_sum , last_report_index ,var_key );
loadOK = true;
} else {
load_value = 0;
@ -343,7 +343,7 @@ bool summary_forward_load_vector(summary_type * summary , const char * ecl_file_
if (ecl_sum_has_report_step( ecl_sum , report_step )) {
int last_report_index = ecl_sum_iget_report_end( ecl_sum , report_step );
double_vector_iset( storage_vector , report_step , ecl_sum_iiget(ecl_sum , last_report_index , sum_index ));
double_vector_iset( storage_vector , report_step , ecl_sum_iget(ecl_sum , last_report_index , sum_index ));
}
}
loadOK = true;

View File

@ -63,8 +63,18 @@ static void time_map_update__( time_map_type * map , int step , time_t time) {
if (current_time == DEFAULT_TIME)
time_t_vector_iset( map->map , step , time );
else {
if (current_time != time)
util_abort("%s: time mismatch for step:%d \n",__func__ , step );
if (current_time != time) {
int current[3];
int new[3];
util_set_date_values( current_time , &current[0] , &current[1] , &current[2]);
util_set_date_values( time , &new[0] , &new[1] , &new[2]);
util_abort("%s: time mismatch for step:%d New: %02d/%02d/%04d existing: %02d/%02d/%04d \n",__func__ , step ,
new[0] , new[1] , new[2] ,
current[0] , current[1] , current[2]);
}
}
if (step == 0)
@ -137,22 +147,30 @@ void time_map_summary_update( time_map_type * map , const ecl_sum_type * ecl_sum
}
void time_map_fwrite( time_map_type * map , FILE * stream ) {
pthread_rwlock_rdlock( &map->rw_lock );
time_t_vector_fwrite( map->map , stream );
void time_map_fwrite( time_map_type * map , const char * filename ) {
pthread_rwlock_wrlock( &map->rw_lock );
{
FILE * stream = util_fopen(filename , "w");
time_t_vector_fwrite( map->map , stream );
fclose( stream );
}
pthread_rwlock_unlock( &map->rw_lock );
}
void time_map_fread( time_map_type * map , FILE * stream ) {
pthread_rwlock_wrlock( &map->rw_lock );
void time_map_fread( time_map_type * map , const char * filename) {
pthread_rwlock_rdlock( &map->rw_lock );
{
time_t_vector_type * file_map = time_t_vector_fread_alloc( stream );
for (int step=0; step < time_t_vector_size( file_map ); step++)
time_map_update__( map , step , time_t_vector_iget( file_map , step ));
time_t_vector_free( file_map );
if (util_file_exists( filename )) {
FILE * stream = util_fopen( filename , "r");
time_t_vector_type * file_map = time_t_vector_fread_alloc( stream );
for (int step=0; step < time_t_vector_size( file_map ); step++)
time_map_update__( map , step , time_t_vector_iget( file_map , step ));
time_t_vector_free( file_map );
fclose( stream );
}
}
pthread_rwlock_unlock( &map->rw_lock );
}
@ -165,7 +183,7 @@ void time_map_fread( time_map_type * map , FILE * stream ) {
step.
*/
int time_map_get_last_step( const time_map_type * map) {
int time_map_get_last_step( time_map_type * map) {
int last_step;
pthread_rwlock_rdlock( &map->rw_lock );

View File

@ -32,10 +32,10 @@ typedef struct time_map_struct time_map_type;
void time_map_update( time_map_type * map , int step , time_t time);
void time_map_summary_update( time_map_type * map , const ecl_sum_type * ecl_sum);
time_t time_map_iget( time_map_type * map , int step );
void time_map_fwrite( time_map_type * map , FILE * stream );
void time_map_fread( time_map_type * map , FILE * stream );
void time_map_fwrite( time_map_type * map , const char * filename);
void time_map_fread( time_map_type * map , const char * filename);
double time_map_iget_sim_days( time_map_type * map , int step );
int time_map_get_last_step( const time_map_type * map);
int time_map_get_last_step( time_map_type * map);
#ifdef __cplusplus
}

View File

@ -1,2 +0,0 @@
SConscript(["src/SConstruct", "applications/SConstruct"])

View File

@ -1,29 +0,0 @@
import os
import os.path
import sys
sys.path += ["../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBGEOMETRY
from global_config import add_program
lib_path = "../lib"
include_path = "../include"
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 2)
env = Environment()
lib_list = ["lapack" , "blas", "plplotd" , "m" , "z" , "pthread"]
if conf.g2c:
lib_list.append( "g2c" )
conf.update_env( env , [ LIBGEOMETRY , LIBUTIL ] , ext_liblist = lib_list , link = True)
env.Append( CPPPATH = conf.PLPLOT_INCLUDE_PATH )
env.Append( LIBPATH = conf.PLPLOT_LIB_PATH )
add_program(env , conf , bin_path , "irap_test.x" , "irap_test.c" )
add_program(env , conf , bin_path , "polygon_test.x" , "polygon_test.c" )
Default( bin_path )

View File

@ -2,11 +2,11 @@ set( source_files geo_surface.c geo_util.c geo_pointset.c geo_region.c geo_polyg
set( header_files geo_surface.h geo_util.h geo_pointset.h geo_region.h geo_polygon.h)
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
include_directories( ${libutil_build_path} )
include_directories( ${libutil_src_path} )
include_directories( ${libert_util_build_path} )
include_directories( ${libert_util_src_path} )
add_library( geometry ${LIBRARY_TYPE} ${source_files} )
target_link_libraries( geometry util )
target_link_libraries( geometry ert_util )
#-----------------------------------------------------------------

View File

@ -1,32 +0,0 @@
import os
import os.path
import sys
sys.path += ["../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBRMS
from global_config import add_static_library
from global_config import add_shared_library
from global_config import add_header
from global_config import get_target
package = "geometry"
lib_path = "../lib"
slib_path = "../slib"
include_path = "../include"
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 2)
env = Environment()
conf.update_env( env , [LIBUTIL] )
src_list = Split("geo_surface.c geo_util.c geo_pointset.c geo_region.c geo_polygon.c")
header_list = Split("geo_surface.h geo_util.h geo_pointset.h geo_region.h geo_polygon.h")
add_static_library( env , conf , lib_path , package , src_list )
add_shared_library( env , conf , slib_path , package , src_list )
add_header( env , conf , include_path , header_list )
Default( lib_path , slib_path , include_path )

View File

@ -1,2 +0,0 @@
SConscript(["src/SConstruct", "applications/SConstruct"])

View File

@ -1,2 +1,2 @@
add_executable( block_node block_node.c )
target_link_libraries( block_node job_queue_static util_static)
target_link_libraries( block_node job_queue ert_util)

View File

@ -1,28 +0,0 @@
import os
import os.path
import sys
sys.path += ["../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBCONFIG
from global_config import LIBJOB_QUEUE
from global_config import add_program
from global_config import get_target
lib_path = "../lib"
include_path = "../include"
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 2)
if conf.INCLUDE_LSF:
env = Environment()
conf.update_env( env , [LIBJOB_QUEUE , LIBCONFIG , LIBUTIL] , [ "bat" ,"lsf" , "nsl" , "z" , "m" , "pthread"] , link = True )
env.Append( CPPPATH = conf.LSF_INCLUDE_PATH )
env.Append( LIBPATH = conf.LSF_LIB_PATH )
add_program(env , conf , bin_path , "block_node" , "block_node.c" )
target = get_target( env , conf )
Default( bin_path )

View File

@ -1,35 +0,0 @@
import os
import os.path
import sys
sys.path += ["../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBCONFIG
from global_config import add_static_library
from global_config import add_shared_library
from global_config import add_header
from global_config import get_target
package = "job_queue"
lib_path = "../lib"
slib_path = "../slib"
include_path = "../include"
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 2)
env = Environment()
conf.update_env( env , [LIBCONFIG , LIBUTIL ] )
if conf.INCLUDE_LSF:
env.Append( CPPDEFINES = ["HAVE_LSF"])
env.Append( CPPPATH = conf.LSF_INCLUDE_PATH )
src_list = Split("forward_model.c queue_driver.c job_queue.c lsf_driver.c local_driver.c rsh_driver.c ext_job.c ext_joblist.c")
header_list = Split("job_queue.h queue_driver.h lsf_driver.h local_driver.h rsh_driver.h ext_job.h ext_joblist.h forward_model.h")
add_static_library( env , conf , lib_path , package , src_list )
add_shared_library( env , conf , slib_path , package , src_list )
add_header( env , conf , include_path , header_list )
Default( lib_path , slib_path , include_path )

View File

@ -749,22 +749,22 @@ ext_job_type * ext_job_fscanf_alloc(const char * name , const char * license_roo
ext_job_set_config_file( ext_job , config_file );
{
config_item_type * item;
item = config_add_item(config , "MAX_RUNNING" , false , false); config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
item = config_add_item(config , "STDIN" , false , false); config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , "STDOUT" , false , false); config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , "STDERR" , false , false); config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , "EXECUTABLE" , false , false); config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , "TARGET_FILE" , false , false); config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , "ERROR_FILE" , false , false); config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , "START_FILE" , false , false); config_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_item(config , "ENV" , false , true ); config_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
item = config_add_item(config , "DEFAULT" , false , true ); config_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
item = config_add_item(config , "ARGLIST" , false , true ); config_item_set_argc_minmax(item , 1 ,-1 , 0 , NULL);
item = config_add_item(config , "MAX_RUNNING_MINUTES" , false , false); config_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
config_schema_item_type * item;
item = config_add_schema_item(config , "MAX_RUNNING" , false , false); config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
item = config_add_schema_item(config , "STDIN" , false , false); config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , "STDOUT" , false , false); config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , "STDERR" , false , false); config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , "EXECUTABLE" , false , false); config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , "TARGET_FILE" , false , false); config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , "ERROR_FILE" , false , false); config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , "START_FILE" , false , false); config_schema_item_set_argc_minmax(item , 1 , 1 , 0 , NULL);
item = config_add_schema_item(config , "ENV" , false , true ); config_schema_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
item = config_add_schema_item(config , "DEFAULT" , false , true ); config_schema_item_set_argc_minmax(item , 2 , 2 , 0 , NULL);
item = config_add_schema_item(config , "ARGLIST" , false , true ); config_schema_item_set_argc_minmax(item , 1 ,-1 , 0 , NULL);
item = config_add_schema_item(config , "MAX_RUNNING_MINUTES" , false , false); config_schema_item_set_argc_minmax(item , 1 , 1 , 1 , (const config_item_types [1]) {CONFIG_INT});
}
config_add_alias(config , "EXECUTABLE" , "PORTABLE_EXE");
config_parse(config , config_file , "--" , NULL , NULL , true , false , true);
config_parse(config , config_file , "--" , NULL , NULL , true , true);
{
if (config_item_set(config , "STDIN")) ext_job_set_stdin_file(ext_job , config_iget(config , "STDIN" , 0,0));
if (config_item_set(config , "STDOUT")) ext_job_set_stdout_file(ext_job , config_iget(config , "STDOUT" , 0,0));

View File

@ -33,13 +33,32 @@ extern "C" {
#define LSF_SERVER "LSF_SERVER"
#define LSF_RSH_CMD "LSF_RSH_CMD" // This option is set to DEFAULT_RSH_CMD at driver creation.
#define LSF_LOGIN_SHELL "LSF_LOGIN_SHELL" // Not fully implemented yet
#define LSF_BSUB_CMD "BSUB_CMD"
#define LSF_BJOBS_CMD "BJOBS_CMD"
#define LSF_BKILL_CMD "BKILL_CMD"
#define LOCAL_LSF_SERVER "LOCAL"
typedef enum {
LSF_SUBMIT_INVALID = 0,
LSF_SUBMIT_INTERNAL = 1,
LSF_SUBMIT_LOCAL_SHELL = 2,
LSF_SUBMIT_REMOTE_SHELL = 3
} lsf_submit_method_enum;
typedef struct lsf_driver_struct lsf_driver_type;
typedef struct lsf_job_struct lsf_job_type;
void * lsf_driver_alloc( );
void * lsf_driver_alloc( );
stringlist_type * lsf_driver_alloc_cmd(lsf_driver_type * driver ,
const char * run_path ,
const char * job_name ,
const char * submit_cmd ,
int num_cpu ,
int job_argc,
const char ** job_argv);
void * lsf_driver_submit_job(void * __driver ,
const char * submit_cmd ,
@ -48,12 +67,17 @@ void * lsf_driver_alloc( );
const char * job_name ,
int argc,
const char ** argv );
job_status_type lsf_driver_convert_status( int lsf_status );
void lsf_driver_kill_job(void * __driver , void * __job);
void lsf_driver_free__(void * __driver );
void lsf_driver_free( lsf_driver_type * driver );
job_status_type lsf_driver_get_job_status(void * __driver , void * __job);
int lsf_driver_get_job_status_lsf(void * __driver , void * __job);
void lsf_driver_free_job(void * __job);
void lsf_driver_display_info( void * __driver , void * __job);
void lsf_driver_set_bjobs_refresh_interval( lsf_driver_type * driver , int refresh_interval);
lsf_submit_method_enum lsf_driver_get_submit_method( const lsf_driver_type * driver );
bool lsf_driver_has_option( const void * __driver , const char * option_key);
const void * lsf_driver_get_option( const void * __driver , const char * option_key);

View File

@ -94,6 +94,9 @@
#define LSF_JOB_TYPE_ID 9963900
#define BJOBS_REFRESH_TIME 10
#define DEFAULT_RSH_CMD "/usr/bin/ssh"
#define DEFAULT_BSUB_CMD "bsub"
#define DEFAULT_BJOBS_CMD "bjobs"
#define DEFAULT_BKILL_CMD "bkill"
struct lsf_job_struct {
@ -112,8 +115,8 @@ struct lsf_driver_struct {
char * resource_request;
char * login_shell;
pthread_mutex_t submit_lock;
bool use_library_calls;
lsf_submit_method_enum submit_method;
/*-----------------------------------------------------------------*/
/* Fields used by the lsf library functions */
@ -123,6 +126,7 @@ struct lsf_driver_struct {
/*-----------------------------------------------------------------*/
/* Fields used by the shell based functions */
int bjobs_refresh_interval;
time_t last_bjobs_update;
hash_type * my_jobs; /* A hash table of all jobs submitted by this ERT instance -
to ensure that we do not check status of old jobs in e.g. ZOMBIE status. */
@ -131,6 +135,9 @@ struct lsf_driver_struct {
pthread_mutex_t bjobs_mutex; /* Only one thread should update the bjobs_chache table. */
char * remote_lsf_server;
char * rsh_cmd;
char * bsub_cmd;
char * bjobs_cmd;
char * bkill_cmd;
};
@ -167,7 +174,7 @@ void lsf_job_free(lsf_job_type * job) {
}
static int lsf_job_parse_bsub_stdout(const char * stdout_file) {
static int lsf_job_parse_bsub_stdout(const lsf_driver_type * driver , const char * stdout_file) {
int jobid = -1;
FILE * stream = util_fopen(stdout_file , "r");
if (util_fseek_string(stream , "<" , true , true)) {
@ -175,21 +182,129 @@ static int lsf_job_parse_bsub_stdout(const char * stdout_file) {
if (jobid_string != NULL) {
jobid = atoi( jobid_string );
free( jobid_string );
} else
util_abort("%s: Could not extract job id from bsub submit_file:%s \n",__func__ , stdout_file );
} else
util_abort("%s: Could not extract job id from bsub submit_file:%s \n",__func__ , stdout_file );
}
}
fclose( stream );
if (jobid == -1) {
char * file_content = util_fread_alloc_file_content( stdout_file , NULL );
fprintf(stderr,"Failed to get lsf job id from file: %s \n",stdout_file );
fprintf(stderr,"bsub command : %s \n",driver->bsub_cmd );
fprintf(stderr,"%s\n", file_content);
free( file_content );
util_exit("%s: \n",__func__);
}
return jobid;
}
stringlist_type * lsf_driver_alloc_cmd(lsf_driver_type * driver ,
const char * lsf_stdout ,
const char * job_name ,
const char * submit_cmd ,
int num_cpu ,
int job_argc,
const char ** job_argv) {
stringlist_type * argv = stringlist_alloc_new();
char * num_cpu_string = util_alloc_sprintf("%d" , num_cpu);
char * quoted_resource_request = NULL;
if (driver->resource_request != NULL)
quoted_resource_request = util_alloc_sprintf("\"%s\"" , driver->resource_request);
if (driver->submit_method == LSF_SUBMIT_REMOTE_SHELL)
stringlist_append_ref( argv , driver->bsub_cmd);
stringlist_append_ref( argv , "-o" );
stringlist_append_copy( argv , lsf_stdout );
if (driver->queue_name != NULL) {
stringlist_append_ref( argv , "-q" );
stringlist_append_ref( argv , driver->queue_name );
}
stringlist_append_ref( argv , "-J" );
stringlist_append_ref( argv , job_name );
stringlist_append_ref( argv , "-n" );
stringlist_append_copy( argv , num_cpu_string );
if (quoted_resource_request != NULL) {
stringlist_append_ref( argv , "-R");
stringlist_append_copy( argv , quoted_resource_request );
}
if (driver->login_shell != NULL) {
stringlist_append_ref( argv , "-L");
stringlist_append_ref( argv , driver->login_shell );
}
stringlist_append_ref( argv , submit_cmd);
{
int iarg;
for (iarg = 0; iarg < job_argc; iarg++)
stringlist_append_ref( argv , job_argv[ iarg ]);
}
free( num_cpu_string );
util_safe_free( quoted_resource_request );
return argv;
}
static int lsf_driver_submit_internal_job( lsf_driver_type * driver ,
const char * lsf_stdout ,
const char * job_name ,
const char * submit_cmd ,
int num_cpu ,
int argc,
const char ** argv) {
char * command;
{
buffer_type * command_buffer = buffer_alloc( 256 );
buffer_fwrite_char_ptr( command_buffer , submit_cmd );
for (int iarg = 0; iarg < argc; iarg++) {
buffer_fwrite_char( command_buffer , ' ');
buffer_fwrite_char_ptr( command_buffer , argv[ iarg ]);
}
buffer_terminate_char_ptr( command_buffer );
command = buffer_get_data( command_buffer );
buffer_free_container( command_buffer );
}
{
int options = SUB_JOB_NAME + SUB_OUT_FILE;
if (driver->queue_name != NULL)
options += SUB_QUEUE;
if (driver->resource_request != NULL)
options += SUB_RES_REQ;
if (driver->login_shell != NULL)
options += SUB_LOGIN_SHELL;
driver->lsf_request.options = options;
}
driver->lsf_request.resReq = driver->resource_request;
driver->lsf_request.loginShell = driver->login_shell;
driver->lsf_request.queue = driver->queue_name;
driver->lsf_request.jobName = (char *) job_name;
driver->lsf_request.outFile = lsf_stdout;
driver->lsf_request.command = command;
driver->lsf_request.numProcessors = num_cpu;
{
int lsf_jobnr = lsb_submit( &driver->lsf_request , &driver->lsf_reply );
free( command ); /* I trust the lsf layer is finished with the command? */
return lsf_jobnr;
}
}
static int lsf_driver_submit_shell_job(lsf_driver_type * driver ,
const char * run_path ,
const char * lsf_stdout ,
const char * job_name ,
const char * submit_cmd ,
int num_cpu ,
@ -197,69 +312,26 @@ static int lsf_driver_submit_shell_job(lsf_driver_type * driver ,
const char ** job_argv) {
int job_id;
char * tmp_file = util_alloc_tmp_file("/tmp" , "enkf-submit" , true);
char * lsf_stdout = util_alloc_filename(run_path , job_name , "LSF-stdout");
char num_cpu_string[4];
sprintf(num_cpu_string , "%d" , num_cpu);
if (driver->remote_lsf_server != NULL) {
char * quoted_resource_request = NULL;
if (driver->resource_request != NULL)
quoted_resource_request = util_alloc_sprintf("\"%s\"" , driver->resource_request);
/**
Command is:
ssh lsf_server remote_bsub_cmd
where remote_bsub_cmd is one long unquoted string:
bsub -o <outfile> -q <queue_name> -J <job_name> -n <num_cpu> -R "<resource_request>" -L <login_shell> cmd arg1 arg2 arg3
The options -R and -L are optional.
*/
buffer_type * remote_cmd = buffer_alloc(256);
buffer_fwrite_char_ptr( remote_cmd , "bsub -o " );
buffer_fwrite_char_ptr( remote_cmd , lsf_stdout );
buffer_fwrite_char_ptr( remote_cmd , " -q " );
buffer_fwrite_char_ptr( remote_cmd , driver->queue_name );
buffer_fwrite_char_ptr( remote_cmd , " -J " );
buffer_fwrite_char_ptr( remote_cmd , job_name );
buffer_fwrite_char_ptr( remote_cmd , " -n " );
buffer_fwrite_char_ptr( remote_cmd , num_cpu_string );
if (quoted_resource_request != NULL) {
buffer_fwrite_char_ptr( remote_cmd , " -R ");
buffer_fwrite_char_ptr( remote_cmd , quoted_resource_request );
}
if (driver->login_shell != NULL) {
buffer_fwrite_char_ptr( remote_cmd , " -L ");
buffer_fwrite_char_ptr( remote_cmd , driver->login_shell );
}
buffer_fwrite_char( remote_cmd , ' ');
buffer_fwrite_char_ptr( remote_cmd , submit_cmd);
{
int iarg;
for (iarg = 0; iarg < job_argc; iarg++) {
buffer_fwrite_char( remote_cmd , ' ');
buffer_fwrite_char_ptr( remote_cmd , job_argv[ iarg ]);
}
}
buffer_terminate_char_ptr( remote_cmd );
{
stringlist_type * remote_argv = lsf_driver_alloc_cmd( driver , lsf_stdout , job_name , submit_cmd , num_cpu , job_argc , job_argv);
if (driver->submit_method == LSF_SUBMIT_REMOTE_SHELL) {
char ** argv = util_calloc( 2 , sizeof * argv );
argv[0] = driver->remote_lsf_server;
argv[1] = buffer_get_data( remote_cmd );
argv[1] = stringlist_alloc_joined_string( remote_argv , " ");
util_fork_exec(driver->rsh_cmd , 2 , (const char **) argv , true , NULL , NULL , NULL , tmp_file , NULL);
free( argv[1] );
free( argv );
} else if (driver->submit_method == LSF_SUBMIT_LOCAL_SHELL) {
char ** argv = stringlist_alloc_char_ref( remote_argv );
util_fork_exec(driver->bsub_cmd , stringlist_get_size( remote_argv) , (const char **) argv , true , NULL , NULL , NULL , tmp_file , NULL);
free( argv );
}
buffer_free( remote_cmd );
util_safe_free(quoted_resource_request);
stringlist_free( remote_argv );
}
job_id = lsf_job_parse_bsub_stdout(tmp_file);
job_id = lsf_job_parse_bsub_stdout(driver , tmp_file);
util_unlink_existing( tmp_file );
free(lsf_stdout);
free(tmp_file);
return job_id;
}
@ -267,7 +339,6 @@ static int lsf_driver_submit_shell_job(lsf_driver_type * driver ,
static int lsf_driver_get_status__(lsf_driver_type * driver , const char * status, const char * job_id) {
if (hash_has_key( driver->status_map , status))
return hash_get_int( driver->status_map , status);
else {
@ -280,11 +351,18 @@ static int lsf_driver_get_status__(lsf_driver_type * driver , const char * statu
static void lsf_driver_update_bjobs_table(lsf_driver_type * driver) {
char * tmp_file = util_alloc_tmp_file("/tmp" , "enkf-bjobs" , true);
{
if (driver->submit_method == LSF_SUBMIT_REMOTE_SHELL) {
char ** argv = util_calloc( 2 , sizeof * argv);
argv[0] = driver->remote_lsf_server;
argv[1] = "bjobs -a";
argv[1] = util_alloc_sprintf("%s -a" , driver->bjobs_cmd);
util_fork_exec(driver->rsh_cmd , 2 , (const char **) argv , true , NULL , NULL , NULL , tmp_file , NULL);
free( argv[1] );
free( argv );
} else if (driver->submit_method == LSF_SUBMIT_LOCAL_SHELL) {
char ** argv = util_calloc( 1 , sizeof * argv);
argv[0] = "-a";
util_fork_exec(driver->bjobs_cmd , 1 , (const char **) argv , true , NULL , NULL , NULL , tmp_file , NULL);
free( argv );
}
@ -319,15 +397,14 @@ static void lsf_driver_update_bjobs_table(lsf_driver_type * driver) {
#define CASE_SET(s1,s2) case(s1): status = s2; break;
static job_status_type lsf_driver_get_job_status_libary(void * __driver , void * __job) {
static int lsf_driver_get_job_status_libary(void * __driver , void * __job) {
if (__job == NULL)
/* the job has not been registered at all ... */
return JOB_QUEUE_NOT_ACTIVE;
else {
lsf_job_type * job = lsf_job_safe_cast( __job );
{
job_status_type status;
int status;
struct jobInfoEnt *job_info;
if (lsb_openjobinfo(job->lsf_jobnr , NULL , NULL , NULL , NULL , ALL_JOB) != 1) {
/*
@ -349,31 +426,18 @@ static job_status_type lsf_driver_get_job_status_libary(void * __driver , void *
job->num_exec_host = job_info->numExHosts;
job->exec_host = util_alloc_stringlist_copy( (const char **) job_info->exHosts , job->num_exec_host);
}
switch (job_info->status) {
CASE_SET(JOB_STAT_PEND , JOB_QUEUE_PENDING);
CASE_SET(JOB_STAT_SSUSP , JOB_QUEUE_RUNNING);
CASE_SET(JOB_STAT_RUN , JOB_QUEUE_RUNNING);
CASE_SET(JOB_STAT_EXIT , JOB_QUEUE_EXIT);
CASE_SET(JOB_STAT_DONE , JOB_QUEUE_DONE);
CASE_SET(JOB_STAT_PDONE , JOB_QUEUE_DONE);
CASE_SET(JOB_STAT_PERR , JOB_QUEUE_EXIT);
CASE_SET(192 , JOB_QUEUE_DONE); /* this 192 seems to pop up - where the fuck
does it come frome ?? _pdone + _ususp ??? */
default:
util_abort("%s: job:%ld lsf_status:%d not recognized - internal LSF fuck up - aborting \n",__func__ , job->lsf_jobnr , job_info->status);
status = JOB_QUEUE_DONE; /* ???? */
}
status = job_info->status;
}
return status;
}
}
}
static job_status_type lsf_driver_get_job_status_shell(void * __driver , void * __job) {
job_status_type status = JOB_QUEUE_NOT_ACTIVE;
static int lsf_driver_get_job_status_shell(void * __driver , void * __job) {
int status = JOB_STAT_NULL;
if (__job != NULL) {
lsf_job_type * job = lsf_job_safe_cast( __job );
@ -388,7 +452,7 @@ static job_status_type lsf_driver_get_job_status_shell(void * __driver , void *
*/
pthread_mutex_lock( &driver->bjobs_mutex );
{
if (difftime(time(NULL) , driver->last_bjobs_update) > BJOBS_REFRESH_TIME) {
if (difftime(time(NULL) , driver->last_bjobs_update) > driver->bjobs_refresh_interval) {
lsf_driver_update_bjobs_table(driver);
driver->last_bjobs_update = time( NULL );
}
@ -402,7 +466,7 @@ static job_status_type lsf_driver_get_job_status_shell(void * __driver , void *
/*
It might be running - but since job != NULL it is at least in the queue system.
*/
status = JOB_QUEUE_PENDING;
status = JOB_STAT_PEND;
}
}
@ -411,20 +475,69 @@ static job_status_type lsf_driver_get_job_status_shell(void * __driver , void *
}
job_status_type lsf_driver_convert_status( int lsf_status ) {
job_status_type job_status;
switch (lsf_status) {
case JOB_STAT_NULL:
job_status = JOB_QUEUE_NOT_ACTIVE;
break;
case JOB_STAT_PEND:
job_status = JOB_QUEUE_PENDING;
break;
case JOB_STAT_SSUSP:
job_status = JOB_QUEUE_RUNNING;
break;
case JOB_STAT_USUSP:
job_status = JOB_QUEUE_RUNNING;
break;
case JOB_STAT_PSUSP:
job_status = JOB_QUEUE_RUNNING;
break;
case JOB_STAT_RUN:
job_status = JOB_QUEUE_RUNNING;
break;
case JOB_STAT_DONE:
job_status = JOB_QUEUE_DONE;
break;
case JOB_STAT_EXIT:
job_status = JOB_QUEUE_EXIT;
break;
case JOB_STAT_UNKWN: // Have lost contact with one of the daemons.
job_status = JOB_QUEUE_EXIT;
break;
case 192: /* this 192 seems to pop up - where the fuck does it come frome ?? _pdone + _ususp ??? */
job_status = JOB_QUEUE_DONE;
break;
default:
job_status = JOB_QUEUE_NOT_ACTIVE;
util_abort("%s: unrecognized lsf status code:%d \n",__func__ , lsf_status );
}
return job_status;
}
int lsf_driver_get_job_status_lsf(void * __driver , void * __job) {
int lsf_status;
lsf_driver_type * driver = lsf_driver_safe_cast( __driver );
if (driver->submit_method == LSF_SUBMIT_INTERNAL)
lsf_status = lsf_driver_get_job_status_libary(__driver , __job);
else
lsf_status = lsf_driver_get_job_status_shell(__driver , __job);
return lsf_status;
}
job_status_type lsf_driver_get_job_status(void * __driver , void * __job) {
job_status_type status;
lsf_driver_type * driver = lsf_driver_safe_cast( __driver );
if (driver->use_library_calls)
status = lsf_driver_get_job_status_libary(__driver , __job);
else
status = lsf_driver_get_job_status_shell(__driver , __job);
return status;
int lsf_status = lsf_driver_get_job_status_lsf( __driver , __job );
return lsf_driver_convert_status( lsf_status );
}
void lsf_driver_free_job(void * __job) {
lsf_job_type * job = lsf_job_safe_cast( __job );
lsf_job_free(job);
@ -436,17 +549,20 @@ void lsf_driver_kill_job(void * __driver , void * __job) {
lsf_driver_type * driver = lsf_driver_safe_cast( __driver );
lsf_job_type * job = lsf_job_safe_cast( __job );
{
if (driver->use_library_calls)
if (driver->submit_method == LSF_SUBMIT_INTERNAL)
lsb_forcekilljob(job->lsf_jobnr);
else {
char ** argv = util_calloc( 2, sizeof * argv );
argv[0] = driver->remote_lsf_server;
argv[1] = util_alloc_sprintf("bkill %s" , job->lsf_jobnr_char);
util_fork_exec(driver->rsh_cmd , 1 , (const char **) &job->lsf_jobnr_char , true , NULL , NULL , NULL , NULL , NULL);
if (driver->submit_method == LSF_SUBMIT_REMOTE_SHELL) {
char ** argv = util_calloc( 2, sizeof * argv );
argv[0] = driver->remote_lsf_server;
argv[1] = util_alloc_sprintf("%s %s" , driver->bkill_cmd , job->lsf_jobnr_char);
free( argv[1] );
free( argv );
util_fork_exec(driver->rsh_cmd , 2 , (const char **) argv , true , NULL , NULL , NULL , NULL , NULL);
free( argv[1] );
free( argv );
} else if (driver->submit_method == LSF_SUBMIT_LOCAL_SHELL)
util_fork_exec(driver->bkill_cmd , 1 , (const char **) &job->lsf_jobnr_char , true , NULL , NULL , NULL , NULL , NULL);
}
}
}
@ -464,50 +580,22 @@ void * lsf_driver_submit_job(void * __driver ,
const char ** argv ) {
lsf_driver_type * driver = lsf_driver_safe_cast( __driver );
{
lsf_job_type * job = lsf_job_alloc();
char * lsf_stdout = util_alloc_joined_string( (const char *[2]) {run_path , "/LSF.stdout"} , 2 , "");
pthread_mutex_lock( &driver->submit_lock );
lsf_job_type * job = lsf_job_alloc();
{
char * lsf_stdout = util_alloc_filename(run_path , job_name , "LSF-stdout");
pthread_mutex_lock( &driver->submit_lock );
if (driver->use_library_calls) {
char * command;
{
buffer_type * command_buffer = buffer_alloc( 256 );
buffer_fwrite_char_ptr( command_buffer , submit_cmd );
for (int iarg = 0; iarg < argc; iarg++) {
buffer_fwrite_char( command_buffer , ' ');
buffer_fwrite_char_ptr( command_buffer , argv[ iarg ]);
}
buffer_terminate_char_ptr( command_buffer );
command = buffer_get_data( command_buffer );
buffer_free_container( command_buffer );
if (driver->submit_method == LSF_SUBMIT_INTERNAL) {
job->lsf_jobnr = lsf_driver_submit_internal_job( driver , run_path , job_name , submit_cmd , num_cpu , argc, argv);
} else {
job->lsf_jobnr = lsf_driver_submit_shell_job( driver , run_path , job_name , submit_cmd , num_cpu , argc, argv);
job->lsf_jobnr_char = util_alloc_sprintf("%ld" , job->lsf_jobnr);
hash_insert_ref( driver->my_jobs , job->lsf_jobnr_char , NULL );
}
{
int options = SUB_QUEUE + SUB_JOB_NAME + SUB_OUT_FILE;
if (driver->resource_request != NULL) {
options += SUB_RES_REQ;
driver->lsf_request.resReq = driver->resource_request;
}
if (driver->login_shell != NULL) {
driver->lsf_request.loginShell = driver->login_shell;
options += SUB_LOGIN_SHELL;
}
driver->lsf_request.options = options;
}
driver->lsf_request.jobName = (char *) job_name;
driver->lsf_request.outFile = lsf_stdout;
driver->lsf_request.command = command;
driver->lsf_request.numProcessors = num_cpu;
job->lsf_jobnr = lsb_submit( &driver->lsf_request , &driver->lsf_reply );
free( command ); /* I trust the lsf layer is finished with the command? */
} else {
job->lsf_jobnr = lsf_driver_submit_shell_job( driver , run_path , job_name , submit_cmd , num_cpu , argc, argv);
job->lsf_jobnr_char = util_alloc_sprintf("%ld" , job->lsf_jobnr);
hash_insert_ref( driver->my_jobs , job->lsf_jobnr_char , NULL );
}
pthread_mutex_unlock( &driver->submit_lock );
free(lsf_stdout);
pthread_mutex_unlock( &driver->submit_lock );
free( lsf_stdout );
}
if (job->lsf_jobnr > 0)
return job;
@ -516,7 +604,7 @@ void * lsf_driver_submit_job(void * __driver ,
The submit failed - the queue system shall handle
NULL return values.
*/
if (driver->use_library_calls)
if (driver->submit_method == LSF_SUBMIT_INTERNAL)
fprintf(stderr,"%s: ** Warning: lsb_submit() failed: %s/%d \n",__func__ , lsb_sysmsg() , lsberrno);
lsf_job_free(job);
return NULL;
@ -532,6 +620,9 @@ void lsf_driver_free(lsf_driver_type * driver ) {
util_safe_free(driver->resource_request );
util_safe_free(driver->remote_lsf_server );
util_safe_free(driver->rsh_cmd );
free( driver->bkill_cmd );
free( driver->bjobs_cmd );
free( driver->bsub_cmd );
hash_free(driver->status_map);
hash_free(driver->bjobs_cache);
@ -549,7 +640,6 @@ void lsf_driver_free__(void * __driver ) {
static void lsf_driver_set_queue( lsf_driver_type * driver, const char * queue ) {
driver->queue_name = util_realloc_string_copy( driver->queue_name , queue);
driver->lsf_request.queue = driver->queue_name;
}
@ -561,18 +651,44 @@ static void lsf_driver_set_rsh_cmd( lsf_driver_type * driver , const char * rsh_
driver->rsh_cmd = util_realloc_string_copy( driver->rsh_cmd , rsh_cmd );
}
static void lsf_driver_set_bsub_cmd( lsf_driver_type * driver , const char * bsub_cmd) {
driver->bsub_cmd = util_realloc_string_copy( driver->bsub_cmd , bsub_cmd );
}
static void lsf_driver_set_bjobs_cmd( lsf_driver_type * driver , const char * bjobs_cmd) {
driver->bjobs_cmd = util_realloc_string_copy( driver->bjobs_cmd , bjobs_cmd );
}
static void lsf_driver_set_bkill_cmd( lsf_driver_type * driver , const char * bkill_cmd) {
driver->bkill_cmd = util_realloc_string_copy( driver->bkill_cmd , bkill_cmd );
}
static void lsf_driver_set_remote_server( lsf_driver_type * driver , const char * remote_server) {
driver->remote_lsf_server = util_realloc_string_copy( driver->remote_lsf_server , remote_server );
if (driver->remote_lsf_server != NULL) {
driver->use_library_calls = false;
util_unsetenv( "BSUB_QUIET" );
} else {
if (driver->remote_lsf_server == NULL) {
/* No remote server has been set - assuming we can issue proper library calls. */
util_setenv("BSUB_QUIET" , "yes"); /* This must NOT be set when using the shell function, because then stdout is redirected and read. */
driver->use_library_calls = true;
/* The BSUB_QUEUE variable must NOT be set when using the shell
function, because then stdout is redirected and read. */
util_setenv("BSUB_QUIET" , "yes");
driver->submit_method = LSF_SUBMIT_INTERNAL;
} else {
util_unsetenv( "BSUB_QUIET" );
{
char * tmp_server = util_alloc_strupr_copy( remote_server );
if (strcmp(tmp_server , LOCAL_LSF_SERVER) == 0)
driver->submit_method = LSF_SUBMIT_LOCAL_SHELL;
else
driver->submit_method = LSF_SUBMIT_REMOTE_SHELL;
free( tmp_server );
}
}
}
lsf_submit_method_enum lsf_driver_get_submit_method( const lsf_driver_type * driver ) {
return driver->submit_method;
}
/*****************************************************************/
/* Generic functions for runtime manipulation of options.
@ -596,6 +712,12 @@ bool lsf_driver_set_option( void * __driver , const char * option_key , const vo
lsf_driver_set_login_shell( driver , value );
else if (strcmp( LSF_RSH_CMD , option_key) == 0)
lsf_driver_set_rsh_cmd( driver , value );
else if (strcmp( LSF_BSUB_CMD , option_key) == 0)
lsf_driver_set_bsub_cmd( driver , value );
else if (strcmp( LSF_BJOBS_CMD , option_key) == 0)
lsf_driver_set_bjobs_cmd( driver , value );
else if (strcmp( LSF_BKILL_CMD , option_key) == 0)
lsf_driver_set_bkill_cmd( driver , value );
else
has_option = false;
}
@ -616,6 +738,12 @@ const void * lsf_driver_get_option( const void * __driver , const char * option_
return driver->login_shell;
else if (strcmp( LSF_RSH_CMD , option_key ) == 0)
return driver->rsh_cmd;
else if (strcmp( LSF_BJOBS_CMD , option_key ) == 0)
return driver->bjobs_cmd;
else if (strcmp( LSF_BSUB_CMD , option_key ) == 0)
return driver->bsub_cmd;
else if (strcmp( LSF_BKILL_CMD , option_key ) == 0)
return driver->bkill_cmd;
else {
util_abort("%s: option_id:%s not recognized for LSF driver \n",__func__ , option_key);
return NULL;
@ -634,12 +762,17 @@ bool lsf_driver_has_option( const void * __driver , const char * option_key) {
/*****************************************************************/
/* Observe that this driver IS not properly initialized when returning
/*
Observe that this driver IS not properly initialized when returning
from this function, the option interface must be used to set the
keys:
*/
void lsf_driver_set_bjobs_refresh_interval( lsf_driver_type * driver , int refresh_interval) {
driver->bjobs_refresh_interval = refresh_interval;
}
void * lsf_driver_alloc( ) {
lsf_driver_type * lsf_driver = util_malloc(sizeof * lsf_driver );
lsf_driver->login_shell = NULL;
@ -647,6 +780,7 @@ void * lsf_driver_alloc( ) {
lsf_driver->remote_lsf_server = NULL;
lsf_driver->rsh_cmd = NULL;
lsf_driver->resource_request = NULL;
lsf_driver_set_bjobs_refresh_interval( lsf_driver , BJOBS_REFRESH_TIME );
UTIL_TYPE_ID_INIT( lsf_driver , LSF_DRIVER_TYPE_ID);
pthread_mutex_init( &lsf_driver->submit_lock , NULL );
@ -686,19 +820,26 @@ void * lsf_driver_alloc( ) {
lsf_driver->bjobs_cache = hash_alloc();
lsf_driver->my_jobs = hash_alloc();
lsf_driver->status_map = hash_alloc();
lsf_driver->bsub_cmd = NULL;
lsf_driver->bjobs_cmd = NULL;
lsf_driver->bkill_cmd = NULL;
hash_insert_int(lsf_driver->status_map , "PEND" , JOB_QUEUE_PENDING);
hash_insert_int(lsf_driver->status_map , "SSUSP" , JOB_QUEUE_RUNNING);
hash_insert_int(lsf_driver->status_map , "PSUSP" , JOB_QUEUE_PENDING);
hash_insert_int(lsf_driver->status_map , "RUN" , JOB_QUEUE_RUNNING);
hash_insert_int(lsf_driver->status_map , "EXIT" , JOB_QUEUE_EXIT);
hash_insert_int(lsf_driver->status_map , "USUSP" , JOB_QUEUE_RUNNING);
hash_insert_int(lsf_driver->status_map , "DONE" , JOB_QUEUE_DONE);
hash_insert_int(lsf_driver->status_map , "UNKWN" , JOB_QUEUE_EXIT); /* Uncertain about this one */
hash_insert_int(lsf_driver->status_map , "PEND" , JOB_STAT_PEND);
hash_insert_int(lsf_driver->status_map , "SSUSP" , JOB_STAT_SSUSP);
hash_insert_int(lsf_driver->status_map , "PSUSP" , JOB_STAT_PSUSP);
hash_insert_int(lsf_driver->status_map , "USUSP" , JOB_STAT_USUSP);
hash_insert_int(lsf_driver->status_map , "RUN" , JOB_STAT_RUN);
hash_insert_int(lsf_driver->status_map , "EXIT" , JOB_STAT_EXIT);
hash_insert_int(lsf_driver->status_map , "DONE" , JOB_STAT_DONE);
hash_insert_int(lsf_driver->status_map , "UNKWN" , JOB_STAT_UNKWN); /* Uncertain about this one */
pthread_mutex_init( &lsf_driver->bjobs_mutex , NULL );
lsf_driver_set_remote_server( lsf_driver , NULL );
lsf_driver_set_rsh_cmd( lsf_driver , DEFAULT_RSH_CMD );
lsf_driver_set_option( lsf_driver , LSF_SERVER , NULL );
lsf_driver_set_option( lsf_driver , LSF_RSH_CMD , DEFAULT_RSH_CMD );
lsf_driver_set_option( lsf_driver , LSF_BSUB_CMD , DEFAULT_BSUB_CMD );
lsf_driver_set_option( lsf_driver , LSF_BJOBS_CMD , DEFAULT_BJOBS_CMD );
lsf_driver_set_option( lsf_driver , LSF_BKILL_CMD , DEFAULT_BKILL_CMD );
return lsf_driver;
}

View File

@ -1,2 +0,0 @@
SConscript(["src/SConstruct"])

Some files were not shown because too many files have changed in this diff Show More