diff --git a/src/chemistry/EAGLE/chemistry.h b/src/chemistry/EAGLE/chemistry.h index 8553f5004150add2e99f8b735d2ef51dd69ffac7..d268486631acd21522b7036259d4d3431e0440d1 100644 --- a/src/chemistry/EAGLE/chemistry.h +++ b/src/chemistry/EAGLE/chemistry.h @@ -37,6 +37,19 @@ #include "physical_constants.h" #include "units.h" +/** + * @brief Return a string containing the name of a given #chemistry_element. + */ +__attribute__((always_inline)) INLINE static const char* +chemistry_get_element_name(enum chemistry_element elem) { + + static const char* chemistry_element_names[chemistry_element_count] = { + "Hydrogen", "Helium", "Carbon", "Nitrogen", "Oxygen", + "Neon", "Magnesium", "Silicium", "Iron"}; + + return chemistry_element_names[elem]; +} + /** * @brief Sets the chemistry properties of the (x-)particles to a valid start * state. diff --git a/src/chemistry/EAGLE/chemistry_io.h b/src/chemistry/EAGLE/chemistry_io.h index b05eb0dbe9dd42aedd66a3ff8fcd420a3c6d6d37..70c62a1bbdcd646b7ec79f41943f8c6a7da2dea8 100644 --- a/src/chemistry/EAGLE/chemistry_io.h +++ b/src/chemistry/EAGLE/chemistry_io.h @@ -19,6 +19,7 @@ #ifndef SWIFT_CHEMISTRY_IO_EAGLE_H #define SWIFT_CHEMISTRY_IO_EAGLE_H +#include "chemistry.h" #include "io_properties.h" /** @@ -98,9 +99,14 @@ int chemistry_write_particles(const struct part* parts, struct io_props* list) { * @brief Writes the current model of SPH to the file * @param h_grpsph The HDF5 group in which to write */ -void chemistry_write_flavour(hid_t h_grpsph) { - - io_write_attribute_s(h_grpsph, "Chemistry Model", "EAGLE"); +void chemistry_write_flavour(hid_t h_grp) { + + io_write_attribute_s(h_grp, "Chemistry Model", "EAGLE"); + for (int elem = 0; elem < chemistry_element_count; ++elem) { + char buffer[20]; + sprintf(buffer, "Element %d", elem); + io_write_attribute_s(h_grp, buffer, chemistry_get_element_name(elem)); + } } #endif /* SWIFT_CHEMISTRY_IO_EAGLE_H */