Skip to content

Commit

Permalink
Merge pull request Ensembles#1474 from joakim-hove/reduce-ensemble-use
Browse files Browse the repository at this point in the history
Reduce ensemble use
  • Loading branch information
joakim-hove authored Apr 5, 2017
2 parents 2a7b911 + 3e5ad73 commit 2eee47a
Show file tree
Hide file tree
Showing 9 changed files with 825 additions and 955 deletions.
72 changes: 0 additions & 72 deletions libenkf/applications/ert_tui/enkf_tui_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,77 +585,6 @@ void enkf_tui_export_scalar2csv(void * arg) {

/*****************************************************************/

void enkf_tui_export_stat(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_config_node_type * config_node;
const int ens_size = enkf_main_get_ensemble_size( enkf_main );
const int last_report = enkf_main_get_history_length( enkf_main );
int report_step;

config_node = enkf_tui_util_scanf_key( ensemble_config , PROMPT_LEN , INVALID , INVALID_VAR );
report_step = util_scanf_int_with_limits("Report step: ", PROMPT_LEN , 0 , last_report);
{
char * mean_file , * mean_path;
char * std_file , * std_path;

util_printf_prompt("Filename to store mean in " , PROMPT_LEN , '=' , "=> ");
{
char * tmp = util_alloc_stdin_line();
char * mean_base , * mean_ext;
util_alloc_file_components( tmp , &mean_path , &mean_base , &mean_ext );
if (mean_path != NULL)
util_make_path( mean_path );
mean_file = util_alloc_filename( NULL , mean_base , mean_ext );
util_safe_free( mean_base );
util_safe_free( mean_ext );
free( tmp );
}

util_printf_prompt("Filename to store std in " , PROMPT_LEN , '=' , "=> ");
{
char * tmp = util_alloc_stdin_line();
char * std_base , * std_ext;
util_alloc_file_components( tmp , &std_path , &std_base , &std_ext );
if (std_path != NULL)
util_make_path( std_path );
std_file = util_alloc_filename( NULL , std_base , std_ext );
util_safe_free( std_base );
util_safe_free( std_ext );
free( tmp );
}

{
enkf_node_type ** ensemble = enkf_main_get_node_ensemble( enkf_main ,
enkf_main_tui_get_fs( enkf_main ) ,
enkf_config_node_get_key( config_node ) ,
report_step );
enkf_node_type * mean = enkf_node_copyc( ensemble[0] );
enkf_node_type * std = enkf_node_copyc( ensemble[0] );

/* Calculating */
enkf_main_node_mean( (const enkf_node_type **) ensemble , ens_size , mean );
enkf_main_node_std( (const enkf_node_type **) ensemble , ens_size , mean , std );

{
ecl_write_ftype * ecl_write_func = enkf_node_get_func_pointer( mean );
ecl_write_func( enkf_node_value_ptr( mean ) , mean_path , mean_file , NULL );
ecl_write_func( enkf_node_value_ptr( std ) , std_path , std_file , NULL );
}

free( ensemble );
util_safe_free( std_file );
util_safe_free( std_path );
util_safe_free( mean_file );
util_safe_free( mean_path );
enkf_node_free( mean );
enkf_node_free( std );
}
}
}
}




