From c22ea734e80c9ff34c194970b6433d7a5486f3b2 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Mon, 7 May 2018 11:12:22 +0200
Subject: [PATCH] Added some more cosmological information to the snapshots.

---
 src/cosmology.c   | 9 +++++++++
 src/parallel_io.c | 1 +
 src/serial_io.c   | 1 +
 src/single_io.c   | 1 +
 4 files changed, 12 insertions(+)

diff --git a/src/cosmology.c b/src/cosmology.c
index a5034240d0..4da9528784 100644
--- a/src/cosmology.c
+++ b/src/cosmology.c
@@ -642,8 +642,12 @@ void cosmology_write_model(hid_t h_grp, const struct cosmology *c) {
   io_write_attribute_d(h_grp, "a_end", c->a_end);
   io_write_attribute_d(h_grp, "time_beg [internal units]", c->time_begin);
   io_write_attribute_d(h_grp, "time_end [internal units]", c->time_end);
+  io_write_attribute_d(h_grp, "Universe age [internal units]", c->time);
+  io_write_attribute_d(h_grp, "Lookback time [internal units]",
+                       c->lookback_time);
   io_write_attribute_d(h_grp, "h", c->h);
   io_write_attribute_d(h_grp, "H0 [internal units]", c->H0);
+  io_write_attribute_d(h_grp, "H [internal units]", c->H);
   io_write_attribute_d(h_grp, "Hubble time [internal units]", c->Hubble_time);
   io_write_attribute_d(h_grp, "Omega_m", c->Omega_m);
   io_write_attribute_d(h_grp, "Omega_r", c->Omega_r);
@@ -652,6 +656,11 @@ void cosmology_write_model(hid_t h_grp, const struct cosmology *c) {
   io_write_attribute_d(h_grp, "Omega_lambda", c->Omega_lambda);
   io_write_attribute_d(h_grp, "w_0", c->w_0);
   io_write_attribute_d(h_grp, "w_a", c->w_a);
+  io_write_attribute_d(h_grp, "w", c->w);
+  io_write_attribute_d(h_grp, "Redshift", c->z);
+  io_write_attribute_d(h_grp, "Scale-factor", c->a);
+  io_write_attribute_d(h_grp, "Critical density [internal units]",
+                       c->critical_density);
 }
 #endif
 
diff --git a/src/parallel_io.c b/src/parallel_io.c
index 51c88e9539..1446a30102 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -904,6 +904,7 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
   io_write_attribute(h_grp, "Dimension", INT, &dimension, 1);
   io_write_attribute(h_grp, "Redshift", DOUBLE, &e->cosmology->z, 1);
   io_write_attribute(h_grp, "Scale-factor", DOUBLE, &e->cosmology->a, 1);
+  io_write_attribute_s(h_grp, "Code", "SWIFT");
 
   /* GADGET-2 legacy values */
   /* Number of particles of each type */
diff --git a/src/serial_io.c b/src/serial_io.c
index dd623f946c..a088e71fbe 100644
--- a/src/serial_io.c
+++ b/src/serial_io.c
@@ -812,6 +812,7 @@ void write_output_serial(struct engine* e, const char* baseName,
     io_write_attribute(h_grp, "Dimension", INT, &dimension, 1);
     io_write_attribute(h_grp, "Redshift", DOUBLE, &e->cosmology->z, 1);
     io_write_attribute(h_grp, "Scale-factor", DOUBLE, &e->cosmology->a, 1);
+    io_write_attribute_s(h_grp, "Code", "SWIFT");
 
     /* GADGET-2 legacy values */
     /* Number of particles of each type */
diff --git a/src/single_io.c b/src/single_io.c
index 2170bcffc4..452c4fe27a 100644
--- a/src/single_io.c
+++ b/src/single_io.c
@@ -666,6 +666,7 @@ void write_output_single(struct engine* e, const char* baseName,
   io_write_attribute(h_grp, "Dimension", INT, &dimension, 1);
   io_write_attribute(h_grp, "Redshift", DOUBLE, &e->cosmology->z, 1);
   io_write_attribute(h_grp, "Scale-factor", DOUBLE, &e->cosmology->a, 1);
+  io_write_attribute_s(h_grp, "Code", "SWIFT");
 
   /* GADGET-2 legacy values */
   /* Number of particles of each type */
-- 
GitLab