bool ecl_sum_vector_add_key( ecl_sum_vector_type * ecl_sum_vector, const char * key){ if (ecl_sum_has_general_var( ecl_sum_vector->ecl_sum , key)) { const smspec_node_type * node = ecl_sum_get_general_var_node( ecl_sum_vector->ecl_sum , key ); int params_index = smspec_node_get_params_index( node ); bool is_rate_key = smspec_node_is_rate( node); int_vector_append(ecl_sum_vector->node_index_list, params_index); bool_vector_append(ecl_sum_vector->is_rate_list, is_rate_key); return true; } else return false; }
double ecl_sum_data_get_from_sim_time( const ecl_sum_data_type * data , time_t sim_time , const smspec_node_type * smspec_node) { int params_index = smspec_node_get_params_index( smspec_node ); if (smspec_node_is_rate( smspec_node )) { int time_index = ecl_sum_data_get_index_from_sim_time( data , sim_time ); return ecl_sum_data_iget( data , time_index , params_index); } else { /* Interpolated lookup based on two (hopefully) consecutive ministeps. */ double weight1 , weight2; int time_index1 , time_index2; ecl_sum_data_init_interp_from_sim_time( data , sim_time , &time_index1 , &time_index2 , &weight1 , &weight2); return ecl_sum_data_interp_get( data , time_index1 , time_index2 , weight1 , weight2 , params_index); } }
void ecl_sum_vector_add_keys( ecl_sum_vector_type * ecl_sum_vector, const char * pattern){ stringlist_type * keylist = ecl_sum_alloc_matching_general_var_list(ecl_sum_vector->ecl_sum , pattern); int num_keywords = stringlist_get_size(keylist); int i; for(i = 0; i < num_keywords ;i++){ const char * key = stringlist_iget(keylist, i); const smspec_node_type * node = ecl_sum_get_general_var_node( ecl_sum_vector->ecl_sum , key ); int params_index = smspec_node_get_params_index( node ); bool is_rate_key = smspec_node_is_rate( node); int_vector_append(ecl_sum_vector->node_index_list, params_index); bool_vector_append(ecl_sum_vector->is_rate_list, is_rate_key); } stringlist_free(keylist); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RifReaderEclipseSummary::values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values) { assert(ecl_sum != NULL); int variableIndex = indexFromAddress(resultAddress); if ( variableIndex < 0 ) return false; values->clear(); int tsCount = timeStepCount(); values->reserve(timeStepCount()); const smspec_node_type * ertSumVarNode = ecl_smspec_iget_node(eclSmSpec, variableIndex); int paramsIndex = smspec_node_get_params_index(ertSumVarNode); for(int time_index = 0; time_index < tsCount; time_index++) { double value = ecl_sum_iget(ecl_sum, time_index, paramsIndex); values->push_back(value); } return true; }
void ecl_sum_tstep_set_from_node( ecl_sum_tstep_type * tstep , const smspec_node_type * smspec_node , float value) { int data_index = smspec_node_get_params_index( smspec_node ); ecl_sum_tstep_iset( tstep , data_index , value); }
double ecl_sum_tstep_get_from_node( const ecl_sum_tstep_type * tstep , const smspec_node_type * smspec_node) { int data_index = smspec_node_get_params_index( smspec_node ); return ecl_sum_tstep_iget( tstep , data_index); }