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) { for (int i=0; i < config_content_item_get_size(item); i++) { const config_content_node_type * node = config_content_item_iget_node( item , i ); enkf_config_node_type * config_node = enkf_config_node_alloc_GEN_PARAM_from_config( node ); if (config_node) ensemble_config_add_node( ensemble_config , config_node ); } } }
void ensemble_config_init_GEN_DATA( ensemble_config_type * ensemble_config , const config_type * config) { 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 ); enkf_config_node_type * config_node = enkf_config_node_alloc_GEN_DATA_from_config( node ); if (config_node) ensemble_config_add_node( ensemble_config , config_node ); } } }
/* If key == NULL the function will create a random key. */ enkf_config_node_type * ensemble_config_add_container( ensemble_config_type * ensemble_config , const char * key) { char * local_key = (char *) key; bool random_key = false; if (key == NULL) { local_key = util_calloc( 11 , sizeof * local_key ); sprintf(local_key , "%ld" , random() % 10000000 ); random_key = true; } { enkf_config_node_type * config_node = enkf_config_node_new_container( local_key ); ensemble_config_add_node( ensemble_config , config_node ); if (random_key) free( local_key ); return config_node; } }
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 * config_node = NULL; if (hash_has_key(ensemble_config->config_nodes, key)) { config_node = hash_get(ensemble_config->config_nodes, key); if (enkf_config_node_get_impl_type( config_node ) != SUMMARY) { util_abort("%s: ensemble key:%s already exists - but it is not of summary type\n",__func__ , key); } summary_config_type * summary_config = enkf_config_node_get_ref( config_node ); summary_config_update_load_fail_mode( summary_config , load_fail ); } else { config_node = enkf_config_node_alloc_summary( key , load_fail); ensemble_config_add_node(ensemble_config , config_node ); } return config_node; }
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 * config_node = NULL; if (hash_has_key(ensemble_config->config_nodes, key)) { config_node = hash_get(ensemble_config->config_nodes, key); if (enkf_config_node_get_impl_type( config_node ) != SUMMARY) util_abort("%s: ensemble key:%s already exists - but it is not of summary type\n",__func__ , key); { summary_config_type * summary_config = enkf_config_node_get_ref( config_node ); summary_config_update_load_fail_mode( summary_config , load_fail ); } } else { if ((ensemble_config->refcase == NULL) || (ecl_sum_has_general_var( ensemble_config->refcase , key ))) { config_node = enkf_config_node_alloc_summary( key , load_fail); ensemble_config_add_node(ensemble_config , config_node ); } else fprintf(stderr,"** warning: the refcase:%s does not contain the summary key:\"%s\" - will be ignored.\n", ecl_sum_get_case( ensemble_config->refcase ) , key); } return config_node; }
void add_NULL_node( void * arg) { ensemble_config_type * ens_config = ensemble_config_safe_cast( arg ); ensemble_config_add_node( ens_config , NULL ); }
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; }
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_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_alloc_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_defined_custom_kw(ensemble_config_type * config, const char * key, const hash_type * definition) { enkf_config_node_type * config_node = enkf_config_node_new_defined_custom_kw(key, definition); ensemble_config_add_node(config, config_node); return config_node; }
enkf_config_node_type * ensemble_config_add_custom_kw(ensemble_config_type * config, const char * key, const char * result_file, const char * output_file) { enkf_config_node_type * config_node = enkf_config_node_new_custom_kw(key, result_file, output_file); ensemble_config_add_node(config, config_node); return config_node; }