From 7eded9ce379b86a6bc66a5cb3e35ab256c8d6686 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Sun, 7 Feb 2016 18:39:41 +0000
Subject: [PATCH] Fixed documentation and MPI-friendly output

---
 src/debug.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/debug.c b/src/debug.c
index 457534a242..f775920570 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -34,6 +34,7 @@
 #include "./hydro/Default/hydro_debug.h"
 #endif
 
+extern int engine_rank;
 
 /**
  * @brief Looks for the particle with the given id and prints its information to
@@ -55,7 +56,11 @@ void printParticle(struct part *parts, struct xpart *xparts, long long int id,
   /* Look for the particle. */
   for (i = 0; i < N; i++)
     if (parts[i].id == id) {
+#ifdef WITH_MPI
+      printf("## [%d] Particle[%d]:\n id=%lld", engine_rank, i, parts[i].id);
+#else
       printf("## Particle[%d]:\n id=%lld", i, parts[i].id);
+#endif
       hydro_debug_particle(&parts[i], &xparts[i]);
       found = 1;
     }
@@ -88,11 +93,14 @@ void printgParticle(struct gpart *parts, long long int id, int N) {
  * @brief Prints the details of a given particle to stdout
  *
  * @param p The particle to print
+ * @param xp The extended data ot the particle to print
  *
  */
 
-void printParticle_single(struct part *p, struct xpart* xp) {
+void printParticle_single(struct part *p, struct xpart *xp) {
 
+  printf("## Particle: id=%lld", p->id);
+  hydro_debug_particle(p, xp);
 }
 
 #ifdef HAVE_METIS
-- 
GitLab