Beispiel #1
0
void ecl_config_set_schedule_file( ecl_config_type * ecl_config , const char * schedule_file ) {
  if (ecl_config->start_date == -1)
    util_abort("%s: must set ecl_data_file first \n",__func__);
  {
    char * base;  /* The schedule target file will be without any path component */
    char * ext;
    util_alloc_file_components(schedule_file , NULL , &base , &ext);
    ecl_config->schedule_target_file = util_alloc_filename(NULL , base , ext);
    free(ext);
    free(base);
  }
  ecl_config->sched_file = sched_file_alloc( ecl_config->start_date );
  
  
  sched_file_parse(ecl_config->sched_file , schedule_file );
  ecl_config->last_history_restart = sched_file_get_num_restart_files( ecl_config->sched_file ) - 1;   /* We keep track of this - so we can stop assimilation at the end of history */
  {
    hash_iter_type * iter = hash_iter_alloc( ecl_config->fixed_length_kw );
    while (!hash_iter_is_complete( iter )) {
      const char * key = hash_iter_get_next_key( iter );
      int length       = hash_get_int( ecl_config->fixed_length_kw , key );
      
      sched_file_add_fixed_length_kw( ecl_config->sched_file , key , length);
    }
    hash_iter_free( iter );
  }
}
Beispiel #2
0
sched_file_type * sched_file_alloc_copy(const sched_file_type * src , bool deep_copy) {
  int ikw;
  sched_file_type * target = sched_file_alloc(src->start_time);
  
  for (ikw = 0; ikw < vector_get_size( src->kw_list ); ikw++) {
    sched_kw_type * kw = vector_iget( src->kw_list , ikw );
    sched_file_add_kw( target , kw );
  }
                                                                
  
  {
    int i;
    for (i = 0; i < stringlist_get_size( src->files ); i++) {
      if (deep_copy)
        stringlist_append_copy( target->files , stringlist_iget(src->files , i));
      else
        stringlist_append_ref( target->files , stringlist_iget(src->files , i));
    }
  }

  sched_file_update_index( target );
  return target;
}
Beispiel #3
0
sched_file_type * sched_file_parse_alloc(const char * filename , time_t start_date) {
  sched_file_type * sched_file = sched_file_alloc( start_date );
  sched_file_parse(sched_file , filename);
  return sched_file;
}