Пример #1
0
void matrix_matlab_dump(const matrix_type * matrix, const char * filename) {
  FILE * stream = util_fopen( filename , "w");
  int i,j;
  util_fwrite_int( matrix->rows    , stream);
  util_fwrite_int( matrix->columns , stream);

  for (j=0; j < matrix->columns; j++)
    for (i=0; i < matrix->rows; i++)
      util_fwrite_double( matrix->data[ GET_INDEX(matrix , i , j) ] , stream);

  fclose(stream);
}
Пример #2
0
void misfit_ensemble_fwrite( const misfit_ensemble_type * misfit_ensemble , FILE * stream ) {
  int ens_size = vector_get_size( misfit_ensemble->ensemble);
  util_fwrite_int( misfit_ensemble->history_length , stream );
  util_fwrite_int( vector_get_size( misfit_ensemble->ensemble ) , stream);

  /* Writing the nodes - one for each ensemble member */
  {
    int iens;
    for (iens = 0; iens < ens_size; iens++) 
      misfit_member_fwrite( vector_iget( misfit_ensemble->ensemble , iens ) , stream ); 
  }
  
}
Пример #3
0
void ecl_file_kw_fwrite( const ecl_file_kw_type * file_kw , FILE * stream ) {
  int header_length = strlen( file_kw->header );
  for (int i=0; i < ECL_STRING8_LENGTH; i++) {
    if (i < header_length)
      fputc( file_kw->header[i], stream );
    else
      fputc( ' ' , stream );
  }

  util_fwrite_int( file_kw->kw_size , stream );
  util_fwrite_offset( file_kw->file_offset , stream );
  util_fwrite_int( ecl_type_get_type( file_kw->data_type ) , stream );
  util_fwrite_size_t( ecl_type_get_sizeof_iotype( file_kw->data_type ) , stream );
}
Пример #4
0
void stringlist_fwrite(const stringlist_type * s, FILE * stream) {
  int i;
  int size = stringlist_get_size( s );
  util_fwrite_int( size , stream);
  for (i=0; i < size; i++)
    util_fwrite_string(stringlist_iget(s , i) , stream);
}
Пример #5
0
void fortio_complete_write(fortio_type *fortio) {
  int file_header = fortio->active_header;
  if (fortio->endian_flip_header)
    util_endian_flip_vector(&file_header , sizeof file_header , 1);

  util_fwrite_int( file_header , fortio->stream );
  fortio->active_header = 0;
}
Пример #6
0
void  fortio_init_write(fortio_type *fortio , int record_size) {
  int file_header;
  fortio->active_header = record_size;
  file_header = fortio->active_header;
  if (fortio->endian_flip_header)
    util_endian_flip_vector(&file_header , sizeof file_header , 1);

  util_fwrite_int( file_header , fortio->stream );
  fortio->rec_nr++;
}
Пример #7
0
void matrix_fwrite(const matrix_type * matrix , FILE * stream) {
  util_fwrite_int( matrix->rows , stream );
  util_fwrite_int( matrix->columns , stream );

  if (matrix->column_stride == matrix->rows)
    util_fwrite( matrix->data , sizeof * matrix->data , matrix->columns * matrix->rows , stream , __func__);
  else {
    int column;
    for (column=0; column < matrix->columns; column++) {
      if (matrix->row_stride == 1) {
        const double * column_data = &matrix->data[ column * matrix->column_stride ];
        util_fwrite( column_data , sizeof * column_data , matrix->rows , stream , __func__);
      } else {
        int row;
        for (row=0; row < matrix->rows; row++)
          util_fwrite_double( matrix->data[ GET_INDEX( matrix , row , column )] , stream);
      }
    }
  }
}
Пример #8
0
void @TYPE@_vector_fwrite(const @TYPE@_vector_type * vector , FILE * stream) {
  util_fwrite_int( vector->size , stream );
  util_fwrite( &vector->default_value , sizeof vector->default_value , 1 , stream , __func__);
  @TYPE@_vector_fwrite_data( vector , stream );
}
Пример #9
0
void cases_config_fwrite( cases_config_type * config , const char * filename ) {
  FILE * stream = util_mkdir_fopen(filename , "w");
  int iteration_no = cases_config_get_iteration_number(config);
  util_fwrite_int( iteration_no , stream );
  fclose( stream );
}