Exemple #1
0
void enkf_tui_fs_initialize_case_for_predictions(void * arg)
{
  int prompt_len = 35;
  char source_case[256];
  int report_step_from;
  int report_step_to;
  state_enum state_from;
  state_enum state_to;

  enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
  
  state_from       = ANALYZED;
  state_to         = ANALYZED;
  report_step_from = enkf_main_get_history_length( enkf_main ); 
  report_step_to   = enkf_main_get_history_length( enkf_main );


  {
    char * target_case = util_alloc_string_copy( NULL );
    
    util_printf_prompt("Source case" , prompt_len , '=' , "=> ");
    fgets(source_case, prompt_len, stdin);
    char *newline = strchr(source_case,'\n');
    if(newline)
      *newline = 0;
    
    if(strlen(source_case) !=0)
      enkf_tui_fs_copy_ensemble__(enkf_main, source_case, target_case, report_step_from, state_from, report_step_to, state_to, false);

    free(target_case);
  }
}
Exemple #2
0
void enkf_tui_fs_copy_ensemble_of_parameters(void * arg)
{
  int prompt_len = 35;
  char * source_case;
  
  int last_report;
  int report_step_from;
  char * report_step_from_as_char;
  int report_step_to;
  state_enum state_from;
  state_enum state_to;
  
  enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
  
  source_case = util_alloc_string_copy(enkf_main_get_current_fs( enkf_main ));
  last_report  = enkf_main_get_history_length( enkf_main );
  
  report_step_from_as_char = util_scanf_int_with_limits_return_char("Source report step",prompt_len , 0 , last_report);
  if(strlen(report_step_from_as_char) !=0){
    util_sscanf_int(report_step_from_as_char , &report_step_from);
    state_from = enkf_tui_util_scanf_state("Source analyzed/forecast [a|f]" , prompt_len , false);
    if(state_from != UNDEFINED){

      util_printf_prompt("Target case" , prompt_len , '=' , "=> ");
      char target_case[256];

      if ( fgets(target_case, prompt_len, stdin) ) {
        char *newline = strchr(target_case, '\n');
        if (newline)
          *newline = 0;
      }

      if (strlen(target_case)) {
        char * report_step_to_as_char = util_scanf_int_with_limits_return_char("Target report step",prompt_len , 0 , last_report);
        if(strlen(report_step_to_as_char) !=0){
          util_sscanf_int(report_step_to_as_char , &report_step_to);
          state_to       = enkf_tui_util_scanf_state("Target analyzed/forecast [a|f]" , prompt_len , false);
          if(state_to != UNDEFINED){
            enkf_tui_fs_copy_ensemble__(enkf_main, source_case, target_case, report_step_from, state_from, report_step_to, state_to, true);
          }
        }
        free(report_step_to_as_char);
      }
    }
  }
  free(source_case);
  free(report_step_from_as_char);
}