예제 #1
0
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;
}
예제 #2
0
파일: main.c 프로젝트: pgdr/ert
int main (int argc, char ** argv) {
  text_splash();
  init_debug(argv[0]);
  printf("\n");
  printf("Documentation : %s \n","http://ert.nr.no");
  printf("git commit    : %s \n",ert_version_get_git_commit( ));
  printf("compile time  : %s \n",ert_version_get_build_time( ));
  printf("site config   : %s \n", site_config_get_location());

  enkf_main_install_SIGNALS();                     /* Signals common to both tui and gui. */
  signal(SIGINT, util_abort_signal);              /* Control C - tui only.               */
  if (argc < 2) {
    enkf_usage();
    exit(1);
  } else {
    const char * model_config_file = argv[1];
    stringlist_type * workflow_list = stringlist_alloc_new();

    parse_workflows(argc, argv, workflow_list);
    if (!(util_entry_readable(model_config_file) && util_is_file(model_config_file)))
      util_exit("Can not read file %s - exiting \n", model_config_file);

    {
      char * abs_config = util_alloc_realpath(model_config_file);
      printf("model config  : %s \n\n", abs_config);
      free(abs_config);
    }
    enkf_welcome(model_config_file);
    {
      res_config_type * res_config = res_config_alloc_load(model_config_file);
      util_chdir( res_config_get_config_directory( res_config ));
      {
        enkf_main_type * enkf_main = enkf_main_alloc(res_config, true, true);
        enkf_main_run_workflows(enkf_main, workflow_list);
        enkf_tui_main_menu(enkf_main);
        enkf_main_free(enkf_main);
        res_config_free(res_config);
      }
    }

    stringlist_free(workflow_list);
    util_abort_free_version_info(); /* No f*****g leaks ... */
  }
  exit(0);
}