diff --git a/src/logger.c b/src/logger.c index 052f6d610f81d762db83d81e461e05ae9d5b23a6..824b36093bcbd2b5a3bca007e2dec5b6d3321070 100644 --- a/src/logger.c +++ b/src/logger.c @@ -118,25 +118,29 @@ void logger_log_part(struct part *p, unsigned int mask, size_t *offset, /* Particle position as three doubles. */ if (mask & logger_mask_x) { - memcpy(buff, p->x, 3 * sizeof(double)) + memcpy(buff, p->x, 3 * sizeof(double)); buff += 3 * sizeof(double); } /* Particle velocity as three floats. */ if (mask & logger_mask_v) { - memcpy(buff, p->v, 3 * sizeof(float)) + memcpy(buff, p->v, 3 * sizeof(float)); buff += 3 * sizeof(float); } /* Particle accelleration as three floats. */ if (mask & logger_mask_a) { - memcpy(buff, p->a_hydro, 3 * sizeof(float)) + memcpy(buff, p->a_hydro, 3 * sizeof(float)); buff += 3 * sizeof(float); } /* Particle internal energy as a single float. */ if (mask & logger_mask_u) { +#if defined(GADGET2_SPH) + memcpy(buff, &p->entropy, sizeof(float)); +#else memcpy(buff, &p->u, sizeof(float)); +#endif buff += sizeof(float); } diff --git a/src/logger.h b/src/logger.h index bc355d9f95b10feaa861b215c10e174c46a0742b..7cea6ad84d70cbba7937534f6c080a2d891bec30 100644 --- a/src/logger.h +++ b/src/logger.h @@ -25,7 +25,7 @@ /** * Logger entries contain messages representing the particle data at a given - * point in time during the simulation. + * point in time during the simulation. * * The logger messages always start with an 8-byte header structured as * follows: @@ -43,7 +43,8 @@ * | | | stored as three doubles. * 1 | v | 12 | Particle velocity, stored as three floats. * 2 | a | 12 | Particle acceleration, stored as three floats. - * 3 | u | 4 | Particle internal energy, stored as a single float. + * 3 | u | 4 | Particle internal energy (or entropy, if Gadget-SPH + * | | | is used), stored as a single float. * 4 | h | 4 | Particle smoothing length, stored as a single float. * 5 | rho | 4 | Particle density, stored as a single float. * 6 | consts | 12 | Particle constants, i.e. mass and ID. @@ -71,8 +72,11 @@ /* Function prototypes. */ int logger_size(unsigned int mask); -void logger_log_part(struct part *p, unsigned int mask, struct dump *dump); -void logger_log_gpart(struct gpart *p, unsigned int mask, struct dump *dump); -void logger_lot_timestamp(unsigned long long int timestamp, struct dump *dump); +void logger_log_part(struct part *p, unsigned int mask, size_t *offset, + struct dump *dump); +void logger_log_gpart(struct gpart *p, unsigned int mask, size_t *offset, + struct dump *dump); +void logger_lot_timestamp(unsigned long long int timestamp, size_t *offset, + struct dump *dump); #endif /* SWIFT_LOGGER_H */