summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Lundborg <lundborg.magnus@gmail.com>2013-12-04 15:40:01 (GMT)
committerMagnus Lundborg <lundborg.magnus@gmail.com>2013-12-04 15:40:01 (GMT)
commit58e095a2636b3823344137dbaf796d28859079d4 (patch)
treecd96efbff489a66fd6f950085cfb0c3665c823fd
parent63aa8c52a9539a7cca4c72760298dd79dc5594da (diff)
Better way to update time of frame set.
-rw-r--r--src/lib/tng_io.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c
index 1f13cd1..f5a4256 100644
--- a/src/lib/tng_io.c
+++ b/src/lib/tng_io.c
@@ -17631,6 +17631,7 @@ tng_function_status DECLSPECDLLEXPORT tng_util_generic_with_time_write
const char particle_dependency,
const char compression)
{
+ tng_trajectory_frame_set_t frame_set;
tng_function_status stat;
TNG_ASSERT(tng_data, "TNG library: Trajectory container not properly setup.");
@@ -17647,10 +17648,23 @@ tng_function_status DECLSPECDLLEXPORT tng_util_generic_with_time_write
{
return(stat);
}
+
+ frame_set = &tng_data->current_trajectory_frame_set;
+
/* first_frame_time is -1 when it is not yet set. */
- if(tng_data->current_trajectory_frame_set.first_frame_time < -0.1)
+ if(frame_set->first_frame_time < -0.1)
{
- stat = tng_frame_set_first_frame_time_set(tng_data, time);
+ if(frame_nr > frame_set->first_frame)
+ {
+ stat = tng_frame_set_first_frame_time_set(tng_data,
+ (frame_nr -
+ frame_set->first_frame) *
+ tng_data->time_per_frame);
+ }
+ else
+ {
+ stat = tng_frame_set_first_frame_time_set(tng_data, time);
+ }
}
return(stat);
}
contact: Jan Huwald // Impressum