void ensemble_config_init_SUMMARY( ensemble_config_type * ensemble_config , const config_type * config , const ecl_sum_type * refcase) { const config_content_item_type * item = config_get_content_item( config , SUMMARY_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 ); int j; for (j= 0; j < config_content_node_get_size( node ); j++) { const char * key = config_content_node_iget( node , j ); if (util_string_has_wildcard( key )) { if (ensemble_config->refcase != NULL) { int k; stringlist_type * keys = stringlist_alloc_new ( ); ecl_sum_select_matching_general_var_list( ensemble_config->refcase , key , keys ); /* expanding the wildcard notatition with help of the refcase. */ for (k=0; k < stringlist_get_size( keys ); k++) ensemble_config_add_summary(ensemble_config , stringlist_iget(keys , k) , LOAD_FAIL_SILENT ); stringlist_free( keys ); } else util_exit("error: when using summary wildcards like: \"%s\" you must supply a valid refcase.\n",key); } else ensemble_config_add_summary(ensemble_config , key , LOAD_FAIL_SILENT); } } } }
void ensemble_config_init_SUMMARY( ensemble_config_type * ensemble_config , const config_content_type * config , const ecl_sum_type * refcase) { if (config_content_has_item(config , SUMMARY_KEY)) { const config_content_item_type * item = config_content_get_item( config , SUMMARY_KEY ); 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 ); int j; for (j= 0; j < config_content_node_get_size( node ); j++) { const char * key = config_content_node_iget( node , j ); summary_key_matcher_add_summary_key(ensemble_config->summary_key_matcher, key); if (util_string_has_wildcard( key )) { //todo: DEPRECATED. In the Future the matcher should take care of this. if (ensemble_config->refcase != NULL) { int k; stringlist_type * keys = stringlist_alloc_new ( ); ecl_sum_select_matching_general_var_list( ensemble_config->refcase , key , keys ); /* expanding the wildcard notation with help of the refcase. */ for (k=0; k < stringlist_get_size( keys ); k++) ensemble_config_add_summary(ensemble_config , stringlist_iget(keys , k) , LOAD_FAIL_SILENT ); stringlist_free( keys ); } } else ensemble_config_add_summary(ensemble_config , key , LOAD_FAIL_SILENT); } } } }
bool summary_key_matcher_summary_key_is_required(const summary_key_matcher_type * matcher, const char * summary_key) { bool is_required = false; if(!util_string_has_wildcard(summary_key) && hash_has_key(matcher->key_set, summary_key)) { is_required = (bool) hash_get_int(matcher->key_set, summary_key); } return is_required; }
static void build_key_list( const ecl_sum_type * ecl_sum , stringlist_type * key_list , int argc , const char ** argv) { int iarg; for (iarg = 0; iarg < argc; iarg++) { /** If the string does not contain wildcards we add it unconditionally; and then subsequently let the ecl_sum_fprintf() function print a message on stderr about missing keys. */ if (util_string_has_wildcard( argv[iarg] )) ecl_sum_select_matching_general_var_list( ecl_sum , argv[iarg] , key_list); else stringlist_append_copy( key_list , argv[iarg] ); } }
void summary_key_matcher_add_summary_key(summary_key_matcher_type * matcher, const char * summary_key) { if(!hash_has_key(matcher->key_set, summary_key)) { hash_insert_int(matcher->key_set, summary_key, !util_string_has_wildcard(summary_key)); } }