Exemple #1
0
void SummaryComparator::getDataVecs(std::vector<double> &dataVec1,
                                    std::vector<double> &dataVec2,
                                    const char* keyword){
    dataVec1.reserve(ecl_sum_get_data_length(ecl_sum1));
    for (int time_index = 0; time_index < ecl_sum_get_data_length(ecl_sum1); time_index++){
        dataVec1.push_back(ecl_sum_iget(ecl_sum1, time_index, ecl_sum_get_general_var_params_index( ecl_sum1 , keyword )));
    }
    dataVec2.reserve(ecl_sum_get_data_length(ecl_sum2));
    for (int time_index = 0; time_index < ecl_sum_get_data_length(ecl_sum2); time_index++){

        dataVec2.push_back(ecl_sum_iget(ecl_sum2, time_index, ecl_sum_get_general_var_params_index( ecl_sum2 , keyword )));
    }
}
Exemple #2
0
static void __ecl_sum_fprintf_line( const ecl_sum_type * ecl_sum , FILE * stream , int internal_index , const bool_vector_type * has_var , const int_vector_type * var_index , char * date_string , const ecl_sum_fmt_type * fmt) {
  fprintf(stream , fmt->days_fmt , ecl_sum_iget_sim_days(ecl_sum , internal_index));
  fprintf(stream , "%s", fmt->sep );

  {
    struct tm ts;
    time_t sim_time = ecl_sum_iget_sim_time(ecl_sum , internal_index );
    util_localtime( &sim_time , &ts);
    strftime( date_string , DATE_STRING_LENGTH - 1 , fmt->date_fmt , &ts);
    fprintf(stream , "%s", date_string );
  }

  {
    int ivar;
    for (ivar = 0; ivar < int_vector_size( var_index ); ivar++) {
      if (bool_vector_iget( has_var , ivar )) {
        fprintf(stream , "%s", fmt->sep);
        fprintf(stream , fmt->value_fmt , ecl_sum_iget(ecl_sum , internal_index, int_vector_iget( var_index , ivar )));
      }
    }
  }

  fprintf(stream , "%s", fmt->newline);
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
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;
}