Пример #1
0
void ensemble_config_init(ensemble_config_type * ensemble_config , const config_type * config , ecl_grid_type * grid, const ecl_sum_type * refcase) {
  int i;
  ensemble_config_set_refcase( ensemble_config , refcase );

  if (config_item_set( config , GEN_KW_TAG_FORMAT_KEY))
    ensemble_config_set_gen_kw_format( ensemble_config , config_iget( config , GEN_KW_TAG_FORMAT_KEY , 0 , 0 ));
  
  ensemble_config_init_GEN_PARAM( ensemble_config , config );
  ensemble_config_init_GEN_DATA( ensemble_config , config );
  ensemble_config_init_GEN_KW(ensemble_config , config ); 
  ensemble_config_init_SURFACE( ensemble_config , config );
  
  ensemble_config_init_SUMMARY( ensemble_config , config , refcase );
  
  ensemble_config_init_FIELD( ensemble_config , config , grid );
  
  
  /* Containers - this must come last, to ensure that the other nodes have been added. */
  {
    for (i=0; i < config_get_occurences(config , CONTAINER_KEY ); i++) {
      const stringlist_type * container_kw_list = config_iget_stringlist_ref(config , CONTAINER_KEY , i);
      const char * container_key = stringlist_iget( container_kw_list , 0 );
      enkf_config_node_type * container_node = ensemble_config_add_container( ensemble_config , container_key );
      
      for (int j= 1; j < stringlist_get_size( container_kw_list ); j++) {
        const char * child_key = stringlist_iget( container_kw_list , j); 
        enkf_config_node_update_container( container_node , ensemble_config_get_node( ensemble_config , child_key ));
      }
    }
  }

  /*****************************************************************/
}
Пример #2
0
void ensemble_init( ensemble_type * ensemble , config_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;
      for (i=0; i < config_get_occurences( config , "CASE_LIST"); i++) {
        const stringlist_type * case_list = config_iget_stringlist_ref( config , "CASE_LIST" , i );
        for (j=0; j < stringlist_get_size( case_list ); j++) 
          ensemble_load_from_glob( ensemble , stringlist_iget( case_list , j ) , 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_item_set( config , "NUM_INTERP" ))
    ensemble->num_interp  = config_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);
}
Пример #3
0
void output_table_init( const ecl_sum_type * refcase, hash_type * output_table , const config_type * config ) {
  int i,j;
  for (i=0; i < config_get_occurences( config , "OUTPUT" ); i++) {
    const stringlist_type * tokens = config_iget_stringlist_ref( config , "OUTPUT" , i);
    const char * file              = stringlist_iget( tokens , 0 );
    const char * format_string     = stringlist_iget( tokens , 1 );
    output_type * output           = output_alloc( file , format_string );
    
    /* All the keys are just added - without any check. */
    for (j = 2; j < stringlist_get_size( tokens ); j++)
      output_add_key( refcase , output , stringlist_iget( tokens , j));
    
    hash_insert_hash_owned_ref( output_table , file , output , output_free__ );
  }
}
Пример #4
0
void site_config_init(site_config_type * site_config , const config_type * config, bool user_config) {
  site_config_add_jobs(site_config , config);
  {
    int i;
    for (i = 0; i < config_get_occurences( config , SETENV_KEY); i++) {
      const stringlist_type * tokens = config_iget_stringlist_ref(config , SETENV_KEY , i);
      const char * var               = stringlist_iget( tokens , 0);
      const char * value             = stringlist_iget( tokens , 1);

      site_config_setenv( site_config , var , value );
    }
    
    for (i=0; i < config_get_occurences( config, UPDATE_PATH_KEY); i++) {
      const stringlist_type * tokens = config_iget_stringlist_ref(config , UPDATE_PATH_KEY , i);
      const char * path              = stringlist_iget( tokens , 0);
      const char * value             = stringlist_iget( tokens , 1);
      
      site_config_update_pathvar( site_config , path , value );
    }
  }
  /* 
     When LSF is used several enviroment variables must be set (by the
     site wide file) - i.e.  the calls to SETENV must come first.
  */
  if (!site_config->user_mode) 
    site_config_create_queue_drivers( site_config );   

  /* 
     Set the umask for all file creation. A value of '0' will ensure
     that all files and directories are created with 'equal rights'
     for everyone - might be handy if you are helping someone... The
     default statoil value is 0022, i.e. write access is removed from
     group and others.  

     The string is supposed to be in OCTAL representation (without any
     prefix characters).
  */
  if (config_item_set(config , UMASK_KEY)) {
    const char * string_mask = config_iget( config , UMASK_KEY , 0 , 0);
    mode_t umask_value;
    if (util_sscanf_octal_int( string_mask , &umask_value))
      site_config_set_umask( site_config , umask_value);
    else
      util_abort("%s: failed to parse:\"%s\" as a valid octal literal \n",__func__ , string_mask);
  }

  if (config_item_set(config , MAX_SUBMIT_KEY)) 
    site_config_set_max_submit( site_config , config_get_value_as_int( config , MAX_SUBMIT_KEY ));
  

  /* LSF options */
  {
    if (config_item_set(config , LSF_QUEUE_KEY))
      site_config_set_lsf_queue( site_config , config_iget( config , LSF_QUEUE_KEY , 0 , 0));
    
    if (config_item_set(config , LSF_RESOURCES_KEY)) {
      char * lsf_resource_request = config_alloc_joined_string(config , LSF_RESOURCES_KEY , " ");
      site_config_set_lsf_request( site_config , lsf_resource_request );
      free( lsf_resource_request );
    }
    
    if (config_item_set(config , MAX_RUNNING_LSF_KEY))
      site_config_set_max_running_lsf( site_config , config_iget_as_int( config , MAX_RUNNING_LSF_KEY , 0 , 0));

    if (config_item_set(config , LSF_SERVER_KEY))
      site_config_set_lsf_server( site_config , config_iget( config , LSF_SERVER_KEY , 0 , 0));
  }


  /* RSH options */
  {
    if (config_item_set( config , RSH_COMMAND_KEY ))
      site_config_set_rsh_command( site_config , config_iget(config , RSH_COMMAND_KEY , 0,0));
    
    if (config_item_set( config , MAX_RUNNING_RSH_KEY))
      site_config_set_max_running_rsh( site_config , config_iget_as_int( config , MAX_RUNNING_RSH_KEY , 0,0));

    /* Parsing the "host1:4" strings. */
    if (user_config) {
      if (config_item_set( config , RSH_HOST_KEY)) {
        stringlist_type * rsh_host_list = config_alloc_complete_stringlist(config , RSH_HOST_KEY);
        int i;
        for (i=0; i < stringlist_get_size( rsh_host_list ); i++) 
          site_config_add_rsh_host_from_string( site_config , stringlist_iget( rsh_host_list , i ) );
        
        stringlist_free( rsh_host_list );
      }
    }
  }

  if (config_item_set( config , QUEUE_SYSTEM_KEY)) {
    job_driver_type driver_type;
    {
      const char * queue_system = config_iget(config , QUEUE_SYSTEM_KEY , 0,0);
      if (strcmp(queue_system , LSF_DRIVER_NAME) == 0) {
        driver_type = LSF_DRIVER;
      } else if (strcmp(queue_system , RSH_DRIVER_NAME) == 0) 
        driver_type = RSH_DRIVER;
      else if (strcmp(queue_system , LOCAL_DRIVER_NAME) == 0) 
        driver_type = LOCAL_DRIVER;
      else {
        util_abort("%s: queue system :%s not recognized \n",__func__ , queue_system);
        driver_type = NULL_DRIVER;
      }
    }
    site_config_set_job_queue__( site_config , driver_type );
  }
  
  /* Parsing local options */
  if (config_item_set( config , MAX_RUNNING_LOCAL_KEY))
    site_config_set_max_running_local( site_config , config_iget_as_int( config , MAX_RUNNING_LOCAL_KEY , 0,0));

  if (config_item_set(config , JOB_SCRIPT_KEY))
    site_config_set_job_script( site_config , config_iget( config , JOB_SCRIPT_KEY , 0 , 0));
  
  if (config_item_set(config , LICENSE_PATH_KEY))
    site_config_set_license_root_path( site_config , config_iget( config , LICENSE_PATH_KEY , 0 , 0));
  
  if (user_config) 
    site_config_install_job_queue( site_config );
  
  /* Setting QUEUE_OPTIONS */
  { 
    int i;
    for (i=0; i < config_get_occurences(config , QUEUE_OPTION_KEY); i++) {
      stringlist_type * tokens   = config_iget_stringlist_ref(config , QUEUE_OPTION_KEY , i);
      const char * driver_name   = stringlist_iget( tokens , 0 );
      const char * option_key    = stringlist_iget( tokens , 1 );
      const char * option_value  = stringlist_alloc_joined_substring( tokens , 2 , stringlist_get_size( tokens ), " ");
      /* 
         If it is desirable to keep the exact number of spaces in the
         option_value it should be quoted with "" in the configuration
         file.
      */
      site_config_set_queue_option( site_config , driver_name , option_key , option_value );
    }
  }
}