本文整理汇总了C++中enkf_main_safe_cast函数的典型用法代码示例。如果您正苦于以下问题:C++ enkf_main_safe_cast函数的具体用法?C++ enkf_main_safe_cast怎么用?C++ enkf_main_safe_cast使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了enkf_main_safe_cast函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: enkf_tui_analysis_menu
void enkf_tui_analysis_menu(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
menu_type * menu = menu_alloc( "Analysis menu" , "Back" , "bB");
arg_pack_type * arg_pack = arg_pack_alloc();
arg_pack_append_ptr( arg_pack , enkf_main );
arg_pack_append_ptr( arg_pack , menu );
{
enkf_tui_analysis_update_title(enkf_main, menu);
if (enkf_main_have_obs(enkf_main)) {
menu_add_item(menu, "Global scaling of uncertainty", "gG", enkf_tui_analysis_scale_observation_std__, enkf_main, NULL);
menu_add_separator(menu);
}
menu_add_item(menu, "Select analysis module", "sS", enkf_tui_analysis_select_module__, arg_pack, NULL);
menu_add_item(menu, "List available modules", "lL", enkf_tui_analysis_list_modules__, enkf_main, NULL);
menu_add_item(menu, "Modify analysis module parameters", "mM", enkf_tui_analysis_update_module__, enkf_main, NULL);
menu_add_item(menu, "Reload current module (external only)", "rR", enkf_tui_analysis_reload_module__, enkf_main, NULL);
}
menu_run(menu);
menu_free(menu);
arg_pack_free(arg_pack);
}
开发者ID:pgdr,项目名称:ert,代码行数:25,代码来源:enkf_tui_analysis.c
示例2: enkf_main_rank_on_data_JOB
void * enkf_main_rank_on_data_JOB(void * self, const stringlist_type * args) {
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
const char * ranking_name = stringlist_iget(args, 0);
const char * data_key = stringlist_iget(args, 1);
bool valid = true;
bool sort_increasing = stringlist_iget_as_bool(args, 2, &valid);
if (!valid) {
fprintf(stderr,"** Third argument \"sort increasing\" not recognized as bool value, job not started\n");
return NULL;
}
int report_step = (stringlist_get_size(args) > 3) ? stringlist_iget_as_int(args, 3, &valid) : enkf_main_get_history_length(enkf_main) ;
if (!valid) {
fprintf(stderr,"** Fourth argument \"step\" not recognized as integer value, job not started\n");
return NULL;
}
if (report_step < 0) {
fprintf(stderr,"** Negative report step, job not started\n");
return NULL;
}
enkf_main_rank_on_data(enkf_main, ranking_name, data_key, sort_increasing, report_step);
return NULL;
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:26,代码来源:enkf_main_jobs.c
示例3: 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
示例4: enkf_tui_ranking_menu
void enkf_tui_ranking_menu(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
{
menu_type * menu = menu_alloc("Ranking of results" , "Back" , "bB");
menu_item_type * obs_item;
{
arg_pack_type * arg_pack = arg_pack_alloc();
arg_pack_append_ptr( arg_pack , enkf_main );
menu_add_item(menu , "Create/update misfit table" , "cC" , enkf_tui_ranking_make_misfit_ensemble , arg_pack , arg_pack_free__);
menu_add_separator( menu );
obs_item = menu_add_item(menu , "New observation based ranking" , "nN" , enkf_tui_ranking_create_obs , enkf_main , NULL);
arg_pack_append_ptr( arg_pack , obs_item );
}
menu_add_item(menu , "New data based ranking (Sort: increasing)" , "iI" , enkf_tui_ranking_create_data_increasing , enkf_main , NULL);
menu_add_item(menu , "New data based ranking (Sort: decreasing)" , "dD" , enkf_tui_ranking_create_data_decreasing , enkf_main , NULL);
menu_add_item(menu , "Show ranking" , "sS" , enkf_tui_ranking_display , enkf_main , NULL);
{
enkf_fs_type * fs = enkf_main_get_fs( enkf_main );
misfit_ensemble_type * misfit_ensemble = enkf_fs_get_misfit_ensemble( fs );
if (!misfit_ensemble_initialized( misfit_ensemble ))
menu_item_disable( obs_item );
}
menu_add_item(menu , "Help" , "hH" , enkf_tui_help_menu_rank , enkf_main , NULL);
menu_run(menu);
menu_free(menu);
}
}
开发者ID:akva2,项目名称:ResInsight,代码行数:29,代码来源:enkf_tui_ranking.c
示例5: 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
示例6: 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
示例7: enkf_main_create_case_JOB
void * enkf_main_create_case_JOB( void * self , const stringlist_type * args) {
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
const char * new_case = stringlist_iget( args , 0 );
enkf_fs_type * fs = enkf_main_mount_alt_fs( enkf_main , new_case , true );
enkf_fs_decref( fs );
return NULL;
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:7,代码来源:enkf_main_jobs.c
示例8: enkf_main_init_case_from_existing_JOB
void * enkf_main_init_case_from_existing_JOB( void * self , const stringlist_type * args) {
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
const char * source_case = stringlist_iget( args , 0 );
enkf_fs_type * source_fs = enkf_main_mount_alt_fs( enkf_main , source_case , true );
{
enkf_fs_type * target_fs;
if (stringlist_get_size(args) > 1) {
const char * current_case = enkf_main_get_current_fs(enkf_main);
const char * target_case = stringlist_iget( args , 1 );
if (0 != strcmp(current_case, target_case)) {
target_fs = enkf_main_mount_alt_fs( enkf_main , target_case , true );
} else
target_fs = enkf_fs_get_ref( enkf_main_get_fs(enkf_main) ); // Using get_ref so that we can unconditionally call decref() further down.
} else
target_fs = enkf_fs_get_ref( enkf_main_get_fs(enkf_main) ); // Using get_ref so that we can unconditionally call decref() further down.
enkf_main_init_case_from_existing(enkf_main, source_fs, 0, ANALYZED, target_fs);
enkf_fs_decref(target_fs);
}
enkf_fs_decref(source_fs);
return NULL;
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:25,代码来源:enkf_main_jobs.c
示例9: enkf_main_create_reports_JOB
void * enkf_main_create_reports_JOB(void * self , const stringlist_type * args ) {
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
ert_report_list_type * report_list = enkf_main_get_report_list( enkf_main );
ert_report_list_create( report_list , enkf_main_get_current_fs( enkf_main ) , true );
return NULL;
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:7,代码来源:enkf_main_jobs.c
示例10: enkf_main_analysis_enkf_update_JOB
void * enkf_main_analysis_enkf_update_JOB( void * self , const stringlist_type * args) {
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
enkf_fs_type * target_fs = enkf_main_get_fs( enkf_main );
int target_step;
int_vector_type * step_list;
// Argument 0: The number of the step to write to
if (stringlist_get_size(args) > 1)
util_sscanf_int(stringlist_iget( args , 1) , &target_step);
else
target_step = 0;
// Argument 1 - ??: The timesteps to use in the update
if (stringlist_get_size( args ) > 2) {
char * step_args = stringlist_alloc_joined_substring(args , 2 , stringlist_get_size(args) , " ");
step_list = string_util_alloc_active_list( step_args );
free( step_args );
} else
step_list = int_vector_alloc(1,target_step);
enkf_main_UPDATE( enkf_main , step_list , target_fs , target_step , SMOOTHER_UPDATE);
int_vector_free( step_list );
return NULL;
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:26,代码来源:enkf_main_jobs.c
示例11: enkf_tui_analysis_update_module__
void enkf_tui_analysis_update_module__(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
int prompt_len = 50;
{
const analysis_config_type * analysis_config = enkf_main_get_analysis_config( enkf_main );
analysis_module_type * analysis_module = analysis_config_get_active_module( analysis_config );
char var_name[256];
char value[256];
util_printf_prompt("Variable to modify" , prompt_len , '=' , "=> ");
scanf("%s", var_name);
{
char * value_prompt = util_alloc_sprintf("New value for %s" , var_name);
util_printf_prompt(value_prompt , prompt_len , '=' , "=> ");
free( value_prompt );
}
scanf("%s", value);
if (analysis_module_set_var( analysis_module , var_name , value))
printf("\'%s\' successfully set to \'%s\' \n",var_name , value);
else
printf("** Variable/type combination: %s/%s not recognized \n", var_name , value);
}
}
开发者ID:pgdr,项目名称:ert,代码行数:25,代码来源:enkf_tui_analysis.c
示例12: enkf_tui_run_iterated_ES
void enkf_tui_run_iterated_ES(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
const analysis_config_type * analysis_config = enkf_main_get_analysis_config(enkf_main);
analysis_iter_config_type * iter_config = analysis_config_get_iter_config(analysis_config);
int num_iter = analysis_iter_config_get_num_iterations(iter_config);
enkf_main_run_iterated_ES(enkf_main , 0 , num_iter );
}
开发者ID:blattms,项目名称:ert,代码行数:7,代码来源:enkf_tui_run.c
示例13: 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
示例14: enkf_tui_fs_initialize_case_for_predictions
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);
}
}
开发者ID:JacobStoren,项目名称:ert,代码行数:32,代码来源:enkf_tui_fs.c
示例15: 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
示例16: enkf_main_select_module_JOB
void * enkf_main_select_module_JOB( void * self , const stringlist_type * args ) {
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
analysis_config_type * analysis_config = enkf_main_get_analysis_config( enkf_main );
analysis_config_select_module( analysis_config , stringlist_iget( args , 0 ));
return NULL;
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:8,代码来源:enkf_main_jobs.c
示例17: enkf_main_export_ranking_JOB
void * enkf_main_export_ranking_JOB(void * self, const stringlist_type * args) {
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
const char * ranking_name = stringlist_iget(args, 0);
const char * ranking_file = stringlist_iget(args, 1);
enkf_main_export_ranking(enkf_main, ranking_name, ranking_file);
return NULL;
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:8,代码来源:enkf_main_jobs.c
示例18: enkf_main_rank_on_observations_JOB
void * enkf_main_rank_on_observations_JOB(void * self, const stringlist_type * args) {
enkf_main_type * enkf_main = enkf_main_safe_cast( self );
const char * ranking_name = stringlist_iget(args, 0);
bool step_arguments = false;
bool obs_arguments = false;
int delimiter = 0;
{
delimiter = stringlist_find_first(args, "|");
if (delimiter > -1) {
step_arguments = (delimiter > 1) ? true : false;
obs_arguments = (stringlist_get_size(args) > delimiter + 1) ? true : false;
} else if (stringlist_get_size(args) > 1) {
step_arguments = true;
delimiter = stringlist_get_size(args);
}
}
int_vector_type * steps_vector = NULL;
{
char * report_steps = NULL;
if (step_arguments)
report_steps = stringlist_alloc_joined_substring(args, 1, delimiter, ",");
else
report_steps = util_alloc_sprintf("0-%d", enkf_main_get_history_length(enkf_main));
steps_vector = string_util_alloc_value_list(report_steps);
free(report_steps);
}
stringlist_type * obs_ranking_keys = NULL;
{
char * obs_key_char = NULL;
if (obs_arguments)
obs_key_char = stringlist_alloc_joined_substring( args , delimiter+1 , stringlist_get_size(args) , " ");
enkf_obs_type * enkf_obs = enkf_main_get_obs(enkf_main);
obs_ranking_keys = enkf_obs_alloc_matching_keylist( enkf_obs , obs_key_char );
if ((obs_arguments) && (stringlist_get_size(obs_ranking_keys) == 0)) {
fprintf(stderr,"The input string : \"%s\" did not resolve to any valid observation keys. Job not started\n", obs_key_char);
return NULL;
}
if (obs_arguments)
free(obs_key_char);
}
enkf_main_rank_on_observations(enkf_main, ranking_name, obs_ranking_keys, steps_vector);
stringlist_free(obs_ranking_keys);
int_vector_free(steps_vector);
return NULL;
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:58,代码来源:enkf_main_jobs.c
示例19: enkf_tui_help_menu_table
void enkf_tui_help_menu_table(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
menu_type * menu = menu_alloc("Help: Table of results" , "Back" , "bB");
menu_add_helptext(menu , "This option can generate a table of results after the case has been run.");
menu_add_item(menu , "Open manual (firefox)" , "mM" , enkf_tui_help_manual_table , enkf_main , NULL);
menu_run(menu);
menu_free(menu);
}
开发者ID:akva2,项目名称:ert,代码行数:9,代码来源:enkf_tui_help.c
示例20: enkf_tui_help_menu_run
void enkf_tui_help_menu_run(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
menu_type * menu = menu_alloc("Help: Run menu" , "Back" , "bB");
menu_add_helptext(menu , "This menu is used to do the main work in ERT. The first option, x: Ensemble run: history, will just run the case without any data conditioning. Options r and s will initiate classical enkf runs. The two options i and t invokes the ensemble kalman smoother.");
menu_add_item(menu , "Open manual (firefox)" , "mM" , enkf_tui_help_manual_run , enkf_main , NULL);
menu_run(menu);
menu_free(menu);
}
开发者ID:akva2,项目名称:ert,代码行数:9,代码来源:enkf_tui_help.c
注:本文中的enkf_main_safe_cast函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论