diff --git a/src/chemistry.c b/src/chemistry.c index d9e36448bb1f9ce3bcfad6e288bb05ed4503bcba..44cbea1361d96c4cf1d4d3d21c3c91e5225640a5 100644 --- a/src/chemistry.c +++ b/src/chemistry.c @@ -46,7 +46,8 @@ void chemistry_init(const struct swift_params* parameter_file, * * Calls chemistry_print_backend for the chosen chemistry model. * - * @brief The #chemistry_global_data containing information about the current model. + * @brief The #chemistry_global_data containing information about the current + * model. */ void chemistry_print(const struct chemistry_global_data* data) { chemistry_print_backend(data); @@ -60,8 +61,8 @@ void chemistry_print(const struct chemistry_global_data* data) { */ void chemistry_struct_dump(const struct chemistry_global_data* chemistry, FILE* stream) { - restart_write_blocks((void*)chemistry, sizeof(struct chemistry_global_data), 1, - stream, "chemistry", "chemistry function"); + restart_write_blocks((void*)chemistry, sizeof(struct chemistry_global_data), + 1, stream, "chemistry", "chemistry function"); } /** diff --git a/src/chemistry/EAGLE/chemistry.h b/src/chemistry/EAGLE/chemistry.h index 241bb5f88183865db4f8c510062f6835e75a75f8..fa63c8cc877861d443d6cdb3cc1c8f0c94befefe 100644 --- a/src/chemistry/EAGLE/chemistry.h +++ b/src/chemistry/EAGLE/chemistry.h @@ -90,8 +90,8 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part( const struct phys_const* restrict phys_const, const struct unit_system* restrict us, const struct cosmology* restrict cosmo, - const struct chemistry_global_data* data, - struct part* restrict p, struct xpart* restrict xp) { + const struct chemistry_global_data* data, struct part* restrict p, + struct xpart* restrict xp) { p->chemistry_data.metal_mass_fraction_total = data->initial_metal_mass_fraction_total; @@ -136,9 +136,11 @@ static INLINE void chemistry_init_backend( /** * @brief Prints the properties of the chemistry model to stdout. * - * @brief The #chemistry_global_data containing information about the current model. + * @brief The #chemistry_global_data containing information about the current + * model. */ -static INLINE void chemistry_print_backend(const struct chemistry_global_data* data) { +static INLINE void chemistry_print_backend( + const struct chemistry_global_data* data) { message("Chemistry model is 'EAGLE' tracking %d elements.", chemistry_element_count); diff --git a/src/chemistry/gear/chemistry.h b/src/chemistry/gear/chemistry.h index ba5e9ace8344b2b16f92a8d5f46ec6aafdd9cb96..9653e7eb05005977c39bca20eab961af83f40b5f 100644 --- a/src/chemistry/gear/chemistry.h +++ b/src/chemistry/gear/chemistry.h @@ -38,7 +38,6 @@ #include "physical_constants.h" #include "units.h" - /** * @brief Compute the metal mass fraction * @@ -46,9 +45,10 @@ * @param xp Pointer to the extended particle data. * @param data The global chemistry information. */ -__attribute__((always_inline)) INLINE static float chemistry_metal_mass_fraction( - const struct part* restrict p, const struct xpart* restrict xp) { - return p->chemistry_data.Z; +__attribute__((always_inline)) INLINE static float +chemistry_metal_mass_fraction(const struct part* restrict p, + const struct xpart* restrict xp) { + return p->chemistry_data.Z; } /** @@ -136,8 +136,8 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part( const struct phys_const* restrict phys_const, const struct unit_system* restrict us, const struct cosmology* restrict cosmo, - const struct chemistry_global_data* data, - struct part* restrict p, struct xpart* restrict xp) { + const struct chemistry_global_data* data, struct part* restrict p, + struct xpart* restrict xp) { p->chemistry_data.Z = data->initial_metallicity; chemistry_init_part(p, data); diff --git a/src/chemistry/gear/chemistry_io.h b/src/chemistry/gear/chemistry_io.h index 8a084db25b48342c5d3825981f5095240435dcb0..2343b6ba18ada5d04825a12d53a6f9cc7e984ef2 100644 --- a/src/chemistry/gear/chemistry_io.h +++ b/src/chemistry/gear/chemistry_io.h @@ -43,9 +43,11 @@ chemistry_get_element_name(enum chemistry_element elem) { /** * @brief Prints the properties of the chemistry model to stdout. * - * @brief The #chemistry_global_data containing information about the current model. + * @brief The #chemistry_global_data containing information about the current + * model. */ -static INLINE void chemistry_print_backend(const struct chemistry_global_data* data) { +static INLINE void chemistry_print_backend( + const struct chemistry_global_data* data) { message("Chemistry function is 'Gear'."); } @@ -65,9 +67,8 @@ __attribute__((always_inline)) INLINE static int chemistry_read_particles( list[0] = io_make_input_field( "ElementAbundance", FLOAT, chemistry_element_count, OPTIONAL, UNIT_CONV_NO_UNITS, parts, chemistry_data.metal_mass_fraction); - list[1] = - io_make_input_field("Z", FLOAT, 1, OPTIONAL, UNIT_CONV_NO_UNITS, - parts, chemistry_data.Z); + list[1] = io_make_input_field("Z", FLOAT, 1, OPTIONAL, UNIT_CONV_NO_UNITS, + parts, chemistry_data.Z); return 2; } @@ -76,12 +77,10 @@ __attribute__((always_inline)) INLINE static void chemistry_read_parameters( const struct swift_params* parameter_file, const struct unit_system* us, const struct phys_const* phys_const, struct chemistry_global_data* data) { - data->initial_metallicity = - parser_get_opt_param_float(parameter_file, "GearChemistry:InitialMetallicity", - -1); + data->initial_metallicity = parser_get_opt_param_float( + parameter_file, "GearChemistry:InitialMetallicity", -1); } - /** * @brief Specifies which particle fields to write to a dataset * @@ -97,8 +96,8 @@ __attribute__((always_inline)) INLINE static int chemistry_write_particles( list[0] = io_make_output_field( "SmoothedElementAbundance", FLOAT, chemistry_element_count, UNIT_CONV_NO_UNITS, parts, chemistry_data.smoothed_metal_mass_fraction); - list[1] = io_make_output_field("Z", FLOAT, 1, UNIT_CONV_NO_UNITS, - parts, chemistry_data.Z); + list[1] = io_make_output_field("Z", FLOAT, 1, UNIT_CONV_NO_UNITS, parts, + chemistry_data.Z); list[2] = io_make_output_field("ElementAbundance", FLOAT, chemistry_element_count, UNIT_CONV_NO_UNITS, @@ -126,5 +125,4 @@ __attribute__((always_inline)) INLINE static void chemistry_write_flavour( } #endif - #endif /* SWIFT_CHEMISTRY_IO_GEAR_H */ diff --git a/src/chemistry/none/chemistry.h b/src/chemistry/none/chemistry.h index f96472a2e18962de507c9f423edef22e5c0a4920..7a9189357c8e3530f2a684bf35b0e1f9bdafcc74 100644 --- a/src/chemistry/none/chemistry.h +++ b/src/chemistry/none/chemistry.h @@ -66,9 +66,11 @@ static INLINE void chemistry_init_backend( /** * @brief Prints the properties of the chemistry model to stdout. * - * @brief The #chemistry_global_data containing information about the current model. + * @brief The #chemistry_global_data containing information about the current + * model. */ -static INLINE void chemistry_print_backend(const struct chemistry_global_data* data) { +static INLINE void chemistry_print_backend( + const struct chemistry_global_data* data) { message("Chemistry function is 'No chemistry'."); } @@ -98,8 +100,8 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part( const struct phys_const* restrict phys_const, const struct unit_system* restrict us, const struct cosmology* restrict cosmo, - const struct chemistry_global_data* data, - const struct part* restrict p, struct xpart* restrict xp) {} + const struct chemistry_global_data* data, const struct part* restrict p, + struct xpart* restrict xp) {} /** * @brief Sets the chemistry properties of the (x-)particles to a valid start diff --git a/src/cooling/EAGLE/cooling.h b/src/cooling/EAGLE/cooling.h index de0337181ff4e69b6a84bc56f1489327209f892c..d0bea0ec76638768527fed4fcfe9766724cf2eb7 100644 --- a/src/cooling/EAGLE/cooling.h +++ b/src/cooling/EAGLE/cooling.h @@ -38,7 +38,6 @@ #include "physical_constants.h" #include "units.h" - /** * @brief Apply the cooling function to a particle. * diff --git a/src/cooling/EAGLE/cooling_io.h b/src/cooling/EAGLE/cooling_io.h index b3eea3c6ed94bae6a96a58078f4c7244801a47bc..314c921dd23c94eb0e54f0a7a460e64e272d9cf1 100644 --- a/src/cooling/EAGLE/cooling_io.h +++ b/src/cooling/EAGLE/cooling_io.h @@ -45,8 +45,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour( */ __attribute__((always_inline)) INLINE static int cooling_write_particles( const struct xpart* xparts, struct io_props* list, - const struct cooling_function_data *cooling) { + const struct cooling_function_data* cooling) { return 0; } -#endif // SWIFT_COOLING_EAGLE_IO_H +#endif // SWIFT_COOLING_EAGLE_IO_H diff --git a/src/cooling/const_du/cooling.h b/src/cooling/const_du/cooling.h index b1ea9f8e36088962b1bb2849f9d4162d28461bed..95d90654d7c95ed9cde01230194c79fe1fdc3c99 100644 --- a/src/cooling/const_du/cooling.h +++ b/src/cooling/const_du/cooling.h @@ -45,7 +45,6 @@ #include "physical_constants.h" #include "units.h" - /** * @brief Apply the cooling function to a particle. * @@ -80,7 +79,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( float cooling_du_dt = -cooling->cooling_rate; /* Integrate cooling equation to enforce energy floor */ - if (u_old + hydro_du_dt * dt < u_floor) { + if (u_old + hydro_du_dt * dt < u_floor) { cooling_du_dt = 0.f; } else if (u_old + (hydro_du_dt + cooling_du_dt) * dt < u_floor) { cooling_du_dt = (u_old + dt * hydro_du_dt - u_floor) / dt; diff --git a/src/cooling/const_du/cooling_io.h b/src/cooling/const_du/cooling_io.h index 9043b9170b2152dfa9c86c6e00060bb989a56c03..cc9347617fba1cb7c13196ba20368e236c46e7bc 100644 --- a/src/cooling/const_du/cooling_io.h +++ b/src/cooling/const_du/cooling_io.h @@ -47,8 +47,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour( */ __attribute__((always_inline)) INLINE static int cooling_write_particles( const struct xpart* xparts, struct io_props* list, - const struct cooling_function_data *cooling) { + const struct cooling_function_data* cooling) { return 0; } -#endif // SWIFT_COOLING_CONST_DU_IO_H +#endif // SWIFT_COOLING_CONST_DU_IO_H diff --git a/src/cooling/const_lambda/cooling.h b/src/cooling/const_lambda/cooling.h index 6eed7d4882e49533745b3f835566eb489199bbf0..5007880ad148733dd1703a950d963de271119507 100644 --- a/src/cooling/const_lambda/cooling.h +++ b/src/cooling/const_lambda/cooling.h @@ -38,7 +38,6 @@ #include "physical_constants.h" #include "units.h" - /** * @brief Calculates du/dt in code units for a particle. * diff --git a/src/cooling/const_lambda/cooling_io.h b/src/cooling/const_lambda/cooling_io.h index 04700a128afab7574a29aaaa2b3631d4a3238f82..49e87ca1d5a433fe45b91ffcb5deccb3f737355f 100644 --- a/src/cooling/const_lambda/cooling_io.h +++ b/src/cooling/const_lambda/cooling_io.h @@ -49,8 +49,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour( */ __attribute__((always_inline)) INLINE static int cooling_write_particles( const struct xpart* xparts, struct io_props* list, - const struct cooling_function_data *cooling) { + const struct cooling_function_data* cooling) { return 0; } -#endif // SWIFT_COOLING_CONST_LAMBDA_IO_H +#endif // SWIFT_COOLING_CONST_LAMBDA_IO_H diff --git a/src/cooling/grackle/cooling.h b/src/cooling/grackle/cooling.h index 294f322aa820797dfc66cd75408bacc2c3f72e8c..e0c25015ed6dcd29b25a027027a63c416848691d 100644 --- a/src/cooling/grackle/cooling.h +++ b/src/cooling/grackle/cooling.h @@ -53,12 +53,12 @@ static gr_float cooling_time( const struct cooling_function_data* restrict cooling, const struct part* restrict p, struct xpart* restrict xp); -static double cooling_rate( - const struct phys_const* restrict phys_const, - const struct unit_system* restrict us, - const struct cosmology* restrict cosmo, - const struct cooling_function_data* restrict cooling, - const struct part* restrict p, struct xpart* restrict xp, double dt); +static double cooling_rate(const struct phys_const* restrict phys_const, + const struct unit_system* restrict us, + const struct cosmology* restrict cosmo, + const struct cooling_function_data* restrict cooling, + const struct part* restrict p, + struct xpart* restrict xp, double dt); /** * @brief Print the chemical network @@ -70,19 +70,17 @@ __attribute__((always_inline)) INLINE static void cooling_print_fractions( const struct cooling_xpart_data tmp = xp->cooling_data; #if COOLING_GRACKLE_MODE > 0 - message("HI %g, HII %g, HeI %g, HeII %g, HeIII %g, e %g", - tmp.HI_frac, tmp.HII_frac, tmp.HeI_frac, - tmp.HeII_frac, tmp.HeIII_frac, tmp.e_frac); + message("HI %g, HII %g, HeI %g, HeII %g, HeIII %g, e %g", tmp.HI_frac, + tmp.HII_frac, tmp.HeI_frac, tmp.HeII_frac, tmp.HeIII_frac, + tmp.e_frac); #endif #if COOLING_GRACKLE_MODE > 1 - message("HM %g, H2I %g, H2II %g", - tmp.HM_frac, tmp.H2I_frac, tmp.H2II_frac); + message("HM %g, H2I %g, H2II %g", tmp.HM_frac, tmp.H2I_frac, tmp.H2II_frac); #endif #if COOLING_GRACKLE_MODE > 2 - message("DI %g, DII %g, HDI %g", - tmp.DI_frac, tmp.DII_frac, tmp.HDI_frac); + message("DI %g, DII %g, HDI %g", tmp.DI_frac, tmp.DII_frac, tmp.HDI_frac); #endif message("Metal: %g", tmp.metal_frac); } @@ -97,13 +95,12 @@ __attribute__((always_inline)) INLINE static void cooling_print_fractions( * * @return 0 if diff > limit */ -#define cooling_check_field(xp, old, field, limit) \ - ({ \ - float tmp = xp->cooling_data.field - old->cooling_data.field; \ - tmp = fabs(tmp) / xp->cooling_data.field; \ - if (tmp > limit) \ - return 0; \ -}) +#define cooling_check_field(xp, old, field, limit) \ + ({ \ + float tmp = xp->cooling_data.field - old->cooling_data.field; \ + tmp = fabs(tmp) / xp->cooling_data.field; \ + if (tmp > limit) return 0; \ + }) /** * @brief Check if difference between two particles is lower than a given value @@ -113,8 +110,7 @@ __attribute__((always_inline)) INLINE static void cooling_print_fractions( * @param limit The difference limit */ __attribute__((always_inline)) INLINE static int cooling_converged( - const struct xpart* restrict xp, - const struct xpart* restrict old, + const struct xpart* restrict xp, const struct xpart* restrict old, const float limit) { #if COOLING_GRACKLE_MODE > 0 @@ -152,8 +148,7 @@ __attribute__((always_inline)) INLINE static void cooling_compute_equilibrium( const struct unit_system* restrict us, const struct cosmology* restrict cosmo, const struct cooling_function_data* restrict cooling, - const struct part* restrict p, - struct xpart* restrict xp) { + const struct part* restrict p, struct xpart* restrict xp) { /* get temporary data */ struct part p_tmp = *p; @@ -164,9 +159,11 @@ __attribute__((always_inline)) INLINE static void cooling_compute_equilibrium( /* compute time step */ const double alpha = 0.01; - double dt = fabs(cooling_time(phys_const, us, cosmo, &cooling_tmp, &p_tmp, xp)); + double dt = + fabs(cooling_time(phys_const, us, cosmo, &cooling_tmp, &p_tmp, xp)); cooling_rate(phys_const, us, cosmo, &cooling_tmp, &p_tmp, xp, dt); - dt = alpha * fabs(cooling_time(phys_const, us, cosmo, &cooling_tmp, &p_tmp, xp)); + dt = alpha * + fabs(cooling_time(phys_const, us, cosmo, &cooling_tmp, &p_tmp, xp)); /* init simple variables */ int step = 0; @@ -184,9 +181,10 @@ __attribute__((always_inline)) INLINE static void cooling_compute_equilibrium( } while (step < max_step && !cooling_converged(xp, &old, conv_limit)); if (step == max_step) - error("A particle element fraction failed to converge." - "You can change 'GrackleCooling:MaxSteps' or " - "'GrackleCooling:ConvergenceLimit' to avoid this problem"); + error( + "A particle element fraction failed to converge." + "You can change 'GrackleCooling:MaxSteps' or " + "'GrackleCooling:ConvergenceLimit' to avoid this problem"); } /** @@ -201,8 +199,8 @@ __attribute__((always_inline)) INLINE static void cooling_first_init_part( const struct phys_const* restrict phys_const, const struct unit_system* restrict us, const struct cosmology* restrict cosmo, - const struct cooling_function_data* cooling, - const struct part* restrict p, struct xpart* restrict xp) { + const struct cooling_function_data* cooling, const struct part* restrict p, + struct xpart* restrict xp) { xp->cooling_data.radiated_energy = 0.f; @@ -215,9 +213,9 @@ __attribute__((always_inline)) INLINE static void cooling_first_init_part( xp->cooling_data.HeI_frac = 1. - grackle_data->HydrogenFractionByMass; xp->cooling_data.HeII_frac = zero; xp->cooling_data.HeIII_frac = zero; - xp->cooling_data.e_frac = xp->cooling_data.HII_frac \ - + 0.25 * xp->cooling_data.HeII_frac \ - + 0.5 * xp->cooling_data.HeIII_frac; + xp->cooling_data.e_frac = xp->cooling_data.HII_frac + + 0.25 * xp->cooling_data.HeII_frac + + 0.5 * xp->cooling_data.HeIII_frac; #endif // MODE >= 1 #if COOLING_GRACKLE_MODE >= 2 @@ -229,8 +227,8 @@ __attribute__((always_inline)) INLINE static void cooling_first_init_part( #if COOLING_GRACKLE_MODE >= 3 /* primordial chemistry >= 3 */ - xp->cooling_data.DI_frac = grackle_data->DeuteriumToHydrogenRatio - * grackle_data->HydrogenFractionByMass; + xp->cooling_data.DI_frac = grackle_data->DeuteriumToHydrogenRatio * + grackle_data->HydrogenFractionByMass; xp->cooling_data.DII_frac = zero; xp->cooling_data.HDI_frac = zero; #endif // MODE >= 3 @@ -261,17 +259,16 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend( message("Cooling function is 'Grackle'."); message("Using Grackle = %i", cooling->chemistry.use_grackle); - message("Chemical network = %i", - cooling->chemistry.primordial_chemistry); + message("Chemical network = %i", cooling->chemistry.primordial_chemistry); message("CloudyTable = %s", cooling->cloudy_table); message("Redshift = %g", cooling->redshift); message("UV background = %d", cooling->with_uv_background); message("Metal cooling = %i", cooling->chemistry.metal_cooling); message("Self Shielding = %i", cooling->self_shielding_method); message("Specific Heating Rates = %i", - cooling->provide_specific_heating_rates); + cooling->provide_specific_heating_rates); message("Volumetric Heating Rates = %i", - cooling->provide_volumetric_heating_rates); + cooling->provide_volumetric_heating_rates); message("Units:"); message("\tComoving = %i", cooling->units.comoving_coordinates); message("\tLength = %g", cooling->units.length_units); @@ -282,54 +279,53 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend( /** * @brief copy a single field from the grackle data to a #xpart - * + * * @param data The #grackle_field_data * @param xp The #xpart * @param rho Particle density * @param field The field to copy */ -#define cooling_copy_field_from_grackle(data, xp, rho, field) \ - xp->cooling_data.field ## _frac = *data.field ## _density / rho; +#define cooling_copy_field_from_grackle(data, xp, rho, field) \ + xp->cooling_data.field##_frac = *data.field##_density / rho; /** * @brief copy a single field from a #xpart to the grackle data - * + * * @param data The #grackle_field_data * @param xp The #xpart * @param rho Particle density * @param field The field to copy */ -#define cooling_copy_field_to_grackle(data, xp, rho, field) \ - gr_float grackle_ ## field = xp->cooling_data.field ## _frac * rho; \ - data.field ## _density = &grackle_ ## field; - +#define cooling_copy_field_to_grackle(data, xp, rho, field) \ + gr_float grackle_##field = xp->cooling_data.field##_frac * rho; \ + data.field##_density = &grackle_##field; /** * @brief copy a #xpart to the grackle data * * Warning this function creates some variable, therefore the grackle call * should be in a block that still has the variables. - * + * * @param data The #grackle_field_data * @param p The #part * @param xp The #xpart * @param rho Particle density */ #if COOLING_GRACKLE_MODE > 0 -#define cooling_copy_to_grackle1(data, p, xp, rho) \ - cooling_copy_field_to_grackle(data, xp, rho, HI); \ - cooling_copy_field_to_grackle(data, xp, rho, HII); \ - cooling_copy_field_to_grackle(data, xp, rho, HeI); \ - cooling_copy_field_to_grackle(data, xp, rho, HeII); \ - cooling_copy_field_to_grackle(data, xp, rho, HeIII); \ +#define cooling_copy_to_grackle1(data, p, xp, rho) \ + cooling_copy_field_to_grackle(data, xp, rho, HI); \ + cooling_copy_field_to_grackle(data, xp, rho, HII); \ + cooling_copy_field_to_grackle(data, xp, rho, HeI); \ + cooling_copy_field_to_grackle(data, xp, rho, HeII); \ + cooling_copy_field_to_grackle(data, xp, rho, HeIII); \ cooling_copy_field_to_grackle(data, xp, rho, e); #else -#define cooling_copy_to_grackle1(data, p, xp, rho) \ - data.HI_density = NULL; \ - data.HII_density = NULL; \ - data.HeI_density = NULL; \ - data.HeII_density = NULL; \ - data.HeIII_density = NULL; \ +#define cooling_copy_to_grackle1(data, p, xp, rho) \ + data.HI_density = NULL; \ + data.HII_density = NULL; \ + data.HeI_density = NULL; \ + data.HeII_density = NULL; \ + data.HeIII_density = NULL; \ data.e_density = NULL; #endif @@ -338,21 +334,21 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend( * * Warning this function creates some variable, therefore the grackle call * should be in a block that still has the variables. - * + * * @param data The #grackle_field_data * @param p The #part * @param xp The #xpart * @param rho Particle density */ #if COOLING_GRACKLE_MODE > 1 -#define cooling_copy_to_grackle2(data, p, xp, rho) \ - cooling_copy_field_to_grackle(data, xp, rho, HM); \ - cooling_copy_field_to_grackle(data, xp, rho, H2I); \ +#define cooling_copy_to_grackle2(data, p, xp, rho) \ + cooling_copy_field_to_grackle(data, xp, rho, HM); \ + cooling_copy_field_to_grackle(data, xp, rho, H2I); \ cooling_copy_field_to_grackle(data, xp, rho, H2II); #else -#define cooling_copy_to_grackle2(data, p, xp, rho) \ - data.HM_density = NULL; \ - data.H2I_density = NULL; \ +#define cooling_copy_to_grackle2(data, p, xp, rho) \ + data.HM_density = NULL; \ + data.H2I_density = NULL; \ data.H2II_density = NULL; #endif @@ -361,39 +357,39 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend( * * Warning this function creates some variable, therefore the grackle call * should be in a block that still has the variables. - * + * * @param data The #grackle_field_data * @param p The #part * @param xp The #xpart * @param rho Particle density */ #if COOLING_GRACKLE_MODE > 2 -#define cooling_copy_to_grackle3(data, p, xp, rho) \ - cooling_copy_field_to_grackle(data, xp, rho, DI); \ - cooling_copy_field_to_grackle(data, xp, rho, DII); \ +#define cooling_copy_to_grackle3(data, p, xp, rho) \ + cooling_copy_field_to_grackle(data, xp, rho, DI); \ + cooling_copy_field_to_grackle(data, xp, rho, DII); \ cooling_copy_field_to_grackle(data, xp, rho, HDI); #else -#define cooling_copy_to_grackle3(data, p, xp, rho) \ - data.DI_density = NULL; \ - data.DII_density = NULL; \ +#define cooling_copy_to_grackle3(data, p, xp, rho) \ + data.DI_density = NULL; \ + data.DII_density = NULL; \ data.HDI_density = NULL; #endif /** * @brief copy the grackle data to a #xpart - * + * * @param data The #grackle_field_data * @param p The #part * @param xp The #xpart * @param rho Particle density */ #if COOLING_GRACKLE_MODE > 0 -#define cooling_copy_from_grackle1(data, p, xp, rho) \ - cooling_copy_field_from_grackle(data, xp, rho, HI); \ - cooling_copy_field_from_grackle(data, xp, rho, HII); \ - cooling_copy_field_from_grackle(data, xp, rho, HeI); \ - cooling_copy_field_from_grackle(data, xp, rho, HeII); \ - cooling_copy_field_from_grackle(data, xp, rho, HeIII); \ +#define cooling_copy_from_grackle1(data, p, xp, rho) \ + cooling_copy_field_from_grackle(data, xp, rho, HI); \ + cooling_copy_field_from_grackle(data, xp, rho, HII); \ + cooling_copy_field_from_grackle(data, xp, rho, HeI); \ + cooling_copy_field_from_grackle(data, xp, rho, HeII); \ + cooling_copy_field_from_grackle(data, xp, rho, HeIII); \ cooling_copy_field_from_grackle(data, xp, rho, e); #else #define cooling_copy_from_grackle1(data, p, xp, rho) @@ -401,16 +397,16 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend( /** * @brief copy the grackle data to a #xpart - * + * * @param data The #grackle_field_data * @param p The #part * @param xp The #xpart * @param rho Particle density */ #if COOLING_GRACKLE_MODE > 1 -#define cooling_copy_from_grackle2(data, p, xp, rho) \ - cooling_copy_field_from_grackle(data, xp, rho, HM); \ - cooling_copy_field_from_grackle(data, xp, rho, H2I); \ +#define cooling_copy_from_grackle2(data, p, xp, rho) \ + cooling_copy_field_from_grackle(data, xp, rho, HM); \ + cooling_copy_field_from_grackle(data, xp, rho, H2I); \ cooling_copy_field_from_grackle(data, xp, rho, H2II); #else #define cooling_copy_from_grackle2(data, p, xp, rho) @@ -418,45 +414,44 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend( /** * @brief copy the grackle data to a #xpart - * + * * @param data The #grackle_field_data * @param p The #part * @param xp The #xpart * @param rho Particle density */ #if COOLING_GRACKLE_MODE > 2 -#define cooling_copy_from_grackle3(data, p, xp, rho) \ - cooling_copy_field_from_grackle(data, xp, rho, DI); \ - cooling_copy_field_from_grackle(data, xp, rho, DII); \ +#define cooling_copy_from_grackle3(data, p, xp, rho) \ + cooling_copy_field_from_grackle(data, xp, rho, DI); \ + cooling_copy_field_from_grackle(data, xp, rho, DII); \ cooling_copy_field_from_grackle(data, xp, rho, HDI); #else #define cooling_copy_from_grackle3(data, p, xp, rho) #endif - /** * @brief copy a #xpart to the grackle data * * Warning this function creates some variable, therefore the grackle call * should be in a block that still has the variables. - * + * * @param data The #grackle_field_data * @param p The #part * @param xp The #xpart * @param rho Particle density */ -#define cooling_copy_to_grackle(data, p, xp, rho) \ - cooling_copy_to_grackle1(data, p, xp, rho); \ - cooling_copy_to_grackle2(data, p, xp, rho); \ - cooling_copy_to_grackle3(data, p, xp, rho); \ - data.volumetric_heating_rate = NULL; \ - data.specific_heating_rate = NULL; \ - data.RT_heating_rate = NULL; \ - data.RT_HI_ionization_rate = NULL; \ - data.RT_HeI_ionization_rate = NULL; \ - data.RT_HeII_ionization_rate = NULL; \ - data.RT_H2_dissociation_rate = NULL; \ - gr_float metal_density = chemistry_metal_mass_fraction(p, xp) * rho; \ +#define cooling_copy_to_grackle(data, p, xp, rho) \ + cooling_copy_to_grackle1(data, p, xp, rho); \ + cooling_copy_to_grackle2(data, p, xp, rho); \ + cooling_copy_to_grackle3(data, p, xp, rho); \ + data.volumetric_heating_rate = NULL; \ + data.specific_heating_rate = NULL; \ + data.RT_heating_rate = NULL; \ + data.RT_HI_ionization_rate = NULL; \ + data.RT_HeI_ionization_rate = NULL; \ + data.RT_HeII_ionization_rate = NULL; \ + data.RT_H2_dissociation_rate = NULL; \ + gr_float metal_density = chemistry_metal_mass_fraction(p, xp) * rho; \ data.metal_density = &metal_density; /** @@ -464,15 +459,15 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend( * * Warning this function creates some variable, therefore the grackle call * should be in a block that still has the variables. - * + * * @param data The #grackle_field_data * @param p The #part * @param xp The #xpart * @param rho Particle density */ -#define cooling_copy_from_grackle(data, p, xp, rho) \ - cooling_copy_from_grackle1(data, p, xp, rho); \ - cooling_copy_from_grackle2(data, p, xp, rho); \ +#define cooling_copy_from_grackle(data, p, xp, rho) \ + cooling_copy_from_grackle1(data, p, xp, rho); \ + cooling_copy_from_grackle2(data, p, xp, rho); \ cooling_copy_from_grackle3(data, p, xp, rho); /** @@ -538,25 +533,19 @@ __attribute__((always_inline)) INLINE static gr_float cooling_rate( /* solve chemistry */ chemistry_data chemistry_grackle = cooling->chemistry; chemistry_data_storage my_rates = grackle_rates; - int error_code = _solve_chemistry(&chemistry_grackle, - &my_rates, - &units, dt, data.grid_dx, - data.grid_rank, data.grid_dimension, - data.grid_start, data.grid_end, - data.density, data.internal_energy, - data.x_velocity, data.y_velocity, data.z_velocity, - data.HI_density, data.HII_density, data.HM_density, - data.HeI_density, data.HeII_density, data.HeIII_density, - data.H2I_density, data.H2II_density, - data.DI_density, data.DII_density, data.HDI_density, - data.e_density, data.metal_density, - data.volumetric_heating_rate, data.specific_heating_rate, - data.RT_heating_rate, data.RT_HI_ionization_rate, data.RT_HeI_ionization_rate, - data.RT_HeII_ionization_rate, data.RT_H2_dissociation_rate, - NULL); - if (error_code == 0) - error("Error in solve_chemistry."); - //if (solve_chemistry(&units, &data, dt) == 0) { + int error_code = _solve_chemistry( + &chemistry_grackle, &my_rates, &units, dt, data.grid_dx, data.grid_rank, + data.grid_dimension, data.grid_start, data.grid_end, data.density, + data.internal_energy, data.x_velocity, data.y_velocity, data.z_velocity, + data.HI_density, data.HII_density, data.HM_density, data.HeI_density, + data.HeII_density, data.HeIII_density, data.H2I_density, + data.H2II_density, data.DI_density, data.DII_density, data.HDI_density, + data.e_density, data.metal_density, data.volumetric_heating_rate, + data.specific_heating_rate, data.RT_heating_rate, + data.RT_HI_ionization_rate, data.RT_HeI_ionization_rate, + data.RT_HeII_ionization_rate, data.RT_H2_dissociation_rate, NULL); + if (error_code == 0) error("Error in solve_chemistry."); + // if (solve_chemistry(&units, &data, dt) == 0) { // error("Error in solve_chemistry."); //} @@ -688,8 +677,6 @@ __attribute__((always_inline)) INLINE static float cooling_timestep( return FLT_MAX; } - - /** * @brief Initialises the cooling unit system. * @@ -697,8 +684,7 @@ __attribute__((always_inline)) INLINE static float cooling_timestep( * @param cooling The cooling properties to initialize */ __attribute__((always_inline)) INLINE static void cooling_init_units( - const struct unit_system* us, - struct cooling_function_data* cooling) { + const struct unit_system* us, struct cooling_function_data* cooling) { /* These are conversions from code units to cgs. */ @@ -727,7 +713,7 @@ __attribute__((always_inline)) INLINE static void cooling_init_units( */ __attribute__((always_inline)) INLINE static void cooling_init_grackle( struct cooling_function_data* cooling) { - + #ifdef SWIFT_DEBUG_CHECKS /* enable verbose for grackle */ grackle_verbose = 1; @@ -752,29 +738,28 @@ __attribute__((always_inline)) INLINE static void cooling_init_grackle( chemistry->grackle_data_file = cooling->cloudy_table; /* radiative transfer */ - chemistry->use_radiative_transfer = - cooling->provide_specific_heating_rates || - cooling->provide_volumetric_heating_rates; + chemistry->use_radiative_transfer = cooling->provide_specific_heating_rates || + cooling->provide_volumetric_heating_rates; chemistry->use_volumetric_heating_rate = - cooling->provide_volumetric_heating_rates; + cooling->provide_volumetric_heating_rates; chemistry->use_specific_heating_rate = - cooling->provide_specific_heating_rates; + cooling->provide_specific_heating_rates; if (cooling->provide_specific_heating_rates && cooling->provide_volumetric_heating_rates) - message("WARNING: You should specified either the specific or the volumetric heating rates, not both"); + message( + "WARNING: You should specified either the specific or the volumetric " + "heating rates, not both"); /* self shielding */ - chemistry->self_shielding_method = - cooling->self_shielding_method; + chemistry->self_shielding_method = cooling->self_shielding_method; /* Initialize the chemistry object. */ if (initialize_chemistry_data(&cooling->units) == 0) { error("Error in initialize_chemistry_data."); } - } - + /** * @brief Initialises the cooling properties. * @@ -798,7 +783,6 @@ __attribute__((always_inline)) INLINE static void cooling_init_backend( cooling_init_units(us, cooling); cooling_init_grackle(cooling); - } #endif /* SWIFT_COOLING_GRACKLE_H */ diff --git a/src/cooling/grackle/cooling_io.h b/src/cooling/grackle/cooling_io.h index 4396fbf3e0945fdbb223e91c33bf4ca494b954a2..ef7a8f27f94bd2c60d4f79f426f4e0c3c9be11a0 100644 --- a/src/cooling/grackle/cooling_io.h +++ b/src/cooling/grackle/cooling_io.h @@ -57,74 +57,70 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour( */ __attribute__((always_inline)) INLINE static int cooling_write_particles( const struct xpart* xparts, struct io_props* list, - const struct cooling_function_data *cooling) { + const struct cooling_function_data* cooling) { int num = 0; - if (cooling->output_mode == 0) - return num; + if (cooling->output_mode == 0) return num; #if COOLING_GRACKLE_MODE >= 1 /* List what we want to write */ - list[0] = io_make_output_field("HI", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.HI_frac); + list[0] = io_make_output_field("HI", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.HI_frac); - list[1] = io_make_output_field("HII", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.HII_frac); - - list[2] = io_make_output_field("HeI", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.HeI_frac); + list[1] = io_make_output_field("HII", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.HII_frac); - list[3] = io_make_output_field("HeII", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.HeII_frac); + list[2] = io_make_output_field("HeI", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.HeI_frac); - list[4] = io_make_output_field("HeIII", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.HeIII_frac); + list[3] = io_make_output_field("HeII", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.HeII_frac); - list[5] = io_make_output_field("e", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.e_frac); + list[4] = io_make_output_field("HeIII", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.HeIII_frac); + + list[5] = io_make_output_field("e", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.e_frac); num += 6; #endif - if (cooling->output_mode == 1) - return num; + if (cooling->output_mode == 1) return num; #if COOLING_GRACKLE_MODE >= 2 list += num; - list[0] = io_make_output_field("HM", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.HM_frac); - - list[1] = io_make_output_field("H2I", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.H2I_frac); + list[0] = io_make_output_field("HM", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.HM_frac); + + list[1] = io_make_output_field("H2I", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.H2I_frac); - list[2] = io_make_output_field("H2II", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.H2II_frac); + list[2] = io_make_output_field("H2II", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.H2II_frac); num += 3; #endif - if (cooling->output_mode == 2) - return num; + if (cooling->output_mode == 2) return num; #if COOLING_GRACKLE_MODE >= 3 list += num; - list[0] = io_make_output_field("DI", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.DI_frac); - - list[1] = io_make_output_field("DII", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.DII_frac); + list[0] = io_make_output_field("DI", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.DI_frac); + + list[1] = io_make_output_field("DII", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.DII_frac); - list[2] = io_make_output_field("HDI", FLOAT, 1, UNIT_CONV_NO_UNITS, - xparts, cooling_data.HDI_frac); + list[2] = io_make_output_field("HDI", FLOAT, 1, UNIT_CONV_NO_UNITS, xparts, + cooling_data.HDI_frac); num += 3; #endif return num; - } /** @@ -146,27 +142,25 @@ __attribute__((always_inline)) INLINE static void cooling_read_parameters( parser_get_param_double(parameter_file, "GrackleCooling:Redshift"); cooling->with_metal_cooling = - parser_get_param_int(parameter_file, "GrackleCooling:WithMetalCooling"); + parser_get_param_int(parameter_file, "GrackleCooling:WithMetalCooling"); - cooling->provide_volumetric_heating_rates = - parser_get_opt_param_int(parameter_file, "GrackleCooling:ProvideVolumetricHeatingRates", 0); + cooling->provide_volumetric_heating_rates = parser_get_opt_param_int( + parameter_file, "GrackleCooling:ProvideVolumetricHeatingRates", 0); - cooling->provide_specific_heating_rates = - parser_get_opt_param_int(parameter_file, "GrackleCooling:ProvideSpecificHeatingRates", 0); + cooling->provide_specific_heating_rates = parser_get_opt_param_int( + parameter_file, "GrackleCooling:ProvideSpecificHeatingRates", 0); - cooling->self_shielding_method = - parser_get_opt_param_int(parameter_file, "GrackleCooling:SelfShieldingMethod", 0); + cooling->self_shielding_method = parser_get_opt_param_int( + parameter_file, "GrackleCooling:SelfShieldingMethod", 0); cooling->output_mode = - parser_get_opt_param_int(parameter_file, "GrackleCooling:OutputMode", 0); - - cooling->max_step = - parser_get_opt_param_int(parameter_file, "GrackleCooling:MaxSteps", 10000); + parser_get_opt_param_int(parameter_file, "GrackleCooling:OutputMode", 0); - cooling->convergence_limit = - parser_get_opt_param_double(parameter_file, "GrackleCooling:ConvergenceLimit", 1e-2); + cooling->max_step = parser_get_opt_param_int( + parameter_file, "GrackleCooling:MaxSteps", 10000); + cooling->convergence_limit = parser_get_opt_param_double( + parameter_file, "GrackleCooling:ConvergenceLimit", 1e-2); } - -#endif // SWIFT_COOLING_GRACKLE_IO_H +#endif // SWIFT_COOLING_GRACKLE_IO_H diff --git a/src/cooling/none/cooling.h b/src/cooling/none/cooling.h index 620ba5af235ea503be9353a250cc04c04ca5c20c..4da220c93fa5ae22c2cae951d4caf640de26a53b 100644 --- a/src/cooling/none/cooling.h +++ b/src/cooling/none/cooling.h @@ -38,7 +38,6 @@ #include "physical_constants.h" #include "units.h" - /** * @brief Apply the cooling function to a particle. * @@ -93,8 +92,8 @@ __attribute__((always_inline)) INLINE static void cooling_first_init_part( const struct phys_const* restrict phys_const, const struct unit_system* restrict us, const struct cosmology* restrict cosmo, - const struct cooling_function_data* data, - const struct part* restrict p, struct xpart* restrict xp) {} + const struct cooling_function_data* data, const struct part* restrict p, + struct xpart* restrict xp) {} /** * @brief Returns the total radiated energy by this particle. diff --git a/src/cooling/none/cooling_io.h b/src/cooling/none/cooling_io.h index 1d13808c1374a150494ee38a638834233f400e1b..ef4bfae10a954ff8293ee029aa81023bf72d4aa5 100644 --- a/src/cooling/none/cooling_io.h +++ b/src/cooling/none/cooling_io.h @@ -45,8 +45,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour( */ __attribute__((always_inline)) INLINE static int cooling_write_particles( const struct xpart* xparts, struct io_props* list, - const struct cooling_function_data *cooling) { + const struct cooling_function_data* cooling) { return 0; } -#endif // SWIFT_COOLING_NONE_IO_H +#endif // SWIFT_COOLING_NONE_IO_H diff --git a/src/debug.c b/src/debug.c index 25301ea5caefe69b7daef2c048b2e4b68d04c289..4000625a5e7d1bc83600a3f20a0db160057f07a6 100644 --- a/src/debug.c +++ b/src/debug.c @@ -326,7 +326,9 @@ static void dumpCells_map(struct cell *c, void *data) { /* So output local super cells that are active and have MPI * tasks as requested. */ - if (c->nodeID == e->nodeID && (!super ||((super && c->super == c) || (c->parent == NULL))) && active && mpiactive) { + if (c->nodeID == e->nodeID && + (!super || ((super && c->super == c) || (c->parent == NULL))) && + active && mpiactive) { /* If requested we work out how many particles are active in this cell. */ int pactcount = 0; diff --git a/src/engine.c b/src/engine.c index f5d8cca878de2088dc1a7be322d2a64fd7e0122a..2bdad767aeb198d3c4c9d0dc6113a7580445022e 100644 --- a/src/engine.c +++ b/src/engine.c @@ -5202,15 +5202,18 @@ void engine_unpin() { * @param chemistry The chemistry information. * @param sourceterms The properties of the source terms function. */ -void engine_init( - struct engine *e, struct space *s, const struct swift_params *params, - long long Ngas, long long Ndm, int policy, int verbose, - struct repartition *reparttype, const struct unit_system *internal_units, - const struct phys_const *physical_constants, struct cosmology *cosmo, - const struct hydro_props *hydro, struct gravity_props *gravity, - const struct external_potential *potential, - const struct cooling_function_data *cooling_func, - const struct chemistry_global_data *chemistry, struct sourceterms *sourceterms) { +void engine_init(struct engine *e, struct space *s, + const struct swift_params *params, long long Ngas, + long long Ndm, int policy, int verbose, + struct repartition *reparttype, + const struct unit_system *internal_units, + const struct phys_const *physical_constants, + struct cosmology *cosmo, const struct hydro_props *hydro, + struct gravity_props *gravity, + const struct external_potential *potential, + const struct cooling_function_data *cooling_func, + const struct chemistry_global_data *chemistry, + struct sourceterms *sourceterms) { /* Clean-up everything */ bzero(e, sizeof(struct engine)); @@ -5974,7 +5977,8 @@ void engine_struct_restore(struct engine *e, FILE *stream) { e->cooling_func = cooling_func; struct chemistry_global_data *chemistry = - (struct chemistry_global_data *)malloc(sizeof(struct chemistry_global_data)); + (struct chemistry_global_data *)malloc( + sizeof(struct chemistry_global_data)); chemistry_struct_restore(chemistry, stream); e->chemistry = chemistry; diff --git a/src/engine.h b/src/engine.h index cd1b47f23f4cfb4bb07e3c1dbda69442d1f95738..29a064876317d7e1a7ff1cba5e3cb740b6e171a9 100644 --- a/src/engine.h +++ b/src/engine.h @@ -330,15 +330,18 @@ void engine_drift_top_multipoles(struct engine *e); void engine_reconstruct_multipoles(struct engine *e); void engine_print_stats(struct engine *e); void engine_dump_snapshot(struct engine *e); -void engine_init( - struct engine *e, struct space *s, const struct swift_params *params, - long long Ngas, long long Ndm, int policy, int verbose, - struct repartition *reparttype, const struct unit_system *internal_units, - const struct phys_const *physical_constants, struct cosmology *cosmo, - const struct hydro_props *hydro, struct gravity_props *gravity, - const struct external_potential *potential, - const struct cooling_function_data *cooling_func, - const struct chemistry_global_data *chemistry, struct sourceterms *sourceterms); +void engine_init(struct engine *e, struct space *s, + const struct swift_params *params, long long Ngas, + long long Ndm, int policy, int verbose, + struct repartition *reparttype, + const struct unit_system *internal_units, + const struct phys_const *physical_constants, + struct cosmology *cosmo, const struct hydro_props *hydro, + struct gravity_props *gravity, + const struct external_potential *potential, + const struct cooling_function_data *cooling_func, + const struct chemistry_global_data *chemistry, + struct sourceterms *sourceterms); void engine_config(int restart, struct engine *e, const struct swift_params *params, int nr_nodes, int nodeID, int nr_threads, int with_aff, int verbose, diff --git a/src/parallel_io.c b/src/parallel_io.c index 00931a2ea9c293468cf72bdffd280875ae697c2b..ced02a6dba9f4f772de37c9aef75df0435472f0a 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -860,7 +860,7 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6], int periodic = e->s->periodic; int numFiles = 1; - const struct cooling_function_data *cooling = e->cooling_func; + const struct cooling_function_data* cooling = e->cooling_func; /* First time, we need to create the XMF file */ if (e->snapshotOutputCount == 0) xmf_create_file(baseName); @@ -1245,7 +1245,8 @@ void write_output_parallel(struct engine* e, const char* baseName, Nparticles = Ngas; hydro_write_particles(parts, xparts, list, &num_fields); num_fields += chemistry_write_particles(parts, list + num_fields); - num_fields += cooling_write_particles(xparts, list + num_fields, cooling); + num_fields += + cooling_write_particles(xparts, list + num_fields, cooling); break; case swift_type_dark_matter: diff --git a/src/serial_io.c b/src/serial_io.c index acc0387f11f478eb66f7f9b2948230ec4b2076ed..3167c1681ef340c24868766fdcf983fcf0bbd021 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -744,7 +744,7 @@ void write_output_serial(struct engine* e, const char* baseName, const struct gpart* gparts = e->s->gparts; struct gpart* dmparts = NULL; const struct spart* sparts = e->s->sparts; - const struct cooling_function_data *cooling = e->cooling_func; + const struct cooling_function_data* cooling = e->cooling_func; FILE* xmfFile = 0; /* Number of unassociated gparts */ @@ -993,8 +993,8 @@ void write_output_serial(struct engine* e, const char* baseName, Nparticles = Ngas; hydro_write_particles(parts, xparts, list, &num_fields); num_fields += chemistry_write_particles(parts, list + num_fields); - num_fields += cooling_write_particles(xparts, list + num_fields, - cooling); + num_fields += + cooling_write_particles(xparts, list + num_fields, cooling); break; case swift_type_dark_matter: diff --git a/src/single_io.c b/src/single_io.c index 3762604df046b8d43f28f318b742244ec5a4715a..8b9ba65e4d07cb7ab1f4b0825849a201736d0238 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -612,7 +612,7 @@ void write_output_single(struct engine* e, const char* baseName, const struct gpart* gparts = e->s->gparts; struct gpart* dmparts = NULL; const struct spart* sparts = e->s->sparts; - const struct cooling_function_data *cooling = e->cooling_func; + const struct cooling_function_data* cooling = e->cooling_func; /* Number of unassociated gparts */ const size_t Ndm = Ntot > 0 ? Ntot - (Ngas + Nstars) : 0; @@ -812,8 +812,8 @@ void write_output_single(struct engine* e, const char* baseName, N = Ngas; hydro_write_particles(parts, xparts, list, &num_fields); num_fields += chemistry_write_particles(parts, list + num_fields); - num_fields += cooling_write_particles(xparts, list + num_fields, - cooling); + num_fields += + cooling_write_particles(xparts, list + num_fields, cooling); break; case swift_type_dark_matter: diff --git a/src/vector.h b/src/vector.h index 5117e0e4e6d51141a9483db60460826d81f500f5..9048e273759ae0c0978c8ddbf26a810d4761f464 100644 --- a/src/vector.h +++ b/src/vector.h @@ -360,7 +360,8 @@ #ifdef HAVE_SSE4_1 #define vec_blend(mask, a, b) _mm_blendv_ps(a, b, mask.v) #else -#define vec_blend(mask, a, b) _mm_or_ps(_mm_and_ps(mask.v,b), _mm_andnot_ps(mask.v,a)) +#define vec_blend(mask, a, b) \ + _mm_or_ps(_mm_and_ps(mask.v, b), _mm_andnot_ps(mask.v, a)) #endif #define vec_todbl_lo(a) _mm_cvtps_pd(a) #define vec_todbl_hi(a) _mm_cvtps_pd(_mm_movehl_ps(a, a))