From ba67300efa6b81306785048cd848f0b509951a7d Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Tue, 28 May 2019 22:41:23 +0200 Subject: [PATCH] Print the description of the output fields as comments in the output list yaml file. --- src/black_holes/Default/black_holes_part.h | 2 ++ src/common_io.c | 9 ++++++++- src/gravity/Default/gravity_io.h | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/black_holes/Default/black_holes_part.h b/src/black_holes/Default/black_holes_part.h index 360eb45d9e..445d0ba8be 100644 --- a/src/black_holes/Default/black_holes_part.h +++ b/src/black_holes/Default/black_holes_part.h @@ -22,6 +22,8 @@ /* Some standard headers. */ #include <stdlib.h> +#include "timeline.h" + /** * @brief Particle fields for the black hole particles. * diff --git a/src/common_io.c b/src/common_io.c index 537f06e538..c4d2f335a4 100644 --- a/src/common_io.c +++ b/src/common_io.c @@ -25,6 +25,7 @@ #include "common_io.h" /* Local includes. */ +#include "black_holes_io.h" #include "chemistry_io.h" #include "engine.h" #include "error.h" @@ -1819,6 +1820,10 @@ void io_write_output_field_parameter(const char* filename) { stars_write_particles(NULL, list, &num_fields); break; + case swift_type_black_hole: + black_holes_write_particles(NULL, list, &num_fields); + break; + default: break; } @@ -1830,7 +1835,9 @@ void io_write_output_field_parameter(const char* filename) { /* Write all the fields of this particle type */ for (int i = 0; i < num_fields; ++i) - fprintf(file, " %s_%s: 1\n", list[i].name, part_type_names[ptype]); + fprintf(file, " %s_%s: %*d \t # %s\n", list[i].name, + part_type_names[ptype], (int)(28 - strlen(list[i].name)), 1, + list[i].description); fprintf(file, "\n"); } diff --git a/src/gravity/Default/gravity_io.h b/src/gravity/Default/gravity_io.h index edd0f60bc3..c4c41c8d9c 100644 --- a/src/gravity/Default/gravity_io.h +++ b/src/gravity/Default/gravity_io.h @@ -116,8 +116,8 @@ INLINE static void darkmatter_write_particles(const struct gpart* gparts, list[3] = io_make_output_field("ParticleIDs", ULONGLONG, 1, UNIT_CONV_NO_UNITS, 0.f, gparts, id_or_neg_offset, ""); - list[4] = io_make_output_field("GroupIDs", INT, 1, UNIT_CONV_NO_UNITS, 0.f, gparts, - group_id, ""); + list[4] = io_make_output_field("GroupIDs", INT, 1, UNIT_CONV_NO_UNITS, 0.f, + gparts, group_id, ""); } #endif /* SWIFT_DEFAULT_GRAVITY_IO_H */ -- GitLab