Example #1
0
void enkf_tui_simple_menu(void * arg) {
  enkf_main_type * enkf_main = enkf_main_safe_cast(arg);
  menu_type * menu = menu_alloc("Simple menu" , "Quit" , "qQ");
  menu_add_item(menu , "Sensitivity run: No data conditioning"                , "sS" , enkf_tui_run_exp         , enkf_main , NULL);
  const model_config_type * model_config = enkf_main_get_model_config( enkf_main );
  menu_item_type * ES_item           = menu_add_item(menu , "Assimilation run: Smoother update"               , "aA" , enkf_tui_run_smoother      , enkf_main , NULL);
  menu_item_type * it_ES_item        = menu_add_item(menu , "Assimilation run: Iterated smoother [RML-EnKF]"  , "iI" , enkf_tui_run_iterated_ES   , enkf_main , NULL);

  if (!model_config_has_history( model_config )) {
    menu_item_disable( it_ES_item );
    menu_item_disable( ES_item );
  }
  menu_add_separator( menu );
  menu_add_item(menu , "Help"                                  , "hH" , enkf_tui_help_menu_simple   , enkf_main , NULL);
  menu_add_item(menu , "Advanced menu"                         , "dD" , enkf_tui_main_menu        , enkf_main , NULL);
  menu_run(menu);
  menu_free(menu);

}
Example #2
0
void enkf_tui_run_menu(void * arg) {
  enkf_main_type  * enkf_main  = enkf_main_safe_cast( arg );
  model_config_type * model_config = enkf_main_get_model_config( enkf_main );
  path_fmt_type     * runpath_fmt  = model_config_get_runpath_fmt( model_config );
  menu_type       * menu;

  {
    char   * title = util_alloc_sprintf("Run menu [case:%s  Runpath:%s]" , enkf_main_get_current_fs( enkf_main ) , path_fmt_get_fmt ( runpath_fmt ));
    menu = menu_alloc(title , "Back" , "bB");
    free(title);
  }
  menu_add_item(menu , "Ensemble run: history"                , "xX" , enkf_tui_run_exp         , enkf_main , NULL);
  menu_add_separator( menu );
  {
    const ecl_config_type * ecl_config = enkf_main_get_ecl_config( enkf_main );
    const model_config_type * model_config = enkf_main_get_model_config( enkf_main );
    const analysis_config_type * analysis_config = enkf_main_get_analysis_config(enkf_main);
    
    menu_item_type * enkf_item         = menu_add_item(menu , "Start EnKF run from beginning"          , "sS" , enkf_tui_run_start         , enkf_main , NULL);
    menu_item_type * restart_enkf_item = menu_add_item(menu , "Restart EnKF run from arbitrary state"  , "rR" , enkf_tui_run_restart__       , enkf_main , NULL);
    menu_item_type * ES_item           = menu_add_item(menu , "Integrated smoother update"             , "iI" , enkf_tui_run_smoother      , enkf_main , NULL);
    menu_item_type * it_ES_item        = menu_add_item(menu , "Iterated smoother [RML-EnKF]"           , "tT" , enkf_tui_run_iterated_ES   , enkf_main , NULL);
    menu_item_type * one_more_item     = menu_add_item(menu , "One more iteration (disabled)"          , "mM" , enkf_tui_run_one_more_iteration , enkf_main , NULL);
              
    if (!ecl_config_has_schedule( ecl_config )) {
      menu_item_disable( enkf_item );
      menu_item_disable( restart_enkf_item );
    }
    
    if (!ecl_config_has_init_section( ecl_config )) 
      menu_item_disable( enkf_item );

    menu_item_disable( one_more_item );
    if (!analysis_config_get_module_option(analysis_config , ANALYSIS_ITERABLE)) {
      menu_item_disable( it_ES_item );
      menu_item_disable( one_more_item );
    } else {
      menu_item_disable( enkf_item );
      menu_item_disable( restart_enkf_item );
      menu_item_disable( ES_item );
    }
      
    if (!model_config_has_history( model_config )) {
      menu_item_disable( it_ES_item );
      menu_item_disable( ES_item );
      menu_item_disable( one_more_item );
    }
  }
  menu_add_separator(menu);
  menu_add_item(menu , "Create runpath directories - NO simulation" , "cC" , enkf_tui_run_create_runpath__ , enkf_main , NULL );
  menu_add_item(menu , "Load results manually"                               , "lL"  , enkf_tui_run_manual_load__ , enkf_main , NULL);
  menu_add_separator(menu);
  {
    menu_item_type * analysis_item = menu_add_item(menu , "Analysis menu"             , "aA" , enkf_tui_analysis_menu , enkf_main , NULL);
    
    if (!enkf_main_have_obs( enkf_main )) 
      menu_item_disable( analysis_item );
  }
  /*
    Option to set runpath runtime - currently dismantled.
    
    menu_add_separator(menu);
    {
    model_config_type * model_config = enkf_main_get_model_config( enkf_main );
    path_fmt_type     * runpath_fmt  = model_config_get_runpath_fmt( model_config );
    arg_pack_type * arg_pack = arg_pack_alloc();  
    char * runpath_label = util_alloc_sprintf("Set new value for RUNPATH:%s" , path_fmt_get_fmt ( runpath_fmt ));
    
    arg_pack_append_ptr(arg_pack , model_config);
    arg_pack_append_ptr(arg_pack , menu_add_item(menu , runpath_label , "dD" , enkf_tui_run_set_runpath , arg_pack , arg_pack_free__));
    
    free(runpath_label);
    }
  */
  menu_add_item(menu , "Help"                                  , "hH" , enkf_tui_help_menu_run   , enkf_main , NULL); 
  menu_run(menu);
  menu_free(menu);
}