From 3cf0ba63c69d89d00a1a2da5e2086c0f63c73f5e Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Mon, 11 Dec 2017 12:28:49 +0000
Subject: [PATCH] Do not overwrite the time-step information on reception of
 xv,rho or gparts.

---
 src/engine.c | 26 ++++++++++++++------------
 src/runner.c |  8 ++++----
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 0a9ea25eb9..eb9ab79500 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -4312,7 +4312,8 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs,
   if (e->verbose) message("took %.3f %s.", e->wallclock_time, clocks_getunit());
 }
 
-integertime_t *address = 0;
+integertime_t *address_hydro = 0;
+integertime_t *address_gravity = 0;
 
 /**
  * @brief Let the #engine loose to compute the forces.
@@ -4360,17 +4361,18 @@ void engine_step(struct engine *e) {
   engine_print_task_counts(e);
   space_print_cells(e->s);
 
-/* /\* Register the time-step information *\/ */
-/* if(e->step == 3) { */
-
-/*   for(int i = 0; i< e->s->nr_cells; ++i) */
-/*     if(&e->s->cells_top[i] - e->s->cells_top == 12) { */
-/* 	message("Found cell!"); */
-/* 	address = &e->s->cells_top[i].ti_end_min; */
-/* 	message("address: %p time_end=%lld", address,
- * e->s->cells_top[i].ti_end_min); */
-/*     } */
-/* } */
+  /* Register the time-step information */
+  if(e->step == 3) {
+    
+    for(int i = 0; i< e->s->nr_cells; ++i)
+      if(&e->s->cells_top[i] - e->s->cells_top == 12) {
+	message("Found cell!");
+	address_hydro = &e->s->cells_top[i].ti_hydro_end_min;
+	address_gravity = &e->s->cells_top[i].ti_gravity_end_min;
+	message("address: %p time_end=%lld", address_hydro,
+		e->s->cells_top[i].ti_hydro_end_min);
+      }
+  }
 
 #ifdef WITH_MPI
   /* Repartition the space amongst the nodes? */
diff --git a/src/runner.c b/src/runner.c
index ece4b3e287..dc5fb9e51e 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -1645,8 +1645,8 @@ void runner_do_recv_part(struct runner *r, struct cell *c, int clear_sorts,
 #endif
 
   /* ... and store. */
-  c->ti_hydro_end_min = ti_hydro_end_min;
-  c->ti_hydro_end_max = ti_hydro_end_max;
+  //c->ti_hydro_end_min = ti_hydro_end_min;
+  //c->ti_hydro_end_max = ti_hydro_end_max;
   c->ti_old_part = ti_current;
   c->h_max = h_max;
 
@@ -1725,8 +1725,8 @@ void runner_do_recv_gpart(struct runner *r, struct cell *c, int timer) {
 #endif
 
   /* ... and store. */
-  c->ti_gravity_end_min = ti_gravity_end_min;
-  c->ti_gravity_end_max = ti_gravity_end_max;
+  //c->ti_gravity_end_min = ti_gravity_end_min;
+  //c->ti_gravity_end_max = ti_gravity_end_max;
   c->ti_old_gpart = ti_current;
 
   if (timer) TIMER_TOC(timer_dorecv_gpart);
-- 
GitLab