Beispiel #1
0
static void gen_data_set_data__(gen_data_type * gen_data , int size, const forward_load_context_type * load_context, ecl_data_type load_data_type , const void * data) {
  gen_data_assert_size(gen_data , size, forward_load_context_get_load_step( load_context ));
  if (gen_data_config_is_dynamic( gen_data->config ))
    gen_data_config_update_active( gen_data->config ,  load_context , gen_data->active_mask);
  
  gen_data_realloc_data(gen_data);

  if (size > 0) {
    ecl_data_type internal_type = gen_data_config_get_internal_data_type( gen_data->config );
    int byte_size = ecl_type_get_sizeof_ctype( internal_type ) * size ;

    if (ecl_type_is_equal(load_data_type, internal_type))
      memcpy(gen_data->data , data , byte_size );
    else {
      if (ecl_type_is_float(load_data_type))
        util_float_to_double((double *) gen_data->data , data , size);
      else
        util_double_to_float((float *) gen_data->data , data , size);
    }
  }
}
Beispiel #2
0
static void gen_data_set_data__(gen_data_type * gen_data , int size, int report_step , ecl_type_enum load_type , const void * data) {
  gen_data_assert_size(gen_data , size, report_step);

  if (gen_data_config_is_dynamic( gen_data->config ))
    gen_data_config_update_active( gen_data->config ,  report_step , gen_data->active_mask);

  gen_data_realloc_data(gen_data);

  if (size > 0) {
    ecl_type_enum internal_type = gen_data_config_get_internal_type( gen_data->config );
    int byte_size = ecl_util_get_sizeof_ctype( internal_type ) * size ;

    if (load_type == internal_type)
      memcpy(gen_data->data , data , byte_size );
    else {
      if (load_type == ECL_FLOAT_TYPE)
        util_float_to_double((double *) gen_data->data , data , size);
      else
        util_double_to_float((float *) gen_data->data , data , size);
    }
  }
}