Expand All @@ -678,7 +607,6 @@ void enkf_tui_export_menu(void * arg) {
menu_add_separator(menu);
menu_add_item(menu , "Export GEN_DATA/GEN_PARAM to file" , "dD" , enkf_tui_export_gen_data , enkf_main , NULL);
menu_add_separator( menu );
menu_add_item(menu , "EclWrite mean and std" , "mM" , enkf_tui_export_stat , enkf_main , NULL );
menu_add_item(menu , "Help" , "hH" , enkf_tui_help_menu_export , enkf_main , NULL );
menu_run(menu);
menu_free(menu);
Expand Down
10 changes: 0 additions & 10 deletions libenkf/include/ert/enkf/enkf_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ extern "C" {
const char * enkf_main_get_user_config_file( const enkf_main_type * enkf_main );
void enkf_main_set_rft_config_file( enkf_main_type * enkf_main , const char * rft_config_file );
const char * enkf_main_get_rft_config_file( const enkf_main_type * enkf_main );
bool enkf_main_get_pre_clear_runpath( const enkf_main_type * enkf_main );
void enkf_main_set_pre_clear_runpath( enkf_main_type * enkf_main , bool pre_clear_runpath);
bool enkf_main_set_refcase( enkf_main_type * enkf_main , const char * refcase_path);
ui_return_type * enkf_main_validata_refcase( const enkf_main_type * enkf_main , const char * refcase_path);

Expand All @@ -85,7 +83,6 @@ extern "C" {
void enkf_main_set_log_level( enkf_main_type * enkf_main , int log_level );
int enkf_main_get_log_level( const enkf_main_type * enkf_main );

member_config_type * enkf_main_iget_member_config(const enkf_main_type * enkf_main , int iens);
void enkf_main_del_unused_static(enkf_main_type * , int );
const char * enkf_main_get_data_file(const enkf_main_type * );
const char ** enkf_main_get_well_list_ref(const enkf_main_type * , int *);
Expand Down Expand Up @@ -125,14 +122,9 @@ extern "C" {
enkf_main_type * enkf_main_bootstrap(const char * model_config, bool strict, bool verbose);
void enkf_main_create_new_config( const char * config_file , const char * storage_path , const char * dbase_type , int num_realizations);

enkf_node_type ** enkf_main_get_node_ensemble(const enkf_main_type * enkf_main , enkf_fs_type * src_fs , const char * key , int report_step);
void enkf_main_node_mean( const enkf_node_type ** ensemble , int ens_size , enkf_node_type * mean );
void enkf_main_node_std( const enkf_node_type ** ensemble , int ens_size , const enkf_node_type * mean , enkf_node_type * std);

ert_impl_type enkf_main_impl_type(const enkf_main_type *, const char * );
enkf_state_type * enkf_main_iget_state(const enkf_main_type * , int );
enkf_state_type ** enkf_main_get_ensemble( enkf_main_type * enkf_main);
const enkf_state_type ** enkf_main_get_ensemble_const( const enkf_main_type * enkf_main);

const enkf_config_node_type * enkf_main_get_config_node(const enkf_main_type * , const char *);
const sched_file_type * enkf_main_get_sched_file(const enkf_main_type *);
Expand Down Expand Up @@ -177,9 +169,7 @@ extern "C" {
void enkf_main_install_SIGNALS(void);
const char * enkf_main_get_SVN_VERSION( void );
const char * enkf_main_get_COMPILE_TIME( void );
void enkf_main_del_node(enkf_main_type * enkf_main , const char * key);
void enkf_main_add_node(enkf_main_type * enkf_main, enkf_config_node_type * enkf_config_node);
void enkf_main_update_node( enkf_main_type * enkf_main , const char * key );
int_vector_type * enkf_main_update_alloc_step_list( const enkf_main_type * enkf_main , int load_start , int step2 , int stride);

hook_manager_type * enkf_main_get_hook_manager( const enkf_main_type * enkf_main );
Expand Down
1 change: 0 additions & 1 deletion libenkf/include/ert/enkf/enkf_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ typedef struct enkf_state_struct enkf_state_type;
const ecl_config_type * ,
ert_templates_type * templates,
subst_list_type * parent_subst);
void enkf_state_update_node( enkf_state_type * enkf_state , const char * node_key );
void enkf_state_update_jobname( enkf_state_type * enkf_state );
void enkf_state_update_eclbase( enkf_state_type * enkf_state );
void enkf_state_add_node(enkf_state_type * , const char * , const enkf_config_node_type * );
Expand Down
Loading

0 comments on commit 2eee47a

Please sign in to comment.