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 ); } }
sched_file_type * sched_file_alloc(time_t start_time) { sched_file_type * sched_file = util_malloc(sizeof * sched_file); UTIL_TYPE_ID_INIT( sched_file , SCHED_FILE_TYPE_ID); sched_file->kw_list = vector_alloc_new(); sched_file->kw_list_by_type = NULL; sched_file->blocks = vector_alloc_new(); sched_file->files = stringlist_alloc_new(); sched_file->start_time = start_time; sched_file->fixed_length_table = hash_alloc(); sched_file->hasEND = false; sched_file_init_fixed_length( sched_file ); { char * fixed_length_file = getenv("SCHEDULE_FIXED_LENGTH"); if ((fixed_length_file != NULL) && (util_entry_readable( fixed_length_file ))) { FILE * stream = util_fopen(fixed_length_file , "r"); char kw[32]; int len; bool OK = true; do { if (fscanf(stream , "%s %d" , kw , &len) == 2) sched_file_add_fixed_length_kw( sched_file , kw , len); else OK = false; } while (OK); fclose( stream); } } return sched_file; }
void ecl_config_add_fixed_length_schedule_kw(ecl_config_type * ecl_config, const char * kw, int length) { hash_insert_int(ecl_config->fixed_length_kw, kw, length); if (ecl_config->sched_file != NULL ) sched_file_add_fixed_length_kw(ecl_config->sched_file, kw, length); }
static void sched_file_init_fixed_length( sched_file_type * sched_file ) { sched_file_add_fixed_length_kw(sched_file , "NEXTSTEP" , 1); sched_file_add_fixed_length_kw(sched_file , "RPTSCHED" , 1); sched_file_add_fixed_length_kw(sched_file , "DRSDT" , 1); sched_file_add_fixed_length_kw(sched_file , "SKIPREST" , 0); sched_file_add_fixed_length_kw(sched_file , "NOECHO" , 0); sched_file_add_fixed_length_kw(sched_file , "ECHO" , 0); sched_file_add_fixed_length_kw(sched_file , "RPTRST" , 1); sched_file_add_fixed_length_kw(sched_file , "TUNING" , 3); sched_file_add_fixed_length_kw(sched_file , "WHISTCTL" , 1); sched_file_add_fixed_length_kw(sched_file , "TIME" , 1); sched_file_add_fixed_length_kw(sched_file , "VAPPARS" , 1); sched_file_add_fixed_length_kw(sched_file , "NETBALAN" , 1); sched_file_add_fixed_length_kw(sched_file , "WPAVE" , 1); sched_file_add_fixed_length_kw(sched_file , "VFPTABL" , 1); sched_file_add_fixed_length_kw(sched_file , "GUIDERAT" , 1); sched_file_add_fixed_length_kw(sched_file , "MESSAGES" , 1); sched_file_add_fixed_length_kw(sched_file , "LIFTOPT" , 1); }