Logo Search packages:      
Sourcecode: ygraph version File versions  Download package

void time_list_merge ( DataSet data_set  ) 

Merge time values with the global_time_list.

Time values of frames in a newly loaded DataSet are merged with the already existing set of frames which are already known by the global_time_list, preserving ordering.

data_set The new DataSet.

Definition at line 658 of file read_data.c.

References _DataSet::frame, global_time_list, _DataSet::nframes, and _Frame::time.

Referenced by dataset_read_from_file(), and time_list_build().

  Frame* frame;
  gdouble frame_time;
  gdouble time;
  gint j;
  guint k;

  k = 0;
  for (j=0; j<data_set->nframes; ++j)
      frame = g_array_index(data_set->frame, Frame*, j);
      frame_time = frame->time;
      time = g_array_index(global_time_list, gdouble, k);

       * The epsilon is here so that if a pair of times differ only by
       * machine roundoff error, then they will not get counted twice.
      while ((frame_time > time+TIME_EPSILON) &&
             ((k+1) < global_time_list->len))
        time = g_array_index(global_time_list, gdouble, ++k);

      if (fabs(time - frame_time) > TIME_EPSILON*2)
        g_array_insert_val(global_time_list, k, frame_time);

Generated by  Doxygen 1.6.0   Back to index