Пример #1
0
static void site_config_add_jobs(site_config_type * site_config, const config_content_type * config) {
  if (config_content_has_item(config, INSTALL_JOB_KEY)) {
    const config_content_item_type * content_item = config_content_get_item(config, INSTALL_JOB_KEY);
    int num_jobs = config_content_item_get_size(content_item);
    for (int job_nr = 0; job_nr < num_jobs; job_nr++) {
      config_content_node_type * node = config_content_item_iget_node(content_item, job_nr);
      const char * job_key = config_content_node_iget(node, 0);
      const char * description_file = config_content_node_iget_as_abspath(node, 1);

      site_config_install_job(site_config, job_key, description_file);
    }
  }
  if (config_content_has_item(config, INSTALL_JOB_DIRECTORY_KEY)) {
    const config_content_item_type * content_item = config_content_get_item(config, INSTALL_JOB_DIRECTORY_KEY);
    int num_dirs = config_content_item_get_size(content_item);
    printf("num_dirs = %d \n",num_dirs);
    for (int dir_nr = 0; dir_nr < num_dirs; dir_nr++) {
      config_content_node_type * node = config_content_item_iget_node(content_item, dir_nr);
      const char * directory = config_content_node_iget_as_abspath(node, 0);

      ext_joblist_add_jobs_in_directory(site_config->joblist  , directory, site_config->__license_root_path, site_config->user_mode );
    }
  }

}
Пример #2
0
void site_config_init_env(site_config_type * site_config, const config_content_type * config) {
  {
    if (config_content_has_item( config , SETENV_KEY)) {
      config_content_item_type * setenv_item = config_content_get_item(config, SETENV_KEY);
      int i;
      for (i = 0; i < config_content_item_get_size(setenv_item); i++) {
        const config_content_node_type * setenv_node = config_content_item_iget_node(setenv_item, i);
        const char * var = config_content_node_iget(setenv_node, 0);
        const char * value = config_content_node_iget(setenv_node, 1);

        site_config_setenv(site_config, var, value);
      }
    }
  }

  {
    if (config_content_has_item( config , UPDATE_PATH_KEY)) {
      config_content_item_type * path_item = config_content_get_item(config, UPDATE_PATH_KEY);
      int i;
      for (i = 0; i < config_content_item_get_size(path_item); i++) {
        const config_content_node_type * path_node = config_content_item_iget_node(path_item, i);
        const char * path = config_content_node_iget(path_node, 0);
        const char * value = config_content_node_iget(path_node, 1);

        site_config_update_pathvar(site_config, path, value);
      }
    }
  }
}
Пример #3
0
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);
      }
    }
  }
}
Пример #4
0
void ert_workflow_list_init( ert_workflow_list_type * workflow_list , config_content_type * config ) {
  /* Adding jobs */
  {
    if (config_content_has_item( config , WORKFLOW_JOB_DIRECTORY_KEY)) {
      const config_content_item_type * jobpath_item = config_content_get_item( config , WORKFLOW_JOB_DIRECTORY_KEY);
      for (int i=0; i < config_content_item_get_size( jobpath_item ); i++) {
        config_content_node_type * path_node = config_content_item_iget_node( jobpath_item , i );

        for (int j=0; j < config_content_node_get_size( path_node ); j++)
          ert_workflow_list_add_jobs_in_directory( workflow_list , config_content_node_iget_as_abspath( path_node , j ) );
      }
    }
  }

  {
    if (config_content_has_item( config , LOAD_WORKFLOW_JOB_KEY)) {
      const config_content_item_type * job_item = config_content_get_item( config , LOAD_WORKFLOW_JOB_KEY);
      for (int i=0; i < config_content_item_get_size( job_item ); i++) {
        config_content_node_type * job_node = config_content_item_iget_node( job_item , i );
        const char * config_file = config_content_node_iget_as_path( job_node , 0 );
        const char * job_name = config_content_node_safe_iget( job_node , 1 );
        ert_workflow_list_add_job( workflow_list , job_name , config_file);
      }
    }
  }


  /* Adding workflows */
  {
    if (config_content_has_item( config , LOAD_WORKFLOW_KEY)) {
      const config_content_item_type * workflow_item = config_content_get_item( config , LOAD_WORKFLOW_KEY);
      for (int i=0; i < config_content_item_get_size( workflow_item ); i++) {
        config_content_node_type * workflow_node = config_content_item_iget_node( workflow_item , i );
        const char * workflow_file = config_content_node_iget_as_path( workflow_node , 0 );
        const char * workflow_name = config_content_node_safe_iget( workflow_node , 1 );

        ert_workflow_list_add_workflow( workflow_list , workflow_file , workflow_name );
      }
    }
  }
}
Пример #5
0
const char * config_content_safe_iget(const config_content_type * content , const char *kw, int occurence , int index) {
  const char * value = NULL;

  if (config_content_has_item( content , kw )) {
    config_content_item_type * item = config_content_get_item(content , kw);
    if (occurence < config_content_item_get_size( item )) {
      config_content_node_type * node = config_content_item_iget_node( item , occurence );
      value = config_content_node_safe_iget( node , index );
    }
  }
  return value;
}
Пример #6
0
void ecl_config_static_kw_init(ecl_config_type * ecl_config, const config_content_type * config)
{
  if (config_content_has_item( config , STATIC_KW_KEY)) {
    const config_content_item_type * content_item = config_content_get_item(config, STATIC_KW_KEY);
    int j;
    for (j = 0; j < config_content_item_get_size(content_item); j++) {
      const config_content_node_type * content_node = config_content_item_iget_node(content_item, j);
      int k;
      for (k = 0; k < config_content_node_get_size(content_node); k++)
        ecl_config_add_static_kw(ecl_config, config_content_node_iget(content_node, k));
    }
  }
}
Пример #7
0
void ensemble_config_init_GEN_DATA( ensemble_config_type * ensemble_config , const config_content_type * config) {
  if (config_content_has_item(config , GEN_DATA_KEY)) {
    const config_content_item_type * item = config_content_get_item( config , GEN_DATA_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 );
      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 );

    }
  }
}
Пример #8
0
void ensemble_config_init_GEN_PARAM( ensemble_config_type * ensemble_config , const config_content_type * config) {
  /* gen_param  - should be unified with the gen_data*/
  if (config_content_has_item(config , GEN_PARAM_KEY)) {
    const config_content_item_type * item = config_content_get_item( config , GEN_PARAM_KEY );
    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 );

    }
  }
}
Пример #9
0
void output_table_init( const ecl_sum_type * refcase, hash_type * output_table , const config_content_type * config ) {
  int i,j;
  if (config_content_has_item( config , "OUTPUT")) {
    const config_content_item_type * output_item = config_content_get_item( config , "OUTPUT");
    for (i = 0; i < config_content_item_get_size( output_item ); i++) {
      const config_content_node_type * output_node = config_content_item_iget_node( output_item , i );

      const char * file              = config_content_node_iget( output_node , 0 );
      const char * format_string     = config_content_node_iget( output_node , 1 );
      output_type * output           = output_alloc( file , format_string );

      /* All the keys are just added - without any check. */
      for (j = 2; j < config_content_node_get_size( output_node ); j++)
        output_add_key( refcase , output , config_content_node_iget( output_node , j));

      hash_insert_hash_owned_ref( output_table , file , output , output_free__ );
    }
  }
}
Пример #10
0
void ensemble_config_init_SURFACE( ensemble_config_type * ensemble_config , const config_content_type * config ) {
  if (config_content_has_item(config , SURFACE_KEY)) {
    const config_content_item_type * item = config_content_get_item( config , SURFACE_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 );
      const char * key           = config_content_node_iget( node , 0 );
      {
        hash_type * options = hash_alloc();  /* INIT_FILE:<init_files>  OUTPUT_FILE:<outfile>  BASE_SURFACE:<base_file> */

        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 *  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_KEY);
            exit(1);
          }

          {
            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 );
          }
        }
        hash_free( options );
      }
    }
  }
}
Пример #11
0
void ensemble_config_init_CUSTOM_KW(ensemble_config_type * ensemble_config, const config_content_type * config) {
    if (config_content_has_item(config, CUSTOM_KW_KEY)) {
        const config_content_item_type * custom_kw_item = config_content_get_item(config, CUSTOM_KW_KEY);

        for (int i = 0; i < config_content_item_get_size(custom_kw_item); i++) {
            config_content_node_type * node = config_content_item_iget_node(custom_kw_item, i);

            const char * key         = config_content_node_iget(node, 0);
            const char * result_file = config_content_node_iget_as_path(node, 1);
            const char * output_file = NULL;

            if(config_content_node_get_size(node) > 2) {
                output_file = config_content_node_iget_as_path(node, 2);
            }

            enkf_config_node_type * config_node = ensemble_config_add_custom_kw(ensemble_config, key, result_file, output_file);
            enkf_config_node_update_custom_kw(config_node, result_file, output_file);
            enkf_config_node_set_internalize(config_node, 0);
        }
    }
}
Пример #12
0
void ensemble_init( ensemble_type * ensemble , config_content_type * config) {

  /*1 : Loading ensembles and settings from the config instance */
  /*1a: Loading the eclipse summary cases. */
  {
    thread_pool_type * tp = thread_pool_alloc( LOAD_THREADS , true );
    {
      int i,j;
      if (config_content_has_item( config , "CASE_LIST")) {
        const config_content_item_type * case_item = config_content_get_item( config , "CASE_LIST" );
        for (j=0; j < config_content_item_get_size( case_item ); j++) {
          const config_content_node_type * case_node = config_content_item_iget_node( case_item , j );
          for (i=0; i < config_content_node_get_size( case_node ); i++) {
            const char * case_glob = config_content_node_iget( case_node , i );
            ensemble_load_from_glob( ensemble , case_glob , tp);
          }
        }
      }

    }
    thread_pool_join( tp );
    thread_pool_free( tp );
  }

  {
    const sum_case_type * tmp = vector_iget_const( ensemble->data , 0 );
    ensemble->refcase = tmp->ecl_sum;
  }

  /*1b: Other config settings */
  if (config_content_has_item( config , "NUM_INTERP" ))
    ensemble->num_interp  = config_content_iget_as_int( config , "NUM_INTERP" , 0 , 0 );


  /*2: Remaining initialization */
  ensemble_init_time_interp( ensemble );
  if (vector_get_size( ensemble->data ) < MIN_SIZE )
    util_exit("Sorry - quantiles make no sense with with < %d realizations; should have ~> 100.\n" , MIN_SIZE);
}
Пример #13
0
void ensemble_config_init_GEN_KW( ensemble_config_type * ensemble_config , const config_content_type * config ) {
  if (config_content_has_item(config , GEN_KW_KEY)) {
    const config_content_item_type * gen_kw_item = config_content_get_item( config , GEN_KW_KEY );
    int i;
    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 );
      hash_type * opt_hash         = hash_alloc();

      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 );
    }
  }
}
Пример #14
0
void ecl_config_init(ecl_config_type * ecl_config, const config_content_type * config)
{
  if (config_content_has_item(config, ECLBASE_KEY)) {
    ui_return_type * ui_return = ecl_config_validate_eclbase(ecl_config, config_content_iget(config, ECLBASE_KEY, 0, 0));
    if (ui_return_get_status(ui_return) == UI_RETURN_OK)
      ecl_config_set_eclbase(ecl_config, config_content_iget(config, ECLBASE_KEY, 0, 0));
    else
      util_abort("%s: failed to set eclbase format. Error:%s\n", __func__ , ui_return_get_last_error(ui_return));
    ui_return_free(ui_return);
  }

  if (config_content_has_item(config, DATA_FILE_KEY))
  {
    ui_return_type * ui_return = ecl_config_validate_data_file(ecl_config, config_content_iget(config, DATA_FILE_KEY, 0, 0));
    if (ui_return_get_status( ui_return ) == UI_RETURN_OK)
      ecl_config_set_data_file( ecl_config, config_content_iget(config, DATA_FILE_KEY, 0, 0) );
    else
      util_abort("%s: problem setting ECLIPSE data file\n",__func__ , ui_return_get_last_error(ui_return));

    ui_return_free(ui_return);
  }

  if (config_content_has_item(config, SCHEDULE_FILE_KEY)) {
    const char * schedule_target_file = config_content_safe_iget(config, SCHEDULE_FILE_KEY, 0, 1);
    if (schedule_target_file) {
      ui_return_type * ui_return_sched_target_file = ecl_config_validate_schedule_file(ecl_config, schedule_target_file);
      if (!ui_return_get_status(ui_return_sched_target_file) == UI_RETURN_OK) {
         util_abort("%s: failed to set target schedule file. Error:%s\n",__func__ , ui_return_get_last_error(ui_return_sched_target_file));
      }
      ui_return_free(ui_return_sched_target_file);
    }

    ui_return_type * ui_return = ecl_config_validate_schedule_file(ecl_config, config_content_iget(config, SCHEDULE_FILE_KEY, 0, 0));
    if (ui_return_get_status(ui_return) == UI_RETURN_OK)
      ecl_config_set_schedule_file(ecl_config, config_content_iget(config, SCHEDULE_FILE_KEY, 0, 0), schedule_target_file);
    else
      util_abort("%s: failed to set schedule file. Error:%s\n",__func__ , ui_return_get_last_error(ui_return));

    ui_return_free(ui_return);
  }

  if (config_content_has_item(config, GRID_KEY)) {
    const char * grid_file = config_content_iget(config, GRID_KEY, 0, 0);
    ui_return_type * ui_return = ecl_config_validate_grid( ecl_config , grid_file);
    if (ui_return_get_status(ui_return) == UI_RETURN_OK)
      ecl_config_set_grid(ecl_config, grid_file );
    else
      util_abort("%s: failed to set grid file:%s  Error:%s \n",__func__ , grid_file , ui_return_get_last_error(ui_return));

    ui_return_free( ui_return );
  }


  if (config_content_has_item(config, ADD_FIXED_LENGTH_SCHEDULE_KW_KEY))
  {
    int iocc;
    for (iocc = 0; iocc < config_content_get_occurences(config, ADD_FIXED_LENGTH_SCHEDULE_KW_KEY); iocc++)
      ecl_config_add_fixed_length_schedule_kw(ecl_config,
                                              config_content_iget(config, ADD_FIXED_LENGTH_SCHEDULE_KW_KEY, iocc, 0),
                                              config_content_iget_as_int(config, ADD_FIXED_LENGTH_SCHEDULE_KW_KEY, iocc, 1));
  }

  if (config_content_has_item(config, REFCASE_KEY))
  {
    const char * refcase_path = config_content_get_value_as_path(config, REFCASE_KEY);
    if (!ecl_config_load_refcase(ecl_config, refcase_path))
      fprintf(stderr, "** Warning: loading refcase:%s failed \n", refcase_path);
  }

  if (config_content_has_item(config, REFCASE_LIST_KEY))
  {
    config_content_item_type * item = config_content_get_item(config, REFCASE_LIST_KEY);
    int i;
    for (i = 0; i < config_content_item_get_size(item); i++)
    {
      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 * case_glob = config_content_node_iget_as_path(node, j);
        ecl_refcase_list_add_matching(ecl_config->refcase_list, case_glob);
      }
    }
  }

  if (config_content_has_item(config, INIT_SECTION_KEY))
    ecl_config_set_init_section(ecl_config, config_content_get_value(config, INIT_SECTION_KEY));
  else if (ecl_config->can_restart)
    /**
     This is a hard error - the datafile contains <INIT>, however
     the config file does NOT contain INIT_SECTION, i.e. we have
     no information to fill in for the <INIT> section. This case
     will not be able to initialize an ECLIPSE model, and that is
     broken behaviour.
     */
    util_exit("Sorry: when the datafile contains <INIT> the config file MUST have the INIT_SECTION keyword. \n");

  /*
   The user has not supplied a INIT_SECTION keyword whatsoever,
   this essentially means that we can not restart - because:

   1. The EQUIL section must be inlined in the DATAFILE without any
   special markup.

   2. ECLIPSE will fail hard if the datafile contains both an EQUIL
   section and a restart statement, and when we have not marked
   the EQUIL section specially with the INIT_SECTION keyword it
   is impossible for ERT to dynamically change between a
   datafile with initialisation and a datafile for restart.

   IFF the user has no intentitions of any form of restart, this is
   perfectly legitemate.
   */
  if (config_content_has_item(config, END_DATE_KEY))
  {
    const char * date_string = config_content_get_value(config, END_DATE_KEY);
    time_t end_date;
    if (util_sscanf_date_utc(date_string, &end_date))
      ecl_config_set_end_date(ecl_config, end_date);
    else
      fprintf(stderr, "** WARNING **: Failed to parse %s as a date - should be in format dd/mm/yyyy \n", date_string);
  }
}
Пример #15
0
const stringlist_type * config_content_iget_stringlist_ref(const config_content_type * content , const char * kw, int occurence) {
  config_content_item_type * item = config_content_get_item(content , kw);

  return config_content_item_iget_stringlist_ref(item , occurence);
}
Пример #16
0
stringlist_type * config_content_alloc_complete_stringlist(const config_content_type * content , const char * kw) {
  bool copy = true;
  config_content_item_type * item = config_content_get_item(content , kw);
  return config_content_item_alloc_complete_stringlist(item , copy);
}
Пример #17
0
config_content_node_type * config_content_get_value_node( const config_content_type * content , const char * kw) {
  config_content_item_type * item = config_content_get_item(content , kw);
  config_content_node_type * node = config_content_item_get_last_node( item );
  config_content_node_assert_key_value( node );
  return node;
}
Пример #18
0
const char * config_content_iget_as_path( const config_content_type * content , const char * key , int occurence , int index) {
  config_content_item_type * item = config_content_get_item(content , key);
  config_content_node_type * node = config_content_item_iget_node( item , index );
  return config_content_node_iget_as_path(node , index);
}
Пример #19
0
double config_content_iget_as_double( const config_content_type * content , const char * key , int occurence , int index) {
  config_content_item_type * item = config_content_get_item(content , key);
  return config_content_item_iget_as_double(item , occurence , index);
}
Пример #20
0
void ensemble_config_init_FIELD( ensemble_config_type * ensemble_config , const config_content_type * config , ecl_grid_type * grid) {
  if (config_content_has_item(config , FIELD_KEY)) {
    const config_content_item_type * item = config_content_get_item( config , FIELD_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 );
      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;

      {
        hash_type * options = hash_alloc();

        int    truncation = TRUNCATE_NONE;
        double value_min  = -1;
        double value_max  = -1;

        config_content_node_init_opt_hash( node , options , 2 );
        if (hash_has_key( options , MIN_KEY)) {
          truncation |= TRUNCATE_MIN;
          value_min   = atof(hash_get( options , MIN_KEY));
        }

        if (hash_has_key( options , MAX_KEY)) {
          truncation |= TRUNCATE_MAX;
          value_max   = atof(hash_get( options , MAX_KEY));
        }


        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) {
          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     ,
                                                   min_std_file      ,
                                                   truncation        ,
                                                   value_min         ,
                                                   value_max         ,
                                                   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 );
          const char *  init_transform    = hash_safe_get( options , INIT_TRANSFORM_KEY );
          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 ,
                                                 init_file_fmt ,
                                                 min_std_file ,
                                                 truncation , value_min , value_max ,
                                                 init_transform ,
                                                 input_transform ,
                                                 output_transform);


        } else
          util_abort("%s: field type: %s is not recognized\n",__func__ , var_type_string);

        hash_free( options );
      }
    }
  }
}
Пример #21
0
int config_content_get_occurences(const config_content_type * content, const char * kw) {
  if (config_content_has_item( content , kw ))
    return config_content_item_get_size( config_content_get_item(content , kw) );
  else
    return 0;
}
Пример #22
0
char * config_content_alloc_joined_string(const config_content_type * content , const char * kw, const char * sep) {
  config_content_item_type * item = config_content_get_item(content , kw);
  return config_content_item_alloc_joined_string(item , sep);
}