diff --git a/logger/logger_particle.h b/logger/logger_particle.h index 8906fd346298cb79393d0a1c347b9d0c2d4221bd..addd23564b65a734152ae8f538596d79019dd36f 100644 --- a/logger/logger_particle.h +++ b/logger/logger_particle.h @@ -104,4 +104,4 @@ void logger_particle_interpolate(struct logger_particle *part_curr, const struct logger_particle *part_next, const double time); -#endif //LOGGER_LOGGER_PARTICLE_H +#endif // LOGGER_LOGGER_PARTICLE_H diff --git a/logger/logger_time.c b/logger/logger_time.c index 829b87a1e1b84b122591d31680edf01733b71210..d2c6ebc3f9e3171ba7fdec6c6a63eb23d7001df6 100644 --- a/logger/logger_time.c +++ b/logger/logger_time.c @@ -45,7 +45,6 @@ void time_array_ensure_size(struct time_array *t) { /* Set the pointer to the new array */ t->records = tmp; - } /** @@ -236,14 +235,12 @@ size_t time_array_get_index(const struct time_array *t, const size_t offset) { while (left <= right) { size_t center = (left + right) / 2; const size_t offset_center = t->records[center].offset; - + if (offset > offset_center) { left = center + 1; - } - else if (offset < offset_center) { + } else if (offset < offset_center) { right = center - 1; - } - else { + } else { return center; } } @@ -277,8 +274,8 @@ void time_array_print(const struct time_array *t) { size_t n = t->size; size_t up_threshold = n - threshold; - printf("Times (size %lu): [%lli (%g)", n, - t->records[0].int_time, t->records[0].time); + printf("Times (size %lu): [%lli (%g)", n, t->records[0].int_time, + t->records[0].time); /* Loop over all elements. */ for (size_t i = 1; i < n; i++) { @@ -308,7 +305,8 @@ void time_array_print_offset(const struct time_array *t) { /* Loop over all elements. */ for (size_t i = 1; i < n; i++) { /* Skip the offset in the middle of the array. */ - if (i < threshold || i > up_threshold) printf(", %lu", t->records[i].offset); + if (i < threshold || i > up_threshold) + printf(", %lu", t->records[i].offset); if (i == threshold) printf(", ..."); } diff --git a/logger/tests/testTimeArray.c b/logger/tests/testTimeArray.c index f07f167496971f173ea27e6679350fe48f75465a..929a7124baa8ab05fd3452f87076d95c88c2f3b2 100644 --- a/logger/tests/testTimeArray.c +++ b/logger/tests/testTimeArray.c @@ -17,9 +17,9 @@ * ******************************************************************************/ -#include "logger_time.h" -#include <time.h> #include <stdlib.h> +#include <time.h> +#include "logger_time.h" #define NUMBER_OF_ELEMENT 10000 #define TIME_BASE 0.04 @@ -40,16 +40,16 @@ int main(int argc, char *argv[]) { time_array_init(×); /* Add elements */ - for(size_t i = 0; i < NUMBER_OF_ELEMENT; i++) { + for (size_t i = 0; i < NUMBER_OF_ELEMENT; i++) { integertime_t int_time = i; double time = i * TIME_BASE; size_t offset = i * OFFSET_BASE; - + time_array_append(×, int_time, time, offset); } /* Check the elements */ - for(size_t i = 0; i < NUMBER_OF_ELEMENT; i++) { + for (size_t i = 0; i < NUMBER_OF_ELEMENT; i++) { integertime_t int_time = i; double time = i * TIME_BASE; size_t offset = i * OFFSET_BASE; @@ -66,14 +66,13 @@ int main(int argc, char *argv[]) { /* Get the index from the offset */ size_t ind = time_array_get_index(×, read_offset); - + /* Check the values obtained */ assert(i == ind); assert(int_time == times.records[ind].int_time); assert(time == times.records[ind].time); - assert(offset == times.records[ind].offset); + assert(offset == times.records[ind].offset); } - return 0; } diff --git a/src/engine.c b/src/engine.c index 2b9cbd3895c21246c3f89fe1b69436e4a84185cb..e58590d2befd36f9a6f2d2ab0c78848158f87dca 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4792,7 +4792,7 @@ void engine_dump_snapshot(struct engine *e) { */ void engine_dump_index(struct engine *e) { -#if defined(WITH_LOGGER) +#if defined(WITH_LOGGER) && !defined(WITH_MPI) struct clocks_time time1, time2; clocks_gettime(&time1); diff --git a/src/logger_io.c b/src/logger_io.c index 9a4f10ea2e256e738f29d92057c824e7d948d735..c6be1f292434c759e20064542e91caa2cd238a4d 100644 --- a/src/logger_io.c +++ b/src/logger_io.c @@ -21,7 +21,7 @@ /* Config parameters. */ #include "../config.h" -#ifdef WITH_LOGGER +#if defined(WITH_LOGGER) && defined(HAVE_HDF5) && !defined(WITH_MPI) /* Some standard headers. */ #include <hdf5.h> @@ -296,4 +296,4 @@ void write_index_single(struct engine* e, const char* baseName, ++outputCount; } -#endif /* HAVE_HDF5 */ +#endif /* WITH_LOGGER && HAVE_HDF5 && !WITH_MPI */ diff --git a/src/logger_io.h b/src/logger_io.h index 574fc0129d4553e1a46bc747945e7a4318186600..a424c5c104b9f1090c69f7e0bb37e72635636f82 100644 --- a/src/logger_io.h +++ b/src/logger_io.h @@ -50,11 +50,13 @@ __attribute__((always_inline)) INLINE static void hydro_write_index( *num_fields = 2; /* List what we want to write */ - list[0] = io_make_output_field("ParticleIDs", ULONGLONG, 1, - UNIT_CONV_NO_UNITS, 0.f, parts, id, "will be erased"); + list[0] = + io_make_output_field("ParticleIDs", ULONGLONG, 1, UNIT_CONV_NO_UNITS, 0.f, + parts, id, "will be erased"); - list[1] = io_make_output_field("Offset", ULONGLONG, 1, UNIT_CONV_NO_UNITS, 0.f, - xparts, logger_data.last_offset, "will be erased"); + list[1] = + io_make_output_field("Offset", ULONGLONG, 1, UNIT_CONV_NO_UNITS, 0.f, + xparts, logger_data.last_offset, "will be erased"); } #endif