static void ecl_sum_data_fwrite_unified( const ecl_sum_data_type * data , const char * ecl_case , bool fmt_case ) { char * filename = ecl_util_alloc_filename( NULL , ecl_case , ECL_UNIFIED_SUMMARY_FILE , fmt_case , 0 ); fortio_type * fortio = fortio_open_writer( filename , fmt_case , ECL_ENDIAN_FLIP ); int report_step; for (report_step = data->first_report_step; report_step <= data->last_report_step; report_step++) { if (ecl_sum_data_has_report_step( data , report_step )) ecl_sum_data_fwrite_report__( data , report_step , fortio ); } fortio_fclose( fortio ); free( filename ); }
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 ); }
bool ecl_sum_has_report_step(const ecl_sum_type * ecl_sum , int report_step ) { return ecl_sum_data_has_report_step( ecl_sum->data , report_step ); }