示例#1
0
void model_config_init(model_config_type * model_config , 
                       const config_type * config , 
                       int ens_size , 
                       const ext_joblist_type * joblist , 
                       int last_history_restart , 
                       const sched_file_type * sched_file , 
                       const ecl_sum_type * refcase) {
  
  model_config->forward_model = forward_model_alloc(  joblist );
  model_config_set_refcase( model_config , refcase );
  

  if (config_item_set( config , FORWARD_MODEL_KEY )) {
    char * config_string = config_alloc_joined_string( config , FORWARD_MODEL_KEY , " ");
    forward_model_parse_init( model_config->forward_model , config_string );
    free(config_string);
  }

  if (config_item_set( config , ENKF_SCHED_FILE_KEY))
    model_config_set_enkf_sched_file(model_config , config_get_value(config , ENKF_SCHED_FILE_KEY ));
  
  if (config_item_set( config, RUNPATH_KEY)) {
    model_config_add_runpath( model_config , DEFAULT_RUNPATH_KEY , config_get_value(config , RUNPATH_KEY) );
    model_config_select_runpath( model_config , DEFAULT_RUNPATH_KEY );
  }

  {
    history_source_type source_type = DEFAULT_HISTORY_SOURCE;

    if (config_item_set( config , HISTORY_SOURCE_KEY)) {
      const char * history_source = config_iget(config , HISTORY_SOURCE_KEY, 0,0);
      source_type = history_get_source_type( history_source );
    }

    if (!model_config_select_history( model_config , source_type , sched_file , refcase ))
      if (!model_config_select_history( model_config , DEFAULT_HISTORY_SOURCE , sched_file , refcase ))
        if (!model_config_select_any_history( model_config , sched_file , refcase))
          fprintf(stderr,"** Warning:: Do not have enough information to select a history source \n");
    
  }
      


  if (model_config->history != NULL) {
    int num_restart = history_get_last_restart( model_config->history );
    bool_vector_iset( model_config->internalize_state , num_restart - 1 , false );
    bool_vector_iset( model_config->__load_state      , num_restart - 1 , false );
  }

  /*
    The full treatment of the SCHEDULE_PREDICTION_FILE keyword is in
    the ensemble_config file, because the functionality is implemented
    as (quite) plain GEN_KW instance. Here we just check if it is
    present or not.
  */
  
  if (config_item_set(config ,  SCHEDULE_PREDICTION_FILE_KEY)) 
    model_config->has_prediction = true;
  else
    model_config->has_prediction = false;


  if (config_item_set(config ,  CASE_TABLE_KEY)) 
    model_config_set_case_table( model_config , ens_size , config_iget( config , CASE_TABLE_KEY , 0,0));
  
  if (config_item_set( config , ENSPATH_KEY))
    model_config_set_enspath( model_config , config_get_value(config , ENSPATH_KEY));

  if (config_item_set( config , JOBNAME_KEY))
    model_config_set_jobname_fmt( model_config , config_get_value(config , JOBNAME_KEY));

  if (config_item_set( config , RFTPATH_KEY))
    model_config_set_rftpath( model_config , config_get_value(config , RFTPATH_KEY));
  
  if (config_item_set( config , DBASE_TYPE_KEY))
    model_config_set_dbase_type( model_config , config_get_value(config , DBASE_TYPE_KEY));
  
  if (config_item_set( config , MAX_RESAMPLE_KEY))
    model_config_set_max_internal_submit( model_config , config_get_value_as_int( config , MAX_RESAMPLE_KEY ));


  {
    const char * export_file_name;
    if (config_item_set( config , GEN_KW_EXPORT_FILE_KEY))
      export_file_name = config_get_value(config, GEN_KW_EXPORT_FILE_KEY);
    else
      export_file_name = DEFAULT_GEN_KW_EXPORT_FILE;

    model_config_set_gen_kw_export_file(model_config, export_file_name);
   }
  
}
示例#2
0
void enkf_main_set_case_table( enkf_main_type * enkf_main , const char * case_table_file ) {
    model_config_set_case_table( enkf_main->model_config , enkf_main->ens_size , case_table_file );
}