Skip to content
Snippets Groups Projects
Commit e12b3e21 authored by lhausamm's avatar lhausamm Committed by Loic Hausammann
Browse files

Bugfix: fix code without logger

parent 9115ebed
No related branches found
No related tags found
1 merge request!502Logger
......@@ -230,7 +230,7 @@ __attribute__((always_inline)) INLINE static void gravity_first_init_gpart(
gravity_init_gpart(gp);
#ifdef WITH_LOGGER
gp->last_output = 0;
gp->last_output = SHRT_MAX;
gp->last_offset = 0;
#endif
}
......
......@@ -130,6 +130,7 @@ INLINE static void darkmatter_write_particles(const struct gpart* gparts,
void darkmatter_write_index(struct gpart* gparts, struct io_props* list,
int* num_fields) {
#ifdef WITH_LOGGER
/* Say how much we want to read */
*num_fields = 2;
......@@ -139,6 +140,9 @@ void darkmatter_write_index(struct gpart* gparts, struct io_props* list,
list[1] = io_make_output_field("Offset", ULONGLONG, 1,
UNIT_CONV_NO_UNITS, gparts, last_offset);
#else
error("Cannot write index without logger");
#endif
}
#endif /* SWIFT_DEFAULT_GRAVITY_IO_H */
......@@ -743,7 +743,6 @@ __attribute__((always_inline)) INLINE static void hydro_first_init_part(
struct part *restrict p, struct xpart *restrict xp) {
p->time_bin = 0;
p->last_offset = 0;
xp->v_full[0] = p->v[0];
xp->v_full[1] = p->v[1];
xp->v_full[2] = p->v[2];
......@@ -751,7 +750,11 @@ __attribute__((always_inline)) INLINE static void hydro_first_init_part(
xp->a_grav[1] = 0.f;
xp->a_grav[2] = 0.f;
xp->entropy_full = p->entropy;
#ifdef WITH_LOGGER
p->last_offset = 0;
xp->last_output = SHRT_MAX;
#endif
hydro_reset_acceleration(p);
hydro_init_part(p, NULL);
......
......@@ -201,6 +201,7 @@ INLINE static void hydro_write_particles(const struct part* parts,
void hydro_write_index(struct part* parts, struct io_props* list,
int* num_fields) {
#ifdef WITH_LOGGER
*num_fields = 2;
/* List what we want to write */
......@@ -209,6 +210,10 @@ void hydro_write_index(struct part* parts, struct io_props* list,
list[1] = io_make_output_field("Offset", ULONGLONG, 1,
UNIT_CONV_NO_UNITS, parts, last_offset);
#else
error("Cannot write index without logger");
#endif
}
......
......@@ -55,8 +55,10 @@ struct xpart {
/* Additional data used to record cooling information */
struct cooling_xpart_data cooling_data;
#ifdef WITH_LOGGER
/* Number of time step since last output */
short int last_output;
#endif
} SWIFT_STRUCT_ALIGN;
......@@ -93,8 +95,10 @@ struct part {
/* Entropy time derivative */
float entropy_dt;
#ifdef WITH_LOGGER
/* offset at last writing */
size_t last_offset;
#endif
union {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment