当前位置: 首页>>代码示例>>C++>>正文


C++ enkf_main_get_ensemble_size函数代码示例

本文整理汇总了C++中enkf_main_get_ensemble_size函数的典型用法代码示例。如果您正苦于以下问题:C++ enkf_main_get_ensemble_size函数的具体用法?C++ enkf_main_get_ensemble_size怎么用?C++ enkf_main_get_ensemble_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了enkf_main_get_ensemble_size函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: enkf_main_copy_ensemble

static void enkf_main_copy_ensemble( const enkf_main_type * enkf_main,
                                     enkf_fs_type * source_case_fs,
                                     int source_report_step,
                                     state_enum source_state,
                                     enkf_fs_type * target_case_fs,
                                     int target_report_step,
                                     state_enum target_state,
                                     const bool_vector_type * iens_mask,
                                     const char * ranking_key , /* It is OK to supply NULL - but if != NULL it must exist */
                                     const stringlist_type * node_list) {

    const int ens_size = enkf_main_get_ensemble_size( enkf_main );
    state_map_type * target_state_map = enkf_fs_get_state_map(target_case_fs);

    {
        int * ranking_permutation;
        int inode , src_iens;

        if (ranking_key != NULL) {
            ranking_table_type * ranking_table = enkf_main_get_ranking_table( enkf_main );
            ranking_permutation = (int *) ranking_table_get_permutation( ranking_table , ranking_key );
        } else {
            ranking_permutation = util_calloc( ens_size , sizeof * ranking_permutation );
            for (src_iens = 0; src_iens < ens_size; src_iens++)
                ranking_permutation[src_iens] = src_iens;
        }

        for (inode =0; inode < stringlist_get_size( node_list ); inode++) {
            enkf_config_node_type * config_node = ensemble_config_get_node( enkf_main_get_ensemble_config(enkf_main) , stringlist_iget( node_list , inode ));
            for (src_iens = 0; src_iens < enkf_main_get_ensemble_size( enkf_main ); src_iens++) {
                if (bool_vector_safe_iget(iens_mask , src_iens)) {
                    int target_iens = ranking_permutation[src_iens];
                    node_id_type src_id    = {.report_step = source_report_step , .iens = src_iens    , .state = source_state };
                    node_id_type target_id = {.report_step = target_report_step , .iens = target_iens , .state = target_state };

                    /* The copy is careful ... */
                    if (enkf_config_node_has_node( config_node , source_case_fs , src_id))
                        enkf_node_copy( config_node ,
                                        source_case_fs , target_case_fs ,
                                        src_id , target_id );

                    if (0 == target_report_step)
                        state_map_iset(target_state_map, target_iens, STATE_INITIALIZED);
                }
            }
        }

        if (ranking_permutation == NULL)
            free( ranking_permutation );
    }
}
开发者ID:eoia,项目名称:ert,代码行数:51,代码来源:enkf_main_manage_fs.c

示例2: enkf_main_initialize_from_scratch_with_bool_vector

void enkf_main_initialize_from_scratch_with_bool_vector(enkf_main_type * enkf_main , const stringlist_type * param_list ,const bool_vector_type * iens_mask , init_mode_type init_mode) {
    int num_cpu = 4;
    int ens_size               = enkf_main_get_ensemble_size( enkf_main );
    thread_pool_type * tp     = thread_pool_alloc( num_cpu , true );
    arg_pack_type ** arg_list = util_calloc( ens_size , sizeof * arg_list );
    int i;
    int iens;

    for (iens = 0; iens < ens_size; iens++) {
        arg_list[iens] = arg_pack_alloc();
        if (bool_vector_safe_iget(iens_mask , iens)) {
            arg_pack_append_ptr( arg_list[iens] , enkf_main );
            arg_pack_append_const_ptr( arg_list[iens] , param_list );
            arg_pack_append_int( arg_list[iens] , iens );
            arg_pack_append_int( arg_list[iens] , init_mode );

            thread_pool_add_job( tp , enkf_main_initialize_from_scratch_mt , arg_list[iens]);
        }

    }
    thread_pool_join( tp );
    for (i = 0; i < ens_size; i++) {
        arg_pack_free( arg_list[i] );
    }
    free( arg_list );
    thread_pool_free( tp );
}
开发者ID:eoia,项目名称:ert,代码行数:27,代码来源:enkf_main_manage_fs.c

示例3: main

