Пример #1
0
void SummaryComparator::setTimeVecs(std::vector<double> &timeVec1,
                                    std::vector<double> &timeVec2){
    timeVec1.reserve(ecl_sum_get_data_length(ecl_sum1));
    for (int time_index = 0; time_index < ecl_sum_get_data_length(ecl_sum1); time_index++){
        timeVec1.push_back(ecl_sum_iget_sim_days(ecl_sum1 , time_index ));
    }
    timeVec2.reserve(ecl_sum_get_data_length(ecl_sum2));
    for (int time_index = 0; time_index < ecl_sum_get_data_length(ecl_sum2); time_index++){
        timeVec2.push_back(ecl_sum_iget_sim_days(ecl_sum2 , time_index ));
    }
}
Пример #2
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 )));
    }
}
Пример #3
0
bool ecl_sum_is_oil_producer( const ecl_sum_type * ecl_sum , const char * well) {
  const char * WOPT_KEY = "WOPT";
  bool oil_producer = false;

  if (ecl_sum_has_well_var( ecl_sum , well , WOPT_KEY)) {
    int last_step = ecl_sum_get_data_length( ecl_sum ) - 1;
    double wopt = ecl_sum_get_well_var( ecl_sum , last_step , well , WOPT_KEY);

    if (wopt > 0)
      oil_producer = true;
  }

  return oil_producer;
}
Пример #4
0
void ecl_sum_fprintf(const ecl_sum_type * ecl_sum , FILE * stream , const stringlist_type * var_list , bool report_only , const ecl_sum_fmt_type * fmt) {
  bool_vector_type  * has_var   = bool_vector_alloc( stringlist_get_size( var_list ), false );
  int_vector_type   * var_index = int_vector_alloc( stringlist_get_size( var_list ), -1 );
  char * date_string            = util_malloc( DATE_STRING_LENGTH * sizeof * date_string);

  char * current_locale = NULL;
  if (fmt->locale != NULL)
    current_locale = setlocale(LC_NUMERIC , fmt->locale);

  {
    int ivar;
    for (ivar = 0; ivar < stringlist_get_size( var_list ); ivar++) {
      if (ecl_sum_has_general_var( ecl_sum , stringlist_iget( var_list , ivar) )) {
        bool_vector_iset( has_var , ivar , true );
        int_vector_iset( var_index , ivar , ecl_sum_get_general_var_params_index( ecl_sum , stringlist_iget( var_list , ivar) ));
      } else {
        fprintf(stderr,"** Warning: could not find variable: \'%s\' in summary file \n", stringlist_iget( var_list , ivar));
        bool_vector_iset( has_var , ivar , false );
      }
    }
  }

  if (fmt->print_header)
    ecl_sum_fprintf_header( ecl_sum , var_list , has_var , stream , fmt);

  if (report_only) {
    int first_report = ecl_sum_get_first_report_step( ecl_sum );
    int last_report  = ecl_sum_get_last_report_step( ecl_sum );
    int report;

    for (report = first_report; report <= last_report; report++) {
      if (ecl_sum_data_has_report_step(ecl_sum->data , report)) {
        int time_index;
        time_index = ecl_sum_data_iget_report_end( ecl_sum->data , report );
        __ecl_sum_fprintf_line( ecl_sum , stream , time_index , has_var , var_index , date_string , fmt);
      }
    }
  } else {
    int time_index;
    for (time_index = 0; time_index < ecl_sum_get_data_length( ecl_sum ); time_index++)
      __ecl_sum_fprintf_line( ecl_sum , stream , time_index , has_var , var_index , date_string , fmt);
  }

  int_vector_free( var_index );
  bool_vector_free( has_var );
  if (current_locale != NULL)
    setlocale( LC_NUMERIC , current_locale);
  free( date_string );
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
int RifReaderEclipseSummary::timeStepCount() const
{
    assert(ecl_sum != NULL);

    return ecl_sum_get_data_length(ecl_sum);
}