mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
parent
6784a8e596
commit
80c5224c65
11
ThirdParty/Ert/devel/CMakeLists.txt
vendored
11
ThirdParty/Ert/devel/CMakeLists.txt
vendored
@ -19,15 +19,21 @@ ENABLE_TESTING()
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(ERT_LINUX TRUE )
|
||||
add_definitions( -DERT_LINUX )
|
||||
set( CMAKE_C_FLAGS "-g -O2 -Wall -std=gnu99" )
|
||||
set( CMAKE_CXX_FLAGS "-g -O2 -Wall" )
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
set(ERT_WINDOWS TRUE)
|
||||
add_definitions( -DERT_WINDOWS )
|
||||
endif()
|
||||
|
||||
|
||||
if (ERT_WINDOWS)
|
||||
set( CMAKE_C_FLAGS "-O2" )
|
||||
set( CMAKE_CXX_FLAGS "-O2" )
|
||||
else()
|
||||
set( CMAKE_C_FLAGS "-g -O2 -Wall -Wno-unknown-pragmas -std=gnu99 " )
|
||||
set( CMAKE_CXX_FLAGS "-g -O2 -Wall" )
|
||||
endif()
|
||||
|
||||
|
||||
include(cmake/ert_check.cmake)
|
||||
include(cmake/ert_find.cmake)
|
||||
include(cmake/Modules/UseMultiArch.cmake)
|
||||
@ -51,7 +57,6 @@ endif(MSVC)
|
||||
|
||||
|
||||
|
||||
|
||||
if (MSVC)
|
||||
add_definitions( -D__func__="\\"????\\"")
|
||||
endif()
|
||||
|
7
ThirdParty/Ert/devel/cmake/ert_check.cmake
vendored
7
ThirdParty/Ert/devel/cmake/ert_check.cmake
vendored
@ -76,9 +76,12 @@ if (HAVE_OPENDIR)
|
||||
add_definitions( -DHAVE_OPENDIR )
|
||||
endif()
|
||||
|
||||
check_function_exists( usleep HAVE_USLEEP )
|
||||
# The usleep() check uses the symbol HAVE__USLEEP with double
|
||||
# underscore to avoid conflict with plplot which defines the
|
||||
# HAVE_USLEEP symbol.
|
||||
check_function_exists( usleep HAVE__USLEEP )
|
||||
if (HAVE_OPENDIR)
|
||||
add_definitions( -DHAVE_USLEEP )
|
||||
add_definitions( -DHAVE__USLEEP )
|
||||
endif()
|
||||
|
||||
try_compile( HAVE_ISFINITE ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_isfinite.c )
|
||||
|
@ -411,8 +411,7 @@ void bootstrap_enkf_updateA(void * module_data ,
|
||||
matrix_type * R ,
|
||||
matrix_type * dObs ,
|
||||
matrix_type * E ,
|
||||
matrix_type * D ,
|
||||
matrix_type * randrot) {
|
||||
matrix_type * D ) {
|
||||
|
||||
bootstrap_enkf_data_type * bootstrap_data = bootstrap_enkf_data_safe_cast( module_data );
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ int enkf_linalg_svd_truncation(const matrix_type * S ,
|
||||
matrix_type * U0 ,
|
||||
matrix_type * V0T) {
|
||||
|
||||
int num_significant;
|
||||
int num_significant = -1;
|
||||
int nrows = matrix_get_rows(S);
|
||||
int ncolumns= matrix_get_columns(S);
|
||||
|
||||
|
11
ThirdParty/Ert/devel/libanalysis/src/rml_enkf.c
vendored
11
ThirdParty/Ert/devel/libanalysis/src/rml_enkf.c
vendored
@ -314,13 +314,10 @@ long rml_enkf_get_options( void * arg , long flag ) {
|
||||
|
||||
|
||||
bool rml_enkf_has_var( const void * arg, const char * var_name) {
|
||||
const rml_enkf_data_type * module_data = rml_enkf_data_safe_cast_const( arg );
|
||||
{
|
||||
if (strcmp(var_name , "ITER") == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
if (strcmp(var_name , "ITER") == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ typedef enum {CONFIG_STRING = 1,
|
||||
void config_schema_item_free( config_schema_item_type * item);
|
||||
void config_schema_item_free__ (void * void_item);
|
||||
|
||||
|
||||
void config_schema_item_set_required_children_on_value(config_schema_item_type * item , const char * value , stringlist_type * child_list);
|
||||
void config_schema_item_set_common_selection_set(config_schema_item_type * item , int argc , const char ** argv);
|
||||
void config_schema_item_set_indexed_selection_set(config_schema_item_type * item , int index , int argc , const char ** argv);
|
||||
void config_schema_item_set_required_children(config_schema_item_type * item , stringlist_type * stringlist);
|
||||
|
2
ThirdParty/Ert/devel/libconfig/src/config.c
vendored
2
ThirdParty/Ert/devel/libconfig/src/config.c
vendored
@ -755,7 +755,7 @@ static void config_parse__(config_type * config ,
|
||||
}
|
||||
free(config_file);
|
||||
path_stack_pop( path_stack );
|
||||
vector_pop( config->path_elm_stack );
|
||||
vector_pop_back( config->path_elm_stack );
|
||||
}
|
||||
|
||||
|
||||
|
@ -271,6 +271,7 @@ bool config_schema_item_validate_set(const config_schema_item_type * item , stri
|
||||
error_message = util_alloc_sprintf("Error when parsing config_file:\"%s\" Keyword:%s must have maximum %d arguments.",config_file , item->kw , item->validate->argc_max);
|
||||
else
|
||||
error_message = util_alloc_sprintf("Error:: Keyword:%s must have maximum %d arguments.",item->kw , item->validate->argc_max);
|
||||
|
||||
config_error_add( error_list , error_message );
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ target_link_libraries( config_content_node config)
|
||||
add_executable( config_content_item config_content_item.c)
|
||||
target_link_libraries( config_content_item config)
|
||||
|
||||
add_executable( config_argc config_argc.c)
|
||||
target_link_libraries( config_argc config)
|
||||
|
||||
add_executable( config_error config_error.c)
|
||||
target_link_libraries( config_error config)
|
||||
add_test( config_error ${EXECUTABLE_OUTPUT_PATH}/config_error )
|
||||
@ -47,3 +50,4 @@ add_test( config_content_node ${EXECUTABLE_OUTPUT_PATH}/config_content_node )
|
||||
add_test( config_content_item ${EXECUTABLE_OUTPUT_PATH}/config_content_item ${CMAKE_CURRENT_SOURCE_DIR}/data/content_item_test)
|
||||
add_test( config_include_test ${EXECUTABLE_OUTPUT_PATH}/config_include_test ${CMAKE_CURRENT_SOURCE_DIR}/data include_test )
|
||||
add_test( config_root_path ${EXECUTABLE_OUTPUT_PATH}/config_root_path ${CMAKE_CURRENT_SOURCE_DIR}/data )
|
||||
add_test( config_argc ${EXECUTABLE_OUTPUT_PATH}/config_argc ${CMAKE_CURRENT_SOURCE_DIR}/data/argc_OK ${CMAKE_CURRENT_SOURCE_DIR}/data/argc_less ${CMAKE_CURRENT_SOURCE_DIR}/data/argc_more)
|
||||
|
@ -28,7 +28,6 @@
|
||||
int main(int argc , char ** argv) {
|
||||
const char * config_file = argv[1];
|
||||
config_type * config = config_alloc();
|
||||
bool OK;
|
||||
config_schema_item_type * item = config_add_schema_item(config , "APPEND" , false );
|
||||
config_schema_item_set_argc_minmax( item , 1 , 1);
|
||||
|
||||
|
80
ThirdParty/Ert/devel/libconfig/tests/config_argc.c
vendored
Normal file
80
ThirdParty/Ert/devel/libconfig/tests/config_argc.c
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'config_argc.c' is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <ert/config/config.h>
|
||||
#include <ert/config/config_schema_item.h>
|
||||
#include <ert/config/config_error.h>
|
||||
|
||||
void install_SIGNALS(void) {
|
||||
signal(SIGSEGV , util_abort_signal); /* Segmentation violation, i.e. overwriting memory ... */
|
||||
signal(SIGINT , util_abort_signal); /* Control C */
|
||||
signal(SIGTERM , util_abort_signal); /* If killing the program with SIGTERM (the default kill signal) you will get a backtrace.
|
||||
Killing with SIGKILL (-9) will not give a backtrace.*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
install_SIGNALS();
|
||||
{
|
||||
const char * argc_OK = argv[1];
|
||||
const char * argc_less = argv[2];
|
||||
const char * argc_more = argv[3];
|
||||
|
||||
config_type * config = config_alloc();
|
||||
config_schema_item_type * schema_item = config_add_schema_item( config , "ITEM" , false );
|
||||
config_schema_item_set_argc_minmax( schema_item , 2 , 2 );
|
||||
|
||||
test_assert_true( config_parse( config , argc_OK , "--" , NULL , NULL , CONFIG_UNRECOGNIZED_ERROR , true));
|
||||
config_clear( config );
|
||||
|
||||
test_assert_false( config_parse( config , argc_less , "--" , NULL , NULL , CONFIG_UNRECOGNIZED_ERROR , true));
|
||||
{
|
||||
const config_error_type * config_error = config_get_errors( config );
|
||||
const char * error_msg = "Error when parsing config_file:\"argc_less\" Keyword:ITEM must have at least 2 arguments.";
|
||||
|
||||
test_assert_int_equal( config_error_count( config_error ) , 1);
|
||||
test_assert_string_equal( config_error_iget( config_error , 0 ) , error_msg);
|
||||
}
|
||||
config_clear( config );
|
||||
|
||||
|
||||
test_assert_false( config_parse( config , argc_more , "--" , NULL , NULL , CONFIG_UNRECOGNIZED_ERROR , true));
|
||||
{
|
||||
const config_error_type * config_error = config_get_errors( config );
|
||||
const char * error_msg = "Error when parsing config_file:\"argc_more\" Keyword:ITEM must have maximum 2 arguments.";
|
||||
|
||||
test_assert_int_equal( config_error_count( config_error ) , 1);
|
||||
test_assert_string_equal( config_error_iget( config_error , 0 ) , error_msg);
|
||||
}
|
||||
config_clear( config );
|
||||
|
||||
|
||||
config_free( config );
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
config_type * config = config_alloc();
|
||||
config_schema_item_type * schema_item = config_add_schema_item( config , "KEYWORD" , false );
|
||||
config_add_schema_item( config , "KEYWORD" , false );
|
||||
config_free( config );
|
||||
exit(0);
|
||||
}
|
||||
|
@ -27,16 +27,6 @@
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
#ifdef ERT_LINUX
|
||||
const char * root = "/tmp/root";
|
||||
const char * rel_path = "rel/path";
|
||||
const char * abs_path = "/tmp/root/abs/path";
|
||||
const char * rel_true = "rel/path/XXX";
|
||||
const char * abs_true = "/tmp/root/rel/path/XXX";
|
||||
const char * path_true1 = "rel/path/XXX";
|
||||
const char * path_true2 = "/tmp/root/rel/path/XXX";
|
||||
#endif
|
||||
|
||||
char * cwd = util_alloc_cwd();
|
||||
|
||||
{
|
||||
|
1
ThirdParty/Ert/devel/libconfig/tests/data/argc_OK
vendored
Normal file
1
ThirdParty/Ert/devel/libconfig/tests/data/argc_OK
vendored
Normal file
@ -0,0 +1 @@
|
||||
ITEM Arg1 Arg2
|
1
ThirdParty/Ert/devel/libconfig/tests/data/argc_less
vendored
Normal file
1
ThirdParty/Ert/devel/libconfig/tests/data/argc_less
vendored
Normal file
@ -0,0 +1 @@
|
||||
ITEM Arg1
|
2
ThirdParty/Ert/devel/libconfig/tests/data/argc_more
vendored
Normal file
2
ThirdParty/Ert/devel/libconfig/tests/data/argc_more
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
ITEM Arg1 ARG2 Arg3
|
||||
|
@ -12,18 +12,18 @@ add_library( ecl ${LIBRARY_TYPE} ${source_files} )
|
||||
set_target_properties( ecl PROPERTIES VERSION 1.0 SOVERSION 1.0 )
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
set( OPENMP OFF )
|
||||
option(USE_OPENMP "Include OpenMP support" OFF)
|
||||
if (USE_OPENMP)
|
||||
INCLUDE(CheckCCompilerFlag)
|
||||
CHECK_C_COMPILER_FLAG(-fopenmp OPENMP)
|
||||
if (OPENMP)
|
||||
add_definitions( -DHAVE_OPENMP -fopenmp )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if (OPENMP)
|
||||
add_definitions( -DHAVE_OPENMP -fopenmp )
|
||||
target_link_libraries( ecl gomp )
|
||||
else()
|
||||
add_definitions( -fno-openmp )
|
||||
endif()
|
||||
target_link_libraries( ecl ert_geometry ert_util )
|
||||
|
||||
|
@ -121,7 +121,7 @@ struct ecl_coarse_cell_struct {
|
||||
|
||||
static UTIL_SAFE_CAST_FUNCTION( ecl_coarse_cell , ECL_COARSE_CELL_TYPE_ID )
|
||||
|
||||
static void ecl_coarse_cell_assert( ecl_coarse_cell_type * coarse_cell ) {
|
||||
void ecl_coarse_cell_assert( ecl_coarse_cell_type * coarse_cell ) {
|
||||
int box_size =
|
||||
(1 + coarse_cell->ijk[1] - coarse_cell->ijk[0]) *
|
||||
(1 + coarse_cell->ijk[2] - coarse_cell->ijk[3]) *
|
||||
|
12
ThirdParty/Ert/devel/libecl/src/ecl_file.c
vendored
12
ThirdParty/Ert/devel/libecl/src/ecl_file.c
vendored
@ -246,16 +246,6 @@ static bool file_map_has_kw( const file_map_type * file_map, const char * kw) {
|
||||
return hash_has_key( file_map->kw_index , kw );
|
||||
}
|
||||
|
||||
static bool file_map_has_kw_ptr( const file_map_type * file_map, const ecl_kw_type * ecl_kw) {
|
||||
int index;
|
||||
for (index = 0; index < vector_get_size( file_map->kw_list ); index++) {
|
||||
const ecl_file_kw_type * file_kw = vector_iget_const( file_map->kw_list , index );
|
||||
if (ecl_file_kw_ptr_eq( file_kw , ecl_kw ))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static ecl_file_kw_type * file_map_iget_file_kw( const file_map_type * file_map , int global_index) {
|
||||
ecl_file_kw_type * file_kw = vector_iget( file_map->kw_list , global_index);
|
||||
@ -932,7 +922,7 @@ void ecl_file_push_block( ecl_file_type * ecl_file ) {
|
||||
}
|
||||
|
||||
void ecl_file_pop_block( ecl_file_type * ecl_file ) {
|
||||
ecl_file->active_map = vector_pop( ecl_file->map_stack );
|
||||
ecl_file->active_map = vector_pop_back( ecl_file->map_stack );
|
||||
}
|
||||
|
||||
|
||||
|
127
ThirdParty/Ert/devel/libecl/src/ecl_grid.c
vendored
127
ThirdParty/Ert/devel/libecl/src/ecl_grid.c
vendored
@ -1675,7 +1675,11 @@ static void ecl_grid_init_mapaxes( ecl_grid_type * ecl_grid , const float * mapa
|
||||
order of occurence in the grid file. the following equalities
|
||||
should apply:
|
||||
|
||||
occurence number in file == lgr_grid->grid_nr == gridhead(4) for lgr == index in the lgr_list vector
|
||||
occurence number in file == lgr_grid->grid_nr
|
||||
|
||||
This 'mostly' agrees with the GRIDHEAD(4) item, but
|
||||
unfortunately not always. Cases have popped up where the series
|
||||
of GRIDHEAD(4) values from lgr to lgr have holes :-(
|
||||
|
||||
when installed in the lgr_list vector the lgr grid is installed
|
||||
with a destructor, i.e. the grid is destroyed when the vector
|
||||
@ -1885,7 +1889,11 @@ void ecl_grid_init_GRDECL_data(ecl_grid_type * ecl_grid , const float * zcorn ,
|
||||
0---1
|
||||
*/
|
||||
|
||||
static ecl_grid_type * ecl_grid_alloc_GRDECL_data__(ecl_grid_type * global_grid , int dualp_flag , int nx , int ny , int nz , const float * zcorn , const float * coord , const int * actnum, const float * mapaxes, const int * corsnum, int grid_nr) {
|
||||
static ecl_grid_type * ecl_grid_alloc_GRDECL_data__(ecl_grid_type * global_grid ,
|
||||
int dualp_flag , int nx , int ny , int nz ,
|
||||
const float * zcorn , const float * coord , const int * actnum, const float * mapaxes, const int * corsnum,
|
||||
int grid_nr) {
|
||||
|
||||
ecl_grid_type * ecl_grid = ecl_grid_alloc_empty(global_grid , dualp_flag , nx,ny,nz,grid_nr,true);
|
||||
|
||||
if (mapaxes != NULL)
|
||||
@ -1931,8 +1939,14 @@ static ecl_grid_type * ecl_grid_alloc_GRDECL_kw__(ecl_grid_type * global_grid ,
|
||||
ny = ecl_kw_iget_int(gridhead_kw , GRIDHEAD_NY_INDEX);
|
||||
nz = ecl_kw_iget_int(gridhead_kw , GRIDHEAD_NZ_INDEX);
|
||||
|
||||
if (grid_nr != ecl_kw_iget_int( gridhead_kw , GRIDHEAD_LGR_INDEX))
|
||||
util_abort("%s: internal error in grid loader - lgr index mismatch\n",__func__);
|
||||
/*
|
||||
The code used to have this test:
|
||||
|
||||
if (grid_nr != ecl_kw_iget_int( gridhead_kw , GRIDHEAD_LGR_INDEX))
|
||||
util_abort("%s: internal error in grid loader - lgr index mismatch\n",__func__);
|
||||
|
||||
But then suddenly a EGRID file where this did not apply appeared :-(
|
||||
*/
|
||||
|
||||
if (gtype != GRIDHEAD_GRIDTYPE_CORNERPOINT)
|
||||
util_abort("%s: gtype:%d fatal error when loading grid - must have corner point grid - aborting\n",__func__ , gtype );
|
||||
@ -2397,6 +2411,109 @@ ecl_grid_type * ecl_grid_alloc(const char * grid_file ) {
|
||||
}
|
||||
|
||||
|
||||
static void ecl_grid_file_nactive_dims( fortio_type * data_fortio , int * dims) {
|
||||
if (data_fortio) {
|
||||
if (ecl_kw_fseek_kw( INTEHEAD_KW , false , false , data_fortio )) {
|
||||
ecl_kw_type * intehead_kw = ecl_kw_fread_alloc( data_fortio );
|
||||
dims[3] = ecl_kw_iget_int( intehead_kw , INTEHEAD_NACTIVE_INDEX );
|
||||
ecl_kw_free( intehead_kw );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool ecl_grid_file_EGRID_dims( fortio_type * grid_fortio , fortio_type * data_fortio , int * dims ) {
|
||||
|
||||
if (ecl_kw_fseek_kw( GRIDHEAD_KW , false , false , grid_fortio)) {
|
||||
{
|
||||
ecl_kw_type * gridhead_kw = ecl_kw_fread_alloc( grid_fortio );
|
||||
dims[0] = ecl_kw_iget_int( gridhead_kw , GRIDHEAD_NX_INDEX );
|
||||
dims[1] = ecl_kw_iget_int( gridhead_kw , GRIDHEAD_NY_INDEX );
|
||||
dims[2] = ecl_kw_iget_int( gridhead_kw , GRIDHEAD_NZ_INDEX );
|
||||
|
||||
ecl_kw_free( gridhead_kw );
|
||||
}
|
||||
ecl_grid_file_nactive_dims( data_fortio , dims );
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
static bool ecl_grid_file_GRID_dims( fortio_type * grid_fortio , fortio_type * data_fortio , int * dims ) {
|
||||
|
||||
if (ecl_kw_fseek_kw( DIMENS_KW , false , false , grid_fortio)) {
|
||||
{
|
||||
ecl_kw_type * dimens_kw = ecl_kw_fread_alloc( grid_fortio );
|
||||
dims[0] = ecl_kw_iget_int( dimens_kw , DIMENS_NX_INDEX );
|
||||
dims[1] = ecl_kw_iget_int( dimens_kw , DIMENS_NY_INDEX );
|
||||
dims[2] = ecl_kw_iget_int( dimens_kw , DIMENS_NZ_INDEX );
|
||||
|
||||
ecl_kw_free( dimens_kw );
|
||||
}
|
||||
|
||||
ecl_grid_file_nactive_dims( data_fortio , dims );
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Will check the grid dimensions from the input grid file
|
||||
@grid_filename; the input file must be a GRID/EGRID file. On exit
|
||||
the dims array will be filled as:
|
||||
|
||||
dims[0] = nx;
|
||||
dims[1] = ny;
|
||||
dims[2] = nz;
|
||||
|
||||
Optionally you can in addition supply the name of a restart or INIT
|
||||
file in the second file argument - if-and-only-if, that filename
|
||||
points to an existing file the fourth element in the dims array
|
||||
will be set as:
|
||||
|
||||
dims[3] = nactive;
|
||||
|
||||
The function as a whole will return true if the grid dimensions
|
||||
(nx,ny,nz) are sucessfully set. If the dimensions are not set the
|
||||
dims vector is not touched.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
bool ecl_grid_file_dims( const char * grid_filename , const char * init_restart_filename , int * dims) {
|
||||
bool input_file_OK = false;
|
||||
bool grid_fmt_file;
|
||||
ecl_file_enum grid_file_type = ecl_util_get_file_type( grid_filename , &grid_fmt_file , NULL );
|
||||
|
||||
if ((grid_file_type == ECL_GRID_FILE) || (grid_file_type == ECL_EGRID_FILE)) {
|
||||
fortio_type * grid_fortio = fortio_open_reader( grid_filename , grid_fmt_file , ECL_ENDIAN_FLIP );
|
||||
if (grid_fortio) {
|
||||
fortio_type * data_fortio = NULL;
|
||||
bool data_fmt_file;
|
||||
|
||||
if (init_restart_filename) {
|
||||
ecl_util_get_file_type( init_restart_filename , &data_fmt_file , NULL );
|
||||
data_fortio = fortio_open_reader( init_restart_filename , data_fmt_file , ECL_ENDIAN_FLIP );
|
||||
}
|
||||
|
||||
|
||||
if (grid_file_type == ECL_GRID_FILE)
|
||||
input_file_OK = ecl_grid_file_GRID_dims( grid_fortio , data_fortio , dims );
|
||||
else
|
||||
input_file_OK = ecl_grid_file_EGRID_dims( grid_fortio , data_fortio , dims );
|
||||
|
||||
if (data_fortio)
|
||||
fortio_fclose( data_fortio );
|
||||
|
||||
fortio_fclose( grid_fortio );
|
||||
}
|
||||
}
|
||||
|
||||
return input_file_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -2921,7 +3038,7 @@ int ecl_grid_get_nactive( const ecl_grid_type * grid ) {
|
||||
|
||||
grid_dims_type ecl_grid_iget_dims( const ecl_grid_type * grid , int grid_nr) {
|
||||
grid_dims_type dims;
|
||||
ecl_grid_type * lgr;
|
||||
const ecl_grid_type * lgr;
|
||||
|
||||
if (grid_nr == 0)
|
||||
lgr = grid;
|
||||
|
19
ThirdParty/Ert/devel/libecl/src/ecl_smspec.c
vendored
19
ThirdParty/Ert/devel/libecl/src/ecl_smspec.c
vendored
@ -939,25 +939,6 @@ static void ecl_smspec_load_restart( ecl_smspec_type * ecl_smspec , const ecl_fi
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
This function is the opposite of the ecl_smspec_index_node
|
||||
function; i.e. it will remove the smspec_node from the various
|
||||
index tables. It will not actually destroy the node itself.
|
||||
*/
|
||||
|
||||
static void ecl_smspec_delete_node_index(ecl_smspec_type * ecl_smspec, smspec_node_type * smspec_node) {
|
||||
{
|
||||
const char * gen_key1 = smspec_node_get_gen_key1( smspec_node );
|
||||
const char * gen_key2 = smspec_node_get_gen_key2( smspec_node );
|
||||
|
||||
if (gen_key1 != NULL)
|
||||
hash_del( ecl_smspec->gen_var_index , gen_key1 );
|
||||
|
||||
if (gen_key2 != NULL)
|
||||
hash_del( ecl_smspec->gen_var_index , gen_key2 );
|
||||
}
|
||||
// Is currently not deleted from the special dictionaries.
|
||||
}
|
||||
|
||||
|
||||
void ecl_smspec_index_node( ecl_smspec_type * ecl_smspec , smspec_node_type * smspec_node) {
|
||||
|
@ -904,14 +904,6 @@ static void ecl_sum_data_add_ecl_file(ecl_sum_data_type * data ,
|
||||
|
||||
|
||||
|
||||
|
||||
static void ecl_sum_data_ensure_index( ecl_sum_data_type * data ) {
|
||||
if (!data->index_valid)
|
||||
ecl_sum_data_build_index( data );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Observe that this can be called several times (but not with the same
|
||||
data - that will die).
|
||||
|
@ -13,6 +13,7 @@ add_executable( ecl_lgr_test ecl_lgr_test.c )
|
||||
target_link_libraries( ecl_lgr_test ecl )
|
||||
add_test( ecl_lgr_test1 ${EXECUTABLE_OUTPUT_PATH}/ecl_lgr_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.EGRID)
|
||||
add_test( ecl_lgr_test2 ${EXECUTABLE_OUTPUT_PATH}/ecl_lgr_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.GRID)
|
||||
add_test( ecl_lgr_test3 ${EXECUTABLE_OUTPUT_PATH}/ecl_lgr_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID )
|
||||
|
||||
|
||||
add_executable( ecl_grid_simple ecl_grid_simple.c )
|
||||
@ -79,11 +80,11 @@ set_property( TEST ecl_coarse_test PROPERTY LABELS Statoil )
|
||||
set_property( TEST ecl_restart_test PROPERTY LABELS Statoil )
|
||||
set_property( TEST ecl_lgr_test1 PROPERTY LABELS Statoil )
|
||||
set_property( TEST ecl_lgr_test2 PROPERTY LABELS Statoil )
|
||||
set_property( TEST ecl_lgr_test3 PROPERTY LABELS Statoil )
|
||||
set_property( TEST ecl_grid_simple PROPERTY LABELS Statoil )
|
||||
set_property( TEST ecl_dualp PROPERTY LABELS Statoil )
|
||||
set_property( TEST ecl_sum_test PROPERTY LABELS Statoil )
|
||||
set_property( TEST ecl_fortio PROPERTY LABELS Statoil)
|
||||
|
||||
set_property( TEST ecl_grid_dims1 PROPERTY LABELS Statoil )
|
||||
set_property( TEST ecl_grid_dims2 PROPERTY LABELS Statoil )
|
||||
set_property( TEST ecl_grid_dims3 PROPERTY LABELS Statoil )
|
||||
|
1
ThirdParty/Ert/devel/libecl/tests/ecl_fmt.c
vendored
1
ThirdParty/Ert/devel/libecl/tests/ecl_fmt.c
vendored
@ -17,6 +17,7 @@
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_util.h>
|
||||
|
@ -36,7 +36,7 @@ void test_grid( const char * grid_filename , const char * data_filename) {
|
||||
for (int i=0; i < ecl_grid_dims_get_num_grids( grid_dims ); i++) {
|
||||
|
||||
grid_dims_type d1 = ecl_grid_iget_dims( ecl_grid , i);
|
||||
grid_dims_type * d2 = ecl_grid_dims_iget_dims( grid_dims , i );
|
||||
const grid_dims_type * d2 = ecl_grid_dims_iget_dims( grid_dims , i );
|
||||
|
||||
test_assert_int_equal( d1.nx , d2->nx );
|
||||
test_assert_int_equal( d1.ny , d2->ny );
|
||||
|
12
ThirdParty/Ert/devel/libecl/tests/ecl_lgr_test.c
vendored
12
ThirdParty/Ert/devel/libecl/tests/ecl_lgr_test.c
vendored
@ -19,14 +19,24 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/test_util.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
|
||||
#include <ert/ecl/ecl_file.h>
|
||||
#include <ert/ecl/ecl_kw_magic.h>
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
const char * grid_file = argv[1];
|
||||
ecl_grid_type * ecl_grid = ecl_grid_alloc( grid_file );
|
||||
ecl_file_type * ecl_file = ecl_file_open( grid_file , 0);
|
||||
|
||||
ecl_grid_test_lgr_consistency( ecl_grid );
|
||||
|
||||
if (ecl_file_get_num_named_kw( ecl_file , COORD_KW ))
|
||||
test_assert_int_equal( ecl_file_get_num_named_kw( ecl_file , COORD_KW ) - 1, ecl_grid_get_num_lgr( ecl_grid ));
|
||||
|
||||
ecl_grid_free( ecl_grid );
|
||||
ecl_file_close( ecl_file);
|
||||
exit(0);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ int main( int argc , char ** argv) {
|
||||
{
|
||||
int iconn;
|
||||
for (iconn = 0; iconn < well_state_get_num_connections( well_state , 0 ); iconn++) {
|
||||
well_conn_type * conn = connections[ iconn ];
|
||||
const well_conn_type * conn = connections[ iconn ];
|
||||
printf("Connection:%02d i=%3d j=%3d k=%3d State:",iconn , well_conn_get_i( conn ) , well_conn_get_j( conn ) , well_conn_get_k( conn ));
|
||||
if (well_conn_open( conn ) )
|
||||
printf("Open\n");
|
||||
|
@ -14,6 +14,8 @@ target_link_libraries( well_lgr_load ecl_well )
|
||||
|
||||
add_test( well_lgr_load1 ${EXECUTABLE_OUTPUT_PATH}/well_lgr_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.X0003)
|
||||
add_test( well_lgr_load2 ${EXECUTABLE_OUTPUT_PATH}/well_lgr_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/AmalgLGRcase/TESTCASE_AMALG_LGR.X0016)
|
||||
|
||||
set_property( TEST well_lgr_load1 PROPERTY LABELS Statoil )
|
||||
set_property( TEST well_lgr_load2 PROPERTY LABELS Statoil )
|
||||
set_property( TEST well_dualp PROPERTY LABELS Statoil )
|
||||
set_property( TEST well_ts PROPERTY LABELS Statoil )
|
||||
|
@ -24,7 +24,7 @@ set( src_list main.c enkf_tui_main.c enkf_tui_fs.c enkf_tui_ranking.c enkf_tu
|
||||
execute_process(COMMAND date "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE BUILD_TIME )
|
||||
string(STRIP ${BUILD_TIME} BUILD_TIME)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/git_commit.sh ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT)
|
||||
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/git_commit.sh "${CMAKE_CURRENT_SOURCE_DIR}" OUTPUT_VARIABLE GIT_COMMIT)
|
||||
string(STRIP ${GIT_COMMIT} GIT_COMMIT)
|
||||
|
||||
set_source_files_properties( main.c PROPERTIES COMPILE_DEFINITIONS "COMPILE_TIME_STAMP=\"${BUILD_TIME}\";GIT_COMMIT=\"${GIT_COMMIT}\";SITE_CONFIG_FILE=\"${SITE_CONFIG_FILE}\"")
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <ert/enkf/enkf_defaults.h>
|
||||
#include <ert/enkf/plot_config.h>
|
||||
#include <ert/enkf/member_config.h>
|
||||
#include <ert/enkf/enkf_analysis.h>
|
||||
|
||||
#include <enkf_tui_util.h>
|
||||
#include <enkf_tui_plot.h>
|
||||
@ -192,8 +193,8 @@ void enkf_tui_QC_plot_PC( void * arg ) {
|
||||
|
||||
|
||||
void enkf_tui_QC_run_workflow( void * arg ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
qc_module_type * qc_module = enkf_main_get_qc_module( enkf_main );
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
const qc_module_type * qc_module = enkf_main_get_qc_module( enkf_main );
|
||||
|
||||
qc_module_run_workflow( qc_module , enkf_main );
|
||||
}
|
||||
|
@ -31,6 +31,8 @@
|
||||
|
||||
#include <enkf_tui_help.h>
|
||||
#include <enkf_tui_init.h>
|
||||
#include <enkf_tui_util.h>
|
||||
|
||||
|
||||
void enkf_tui_fs_ls_case(void * arg) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
@ -187,7 +189,7 @@ static void enkf_tui_fs_copy_ensemble__(
|
||||
for (i = 0; i < stringlist_get_size( restart_kw_list ); i++) {
|
||||
const char * kw = stringlist_iget( restart_kw_list , i);
|
||||
if (!ensemble_config_has_key(config , kw))
|
||||
ensemble_config_add_node(config , kw , STATIC_STATE , STATIC , NULL , NULL , NULL );
|
||||
ensemble_config_add_STATIC_node(config , kw );
|
||||
}
|
||||
for (i=0; i < ens_size; i++)
|
||||
enkf_fs_fwrite_restart_kw_list(target_fs , report_step_to , i , restart_kw_list);
|
||||
@ -272,20 +274,22 @@ void enkf_tui_fs_copy_ensemble(void * arg)
|
||||
if(strlen(report_step_from_as_char) !=0){
|
||||
util_sscanf_int(report_step_from_as_char , &report_step_from);
|
||||
state_from = enkf_tui_util_scanf_state("source analyzed/forecast [a|f]" , prompt_len , false);
|
||||
if(state_from != UNDEFINED){
|
||||
if(state_from != UNDEFINED) {
|
||||
util_printf_prompt("target case" , prompt_len , '=' , "=> ");
|
||||
char * target_case;
|
||||
if(fgets(target_case, prompt_len, stdin) != NULL);{
|
||||
char * target_case = NULL;
|
||||
|
||||
if ( fgets(target_case, prompt_len, stdin)) {
|
||||
char *newline = strchr(target_case, '\n');
|
||||
if (newline)
|
||||
*newline = 0;
|
||||
}
|
||||
if(strlen(target_case) !=0){
|
||||
|
||||
if (target_case && (strlen(target_case))) {
|
||||
char * report_step_to_as_char = util_scanf_int_with_limits_return_char("target report step",prompt_len , 0 , last_report);
|
||||
if(strlen(report_step_to_as_char) !=0){
|
||||
if (strlen(report_step_to_as_char)) {
|
||||
util_sscanf_int(report_step_to_as_char , &report_step_to);
|
||||
state_to = enkf_tui_util_scanf_state("target analyzed/forecast [a|f]" , prompt_len , false);
|
||||
if(state_to != UNDEFINED){
|
||||
if(state_to != UNDEFINED) {
|
||||
enkf_tui_fs_copy_ensemble__(enkf_main, source_case, target_case, report_step_from, state_from, report_step_to, state_to, false);
|
||||
}
|
||||
}
|
||||
@ -321,14 +325,17 @@ void enkf_tui_fs_copy_ensemble_of_parameters(void * arg)
|
||||
util_sscanf_int(report_step_from_as_char , &report_step_from);
|
||||
state_from = enkf_tui_util_scanf_state("source analyzed/forecast [a|f]" , prompt_len , false);
|
||||
if(state_from != UNDEFINED){
|
||||
|
||||
util_printf_prompt("target case" , prompt_len , '=' , "=> ");
|
||||
char * target_case;
|
||||
if(fgets(target_case, prompt_len, stdin) != NULL);{
|
||||
char * target_case = NULL;
|
||||
|
||||
if ( fgets(target_case, prompt_len, stdin) ) {
|
||||
char *newline = strchr(target_case, '\n');
|
||||
if (newline)
|
||||
*newline = 0;
|
||||
}
|
||||
if(strlen(target_case) !=0){
|
||||
|
||||
if (target_case && strlen(target_case)) {
|
||||
char * report_step_to_as_char = util_scanf_int_with_limits_return_char("target report step",prompt_len , 0 , last_report);
|
||||
if(strlen(report_step_to_as_char) !=0){
|
||||
util_sscanf_int(report_step_to_as_char , &report_step_to);
|
||||
|
@ -19,9 +19,14 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <util.h>
|
||||
#include <ctype.h>
|
||||
#include <menu.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/menu.h>
|
||||
|
||||
#include <ert/enkf/enkf_main.h>
|
||||
#include <ert/enkf/enkf_sched.h>
|
||||
|
||||
#include <enkf_tui_run.h>
|
||||
#include <enkf_tui_export.h>
|
||||
#include <enkf_tui_plot.h>
|
||||
@ -31,8 +36,6 @@
|
||||
#include <enkf_tui_QC.h>
|
||||
#include <enkf_tui_help.h>
|
||||
#include <enkf_tui_misc.h>
|
||||
#include <enkf_main.h>
|
||||
#include <enkf_sched.h>
|
||||
|
||||
|
||||
void enkf_tui_help_manual_main( void * arg) {
|
||||
|
@ -53,9 +53,10 @@
|
||||
|
||||
|
||||
|
||||
void enkf_tui_main_menu(enkf_main_type * enkf_main) {
|
||||
void enkf_tui_main_menu(void * arg) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
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 , "Quality check" , "uU" , enkf_tui_QC_menu , enkf_main , NULL);
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <enkf_main.h>
|
||||
|
||||
|
||||
void enkf_tui_main_menu(enkf_main_type *);
|
||||
void enkf_tui_main_menu(void * arg);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -431,7 +431,7 @@ void enkf_tui_plot_ensemble__(enkf_main_type * enkf_main ,
|
||||
int num_refcase = ecl_refcase_list_get_size( refcase_list );
|
||||
|
||||
for( int iref=0; iref < num_refcase; iref++) {
|
||||
ecl_sum_type * refcase = ecl_refcase_list_iget_case( refcase_list , iref );
|
||||
const ecl_sum_type * refcase = ecl_refcase_list_iget_case( refcase_list , iref );
|
||||
if ( ecl_sum_has_general_var( refcase , user_key)) {
|
||||
char * refcase_label = util_alloc_sprintf("Refcase%d" , iref);
|
||||
plot_dataset_type * d = plot_alloc_new_dataset( plot , refcase_label , PLOT_XY );
|
||||
@ -500,7 +500,7 @@ void enkf_tui_plot_GEN_KW(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);
|
||||
const enkf_fs_type * fs = enkf_main_get_fs( enkf_main );
|
||||
const time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
{
|
||||
const char * prompt = "Which GEN_KW parameter do you want to plot";
|
||||
const enkf_config_node_type * config_node = NULL;
|
||||
@ -550,11 +550,11 @@ void enkf_tui_plot_all_GEN_KW(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);
|
||||
const enkf_fs_type * fs = enkf_main_get_fs( enkf_main );
|
||||
const time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
{
|
||||
int iens1 , iens2 , step1 , step2 , ikey;
|
||||
stringlist_type * gen_kw_keys = ensemble_config_alloc_keylist_from_impl_type(ensemble_config , GEN_KW);
|
||||
const int last_report = time_map_get_last_step( time_map );
|
||||
int last_report = time_map_get_last_step( time_map );
|
||||
|
||||
enkf_tui_util_scanf_report_steps(last_report , PROMPT_LEN , &step1 , &step2);
|
||||
enkf_tui_util_scanf_iens_range("Realizations members to plot(0 - %d)" , enkf_main_get_ensemble_size( enkf_main ) , PROMPT_LEN , &iens1 , &iens2);
|
||||
@ -623,7 +623,7 @@ 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 );
|
||||
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;
|
||||
@ -678,7 +678,7 @@ void enkf_tui_plot_ensemble(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);
|
||||
const enkf_fs_type * fs = enkf_main_get_fs( enkf_main );
|
||||
const time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
{
|
||||
const bool prediction_mode = false;
|
||||
const char * prompt = "What do you want to plot (KEY:INDEX)";
|
||||
@ -734,7 +734,7 @@ static void * enkf_tui_plot_ensemble_mt( void * void_arg ) {
|
||||
arg_pack_type * arg = arg_pack_safe_cast( void_arg );
|
||||
enkf_tui_plot_ensemble__(arg_pack_iget_ptr( arg , 0 ),
|
||||
arg_pack_iget_ptr( arg , 1 ),
|
||||
arg_pack_iget_ptr( arg , 2 ),
|
||||
arg_pack_iget_const_ptr( arg , 2 ),
|
||||
arg_pack_iget_ptr( arg , 3 ),
|
||||
arg_pack_iget_int( arg , 4 ),
|
||||
arg_pack_iget_int( arg , 5 ),
|
||||
@ -775,7 +775,7 @@ void enkf_tui_plot_all_summary__( enkf_main_type * enkf_main , int iens1 , int i
|
||||
|
||||
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_const_ptr( arg , key );
|
||||
arg_pack_append_ptr( arg , NULL );
|
||||
arg_pack_append_int( arg , step1 );
|
||||
arg_pack_append_int( arg , step2 );
|
||||
@ -836,7 +836,7 @@ void enkf_tui_plot_observation(void * arg) {
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
const char * prompt = "What do you want to plot (KEY:INDEX)";
|
||||
enkf_fs_type * fs = enkf_main_get_fs(enkf_main);
|
||||
const time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
const obs_vector_type * obs_vector;
|
||||
char * user_key;
|
||||
char * index_key;
|
||||
@ -955,7 +955,7 @@ void enkf_tui_plot_sensitivity(void * arg) {
|
||||
|
||||
|
||||
enkf_fs_type * fs = enkf_main_get_fs(enkf_main);
|
||||
const time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
const int last_report = time_map_get_last_step( time_map );
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
const enkf_config_node_type * config_node_x;
|
||||
@ -1118,7 +1118,7 @@ void enkf_tui_plot_RFT_time(void * arg) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
enkf_obs_type * enkf_obs = enkf_main_get_obs( enkf_main );
|
||||
const enkf_fs_type * fs = enkf_main_get_fs( enkf_main );
|
||||
const time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
time_map_type * time_map = enkf_fs_get_time_map( fs );
|
||||
{
|
||||
const char * state_kw;
|
||||
char * index_key = NULL;
|
||||
|
@ -220,7 +220,7 @@ void enkf_tui_plot_RFT_simIn(enkf_main_type * enkf_main, path_fmt_type * runpath
|
||||
bool plot_refcase = plot_config_get_plot_refcase( plot_config );
|
||||
ecl_config_type * ecl_config = enkf_main_get_ecl_config(enkf_main);
|
||||
ecl_refcase_list_type * refcase_list = ecl_config_get_refcase_list( ecl_config );
|
||||
ecl_sum_type * refcase = ecl_refcase_list_get_default( refcase_list );
|
||||
const ecl_sum_type * refcase = ecl_refcase_list_get_default( refcase_list );
|
||||
if (refcase) {
|
||||
|
||||
/*
|
||||
@ -523,7 +523,6 @@ void enkf_tui_plot_RFT__(enkf_main_type * enkf_main,
|
||||
char cens[5];
|
||||
sprintf(cens , "%03d" , iens);
|
||||
msg_update(msg , cens);
|
||||
bool has_node = true;
|
||||
node_id_type node_id = {.report_step = report_step ,
|
||||
.iens = iens ,
|
||||
.state = BOTH };
|
||||
|
@ -94,8 +94,8 @@ plot_type * enkf_tui_plot_alloc(const plot_config_type * plot_config , const cha
|
||||
plot_type * plot;
|
||||
|
||||
if (util_string_equal( plot_config_get_driver( plot_config ) , "PLPLOT")) {
|
||||
arg_pack_append_ptr( arg_pack , file );
|
||||
arg_pack_append_ptr( arg_pack , plot_config_get_image_type( plot_config ));
|
||||
arg_pack_append_const_ptr( arg_pack , file );
|
||||
arg_pack_append_const_ptr( arg_pack , plot_config_get_image_type( plot_config ));
|
||||
} else if (util_string_equal( plot_config_get_driver( plot_config ) , "TEXT")) {
|
||||
|
||||
char * plot_path, *basename;
|
||||
|
@ -112,7 +112,6 @@ static void enkf_tui_ranking_create_data__( void * arg , bool sort_increasing) {
|
||||
const char * prompt1 = "Data key to use for ranking";
|
||||
const char * prompt2 = "Report step of data [Blank: last step]";
|
||||
const char * ranking_name = "Name of new ranking";
|
||||
const char * store_prompt = "Name of file to store ranking [Blank - no store]";
|
||||
|
||||
state_enum state = FORECAST;
|
||||
char * user_key;
|
||||
|
@ -125,7 +125,6 @@ void enkf_tui_run_iterated_ES(void * enkf_main) {
|
||||
const ecl_config_type * ecl_config = enkf_main_get_ecl_config( enkf_main );
|
||||
const analysis_config_type * analysis_config = enkf_main_get_analysis_config( enkf_main );
|
||||
analysis_iter_config_type * iter_config = analysis_config_get_iter_config( analysis_config );
|
||||
analysis_module_type * module = analysis_config_get_active_module( analysis_config );
|
||||
int step1 = 0;
|
||||
int step2 ;
|
||||
int_vector_type * step_list = int_vector_alloc(0,0);
|
||||
@ -158,15 +157,15 @@ void enkf_tui_run_iterated_ES(void * enkf_main) {
|
||||
|
||||
enkf_main_run_exp(enkf_main , iactive , true , step1 , step1 , FORECAST);
|
||||
{
|
||||
char * target_fs_name = analysis_iter_config_iget_case( iter_config , iter );
|
||||
enkf_fs_type * target_fs = enkf_main_get_alt_fs(enkf_main , target_fs_name , false , true );
|
||||
const char * target_fs_name = analysis_iter_config_iget_case( iter_config , iter );
|
||||
enkf_fs_type * target_fs = enkf_main_get_alt_fs(enkf_main , target_fs_name , false , true );
|
||||
enkf_main_smoother_update(enkf_main , step_list , target_fs);
|
||||
|
||||
enkf_main_copy_ensemble( enkf_main ,
|
||||
enkf_main_get_current_fs( enkf_main ),
|
||||
0 , // Smoother update will write on step 0
|
||||
ANALYZED ,
|
||||
target_fs,
|
||||
target_fs_name ,
|
||||
step1 ,
|
||||
FORECAST ,
|
||||
iactive ,
|
||||
@ -175,7 +174,6 @@ void enkf_tui_run_iterated_ES(void * enkf_main) {
|
||||
|
||||
|
||||
enkf_main_set_fs(enkf_main , target_fs , enkf_fs_get_case_name( target_fs ));
|
||||
free( target_fs_name );
|
||||
}
|
||||
//iter = analysis_module_get_int(module, "ITER");
|
||||
iter++;
|
||||
@ -307,7 +305,7 @@ void enkf_tui_run_manual_load__( void * arg ) {
|
||||
arg_pack_append_int( arg_pack , step2 ); /* 4: Step2 For summary data it will load the whole goddamn thing anyway.*/
|
||||
arg_pack_append_bool( arg_pack , true ); /* 5: Interactive */
|
||||
arg_pack_append_owned_ptr( arg_pack , stringlist_alloc_new() , stringlist_free__); /* 6: List of interactive mode messages. */
|
||||
thread_pool_add_job( tp , enkf_state_internalize_results_mt , arg_pack);
|
||||
thread_pool_add_job( tp , enkf_state_load_from_forward_model_mt , arg_pack);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/string_util.h>
|
||||
#include <ert/util/menu.h>
|
||||
#include <ert/util/arg_pack.h>
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <ert/enkf/enkf_config_node.h>
|
||||
#include <ert/enkf/ensemble_config.h>
|
||||
|
||||
|
||||
void enkf_tui_util_scanf_report_steps(int , int , int * , int * );
|
||||
const enkf_config_node_type * enkf_tui_util_scanf_key(const ensemble_config_type * , int , ert_impl_type , enkf_var_type);
|
||||
state_enum enkf_tui_util_scanf_state(const char * , int , bool);
|
||||
|
@ -53,7 +53,8 @@ void enkf_tui_workflow_run( void * arg ) {
|
||||
char * workflow_name = util_alloc_stdin_line();
|
||||
if (workflow_name != NULL) {
|
||||
if (ert_workflow_list_has_workflow( workflow_list , workflow_name )) {
|
||||
if (!ert_workflow_list_run_workflow( workflow_list , workflow_name , enkf_main )) {
|
||||
bool runOK = ert_workflow_list_run_workflow( workflow_list , workflow_name , enkf_main);
|
||||
if (!runOK) {
|
||||
printf("Errors in workflow:%s \n", workflow_name );
|
||||
printf("-----------------------------------------------------------------\n");
|
||||
config_error_fprintf( ert_workflow_list_get_last_error( workflow_list ) , true , stdout);
|
||||
@ -68,10 +69,7 @@ void enkf_tui_workflow_run( void * arg ) {
|
||||
|
||||
|
||||
void enkf_tui_workflow_load( void * arg ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
|
||||
{
|
||||
|
||||
}
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,7 +51,7 @@ void enkf_tui_plot_JOB(void * self , const stringlist_type * args ) {
|
||||
for (i=0; i < stringlist_get_size( args ); i++) {
|
||||
const char * user_key = stringlist_iget( args , i );
|
||||
char * key_index;
|
||||
enkf_config_node_type * config_node = ensemble_config_user_get_node( ensemble_config , user_key , &key_index);
|
||||
const enkf_config_node_type * config_node = ensemble_config_user_get_node( ensemble_config , user_key , &key_index);
|
||||
if (config_node != NULL)
|
||||
enkf_tui_plot_ensemble__(enkf_main , config_node , user_key , key_index , step1 , step2 , false , 0 , enkf_main_get_ensemble_size( enkf_main ) , BOTH );
|
||||
|
||||
|
@ -110,13 +110,13 @@ static void init_debug( const char * argv0) {
|
||||
|
||||
|
||||
void parse_workflows(int argc , char ** argv , stringlist_type * workflows) {
|
||||
bool workflow_on = false;
|
||||
/* bool workflow_on = false; */
|
||||
for (int iarg = 2; iarg < argc; iarg++) {
|
||||
stringlist_append_copy( workflows , argv[iarg]);
|
||||
|
||||
/*if (strcmp( argv[iarg] , WORKFLOW_OPTION) == 0)
|
||||
workflow_on = true;
|
||||
else {
|
||||
else {
|
||||
if (workflow_on)
|
||||
stringlist_append_copy( workflows , argv[iarg]);
|
||||
else
|
||||
|
@ -23,7 +23,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* These keys are used as options in KEY:VALUE statements */
|
||||
/* These keys are used as options in KEY:VALUE statements */
|
||||
#define FORWARD_INIT_KEY "FORWARD_INIT"
|
||||
#define MIN_STD_KEY "MIN_STD"
|
||||
#define INIT_FILES_KEY "INIT_FILES"
|
||||
#define KEY_KEY "KEY"
|
||||
|
@ -42,7 +42,7 @@ extern "C" {
|
||||
|
||||
bool enkf_config_node_has_vector( const enkf_config_node_type * node , enkf_fs_type * fs , int iens , state_enum state);
|
||||
bool enkf_config_node_has_node( const enkf_config_node_type * node , enkf_fs_type * fs , node_id_type node_id);
|
||||
enkf_config_node_type * enkf_config_node_new_gen_data( const char * key );
|
||||
enkf_config_node_type * enkf_config_node_new_gen_data( const char * key, bool forward_init );
|
||||
bool enkf_config_node_vector_storage( const enkf_config_node_type * config_node);
|
||||
|
||||
void enkf_config_node_update_gen_data( enkf_config_node_type * config_node,
|
||||
@ -56,7 +56,7 @@ extern "C" {
|
||||
const char * min_std_file);
|
||||
|
||||
|
||||
enkf_config_node_type * enkf_config_node_new_surface( const char * key );
|
||||
enkf_config_node_type * enkf_config_node_new_surface( const char * key , bool forward_init);
|
||||
|
||||
|
||||
void enkf_config_node_update_surface( enkf_config_node_type * config_node ,
|
||||
@ -75,7 +75,8 @@ extern "C" {
|
||||
|
||||
|
||||
enkf_config_node_type * enkf_config_node_alloc(enkf_var_type ,
|
||||
ert_impl_type ,
|
||||
ert_impl_type ,
|
||||
bool ,
|
||||
const char * ,
|
||||
const char * ,
|
||||
const char * ,
|
||||
@ -114,8 +115,8 @@ extern "C" {
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
enkf_config_node_type * enkf_config_node_new_gen_kw( const char * key , const char * tag_fmt );
|
||||
enkf_config_node_type * enkf_config_node_new_field( const char * key , ecl_grid_type * ecl_grid, field_trans_table_type * trans_table);
|
||||
enkf_config_node_type * enkf_config_node_new_gen_kw( const char * key , const char * tag_fmt , bool forward_init);
|
||||
enkf_config_node_type * enkf_config_node_new_field( const char * key , ecl_grid_type * ecl_grid, field_trans_table_type * trans_table, bool forward_init);
|
||||
bool enkf_config_node_is_valid( const enkf_config_node_type * config_node );
|
||||
int enkf_config_node_get_data_size( const enkf_config_node_type * node , int report_step);
|
||||
char * enkf_config_node_alloc_infile(const enkf_config_node_type * , int );
|
||||
@ -138,13 +139,13 @@ extern "C" {
|
||||
const char * enkf_config_node_get_min_std_file( const enkf_config_node_type * config_node );
|
||||
const char * enkf_config_node_get_enkf_outfile( const enkf_config_node_type * conifg_node );
|
||||
const char * enkf_config_node_get_enkf_infile( const enkf_config_node_type * config_node );
|
||||
char * enkf_config_node_alloc_initfile( const enkf_config_node_type * node , int iens);
|
||||
char * enkf_config_node_alloc_initfile( const enkf_config_node_type * node , const char * path , int iens);
|
||||
|
||||
void enkf_config_node_set_internalize(enkf_config_node_type * node, int report_step);
|
||||
bool enkf_config_node_internalize(const enkf_config_node_type * node, int report_step);
|
||||
|
||||
void enkf_config_node_fprintf_config( const enkf_config_node_type * config_node , FILE * stream );
|
||||
const enkf_config_node_type * enkf_config_node_container_iget( const enkf_config_node_type * node , int index);
|
||||
enkf_config_node_type * enkf_config_node_container_iget( const enkf_config_node_type * node , int index);
|
||||
int enkf_config_node_container_size( const enkf_config_node_type * node );
|
||||
|
||||
enkf_config_node_type * enkf_config_node_new_container( const char * key );
|
||||
@ -157,6 +158,10 @@ extern "C" {
|
||||
void enkf_node_free(enkf_node_type *enkf_node);
|
||||
const enkf_node_type * enkf_config_node_get_min_std( const enkf_config_node_type * config_node );
|
||||
|
||||
bool enkf_config_node_use_forward_init(const enkf_config_node_type * config_node);
|
||||
void enkf_config_node_set_forward_init(enkf_config_node_type * config_node, bool forward_init);
|
||||
|
||||
|
||||
UTIL_SAFE_CAST_HEADER(enkf_config_node);
|
||||
VOID_FREE_HEADER(enkf_config_node);
|
||||
#ifdef __cplusplus
|
||||
|
@ -118,11 +118,11 @@ void * prefix ## _alloc__(const void *void_config) {
|
||||
#define VOID_READ_FROM_BUFFER_HEADER(prefix) void prefix ## _read_from_buffer__(void * , buffer_type * , int, state_enum);
|
||||
|
||||
#define VOID_FLOAD(prefix) \
|
||||
void prefix ## _fload__(void * void_arg , const char * filename) { \
|
||||
bool prefix ## _fload__(void * void_arg , const char * filename) { \
|
||||
prefix ## _type * arg = prefix ## _safe_cast( void_arg ); \
|
||||
prefix ## _fload(arg , filename); \
|
||||
return prefix ## _fload(arg , filename); \
|
||||
}
|
||||
#define VOID_FLOAD_HEADER(prefix) void prefix ## _fload__(void * , const char * );
|
||||
#define VOID_FLOAD_HEADER(prefix) bool prefix ## _fload__(void * , const char * );
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
|
@ -220,7 +220,7 @@ extern "C" {
|
||||
void enkf_main_fprintf_config( const enkf_main_type * enkf_main );
|
||||
int_vector_type * enkf_main_update_alloc_step_list( const enkf_main_type * enkf_main , int load_start , int step2 , int stride);
|
||||
|
||||
const qc_module_type * enkf_main_get_qc_module( const enkf_main_type * enkf_main );
|
||||
qc_module_type * enkf_main_get_qc_module( const enkf_main_type * enkf_main );
|
||||
bool enkf_main_has_QC_workflow( const enkf_main_type * enkf_main );
|
||||
|
||||
void enkf_main_get_PC( const enkf_main_type * enkf_main ,
|
||||
@ -244,6 +244,7 @@ extern "C" {
|
||||
enkf_main_type * enkf_main_alloc_empty( );
|
||||
|
||||
rng_config_type * enkf_main_get_rng_config( const enkf_main_type * enkf_main );
|
||||
void enkf_main_rng_init( enkf_main_type * enkf_main);
|
||||
|
||||
UTIL_SAFE_CAST_HEADER(enkf_main);
|
||||
|
||||
|
@ -59,7 +59,7 @@ extern "C" {
|
||||
const char * , /* Filename - can be NULL. */
|
||||
fortio_type *); /* fortio inistance for writing elements in restart files. */
|
||||
|
||||
typedef void (fload_ftype) ( void * , const char *);
|
||||
typedef bool (fload_ftype) ( void * , const char *);
|
||||
typedef void (read_from_buffer_ftype) ( void * , buffer_type * , int, state_enum );
|
||||
typedef bool (write_to_buffer_ftype) (const void * , buffer_type * , int, state_enum );
|
||||
typedef bool (has_data_ftype) (const void * , int , state_enum);
|
||||
@ -118,6 +118,7 @@ extern "C" {
|
||||
void enkf_node_free(enkf_node_type *enkf_node);
|
||||
*/
|
||||
|
||||
bool enkf_node_forward_init(enkf_node_type * enkf_node , const char * run_path , int iens);
|
||||
bool enkf_node_has_data( enkf_node_type * enkf_node , enkf_fs_type * fs , node_id_type node_id);
|
||||
void enkf_node_free_data(enkf_node_type * );
|
||||
void enkf_node_free__(void *);
|
||||
@ -126,6 +127,7 @@ extern "C" {
|
||||
void * enkf_node_value_ptr(const enkf_node_type * );
|
||||
ert_impl_type enkf_node_get_impl_type(const enkf_node_type * );
|
||||
enkf_var_type enkf_node_get_var_type(const enkf_node_type * );
|
||||
bool enkf_node_use_forward_init( const enkf_node_type * enkf_node );
|
||||
void enkf_node_clear_serial_state(enkf_node_type * );
|
||||
void enkf_node_serialize(enkf_node_type * enkf_node , enkf_fs_type * fs , node_id_type node_id , const active_list_type * active_list , matrix_type * A , int row_offset , int column);
|
||||
void enkf_node_deserialize(enkf_node_type *enkf_node , enkf_fs_type * fs , node_id_type node_id , const active_list_type * active_list , const matrix_type * A , int row_offset , int column);
|
||||
@ -156,7 +158,7 @@ extern "C" {
|
||||
enkf_node_type ** enkf_node_load_alloc_ensemble( const enkf_config_node_type * config_node , enkf_fs_type * fs ,
|
||||
int report_step , int iens1 , int iens2 , state_enum state);
|
||||
enkf_node_type * enkf_node_load_alloc( const enkf_config_node_type * config_node , enkf_fs_type * fs , node_id_type node_id);
|
||||
void enkf_node_fload( enkf_node_type * enkf_node , const char * filename );
|
||||
bool enkf_node_fload( enkf_node_type * enkf_node , const char * filename );
|
||||
void enkf_node_load(enkf_node_type * enkf_node , enkf_fs_type * fs , node_id_type node_id );
|
||||
bool enkf_node_store(enkf_node_type * enkf_node , enkf_fs_type * fs , bool force_vectors , node_id_type node_id);
|
||||
bool enkf_node_store_vector(enkf_node_type *enkf_node , enkf_fs_type * fs , int iens , state_enum state);
|
||||
|
@ -66,7 +66,7 @@ typedef struct enkf_state_struct enkf_state_type;
|
||||
time_t enkf_state_get_submit_time( const enkf_state_type * enkf_state );
|
||||
bool enkf_state_resubmit_simulation( enkf_state_type * enkf_state , enkf_fs_type * fs , bool resample);
|
||||
bool enkf_state_kill_simulation( const enkf_state_type * enkf_state );
|
||||
void * enkf_state_internalize_results_mt( void * arg );
|
||||
void * enkf_state_load_from_forward_model_mt( void * arg );
|
||||
void enkf_state_initialize(enkf_state_type * enkf_state , enkf_fs_type * fs, const stringlist_type * param_list , bool force_init);
|
||||
void enkf_state_fread(enkf_state_type * , enkf_fs_type * fs , int , int , state_enum );
|
||||
bool enkf_state_get_analyzed(const enkf_state_type * );
|
||||
@ -79,13 +79,24 @@ typedef struct enkf_state_struct enkf_state_type;
|
||||
void enkf_state_load_ecl_summary(enkf_state_type * , bool , int );
|
||||
void * enkf_state_run_eclipse__(void * );
|
||||
void * enkf_state_start_forward_model__(void * );
|
||||
|
||||
void enkf_state_load_from_forward_model(enkf_state_type * enkf_state ,
|
||||
enkf_fs_type * fs ,
|
||||
bool * loadOK ,
|
||||
bool interactive ,
|
||||
stringlist_type * msg_list);
|
||||
|
||||
void enkf_state_forward_init(enkf_state_type * enkf_state ,
|
||||
enkf_fs_type * fs ,
|
||||
bool * loadOK );
|
||||
|
||||
enkf_state_type * enkf_state_alloc(int ,
|
||||
rng_type * main_rng ,
|
||||
enkf_fs_type * fs,
|
||||
const char * casename ,
|
||||
bool pre_clear_runpath,
|
||||
keep_runpath_type ,
|
||||
const model_config_type * ,
|
||||
model_config_type * ,
|
||||
ensemble_config_type * ,
|
||||
const site_config_type * ,
|
||||
const ecl_config_type * ,
|
||||
@ -112,6 +123,7 @@ typedef struct enkf_state_struct enkf_state_type;
|
||||
const char * enkf_state_get_eclbase( const enkf_state_type * enkf_state );
|
||||
void enkf_state_printf_subst_list(enkf_state_type * enkf_state , int step1 , int step2);
|
||||
|
||||
rng_type * enkf_state_get_rng( const enkf_state_type * enkf_state );
|
||||
unsigned int enkf_state_get_random( enkf_state_type * enkf_state );
|
||||
|
||||
/*****************************************************************/
|
||||
|
@ -42,11 +42,11 @@ typedef struct ensemble_config_struct ensemble_config_type;
|
||||
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 , 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_surface( ensemble_config_type * ensemble_config , const char * key , bool forward_init);
|
||||
enkf_config_node_type * ensemble_config_add_gen_data( ensemble_config_type * config , const char * key , bool forward_init);
|
||||
enkf_config_node_type * ensemble_config_add_summary(ensemble_config_type * ensemble_config , const char * key, load_fail_type load_fail);
|
||||
enkf_config_node_type * ensemble_config_add_gen_kw( ensemble_config_type * config , const char * key );
|
||||
enkf_config_node_type * ensemble_config_add_field( ensemble_config_type * config , const char * key , ecl_grid_type * ecl_grid );
|
||||
enkf_config_node_type * ensemble_config_add_gen_kw( ensemble_config_type * config , const char * key , bool forward_init);
|
||||
enkf_config_node_type * ensemble_config_add_field( ensemble_config_type * config , const char * key , ecl_grid_type * ecl_grid , bool forward_init);
|
||||
int ensemble_config_get_observations( const ensemble_config_type * config , enkf_obs_type * enkf_obs , const char * user_key , int obs_count ,
|
||||
time_t * obs_time , double * y , double * std);
|
||||
void ensemble_config_ensure_static_key(ensemble_config_type * ensemble_config , const char * kw );
|
||||
@ -58,13 +58,7 @@ typedef struct ensemble_config_struct ensemble_config_type;
|
||||
void ensemble_config_init(ensemble_config_type * ensemble_config , const config_type * config , ecl_grid_type * grid , const ecl_sum_type * refcase);
|
||||
void ensemble_config_free(ensemble_config_type * );
|
||||
bool ensemble_config_has_key(const ensemble_config_type * , const char * );
|
||||
enkf_config_node_type * ensemble_config_add_node(ensemble_config_type * ,
|
||||
const char * ,
|
||||
enkf_var_type ,
|
||||
ert_impl_type ,
|
||||
const char * ,
|
||||
const char * ,
|
||||
void * );
|
||||
bool ensemble_config_have_forward_init( const ensemble_config_type * ensemble_config );
|
||||
|
||||
void ensemble_config_init_internalization( ensemble_config_type * );
|
||||
void ensemble_config_del_node(ensemble_config_type * , const char * );
|
||||
@ -81,6 +75,11 @@ typedef struct ensemble_config_struct ensemble_config_type;
|
||||
ensemble_config_type * ensemble_config_alloc_empty( );
|
||||
void ensemble_config_fprintf_config( ensemble_config_type * ensemble_config , FILE * stream );
|
||||
|
||||
enkf_config_node_type * ensemble_config_add_STATIC_node(ensemble_config_type * ,
|
||||
const char * );
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -45,7 +45,7 @@ extern "C" {
|
||||
void ert_workflow_list_add_config_items( config_type * config );
|
||||
void ert_workflow_list_init( ert_workflow_list_type * workflow_list , config_type * config , log_type * logh);
|
||||
bool ert_workflow_list_run_workflow(ert_workflow_list_type * workflow_list , const char * workflow_name , void * self);
|
||||
bool ert_workflow_list_run_workflow__(ert_workflow_list_type * workflow_list , workflow_type * workflow, bool verbose , void * self );
|
||||
bool ert_workflow_list_run_workflow__(ert_workflow_list_type * workflow_list , workflow_type * workflow, bool verbose , void * self);
|
||||
bool ert_workflow_list_has_workflow(ert_workflow_list_type * workflow_list , const char * workflow_name );
|
||||
stringlist_type * ert_workflow_list_alloc_namelist( ert_workflow_list_type * workflow_list );
|
||||
const config_error_type * ert_workflow_list_get_last_error( const ert_workflow_list_type * workflow_list);
|
||||
|
@ -53,7 +53,7 @@ extern "C" {
|
||||
field_type * field_alloc_shared(const field_config_type * , void * , int );
|
||||
void field_free(field_type *);
|
||||
void field_get_dims(const field_type *, int *, int *, int *);
|
||||
void field_fload_auto(field_type * , const char * );
|
||||
bool field_fload_auto(field_type * , const char * );
|
||||
void field_export3D(const field_type * , void *, bool , ecl_type_enum , void *);
|
||||
void field_export(const field_type * , const char * , fortio_type * , field_file_format_type , bool);
|
||||
field_type * field_copyc(const field_type *);
|
||||
@ -69,7 +69,7 @@ extern "C" {
|
||||
void field_iadd(field_type * , const field_type *);
|
||||
void field_imul_add(field_type * , double , const field_type *);
|
||||
ecl_kw_type * field_alloc_ecl_kw_wrapper(const field_type * );
|
||||
void field_update_sum(field_type * sum , const field_type * field , double lower_limit , double upper_limit);
|
||||
void field_update_sum(field_type * sum , field_type * field , double lower_limit , double upper_limit);
|
||||
void field_upgrade_103(const char * filename);
|
||||
|
||||
UTIL_IS_INSTANCE_HEADER(field);
|
||||
|
@ -30,7 +30,7 @@ typedef struct field_config_struct field_config_type;
|
||||
typedef struct field_struct field_type;
|
||||
|
||||
field_type * field_alloc(const field_config_type * );
|
||||
void field_fload(field_type * , const char * );
|
||||
bool field_fload(field_type * , const char * );
|
||||
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ typedef struct gen_data_config_struct gen_data_config_type;
|
||||
typedef struct gen_data_struct gen_data_type;
|
||||
|
||||
gen_data_type * gen_data_alloc(const gen_data_config_type * );
|
||||
void gen_data_fload(gen_data_type * , const char * );
|
||||
bool gen_data_fload(gen_data_type * , const char * );
|
||||
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ typedef struct gen_kw_config_struct gen_kw_config_type;
|
||||
typedef struct gen_kw_struct gen_kw_type;
|
||||
|
||||
gen_kw_type * gen_kw_alloc(const gen_kw_config_type * );
|
||||
void gen_kw_fload(gen_kw_type * , const char *);
|
||||
bool gen_kw_fload(gen_kw_type * , const char *);
|
||||
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
typedef struct gen_obs_struct gen_obs_type;
|
||||
|
||||
gen_obs_type * gen_obs_alloc( const gen_data_config_type * config , const char * obs_key , const char * , double , double , const char * , const char * , const char * );
|
||||
gen_obs_type * gen_obs_alloc(gen_data_config_type * config , const char * obs_key , const char * , double , double , const char * , const char * , const char * );
|
||||
void gen_obs_user_get_with_data_index(const gen_obs_type * gen_obs , const char * index_key , double * value , double * std , bool * valid);
|
||||
|
||||
VOID_CHI2_HEADER(gen_obs);
|
||||
|
@ -36,7 +36,7 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
|
||||
void misfit_ensemble_fread( misfit_ensemble_type * misfit_ensemble , FILE * stream );
|
||||
void misfit_ensemble_clear( misfit_ensemble_type * table);
|
||||
misfit_ensemble_type * misfit_ensemble_alloc( );
|
||||
void misfit_ensemble_free( misfit_ensemble_type * table );
|
||||
|
@ -29,6 +29,7 @@ extern "C" {
|
||||
typedef struct misfit_ts_struct misfit_ts_type;
|
||||
|
||||
|
||||
void misfit_ts_fwrite( const misfit_ts_type * misfit_ts , FILE * stream );
|
||||
double misfit_ts_eval( const misfit_ts_type * ts , int step1 , int step2 );
|
||||
misfit_ts_type * misfit_ts_alloc(int history_length);
|
||||
misfit_ts_type * misfit_ts_fread_alloc( FILE * stream );
|
||||
|
@ -73,7 +73,7 @@ extern "C" {
|
||||
obs_vector_type * obs_vector_alloc_from_GENERAL_OBSERVATION(const conf_instance_type * , const history_type * , const ensemble_config_type * , const time_t_vector_type * obs_time);
|
||||
void obs_vector_load_from_SUMMARY_OBSERVATION(obs_vector_type * obs_vector , const conf_instance_type * , const history_type * , ensemble_config_type * );
|
||||
bool obs_vector_load_from_HISTORY_OBSERVATION(obs_vector_type * obs_vector , const conf_instance_type * , const history_type * , ensemble_config_type * , double std_cutoff );
|
||||
obs_vector_type * obs_vector_alloc_from_BLOCK_OBSERVATION(const conf_instance_type * , const ecl_grid_type * grid , const ecl_sum_type * refcase , const history_type * , const ensemble_config_type * , const time_t_vector_type * obs_time);
|
||||
obs_vector_type * obs_vector_alloc_from_BLOCK_OBSERVATION(const conf_instance_type * , const ecl_grid_type * grid , const ecl_sum_type * refcase , const history_type * , ensemble_config_type * , const time_t_vector_type * obs_time);
|
||||
void obs_vector_set_config_node(obs_vector_type * , const enkf_config_node_type * );
|
||||
obs_vector_type * obs_vector_alloc(obs_impl_type obs_type , const char * obs_key , enkf_config_node_type * config_node , const time_t_vector_type * obs_time , int num_reports);
|
||||
|
||||
|
@ -32,7 +32,7 @@ extern "C" {
|
||||
bool qc_module_has_workflow( const qc_module_type * qc_module );
|
||||
qc_module_type * qc_module_alloc(ert_workflow_list_type * workflow_list , const char * qc_path);
|
||||
void qc_module_free();
|
||||
bool qc_module_run_workflow( qc_module_type * qc_module , void * self);
|
||||
bool qc_module_run_workflow( const qc_module_type * qc_module , void * self);
|
||||
runpath_list_type * qc_module_get_runpath_list( qc_module_type * qc_module );
|
||||
void qc_module_set_path( qc_module_type * qc_module , const char * qc_path);
|
||||
const char * qc_module_get_path( const qc_module_type * qc_module );
|
||||
|
@ -48,6 +48,7 @@ extern "C" {
|
||||
VOID_IADDSQR_HEADER(surface);
|
||||
VOID_ISQRT_HEADER(surface);
|
||||
VOID_INITIALIZE_HEADER(surface);
|
||||
VOID_FLOAD_HEADER(surface);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
6
ThirdParty/Ert/devel/libenkf/src/block_obs.c
vendored
6
ThirdParty/Ert/devel/libenkf/src/block_obs.c
vendored
@ -83,9 +83,10 @@ UTIL_IS_INSTANCE_FUNCTION(block_obs , BLOCK_OBS_TYPE_ID);
|
||||
|
||||
|
||||
|
||||
static point_obs_type * point_obs_alloc( block_obs_source_type source_type , int i , int j , int k , int active_index , char * sum_key , double value , double std) {
|
||||
static point_obs_type * point_obs_alloc( block_obs_source_type source_type , int i , int j , int k , int active_index , const char * sum_key , double value , double std) {
|
||||
point_obs_type * point_obs = util_malloc( sizeof * point_obs );
|
||||
UTIL_TYPE_ID_INIT( point_obs , POINT_OBS_TYPE_ID );
|
||||
|
||||
point_obs->source_type = source_type;
|
||||
point_obs->i = i;
|
||||
point_obs->j = j;
|
||||
@ -169,7 +170,6 @@ block_obs_type * block_obs_alloc(const char * obs_key,
|
||||
|
||||
{
|
||||
block_obs_type * block_obs = util_malloc(sizeof * block_obs);
|
||||
char * sum_kw = NULL;
|
||||
|
||||
UTIL_TYPE_ID_INIT( block_obs , BLOCK_OBS_TYPE_ID );
|
||||
block_obs->obs_key = util_alloc_string_copy(obs_key);
|
||||
@ -183,7 +183,7 @@ block_obs_type * block_obs_alloc(const char * obs_key,
|
||||
{
|
||||
for (int l=0; l < size; l++) {
|
||||
int active_index = ecl_grid_get_active_index3( block_obs->grid , i[l],j[l],k[l]);
|
||||
char * sum_key = NULL;
|
||||
const char * sum_key = NULL;
|
||||
if (source_type == SOURCE_SUMMARY)
|
||||
sum_key = stringlist_iget( summary_keys , l );
|
||||
|
||||
|
6
ThirdParty/Ert/devel/libenkf/src/container.c
vendored
6
ThirdParty/Ert/devel/libenkf/src/container.c
vendored
@ -25,15 +25,15 @@
|
||||
#include <ert/enkf/enkf_types.h>
|
||||
#include <ert/enkf/enkf_node.h>
|
||||
|
||||
typedef struct container_struct {
|
||||
struct container_struct {
|
||||
int __type_id;
|
||||
container_config_type * config;
|
||||
const container_config_type * config;
|
||||
vector_type * nodes;
|
||||
};
|
||||
|
||||
|
||||
|
||||
container_type * container_alloc( container_config_type * config ) {
|
||||
container_type * container_alloc( const container_config_type * config ) {
|
||||
container_type * container = util_malloc( sizeof * container );
|
||||
UTIL_TYPE_ID_INIT( container , CONTAINER );
|
||||
container->config = config;
|
||||
|
@ -67,7 +67,7 @@ void data_ranking_free( data_ranking_type * ranking ) {
|
||||
|
||||
static void data_ranking_init(data_ranking_type * ranking ,
|
||||
enkf_fs_type * fs ,
|
||||
enkf_config_node_type * config_node,
|
||||
const enkf_config_node_type * config_node,
|
||||
const char * key_index ,
|
||||
int step ,
|
||||
state_enum state ) {
|
||||
|
@ -455,7 +455,7 @@ void ecl_config_init( ecl_config_type * ecl_config , const config_type * config
|
||||
|
||||
/* Deprecated */
|
||||
if (config_item_set( config , PLOT_REFCASE_LIST_KEY)) {
|
||||
char * case_list_file = config_get_value( config , PLOT_REFCASE_LIST_KEY);
|
||||
const char * case_list_file = config_get_value( config , PLOT_REFCASE_LIST_KEY);
|
||||
FILE * stream = util_fopen(case_list_file , "r");
|
||||
bool at_eof;
|
||||
do {
|
||||
|
@ -119,7 +119,6 @@ static sum_pair_type * sum_pair_alloc( const char * case_name , bool strict_load
|
||||
|
||||
static UTIL_SAFE_CAST_FUNCTION( sum_pair , SUM_PAIR_TYPE_ID );
|
||||
static UTIL_SAFE_CAST_FUNCTION_CONST( sum_pair , SUM_PAIR_TYPE_ID );
|
||||
static UTIL_IS_INSTANCE_FUNCTION( sum_pair , SUM_PAIR_TYPE_ID);
|
||||
|
||||
const ecl_sum_type * sum_pair_get_ecl_sum( sum_pair_type * sum_pair ) {
|
||||
if (sum_pair->ecl_sum == NULL)
|
||||
|
@ -52,6 +52,7 @@ struct enkf_config_node_struct {
|
||||
ert_impl_type impl_type;
|
||||
enkf_var_type var_type;
|
||||
bool vector_storage;
|
||||
bool forward_init; /* Should the (parameter) node be initialized by loading results from the Forward model? */
|
||||
|
||||
bool_vector_type * internalize; /* Should this node be internalized - observe that question of what to internalize is MOSTLY handled at a higher level - without consulting this variable. Can be NULL. */
|
||||
stringlist_type * obs_keys; /* Keys of observations which observe this node. */
|
||||
@ -104,9 +105,12 @@ bool enkf_config_node_has_vector( const enkf_config_node_type * node , enkf_fs_t
|
||||
|
||||
static enkf_config_node_type * enkf_config_node_alloc__( enkf_var_type var_type,
|
||||
ert_impl_type impl_type,
|
||||
const char * key) {
|
||||
const char * key,
|
||||
bool forward_init) {
|
||||
|
||||
enkf_config_node_type * node = util_malloc( sizeof *node );
|
||||
UTIL_TYPE_ID_INIT( node , ENKF_CONFIG_NODE_TYPE_ID );
|
||||
node->forward_init = forward_init;
|
||||
node->var_type = var_type;
|
||||
node->impl_type = impl_type;
|
||||
node->key = util_alloc_string_copy( key );
|
||||
@ -257,14 +261,15 @@ static void enkf_config_node_update( enkf_config_node_type * config_node ,
|
||||
|
||||
|
||||
enkf_config_node_type * enkf_config_node_alloc(enkf_var_type var_type,
|
||||
ert_impl_type impl_type,
|
||||
ert_impl_type impl_type,
|
||||
bool forward_init ,
|
||||
const char * key ,
|
||||
const char * init_file_fmt ,
|
||||
const char * enkf_outfile_fmt ,
|
||||
const char * enkf_infile_fmt ,
|
||||
void * data) {
|
||||
|
||||
enkf_config_node_type * node = enkf_config_node_alloc__( var_type , impl_type , key );
|
||||
enkf_config_node_type * node = enkf_config_node_alloc__( var_type , impl_type , key , forward_init);
|
||||
enkf_config_node_update( node , init_file_fmt, enkf_outfile_fmt , enkf_infile_fmt , NULL );
|
||||
node->data = data;
|
||||
return node;
|
||||
@ -291,15 +296,15 @@ void enkf_config_node_update_gen_kw( enkf_config_node_type * config_node ,
|
||||
This will create a new gen_kw_config instance which is NOT yet
|
||||
valid.
|
||||
*/
|
||||
enkf_config_node_type * enkf_config_node_new_gen_kw( const char * key , const char * tag_fmt ) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( PARAMETER , GEN_KW , key );
|
||||
enkf_config_node_type * enkf_config_node_new_gen_kw( const char * key , const char * tag_fmt , bool forward_init) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( PARAMETER , GEN_KW , key , forward_init);
|
||||
config_node->data = gen_kw_config_alloc_empty( key , tag_fmt );
|
||||
return config_node;
|
||||
}
|
||||
|
||||
|
||||
enkf_config_node_type * enkf_config_node_new_surface( const char * key ) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( PARAMETER , SURFACE , key );
|
||||
enkf_config_node_type * enkf_config_node_new_surface( const char * key , bool forward_init) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( PARAMETER , SURFACE , key , forward_init);
|
||||
config_node->data = surface_config_alloc_empty( );
|
||||
return config_node;
|
||||
}
|
||||
@ -318,7 +323,7 @@ void enkf_config_node_update_surface( enkf_config_node_type * config_node , cons
|
||||
/*****************************************************************/
|
||||
|
||||
enkf_config_node_type * enkf_config_node_alloc_summary( const char * key , load_fail_type load_fail) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( DYNAMIC_RESULT , SUMMARY , key );
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( DYNAMIC_RESULT , SUMMARY , key , false);
|
||||
config_node->data = summary_config_alloc( key , config_node->vector_storage , load_fail );
|
||||
return config_node;
|
||||
}
|
||||
@ -326,8 +331,8 @@ enkf_config_node_type * enkf_config_node_alloc_summary( const char * key , load_
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
enkf_config_node_type * enkf_config_node_new_gen_data( const char * key ) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( INVALID , GEN_DATA , key );
|
||||
enkf_config_node_type * enkf_config_node_new_gen_data( const char * key , bool forward_init) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( INVALID , GEN_DATA , key , forward_init);
|
||||
config_node->data = gen_data_config_alloc_empty( key );
|
||||
return config_node;
|
||||
}
|
||||
@ -335,7 +340,7 @@ enkf_config_node_type * enkf_config_node_new_gen_data( const char * key ) {
|
||||
/*****************************************************************/
|
||||
|
||||
enkf_config_node_type * enkf_config_node_new_container( const char * key ) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( INVALID , CONTAINER , key );
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( INVALID , CONTAINER , key , false);
|
||||
config_node->data = container_config_alloc( key );
|
||||
return config_node;
|
||||
}
|
||||
@ -356,8 +361,8 @@ const char * enkf_config_node_iget_container_key( const enkf_config_node_type *
|
||||
This will create a new gen_kw_config instance which is NOT yet
|
||||
valid. Mainly support code for the GUI.
|
||||
*/
|
||||
enkf_config_node_type * enkf_config_node_new_field( const char * key , ecl_grid_type * ecl_grid, field_trans_table_type * trans_table) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( INVALID , FIELD , key );
|
||||
enkf_config_node_type * enkf_config_node_new_field( const char * key , ecl_grid_type * ecl_grid, field_trans_table_type * trans_table, bool forward_init) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_alloc__( INVALID , FIELD , key , forward_init);
|
||||
config_node->data = field_config_alloc_empty( key , ecl_grid , trans_table );
|
||||
return config_node;
|
||||
}
|
||||
@ -505,8 +510,8 @@ void enkf_config_node_update_gen_data( enkf_config_node_type * config_node,
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
const enkf_config_node_type * enkf_config_node_container_iget( const enkf_config_node_type * node , int index) {
|
||||
return vector_iget_const( node->container_nodes , index );
|
||||
enkf_config_node_type * enkf_config_node_container_iget( const enkf_config_node_type * node , int index) {
|
||||
return vector_iget( node->container_nodes , index );
|
||||
}
|
||||
|
||||
int enkf_config_node_container_size( const enkf_config_node_type * node ) {
|
||||
@ -579,17 +584,13 @@ void enkf_config_node_set_min_std( enkf_config_node_type * config_node , enkf_no
|
||||
config_node->min_std = min_std;
|
||||
}
|
||||
|
||||
/*
|
||||
(defun insert-curly ()
|
||||
(interactive)
|
||||
(insert "{}"))
|
||||
*/
|
||||
|
||||
void enkf_config_node_set_internalize(enkf_config_node_type * node, int report_step) {
|
||||
ert_impl_type impl_type = enkf_config_node_get_impl_type( node );
|
||||
if (impl_type == CONTAINER) {
|
||||
int inode;
|
||||
int container_size = enkf_config_node_container_size( node );
|
||||
for (inode == 0; inode < container_size; inode++) {
|
||||
for (inode = 0; inode < container_size; inode++) {
|
||||
enkf_config_node_type * child_node = enkf_config_node_container_iget( node , inode );
|
||||
enkf_config_node_set_internalize( child_node , report_step );
|
||||
}
|
||||
@ -637,11 +638,24 @@ char * enkf_config_node_alloc_outfile(const enkf_config_node_type * node , int r
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char * enkf_config_node_alloc_initfile( const enkf_config_node_type * node , int iens) {
|
||||
/*
|
||||
The path argument is used when the function is during forward_model
|
||||
based initialisation.
|
||||
*/
|
||||
|
||||
char * enkf_config_node_alloc_initfile( const enkf_config_node_type * node , const char * path , int iens) {
|
||||
if (node->init_file_fmt == NULL)
|
||||
return NULL;
|
||||
else
|
||||
return path_fmt_alloc_file( node->init_file_fmt , false , iens );
|
||||
else {
|
||||
char * file = path_fmt_alloc_file( node->init_file_fmt , false , iens );
|
||||
if (util_is_abs_path( file ))
|
||||
return file;
|
||||
else {
|
||||
char * full_path = util_alloc_filename( path , file , NULL );
|
||||
free( file );
|
||||
return full_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -664,6 +678,11 @@ bool enkf_config_node_include_type(const enkf_config_node_type * config_node , i
|
||||
}
|
||||
|
||||
|
||||
bool enkf_config_node_use_forward_init(const enkf_config_node_type * config_node) {
|
||||
return config_node->forward_init;
|
||||
}
|
||||
|
||||
|
||||
ert_impl_type enkf_config_node_get_impl_type(const enkf_config_node_type *config_node) {
|
||||
return config_node->impl_type;
|
||||
}
|
||||
|
2
ThirdParty/Ert/devel/libenkf/src/enkf_fs.c
vendored
2
ThirdParty/Ert/devel/libenkf/src/enkf_fs.c
vendored
@ -258,7 +258,7 @@ static enkf_fs_type * enkf_fs_alloc_empty( const char * mount_point , bool read_
|
||||
|
||||
util_path_split( fs->mount_point , &path_len , &path_tmp);
|
||||
fs->case_name = util_alloc_string_copy( path_tmp[path_len - 1]);
|
||||
fs->root_path = util_alloc_joined_string( path_tmp , path_len , UTIL_PATH_SEP_STRING);
|
||||
fs->root_path = util_alloc_joined_string( (const char **) path_tmp , path_len , UTIL_PATH_SEP_STRING);
|
||||
|
||||
util_free_stringlist( path_tmp , path_len );
|
||||
}
|
||||
|
119
ThirdParty/Ert/devel/libenkf/src/enkf_main.c
vendored
119
ThirdParty/Ert/devel/libenkf/src/enkf_main.c
vendored
@ -46,6 +46,7 @@
|
||||
#include <ert/util/set.h>
|
||||
#include <ert/util/log.h>
|
||||
#include <ert/util/node_ctype.h>
|
||||
#include <ert/util/string_util.h>
|
||||
|
||||
#include <ert/config/config.h>
|
||||
|
||||
@ -311,7 +312,7 @@ bool enkf_main_has_QC_workflow( const enkf_main_type * enkf_main ) {
|
||||
return qc_module_has_workflow( enkf_main->qc_module );
|
||||
}
|
||||
|
||||
const qc_module_type * enkf_main_get_qc_module( const enkf_main_type * enkf_main ) {
|
||||
qc_module_type * enkf_main_get_qc_module( const enkf_main_type * enkf_main ) {
|
||||
return enkf_main->qc_module;
|
||||
}
|
||||
|
||||
@ -509,64 +510,6 @@ void enkf_main_load_ensemble(enkf_main_type * enkf_main , int mask , int report_
|
||||
|
||||
|
||||
|
||||
static void enkf_main_fwrite_sub_ensemble(enkf_main_type * enkf_main , int mask , int report_step , state_enum state, int iens1 , int iens2) {
|
||||
int iens;
|
||||
for (iens = iens1; iens < iens2; iens++)
|
||||
enkf_state_fwrite(enkf_main->ensemble[iens] , enkf_main_get_fs( enkf_main ), mask , report_step , state);
|
||||
}
|
||||
|
||||
|
||||
static void * enkf_main_fwrite_sub_ensemble__(void *__arg) {
|
||||
arg_pack_type * arg_pack = arg_pack_safe_cast(__arg);
|
||||
enkf_main_type * enkf_main = arg_pack_iget_ptr(arg_pack , 0);
|
||||
int mask = arg_pack_iget_int(arg_pack , 1);
|
||||
int report_step = arg_pack_iget_int(arg_pack , 2);
|
||||
state_enum state = arg_pack_iget_int(arg_pack , 3);
|
||||
int iens1 = arg_pack_iget_int(arg_pack , 4);
|
||||
int iens2 = arg_pack_iget_int(arg_pack , 5);
|
||||
|
||||
enkf_main_fwrite_sub_ensemble(enkf_main , mask , report_step , state , iens1 , iens2);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*void enkf_main_fwrite_ensemble(enkf_main_type * enkf_main , int mask , int report_step , state_enum state) {
|
||||
const int cpu_threads = 4;
|
||||
int sub_ens_size = enkf_main_get_ensemble_size(enkf_main) / cpu_threads;
|
||||
int icpu;
|
||||
thread_pool_type * tp = thread_pool_alloc( cpu_threads , true );
|
||||
arg_pack_type ** arg_pack_list = util_malloc( cpu_threads * sizeof * arg_pack_list , __func__);
|
||||
|
||||
for (icpu = 0; icpu < cpu_threads; icpu++) {
|
||||
arg_pack_type * arg = arg_pack_alloc();
|
||||
arg_pack_append_ptr(arg , enkf_main);
|
||||
arg_pack_append_int(arg , mask);
|
||||
arg_pack_append_int(arg , report_step);
|
||||
arg_pack_append_int(arg , state);
|
||||
|
||||
{
|
||||
int iens1 = icpu * sub_ens_size;
|
||||
int iens2 = iens1 + sub_ens_size;
|
||||
|
||||
if (icpu == (cpu_threads - 1))
|
||||
iens2 = enkf_main_get_ensemble_size(enkf_main);
|
||||
|
||||
arg_pack_append_int(arg , iens1);
|
||||
arg_pack_append_int(arg , iens2);
|
||||
}
|
||||
arg_pack_list[icpu] = arg;
|
||||
arg_pack_lock( arg );
|
||||
thread_pool_add_job( tp , enkf_main_fwrite_sub_ensemble__ , arg);
|
||||
}
|
||||
thread_pool_join( tp );
|
||||
thread_pool_free( tp );
|
||||
|
||||
for (icpu = 0; icpu < cpu_threads; icpu++)
|
||||
arg_pack_free( arg_pack_list[icpu]);
|
||||
free(arg_pack_list);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -1512,8 +1455,6 @@ void enkf_main_run_exp(enkf_main_type * enkf_main ,
|
||||
}
|
||||
enkf_main_init_run( enkf_main , run_mode );
|
||||
{
|
||||
const enkf_sched_type * enkf_sched = model_config_get_enkf_sched(enkf_main->model_config);
|
||||
const int last_report = -1; // Should be fully ignored.
|
||||
int load_start = start_report;
|
||||
state_enum init_state_parameter = start_state;
|
||||
state_enum init_state_dynamic = start_state;
|
||||
@ -1788,12 +1729,12 @@ void enkf_main_initialize_from_existing(enkf_main_type * enkf_main ,
|
||||
|
||||
|
||||
static void * enkf_main_initialize_from_scratch_mt(void * void_arg) {
|
||||
arg_pack_type * arg_pack = arg_pack_safe_cast( void_arg );
|
||||
enkf_main_type * enkf_main = arg_pack_iget_ptr( arg_pack , 0);
|
||||
stringlist_type * param_list = arg_pack_iget_ptr( arg_pack , 1 );
|
||||
int iens1 = arg_pack_iget_int( arg_pack , 2 );
|
||||
int iens2 = arg_pack_iget_int( arg_pack , 3 );
|
||||
bool force_init = arg_pack_iget_bool( arg_pack , 4 );
|
||||
arg_pack_type * arg_pack = arg_pack_safe_cast( void_arg );
|
||||
enkf_main_type * enkf_main = arg_pack_iget_ptr( arg_pack , 0);
|
||||
const stringlist_type * param_list = arg_pack_iget_const_ptr( arg_pack , 1 );
|
||||
int iens1 = arg_pack_iget_int( arg_pack , 2 );
|
||||
int iens2 = arg_pack_iget_int( arg_pack , 3 );
|
||||
bool force_init = arg_pack_iget_bool( arg_pack , 4 );
|
||||
int iens;
|
||||
|
||||
for (iens = iens1; iens < iens2; iens++) {
|
||||
@ -1816,7 +1757,7 @@ void enkf_main_initialize_from_scratch(enkf_main_type * enkf_main , const string
|
||||
for (i = 0; i < num_cpu; i++) {
|
||||
arg_list[i] = arg_pack_alloc();
|
||||
arg_pack_append_ptr( arg_list[i] , enkf_main );
|
||||
arg_pack_append_ptr( arg_list[i] , param_list );
|
||||
arg_pack_append_const_ptr( arg_list[i] , param_list );
|
||||
{
|
||||
int start_iens = i * ens_sub_size;
|
||||
int end_iens = start_iens + ens_sub_size;
|
||||
@ -2123,10 +2064,6 @@ static void enkf_main_add_subst_kw( enkf_main_type * enkf_main , const char * ke
|
||||
free(tagged_key);
|
||||
}
|
||||
|
||||
static void enkf_main_init_workflow_list( enkf_main_type * enkf_main , config_type * config ) {
|
||||
ert_workflow_list_init( enkf_main->workflow_list , config , enkf_main->logh);
|
||||
}
|
||||
|
||||
|
||||
static void enkf_main_init_qc( enkf_main_type * enkf_main , config_type * config ) {
|
||||
qc_module_init( enkf_main->qc_module , config );
|
||||
@ -2426,6 +2363,21 @@ char * enkf_main_alloc_mount_point( const enkf_main_type * enkf_main , const cha
|
||||
}
|
||||
|
||||
|
||||
void enkf_main_gen_data_special( enkf_main_type * enkf_main ) {
|
||||
stringlist_type * gen_data_keys = ensemble_config_alloc_keylist_from_impl_type( enkf_main->ensemble_config , GEN_DATA);
|
||||
for (int i=0; i < stringlist_get_size( gen_data_keys ); i++) {
|
||||
enkf_config_node_type * config_node = ensemble_config_get_node( enkf_main->ensemble_config , stringlist_iget( gen_data_keys , i));
|
||||
enkf_var_type var_type = enkf_config_node_get_var_type(config_node);
|
||||
if ((var_type == DYNAMIC_STATE) || (var_type == DYNAMIC_RESULT)) {
|
||||
gen_data_config_type * gen_data_config = enkf_config_node_get_ref( config_node );
|
||||
gen_data_config_set_dynamic( gen_data_config , enkf_main->dbase );
|
||||
gen_data_config_set_ens_size( gen_data_config , enkf_main->ens_size );
|
||||
}
|
||||
}
|
||||
stringlist_free( gen_data_keys );
|
||||
}
|
||||
|
||||
|
||||
void enkf_main_set_fs( enkf_main_type * enkf_main , enkf_fs_type * fs , const char * case_path ) {
|
||||
if (enkf_main->dbase != fs) {
|
||||
if (enkf_main->dbase != NULL)
|
||||
@ -2499,19 +2451,6 @@ enkf_fs_type * enkf_main_get_alt_fs(enkf_main_type * enkf_main , const char * ca
|
||||
return alt_fs;
|
||||
}
|
||||
|
||||
void enkf_main_gen_data_special( enkf_main_type * enkf_main ) {
|
||||
stringlist_type * gen_data_keys = ensemble_config_alloc_keylist_from_impl_type( enkf_main->ensemble_config , GEN_DATA);
|
||||
for (int i=0; i < stringlist_get_size( gen_data_keys ); i++) {
|
||||
enkf_config_node_type * config_node = ensemble_config_get_node( enkf_main->ensemble_config , stringlist_iget( gen_data_keys , i));
|
||||
enkf_var_type var_type = enkf_config_node_get_var_type(config_node);
|
||||
if ((var_type == DYNAMIC_STATE) || (var_type == DYNAMIC_RESULT)) {
|
||||
gen_data_config_type * gen_data_config = enkf_config_node_get_ref( config_node );
|
||||
gen_data_config_set_dynamic( gen_data_config , enkf_main->dbase );
|
||||
gen_data_config_set_ens_size( gen_data_config , enkf_main->ens_size );
|
||||
}
|
||||
}
|
||||
stringlist_free( gen_data_keys );
|
||||
}
|
||||
|
||||
|
||||
void enkf_main_select_fs( enkf_main_type * enkf_main , const char * case_path ) {
|
||||
@ -2588,7 +2527,8 @@ void enkf_main_set_schedule_prediction_file__( enkf_main_type * enkf_main , cons
|
||||
|
||||
if (template_file != NULL) {
|
||||
char * target_file;
|
||||
enkf_config_node_type * config_node = ensemble_config_add_gen_kw( enkf_main->ensemble_config , key );
|
||||
bool forward_init = false;
|
||||
enkf_config_node_type * config_node = ensemble_config_add_gen_kw( enkf_main->ensemble_config , key , forward_init);
|
||||
{
|
||||
char * base;
|
||||
char * ext;
|
||||
@ -2916,7 +2856,7 @@ enkf_main_type * enkf_main_bootstrap(const char * _site_config, const char * _mo
|
||||
{
|
||||
const config_content_item_type * pred_item = config_get_content_item( config , SCHEDULE_PREDICTION_FILE_KEY );
|
||||
if (pred_item != NULL) {
|
||||
const config_content_node_type * pred_node = config_content_item_get_last_node( pred_item );
|
||||
config_content_node_type * pred_node = config_content_item_get_last_node( pred_item );
|
||||
const char * template_file = config_content_node_iget_as_path( pred_node , 0 );
|
||||
{
|
||||
hash_type * opt_hash = hash_alloc();
|
||||
@ -3492,11 +3432,10 @@ ert_workflow_list_type * enkf_main_get_workflow_list( enkf_main_type * enkf_main
|
||||
return enkf_main->workflow_list;
|
||||
}
|
||||
|
||||
|
||||
bool enkf_main_run_workflow( enkf_main_type * enkf_main , const char * workflow) {
|
||||
bool enkf_main_run_workflow( enkf_main_type * enkf_main , const char * workflow ) {
|
||||
ert_workflow_list_type * workflow_list = enkf_main_get_workflow_list( enkf_main );
|
||||
if (ert_workflow_list_has_workflow( workflow_list , workflow))
|
||||
return ert_workflow_list_run_workflow( workflow_list , workflow , enkf_main );
|
||||
return ert_workflow_list_run_workflow( workflow_list , workflow , enkf_main);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
@ -21,23 +21,25 @@
|
||||
#include <ert/enkf/enkf_main.h>
|
||||
|
||||
|
||||
void enkf_main_exit_JOB(void * self , const stringlist_type * args ) {
|
||||
void * enkf_main_exit_JOB(void * self , const stringlist_type * args ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
|
||||
enkf_main_exit( enkf_main );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void enkf_main_assimilation_JOB( void * self , const stringlist_type * args ) {
|
||||
void * enkf_main_assimilation_JOB( void * self , const stringlist_type * args ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
|
||||
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 );
|
||||
enkf_main_run_assimilation( enkf_main , iactive , 0 , 0 , ANALYZED );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void enkf_main_ensemble_run_JOB( void * self , const stringlist_type * args ) {
|
||||
void * enkf_main_ensemble_run_JOB( void * self , const stringlist_type * args ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
|
||||
int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
bool_vector_type * iactive = bool_vector_alloc( 0 , true );
|
||||
@ -47,10 +49,11 @@ void enkf_main_ensemble_run_JOB( void * self , const stringlist_type * args ) {
|
||||
|
||||
bool_vector_iset( iactive , ens_size - 1 , true );
|
||||
enkf_main_run_exp( enkf_main , iactive , true , 0 , 0 , ANALYZED );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void enkf_main_smoother_JOB( void * self , const stringlist_type * args ) {
|
||||
void * enkf_main_smoother_JOB( void * self , const stringlist_type * args ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
|
||||
int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
bool_vector_type * iactive = bool_vector_alloc( 0 , true );
|
||||
@ -59,14 +62,16 @@ void enkf_main_smoother_JOB( void * self , const stringlist_type * args ) {
|
||||
|
||||
bool_vector_iset( iactive , ens_size - 1 , true );
|
||||
enkf_main_run_smoother( enkf_main , target_case , rerun);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void enkf_main_create_reports_JOB(void * self , const stringlist_type * args ) {
|
||||
void * enkf_main_create_reports_JOB(void * self , const stringlist_type * args ) {
|
||||
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
|
||||
ert_report_list_type * report_list = enkf_main_get_report_list( enkf_main );
|
||||
|
||||
ert_report_list_create( report_list , enkf_main_get_current_fs( enkf_main ) , true );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
52
ThirdParty/Ert/devel/libenkf/src/enkf_node.c
vendored
52
ThirdParty/Ert/devel/libenkf/src/enkf_node.c
vendored
@ -293,7 +293,9 @@ enkf_var_type enkf_node_get_var_type(const enkf_node_type * enkf_node) {
|
||||
return enkf_config_node_get_var_type(enkf_node->config);
|
||||
}
|
||||
|
||||
|
||||
bool enkf_node_use_forward_init( const enkf_node_type * enkf_node ) {
|
||||
return enkf_config_node_use_forward_init( enkf_node->config );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -370,9 +372,9 @@ bool enkf_node_user_get_vector( enkf_node_type * enkf_node , enkf_fs_type * fs ,
|
||||
|
||||
|
||||
|
||||
void enkf_node_fload( enkf_node_type * enkf_node , const char * filename ) {
|
||||
bool enkf_node_fload( enkf_node_type * enkf_node , const char * filename ) {
|
||||
FUNC_ASSERT( enkf_node->fload );
|
||||
enkf_node->fload( enkf_node->data , filename );
|
||||
return enkf_node->fload( enkf_node->data , filename );
|
||||
}
|
||||
|
||||
|
||||
@ -420,6 +422,19 @@ bool enkf_node_forward_load(enkf_node_type *enkf_node , const char * run_path ,
|
||||
}
|
||||
|
||||
|
||||
bool enkf_node_forward_init(enkf_node_type * enkf_node , const char * run_path , int iens) {
|
||||
char * init_file = enkf_config_node_alloc_initfile( enkf_node->config , run_path , iens );
|
||||
bool loadOK = false;
|
||||
if (init_file) {
|
||||
FUNC_ASSERT(enkf_node->fload);
|
||||
loadOK = enkf_node->fload( enkf_node->data , init_file );
|
||||
}
|
||||
util_safe_free( init_file );
|
||||
return loadOK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool enkf_node_forward_load_vector(enkf_node_type *enkf_node , const char * run_path , const ecl_sum_type * ecl_sum, const ecl_file_type * restart_block , int report_step1, int report_step2 , int iens ) {
|
||||
bool loadOK;
|
||||
FUNC_ASSERT(enkf_node->forward_load_vector);
|
||||
@ -845,19 +860,23 @@ void enkf_node_imul(enkf_node_type *enkf_node , const enkf_node_type * delta_nod
|
||||
*/
|
||||
|
||||
bool enkf_node_initialize(enkf_node_type *enkf_node, int iens , rng_type * rng) {
|
||||
if (enkf_node->initialize != NULL) {
|
||||
char * init_file = enkf_config_node_alloc_initfile( enkf_node->config , iens );
|
||||
bool init = enkf_node->initialize(enkf_node->data , iens , init_file, rng);
|
||||
if (init) {
|
||||
enkf_node->__node_id.report_step = 0;
|
||||
enkf_node->__node_id.state = ANALYZED;
|
||||
enkf_node->__node_id.iens = iens;
|
||||
enkf_node->__modified = true;
|
||||
}
|
||||
util_safe_free( init_file );
|
||||
return init;
|
||||
} else
|
||||
return false; /* No init performed */
|
||||
if (enkf_node_use_forward_init( enkf_node ))
|
||||
return false; // This node will be initialized by loading results from the forward model.
|
||||
else {
|
||||
if (enkf_node->initialize != NULL) {
|
||||
char * init_file = enkf_config_node_alloc_initfile( enkf_node->config , NULL , iens );
|
||||
bool init = enkf_node->initialize(enkf_node->data , iens , init_file, rng);
|
||||
if (init) {
|
||||
enkf_node->__node_id.report_step = 0;
|
||||
enkf_node->__node_id.state = ANALYZED;
|
||||
enkf_node->__node_id.iens = iens;
|
||||
enkf_node->__modified = true;
|
||||
}
|
||||
util_safe_free( init_file );
|
||||
return init;
|
||||
} else
|
||||
return false; /* No init performed */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1024,6 +1043,7 @@ static enkf_node_type * enkf_node_alloc_empty(const enkf_config_node_type *confi
|
||||
node->iaddsqr = surface_iaddsqr__;
|
||||
node->imul = surface_imul__;
|
||||
node->isqrt = surface_isqrt__;
|
||||
node->fload = surface_fload__;
|
||||
break;
|
||||
case(FIELD):
|
||||
node->alloc = field_alloc__;
|
||||
|
@ -89,7 +89,7 @@ void * enkf_plot_data_load__( void *arg ) {
|
||||
enkf_plot_data_type * plot_data = arg_pack_iget_ptr( arg_pack , 0 );
|
||||
enkf_config_node_type * config_node = arg_pack_iget_ptr( arg_pack , 1 );
|
||||
enkf_fs_type * fs = arg_pack_iget_ptr( arg_pack , 2 );
|
||||
const char * user_key = arg_pack_iget_ptr( arg_pack , 3 );
|
||||
const char * user_key = arg_pack_iget_const_ptr( arg_pack , 3 );
|
||||
state_enum state = arg_pack_iget_int( arg_pack , 4 );
|
||||
int step1 = arg_pack_iget_int( arg_pack , 5 );
|
||||
int step2 = arg_pack_iget_int( arg_pack , 6 );
|
||||
@ -158,7 +158,7 @@ void enkf_plot_data_load( enkf_plot_data_type * plot_data ,
|
||||
arg_pack_append_ptr( arg_list[i] , plot_data );
|
||||
arg_pack_append_ptr( arg_list[i] , config_node );
|
||||
arg_pack_append_ptr( arg_list[i] , fs );
|
||||
arg_pack_append_ptr( arg_list[i] , user_key );
|
||||
arg_pack_append_const_ptr( arg_list[i] , user_key );
|
||||
|
||||
arg_pack_append_int( arg_list[i] , state );
|
||||
arg_pack_append_int( arg_list[i] , step1 );
|
||||
|
105
ThirdParty/Ert/devel/libenkf/src/enkf_state.c
vendored
105
ThirdParty/Ert/devel/libenkf/src/enkf_state.c
vendored
@ -119,7 +119,7 @@ typedef struct run_info_struct {
|
||||
*/
|
||||
|
||||
typedef struct shared_info_struct {
|
||||
const model_config_type * model_config; /* .... */
|
||||
model_config_type * model_config; /* .... */
|
||||
ext_joblist_type * joblist; /* The list of external jobs which are installed - and *how* they should be run (with Python code) */
|
||||
job_queue_type * job_queue; /* The queue handling external jobs. (i.e. LSF / TORQUE / rsh / local / ... )*/
|
||||
const site_config_type * site_config;
|
||||
@ -249,7 +249,7 @@ static void run_info_complete_run(run_info_type * run_info) {
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
static shared_info_type * shared_info_alloc(const site_config_type * site_config , const model_config_type * model_config, const ecl_config_type * ecl_config , log_type * logh , ert_templates_type * templates) {
|
||||
static shared_info_type * shared_info_alloc(const site_config_type * site_config , model_config_type * model_config, const ecl_config_type * ecl_config , log_type * logh , ert_templates_type * templates) {
|
||||
shared_info_type * shared_info = util_malloc(sizeof * shared_info );
|
||||
|
||||
shared_info->joblist = site_config_get_installed_jobs( site_config );
|
||||
@ -289,7 +289,6 @@ void enkf_state_initialize(enkf_state_type * enkf_state , enkf_fs_type * fs , co
|
||||
if (force_init || (enkf_node_has_data( param_node , fs , node_id) == false)) {
|
||||
if (enkf_node_initialize( param_node , iens , enkf_state->rng))
|
||||
enkf_node_store( param_node , fs , true , node_id);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -448,7 +447,7 @@ enkf_state_type * enkf_state_alloc(int iens,
|
||||
const char * casename ,
|
||||
bool pre_clear_runpath ,
|
||||
keep_runpath_type keep_runpath ,
|
||||
const model_config_type * model_config,
|
||||
model_config_type * model_config,
|
||||
ensemble_config_type * ensemble_config,
|
||||
const site_config_type * site_config,
|
||||
const ecl_config_type * ecl_config,
|
||||
@ -590,7 +589,6 @@ const char * enkf_state_get_eclbase( const enkf_state_type * enkf_state ) {
|
||||
|
||||
|
||||
static ecl_sum_type * enkf_state_load_ecl_sum(const enkf_state_type * enkf_state , stringlist_type * messages , bool * loadOK) {
|
||||
member_config_type * my_config = enkf_state->my_config;
|
||||
const run_info_type * run_info = enkf_state->run_info;
|
||||
const ecl_config_type * ecl_config = enkf_state->shared_info->ecl_config;
|
||||
const bool fmt_file = ecl_config_get_formatted(ecl_config);
|
||||
@ -680,7 +678,6 @@ static void enkf_state_log_GEN_DATA_load( const enkf_node_type * enkf_node , int
|
||||
static bool enkf_state_internalize_dynamic_eclipse_results(enkf_state_type * enkf_state , enkf_fs_type * fs , const model_config_type * model_config , bool * loadOK, bool interactive , stringlist_type * msg_list) {
|
||||
const run_info_type * run_info = enkf_state->run_info;
|
||||
int load_start = run_info->load_start;
|
||||
int report_step;
|
||||
|
||||
if (load_start == 0) /* Do not attempt to load the "S0000" summary results. */
|
||||
load_start++;
|
||||
@ -709,7 +706,7 @@ static bool enkf_state_internalize_dynamic_eclipse_results(enkf_state_type * enk
|
||||
if (enkf_node_forward_load_vector( node , run_info->run_path , summary , NULL , load_start, step2 , iens)) {
|
||||
enkf_node_store_vector( node , fs , iens , FORECAST );
|
||||
if (interactive && enkf_node_get_impl_type(node) == GEN_DATA)
|
||||
enkf_state_log_GEN_DATA_load( node , report_step , msg_list );
|
||||
enkf_state_log_GEN_DATA_load( node , 0 , msg_list );
|
||||
} else {
|
||||
*loadOK = false;
|
||||
log_add_fmt_message(shared_info->logh , 3 , NULL , "[%03d:----] Failed to load data for vector node:%s.",iens , enkf_node_get_key( node ));
|
||||
@ -717,6 +714,7 @@ static bool enkf_state_internalize_dynamic_eclipse_results(enkf_state_type * enk
|
||||
stringlist_append_owned_ref( msg_list , util_alloc_sprintf("Failed to load vector:%s" , enkf_node_get_key( node )));
|
||||
}
|
||||
} else {
|
||||
int report_step;
|
||||
for (report_step = load_start; report_step <= step2; report_step++) {
|
||||
bool store_vectors = (report_step == step2) ? true : false;
|
||||
if (enkf_node_forward_load(node , run_info->run_path , summary , NULL , report_step , iens)) { /* Loading/internalizing */
|
||||
@ -754,7 +752,7 @@ static bool enkf_state_internalize_dynamic_results(enkf_state_type * enkf_state
|
||||
|
||||
if (ecl_config_active( ecl_config )) {
|
||||
bool eclipse_load = enkf_state_internalize_dynamic_eclipse_results( enkf_state , fs , model_config , loadOK, interactive , msg_list);
|
||||
fprintf("** Warning: could not load ECLIPSE summary data from %s - this will probably fail later ...\n" , enkf_state->run_info->run_path);
|
||||
fprintf(stderr , "** Warning: could not load ECLIPSE summary data from %s - this will probably fail later ...\n" , enkf_state->run_info->run_path);
|
||||
return eclipse_load;
|
||||
} else
|
||||
return false;
|
||||
@ -1013,8 +1011,8 @@ static void enkf_state_internalize_state(enkf_state_type * enkf_state ,
|
||||
|
||||
|
||||
static void enkf_state_internalize_results(enkf_state_type * enkf_state , enkf_fs_type * fs , bool * loadOK , bool interactive , stringlist_type * msg_list) {
|
||||
run_info_type * run_info = enkf_state->run_info;
|
||||
const model_config_type * model_config = enkf_state->shared_info->model_config;
|
||||
run_info_type * run_info = enkf_state->run_info;
|
||||
model_config_type * model_config = enkf_state->shared_info->model_config;
|
||||
int report_step;
|
||||
|
||||
/*
|
||||
@ -1044,12 +1042,62 @@ static void enkf_state_internalize_results(enkf_state_type * enkf_state , enkf_f
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void enkf_state_forward_init(enkf_state_type * enkf_state ,
|
||||
enkf_fs_type * fs ,
|
||||
bool * loadOK ) {
|
||||
run_info_type * run_info = enkf_state->run_info;
|
||||
|
||||
if (run_info->step1 == 0) {
|
||||
int iens = enkf_state_get_iens( enkf_state );
|
||||
hash_iter_type * iter = hash_iter_alloc( enkf_state->node_hash );
|
||||
while ( !hash_iter_is_complete(iter) ) {
|
||||
enkf_node_type * node = hash_iter_get_next_value(iter);
|
||||
if (enkf_node_use_forward_init(node)) {
|
||||
node_id_type node_id = {.report_step = 0 ,
|
||||
.iens = iens ,
|
||||
.state = ANALYZED };
|
||||
|
||||
|
||||
/* Will not reinitialize; i.e. it is essential that the
|
||||
forward model uses the state given from the stored
|
||||
instance, and not from the current run of e.g. RMS. */
|
||||
|
||||
if (!enkf_node_has_data( node , fs , node_id)) {
|
||||
if (enkf_node_forward_init(node , run_info->run_path , iens ))
|
||||
enkf_node_store( node , fs, false , node_id );
|
||||
else
|
||||
*loadOK = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
hash_iter_free( iter );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void enkf_state_load_from_forward_model(enkf_state_type * enkf_state ,
|
||||
enkf_fs_type * fs ,
|
||||
bool * loadOK ,
|
||||
bool interactive ,
|
||||
stringlist_type * msg_list) {
|
||||
|
||||
if (ensemble_config_have_forward_init( enkf_state->ensemble_config ))
|
||||
enkf_state_forward_init( enkf_state , fs , loadOK );
|
||||
|
||||
enkf_state_internalize_results( enkf_state , fs , loadOK , interactive , msg_list );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Observe that this does not return the loadOK flag; it will load as
|
||||
good as it can all the data it should, and be done with it.
|
||||
*/
|
||||
|
||||
void * enkf_state_internalize_results_mt( void * arg ) {
|
||||
void * enkf_state_load_from_forward_model_mt( void * arg ) {
|
||||
arg_pack_type * arg_pack = arg_pack_safe_cast( arg );
|
||||
enkf_state_type * enkf_state = arg_pack_iget_ptr( arg_pack , 0 );
|
||||
enkf_fs_type * fs = arg_pack_iget_ptr( arg_pack , 1 );
|
||||
@ -1069,7 +1117,7 @@ void * enkf_state_internalize_results_mt( void * arg ) {
|
||||
model_config_get_runpath_fmt( enkf_state->shared_info->model_config ) ,
|
||||
enkf_state->subst_list );
|
||||
|
||||
enkf_state_internalize_results( enkf_state , fs , &loadOK , interactive , msg_list );
|
||||
enkf_state_load_from_forward_model( enkf_state , fs , &loadOK , interactive , msg_list );
|
||||
if (interactive) {
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
@ -1118,7 +1166,7 @@ static void enkf_state_write_restart_file(enkf_state_type * enkf_state , enkf_fs
|
||||
before things blow up completely at a later instant.
|
||||
*/
|
||||
if (!ensemble_config_has_key(enkf_state->ensemble_config , kw))
|
||||
ensemble_config_add_node(enkf_state->ensemble_config , kw , STATIC_STATE , STATIC , NULL , NULL , NULL );
|
||||
ensemble_config_ensure_static_key(enkf_state->ensemble_config , kw );
|
||||
|
||||
if (!enkf_state_has_node(enkf_state , kw)) {
|
||||
const enkf_config_node_type * config_node = ensemble_config_get_node(enkf_state->ensemble_config , kw);
|
||||
@ -1194,13 +1242,26 @@ void enkf_state_ecl_write(enkf_state_type * enkf_state, enkf_fs_type * fs) {
|
||||
|
||||
const int num_keys = hash_get_size(enkf_state->node_hash);
|
||||
char ** key_list = hash_alloc_keylist(enkf_state->node_hash);
|
||||
int iens = enkf_state_get_iens( enkf_state );
|
||||
int ikey;
|
||||
|
||||
|
||||
for (ikey = 0; ikey < num_keys; ikey++) {
|
||||
if (!stringlist_contains(enkf_state->restart_kw_list , key_list[ikey])) { /* Make sure that the elements in the restart file are not written (again). */
|
||||
enkf_node_type * enkf_node = hash_get(enkf_state->node_hash , key_list[ikey]);
|
||||
if (enkf_node_get_var_type( enkf_node ) != STATIC_STATE) /* Ensure that no-longer-active static keywords do not create problems. */
|
||||
enkf_node_ecl_write(enkf_node , run_info->run_path , NULL , run_info->step1);
|
||||
if (enkf_node_get_var_type( enkf_node ) != STATIC_STATE) { /* Ensure that no-longer-active static keywords do not create problems. */
|
||||
bool forward_init = enkf_node_use_forward_init( enkf_node );
|
||||
|
||||
if ((run_info->step1 == 0) && (forward_init)) {
|
||||
node_id_type node_id = {.report_step = 0,
|
||||
.iens = iens ,
|
||||
.state = ANALYZED };
|
||||
|
||||
if (enkf_node_has_data( enkf_node , fs , node_id))
|
||||
enkf_node_ecl_write(enkf_node , run_info->run_path , NULL , run_info->step1);
|
||||
} else
|
||||
enkf_node_ecl_write(enkf_node , run_info->run_path , NULL , run_info->step1);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
util_free_stringlist(key_list , num_keys);
|
||||
@ -1244,7 +1305,11 @@ void enkf_state_fread(enkf_state_type * enkf_state , enkf_fs_type * fs , int mas
|
||||
node_id_type node_id = {.report_step = report_step ,
|
||||
.iens = member_config_get_iens( my_config ) ,
|
||||
state = state };
|
||||
enkf_node_load(enkf_node , fs , node_id);
|
||||
bool forward_init = enkf_node_use_forward_init( enkf_node );
|
||||
if (forward_init)
|
||||
enkf_node_try_load(enkf_node , fs , node_id );
|
||||
else
|
||||
enkf_node_load(enkf_node , fs , node_id);
|
||||
}
|
||||
}
|
||||
util_free_stringlist(key_list , num_keys);
|
||||
@ -1884,7 +1949,7 @@ static bool enkf_state_complete_forward_modelOK(enkf_state_type * enkf_state , e
|
||||
is OK the final status is updated, otherwise: restart.
|
||||
*/
|
||||
log_add_fmt_message( shared_info->logh , 2 , NULL , "[%03d:%04d-%04d] Forward model complete - starting to load results." , iens , run_info->step1, run_info->step2);
|
||||
enkf_state_internalize_results(enkf_state , fs , &loadOK , false , NULL);
|
||||
enkf_state_load_from_forward_model(enkf_state , fs , &loadOK , false , NULL);
|
||||
if (loadOK) {
|
||||
/*
|
||||
The loading succeded - so this is a howling success! We set
|
||||
@ -2037,7 +2102,9 @@ void enkf_state_init_run(enkf_state_type * state ,
|
||||
|
||||
|
||||
|
||||
|
||||
rng_type * enkf_state_get_rng( const enkf_state_type * enkf_state ) {
|
||||
return enkf_state->rng;
|
||||
}
|
||||
|
||||
unsigned int enkf_state_get_random( enkf_state_type * enkf_state ) {
|
||||
return rng_forward( enkf_state->rng );
|
||||
|
163
ThirdParty/Ert/devel/libenkf/src/ensemble_config.c
vendored
163
ThirdParty/Ert/devel/libenkf/src/ensemble_config.c
vendored
@ -74,6 +74,7 @@ struct ensemble_config_struct {
|
||||
field_trans_table_type * field_trans_table; /* a table of the transformations which are available to apply on fields. */
|
||||
const ecl_sum_type * refcase; /* a ecl_sum reference instance - can be null (not owned by the ensemble
|
||||
config). is only used to check that summary keys are valid when adding. */
|
||||
bool have_forward_init;
|
||||
};
|
||||
|
||||
|
||||
@ -141,6 +142,7 @@ ensemble_config_type * ensemble_config_alloc_empty( ) {
|
||||
ensemble_config->field_trans_table = field_trans_table_alloc();
|
||||
ensemble_config->refcase = NULL;
|
||||
ensemble_config->gen_kw_format_string = util_alloc_string_copy( DEFAULT_GEN_KW_TAG_FORMAT );
|
||||
ensemble_config->have_forward_init = false;
|
||||
pthread_mutex_init( &ensemble_config->mutex , NULL);
|
||||
|
||||
return ensemble_config;
|
||||
@ -226,30 +228,29 @@ void ensemble_config_del_node(ensemble_config_type * ensemble_config, const char
|
||||
}
|
||||
|
||||
|
||||
bool ensemble_config_have_forward_init( const ensemble_config_type * ensemble_config ) {
|
||||
return ensemble_config->have_forward_init;
|
||||
}
|
||||
|
||||
void ensemble_config_add_node__( ensemble_config_type * ensemble_config , enkf_config_node_type * node) {
|
||||
|
||||
const char * key = enkf_config_node_get_key( node );
|
||||
if (ensemble_config_has_key(ensemble_config , key))
|
||||
util_abort("%s: a configuration object:%s has already been added - aborting \n",__func__ , key);
|
||||
|
||||
hash_insert_hash_owned_ref(ensemble_config->config_nodes , key , node , enkf_config_node_free__);
|
||||
ensemble_config->have_forward_init |= enkf_config_node_use_forward_init( node );
|
||||
}
|
||||
|
||||
|
||||
enkf_config_node_type * ensemble_config_add_node(ensemble_config_type * ensemble_config ,
|
||||
const char * key ,
|
||||
enkf_var_type enkf_type ,
|
||||
ert_impl_type impl_type ,
|
||||
const char * enkf_outfile , /* written by enkf and read by forward model */
|
||||
const char * enkf_infile , /* written by forward model and read by enkf */
|
||||
void * data ) {
|
||||
|
||||
if (ensemble_config_has_key(ensemble_config , key))
|
||||
util_abort("%s: a configuration object:%s has already been added - aborting \n",__func__ , key);
|
||||
enkf_config_node_type * ensemble_config_add_STATIC_node(ensemble_config_type * ensemble_config ,
|
||||
const char * key) {
|
||||
|
||||
if (ensemble_config_has_key(ensemble_config , key))
|
||||
util_abort("%s: a configuration object:%s has already been added - aborting \n",__func__ , key);
|
||||
{
|
||||
const char * init_file = "hhh";
|
||||
|
||||
enkf_config_node_type * node = enkf_config_node_alloc(enkf_type , impl_type , key , init_file , enkf_outfile , enkf_infile , data );
|
||||
enkf_config_node_type * node = enkf_config_node_alloc(STATIC_STATE , STATIC , false , key , NULL , NULL , NULL , NULL);
|
||||
hash_insert_hash_owned_ref(ensemble_config->config_nodes , key , node , enkf_config_node_free__);
|
||||
return node;
|
||||
}
|
||||
@ -265,7 +266,7 @@ void ensemble_config_ensure_static_key(ensemble_config_type * ensemble_config ,
|
||||
pthread_mutex_lock( &ensemble_config->mutex );
|
||||
{
|
||||
if (!ensemble_config_has_key(ensemble_config , kw))
|
||||
ensemble_config_add_node(ensemble_config , kw , STATIC_STATE , STATIC , NULL , NULL , NULL);
|
||||
ensemble_config_add_STATIC_node(ensemble_config , kw );
|
||||
}
|
||||
pthread_mutex_unlock( &ensemble_config->mutex );
|
||||
}
|
||||
@ -354,15 +355,14 @@ void ensemble_config_add_config_items(config_type * config) {
|
||||
}
|
||||
|
||||
|
||||
void ensemble_config_init_GEN_DATA( ensemble_config_type * ensemble_config , const config_type * config ) {
|
||||
void ensemble_config_init_GEN_DATA( ensemble_config_type * ensemble_config , const config_type * config) {
|
||||
/* gen_param - should be unified with the gen_data*/
|
||||
const config_content_item_type * item = config_get_content_item( config , GEN_DATA_KEY );
|
||||
if (item != NULL) {
|
||||
int i;
|
||||
for (i=0; i < config_content_item_get_size(item); i++) {
|
||||
const config_content_node_type * node = config_content_item_iget_node( item , i );
|
||||
const char * key = config_content_node_iget( node , 0 );
|
||||
enkf_config_node_type * config_node = ensemble_config_add_gen_data( ensemble_config , key );
|
||||
const char * node_key = config_content_node_iget( node , 0 );
|
||||
{
|
||||
hash_type * options = hash_alloc();
|
||||
|
||||
@ -373,15 +373,24 @@ void ensemble_config_init_GEN_DATA( ensemble_config_type * ensemble_config , con
|
||||
const char * init_file_fmt = hash_safe_get( options , INIT_FILES_KEY);
|
||||
const char * ecl_file = hash_safe_get( options , ECL_FILE_KEY);
|
||||
const char * template = hash_safe_get( options , TEMPLATE_KEY);
|
||||
const char * key = hash_safe_get( options , KEY_KEY);
|
||||
const char * data_key = hash_safe_get( options , KEY_KEY);
|
||||
const char * result_file = hash_safe_get( options , RESULT_FILE_KEY);
|
||||
const char * min_std_file = hash_safe_get( options , MIN_STD_KEY);
|
||||
const char * forward_string = hash_safe_get( options , FORWARD_INIT_KEY );
|
||||
enkf_config_node_type * config_node;
|
||||
bool forward_init = false;
|
||||
|
||||
enkf_config_node_update_gen_data( config_node , input_format , output_format , init_file_fmt , template , key , ecl_file , result_file , min_std_file);
|
||||
if (forward_string) {
|
||||
if (!util_sscanf_bool( forward_string , &forward_init))
|
||||
fprintf(stderr,"** Warning: parsing %s as bool failed - using FALSE \n",forward_string);
|
||||
}
|
||||
|
||||
config_node = ensemble_config_add_gen_data( ensemble_config , node_key , forward_init);
|
||||
enkf_config_node_update_gen_data( config_node , input_format , output_format , init_file_fmt , template , data_key , ecl_file , result_file , min_std_file);
|
||||
{
|
||||
const gen_data_config_type * gen_data_config = enkf_config_node_get_ref( config_node );
|
||||
if (!gen_data_config_is_valid( gen_data_config ))
|
||||
util_abort("%s: sorry the gen_param key:%s is not valid \n",__func__ , key);
|
||||
util_abort("%s: sorry the gen_param key:%s is not valid \n",__func__ , node_key);
|
||||
}
|
||||
}
|
||||
hash_free( options );
|
||||
@ -391,16 +400,15 @@ void ensemble_config_init_GEN_DATA( ensemble_config_type * ensemble_config , con
|
||||
}
|
||||
|
||||
|
||||
void ensemble_config_init_GEN_PARAM( ensemble_config_type * ensemble_config , const config_type * config ) {
|
||||
void ensemble_config_init_GEN_PARAM( ensemble_config_type * ensemble_config , const config_type * config) {
|
||||
/* gen_param - should be unified with the gen_data*/
|
||||
const config_content_item_type * item = config_get_content_item( config , GEN_PARAM_KEY );
|
||||
if (item != NULL) {
|
||||
int i;
|
||||
for (i=0; i < config_content_item_get_size(item); i++) {
|
||||
const config_content_node_type * node = config_content_item_iget_node( item , i );
|
||||
const char * key = config_content_node_iget( node , 0 );
|
||||
const char * node_key = config_content_node_iget( node , 0 );
|
||||
const char * ecl_file = config_content_node_iget( node , 1 );
|
||||
enkf_config_node_type * config_node = ensemble_config_add_gen_data( ensemble_config , key );
|
||||
{
|
||||
hash_type * options = hash_alloc();
|
||||
|
||||
@ -410,15 +418,24 @@ void ensemble_config_init_GEN_PARAM( ensemble_config_type * ensemble_config , co
|
||||
gen_data_file_format_type output_format = gen_data_config_check_format( hash_safe_get( options , OUTPUT_FORMAT_KEY));
|
||||
const char * init_file_fmt = hash_safe_get( options , INIT_FILES_KEY);
|
||||
const char * template = hash_safe_get( options , TEMPLATE_KEY);
|
||||
const char * key = hash_safe_get( options , KEY_KEY);
|
||||
const char * data_key = hash_safe_get( options , KEY_KEY);
|
||||
const char * result_file = hash_safe_get( options , RESULT_FILE_KEY);
|
||||
const char * min_std_file = hash_safe_get( options , MIN_STD_KEY);
|
||||
const char * forward_string = hash_safe_get( options , FORWARD_INIT_KEY );
|
||||
enkf_config_node_type * config_node;
|
||||
bool forward_init = false;
|
||||
|
||||
enkf_config_node_update_gen_data( config_node , input_format , output_format , init_file_fmt , template , key , ecl_file , result_file , min_std_file);
|
||||
if (forward_string) {
|
||||
if (!util_sscanf_bool( forward_string , &forward_init))
|
||||
fprintf(stderr,"** Warning: parsing %s as bool failed - using FALSE \n",forward_string);
|
||||
}
|
||||
|
||||
config_node = ensemble_config_add_gen_data( ensemble_config , node_key , forward_init);
|
||||
enkf_config_node_update_gen_data( config_node , input_format , output_format , init_file_fmt , template , data_key , ecl_file , result_file , min_std_file);
|
||||
{
|
||||
const gen_data_config_type * gen_data_config = enkf_config_node_get_ref( config_node );
|
||||
if (!gen_data_config_is_valid( gen_data_config ))
|
||||
util_abort("%s: sorry the gen_param key:%s is not valid \n",__func__ , key);
|
||||
util_abort("%s: sorry the gen_param key:%s is not valid \n",__func__ , node_key);
|
||||
}
|
||||
}
|
||||
hash_free( options );
|
||||
@ -435,23 +452,32 @@ void ensemble_config_init_GEN_KW( ensemble_config_type * ensemble_config , const
|
||||
for (i=0; i < config_content_item_get_size( gen_kw_item ); i++) {
|
||||
config_content_node_type * node = config_content_item_iget_node( gen_kw_item , i );
|
||||
|
||||
const char * key = config_content_node_iget( node , 0 );
|
||||
const char * template_file = config_content_node_iget_as_path( node , 1 );
|
||||
const char * enkf_outfile = config_content_node_iget( node , 2 );
|
||||
const char * parameter_file = config_content_node_iget_as_path( node , 3 );
|
||||
const char * key = config_content_node_iget( node , 0 );
|
||||
const char * template_file = config_content_node_iget_as_path( node , 1 );
|
||||
const char * enkf_outfile = config_content_node_iget( node , 2 );
|
||||
const char * parameter_file = config_content_node_iget_as_path( node , 3 );
|
||||
hash_type * opt_hash = hash_alloc();
|
||||
|
||||
config_content_node_init_opt_hash( node , opt_hash , 4 );
|
||||
{
|
||||
hash_type * opt_hash = hash_alloc();
|
||||
enkf_config_node_type * config_node = ensemble_config_add_gen_kw( ensemble_config , key );
|
||||
config_content_node_init_opt_hash( node , opt_hash , 4 );
|
||||
const char * forward_string = hash_safe_get( opt_hash , FORWARD_INIT_KEY );
|
||||
enkf_config_node_type * config_node;
|
||||
bool forward_init = false;
|
||||
|
||||
if (forward_string) {
|
||||
if (!util_sscanf_bool( forward_string , &forward_init))
|
||||
fprintf(stderr,"** Warning: parsing %s as bool failed - using FALSE \n",forward_string);
|
||||
}
|
||||
|
||||
config_node = ensemble_config_add_gen_kw( ensemble_config , key , forward_init);
|
||||
enkf_config_node_update_gen_kw( config_node ,
|
||||
enkf_outfile ,
|
||||
template_file ,
|
||||
parameter_file ,
|
||||
hash_safe_get( opt_hash , MIN_STD_KEY ) ,
|
||||
hash_safe_get( opt_hash , INIT_FILES_KEY));
|
||||
hash_free( opt_hash );
|
||||
enkf_outfile ,
|
||||
template_file ,
|
||||
parameter_file ,
|
||||
hash_safe_get( opt_hash , MIN_STD_KEY ) ,
|
||||
hash_safe_get( opt_hash , INIT_FILES_KEY));
|
||||
}
|
||||
hash_free( opt_hash );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -470,21 +496,28 @@ void ensemble_config_init_SURFACE( ensemble_config_type * ensemble_config , cons
|
||||
|
||||
config_content_node_init_opt_hash( node , options , 1 );
|
||||
{
|
||||
const char * init_file_fmt = hash_safe_get( options , INIT_FILES_KEY );
|
||||
const char * output_file = hash_safe_get( options , OUTPUT_FILE_KEY);
|
||||
const char * base_surface = hash_safe_get( options , BASE_SURFACE_KEY);
|
||||
const char * min_std_file = hash_safe_get( options , MIN_STD_KEY);
|
||||
const char * init_file_fmt = hash_safe_get( options , INIT_FILES_KEY );
|
||||
const char * output_file = hash_safe_get( options , OUTPUT_FILE_KEY);
|
||||
const char * base_surface = hash_safe_get( options , BASE_SURFACE_KEY);
|
||||
const char * min_std_file = hash_safe_get( options , MIN_STD_KEY);
|
||||
const char * forward_string = hash_safe_get( options , FORWARD_INIT_KEY );
|
||||
bool forward_init = false;
|
||||
|
||||
if (forward_string) {
|
||||
if (!util_sscanf_bool( forward_string , &forward_init))
|
||||
fprintf(stderr,"** Warning: parsing %s as bool failed - using FALSE \n",forward_string);
|
||||
}
|
||||
|
||||
if ((init_file_fmt == NULL) || (output_file == NULL) || (base_surface == NULL)) {
|
||||
fprintf(stderr,"** error: when entering a surface you must provide arguments:\n");
|
||||
fprintf(stderr,"** %s:/path/to/input/files%%d \n",INIT_FILES_KEY);
|
||||
fprintf(stderr,"** %s:name_of_output_file\n", OUTPUT_FILE_KEY);
|
||||
fprintf(stderr,"** %s:base_surface_file\n",base_surface);
|
||||
fprintf(stderr,"** %s:base_surface_file\n",BASE_SURFACE_KEY);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
{
|
||||
enkf_config_node_type * config_node = ensemble_config_add_surface( ensemble_config , key );
|
||||
enkf_config_node_type * config_node = ensemble_config_add_surface( ensemble_config , key , forward_init);
|
||||
enkf_config_node_update_surface( config_node , base_surface , init_file_fmt , output_file , min_std_file );
|
||||
}
|
||||
}
|
||||
@ -534,7 +567,7 @@ void ensemble_config_init_FIELD( ensemble_config_type * ensemble_config , const
|
||||
const config_content_node_type * node = config_content_item_iget_node( item , i );
|
||||
const char * key = config_content_node_iget( node , 0 );
|
||||
const char * var_type_string = config_content_node_iget( node , 1 );
|
||||
enkf_config_node_type * config_node = ensemble_config_add_field( ensemble_config , key , grid );
|
||||
enkf_config_node_type * config_node;
|
||||
|
||||
{
|
||||
hash_type * options = hash_alloc();
|
||||
@ -555,15 +588,23 @@ void ensemble_config_init_FIELD( ensemble_config_type * ensemble_config , const
|
||||
}
|
||||
|
||||
|
||||
if (strcmp(var_type_string , DYNAMIC_KEY) == 0)
|
||||
if (strcmp(var_type_string , DYNAMIC_KEY) == 0) {
|
||||
config_node = ensemble_config_add_field( ensemble_config , key , grid , false);
|
||||
enkf_config_node_update_state_field( config_node , truncation , value_min , value_max );
|
||||
else if (strcmp(var_type_string , PARAMETER_KEY) == 0) {
|
||||
} else if (strcmp(var_type_string , PARAMETER_KEY) == 0) {
|
||||
const char * ecl_file = config_content_node_iget( node , 2 );
|
||||
const char * init_file_fmt = hash_safe_get( options , INIT_FILES_KEY );
|
||||
const char * init_transform = hash_safe_get( options , INIT_TRANSFORM_KEY );
|
||||
const char * output_transform = hash_safe_get( options , OUTPUT_TRANSFORM_KEY );
|
||||
const char * min_std_file = hash_safe_get( options , MIN_STD_KEY );
|
||||
|
||||
const char * forward_string = hash_safe_get( options , FORWARD_INIT_KEY );
|
||||
bool forward_init = false;
|
||||
|
||||
if (forward_string) {
|
||||
if (!util_sscanf_bool( forward_string , &forward_init))
|
||||
fprintf(stderr,"** Warning: parsing %s as bool failed - using FALSE \n",forward_string);
|
||||
}
|
||||
config_node = ensemble_config_add_field( ensemble_config , key , grid , forward_init);
|
||||
enkf_config_node_update_parameter_field( config_node,
|
||||
ecl_file ,
|
||||
init_file_fmt ,
|
||||
@ -574,6 +615,7 @@ void ensemble_config_init_FIELD( ensemble_config_type * ensemble_config , const
|
||||
init_transform ,
|
||||
output_transform );
|
||||
} else if (strcmp(var_type_string , GENERAL_KEY) == 0) {
|
||||
/* General - not really interesting .. */
|
||||
const char * ecl_file = config_content_node_iget( node , 2 );
|
||||
const char * enkf_infile = config_content_node_iget( node , 3 );
|
||||
const char * init_file_fmt = hash_safe_get( options , INIT_FILES_KEY );
|
||||
@ -581,8 +623,15 @@ void ensemble_config_init_FIELD( ensemble_config_type * ensemble_config , const
|
||||
const char * output_transform = hash_safe_get( options , OUTPUT_TRANSFORM_KEY );
|
||||
const char * input_transform = hash_safe_get( options , INPUT_TRANSFORM_KEY );
|
||||
const char * min_std_file = hash_safe_get( options , MIN_STD_KEY );
|
||||
|
||||
const char * forward_string = hash_safe_get( options , FORWARD_INIT_KEY );
|
||||
bool forward_init = false;
|
||||
|
||||
if (forward_string) {
|
||||
if (!util_sscanf_bool( forward_string , &forward_init))
|
||||
fprintf(stderr,"** Warning: parsing %s as bool failed - using FALSE \n",forward_string);
|
||||
}
|
||||
|
||||
config_node = ensemble_config_add_field( ensemble_config , key , grid , forward_init);
|
||||
enkf_config_node_update_general_field( config_node,
|
||||
ecl_file ,
|
||||
enkf_infile ,
|
||||
@ -780,22 +829,22 @@ int ensemble_config_get_observations( const ensemble_config_type * config , enkf
|
||||
is essential for proper operation.
|
||||
*/
|
||||
|
||||
enkf_config_node_type * ensemble_config_add_field( ensemble_config_type * config , const char * key , ecl_grid_type * ecl_grid ) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_new_field( key , ecl_grid , config->field_trans_table );
|
||||
enkf_config_node_type * ensemble_config_add_field( ensemble_config_type * config , const char * key , ecl_grid_type * ecl_grid , bool forward_init) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_new_field( key , ecl_grid , config->field_trans_table , forward_init);
|
||||
ensemble_config_add_node__( config , config_node );
|
||||
return config_node;
|
||||
}
|
||||
|
||||
|
||||
enkf_config_node_type * ensemble_config_add_gen_kw( ensemble_config_type * config , const char * key ) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_new_gen_kw( key , config->gen_kw_format_string );
|
||||
enkf_config_node_type * ensemble_config_add_gen_kw( ensemble_config_type * config , const char * key , bool forward_init) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_new_gen_kw( key , config->gen_kw_format_string , forward_init);
|
||||
ensemble_config_add_node__( config , config_node );
|
||||
return config_node;
|
||||
}
|
||||
|
||||
|
||||
enkf_config_node_type * ensemble_config_add_gen_data( ensemble_config_type * config , const char * key ) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_new_gen_data( key );
|
||||
enkf_config_node_type * ensemble_config_add_gen_data( ensemble_config_type * config , const char * key , bool forward_init) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_new_gen_data( key , forward_init);
|
||||
ensemble_config_add_node__( config , config_node );
|
||||
return config_node;
|
||||
}
|
||||
@ -834,8 +883,8 @@ enkf_config_node_type * ensemble_config_add_summary(ensemble_config_type * ensem
|
||||
}
|
||||
|
||||
|
||||
enkf_config_node_type * ensemble_config_add_surface( ensemble_config_type * ensemble_config , const char * key ) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_new_surface( key );
|
||||
enkf_config_node_type * ensemble_config_add_surface( ensemble_config_type * ensemble_config , const char * key , bool forward_init) {
|
||||
enkf_config_node_type * config_node = enkf_config_node_new_surface( key , forward_init );
|
||||
ensemble_config_add_node__( ensemble_config , config_node );
|
||||
return config_node;
|
||||
}
|
||||
|
@ -210,8 +210,8 @@ bool ert_workflow_list_has_workflow(ert_workflow_list_type * workflow_list , co
|
||||
}
|
||||
|
||||
|
||||
bool ert_workflow_list_run_workflow__(ert_workflow_list_type * workflow_list , workflow_type * workflow, bool verbose , void * self ) {
|
||||
bool runOK = workflow_run( workflow , self , verbose , workflow_list->context );
|
||||
bool ert_workflow_list_run_workflow__(ert_workflow_list_type * workflow_list , workflow_type * workflow, bool verbose , void * self) {
|
||||
bool runOK = workflow_run( workflow , self , verbose , workflow_list->context);
|
||||
|
||||
if (runOK)
|
||||
workflow_list->last_error = NULL;
|
||||
@ -223,7 +223,7 @@ bool ert_workflow_list_run_workflow__(ert_workflow_list_type * workflow_list ,
|
||||
|
||||
bool ert_workflow_list_run_workflow(ert_workflow_list_type * workflow_list , const char * workflow_name , void * self) {
|
||||
workflow_type * workflow = ert_workflow_list_get_workflow( workflow_list , workflow_name );
|
||||
return ert_workflow_list_run_workflow__( workflow_list , workflow , workflow_list->verbose , self );
|
||||
return ert_workflow_list_run_workflow__( workflow_list , workflow , workflow_list->verbose , self);
|
||||
}
|
||||
|
||||
|
||||
|
177
ThirdParty/Ert/devel/libenkf/src/field.c
vendored
177
ThirdParty/Ert/devel/libenkf/src/field.c
vendored
@ -729,8 +729,7 @@ void field_ecl_write(const field_type * field , const char * run_path , const ch
|
||||
|
||||
bool field_initialize(field_type *field , int iens , const char * init_file , rng_type * rng) {
|
||||
if (init_file != NULL) {
|
||||
field_fload(field , init_file );
|
||||
{
|
||||
if (field_fload(field , init_file )) {
|
||||
field_func_type * init_transform = field_config_get_init_transform(field->config);
|
||||
/*
|
||||
Doing the input transform - observe that this is done inplace on
|
||||
@ -742,10 +741,11 @@ bool field_initialize(field_type *field , int iens , const char * init_file , rn
|
||||
if (!field_check_finite( field ))
|
||||
util_exit("Sorry: after applying the init transform field:%s contains nan/inf or similar malformed values.\n" , field_config_get_key( field->config ));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
} else
|
||||
return false; /* The field is initialized as part of the forward model. */
|
||||
}
|
||||
|
||||
return false; /* The field is initialized as part of the forward model. */
|
||||
}
|
||||
|
||||
|
||||
@ -1003,118 +1003,144 @@ void field_copy_ecl_kw_data(field_type * field , const ecl_kw_type * ecl_kw) {
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
void field_fload_rms(field_type * field , const char * filename) {
|
||||
const char * key = field_config_get_ecl_kw_name(field->config);
|
||||
ecl_type_enum ecl_type;
|
||||
rms_file_type * rms_file = rms_file_alloc(filename , false);
|
||||
rms_tagkey_type * data_tag;
|
||||
if (field_config_enkf_mode(field->config))
|
||||
data_tag = rms_file_fread_alloc_data_tagkey(rms_file , "parameter" , "name" , key);
|
||||
else {
|
||||
/**
|
||||
Setting the key - purely to support converting between
|
||||
different types of files, without knowing the key. A usable
|
||||
feature - but not really well defined.
|
||||
*/
|
||||
|
||||
rms_tag_type * rms_tag = rms_file_fread_alloc_tag(rms_file , "parameter" , NULL , NULL);
|
||||
const char * parameter_name = rms_tag_get_namekey_name(rms_tag);
|
||||
field_config_set_key( (field_config_type *) field->config , parameter_name );
|
||||
data_tag = rms_tagkey_copyc( rms_tag_get_key(rms_tag , "data") );
|
||||
rms_tag_free(rms_tag);
|
||||
bool field_fload_rms(field_type * field , const char * filename) {
|
||||
{
|
||||
FILE * stream = util_fopen__( filename , "r");
|
||||
if (!stream)
|
||||
return false;
|
||||
|
||||
fclose( stream );
|
||||
}
|
||||
|
||||
ecl_type = rms_tagkey_get_ecl_type(data_tag);
|
||||
if (rms_tagkey_get_size(data_tag) != field_config_get_volume(field->config))
|
||||
util_abort("%s: trying to import rms_data_tag from:%s with wrong size - aborting \n",__func__ , filename);
|
||||
|
||||
field_import3D(field , rms_tagkey_get_data_ref(data_tag) , true , ecl_type);
|
||||
rms_tagkey_free(data_tag);
|
||||
rms_file_free(rms_file);
|
||||
|
||||
{
|
||||
const char * key = field_config_get_ecl_kw_name(field->config);
|
||||
ecl_type_enum ecl_type;
|
||||
rms_file_type * rms_file = rms_file_alloc(filename , false);
|
||||
rms_tagkey_type * data_tag;
|
||||
if (field_config_enkf_mode(field->config))
|
||||
data_tag = rms_file_fread_alloc_data_tagkey(rms_file , "parameter" , "name" , key);
|
||||
else {
|
||||
/**
|
||||
Setting the key - purely to support converting between
|
||||
different types of files, without knowing the key. A usable
|
||||
feature - but not really well defined.
|
||||
*/
|
||||
|
||||
rms_tag_type * rms_tag = rms_file_fread_alloc_tag(rms_file , "parameter" , NULL , NULL);
|
||||
const char * parameter_name = rms_tag_get_namekey_name(rms_tag);
|
||||
field_config_set_key( (field_config_type *) field->config , parameter_name );
|
||||
data_tag = rms_tagkey_copyc( rms_tag_get_key(rms_tag , "data") );
|
||||
rms_tag_free(rms_tag);
|
||||
}
|
||||
|
||||
ecl_type = rms_tagkey_get_ecl_type(data_tag);
|
||||
if (rms_tagkey_get_size(data_tag) != field_config_get_volume(field->config))
|
||||
util_abort("%s: trying to import rms_data_tag from:%s with wrong size - aborting \n",__func__ , filename);
|
||||
|
||||
field_import3D(field , rms_tagkey_get_data_ref(data_tag) , true , ecl_type);
|
||||
rms_tagkey_free(data_tag);
|
||||
rms_file_free(rms_file);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void field_fload_ecl_kw(field_type * field , const char * filename ) {
|
||||
bool field_fload_ecl_kw(field_type * field , const char * filename ) {
|
||||
const char * key = field_config_get_ecl_kw_name(field->config);
|
||||
ecl_kw_type * ecl_kw;
|
||||
ecl_kw_type * ecl_kw = NULL;
|
||||
|
||||
{
|
||||
bool fmt_file;
|
||||
|
||||
if (ecl_util_fmt_file( filename , &fmt_file)) {
|
||||
fortio_type * fortio = fortio_open_reader(filename , fmt_file , ECL_ENDIAN_FLIP);
|
||||
ecl_kw_fseek_kw(key , true , true , fortio);
|
||||
ecl_kw = ecl_kw_fread_alloc( fortio );
|
||||
fortio_fclose(fortio);
|
||||
if (fortio) {
|
||||
ecl_kw_fseek_kw(key , true , true , fortio);
|
||||
ecl_kw = ecl_kw_fread_alloc( fortio );
|
||||
fortio_fclose(fortio);
|
||||
|
||||
if (field_config_get_volume(field->config) == ecl_kw_get_size(ecl_kw))
|
||||
field_import3D(field , ecl_kw_get_void_ptr(ecl_kw) , false , ecl_kw_get_type(ecl_kw));
|
||||
else
|
||||
/* Keyword is already packed - e.g. from a restart file. Size is
|
||||
verified in the _copy function.*/
|
||||
field_copy_ecl_kw_data(field , ecl_kw);
|
||||
|
||||
ecl_kw_free(ecl_kw);
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
util_abort("%s: could not determine formatted/unformatted status of file:%s \n",filename);
|
||||
}
|
||||
|
||||
|
||||
if (field_config_get_volume(field->config) == ecl_kw_get_size(ecl_kw))
|
||||
field_import3D(field , ecl_kw_get_void_ptr(ecl_kw) , false , ecl_kw_get_type(ecl_kw));
|
||||
else
|
||||
/* Keyword is already packed - e.g. from a restart file. Size is
|
||||
verified in the _copy function.*/
|
||||
field_copy_ecl_kw_data(field , ecl_kw);
|
||||
|
||||
ecl_kw_free(ecl_kw);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* No type translation possible */
|
||||
void field_fload_ecl_grdecl(field_type * field , const char * filename ) {
|
||||
bool field_fload_ecl_grdecl(field_type * field , const char * filename ) {
|
||||
const char * key = field_config_get_ecl_kw_name(field->config);
|
||||
int size = field_config_get_volume(field->config);
|
||||
ecl_type_enum ecl_type = field_config_get_ecl_type(field->config);
|
||||
ecl_kw_type * ecl_kw = NULL;
|
||||
{
|
||||
FILE * stream = util_fopen(filename , "r");
|
||||
if (ecl_kw_grdecl_fseek_kw(key , false , stream))
|
||||
ecl_kw = ecl_kw_fscanf_alloc_grdecl_data(stream , size , ecl_type);
|
||||
else
|
||||
util_exit("%s: Can not locate %s keyword in %s \n",__func__ , key , filename);
|
||||
fclose(stream);
|
||||
FILE * stream = util_fopen__(filename , "r");
|
||||
if (stream) {
|
||||
if (ecl_kw_grdecl_fseek_kw(key , false , stream))
|
||||
ecl_kw = ecl_kw_fscanf_alloc_grdecl_data(stream , size , ecl_type);
|
||||
else
|
||||
util_exit("%s: Can not locate %s keyword in %s \n",__func__ , key , filename);
|
||||
fclose(stream);
|
||||
|
||||
field_import3D(field , ecl_kw_get_void_ptr(ecl_kw) , false , ecl_kw_get_type(ecl_kw));
|
||||
ecl_kw_free(ecl_kw);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
field_import3D(field , ecl_kw_get_void_ptr(ecl_kw) , false , ecl_kw_get_type(ecl_kw));
|
||||
ecl_kw_free(ecl_kw);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void field_fload_typed(field_type * field , const char * filename , field_file_format_type file_type) {
|
||||
|
||||
bool field_fload_typed(field_type * field , const char * filename , field_file_format_type file_type) {
|
||||
bool loadOK = false;
|
||||
switch (file_type) {
|
||||
case(RMS_ROFF_FILE):
|
||||
field_fload_rms(field , filename );
|
||||
loadOK = field_fload_rms(field , filename );
|
||||
break;
|
||||
case(ECL_KW_FILE):
|
||||
field_fload_ecl_kw(field , filename );
|
||||
loadOK = field_fload_ecl_kw(field , filename );
|
||||
break;
|
||||
case(ECL_GRDECL_FILE):
|
||||
field_fload_ecl_grdecl(field , filename);
|
||||
loadOK = field_fload_ecl_grdecl(field , filename);
|
||||
break;
|
||||
default:
|
||||
util_abort("%s: file_type:%d not recognized - aborting \n",__func__ , file_type);
|
||||
}
|
||||
return loadOK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void field_fload(field_type * field , const char * filename ) {
|
||||
field_file_format_type file_type = field_config_guess_file_type( filename );
|
||||
if (file_type == UNDEFINED_FORMAT) file_type = field_config_manual_file_type(filename , true);
|
||||
field_fload_typed(field , filename , file_type);
|
||||
bool field_fload(field_type * field , const char * filename ) {
|
||||
if (util_file_readable( filename )) {
|
||||
field_file_format_type file_type = field_config_guess_file_type( filename );
|
||||
if (file_type == UNDEFINED_FORMAT)
|
||||
file_type = field_config_manual_file_type(filename , true);
|
||||
|
||||
return field_fload_typed(field , filename , file_type);
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void field_fload_auto(field_type * field , const char * filename ) {
|
||||
bool field_fload_auto(field_type * field , const char * filename ) {
|
||||
field_file_format_type file_type = field_config_guess_file_type(filename);
|
||||
field_fload_typed(field , filename , file_type);
|
||||
return field_fload_typed(field , filename , file_type);
|
||||
}
|
||||
|
||||
|
||||
@ -1145,19 +1171,6 @@ bool field_cmp(const field_type * f1 , const field_type * f2) {
|
||||
/*****************************************************************/
|
||||
|
||||
|
||||
/* /\* Skal param_name vaere en variabel ?? *\/ */
|
||||
/* void field_rms_export_parameter(const field_type * field , const char * param_name , const float * data3D, const rms_file_type * rms_file) { */
|
||||
/* const field_config_type * config = field->config; */
|
||||
/* const int data_size = field_config_get_data_size(config); */
|
||||
|
||||
/* /\* Hardcoded rms_float_type *\/ */
|
||||
/* rms_tagkey_type *tagkey = rms_tagkey_alloc_complete("data" , data_size , rms_float_type , data3D , true); */
|
||||
/* rms_tag_fwrite_parameter(param_name , tagkey , rms_file_get_FILE(rms_file)); */
|
||||
/* rms_tagkey_free(tagkey); */
|
||||
|
||||
/* } */
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -1330,7 +1343,7 @@ void field_imul_add(field_type * field1 , double factor , const field_type * fie
|
||||
}
|
||||
|
||||
|
||||
void field_update_sum(field_type * sum , const field_type * field , double lower_limit , double upper_limit) {
|
||||
void field_update_sum(field_type * sum , field_type * field , double lower_limit , double upper_limit) {
|
||||
field_output_transform( field );
|
||||
{
|
||||
const int data_size = field_config_get_data_size(field->config );
|
||||
@ -1370,10 +1383,12 @@ void field_update_sum(field_type * sum , const field_type * field , double lower
|
||||
*/
|
||||
bool field_user_get(const field_type * field, const char * index_key, int report_step , state_enum state, double * value)
|
||||
{
|
||||
printf("index_key : %s \n",index_key);
|
||||
const bool internal_value = false;
|
||||
bool valid;
|
||||
int i,j,k;
|
||||
int parse_user_key = field_config_parse_user_key(field->config , index_key , &i, &j , &k);
|
||||
|
||||
|
||||
if (parse_user_key == 0) {
|
||||
int active_index = field_config_active_index(field->config , i,j,k);
|
||||
|
10
ThirdParty/Ert/devel/libenkf/src/field_config.c
vendored
10
ThirdParty/Ert/devel/libenkf/src/field_config.c
vendored
@ -21,6 +21,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/string_util.h>
|
||||
|
||||
#include <ert/ecl/ecl_grid.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
@ -944,7 +945,7 @@ void field_config_assert_binary( const field_config_type * config1 , const field
|
||||
bool field_config_parse_user_key__( const char * index_key , int *i , int *j , int *k) {
|
||||
int length;
|
||||
{
|
||||
int_vector_type * indices = string_util_alloc_active_list( index_key );
|
||||
int_vector_type * indices = string_util_alloc_value_list( index_key );
|
||||
length = int_vector_size( indices );
|
||||
|
||||
if (length == 3) {
|
||||
@ -952,6 +953,8 @@ bool field_config_parse_user_key__( const char * index_key , int *i , int *j , i
|
||||
*j = int_vector_iget( indices , 1) - 1;
|
||||
*k = int_vector_iget( indices , 2) - 1;
|
||||
}
|
||||
|
||||
int_vector_fprintf( indices , stdout , "INDEXLIST" , " %4d");
|
||||
|
||||
int_vector_free( indices );
|
||||
}
|
||||
@ -965,9 +968,8 @@ bool field_config_parse_user_key__( const char * index_key , int *i , int *j , i
|
||||
|
||||
int field_config_parse_user_key(const field_config_type * config, const char * index_key , int *i , int *j , int *k) {
|
||||
int return_value = 0;
|
||||
|
||||
|
||||
if (field_config_parse_user_key__( index_key , i , j , k)) {
|
||||
|
||||
if(field_config_ijk_valid(config, *i, *j, *k)) {
|
||||
int active_index = field_config_active_index(config , *i,*j,*k);
|
||||
if (active_index < 0)
|
||||
@ -975,7 +977,7 @@ int field_config_parse_user_key(const field_config_type * config, const char * i
|
||||
} else
|
||||
return_value = 2; /* ijk is outside the grid. */
|
||||
} else
|
||||
return_value = 0;
|
||||
return_value = 1; /* Could not be parsed to three integers. */
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ void * gen_common_fread_alloc(const char * file , ecl_type_enum load_type , int
|
||||
int current_size = 0;
|
||||
int buffer_elements;
|
||||
int fread_return;
|
||||
void * buffer;
|
||||
char * buffer;
|
||||
|
||||
|
||||
buffer_elements = read_size;
|
||||
|
6
ThirdParty/Ert/devel/libenkf/src/gen_data.c
vendored
6
ThirdParty/Ert/devel/libenkf/src/gen_data.c
vendored
@ -305,13 +305,13 @@ bool gen_data_fload_with_report_step( gen_data_type * gen_data , const char * fi
|
||||
}
|
||||
gen_data_set_data__(gen_data , size , report_step , load_type , buffer );
|
||||
util_safe_free(buffer);
|
||||
printf("Returning %s:%d \n",filename , has_file);
|
||||
return has_file;
|
||||
}
|
||||
|
||||
|
||||
void gen_data_fload( gen_data_type * gen_data , const char * filename) {
|
||||
if (!gen_data_fload_with_report_step( gen_data , filename , 0))
|
||||
util_abort("%s: failed to load from filename:%s \n",__func__ , filename );
|
||||
bool gen_data_fload( gen_data_type * gen_data , const char * filename) {
|
||||
return gen_data_fload_with_report_step( gen_data , filename , 0);
|
||||
}
|
||||
|
||||
|
||||
|
104
ThirdParty/Ert/devel/libenkf/src/gen_kw.c
vendored
104
ThirdParty/Ert/devel/libenkf/src/gen_kw.c
vendored
@ -228,62 +228,66 @@ const char * gen_kw_get_name(const gen_kw_type * gen_kw, int kw_nr) {
|
||||
|
||||
*/
|
||||
|
||||
void gen_kw_fload(gen_kw_type * gen_kw , const char * filename) {
|
||||
const int size = gen_kw_config_get_data_size(gen_kw->config );
|
||||
FILE * stream = util_fopen( filename , "r");
|
||||
bool readOK = true;
|
||||
|
||||
/* First try reading all the data as one long vector. */
|
||||
{
|
||||
int index = 0;
|
||||
while ((index < size) && readOK) {
|
||||
double value;
|
||||
if (fscanf(stream,"%lg" , &value) == 1)
|
||||
gen_kw->data[index] = value;
|
||||
else
|
||||
readOK = false;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
OK - rewind and try again with interlaced key + value
|
||||
pairs. Observe that we still require that ALL the elements in the
|
||||
gen_kw instance are set, i.e. it is not allowed to read only some
|
||||
of the keywords; but the ordering is not relevant.
|
||||
|
||||
The code will be fooled (and give undefined erronous results) if
|
||||
the same key appears several times. Be polite!
|
||||
*/
|
||||
|
||||
if (!readOK) {
|
||||
int counter = 0;
|
||||
readOK = true;
|
||||
fseek( stream , 0 , SEEK_SET );
|
||||
bool gen_kw_fload(gen_kw_type * gen_kw , const char * filename) {
|
||||
FILE * stream = util_fopen__( filename , "r");
|
||||
if (stream) {
|
||||
const int size = gen_kw_config_get_data_size(gen_kw->config );
|
||||
bool readOK = true;
|
||||
|
||||
while ((counter < size) && readOK) {
|
||||
char key[128];
|
||||
double value;
|
||||
int fscanf_return = fscanf(stream , "%s %lg" , key , &value);
|
||||
|
||||
if (fscanf_return == 2) {
|
||||
int index = gen_kw_config_get_index(gen_kw->config , key);
|
||||
if (index >= 0)
|
||||
/* First try reading all the data as one long vector. */
|
||||
{
|
||||
int index = 0;
|
||||
while ((index < size) && readOK) {
|
||||
double value;
|
||||
if (fscanf(stream,"%lg" , &value) == 1)
|
||||
gen_kw->data[index] = value;
|
||||
else
|
||||
util_abort("%s: key:%s not recognized as part of GEN_KW instance - error when reading file:%s \n",__func__ , key , filename);
|
||||
counter++;
|
||||
} else {
|
||||
util_abort("%s: failed to read (key,value) pair at line:%d in file:%s \n",__func__ , util_get_current_linenr( stream ) , filename);
|
||||
readOK = false;
|
||||
readOK = false;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!readOK)
|
||||
util_abort("%s: failed loading from file:%s \n",__func__ , filename);
|
||||
|
||||
/*
|
||||
OK - rewind and try again with interlaced key + value
|
||||
pairs. Observe that we still require that ALL the elements in the
|
||||
gen_kw instance are set, i.e. it is not allowed to read only some
|
||||
of the keywords; but the ordering is not relevant.
|
||||
|
||||
The code will be fooled (and give undefined erronous results) if
|
||||
the same key appears several times. Be polite!
|
||||
*/
|
||||
|
||||
if (!readOK) {
|
||||
int counter = 0;
|
||||
readOK = true;
|
||||
fseek( stream , 0 , SEEK_SET );
|
||||
|
||||
while ((counter < size) && readOK) {
|
||||
char key[128];
|
||||
double value;
|
||||
int fscanf_return = fscanf(stream , "%s %lg" , key , &value);
|
||||
|
||||
if (fscanf_return == 2) {
|
||||
int index = gen_kw_config_get_index(gen_kw->config , key);
|
||||
if (index >= 0)
|
||||
gen_kw->data[index] = value;
|
||||
else
|
||||
util_abort("%s: key:%s not recognized as part of GEN_KW instance - error when reading file:%s \n",__func__ , key , filename);
|
||||
counter++;
|
||||
} else {
|
||||
util_abort("%s: failed to read (key,value) pair at line:%d in file:%s \n",__func__ , util_get_current_linenr( stream ) , filename);
|
||||
readOK = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!readOK)
|
||||
util_abort("%s: failed loading from file:%s \n",__func__ , filename);
|
||||
|
||||
fclose(stream);
|
||||
fclose(stream);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
2
ThirdParty/Ert/devel/libenkf/src/gen_obs.c
vendored
2
ThirdParty/Ert/devel/libenkf/src/gen_obs.c
vendored
@ -165,7 +165,7 @@ static void gen_obs_load_observation(gen_obs_type * gen_obs, double scalar_value
|
||||
*/
|
||||
|
||||
|
||||
gen_obs_type * gen_obs_alloc(const gen_data_config_type * data_config , const char * obs_key , const char * obs_file , double scalar_value , double scalar_error , const char * data_index_file , const char * data_index_string , const char * error_covar_file) {
|
||||
gen_obs_type * gen_obs_alloc(gen_data_config_type * data_config , const char * obs_key , const char * obs_file , double scalar_value , double scalar_error , const char * data_index_file , const char * data_index_string , const char * error_covar_file) {
|
||||
gen_obs_type * obs = util_malloc(sizeof * obs);
|
||||
|
||||
UTIL_TYPE_ID_INIT( obs , GEN_OBS_TYPE_ID );
|
||||
|
@ -201,7 +201,6 @@ void misfit_ensemble_fread( misfit_ensemble_type * misfit_ensemble , FILE * stre
|
||||
|
||||
}
|
||||
misfit_ensemble->initialized = true;
|
||||
return misfit_ensemble;
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ misfit_member_type * misfit_member_fread_alloc( FILE * stream ) {
|
||||
{
|
||||
int iobs;
|
||||
for (iobs = 0; iobs < hash_size; iobs++) {
|
||||
const char * key = util_fread_alloc_string( stream );
|
||||
char * key = util_fread_alloc_string( stream );
|
||||
misfit_ts_type * misfit_ts = misfit_ts_fread_alloc( stream );
|
||||
misfit_member_install_vector( node , key , misfit_ts );
|
||||
free( key );
|
||||
|
11
ThirdParty/Ert/devel/libenkf/src/misfit_ts.c
vendored
11
ThirdParty/Ert/devel/libenkf/src/misfit_ts.c
vendored
@ -78,17 +78,6 @@ void misfit_ts_free__( void * vector ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Will return the sum over the half-open interval [step1, step2).
|
||||
*/
|
||||
|
||||
static double misfit_ts_sum( const misfit_ts_type * vector , int step1 , int step2 ) {
|
||||
double sum = 0;
|
||||
const double * data = double_vector_get_const_ptr( vector->data );
|
||||
for (int step = step1; step < step2; step++)
|
||||
sum += data[step];
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
void misfit_ts_iset( misfit_ts_type * vector , int time_index , double value ) {
|
||||
|
12
ThirdParty/Ert/devel/libenkf/src/obs_vector.c
vendored
12
ThirdParty/Ert/devel/libenkf/src/obs_vector.c
vendored
@ -607,18 +607,18 @@ obs_vector_type * obs_vector_alloc_from_BLOCK_OBSERVATION(const conf_instance_ty
|
||||
const ecl_grid_type * grid ,
|
||||
const ecl_sum_type * refcase ,
|
||||
const history_type * history,
|
||||
const ensemble_config_type * ensemble_config,
|
||||
ensemble_config_type * ensemble_config,
|
||||
const time_t_vector_type * obs_time) {
|
||||
|
||||
if(!conf_instance_is_of_class(conf_instance, "BLOCK_OBSERVATION"))
|
||||
util_abort("%s: internal error. expected \"BLOCK_OBSERVATION\" instance, got \"%s\".\n",
|
||||
__func__, conf_instance_get_class_name_ref(conf_instance) );
|
||||
|
||||
block_obs_source_type source_type;
|
||||
const char * obs_label = conf_instance_get_name_ref(conf_instance);
|
||||
const char * source_string = conf_instance_get_item_value_ref(conf_instance , "SOURCE");
|
||||
const char * field_name = conf_instance_get_item_value_ref(conf_instance , "FIELD");
|
||||
char * sum_kw = NULL;
|
||||
block_obs_source_type source_type = SOURCE_SUMMARY;
|
||||
const char * obs_label = conf_instance_get_name_ref(conf_instance);
|
||||
const char * source_string = conf_instance_get_item_value_ref(conf_instance , "SOURCE");
|
||||
const char * field_name = conf_instance_get_item_value_ref(conf_instance , "FIELD");
|
||||
const char * sum_kw = NULL;
|
||||
bool OK = true;
|
||||
|
||||
if (strcmp(source_string , "FIELD") == 0) {
|
||||
|
2
ThirdParty/Ert/devel/libenkf/src/qc_module.c
vendored
2
ThirdParty/Ert/devel/libenkf/src/qc_module.c
vendored
@ -117,7 +117,7 @@ void qc_module_set_workflow( qc_module_type * qc_module , const char * qc_workfl
|
||||
}
|
||||
|
||||
|
||||
bool qc_module_run_workflow( qc_module_type * qc_module , void * self) {
|
||||
bool qc_module_run_workflow( const qc_module_type * qc_module , void * self) {
|
||||
bool verbose = false;
|
||||
if (qc_module->qc_workflow != NULL ) {
|
||||
if (!util_file_exists( qc_module->runpath_list_file ))
|
||||
|
15
ThirdParty/Ert/devel/libenkf/src/site_config.c
vendored
15
ThirdParty/Ert/devel/libenkf/src/site_config.c
vendored
@ -37,6 +37,7 @@
|
||||
#include <ert/config/config.h>
|
||||
#include <ert/config/config_content_item.h>
|
||||
#include <ert/config/config_content_node.h>
|
||||
#include <ert/config/config_schema_item.h>
|
||||
|
||||
#include <ert/enkf/site_config.h>
|
||||
#include <ert/enkf/enkf_defaults.h>
|
||||
@ -981,13 +982,13 @@ void site_config_fprintf_config(const site_config_type * site_config, FILE * str
|
||||
}
|
||||
|
||||
{
|
||||
queue_driver_type * rsh_driver = site_config_get_queue_driver(site_config, RSH_DRIVER_NAME);
|
||||
hash_type * host_list = queue_driver_get_option(rsh_driver, RSH_HOSTLIST);
|
||||
hash_iter_type * iter = hash_iter_alloc(host_list);
|
||||
while (!hash_iter_is_complete(iter)) {
|
||||
const char * host_name = hash_iter_get_next_key(iter);
|
||||
fprintf(stream, CONFIG_KEY_FORMAT, RSH_HOST_KEY);
|
||||
fprintf(stream, "%s:%d\n", host_name, hash_get_int(host_list, host_name));
|
||||
queue_driver_type * rsh_driver = site_config_get_queue_driver( site_config , RSH_DRIVER_NAME );
|
||||
hash_type * host_list = hash_safe_cast( (void *) queue_driver_get_option( rsh_driver , RSH_HOSTLIST ) );
|
||||
hash_iter_type * iter = hash_iter_alloc( host_list );
|
||||
while (!hash_iter_is_complete( iter )) {
|
||||
const char * host_name = hash_iter_get_next_key( iter );
|
||||
fprintf(stream , CONFIG_KEY_FORMAT , RSH_HOST_KEY );
|
||||
fprintf(stream , "%s:%d\n" , host_name , hash_get_int( host_list , host_name));
|
||||
}
|
||||
hash_iter_free(iter);
|
||||
}
|
||||
|
1
ThirdParty/Ert/devel/libenkf/src/summary.c
vendored
1
ThirdParty/Ert/devel/libenkf/src/summary.c
vendored
@ -312,7 +312,6 @@ bool summary_forward_load_vector(summary_type * summary , const char * ecl_file_
|
||||
if (ecl_sum != NULL) {
|
||||
double_vector_type * storage_vector = SELECT_VECTOR( summary , FORECAST );
|
||||
const char * var_key = summary_config_get_var(summary->config);
|
||||
const ecl_smspec_var_type var_type = summary_config_get_var_type(summary->config , ecl_sum);
|
||||
load_fail_type load_fail_action = summary_config_get_load_fail_mode(summary->config );
|
||||
bool normal_load = false;
|
||||
|
||||
|
6
ThirdParty/Ert/devel/libenkf/src/surface.c
vendored
6
ThirdParty/Ert/devel/libenkf/src/surface.c
vendored
@ -52,9 +52,9 @@ void surface_clear(surface_type * surface) {
|
||||
surface->data[k] = 0;
|
||||
}
|
||||
|
||||
static void surface_fload( surface_type * surface , const char * filename ) {
|
||||
bool surface_fload( surface_type * surface , const char * filename ) {
|
||||
const geo_surface_type * base_surface = surface_config_get_base_surface( surface->config );
|
||||
geo_surface_fload_irap_zcoord( base_surface , filename , surface->data );
|
||||
return geo_surface_fload_irap_zcoord( base_surface , filename , surface->data );
|
||||
}
|
||||
|
||||
|
||||
@ -225,4 +225,4 @@ VOID_SCALE(surface)
|
||||
VOID_IMUL(surface)
|
||||
VOID_IADDSQR(surface)
|
||||
VOID_ISQRT(surface)
|
||||
|
||||
VOID_FLOAD(surface)
|
||||
|
37
ThirdParty/Ert/devel/libenkf/src/trans_func.c
vendored
37
ThirdParty/Ert/devel/libenkf/src/trans_func.c
vendored
@ -70,16 +70,6 @@ static double trans_errf(double x, const arg_pack_type * arg) {
|
||||
}
|
||||
|
||||
|
||||
static void trans_errf_check(const char * func_name , const arg_pack_type * arg) {
|
||||
double width = arg_pack_iget_double(arg , 3);
|
||||
if (width <= 0)
|
||||
util_exit("In function:%s the witdh must be > 0.",func_name);
|
||||
}
|
||||
|
||||
|
||||
static double trans_none(double x , const arg_pack_type * arg) {
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
static double trans_const(double x , const arg_pack_type * arg) {
|
||||
@ -101,17 +91,6 @@ static double trans_derrf(double x , const arg_pack_type * arg) {
|
||||
}
|
||||
|
||||
|
||||
static void trans_derrf_check(const char * func_name , const arg_pack_type * arg) {
|
||||
int steps = arg_pack_iget_int(arg , 0);
|
||||
double width = arg_pack_iget_double(arg , 4);
|
||||
if (width <= 0)
|
||||
util_exit("In function:%s the witdh must be > 0.",func_name);
|
||||
|
||||
if (steps <= 1)
|
||||
util_exit("In function:%s the number of steps must be greater than 1.",func_name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -136,13 +115,6 @@ static double trans_dunif(double x , const arg_pack_type * arg) {
|
||||
}
|
||||
|
||||
|
||||
static void trans_dunif_check(const char * func_name , const arg_pack_type * arg) {
|
||||
int steps = arg_pack_iget_int(arg , 0);
|
||||
|
||||
if (steps <= 1)
|
||||
util_exit("When using function:%s steps must be > 1 \n",func_name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static double trans_normal(double x , const arg_pack_type * arg) {
|
||||
@ -181,15 +153,6 @@ static double trans_logunif(double x , const arg_pack_type * arg) {
|
||||
}
|
||||
|
||||
|
||||
static void trans_logunif_check(const char * func_name , const arg_pack_type * arg) {
|
||||
|
||||
double min = arg_pack_iget_double(arg , 0);
|
||||
double max = arg_pack_iget_double(arg , 1);
|
||||
if (min >= max )
|
||||
util_exit("When using:%s frist argument must be less than second.\n",func_name);
|
||||
if(min <= 0)
|
||||
util_exit("When using:%s both arguments must be greater than zero.\n",func_name);
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
|
@ -17,6 +17,57 @@ add_executable( enkf_main enkf_main.c )
|
||||
target_link_libraries( enkf_main enkf )
|
||||
add_test( enkf_main ${EXECUTABLE_OUTPUT_PATH}/enkf_main )
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
add_executable( enkf_forward_init_GEN_KW enkf_forward_init_GEN_KW.c )
|
||||
target_link_libraries( enkf_forward_init_GEN_KW enkf )
|
||||
add_test( enkf_forward_init_GEN_KW_TRUE ${EXECUTABLE_OUTPUT_PATH}/enkf_forward_init_GEN_KW ${CMAKE_CURRENT_SOURCE_DIR}/data/config/forward/config_GEN_KW_true TRUE)
|
||||
add_test( enkf_forward_init_GEN_KW_FALSE ${EXECUTABLE_OUTPUT_PATH}/enkf_forward_init_GEN_KW ${CMAKE_CURRENT_SOURCE_DIR}/data/config/forward/config_GEN_KW_false FALSE)
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
add_executable( enkf_forward_init_GEN_PARAM enkf_forward_init_GEN_PARAM.c )
|
||||
target_link_libraries( enkf_forward_init_GEN_PARAM enkf )
|
||||
add_test( enkf_forward_init_GEN_PARAM_TRUE ${EXECUTABLE_OUTPUT_PATH}/enkf_forward_init_GEN_PARAM ${CMAKE_CURRENT_SOURCE_DIR}/data/config/forward/config_GEN_PARAM_true TRUE)
|
||||
add_test( enkf_forward_init_GEN_PARAM_FALSE ${EXECUTABLE_OUTPUT_PATH}/enkf_forward_init_GEN_PARAM ${CMAKE_CURRENT_SOURCE_DIR}/data/config/forward/config_GEN_PARAM_false FALSE)
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
add_executable( enkf_forward_init_SURFACE enkf_forward_init_SURFACE.c )
|
||||
target_link_libraries( enkf_forward_init_SURFACE enkf )
|
||||
|
||||
add_test( enkf_forward_init_SURFACE_TRUE
|
||||
${EXECUTABLE_OUTPUT_PATH}/enkf_forward_init_SURFACE
|
||||
${PROJECT_SOURCE_DIR}/test-data/Statoil/config/forward_init/surface/config_surface_true
|
||||
${PROJECT_SOURCE_DIR}/test-data/Statoil/config/forward_init/surface/Surface.irap
|
||||
TRUE)
|
||||
|
||||
add_test( enkf_forward_init_SURFACE_FALSE
|
||||
${EXECUTABLE_OUTPUT_PATH}/enkf_forward_init_SURFACE
|
||||
${PROJECT_SOURCE_DIR}/test-data/Statoil/config/forward_init/surface/config_surface_false
|
||||
${PROJECT_SOURCE_DIR}/test-data/Statoil/config/forward_init/surface/Surface.irap
|
||||
FALSE)
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
add_executable( enkf_forward_init_FIELD enkf_forward_init_FIELD.c )
|
||||
target_link_libraries( enkf_forward_init_FIELD enkf )
|
||||
|
||||
add_test( enkf_forward_init_FIELD_TRUE
|
||||
${EXECUTABLE_OUTPUT_PATH}/enkf_forward_init_FIELD
|
||||
${PROJECT_SOURCE_DIR}/test-data/Statoil/config/forward_init/field/config_field_true
|
||||
${PROJECT_SOURCE_DIR}/test-data/Statoil/config/forward_init/field/petro.grdecl
|
||||
TRUE)
|
||||
|
||||
add_test( enkf_forward_init_FIELD_FALSE
|
||||
${EXECUTABLE_OUTPUT_PATH}/enkf_forward_init_FIELD
|
||||
${PROJECT_SOURCE_DIR}/test-data/Statoil/config/forward_init/field/config_field_false
|
||||
${PROJECT_SOURCE_DIR}/test-data/Statoil/config/forward_init/field/petro.grdecl
|
||||
FALSE)
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
||||
add_executable( enkf_iter_config enkf_iter_config.c )
|
||||
target_link_libraries( enkf_iter_config enkf )
|
||||
add_test( enkf_iter_config ${EXECUTABLE_OUTPUT_PATH}/enkf_iter_config )
|
||||
@ -62,4 +113,8 @@ add_test( enkf_ensemble ${EXECUTABLE_OUTPUT_PATH}/enkf_ensemble )
|
||||
|
||||
set_property( TEST enkf_time_map2 PROPERTY LABELS Statoil )
|
||||
set_property( TEST enkf_site_config PROPERTY LABELS Statoil )
|
||||
set_property( TEST enkf_forward_init_SURFACE_FALSE PROPERTY LABELS Statoil )
|
||||
set_property( TEST enkf_forward_init_SURFACE_TRUE PROPERTY LABELS Statoil )
|
||||
set_property( TEST enkf_forward_init_FIELD_FALSE PROPERTY LABELS Statoil )
|
||||
set_property( TEST enkf_forward_init_FIELD_TRUE PROPERTY LABELS Statoil )
|
||||
|
||||
|
1
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/FAULT_TEMPLATE
vendored
Normal file
1
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/FAULT_TEMPLATE
vendored
Normal file
@ -0,0 +1 @@
|
||||
<MULTFLT>
|
1
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/MULTFLT.TXT
vendored
Normal file
1
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/MULTFLT.TXT
vendored
Normal file
@ -0,0 +1 @@
|
||||
MULTFLT NORMAL 0 1
|
8
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/config_GEN_KW_false
vendored
Normal file
8
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/config_GEN_KW_false
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
JOBNAME Job%d
|
||||
RUNPATH /tmp/simulations/run%d
|
||||
NUM_REALIZATIONS 1
|
||||
|
||||
ENSPATH /tmp/Storage
|
||||
JOB_SCRIPT script.sh
|
||||
|
||||
GEN_KW MULTFLT FAULT_TEMPLATE MULTFLT.INC MULTFLT.TXT INIT_FILES:MULTFLT_INIT
|
8
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/config_GEN_KW_true
vendored
Normal file
8
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/config_GEN_KW_true
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
JOBNAME Job%d
|
||||
RUNPATH /tmp/simulations/run%d
|
||||
NUM_REALIZATIONS 1
|
||||
|
||||
ENSPATH /tmp/Storage
|
||||
JOB_SCRIPT script.sh
|
||||
|
||||
GEN_KW MULTFLT FAULT_TEMPLATE MULTFLT.INC MULTFLT.TXT INIT_FILES:MULTFLT_INIT FORWARD_INIT:TRUE
|
9
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/config_GEN_PARAM_false
vendored
Normal file
9
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/config_GEN_PARAM_false
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
JOBNAME Job%d
|
||||
RUNPATH /tmp/simulations/run%d
|
||||
NUM_REALIZATIONS 1
|
||||
|
||||
ENSPATH /tmp/Storage
|
||||
JOB_SCRIPT script.sh
|
||||
|
||||
|
||||
GEN_PARAM PARAM PARAM.INC INIT_FILES:PARAM_INIT INPUT_FORMAT:ASCII OUTPUT_FORMAT:ASCII
|
9
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/config_GEN_PARAM_true
vendored
Normal file
9
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/config_GEN_PARAM_true
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
JOBNAME Job%d
|
||||
RUNPATH /tmp/simulations/run%d
|
||||
NUM_REALIZATIONS 1
|
||||
|
||||
ENSPATH /tmp/Storage
|
||||
JOB_SCRIPT script.sh
|
||||
|
||||
|
||||
GEN_PARAM PARAM PARAM.INC INIT_FILES:PARAM_INIT INPUT_FORMAT:ASCII OUTPUT_FORMAT:ASCII FORWARD_INIT:TRUE
|
1
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/script.sh
vendored
Normal file
1
ThirdParty/Ert/devel/libenkf/tests/data/config/forward/script.sh
vendored
Normal file
@ -0,0 +1 @@
|
||||
# Completlely stupid - an executable must be present for the testing.
|
156
ThirdParty/Ert/devel/libenkf/tests/enkf_forward_init_FIELD.c
vendored
Normal file
156
ThirdParty/Ert/devel/libenkf/tests/enkf_forward_init_FIELD.c
vendored
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
Copyright (C) 2013 Statoil ASA, Norway.
|
||||
|
||||
The file 'enkf_forward_init_FIELD.c' is part of ERT - Ensemble based Reservoir Tool.
|
||||
|
||||
ERT is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
for more details.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ert/util/test_util.h>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/thread_pool.h>
|
||||
#include <ert/util/arg_pack.h>
|
||||
|
||||
#include <ert/enkf/enkf_main.h>
|
||||
|
||||
|
||||
void create_runpath(enkf_main_type * enkf_main ) {
|
||||
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
|
||||
bool_vector_type * iactive = bool_vector_alloc(0,false);
|
||||
|
||||
state_enum init_state = ANALYZED;
|
||||
int start_report = 0;
|
||||
int init_step_parameters = 0;
|
||||
bool_vector_iset( iactive , ens_size - 1 , true );
|
||||
enkf_main_run_exp(enkf_main , iactive , false , init_step_parameters , start_report , init_state);
|
||||
bool_vector_free(iactive);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc , char ** argv) {
|
||||
enkf_main_install_SIGNALS();
|
||||
{
|
||||
const char * config_file = argv[1];
|
||||
const char * init_file = argv[2];
|
||||
const char * forward_init_string = argv[3];
|
||||
bool forward_init;
|
||||
bool strict = true;
|
||||
enkf_main_type * enkf_main;
|
||||
|
||||
test_assert_true( util_sscanf_bool( forward_init_string , &forward_init));
|
||||
|
||||
util_clear_directory( "/tmp/Storage" , true , true );
|
||||
enkf_main = enkf_main_bootstrap( NULL , config_file , strict , true );
|
||||
{
|
||||
enkf_state_type * state = enkf_main_iget_state( enkf_main , 0 );
|
||||
enkf_node_type * field_node = enkf_state_get_node( state , "PORO" );
|
||||
{
|
||||
const enkf_config_node_type * field_config_node = enkf_node_get_config( field_node );
|
||||
char * init_file1 = enkf_config_node_alloc_initfile( field_config_node , NULL , 0);
|
||||
char * init_file2 = enkf_config_node_alloc_initfile( field_config_node , "/tmp", 0);
|
||||
|
||||
test_assert_bool_equal( enkf_config_node_use_forward_init( field_config_node ) , forward_init );
|
||||
test_assert_string_equal( init_file1 , "petro.grdecl");
|
||||
test_assert_string_equal( init_file2 , "/tmp/petro.grdecl");
|
||||
|
||||
free( init_file1 );
|
||||
free( init_file2 );
|
||||
}
|
||||
|
||||
test_assert_bool_equal( enkf_node_use_forward_init( field_node ) , forward_init );
|
||||
if (forward_init)
|
||||
test_assert_bool_not_equal( enkf_node_initialize( field_node , 0 , enkf_state_get_rng( state )) , forward_init);
|
||||
// else hard_failure()
|
||||
}
|
||||
test_assert_bool_equal( forward_init, ensemble_config_have_forward_init( enkf_main_get_ensemble_config( enkf_main )));
|
||||
|
||||
if (forward_init) {
|
||||
enkf_state_type * state = enkf_main_iget_state( enkf_main , 0 );
|
||||
enkf_fs_type * fs = enkf_main_get_fs( enkf_main );
|
||||
enkf_node_type * field_node = enkf_state_get_node( state , "PORO" );
|
||||
node_id_type node_id = {.report_step = 0 ,
|
||||
.iens = 0,
|
||||
.state = ANALYZED };
|
||||
|
||||
create_runpath( enkf_main );
|
||||
test_assert_true( util_is_directory( "/tmp/simulations/run0" ));
|
||||
|
||||
{
|
||||
bool loadOK = true;
|
||||
stringlist_type * msg_list = stringlist_alloc_new();
|
||||
|
||||
{
|
||||
run_mode_type run_mode = ENSEMBLE_EXPERIMENT;
|
||||
enkf_main_init_run(enkf_main , run_mode); /* This is ugly */
|
||||
}
|
||||
|
||||
|
||||
test_assert_false( enkf_node_has_data( field_node , fs, node_id ));
|
||||
|
||||
util_unlink_existing( "/tmp/simulations/run0/petro.grdecl" );
|
||||
|
||||
test_assert_false( enkf_node_forward_init( field_node , "/tmp/simulations/run0" , 0 ));
|
||||
enkf_state_forward_init( state , fs , &loadOK );
|
||||
test_assert_false( loadOK );
|
||||
|
||||
loadOK = true;
|
||||
enkf_state_load_from_forward_model( state , fs , &loadOK , false , msg_list );
|
||||
stringlist_free( msg_list );
|
||||
test_assert_false( loadOK );
|
||||
}
|
||||
|
||||
|
||||
util_copy_file( init_file , "/tmp/simulations/run0/petro.grdecl");
|
||||
{
|
||||
bool loadOK = true;
|
||||
stringlist_type * msg_list = stringlist_alloc_new();
|
||||
|
||||
{
|
||||
run_mode_type run_mode = ENSEMBLE_EXPERIMENT;
|
||||
enkf_main_init_run(enkf_main , run_mode); /* This is ugly */
|
||||
}
|
||||
|
||||
test_assert_true( enkf_node_forward_init( field_node , "/tmp/simulations/run0" , 0));
|
||||
enkf_state_forward_init( state , fs , &loadOK );
|
||||
test_assert_true( loadOK );
|
||||
enkf_state_load_from_forward_model( state , fs , &loadOK , false , msg_list );
|
||||
stringlist_free( msg_list );
|
||||
test_assert_true( loadOK );
|
||||
|
||||
{
|
||||
double value;
|
||||
test_assert_true( enkf_node_user_get( field_node , fs , "5,5,5" , node_id , &value));
|
||||
test_assert_double_equal( 0.28485405445 , value);
|
||||
}
|
||||
}
|
||||
util_clear_directory( "/tmp/simulations" , true , true );
|
||||
create_runpath( enkf_main );
|
||||
test_assert_true( util_is_directory( "/tmp/simulations/run0" ));
|
||||
test_assert_true( util_is_file( "/tmp/simulations/run0/PORO.grdecl" ));
|
||||
test_assert_true( enkf_node_fload( field_node , "/tmp/simulations/run0/PORO.grdecl"));
|
||||
{
|
||||
double value;
|
||||
test_assert_true( enkf_node_user_get( field_node , fs , "4,4,4" , node_id , &value));
|
||||
test_assert_double_equal( 0.130251303315 , value);
|
||||
}
|
||||
util_clear_directory( "/tmp/simulations" , true , true );
|
||||
}
|
||||
enkf_main_free( enkf_main );
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user