int main(int argc , char ** argv) {
    enkf_main_install_SIGNALS();

    const char * config_file             = argv[1];
    ert_test_context_type * test_context = ert_test_context_alloc("VerifyJobsFileTest" , config_file);
    enkf_main_type * enkf_main           = ert_test_context_get_main(test_context);

    {
        const int ens_size         = enkf_main_get_ensemble_size( enkf_main );
        bool_vector_type * iactive = bool_vector_alloc(0, false);
        bool_vector_iset( iactive , ens_size - 1 , true );

        enkf_main_create_run_path(enkf_main , iactive , 0);
        bool_vector_free(iactive);
    }

    const char * filename = util_alloc_filename(ert_test_context_get_cwd(test_context),
                            "simulations/run0/jobs.py", NULL);
    const char * jobs_file_content = util_fread_alloc_file_content(filename, NULL);

    test_assert_true  (strstr(jobs_file_content, "umask = 0022") != NULL);
    test_assert_false (strstr(jobs_file_content, "umask = 0023") != NULL);
    test_assert_false (strstr(jobs_file_content, "umask = 0032") != NULL);
    test_assert_false (strstr(jobs_file_content, "umask = 0122") != NULL);
    test_assert_false (strstr(jobs_file_content, "umask = 1022") != NULL);

    ert_test_context_free(test_context);
    exit(0);
}
开发者ID:jokva,项目名称:ert,代码行数:29,代码来源:enkf_umask_config_test.c

示例4: enkf_tui_fs_initialize_case_from_copy

void enkf_tui_fs_initialize_case_from_copy(void * arg) 
{
  int prompt_len =50;
  char * source_case;
  int ens_size;
  int last_report;
  int src_step;
  state_enum src_state;
  enkf_main_type   * enkf_main = enkf_main_safe_cast( arg );

  ens_size = enkf_main_get_ensemble_size( enkf_main );

  
  last_report  = enkf_main_get_history_length( enkf_main );

  source_case = enkf_tui_fs_alloc_existing_case( enkf_main , "Initialize from case" , prompt_len);
  if (source_case != NULL) {                                              
    src_step                 = util_scanf_int_with_limits("Source report step",prompt_len , 0 , last_report);
    src_state                = enkf_tui_util_scanf_state("Source analyzed/forecast [A|F]" , prompt_len , false);
    enkf_fs_type * source_fs = enkf_main_mount_alt_fs( enkf_main , source_case , false );
    enkf_main_init_current_case_from_existing(enkf_main, source_fs , src_step , src_state);
    enkf_fs_decref(source_fs);
  }
  util_safe_free( source_case );
}
开发者ID:akva2,项目名称:ert,代码行数:25,代码来源:enkf_tui_fs.c

示例5: enkf_tui_run_restart__

void enkf_tui_run_restart__(void * enkf_main) {
  const int ens_size    = enkf_main_get_ensemble_size( enkf_main );
  const int last_report = enkf_main_get_history_length( enkf_main );
  int start_report;
  char * start_report_as_char;
  bool wronginput = false;
  state_enum state;
  bool_vector_type * iactive = bool_vector_alloc(0,true);
  bool_vector_iset( iactive , ens_size - 1 , true );
  
  start_report_as_char = util_scanf_int_with_limits_return_char("Report step",PROMPT_LEN , 0 , last_report);
  if(strlen(start_report_as_char) != 0){
    util_sscanf_int(start_report_as_char , &start_report);
  }
  else
    wronginput = true;
  
  if(!wronginput){
    state        = enkf_tui_util_scanf_state("Analyzed/forecast" , PROMPT_LEN , false);
    if(state == UNDEFINED)
      wronginput = true;
  }
  
  if(!wronginput)
    enkf_main_run_assimilation(enkf_main ,  iactive , start_report , start_report  , state);
  
  bool_vector_free(iactive);
  free(start_report_as_char);
}
开发者ID:PETECLAM,项目名称:ResInsight,代码行数:29,代码来源:enkf_tui_run.c

示例6: enkf_tui_fs_initialize_case_from_copy

void enkf_tui_fs_initialize_case_from_copy(void * arg) 
{
  int prompt_len =50;
  char * source_case;
  int ens_size;
  int last_report;
  int src_step;
  state_enum src_state;
  enkf_main_type   * enkf_main = enkf_main_safe_cast( arg );

  ens_size = enkf_main_get_ensemble_size( enkf_main );

  
  last_report  = enkf_main_get_history_length( enkf_main );

  source_case = enkf_tui_fs_alloc_existing_case( enkf_main , "Initialize from case" , prompt_len);
  if (source_case != NULL) {                                              
    char * ranking_key  = NULL;
    bool_vector_type * iens_mask = bool_vector_alloc( 0 , true ); 
    src_step         = util_scanf_int_with_limits("Source report step",prompt_len , 0 , last_report);
    src_state        = enkf_tui_util_scanf_state("Source analyzed/forecast [A|F]" , prompt_len , false);
    enkf_main_initialize_from_existing( enkf_main , source_case , src_step , src_state , iens_mask , ranking_key );
    bool_vector_free( iens_mask );
  }
  util_safe_free( source_case );
}
开发者ID:JacobStoren,项目名称:ert,代码行数:26,代码来源:enkf_tui_fs.c

示例7: enkf_main_smoother_JOB__

static void * enkf_main_smoother_JOB__( void * self , int iter , const stringlist_type * args ) {
  enkf_main_type   * enkf_main = enkf_main_safe_cast( self );
  int ens_size                 = enkf_main_get_ensemble_size( enkf_main );
  bool_vector_type * iactive   = bool_vector_alloc( ens_size , true );
  bool valid                   = true;
  const char * target_case;
  enkf_fs_type * target_fs     = enkf_main_get_fs( enkf_main );


  // Argument 0: Which case to write to. Default current case.
  if (stringlist_get_size(args)) {
    target_case = stringlist_iget( args , 0 );
    if (strcmp( target_case , CURRENT_CASE_STRING) == 0)
      target_case = enkf_fs_get_case_name(target_fs);
  } else
    target_case = enkf_fs_get_case_name(target_fs);

  //Argument 1: Rerun. Default false.
  bool rerun = (stringlist_get_size(args) >= 2) ? stringlist_iget_as_bool(args, 1, &valid) : false;

  if (!valid) {
      fprintf(stderr, "** Warning: Function %s : Second argument must be a bool value. Exiting job\n", __func__);
      return NULL;
  }
  enkf_main_run_smoother( enkf_main , target_case , iactive , iter , rerun);
  bool_vector_free( iactive );
  return NULL;
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:28,代码来源:enkf_main_jobs.c

示例8: test_measure

void test_measure( ert_test_context_type * test_context ) {
  enkf_main_type * enkf_main = ert_test_context_get_main( test_context );
  enkf_fs_type * fs = enkf_main_get_fs( enkf_main );
  enkf_obs_type * enkf_obs = enkf_main_get_obs( enkf_main );
  obs_vector_type * rft_obs = enkf_obs_get_vector( enkf_obs , "RFT_TEST");
  int_vector_type * ens_active_list = int_vector_alloc(0,0);
  active_list_type * active_list = active_list_alloc( );
  meas_data_type * meas_data_RFT;

  for (int i=0; i < enkf_main_get_ensemble_size( enkf_main ); i++)
    int_vector_append( ens_active_list , i );

  {
    bool_vector_type * ens_mask;
    ens_mask = int_vector_alloc_mask( ens_active_list );
    meas_data_RFT = meas_data_alloc( ens_mask );
    bool_vector_free( ens_mask );
  }

  obs_vector_measure( rft_obs , fs , 20 , ens_active_list , meas_data_RFT , active_list );

  int_vector_free( ens_active_list );
  active_list_free( active_list );
  meas_data_free( meas_data_RFT );
}
开发者ID:Ensembles,项目名称:ert,代码行数:25,代码来源:enkf_obs_vector_fs.c

示例9: enkf_tui_run_exp

void enkf_tui_run_exp(void * enkf_main) {
  const int ens_size          = enkf_main_get_ensemble_size( enkf_main );
  bool_vector_type * iactive  = bool_vector_alloc(0,false);

  state_enum init_state    = ANALYZED; 
  int start_report         = 0;
  int init_step_parameters = 0;
  
  {

    char * prompt = util_alloc_sprintf("Which realizations to simulate (Ex: 1,3-5) <Enter for all> [M to return to menu] : " , ens_size);
    char * select_string;
      
    util_printf_prompt(prompt , PROMPT_LEN , '=' , "=> ");
    select_string = util_alloc_stdin_line();
    enkf_tui_util_sscanf_active_list( iactive , select_string , ens_size);

    util_safe_free( select_string );
    free( prompt );
  }
  if (bool_vector_count_equal(iactive , true))
    enkf_main_run_exp(enkf_main , iactive , true , init_step_parameters , start_report , init_state, true);
  
  bool_vector_free(iactive);
}
开发者ID:PETECLAM,项目名称:ResInsight,代码行数:25,代码来源:enkf_tui_run.c

示例10: enkf_tui_run_smoother

void enkf_tui_run_smoother(void * arg) {
  enkf_main_type * enkf_main  = enkf_main_safe_cast( arg );
  int ens_size = enkf_main_get_ensemble_size( enkf_main );
  bool_vector_type * iactive = bool_vector_alloc( ens_size , true );
  enkf_main_run_smoother(enkf_main , "AUTO-SMOOTHER" , iactive , 0 , true );
  bool_vector_free( iactive );
}
开发者ID:blattms,项目名称:ert,代码行数:7,代码来源:enkf_tui_run.c

示例11: enkf_main_std_scale_correlated_obs_JOB

void * enkf_main_std_scale_correlated_obs_JOB(void * self, const stringlist_type * args)  {

  if (stringlist_get_size(args) > 0) {
    enkf_main_type * enkf_main              = enkf_main_safe_cast( self );
    int ensemble_size                       = enkf_main_get_ensemble_size(enkf_main);
    enkf_fs_type * fs                       = enkf_main_get_fs( enkf_main );
    enkf_obs_type * obs                     = enkf_main_get_obs( enkf_main );
    int_vector_type * realizations          = int_vector_alloc(1, 0);
    local_obsdata_type * obsdata = local_obsdata_alloc( "OBS-JOB" );

    int_vector_init_range(realizations, 0, ensemble_size, 1);

    for (int iarg = 0; iarg < stringlist_get_size(args); iarg++) {
      const char * arg_key = stringlist_iget( args , iarg );
      stringlist_type * key_list = enkf_obs_alloc_matching_keylist(obs, arg_key);
      for (int iobs=0; iobs < stringlist_get_size( key_list ); iobs++) {
        const char * obs_key = stringlist_iget( key_list , iobs);
        const obs_vector_type * obs_vector = enkf_obs_get_vector(obs, obs_key);
        local_obsdata_add_node( obsdata , obs_vector_alloc_local_node(obs_vector) );
      }
      stringlist_free( key_list );
    }

    if (local_obsdata_get_size(obsdata) > 0)
      enkf_obs_scale_correlated_std(obs, fs, realizations, obsdata );

    local_obsdata_free( obsdata );
  }

  return NULL;
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:31,代码来源:enkf_main_jobs.c

示例12: create_runpath

void create_runpath(enkf_main_type * enkf_main ) {
  const int ens_size         = enkf_main_get_ensemble_size( enkf_main );
  bool_vector_type * iactive = bool_vector_alloc(0,false);

  bool_vector_iset( iactive , ens_size - 1 , true );
  enkf_main_run_exp(enkf_main , iactive , false );
  bool_vector_free(iactive);
}
开发者ID:YingfangZhou,项目名称:ert,代码行数:8,代码来源:enkf_forward_init_SURFACE.c

示例13: enkf_tui_run_start

void enkf_tui_run_start(void * enkf_main) {
  const int ens_size = enkf_main_get_ensemble_size( enkf_main );
  bool_vector_type * iactive = bool_vector_alloc(ens_size , true);

  enkf_main_run_assimilation(enkf_main , iactive , 0 , 0 , ANALYZED);
  
  bool_vector_free(iactive);
}
开发者ID:blattms,项目名称:ert,代码行数:8,代码来源:enkf_tui_run.c

示例14: enkf_main_assimilation_JOB

void * enkf_main_assimilation_JOB( void * self , const stringlist_type * args ) {
  enkf_main_type   * enkf_main = enkf_main_safe_cast( self );
  int ens_size                 = enkf_main_get_ensemble_size( enkf_main );
  bool_vector_type * iactive   = bool_vector_alloc( 0 , true );

  bool_vector_iset( iactive , ens_size - 1 , true );
  enkf_main_run_assimilation( enkf_main , iactive , 0 , 0 ,  ANALYZED );
  return NULL;
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:9,代码来源:enkf_main_jobs.c

示例15: test_invalid_obs_vector

void test_invalid_obs_vector( enkf_main_type * enkf_main , const char * obs_key) {
  enkf_fs_type * fs = enkf_main_get_fs(enkf_main);
  enkf_obs_type * enkf_obs = enkf_main_get_obs( enkf_main );
  obs_vector_type * obs_vector = enkf_obs_get_vector( enkf_obs , obs_key );
  bool_vector_type * active_mask = bool_vector_alloc( enkf_main_get_ensemble_size( enkf_main ) , true);

  test_assert_false( obs_vector_has_data( obs_vector , active_mask , fs ));
  bool_vector_free( active_mask );
}
开发者ID:Ensembles,项目名称:ert,代码行数:9,代码来源:enkf_obs_vector_fs.c


注:本文中的enkf_main_get_ensemble_size函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。