diff --git a/examples/main.c b/examples/main.c index 3952550e327683a9e386405526608eb87b8a6bd3..fa7f541639f57eb09ef418ef4a55ac0690509fa2 100644 --- a/examples/main.c +++ b/examples/main.c @@ -244,7 +244,8 @@ int main(int argc, char *argv[]) { "Run with time-step synchronization of particles hit by " "feedback events.", NULL, 0, 0), - OPT_BOOLEAN(0, "csds", &with_csds, "Run with the Continuous Simulation Data Stream (CSDS).", + OPT_BOOLEAN(0, "csds", &with_csds, + "Run with the Continuous Simulation Data Stream (CSDS).", NULL, 0, 0), OPT_BOOLEAN('R', "radiation", &with_rt, "Run with radiative transfer. Work in progress, currently " @@ -1733,10 +1734,10 @@ int main(int argc, char *argv[]) { /* Write a sentinel timestamp */ if (e.policy & engine_policy_cosmology) { csds_log_timestamp(e.csds, e.ti_current, e.cosmology->a, - &e.csds->timestamp_offset); + &e.csds->timestamp_offset); } else { csds_log_timestamp(e.csds, e.ti_current, e.time, - &e.csds->timestamp_offset); + &e.csds->timestamp_offset); } } #endif diff --git a/src/cell_drift.c b/src/cell_drift.c index 1eb592db71fdd57afacc9c20d59de4144a66c227..8aa90cce4f69120da742171f35e325c92174800b 100644 --- a/src/cell_drift.c +++ b/src/cell_drift.c @@ -187,7 +187,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) { if (e->policy & engine_policy_csds) { /* Log the particle one last time. */ csds_log_part(e->csds, p, xp, e, /* log_all */ 1, - csds_flag_delete, /* data */ 0); + csds_flag_delete, /* data */ 0); } #endif @@ -383,7 +383,7 @@ void cell_drift_gpart(struct cell *c, const struct engine *e, int force) { if (e->policy & engine_policy_csds) { /* Log the particle one last time. */ csds_log_gpart(e->csds, gp, e, /* log_all */ 1, - csds_flag_delete, /* data */ 0); + csds_flag_delete, /* data */ 0); } #endif @@ -535,8 +535,8 @@ void cell_drift_spart(struct cell *c, const struct engine *e, int force) { #ifdef WITH_CSDS if (e->policy & engine_policy_csds) { /* Log the particle one last time. */ - csds_log_spart(e->csds, sp, e, /* log_all */ 1, - csds_flag_delete, /* data */ 0); + csds_log_spart(e->csds, sp, e, /* log_all */ 1, csds_flag_delete, + /* data */ 0); } #endif diff --git a/src/chemistry/GEAR/chemistry_csds.c b/src/chemistry/GEAR/chemistry_csds.c index db81e83bb9b54deb73ac46a6caf8b8fb6ed67788..c908f4bd93ac3b00ffb57808e4f7a99fe93b8bf3 100644 --- a/src/chemistry/GEAR/chemistry_csds.c +++ b/src/chemistry/GEAR/chemistry_csds.c @@ -23,12 +23,11 @@ #include "chemistry_csds.h" -const char - *chemistry_csds_field_names_part[chemistry_csds_field_part_count] = { - "ChemistryHydro", +const char *chemistry_csds_field_names_part[chemistry_csds_field_part_count] = { + "ChemistryHydro", }; -const char - *chemistry_csds_field_names_spart[chemistry_csds_field_spart_count] = { +const char *chemistry_csds_field_names_spart[chemistry_csds_field_spart_count] = + { "MetalMassFractions", }; diff --git a/src/chemistry/GEAR/chemistry_csds.h b/src/chemistry/GEAR/chemistry_csds.h index 09c5815c5f41943c9922df521f370470fe691d4d..f2d7df02e9b8eb6ec702a34ab5615df17580ac94 100644 --- a/src/chemistry/GEAR/chemistry_csds.h +++ b/src/chemistry/GEAR/chemistry_csds.h @@ -19,8 +19,8 @@ #ifndef SWIFT_CHEMISTRY_NONE_CHEMISTRY_CSDS_H #define SWIFT_CHEMISTRY_NONE_CHEMISTRY_CSDS_H -#include "hydro.h" #include "csds_io.h" +#include "hydro.h" #ifdef WITH_CSDS @@ -107,8 +107,8 @@ INLINE static void chemistry_csds_compute_size_and_mask_part( const struct xpart *xpart, const int write_all, size_t *buffer_size, unsigned int *mask) { /* Add the chemistry. */ - *mask |= csds_add_field_to_mask(masks[chemistry_csds_field_part_all], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[chemistry_csds_field_part_all], buffer_size); } /** @@ -154,8 +154,7 @@ INLINE static char *chemistry_csds_write_particle( const struct xpart *xp, unsigned int *mask, char *buff) { /* Write the chemistry. */ - if (csds_should_write_field(mask_data[chemistry_csds_field_part_all], - mask)) { + if (csds_should_write_field(mask_data[chemistry_csds_field_part_all], mask)) { /* Write the smoothed metal mass fraction */ memcpy(buff, p->chemistry_data.smoothed_metal_mass_fraction, diff --git a/src/chemistry/none/chemistry_csds.c b/src/chemistry/none/chemistry_csds.c index f8dd589fb9742008cd3d3f1c95b599dcc3315602..098ea985a3b12679110524e829cf11c25036e387 100644 --- a/src/chemistry/none/chemistry_csds.c +++ b/src/chemistry/none/chemistry_csds.c @@ -23,9 +23,9 @@ #include "chemistry_csds.h" -const char - *chemistry_csds_field_names_part[chemistry_csds_field_part_count] = {}; -const char * - chemistry_csds_field_names_spart[chemistry_csds_field_spart_count] = {}; +const char *chemistry_csds_field_names_part[chemistry_csds_field_part_count] = + {}; +const char *chemistry_csds_field_names_spart[chemistry_csds_field_spart_count] = + {}; #endif // WITH_CSDS diff --git a/src/csds.c b/src/csds.c index 12d45131aa686529df7b9c7959f0a90cc86859bf..ae59446a82f7fb8561cf2ccb693c3a28f76bbe95 100644 --- a/src/csds.c +++ b/src/csds.c @@ -93,8 +93,7 @@ char csds_file_format[csds_format_size] = "SWIFT_CSDS"; * @return updated buff */ char *csds_write_record_header(char *buff, const unsigned int *mask, - const size_t *offset, - const size_t offset_new) { + const size_t *offset, const size_t offset_new) { /* write mask. */ memcpy(buff, mask, csds_mask_size); buff += csds_mask_size; @@ -116,7 +115,7 @@ char *csds_write_record_header(char *buff, const unsigned int *mask, * @param p pointer to the data */ void csds_write_data(struct dump *d, size_t *offset, size_t size, - const void *p) { + const void *p) { /* get buffer. */ char *buff = dump_get(d, size, offset); @@ -134,8 +133,7 @@ void csds_write_data(struct dump *d, size_t *offset, size_t size, * @param log The #csds_writer * @param e The #engine */ -void csds_log_all_particles(struct csds_writer *log, - const struct engine *e) { +void csds_log_all_particles(struct csds_writer *log, const struct engine *e) { /* Ensure that enough space is available. */ csds_ensure_size(log, e->s->nr_parts, e->s->nr_gparts, e->s->nr_sparts); @@ -149,8 +147,8 @@ void csds_log_all_particles(struct csds_writer *log, struct xpart *xp = &s->xparts[i]; if (!part_is_inhibited(p, e) && p->time_bin != time_bin_not_created) { csds_log_part(log, p, xp, e, - /* log_all_fields */ 1, csds_flag_none, - /* data */ 0); + /* log_all_fields */ 1, csds_flag_none, + /* data */ 0); } } @@ -161,8 +159,8 @@ void csds_log_all_particles(struct csds_writer *log, (gp->type == swift_type_dark_matter || gp->type == swift_type_dark_matter_background)) { csds_log_gpart(log, gp, e, - /* log_all_fields */ 1, csds_flag_none, - /* data */ 0); + /* log_all_fields */ 1, csds_flag_none, + /* data */ 0); } } @@ -171,8 +169,8 @@ void csds_log_all_particles(struct csds_writer *log, struct spart *sp = &s->sparts[i]; if (!spart_is_inhibited(sp, e) && sp->time_bin != time_bin_not_created) { csds_log_spart(log, sp, e, - /* log_all_fields */ 1, csds_flag_none, - /* data */ 0); + /* log_all_fields */ 1, csds_flag_none, + /* data */ 0); } } @@ -192,11 +190,10 @@ void csds_log_all_particles(struct csds_writer *log, * @param buff The buffer to use when writing. * @param special_flags The data for the special flags. */ -void csds_copy_part_fields(const struct csds_writer *log, - const struct part *p, const struct xpart *xp, - const struct engine *e, unsigned int mask, - size_t *offset, size_t offset_new, char *buff, - const uint32_t special_flags) { +void csds_copy_part_fields(const struct csds_writer *log, const struct part *p, + const struct xpart *xp, const struct engine *e, + unsigned int mask, size_t *offset, size_t offset_new, + char *buff, const uint32_t special_flags) { #ifdef SWIFT_DEBUG_CHECKS if (mask == 0) { @@ -216,10 +213,10 @@ void csds_copy_part_fields(const struct csds_writer *log, } /* Write the hydro fields */ - buff = hydro_csds_write_particle(log->mask_data_pointers.hydro, p, xp, - &mask, buff); + buff = hydro_csds_write_particle(log->mask_data_pointers.hydro, p, xp, &mask, + buff); buff = chemistry_csds_write_particle(log->mask_data_pointers.chemistry_part, - p, xp, &mask, buff); + p, xp, &mask, buff); #ifdef SWIFT_DEBUG_CHECKS if (mask) { @@ -240,13 +237,12 @@ void csds_copy_part_fields(const struct csds_writer *log, * @param flag_data The data to write for the flag. */ void csds_log_part(struct csds_writer *log, const struct part *p, - struct xpart *xp, const struct engine *e, - const int log_all_fields, - const enum csds_special_flags flag, - const int flag_data) { + struct xpart *xp, const struct engine *e, + const int log_all_fields, const enum csds_special_flags flag, + const int flag_data) { csds_log_parts(log, p, xp, /* count= */ 1, e, log_all_fields, flag, - flag_data); + flag_data); } /** @@ -262,10 +258,9 @@ void csds_log_part(struct csds_writer *log, const struct part *p, * @param flag_data The data to write for the flag. */ void csds_log_parts(struct csds_writer *log, const struct part *p, - struct xpart *xp, int count, const struct engine *e, - const int log_all_fields, - const enum csds_special_flags flag, - const int flag_data) { + struct xpart *xp, int count, const struct engine *e, + const int log_all_fields, + const enum csds_special_flags flag, const int flag_data) { /* Build the special flag */ const int size_special_flag = @@ -285,7 +280,7 @@ void csds_log_parts(struct csds_writer *log, const struct part *p, unsigned int mask = 0; size_t size = 0; hydro_csds_compute_size_and_mask(log->mask_data_pointers.hydro, &p[i], - &xp[i], log_all_fields, &size, &mask); + &xp[i], log_all_fields, &size, &mask); chemistry_csds_compute_size_and_mask_part( log->mask_data_pointers.chemistry_part, &p[i], &xp[i], log_all_fields, &size, &mask); @@ -312,7 +307,7 @@ void csds_log_parts(struct csds_writer *log, const struct part *p, size_t size = 0; unsigned int mask = 0; hydro_csds_compute_size_and_mask(log->mask_data_pointers.hydro, &p[i], - &xp[i], log_all_fields, &size, &mask); + &xp[i], log_all_fields, &size, &mask); chemistry_csds_compute_size_and_mask_part( log->mask_data_pointers.chemistry_part, &p[i], &xp[i], log_all_fields, &size, &mask); @@ -330,8 +325,8 @@ void csds_log_parts(struct csds_writer *log, const struct part *p, /* Copy everything into the buffer */ csds_copy_part_fields(log, &p[i], &xp[i], e, mask, - &xp[i].csds_data.last_offset, offset_new, buff, - special_flags); + &xp[i].csds_data.last_offset, offset_new, buff, + special_flags); /* Update the pointers */ xp[i].csds_data.last_offset = offset_new; @@ -342,11 +337,11 @@ void csds_log_parts(struct csds_writer *log, const struct part *p, /* Write the particle into the history if needed. */ if (flag == csds_flag_create || flag == csds_flag_mpi_enter) { csds_history_log(&log->history_new[swift_type_gas], p[i].id, - xp[i].csds_data.last_offset); + xp[i].csds_data.last_offset); } else if (flag == csds_flag_change_type || flag == csds_flag_delete || flag == csds_flag_mpi_exit) { csds_history_log(&log->history_removed[swift_type_gas], p[i].id, - xp[i].csds_data.last_offset); + xp[i].csds_data.last_offset); } } @@ -373,10 +368,10 @@ void csds_log_parts(struct csds_writer *log, const struct part *p, * @param special_flags The data for the special flags. */ void csds_copy_spart_fields(const struct csds_writer *log, - const struct spart *sp, const struct engine *e, - unsigned int mask, size_t *offset, - size_t offset_new, char *buff, - const uint32_t special_flags) { + const struct spart *sp, const struct engine *e, + unsigned int mask, size_t *offset, + size_t offset_new, char *buff, + const uint32_t special_flags) { #ifdef SWIFT_DEBUG_CHECKS if (mask == 0) { @@ -396,10 +391,10 @@ void csds_copy_spart_fields(const struct csds_writer *log, } /* Write the stellar fields */ - buff = stars_csds_write_particle(log->mask_data_pointers.stars, sp, &mask, - buff); - buff = chemistry_csds_write_sparticle( - log->mask_data_pointers.chemistry_spart, sp, &mask, buff); + buff = + stars_csds_write_particle(log->mask_data_pointers.stars, sp, &mask, buff); + buff = chemistry_csds_write_sparticle(log->mask_data_pointers.chemistry_spart, + sp, &mask, buff); buff = star_formation_csds_write_sparticle( log->mask_data_pointers.star_formation, sp, &mask, buff); #ifdef SWIFT_DEBUG_CHECKS @@ -420,9 +415,8 @@ void csds_copy_spart_fields(const struct csds_writer *log, * @param flag_data The data to write for the flag. */ void csds_log_spart(struct csds_writer *log, struct spart *sp, - const struct engine *e, const int log_all_fields, - const enum csds_special_flags flag, - const int flag_data) { + const struct engine *e, const int log_all_fields, + const enum csds_special_flags flag, const int flag_data) { csds_log_sparts(log, sp, /* count */ 1, e, log_all_fields, flag, flag_data); } @@ -439,9 +433,8 @@ void csds_log_spart(struct csds_writer *log, struct spart *sp, * @param flag_data The data to write for the flag. */ void csds_log_sparts(struct csds_writer *log, struct spart *sp, int count, - const struct engine *e, const int log_all_fields, - const enum csds_special_flags flag, - const int flag_data) { + const struct engine *e, const int log_all_fields, + const enum csds_special_flags flag, const int flag_data) { /* Build the special flag */ const int size_special_flag = log->csds_mask_data[csds_index_special_flags].size; @@ -460,7 +453,7 @@ void csds_log_sparts(struct csds_writer *log, struct spart *sp, int count, unsigned int mask = 0; size_t size = 0; stars_csds_compute_size_and_mask(log->mask_data_pointers.stars, &sp[i], - log_all_fields, &size, &mask); + log_all_fields, &size, &mask); chemistry_csds_compute_size_and_mask_spart( log->mask_data_pointers.chemistry_spart, &sp[i], log_all_fields, &size, &mask); @@ -488,7 +481,7 @@ void csds_log_sparts(struct csds_writer *log, struct spart *sp, int count, size_t size = 0; unsigned int mask = 0; stars_csds_compute_size_and_mask(log->mask_data_pointers.stars, &sp[i], - log_all_fields, &size, &mask); + log_all_fields, &size, &mask); chemistry_csds_compute_size_and_mask_spart( log->mask_data_pointers.chemistry_spart, &sp[i], log_all_fields, &size, &mask); @@ -509,9 +502,8 @@ void csds_log_sparts(struct csds_writer *log, struct spart *sp, int count, } /* Copy everything into the buffer */ - csds_copy_spart_fields(log, &sp[i], e, mask, - &sp[i].csds_data.last_offset, offset_new, buff, - special_flags); + csds_copy_spart_fields(log, &sp[i], e, mask, &sp[i].csds_data.last_offset, + offset_new, buff, special_flags); /* Update the pointers */ sp[i].csds_data.last_offset = offset_new; @@ -522,11 +514,11 @@ void csds_log_sparts(struct csds_writer *log, struct spart *sp, int count, /* Write the particle into the history if needed. */ if (flag == csds_flag_create || flag == csds_flag_mpi_enter) { csds_history_log(&log->history_new[swift_type_stars], sp[i].id, - sp[i].csds_data.last_offset); + sp[i].csds_data.last_offset); } else if (flag == csds_flag_change_type || flag == csds_flag_delete || flag == csds_flag_mpi_exit) { csds_history_log(&log->history_removed[swift_type_stars], sp[i].id, - sp[i].csds_data.last_offset); + sp[i].csds_data.last_offset); } } #ifdef SWIFT_DEBUG_CHECKS @@ -552,10 +544,10 @@ void csds_log_sparts(struct csds_writer *log, struct spart *sp, int count, * @param special_flags The data of the special flag. */ void csds_copy_gpart_fields(const struct csds_writer *log, - const struct gpart *gp, const struct engine *e, - unsigned int mask, size_t *offset, - size_t offset_new, char *buff, - const uint32_t special_flags) { + const struct gpart *gp, const struct engine *e, + unsigned int mask, size_t *offset, + size_t offset_new, char *buff, + const uint32_t special_flags) { #ifdef SWIFT_DEBUG_CHECKS if (mask == 0) { @@ -575,8 +567,8 @@ void csds_copy_gpart_fields(const struct csds_writer *log, } /* Write the gravity fields */ - buff = gravity_csds_write_particle(log->mask_data_pointers.gravity, gp, - &mask, buff); + buff = gravity_csds_write_particle(log->mask_data_pointers.gravity, gp, &mask, + buff); #ifdef SWIFT_DEBUG_CHECKS if (mask) { @@ -596,9 +588,8 @@ void csds_copy_gpart_fields(const struct csds_writer *log, * @param flag_data The data to write for the flag. */ void csds_log_gpart(struct csds_writer *log, struct gpart *p, - const struct engine *e, const int log_all_fields, - const enum csds_special_flags flag, - const int flag_data) { + const struct engine *e, const int log_all_fields, + const enum csds_special_flags flag, const int flag_data) { csds_log_gparts(log, p, /* count */ 1, e, log_all_fields, flag, flag_data); } @@ -614,9 +605,8 @@ void csds_log_gpart(struct csds_writer *log, struct gpart *p, * @param flag_data The data to write for the flag. */ void csds_log_gparts(struct csds_writer *log, struct gpart *p, int count, - const struct engine *e, const int log_all_fields, - const enum csds_special_flags flag, - const int flag_data) { + const struct engine *e, const int log_all_fields, + const enum csds_special_flags flag, const int flag_data) { /* Build the special flag */ const int size_special_flag = log->csds_mask_data[csds_index_special_flags].size; @@ -634,7 +624,7 @@ void csds_log_gparts(struct csds_writer *log, struct gpart *p, int count, unsigned int mask = 0; size_t size = 0; gravity_csds_compute_size_and_mask(log->mask_data_pointers.gravity, &p[i], - log_all_fields, &size, &mask); + log_all_fields, &size, &mask); if (flag != 0) { size += size_special_flag; } @@ -660,7 +650,7 @@ void csds_log_gparts(struct csds_writer *log, struct gpart *p, int count, size_t size = 0; unsigned int mask = 0; gravity_csds_compute_size_and_mask(log->mask_data_pointers.gravity, &p[i], - log_all_fields, &size, &mask); + log_all_fields, &size, &mask); size += csds_header_bytes; /* Add the special flag. */ @@ -676,7 +666,7 @@ void csds_log_gparts(struct csds_writer *log, struct gpart *p, int count, /* Copy everything into the buffer */ csds_copy_gpart_fields(log, &p[i], e, mask, &p[i].csds_data.last_offset, - offset_new, buff, special_flags); + offset_new, buff, special_flags); /* Update the pointers */ p[i].csds_data.last_offset = offset_new; @@ -687,11 +677,11 @@ void csds_log_gparts(struct csds_writer *log, struct gpart *p, int count, /* Write the particle into the history if needed. */ if (flag == csds_flag_create || flag == csds_flag_mpi_enter) { csds_history_log(&log->history_new[swift_type_dark_matter], - p[i].id_or_neg_offset, p[i].csds_data.last_offset); + p[i].id_or_neg_offset, p[i].csds_data.last_offset); } else if (flag == csds_flag_change_type || flag == csds_flag_delete || flag == csds_flag_mpi_exit) { csds_history_log(&log->history_removed[swift_type_dark_matter], - p[i].id_or_neg_offset, p[i].csds_data.last_offset); + p[i].id_or_neg_offset, p[i].csds_data.last_offset); } } #ifdef SWIFT_DEBUG_CHECKS @@ -714,7 +704,7 @@ void csds_log_gparts(struct csds_writer *log, struct gpart *p, int count, * (return) offset of this log. */ void csds_log_timestamp(struct csds_writer *log, integertime_t timestamp, - double time, size_t *offset) { + double time, size_t *offset) { struct dump *dump = &log->dump; /* Start by computing the size of the message. */ const int size = @@ -751,7 +741,7 @@ void csds_log_timestamp(struct csds_writer *log, integertime_t timestamp, * @param total_nr_sparts total number of spart */ void csds_ensure_size(struct csds_writer *log, size_t total_nr_parts, - size_t total_nr_gparts, size_t total_nr_sparts) { + size_t total_nr_gparts, size_t total_nr_sparts) { /* count part memory */ size_t limit = 0; @@ -967,8 +957,7 @@ void csds_init_masks(struct csds_writer *log, const struct engine *e) { } if (log->mask_data_pointers.chemistry_spart != NULL) { log->mask_data_pointers.chemistry_spart = - log->csds_mask_data + - (log->mask_data_pointers.chemistry_spart - list); + log->csds_mask_data + (log->mask_data_pointers.chemistry_spart - list); } if (log->mask_data_pointers.star_formation != NULL) { log->mask_data_pointers.star_formation = @@ -1032,12 +1021,11 @@ void csds_init_masks(struct csds_writer *log, const struct engine *e) { * @param params The #swift_params */ void csds_init(struct csds_writer *log, const struct engine *e, - struct swift_params *params) { + struct swift_params *params) { /* read parameters. */ log->delta_step = parser_get_param_int(params, "CSDS:delta_step"); size_t buffer_size = - parser_get_opt_param_float(params, "CSDS:initial_buffer_size", 0.5) * - 1e9; + parser_get_opt_param_float(params, "CSDS:initial_buffer_size", 0.5) * 1e9; log->buffer_scale = parser_get_opt_param_float(params, "CSDS:buffer_scale", 10); parser_get_param_string(params, "CSDS:basename", log->base_name); @@ -1079,8 +1067,7 @@ void csds_init(struct csds_writer *log, const struct engine *e, 1e9 * max_memory_size / sizeof(struct csds_index_data); if (e->nodeID == 0) { - message("Maximal memory size for the CSDS history: %g GB", - max_memory_size); + message("Maximal memory size for the CSDS history: %g GB", max_memory_size); } /* initialize the history */ @@ -1127,8 +1114,7 @@ void csds_write_file_header(struct csds_writer *log) { "This function should be called before writing anything in the CSDS"); /* Write format information. */ - csds_write_data(dump, &file_offset, csds_format_size, - &csds_file_format); + csds_write_data(dump, &file_offset, csds_format_size, &csds_file_format); /* Write the major version number. */ int major = csds_major_version; @@ -1173,11 +1159,11 @@ void csds_write_file_header(struct csds_writer *log) { // mask name. csds_write_data(dump, &file_offset, csds_label_size, - &log->csds_mask_data[i].name); + &log->csds_mask_data[i].name); // mask size. csds_write_data(dump, &file_offset, sizeof(unsigned int), - &log->csds_mask_data[i].size); + &log->csds_mask_data[i].size); } memcpy(skip_unique_masks, &unique_mask, sizeof(unsigned int)); @@ -1218,7 +1204,7 @@ __attribute__((always_inline)) INLINE static int csds_read_record_header( * @return The mask containing the values read. */ int csds_read_part(const struct csds_writer *log, struct part *p, - size_t *offset, const char *buff) { + size_t *offset, const char *buff) { /* Jump to the offset. */ buff = &buff[*offset]; @@ -1282,7 +1268,7 @@ int csds_read_part(const struct csds_writer *log, struct part *p, * @return The mask containing the values read. */ int csds_read_gpart(const struct csds_writer *log, struct gpart *p, - size_t *offset, const char *buff) { + size_t *offset, const char *buff) { /* Jump to the offset. */ buff = &buff[*offset]; @@ -1335,7 +1321,7 @@ int csds_read_gpart(const struct csds_writer *log, struct gpart *p, * @return The mask containing the values read. */ int csds_read_timestamp(const struct csds_writer *log, integertime_t *t, - double *time, size_t *offset, const char *buff) { + double *time, size_t *offset, const char *buff) { /* Jump to the offset. */ buff = &buff[*offset]; @@ -1395,13 +1381,13 @@ void csds_struct_dump(const struct csds_writer *log, FILE *stream) { */ void csds_struct_restore(struct csds_writer *log, FILE *stream) { /* Read the block */ - restart_read_blocks((void *)log, sizeof(struct csds_writer), 1, stream, - NULL, "csds"); + restart_read_blocks((void *)log, sizeof(struct csds_writer), 1, stream, NULL, + "csds"); /* Read the masks */ const struct mask_data *old_csds_mask_data = log->csds_mask_data; log->csds_mask_data = (struct mask_data *)malloc(sizeof(struct mask_data) * - log->csds_count_mask); + log->csds_count_mask); restart_read_blocks((void *)log->csds_mask_data, sizeof(struct mask_data), log->csds_count_mask, stream, NULL, "csds_masks"); diff --git a/src/csds.h b/src/csds.h index 99a57a95e74170ff9e294796a84758988abac2a7..11ecb27565c84817a1262a7d1648caba8ca3b69a 100644 --- a/src/csds.h +++ b/src/csds.h @@ -27,10 +27,10 @@ /* Includes. */ #include "align.h" #include "common_io.h" +#include "csds_history.h" #include "dump.h" #include "error.h" #include "inline.h" -#include "csds_history.h" #include "timeline.h" #include "units.h" @@ -96,7 +96,7 @@ enum csds_special_flags { csds_flag_none = 0, /* No flag */ csds_flag_change_type = 1, /* Flag for a change of particle type */ csds_flag_mpi_enter, /* Flag for a particle received from another MPI rank - */ + */ csds_flag_mpi_exit, /* Flag for a particle sent to another MPI rank */ csds_flag_delete, /* Flag for a deleted particle */ csds_flag_create, /* Flag for a created particle */ @@ -193,48 +193,42 @@ struct csds_part_data { }; /* Function prototypes. */ -void csds_log_all_particles(struct csds_writer *log, - const struct engine *e); +void csds_log_all_particles(struct csds_writer *log, const struct engine *e); void csds_log_part(struct csds_writer *log, const struct part *p, - struct xpart *xp, const struct engine *e, - const int log_all_fields, - const enum csds_special_flags flag, const int flag_data); + struct xpart *xp, const struct engine *e, + const int log_all_fields, const enum csds_special_flags flag, + const int flag_data); void csds_log_parts(struct csds_writer *log, const struct part *p, - struct xpart *xp, int count, const struct engine *e, - const int log_all_fields, - const enum csds_special_flags flag, - const int flag_data); + struct xpart *xp, int count, const struct engine *e, + const int log_all_fields, + const enum csds_special_flags flag, const int flag_data); void csds_log_spart(struct csds_writer *log, struct spart *p, - const struct engine *e, const int log_all_fields, - const enum csds_special_flags flag, - const int flag_data); + const struct engine *e, const int log_all_fields, + const enum csds_special_flags flag, const int flag_data); void csds_log_sparts(struct csds_writer *log, struct spart *sp, int count, - const struct engine *e, const int log_all_fields, - const enum csds_special_flags flag, - const int flag_data); + const struct engine *e, const int log_all_fields, + const enum csds_special_flags flag, const int flag_data); void csds_log_gpart(struct csds_writer *log, struct gpart *p, - const struct engine *e, const int log_all_fields, - const enum csds_special_flags flag, - const int flag_data); + const struct engine *e, const int log_all_fields, + const enum csds_special_flags flag, const int flag_data); void csds_log_gparts(struct csds_writer *log, struct gpart *gp, int count, - const struct engine *e, const int log_all_fields, - const enum csds_special_flags flag, - const int flag_data); + const struct engine *e, const int log_all_fields, + const enum csds_special_flags flag, const int flag_data); void csds_init(struct csds_writer *log, const struct engine *e, - struct swift_params *params); + struct swift_params *params); void csds_free(struct csds_writer *log); -void csds_log_timestamp(struct csds_writer *log, integertime_t t, - double time, size_t *offset); +void csds_log_timestamp(struct csds_writer *log, integertime_t t, double time, + size_t *offset); void csds_ensure_size(struct csds_writer *log, size_t total_nr_parts, - size_t total_nr_gparts, size_t total_nr_sparts); + size_t total_nr_gparts, size_t total_nr_sparts); void csds_write_file_header(struct csds_writer *log); int csds_read_part(const struct csds_writer *log, struct part *p, - size_t *offset, const char *buff); + size_t *offset, const char *buff); int csds_read_gpart(const struct csds_writer *log, struct gpart *p, - size_t *offset, const char *buff); + size_t *offset, const char *buff); int csds_read_timestamp(const struct csds_writer *log, integertime_t *t, - double *time, size_t *offset, const char *buff); + double *time, size_t *offset, const char *buff); void csds_struct_dump(const struct csds_writer *log, FILE *stream); void csds_struct_restore(struct csds_writer *log, FILE *stream); @@ -244,8 +238,8 @@ void csds_struct_restore(struct csds_writer *log, FILE *stream); * @param flag The special flag to use. * @param flag_data The data to write in the record. */ -INLINE static uint32_t csds_pack_flags_and_data( - enum csds_special_flags flag, int flag_data) { +INLINE static uint32_t csds_pack_flags_and_data(enum csds_special_flags flag, + int flag_data) { #ifdef SWIFT_DEBUG_CHECKS if (flag & 0xFFFFFF00) { error( @@ -280,8 +274,7 @@ INLINE static void csds_part_data_init(struct csds_part_data *csds) { * @return 1 if the particle should be writen, 0 otherwise. */ __attribute__((always_inline)) INLINE static int csds_should_write( - const struct csds_part_data *csds_data, - const struct csds_writer *log) { + const struct csds_part_data *csds_data, const struct csds_writer *log) { return (csds_data->steps_since_last_output > log->delta_step); } diff --git a/src/csds_history.c b/src/csds_history.c index 0fafd3b90cafcec0b80eeb914ad474c5ae243216..f7b22a80f10a05f3759f09caa17ea1709fcc530b 100644 --- a/src/csds_history.c +++ b/src/csds_history.c @@ -44,8 +44,7 @@ void csds_history_init(struct csds_history *hist) { lock_init(&hist->lock); hist->data = (struct csds_index_data *)swift_malloc( - "csds_history", - sizeof(struct csds_index_data) * CSDS_HISTORY_INIT_SIZE); + "csds_history", sizeof(struct csds_index_data) * CSDS_HISTORY_INIT_SIZE); if (hist->data == NULL) { error("Failed to allocate memory for the csds_history."); } @@ -90,7 +89,7 @@ void csds_history_free(struct csds_history *hist) { * @param data The data from the particle. */ void csds_history_log(struct csds_history *hist, const long long id, - const uint64_t last_offset) { + const uint64_t last_offset) { #ifdef SWIFT_DEBUG_CHECKS if (id < 0) { @@ -141,8 +140,7 @@ void csds_history_log(struct csds_history *hist, const long long id, * @param e The #engine. * @param f The file where to write the history. */ -void csds_history_write(struct csds_history *hist, struct engine *e, - FILE *f) { +void csds_history_write(struct csds_history *hist, struct engine *e, FILE *f) { /* Generate the structures for writing the index file */ const int num_fields = 2; struct io_props list[2]; diff --git a/src/csds_history.h b/src/csds_history.h index a42527a7b160995be45dc0883dfeaa46804cb955..3bb29ee6eab147385397ae2234175d4454153807 100644 --- a/src/csds_history.h +++ b/src/csds_history.h @@ -75,9 +75,8 @@ void csds_history_init(struct csds_history *hist); void csds_history_reset(struct csds_history *hist); void csds_history_free(struct csds_history *hist); void csds_history_log(struct csds_history *hist, const long long id, - const uint64_t last_offset); -void csds_history_write(struct csds_history *hist, struct engine *e, - FILE *f); + const uint64_t last_offset); +void csds_history_write(struct csds_history *hist, struct engine *e, FILE *f); void csds_history_dump(const struct csds_history *hist, FILE *stream); void csds_history_restore(struct csds_history *hist, FILE *stream); diff --git a/src/csds_io.c b/src/csds_io.c index aed872c477e953bf4d0330cb67abb692ce0d128d..217241bd301fb9ad38ec7139097e7718f3fff673 100644 --- a/src/csds_io.c +++ b/src/csds_io.c @@ -133,7 +133,7 @@ void write_index_array(const struct engine* e, FILE* f, struct io_props* props, * @param f The opened file to use. */ void csds_write_history(struct csds_history* history, struct engine* e, - FILE* f) { + FILE* f) { /* Write the number of particles. */ uint64_t size[swift_type_count]; @@ -383,8 +383,7 @@ void csds_write_index_file(struct csds_writer* log, struct engine* e) { } if (num_fields != 2) { - error( - "The code expects only two fields per particle type for the CSDS"); + error("The code expects only two fields per particle type for the CSDS"); } /* Write ids */ diff --git a/src/csds_io.h b/src/csds_io.h index 2ef904b3d84e1bf71a9733f098faa3e71a13647b..37ec34a4e269eafb837c87fa0f7a0ade8b381581 100644 --- a/src/csds_io.h +++ b/src/csds_io.h @@ -76,7 +76,7 @@ void write_index_array(const struct engine* e, FILE* f, struct io_props* props, * @return The new mask_data. */ INLINE static struct mask_data csds_create_mask_entry(const char* name, - int size) { + int size) { struct mask_data mask; /* Copy the fields */ strcpy(mask.name, name); @@ -97,7 +97,7 @@ INLINE static struct mask_data csds_create_mask_entry(const char* name, * @return The mask of the current field. */ INLINE static size_t csds_add_field_to_mask(struct mask_data mask_data, - size_t* buffer_size) { + size_t* buffer_size) { *buffer_size += mask_data.size; return mask_data.mask; @@ -111,7 +111,7 @@ INLINE static size_t csds_add_field_to_mask(struct mask_data mask_data, * @param mask The mask used for the current record. */ INLINE static int csds_should_write_field(struct mask_data mask_data, - unsigned int* mask) { + unsigned int* mask) { const int test = mask_data.mask & *mask; if (test) { diff --git a/src/engine.c b/src/engine.c index 74a668d124d2eb8b457fca664c90d5d5ffab8813..ea14ad7c47bb42cc9b7ef5b2edaea86448dda02a 100644 --- a/src/engine.c +++ b/src/engine.c @@ -60,6 +60,8 @@ #include "cooling.h" #include "cooling_properties.h" #include "cosmology.h" +#include "csds.h" +#include "csds_io.h" #include "cycle.h" #include "debug.h" #include "equation_of_state.h" @@ -70,8 +72,6 @@ #include "gravity_cache.h" #include "hydro.h" #include "line_of_sight.h" -#include "csds.h" -#include "csds_io.h" #include "map.h" #include "memuse.h" #include "minmax.h" @@ -1782,10 +1782,10 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs, /* Mark the first time step in the particle csds file. */ if (e->policy & engine_policy_cosmology) { csds_log_timestamp(e->csds, e->ti_current, e->cosmology->a, - &e->csds->timestamp_offset); + &e->csds->timestamp_offset); } else { csds_log_timestamp(e->csds, e->ti_current, e->time, - &e->csds->timestamp_offset); + &e->csds->timestamp_offset); } /* Make sure that we have enough space in the particle csds file * to store the particles in current time step. */ @@ -2191,15 +2191,14 @@ void engine_step(struct engine *e) { /* Mark the current time step in the particle csds file. */ if (e->policy & engine_policy_cosmology) { csds_log_timestamp(e->csds, e->ti_current, e->cosmology->a, - &e->csds->timestamp_offset); + &e->csds->timestamp_offset); } else { csds_log_timestamp(e->csds, e->ti_current, e->time, - &e->csds->timestamp_offset); + &e->csds->timestamp_offset); } /* Make sure that we have enough space in the particle csds file * to store the particles in current time step. */ - csds_ensure_size(e->csds, e->s->nr_parts, e->s->nr_gparts, - e->s->nr_sparts); + csds_ensure_size(e->csds, e->s->nr_parts, e->s->nr_gparts, e->s->nr_sparts); } #endif diff --git a/src/engine_io.c b/src/engine_io.c index 5187648b545b325771ee92ad21ffa719f2e802de..34aeca8dc604a815a613c3661b068aeac84f402f 100644 --- a/src/engine_io.c +++ b/src/engine_io.c @@ -31,10 +31,10 @@ #include "engine.h" /* Local headers. */ +#include "csds_io.h" #include "distributed_io.h" #include "kick.h" #include "line_of_sight.h" -#include "csds_io.h" #include "parallel_io.h" #include "serial_io.h" #include "single_io.h" @@ -57,8 +57,7 @@ void engine_check_for_index_dump(struct engine *e) { const size_t total_nr_parts = (e->total_nr_parts + e->total_nr_gparts + e->total_nr_sparts + e->total_nr_bparts + e->total_nr_DM_background_gparts); - const size_t index_file_size = - total_nr_parts * sizeof(struct csds_part_data); + const size_t index_file_size = total_nr_parts * sizeof(struct csds_part_data); size_t number_part_history = 0; for (int i = 0; i < swift_type_count; i++) { diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index c7dc59c7e63eda91bb58f999f4a6000e735befe6..4c01c523fe5c634e104bb1a4d3b8f3ad0f4f9bc6 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -1016,8 +1016,8 @@ void engine_make_hierarchical_tasks_common(struct engine *e, struct cell *c) { struct task *kick2_or_csds; if (with_csds) { /* Add the hydro csds task. */ - c->csds = scheduler_addtask(s, task_type_csds, task_subtype_none, 0, - 0, c, NULL); + c->csds = scheduler_addtask(s, task_type_csds, task_subtype_none, 0, 0, + c, NULL); /* Add the kick2 dependency */ scheduler_addunlock(s, c->kick2, c->csds); @@ -1545,8 +1545,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c, #ifdef WITH_CSDS if (with_csds) { - scheduler_addunlock(s, c->super->csds, - c->black_holes.black_holes_in); + scheduler_addunlock(s, c->super->csds, c->black_holes.black_holes_in); } else { scheduler_addunlock(s, c->super->kick2, c->black_holes.black_holes_in); diff --git a/src/engine_redistribute.c b/src/engine_redistribute.c index b8f9c5c7ed616022fbcbcdc64f8d89ffb9f9d782..22826334c26e2dddff40bab84dadfcd1b380fe37 100644 --- a/src/engine_redistribute.c +++ b/src/engine_redistribute.c @@ -1006,16 +1006,16 @@ void engine_redistribute(struct engine *e) { /* Log the hydro parts. */ csds_log_parts(e->csds, &parts[part_offset], &xparts[part_offset], - counts[c_ind], e, /* log_all_fields */ 1, - csds_flag_mpi_exit, i); + counts[c_ind], e, /* log_all_fields */ 1, + csds_flag_mpi_exit, i); /* Log the stellar parts. */ csds_log_sparts(e->csds, &sparts[spart_offset], s_counts[c_ind], e, - /* log_all_fields */ 1, csds_flag_mpi_exit, i); + /* log_all_fields */ 1, csds_flag_mpi_exit, i); /* Log the gparts */ csds_log_gparts(e->csds, &gparts[gpart_offset], g_counts[c_ind], e, - /* log_all_fields */ 1, csds_flag_mpi_exit, i); + /* log_all_fields */ 1, csds_flag_mpi_exit, i); /* Log the bparts */ if (b_counts[c_ind] > 0) { @@ -1103,17 +1103,17 @@ void engine_redistribute(struct engine *e) { } /* Log the hydro parts. */ - csds_log_parts(e->csds, &s->parts[part_offset], - &s->xparts[part_offset], counts[c_ind], e, - /* log_all_fields */ 1, csds_flag_mpi_enter, i); + csds_log_parts(e->csds, &s->parts[part_offset], &s->xparts[part_offset], + counts[c_ind], e, + /* log_all_fields */ 1, csds_flag_mpi_enter, i); /* Log the stellar parts. */ csds_log_sparts(e->csds, &s->sparts[spart_offset], s_counts[c_ind], e, - /* log_all_fields */ 1, csds_flag_mpi_enter, i); + /* log_all_fields */ 1, csds_flag_mpi_enter, i); /* Log the gparts */ csds_log_gparts(e->csds, &s->gparts[gpart_offset], g_counts[c_ind], e, - /* log_all_fields */ 1, csds_flag_mpi_enter, i); + /* log_all_fields */ 1, csds_flag_mpi_enter, i); /* Log the bparts */ if (b_counts[c_ind] > 0) { diff --git a/src/engine_strays.c b/src/engine_strays.c index dd6fbf26735191b6af4fdcc5a11e9ec5e3897a36..c8cd1ed8c42b8b47778b68f1ccce32088c0bccaa 100644 --- a/src/engine_strays.c +++ b/src/engine_strays.c @@ -121,8 +121,8 @@ void engine_exchange_strays(struct engine *e, const size_t offset_parts, if (e->policy & engine_policy_csds) { /* Log the particle when leaving a rank. */ csds_log_part(e->csds, &s->parts[offset_parts + k], - &s->xparts[offset_parts + k], e, /* log_all_fields */ 1, - csds_flag_mpi_exit, node_id); + &s->xparts[offset_parts + k], e, /* log_all_fields */ 1, + csds_flag_mpi_exit, node_id); } #endif } @@ -165,7 +165,7 @@ void engine_exchange_strays(struct engine *e, const size_t offset_parts, if (e->policy & engine_policy_csds) { /* Log the particle when leaving a rank. */ csds_log_spart(e->csds, &s->sparts[offset_sparts + k], e, - /* log_all_fields */ 1, csds_flag_mpi_exit, node_id); + /* log_all_fields */ 1, csds_flag_mpi_exit, node_id); } #endif } @@ -246,7 +246,7 @@ void engine_exchange_strays(struct engine *e, const size_t offset_parts, /* Log the particle when leaving a rank. */ csds_log_gpart(e->csds, &s->gparts[offset_gparts + k], e, - /* log_all_fields */ 1, csds_flag_mpi_exit, node_id); + /* log_all_fields */ 1, csds_flag_mpi_exit, node_id); } #endif } @@ -478,18 +478,18 @@ void engine_exchange_strays(struct engine *e, const size_t offset_parts, /* Log the gas particles */ csds_log_parts(e->csds, parts, xparts, prox->nr_parts_in, e, - /* log_all_fields */ 1, csds_flag_mpi_enter, - prox->nodeID); + /* log_all_fields */ 1, csds_flag_mpi_enter, + prox->nodeID); /* Log the stellar particles */ csds_log_sparts(e->csds, sparts, prox->nr_sparts_in, e, - /* log_all_fields */ 1, csds_flag_mpi_enter, - prox->nodeID); + /* log_all_fields */ 1, csds_flag_mpi_enter, + prox->nodeID); /* Log the gparts */ csds_log_gparts(e->csds, gparts, prox->nr_gparts_in, e, - /* log_all_fields */ 1, csds_flag_mpi_enter, - prox->nodeID); + /* log_all_fields */ 1, csds_flag_mpi_enter, + prox->nodeID); /* Log the bparts */ if (prox->nr_bparts_in > 0) { diff --git a/src/gravity/MultiSoftening/gravity_csds.h b/src/gravity/MultiSoftening/gravity_csds.h index c7d95567515fc8a820224c5ee4c8a467e9adb211..e3b5485bfa43af6613dd8547c3eaf1e835f4736e 100644 --- a/src/gravity/MultiSoftening/gravity_csds.h +++ b/src/gravity/MultiSoftening/gravity_csds.h @@ -19,8 +19,8 @@ #ifndef SWIFT_MULTISOFTENING_GRAVITY_CSDS_H #define SWIFT_MULTISOFTENING_GRAVITY_CSDS_H -#include "gravity_part.h" #include "csds_io.h" +#include "gravity_part.h" #ifdef WITH_CSDS @@ -95,15 +95,15 @@ INLINE static void gravity_csds_compute_size_and_mask( /* Add the coordinates. */ *mask |= csds_add_field_to_mask(masks[gravity_csds_field_coordinates], - buffer_size); + buffer_size); /* Add the velocities. */ - *mask |= csds_add_field_to_mask(masks[gravity_csds_field_velocities], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[gravity_csds_field_velocities], buffer_size); /* Add the accelerations. */ *mask |= csds_add_field_to_mask(masks[gravity_csds_field_accelerations], - buffer_size); + buffer_size); /* Add the masses. */ *mask |= @@ -111,7 +111,7 @@ INLINE static void gravity_csds_compute_size_and_mask( /* Add the ID. */ *mask |= csds_add_field_to_mask(masks[gravity_csds_field_particle_ids], - buffer_size); + buffer_size); } /** @@ -133,21 +133,20 @@ INLINE static char *gravity_csds_write_particle( /* Write the coordinate. */ if (csds_should_write_field(mask_data[gravity_csds_field_coordinates], - mask)) { + mask)) { memcpy(buff, p->x, 3 * sizeof(double)); buff += 3 * sizeof(double); } /* Write the velocity. */ - if (csds_should_write_field(mask_data[gravity_csds_field_velocities], - mask)) { + if (csds_should_write_field(mask_data[gravity_csds_field_velocities], mask)) { memcpy(buff, p->v_full, 3 * sizeof(float)); buff += 3 * sizeof(float); } /* Write the acceleration. */ if (csds_should_write_field(mask_data[gravity_csds_field_accelerations], - mask)) { + mask)) { float acc[3] = { p->a_grav[0] + p->a_grav_mesh[0], p->a_grav[1] + p->a_grav_mesh[1], @@ -165,7 +164,7 @@ INLINE static char *gravity_csds_write_particle( /* Write the Id. */ if (csds_should_write_field(mask_data[gravity_csds_field_particle_ids], - mask)) { + mask)) { memcpy(buff, &p->id_or_neg_offset, sizeof(long long)); buff += sizeof(long long); } diff --git a/src/gravity/MultiSoftening/gravity_part.h b/src/gravity/MultiSoftening/gravity_part.h index ae9afc00ba1e88982c1f944821eaed1ebf6f49bd..0c0c8c8ca7528650c71df84f0a244f99a3ab24d5 100644 --- a/src/gravity/MultiSoftening/gravity_part.h +++ b/src/gravity/MultiSoftening/gravity_part.h @@ -19,8 +19,8 @@ #ifndef SWIFT_MULTI_SOFTENING_GRAVITY_PART_H #define SWIFT_MULTI_SOFTENING_GRAVITY_PART_H -#include "fof_struct.h" #include "csds.h" +#include "fof_struct.h" /* Gravity particle. */ struct gpart { diff --git a/src/hydro/Gadget2/hydro_csds.h b/src/hydro/Gadget2/hydro_csds.h index df39c1c8d3dcc1111644f04acea47cf30a36998b..7d6cd93545202fdc5c7612d57b4c994702674965 100644 --- a/src/hydro/Gadget2/hydro_csds.h +++ b/src/hydro/Gadget2/hydro_csds.h @@ -66,12 +66,10 @@ extern const char *hydro_csds_field_names[hydro_csds_field_count]; INLINE static int hydro_csds_writer_populate_mask_data( struct mask_data *mask_data) { mask_data[hydro_csds_field_coordinates] = csds_create_mask_entry( - hydro_csds_field_names[hydro_csds_field_coordinates], - 3 * sizeof(double)); + hydro_csds_field_names[hydro_csds_field_coordinates], 3 * sizeof(double)); mask_data[hydro_csds_field_velocities] = csds_create_mask_entry( - hydro_csds_field_names[hydro_csds_field_velocities], - 3 * sizeof(float)); + hydro_csds_field_names[hydro_csds_field_velocities], 3 * sizeof(float)); mask_data[hydro_csds_field_accelerations] = csds_create_mask_entry( hydro_csds_field_names[hydro_csds_field_accelerations], @@ -88,8 +86,7 @@ INLINE static int hydro_csds_writer_populate_mask_data( hydro_csds_field_names[hydro_csds_field_entropies], sizeof(float)); mask_data[hydro_csds_field_particle_ids] = csds_create_mask_entry( - hydro_csds_field_names[hydro_csds_field_particle_ids], - sizeof(long long)); + hydro_csds_field_names[hydro_csds_field_particle_ids], sizeof(long long)); mask_data[hydro_csds_field_densities] = csds_create_mask_entry( hydro_csds_field_names[hydro_csds_field_densities], sizeof(float)); @@ -119,36 +116,35 @@ INLINE static void hydro_csds_compute_size_and_mask( /* Here you can decide your own writing logic */ /* Add the coordinates. */ - *mask |= csds_add_field_to_mask(masks[hydro_csds_field_coordinates], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[hydro_csds_field_coordinates], buffer_size); /* Add the velocities. */ - *mask |= csds_add_field_to_mask(masks[hydro_csds_field_velocities], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[hydro_csds_field_velocities], buffer_size); /* Add the accelerations. */ *mask |= csds_add_field_to_mask(masks[hydro_csds_field_accelerations], - buffer_size); + buffer_size); /* Add the masses. */ - *mask |= - csds_add_field_to_mask(masks[hydro_csds_field_masses], buffer_size); + *mask |= csds_add_field_to_mask(masks[hydro_csds_field_masses], buffer_size); /* Add the smoothing lengths. */ *mask |= csds_add_field_to_mask(masks[hydro_csds_field_smoothing_lengths], - buffer_size); + buffer_size); /* Add the entropies. */ - *mask |= csds_add_field_to_mask(masks[hydro_csds_field_entropies], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[hydro_csds_field_entropies], buffer_size); /* Add the ID. */ - *mask |= csds_add_field_to_mask(masks[hydro_csds_field_particle_ids], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[hydro_csds_field_particle_ids], buffer_size); /* Add the density. */ - *mask |= csds_add_field_to_mask(masks[hydro_csds_field_densities], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[hydro_csds_field_densities], buffer_size); } /** @@ -165,27 +161,26 @@ INLINE static void hydro_csds_compute_size_and_mask( * * @return The buffer after the data. */ -INLINE static char *hydro_csds_write_particle( - const struct mask_data *mask_data, const struct part *p, - const struct xpart *xp, unsigned int *mask, char *buff) { +INLINE static char *hydro_csds_write_particle(const struct mask_data *mask_data, + const struct part *p, + const struct xpart *xp, + unsigned int *mask, char *buff) { /* Write the coordinate. */ - if (csds_should_write_field(mask_data[hydro_csds_field_coordinates], - mask)) { + if (csds_should_write_field(mask_data[hydro_csds_field_coordinates], mask)) { memcpy(buff, p->x, 3 * sizeof(double)); buff += 3 * sizeof(double); } /* Write the velocity. */ - if (csds_should_write_field(mask_data[hydro_csds_field_velocities], - mask)) { + if (csds_should_write_field(mask_data[hydro_csds_field_velocities], mask)) { memcpy(buff, p->v, 3 * sizeof(float)); buff += 3 * sizeof(float); } /* Write the acceleration. */ if (csds_should_write_field(mask_data[hydro_csds_field_accelerations], - mask)) { + mask)) { /* Compute the acceleration due to hydro and gravity */ float *acc = (float *)buff; @@ -210,28 +205,25 @@ INLINE static char *hydro_csds_write_particle( /* Write the smoothing length. */ if (csds_should_write_field(mask_data[hydro_csds_field_smoothing_lengths], - mask)) { + mask)) { memcpy(buff, &p->h, sizeof(float)); buff += sizeof(float); } /* Write the entropy. */ - if (csds_should_write_field(mask_data[hydro_csds_field_entropies], - mask)) { + if (csds_should_write_field(mask_data[hydro_csds_field_entropies], mask)) { memcpy(buff, &p->entropy, sizeof(float)); buff += sizeof(float); } /* Write the Id. */ - if (csds_should_write_field(mask_data[hydro_csds_field_particle_ids], - mask)) { + if (csds_should_write_field(mask_data[hydro_csds_field_particle_ids], mask)) { memcpy(buff, &p->id, sizeof(long long)); buff += sizeof(long long); } /* Write the density. */ - if (csds_should_write_field(mask_data[hydro_csds_field_densities], - mask)) { + if (csds_should_write_field(mask_data[hydro_csds_field_densities], mask)) { memcpy(buff, &p->rho, sizeof(float)); buff += sizeof(float); } diff --git a/src/hydro/Gadget2/hydro_part.h b/src/hydro/Gadget2/hydro_part.h index a165728df894f3a39ff90a47ee0bbc969d6a566c..2d9c0fdbffadc5f374136f853f959425bd480747 100644 --- a/src/hydro/Gadget2/hydro_part.h +++ b/src/hydro/Gadget2/hydro_part.h @@ -34,8 +34,8 @@ #include "black_holes_struct.h" #include "chemistry_struct.h" #include "cooling_struct.h" -#include "feedback_struct.h" #include "csds.h" +#include "feedback_struct.h" #include "particle_splitting_struct.h" #include "pressure_floor_struct.h" #include "rt_struct.h" diff --git a/src/hydro/SPHENIX/hydro_csds.h b/src/hydro/SPHENIX/hydro_csds.h index 37c0f8a97f1825840fe57c80b8785cc6f084f4d1..65f4fdb0f53c8c086d94af4284ccf4b58a1fd1c6 100644 --- a/src/hydro/SPHENIX/hydro_csds.h +++ b/src/hydro/SPHENIX/hydro_csds.h @@ -20,8 +20,8 @@ #define SWIFT_SPHENIX_HYDRO_CSDS_H /* Other Includes */ -#include "hydro.h" #include "csds_io.h" +#include "hydro.h" #ifdef WITH_CSDS @@ -63,12 +63,10 @@ extern const char *hydro_csds_field_names[hydro_csds_field_count]; INLINE static int hydro_csds_writer_populate_mask_data( struct mask_data *mask_data) { mask_data[hydro_csds_field_coordinates] = csds_create_mask_entry( - hydro_csds_field_names[hydro_csds_field_coordinates], - 3 * sizeof(double)); + hydro_csds_field_names[hydro_csds_field_coordinates], 3 * sizeof(double)); mask_data[hydro_csds_field_velocities] = csds_create_mask_entry( - hydro_csds_field_names[hydro_csds_field_velocities], - 3 * sizeof(float)); + hydro_csds_field_names[hydro_csds_field_velocities], 3 * sizeof(float)); mask_data[hydro_csds_field_accelerations] = csds_create_mask_entry( hydro_csds_field_names[hydro_csds_field_accelerations], @@ -86,8 +84,7 @@ INLINE static int hydro_csds_writer_populate_mask_data( sizeof(float)); mask_data[hydro_csds_field_particle_ids] = csds_create_mask_entry( - hydro_csds_field_names[hydro_csds_field_particle_ids], - sizeof(long long)); + hydro_csds_field_names[hydro_csds_field_particle_ids], sizeof(long long)); mask_data[hydro_csds_field_densities] = csds_create_mask_entry( hydro_csds_field_names[hydro_csds_field_densities], sizeof(float)); @@ -122,40 +119,39 @@ INLINE static void hydro_csds_compute_size_and_mask( /* Here you can decide your own writing logic */ /* Add the coordinates. */ - *mask |= csds_add_field_to_mask(masks[hydro_csds_field_coordinates], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[hydro_csds_field_coordinates], buffer_size); /* Add the velocities. */ - *mask |= csds_add_field_to_mask(masks[hydro_csds_field_velocities], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[hydro_csds_field_velocities], buffer_size); /* Add the accelerations. */ *mask |= csds_add_field_to_mask(masks[hydro_csds_field_accelerations], - buffer_size); + buffer_size); /* Add the masses. */ - *mask |= - csds_add_field_to_mask(masks[hydro_csds_field_masses], buffer_size); + *mask |= csds_add_field_to_mask(masks[hydro_csds_field_masses], buffer_size); /* Add the smoothing lengths. */ *mask |= csds_add_field_to_mask(masks[hydro_csds_field_smoothing_lengths], - buffer_size); + buffer_size); /* Add the energies. */ *mask |= csds_add_field_to_mask(masks[hydro_csds_field_internal_energies], - buffer_size); + buffer_size); /* Add the ID. */ - *mask |= csds_add_field_to_mask(masks[hydro_csds_field_particle_ids], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[hydro_csds_field_particle_ids], buffer_size); /* Add the density. */ - *mask |= csds_add_field_to_mask(masks[hydro_csds_field_densities], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[hydro_csds_field_densities], buffer_size); /* Add the secondary fields. */ *mask |= csds_add_field_to_mask(masks[hydro_csds_field_secondary_fields], - buffer_size); + buffer_size); } /** @@ -172,27 +168,26 @@ INLINE static void hydro_csds_compute_size_and_mask( * * @return The buffer after the data. */ -INLINE static char *hydro_csds_write_particle( - const struct mask_data *mask_data, const struct part *p, - const struct xpart *xp, unsigned int *mask, char *buff) { +INLINE static char *hydro_csds_write_particle(const struct mask_data *mask_data, + const struct part *p, + const struct xpart *xp, + unsigned int *mask, char *buff) { /* Write the coordinate. */ - if (csds_should_write_field(mask_data[hydro_csds_field_coordinates], - mask)) { + if (csds_should_write_field(mask_data[hydro_csds_field_coordinates], mask)) { memcpy(buff, p->x, 3 * sizeof(double)); buff += 3 * sizeof(double); } /* Write the velocity. */ - if (csds_should_write_field(mask_data[hydro_csds_field_velocities], - mask)) { + if (csds_should_write_field(mask_data[hydro_csds_field_velocities], mask)) { memcpy(buff, p->v, 3 * sizeof(float)); buff += 3 * sizeof(float); } /* Write the acceleration. */ if (csds_should_write_field(mask_data[hydro_csds_field_accelerations], - mask)) { + mask)) { /* Compute the acceleration due to hydro and gravity */ float *acc = (float *)buff; @@ -217,35 +212,33 @@ INLINE static char *hydro_csds_write_particle( /* Write the smoothing length. */ if (csds_should_write_field(mask_data[hydro_csds_field_smoothing_lengths], - mask)) { + mask)) { memcpy(buff, &p->h, sizeof(float)); buff += sizeof(float); } /* Write the energy. */ if (csds_should_write_field(mask_data[hydro_csds_field_internal_energies], - mask)) { + mask)) { memcpy(buff, &p->u, sizeof(float)); buff += sizeof(float); } /* Write the Id. */ - if (csds_should_write_field(mask_data[hydro_csds_field_particle_ids], - mask)) { + if (csds_should_write_field(mask_data[hydro_csds_field_particle_ids], mask)) { memcpy(buff, &p->id, sizeof(long long)); buff += sizeof(long long); } /* Write the density. */ - if (csds_should_write_field(mask_data[hydro_csds_field_densities], - mask)) { + if (csds_should_write_field(mask_data[hydro_csds_field_densities], mask)) { memcpy(buff, &p->rho, sizeof(float)); buff += sizeof(float); } /* Write the secondary fields. */ if (csds_should_write_field(mask_data[hydro_csds_field_secondary_fields], - mask)) { + mask)) { const float secondary[7] = { hydro_get_comoving_entropy(p, xp), hydro_get_comoving_pressure(p), diff --git a/src/hydro/SPHENIX/hydro_part.h b/src/hydro/SPHENIX/hydro_part.h index d40e8ee41ea37b22aa96968422bbac0f8851f6eb..f23b6d59d14759cfeab03f7cac865c61df93c649 100644 --- a/src/hydro/SPHENIX/hydro_part.h +++ b/src/hydro/SPHENIX/hydro_part.h @@ -29,8 +29,8 @@ #include "black_holes_struct.h" #include "chemistry_struct.h" #include "cooling_struct.h" -#include "feedback_struct.h" #include "csds.h" +#include "feedback_struct.h" #include "particle_splitting_struct.h" #include "pressure_floor_struct.h" #include "rt_struct.h" diff --git a/src/runner_others.c b/src/runner_others.c index d3d62c16cdb7704a10c590d379b0f64c5f82d3f6..54a28d9451471ce06831061bae3e05023d80f0ef 100644 --- a/src/runner_others.c +++ b/src/runner_others.c @@ -42,14 +42,14 @@ #include "cell.h" #include "chemistry.h" #include "cooling.h" +#include "csds.h" +#include "csds_io.h" #include "engine.h" #include "error.h" #include "feedback.h" #include "fof.h" #include "gravity.h" #include "hydro.h" -#include "csds.h" -#include "csds_io.h" #include "pressure_floor.h" #include "rt.h" #include "space.h" @@ -407,7 +407,7 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { /* Logs all the fields request by the user */ // TODO select only the requested fields csds_log_part(e->csds, p, xp, e, /* log_all */ 1, - csds_flag_change_type, swift_type_stars); + csds_flag_change_type, swift_type_stars); #endif } @@ -464,8 +464,8 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { } /* Write the s-particle */ - csds_log_spart(e->csds, sp, e, /* log_all */ 1, - csds_flag_create, /* data */ 0); + csds_log_spart(e->csds, sp, e, /* log_all */ 1, csds_flag_create, + /* data */ 0); #endif } else if (swift_star_formation_model_creates_stars) { @@ -876,7 +876,7 @@ void runner_do_csds(struct runner *r, struct cell *c, int timer) { /* Write particle */ /* Currently writing everything, should adapt it through time */ csds_log_part(e->csds, p, xp, e, /* log_all_fields= */ 0, - csds_flag_none, /* flag_data= */ 0); + csds_flag_none, /* flag_data= */ 0); } else /* Update counter */ xp->csds_data.steps_since_last_output += 1; @@ -901,7 +901,7 @@ void runner_do_csds(struct runner *r, struct cell *c, int timer) { /* Write particle */ /* Currently writing everything, should adapt it through time */ csds_log_gpart(e->csds, gp, e, /* log_all_fields= */ 0, - csds_flag_none, /* flag_data= */ 0); + csds_flag_none, /* flag_data= */ 0); } else /* Update counter */ @@ -922,7 +922,7 @@ void runner_do_csds(struct runner *r, struct cell *c, int timer) { /* Write particle */ /* Currently writing everything, should adapt it through time */ csds_log_spart(e->csds, sp, e, /* Log_all_fields= */ 0, - csds_flag_none, /* flag_data= */ 0); + csds_flag_none, /* flag_data= */ 0); } else /* Update counter */ sp->csds_data.steps_since_last_output += 1; diff --git a/src/star_formation/GEAR/star_formation_csds.c b/src/star_formation/GEAR/star_formation_csds.c index b71cc60734aa11b7933eeb7948ac92404771b819..4094c616da157cf0e97d10a1c701b9a87c7705a8 100644 --- a/src/star_formation/GEAR/star_formation_csds.c +++ b/src/star_formation/GEAR/star_formation_csds.c @@ -24,9 +24,8 @@ #include "star_formation_csds.h" /* Name of each possible mask. */ -const char - *star_formation_csds_field_names[star_formation_csds_field_count] = { - "StarFormation", +const char *star_formation_csds_field_names[star_formation_csds_field_count] = { + "StarFormation", }; #endif // WITH_CSDS diff --git a/src/star_formation/GEAR/star_formation_csds.h b/src/star_formation/GEAR/star_formation_csds.h index c0096b585eab95efe57cd512337e795e25638421..866672827d6f8b558deb51e45dceb4fc4226fbb2 100644 --- a/src/star_formation/GEAR/star_formation_csds.h +++ b/src/star_formation/GEAR/star_formation_csds.h @@ -74,8 +74,8 @@ INLINE static void star_formation_csds_compute_size_and_mask( const struct mask_data *masks, const struct spart *spart, const int write_all, size_t *buffer_size, unsigned int *mask) { /* Add the star formation. */ - *mask |= csds_add_field_to_mask(masks[star_formation_csds_field_all], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[star_formation_csds_field_all], buffer_size); } /** @@ -96,8 +96,7 @@ INLINE static char *star_formation_csds_write_sparticle( const struct mask_data *mask_data, const struct spart *sp, unsigned int *mask, char *buff) { /* Write the star formation. */ - if (csds_should_write_field(mask_data[star_formation_csds_field_all], - mask)) { + if (csds_should_write_field(mask_data[star_formation_csds_field_all], mask)) { /* Write the birth density */ memcpy(buff, &sp->sf_data.birth_density, sizeof(float)); diff --git a/src/star_formation/none/star_formation_csds.c b/src/star_formation/none/star_formation_csds.c index f7bbf9a5d8530dfb5e3dcb9843de4340bea5376e..82806993e7f64954940ae6b4d3674bd2b06e02fe 100644 --- a/src/star_formation/none/star_formation_csds.c +++ b/src/star_formation/none/star_formation_csds.c @@ -23,7 +23,7 @@ #include "star_formation_csds.h" -const char - *star_formation_csds_field_names[star_formation_csds_field_count] = {}; +const char *star_formation_csds_field_names[star_formation_csds_field_count] = + {}; #endif // WITH_CSDS diff --git a/src/stars/Basic/stars_csds.h b/src/stars/Basic/stars_csds.h index 4fe0c64808edf9aa9705389f1718e646368c61dc..8235b84b7b2a86b5bca1d46641c55fccfb8c9379 100644 --- a/src/stars/Basic/stars_csds.h +++ b/src/stars/Basic/stars_csds.h @@ -53,12 +53,10 @@ extern const char *stars_csds_field_names[stars_csds_field_count]; INLINE static int stars_csds_writer_populate_mask_data( struct mask_data *mask_data) { mask_data[stars_csds_field_coordinates] = csds_create_mask_entry( - stars_csds_field_names[stars_csds_field_coordinates], - 3 * sizeof(double)); + stars_csds_field_names[stars_csds_field_coordinates], 3 * sizeof(double)); mask_data[stars_csds_field_velocities] = csds_create_mask_entry( - stars_csds_field_names[stars_csds_field_velocities], - 3 * sizeof(float)); + stars_csds_field_names[stars_csds_field_velocities], 3 * sizeof(float)); mask_data[stars_csds_field_accelerations] = csds_create_mask_entry( stars_csds_field_names[stars_csds_field_accelerations], @@ -72,8 +70,7 @@ INLINE static int stars_csds_writer_populate_mask_data( sizeof(float)); mask_data[stars_csds_field_particle_ids] = csds_create_mask_entry( - stars_csds_field_names[stars_csds_field_particle_ids], - sizeof(long long)); + stars_csds_field_names[stars_csds_field_particle_ids], sizeof(long long)); return stars_csds_field_count; } @@ -98,28 +95,27 @@ INLINE static void stars_csds_compute_size_and_mask( /* Here you can decide your own writing logic */ /* Add the coordinates. */ - *mask |= csds_add_field_to_mask(masks[stars_csds_field_coordinates], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[stars_csds_field_coordinates], buffer_size); /* Add the velocities. */ - *mask |= csds_add_field_to_mask(masks[stars_csds_field_velocities], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[stars_csds_field_velocities], buffer_size); /* Add the accelerations. */ *mask |= csds_add_field_to_mask(masks[stars_csds_field_accelerations], - buffer_size); + buffer_size); /* Add the masses. */ - *mask |= - csds_add_field_to_mask(masks[stars_csds_field_masses], buffer_size); + *mask |= csds_add_field_to_mask(masks[stars_csds_field_masses], buffer_size); /* Add the smoothing lengths. */ *mask |= csds_add_field_to_mask(masks[stars_csds_field_smoothing_lengths], - buffer_size); + buffer_size); /* Add the ID. */ - *mask |= csds_add_field_to_mask(masks[stars_csds_field_particle_ids], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[stars_csds_field_particle_ids], buffer_size); } /** @@ -135,27 +131,25 @@ INLINE static void stars_csds_compute_size_and_mask( * * @return The buffer after the data. */ -INLINE static char *stars_csds_write_particle( - const struct mask_data *mask_data, const struct spart *p, - unsigned int *mask, char *buff) { +INLINE static char *stars_csds_write_particle(const struct mask_data *mask_data, + const struct spart *p, + unsigned int *mask, char *buff) { /* Write the coordinate. */ - if (csds_should_write_field(mask_data[stars_csds_field_coordinates], - mask)) { + if (csds_should_write_field(mask_data[stars_csds_field_coordinates], mask)) { memcpy(buff, p->x, 3 * sizeof(double)); buff += 3 * sizeof(double); } /* Write the velocity. */ - if (csds_should_write_field(mask_data[stars_csds_field_velocities], - mask)) { + if (csds_should_write_field(mask_data[stars_csds_field_velocities], mask)) { memcpy(buff, p->v, 3 * sizeof(float)); buff += 3 * sizeof(float); } /* Write the acceleration. */ if (csds_should_write_field(mask_data[stars_csds_field_accelerations], - mask)) { + mask)) { memcpy(buff, p->gpart->a_grav, 3 * sizeof(float)); buff += 3 * sizeof(float); } @@ -168,14 +162,13 @@ INLINE static char *stars_csds_write_particle( /* Write the smoothing length. */ if (csds_should_write_field(mask_data[stars_csds_field_smoothing_lengths], - mask)) { + mask)) { memcpy(buff, &p->h, sizeof(float)); buff += sizeof(float); } /* Write the Id. */ - if (csds_should_write_field(mask_data[stars_csds_field_particle_ids], - mask)) { + if (csds_should_write_field(mask_data[stars_csds_field_particle_ids], mask)) { memcpy(buff, &p->id, sizeof(long long)); buff += sizeof(long long); } diff --git a/src/stars/GEAR/stars_csds.h b/src/stars/GEAR/stars_csds.h index 8f1cae97c0c1c1f01b7929499520648c0de08a3e..9691228785321150b100c4bb29583f7ec90b54d8 100644 --- a/src/stars/GEAR/stars_csds.h +++ b/src/stars/GEAR/stars_csds.h @@ -54,12 +54,10 @@ extern const char *stars_csds_field_names[stars_csds_field_count]; INLINE static int stars_csds_writer_populate_mask_data( struct mask_data *mask_data) { mask_data[stars_csds_field_coordinates] = csds_create_mask_entry( - stars_csds_field_names[stars_csds_field_coordinates], - 3 * sizeof(double)); + stars_csds_field_names[stars_csds_field_coordinates], 3 * sizeof(double)); mask_data[stars_csds_field_velocities] = csds_create_mask_entry( - stars_csds_field_names[stars_csds_field_velocities], - 3 * sizeof(float)); + stars_csds_field_names[stars_csds_field_velocities], 3 * sizeof(float)); mask_data[stars_csds_field_accelerations] = csds_create_mask_entry( stars_csds_field_names[stars_csds_field_accelerations], @@ -73,8 +71,7 @@ INLINE static int stars_csds_writer_populate_mask_data( sizeof(float)); mask_data[stars_csds_field_particle_ids] = csds_create_mask_entry( - stars_csds_field_names[stars_csds_field_particle_ids], - sizeof(long long)); + stars_csds_field_names[stars_csds_field_particle_ids], sizeof(long long)); mask_data[stars_csds_field_birth_scale_factors] = csds_create_mask_entry( stars_csds_field_names[stars_csds_field_birth_scale_factors], @@ -103,32 +100,31 @@ INLINE static void stars_csds_compute_size_and_mask( /* Here you can decide your own writing logic */ /* Add the coordinates. */ - *mask |= csds_add_field_to_mask(masks[stars_csds_field_coordinates], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[stars_csds_field_coordinates], buffer_size); /* Add the velocities. */ - *mask |= csds_add_field_to_mask(masks[stars_csds_field_velocities], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[stars_csds_field_velocities], buffer_size); /* Add the accelerations. */ *mask |= csds_add_field_to_mask(masks[stars_csds_field_accelerations], - buffer_size); + buffer_size); /* Add the masses. */ - *mask |= - csds_add_field_to_mask(masks[stars_csds_field_masses], buffer_size); + *mask |= csds_add_field_to_mask(masks[stars_csds_field_masses], buffer_size); /* Add the smoothing lengths. */ *mask |= csds_add_field_to_mask(masks[stars_csds_field_smoothing_lengths], - buffer_size); + buffer_size); /* Add the ID. */ - *mask |= csds_add_field_to_mask(masks[stars_csds_field_particle_ids], - buffer_size); + *mask |= + csds_add_field_to_mask(masks[stars_csds_field_particle_ids], buffer_size); /* Add the birth scale factor. */ - *mask |= csds_add_field_to_mask( - masks[stars_csds_field_birth_scale_factors], buffer_size); + *mask |= csds_add_field_to_mask(masks[stars_csds_field_birth_scale_factors], + buffer_size); } /** @@ -144,27 +140,25 @@ INLINE static void stars_csds_compute_size_and_mask( * * @return The buffer after the data. */ -INLINE static char *stars_csds_write_particle( - const struct mask_data *mask_data, const struct spart *p, - unsigned int *mask, char *buff) { +INLINE static char *stars_csds_write_particle(const struct mask_data *mask_data, + const struct spart *p, + unsigned int *mask, char *buff) { /* Write the coordinate. */ - if (csds_should_write_field(mask_data[stars_csds_field_coordinates], - mask)) { + if (csds_should_write_field(mask_data[stars_csds_field_coordinates], mask)) { memcpy(buff, p->x, 3 * sizeof(double)); buff += 3 * sizeof(double); } /* Write the velocity. */ - if (csds_should_write_field(mask_data[stars_csds_field_velocities], - mask)) { + if (csds_should_write_field(mask_data[stars_csds_field_velocities], mask)) { memcpy(buff, p->v, 3 * sizeof(float)); buff += 3 * sizeof(float); } /* Write the acceleration. */ if (csds_should_write_field(mask_data[stars_csds_field_accelerations], - mask)) { + mask)) { memcpy(buff, p->gpart->a_grav, 3 * sizeof(float)); buff += 3 * sizeof(float); } @@ -177,21 +171,20 @@ INLINE static char *stars_csds_write_particle( /* Write the smoothing length. */ if (csds_should_write_field(mask_data[stars_csds_field_smoothing_lengths], - mask)) { + mask)) { memcpy(buff, &p->h, sizeof(float)); buff += sizeof(float); } /* Write the Id. */ - if (csds_should_write_field(mask_data[stars_csds_field_particle_ids], - mask)) { + if (csds_should_write_field(mask_data[stars_csds_field_particle_ids], mask)) { memcpy(buff, &p->id, sizeof(long long)); buff += sizeof(long long); } /* Write the birth scale factor. */ - if (csds_should_write_field( - mask_data[stars_csds_field_birth_scale_factors], mask)) { + if (csds_should_write_field(mask_data[stars_csds_field_birth_scale_factors], + mask)) { memcpy(buff, &p->birth_scale_factor, sizeof(float)); buff += sizeof(float); } diff --git a/src/swift.h b/src/swift.h index 372ad4a0b24b4a39c64ddc337487926def500f82..a4e2594dc36191cad2357ad30433cfc2c1533b7c 100644 --- a/src/swift.h +++ b/src/swift.h @@ -35,6 +35,8 @@ #include "cooling.h" #include "cooling_properties.h" #include "cosmology.h" +#include "csds.h" +#include "csds_io.h" #include "cycle.h" #include "debug.h" #include "dump.h" @@ -52,8 +54,6 @@ #include "hydro_properties.h" #include "line_of_sight.h" #include "lock.h" -#include "csds.h" -#include "csds_io.h" #include "map.h" #include "memuse.h" #include "mesh_gravity.h"