这篇教程C++ vector_iget_const函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vector_iget_const函数的典型用法代码示例。如果您正苦于以下问题:C++ vector_iget_const函数的具体用法?C++ vector_iget_const怎么用?C++ vector_iget_const使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vector_iget_const函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: test_reversevoid test_reverse() { const char * val1 = "value1"; const char * val2 = "value2"; const char * val3 = "value3"; const char * val4 = "value4"; vector_type * vector1 = vector_alloc_new( ); vector_type * vector2 = vector_alloc_new( ); vector_append_ref( vector1 , val1 ); vector_append_ref( vector1 , val2 ); vector_append_ref( vector1 , val3 ); vector_append_ref( vector1 , val4 ); vector_append_ref( vector2 , val1 ); vector_append_ref( vector2 , val2 ); vector_append_ref( vector2 , val3 ); vector_append_ref( vector2 , val4 ); vector_inplace_reverse( vector1 ); { int i; int size = vector_get_size( vector1 ); for (i=0; i < vector_get_size( vector1 ); i++) test_assert_ptr_equal( vector_iget_const( vector2 , i ) , vector_iget_const( vector1 , size - 1 - i )); } vector_free( vector1 ); vector_free( vector2 );}
开发者ID:joelmheim,项目名称:ResInsight,代码行数:30,
示例2: well_ts_get_index__static int well_ts_get_index__( const well_ts_type * well_ts , int report_step , time_t sim_time , bool use_report) { const int size = vector_get_size( well_ts->ts ); if (size == 0) return 0; else { const well_node_type * first_node = vector_iget_const( well_ts->ts , 0 ); const well_node_type * last_node = vector_get_last_const( well_ts->ts ); if (use_report) { if (report_step < first_node->report_nr) return -1; // Before the start if (report_step >= last_node->report_nr) return size - 1; // After end } else { if (sim_time < first_node->sim_time) return -1; // Before the start if (sim_time >= last_node->sim_time) return size - 1; // After end } // Binary search { int lower_index = 0; int upper_index = size - 1; while (true) { int center_index = (lower_index + upper_index) / 2; const well_node_type * center_node = vector_iget_const( well_ts->ts , center_index ); double cmp; if (use_report) cmp = center_node->report_nr - report_step; else cmp = difftime( center_node->sim_time , sim_time ); if (cmp > 0) { if ((center_index - lower_index) == 1) // We found an interval of length 1 return lower_index; else upper_index = center_index; } else { if ((upper_index - center_index) == 1) // We found an interval of length 1 return center_index; else lower_index = center_index; } } } }}
开发者ID:JacobStoren,项目名称:ert,代码行数:54,
示例3: menu_runvoid menu_run(const menu_type * menu) { while (1) { int cmd; menu_display(menu); cmd = menu_read_cmd(menu); if (strchr(menu->quit_keys , cmd) != NULL) /* We have recieved a quit command - leave the building. */ break; /* OK - we start looking through all the available commands to see which this is. */ { int item_index = 0; while (1) { const menu_item_type * item = vector_iget_const(menu->items , item_index); if (!item->separator) { if(!item->helptext) { if (strchr(item->key_set , cmd) != NULL) { /* Calling the function ... */ menu_item_call( item ); break; } } } item_index++; } } }}
开发者ID:alfbr,项目名称:ResInsight,代码行数:31,
示例4: mainint main(int argc , char ** argv) { util_install_signals(); { ecl_grid_type * grid = ecl_grid_alloc( argv[1] ); vector_type * expected = load_expected( grid, argv[2] ); for (int c=0; c < vector_get_size( expected ); c++) { const point_type * p = vector_iget_const( expected , c ); int g = ecl_grid_get_global_index_from_xyz(grid , p->x, p->y , p->z , 0 ); if (g != ecl_grid_get_global_index3(grid, p->i,p->j, p->k)) { int i,j,k; ecl_grid_get_ijk1(grid, g, &i, &j, &k); fprintf(stderr,"point:%d (%g,%g,%g), Simulated: %d:(%d,%d,%d) Expected: %d:(%d,%d,%d) contains:%d/n", c , p->x, p->y, p->z, g, i,j,k, p->g, p->i, p->j, p->k, ecl_grid_cell_contains_xyz1( grid, p->g , p->x , p->y, p->z)); } if (!p->skip) test_assert_int_equal( g , ecl_grid_get_global_index3(grid, p->i,p->j, p->k)); else { if ( g != ecl_grid_get_global_index3(grid, p->i,p->j, p->k)) fprintf(stderr," ** Skipping failed test for point:%d /n",c); } } ecl_grid_free( grid ); vector_free( expected ); } exit(0);}
开发者ID:Ensembles,项目名称:ert,代码行数:27,
示例5: ecl_sum_data_get_report_step_from_daysint ecl_sum_data_get_report_step_from_days(const ecl_sum_data_type * data , double sim_days) { if ((sim_days < data->days_start) || (sim_days > data->sim_length)) return -1; else { int report_step = -1; double_vector_type * days_map = double_vector_alloc( 0 , 0 ); int_vector_type * report_map = int_vector_alloc( 0 , 0 ); int i; for (i=1; i < int_vector_size( data->report_last_index ); i++) { int ministep_index = int_vector_iget( data->report_last_index , i ); const ecl_sum_tstep_type * ministep = vector_iget_const( data->data , ministep_index ); double_vector_iset( days_map , i , ecl_sum_tstep_get_sim_days( ministep )); int_vector_iset( report_map , i , ecl_sum_tstep_get_report( ministep )); } { /** Hmmmm - double == comparison ... */ int index = double_vector_index_sorted( days_map , sim_days ); if (index >= 0) report_step = int_vector_iget( report_map , index ); } int_vector_free( report_map ); double_vector_free( days_map ); return report_step; }}
开发者ID:akva2,项目名称:ResInsight,代码行数:31,
示例6: ecl_rft_node_iget_gratdouble ecl_rft_node_iget_grat( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , PLT , index ); { const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index); return ecl_rft_cell_get_grat( cell ); }}
开发者ID:atgeirr,项目名称:ert,代码行数:7,
示例7: subst_list_fprintfvoid subst_list_fprintf(const subst_list_type * subst_list , FILE * stream) { int index; for (index=0; index < vector_get_size( subst_list->string_data ); index++) { const subst_list_string_type * node = vector_iget_const( subst_list->string_data , index ); fprintf(stream , "%s = %s/n" , node->key , node->value); }}
开发者ID:akva2,项目名称:ResInsight,代码行数:7,
示例8: ecl_sum_data_get_report_step_from_timeint ecl_sum_data_get_report_step_from_time(const ecl_sum_data_type * data , time_t sim_time) { if ((sim_time < data->data_start_time) || (sim_time > data->sim_end)) return -1; { int report_step = -1; time_t_vector_type * time_map = time_t_vector_alloc( 0 , 0 ); int_vector_type * report_map = int_vector_alloc( 0 , 0 ); int i; for (i=1; i < int_vector_size( data->report_last_index ); i++) { int ministep_index = int_vector_iget( data->report_last_index , i ); const ecl_sum_tstep_type * ministep = vector_iget_const( data->data , ministep_index ); time_t_vector_iset( time_map , i , ecl_sum_tstep_get_sim_time( ministep )); int_vector_iset( report_map , i , ecl_sum_tstep_get_report( ministep )); } { int index = time_t_vector_index_sorted( time_map , sim_time ); if (index >= 0) report_step = int_vector_iget( report_map , index ); } int_vector_free( report_map ); time_t_vector_free( time_map ); return report_step; }}
开发者ID:akva2,项目名称:ResInsight,代码行数:32,
示例9: ensemble_initvoid 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);}
开发者ID:akva2,项目名称:ResInsight,代码行数:33,
示例10: sched_block_fprintfstatic void sched_block_fprintf(const sched_block_type * block, FILE * stream){ int i; for (i=0; i < vector_get_size(block->kw_list); i++) { const sched_kw_type * sched_kw = vector_iget_const( block->kw_list , i); sched_kw_fprintf(sched_kw, stream); }}
开发者ID:YingfangZhou,项目名称:ert,代码行数:8,
示例11: obs_vector_install_nodevoid obs_vector_install_node(obs_vector_type * obs_vector , int index , void * node) { obs_vector_assert_node_type( obs_vector , node ); { if (vector_iget_const( obs_vector->nodes , index ) == NULL) obs_vector->num_active++; vector_iset_owned_ref( obs_vector->nodes , index , node , obs_vector->freef ); }}
开发者ID:patricknraanes,项目名称:ert,代码行数:9,
示例12: file_map_has_kw_ptrstatic bool file_map_has_kw_ptr( const file_map_type * file_map, const ecl_kw_type * ecl_kw) { int index; for (index = 0; index < vector_get_size( file_map->kw_list ); index++) { const ecl_file_kw_type * file_kw = vector_iget_const( file_map->kw_list , index ); if (ecl_file_kw_ptr_eq( file_kw , ecl_kw )) return true; } return false;}
开发者ID:akva2,项目名称:ResInsight,代码行数:9,
示例13: subst_list_iget_doc_stringconst char * subst_list_iget_doc_string( const subst_list_type * subst_list , int index) { if (index < vector_get_size(subst_list->string_data)) { const subst_list_string_type * node = vector_iget_const( subst_list->string_data , index ); return node->doc_string; } else { util_abort("%s: index:%d to large /n",__func__ , index); return NULL; }}
开发者ID:akva2,项目名称:ResInsight,代码行数:9,
示例14: local_updatestep_has_data_keybool local_updatestep_has_data_key( const local_updatestep_type * update_step , const char * key) { bool has_key = false; for (int i = 0; i < vector_get_size( update_step->ministep ); i++) { const local_ministep_type * ministep = vector_iget_const( update_step->ministep , i ); if (local_ministep_has_data_key(ministep, key)) has_key = true; } return has_key;}
开发者ID:Ensembles,项目名称:ert,代码行数:9,
示例15: ecl_rft_node_iget_cell_sortedconst ecl_rft_cell_type * ecl_rft_node_iget_cell_sorted( ecl_rft_node_type * rft_node , int index) { if (ecl_rft_node_is_RFT( rft_node )) return ecl_rft_node_iget_cell( rft_node , index ); else { if (!rft_node->sort_perm_in_sync) ecl_rft_node_create_sort_perm( rft_node ); return vector_iget_const( rft_node->cells , int_vector_iget( rft_node->sort_perm , index )); }}
开发者ID:atgeirr,项目名称:ert,代码行数:10,
示例16: file_map_fprintf_kw_liststatic void file_map_fprintf_kw_list(const file_map_type * file_map , FILE * stream) { int i; for (i=0; i < vector_get_size( file_map->kw_list ); i++) { const ecl_file_kw_type * file_kw = vector_iget_const( file_map->kw_list , i ); fprintf(stream , "%-8s %7d:%s/n", ecl_file_kw_get_header( file_kw ) , ecl_file_kw_get_size( file_kw ) , ecl_util_get_type_name( ecl_file_kw_get_type( file_kw ))); }}
开发者ID:joelmheim,项目名称:ResInsight,代码行数:10,
示例17: sched_file_alloc_time_t_vectortime_t_vector_type * sched_file_alloc_time_t_vector( const sched_file_type * sched_file ) { time_t_vector_type * vector = time_t_vector_alloc(0,0); int i; time_t_vector_append( vector , sched_file->start_time ); for (i=1; i < vector_get_size( sched_file->blocks ); i++) { const sched_block_type * block = vector_iget_const( sched_file->blocks , i ); time_t_vector_append( vector , block->block_end_time ); } return vector;}
开发者ID:YingfangZhou,项目名称:ert,代码行数:10,
示例18: gen_kw_config_alloc_name_liststringlist_type * gen_kw_config_alloc_name_list( const gen_kw_config_type * config ) { stringlist_type * name_list = stringlist_alloc_new(); int i; for (i=0; i < vector_get_size( config->parameters ); i++) { const gen_kw_parameter_type * parameter = vector_iget_const( config->parameters , i ); stringlist_append_ref( name_list , parameter->name ); /* If the underlying parameter goes out scope - whom bang .. */ } return name_list;}
开发者ID:danielfmva,项目名称:ert,代码行数:11,
示例19: sched_kw_compdat_fprintfvoid sched_kw_compdat_fprintf(const sched_kw_compdat_type *kw , FILE *stream) { fprintf(stream , "COMPDAT/n"); { int index; for (index = 0; index < vector_get_size( kw->completions ); index++) { const comp_type * comp = vector_iget_const( kw->completions , index ); comp_sched_fprintf(comp , stream); } } fprintf(stream , "//n/n");}
开发者ID:akva2,项目名称:ResInsight,代码行数:11,
示例20: nnc_info_alloc_copynnc_info_type * nnc_info_alloc_copy( const nnc_info_type * src_info ) { nnc_info_type * copy_info = nnc_info_alloc( src_info->lgr_nr ); int ivec; for (ivec = 0; ivec < vector_get_size( src_info->lgr_list ); ivec++) { nnc_vector_type * copy_vector = nnc_vector_alloc_copy( vector_iget_const( src_info->lgr_list , ivec)); nnc_info_add_vector( copy_info , copy_vector ); } return copy_info;}
开发者ID:Ensembles,项目名称:ert,代码行数:11,
示例21: sched_file_well_openbool sched_file_well_open( const sched_file_type * sched_file , int restart_nr , const char * well_name) { bool well_found = false; bool well_open = false; int block_nr = restart_nr; while (!well_found && (block_nr >= 0)) { sched_block_type * block = sched_file_iget_block( sched_file , block_nr ); if (hash_has_key( block->kw_hash , "WCONHIST")) { const vector_type * wconhist_vector = hash_get( block->kw_hash , "WCONHIST"); int i; for (i=0; i < vector_get_size( wconhist_vector ); i++) { const sched_kw_type * kw = vector_iget_const( wconhist_vector , i ); if (sched_kw_has_well( kw , well_name )) { well_found = true; well_open = sched_kw_well_open( kw , well_name ); } } } if (hash_has_key( block->kw_hash , "WCONINJE")) { const vector_type * wconinje_vector = hash_get( block->kw_hash , "WCONINJE"); int i; for (i=0; i < vector_get_size( wconinje_vector ); i++) { const sched_kw_type * kw = vector_iget_const( wconinje_vector , i ); if (sched_kw_has_well( kw , well_name )) { well_found = true; well_open = sched_kw_well_open( kw , well_name ); } } } block_nr--; } return well_open;}
开发者ID:YingfangZhou,项目名称:ert,代码行数:41,
示例22: obs_vector_install_nodevoid obs_vector_install_node(obs_vector_type * obs_vector , int index , void * node) { obs_vector_assert_node_type( obs_vector , node ); { if (vector_iget_const( obs_vector->nodes , index ) == NULL) { obs_vector->num_active++; int_vector_append( obs_vector->step_list , index ); int_vector_sort( obs_vector->step_list ); } vector_iset_owned_ref( obs_vector->nodes , index , node , obs_vector->freef ); }}
开发者ID:Ensembles,项目名称:ert,代码行数:12,
示例23: obs_vector_get_last_active_stepint obs_vector_get_last_active_step(const obs_vector_type * obs_vector) { int step = vector_get_size( obs_vector->nodes ) - 1; while (true) { const void * obs_node = vector_iget_const( obs_vector->nodes , step ); if (obs_node) break; step--; if (step < 0) break; } return step;}
开发者ID:patricknraanes,项目名称:ert,代码行数:13,
示例24: rms_tag_fprintfvoid rms_tag_fprintf(const rms_tag_type * tag , FILE * stream) { fprintf(stream , " <%s>/n",tag->name); { int i; for (i=0; i < vector_get_size( tag->key_list ); i++) { const rms_tagkey_type * tagkey = vector_iget_const( tag->key_list , i ); rms_tagkey_fprintf( tagkey , stream); } } fprintf(stream , " </%s>/n",tag->name);}
开发者ID:bramirex,项目名称:ert,代码行数:13,
示例25: subst_list_replace_strings__/** Updates the buffer inplace with all the string substitutions in the subst_list. This is the lowest level function, which does *NOT* consider the parent pointer.*/static void subst_list_replace_strings__(const subst_list_type * subst_list , buffer_type * buffer) { int index; for (index = 0; index < vector_get_size( subst_list->string_data ); index++) { const subst_list_string_type * node = vector_iget_const( subst_list->string_data , index ); if (node->value != NULL) { bool match; buffer_rewind( buffer ); do { match = buffer_search_replace( buffer , node->key , node->value); } while (match); } }}
开发者ID:akva2,项目名称:ResInsight,代码行数:18,
示例26: rms_tag_fwritevoid rms_tag_fwrite(const rms_tag_type * tag , FILE * stream) { rms_util_fwrite_string("tag" , stream); rms_util_fwrite_string(tag->name , stream); { int i; for (i=0; i < vector_get_size( tag->key_list ); i++) { const rms_tagkey_type * tagkey = vector_iget_const( tag->key_list , i ); rms_tagkey_fwrite( tagkey , stream); } } rms_util_fwrite_string("endtag" , stream);}
开发者ID:bramirex,项目名称:ert,代码行数:14,
示例27: subst_list_alloc_deep_copysubst_list_type * subst_list_alloc_deep_copy(const subst_list_type * src) { subst_list_type * copy; if (src->parent != NULL) copy = subst_list_alloc( src->parent ); else copy = subst_list_alloc( src->func_pool); { int index; for (index = 0; index < vector_get_size( src->string_data ); index++) { const subst_list_string_type * node = vector_iget_const( src->string_data , index ); subst_list_insert__( copy , node->key , node->value , node->doc_string , true , SUBST_DEEP_COPY); } for (index = 0; index < vector_get_size( src->func_data ); index++) { const subst_list_func_type * src_node = vector_iget_const( src->func_data , index ); subst_list_func_type * copy_node = subst_list_func_alloc( src_node->name , src_node->func ); vector_append_owned_ref( copy->func_data , copy_node , subst_list_func_free__ ); } } return copy;}
开发者ID:akva2,项目名称:ResInsight,代码行数:23,
示例28: menu_displaystatic void menu_display(const menu_type * menu) { int i; int length = strlen(menu->title); for (i = 0; i < vector_get_size(menu->items); i++) { const menu_item_type * item = vector_iget_const( menu->items , i); if(!item->helptext) length = util_int_max(length , item->label_length); if(item->helptext) length = util_int_max(length , 60); /* Hardcoded length for helptext*/ } printf("/n"); __print_line(length + 10 , 0); printf("| "); util_fprintf_string(menu->title , length + 6 , center_pad , stdout); printf(" |/n"); __print_line(length + 10 , 1); for (i=0; i < vector_get_size(menu->items); i++) { const menu_item_type * item = vector_iget_const( menu->items , i); if (item->separator) __print_sep(length + 6); else if (item->helptext) __print_helptext(item->label,length); else { printf("| %c: ", menu_item_get_key( item )); util_fprintf_string(item->label , length + 3 , right_pad , stdout); printf(" |/n"); } } __print_sep(length + 6); printf("| %c: ",menu->quit_keys[0]); util_fprintf_string(menu->quit_label , length + 3 , right_pad , stdout); printf(" |/n"); __print_line(length + 10 , 2); printf("/n");}
开发者ID:alfbr,项目名称:ResInsight,代码行数:37,
示例29: subst_list_eval_funcs____static void subst_list_eval_funcs____(const subst_list_type * subst_list , const parser_type * parser , buffer_type * buffer) { { int index; for (index = 0; index < vector_get_size( subst_list->func_data); index++) { const subst_list_func_type * subst_func = vector_iget_const( subst_list->func_data , index ); const char * func_name = subst_func->name; bool match; buffer_rewind( buffer ); do { size_t match_pos; match = buffer_strstr( buffer , func_name ); match_pos = buffer_get_offset( buffer ); if (match) { bool update = false; char * arg_start = buffer_get_data( buffer ); arg_start += buffer_get_offset( buffer ) + strlen( func_name ); if (arg_start[0] == '(') { /* We require that an opening paren follows immediately behind the function name. */ char * arg_end = strchr( arg_start , ')'); if (arg_end != NULL) { /* OK - we found an enclosing () pair. */ char * arg_content = util_alloc_substring_copy( arg_start, 1 , arg_end - arg_start - 1); stringlist_type * arg_list = parser_tokenize_buffer( parser , arg_content , true); char * func_eval = subst_list_func_eval( subst_func , arg_list ); int old_len = strlen(func_name) + strlen( arg_content) + 2; if (func_eval != NULL) { buffer_memshift( buffer , match_pos + old_len , strlen( func_eval ) - old_len); buffer_fwrite( buffer , func_eval , strlen( func_eval ) , sizeof * func_eval ); free( func_eval ); update = true; } free( arg_content ); stringlist_free( arg_list ); } } if (!update) buffer_fseek( buffer , match_pos + strlen( func_name ) , SEEK_SET); } } while (match); } } if (subst_list->parent != NULL) subst_list_eval_funcs____( subst_list->parent , parser , buffer );}
开发者ID:akva2,项目名称:ResInsight,代码行数:49,
示例30: workflow_runbool workflow_run(workflow_type * workflow, void * self , bool verbose , const subst_list_type * context) { vector_clear( workflow->stack ); workflow_try_compile( workflow , context); if (workflow->compiled) { int icmd; for (icmd = 0; icmd < vector_get_size( workflow->cmd_list ); icmd++) { const cmd_type * cmd = vector_iget_const( workflow->cmd_list , icmd ); void * return_value = workflow_job_run( cmd->workflow_job, self , verbose , cmd->arglist ); vector_push_front_ref( workflow->stack , return_value ); } return true; } else return false;}
开发者ID:YingfangZhou,项目名称:ert,代码行数:15,
注:本文中的vector_iget_const函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vector_length函数代码示例 C++ vector_iget函数代码示例 |