From 8109e6ce943b53f78e9a239a54602e66a5415f8b Mon Sep 17 00:00:00 2001 From: loikki <loic.hausammann@protonmail.ch> Date: Mon, 29 Jul 2019 14:03:02 +0200 Subject: [PATCH] Format --- src/star_formation/EAGLE/star_formation.h | 3 +- .../EAGLE/star_formation_logger.h | 9 ++--- .../EAGLE/star_formation_logger_struct.h | 2 - src/star_formation/GEAR/star_formation.h | 40 +++++++++++-------- src/star_formation/GEAR/star_formation_iact.h | 12 +----- src/star_formation/GEAR/star_formation_io.h | 12 +++--- .../GEAR/star_formation_logger.h | 2 - .../GEAR/star_formation_logger_struct.h | 3 +- .../GEAR/star_formation_struct.h | 4 +- src/star_formation/none/star_formation.h | 3 +- .../none/star_formation_logger.h | 9 ++--- .../none/star_formation_logger_struct.h | 1 - src/stars/GEAR/stars_io.h | 9 +++-- 13 files changed, 51 insertions(+), 58 deletions(-) diff --git a/src/star_formation/EAGLE/star_formation.h b/src/star_formation/EAGLE/star_formation.h index eb6a74cbd3..55f1c8d427 100644 --- a/src/star_formation/EAGLE/star_formation.h +++ b/src/star_formation/EAGLE/star_formation.h @@ -690,6 +690,7 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, * @param data The global star_formation information. */ __attribute__((always_inline)) INLINE static void star_formation_init_part( - struct part* restrict p, struct xpart* restrict xp, const struct star_formation* data) {} + struct part* restrict p, struct xpart* restrict xp, + const struct star_formation* data) {} #endif /* SWIFT_EAGLE_STAR_FORMATION_H */ diff --git a/src/star_formation/EAGLE/star_formation_logger.h b/src/star_formation/EAGLE/star_formation_logger.h index e992e5d144..a843f63ce5 100644 --- a/src/star_formation/EAGLE/star_formation_logger.h +++ b/src/star_formation/EAGLE/star_formation_logger.h @@ -88,11 +88,11 @@ INLINE static void star_formation_logger_add( } /** - * @brief add a star formation history struct to the engine star formation history - * accumulator struct + * @brief add a star formation history struct to the engine star formation + * history accumulator struct * - * @param sf_add the star formation accumulator struct which we want to add to the star - * formation history + * @param sf_add the star formation accumulator struct which we want to add to + * the star formation history * @param sf_update the star formation structure which we want to update */ INLINE static void star_formation_logger_add_to_accumulator( @@ -145,7 +145,6 @@ INLINE static void star_formation_logger_accumulator_init( sfh->SFR_inactive = 0.f; } - /** * @brief Write the final SFH to a file * diff --git a/src/star_formation/EAGLE/star_formation_logger_struct.h b/src/star_formation/EAGLE/star_formation_logger_struct.h index b677ee6bc7..c03a00c97e 100644 --- a/src/star_formation/EAGLE/star_formation_logger_struct.h +++ b/src/star_formation/EAGLE/star_formation_logger_struct.h @@ -34,7 +34,6 @@ struct star_formation_history { float SFRdt_active; }; - /* Starformation history struct for the engine. Allows to integrate in time some values. Nothing to do in EAGLE => copy of star_formation_history */ @@ -52,5 +51,4 @@ struct star_formation_history_accumulator { float SFRdt_active; }; - #endif /* SWIFT_EAGLE_STAR_FORMATION_LOGGER_STRUCT_H */ diff --git a/src/star_formation/GEAR/star_formation.h b/src/star_formation/GEAR/star_formation.h index a1d9dda2a0..ac423a5186 100644 --- a/src/star_formation/GEAR/star_formation.h +++ b/src/star_formation/GEAR/star_formation.h @@ -59,8 +59,8 @@ INLINE static int star_formation_is_star_forming( const struct cooling_function_data* restrict cooling, const struct entropy_floor_properties* restrict entropy_floor) { - const float temperature = - cooling_get_temperature(phys_const, hydro_props, us, cosmo, cooling, p, xp); + const float temperature = cooling_get_temperature(phys_const, hydro_props, us, + cosmo, cooling, p, xp); const float temperature_max = starform->maximal_temperature; @@ -80,9 +80,12 @@ INLINE static int star_formation_is_star_forming( const float mu = hydro_props->mu_neutral; /* Compute the density criterion */ - const float coef = M_PI_4 / (phys_const->const_newton_G * n_jeans_2_3 * h * h); - const float density_criterion = coef * (hydro_gamma * phys_const->const_boltzmann_k * temperature - / (mu * phys_const->const_proton_mass) + sigma2); + const float coef = + M_PI_4 / (phys_const->const_newton_G * n_jeans_2_3 * h * h); + const float density_criterion = + coef * (hydro_gamma * phys_const->const_boltzmann_k * temperature / + (mu * phys_const->const_proton_mass) + + sigma2); /* Check the density criterion */ return density > density_criterion; @@ -91,7 +94,8 @@ INLINE static int star_formation_is_star_forming( /** * @brief Compute the star-formation rate of a given particle. * - * Nothing to do here. Everything is done in #star_formation_should_convert_to_star. + * Nothing to do here. Everything is done in + * #star_formation_should_convert_to_star. * * @param p #part. * @param xp the #xpart. @@ -123,7 +127,7 @@ INLINE static int star_formation_should_convert_to_star( const struct engine* e, const double dt_star) { const struct phys_const* phys_const = e->physical_constants; - const struct cosmology *cosmo = e->cosmology; + const struct cosmology* cosmo = e->cosmology; /* Check that we are running a full time step */ if (dt_star == 0.) { @@ -135,12 +139,14 @@ INLINE static int star_formation_should_convert_to_star( const float density = hydro_get_physical_density(p, cosmo); /* Compute the probability */ - const float inv_free_fall_time = sqrtf(density * 32.f * G * 0.33333333f * M_1_PI); - const float prob = 1.f - exp(-starform->star_formation_efficiency * inv_free_fall_time * dt_star); + const float inv_free_fall_time = + sqrtf(density * 32.f * G * 0.33333333f * M_1_PI); + const float prob = 1.f - exp(-starform->star_formation_efficiency * + inv_free_fall_time * dt_star); /* Roll the dice... */ const float random_number = - random_unit_interval(p->id, e->ti_current, random_number_star_formation); + random_unit_interval(p->id, e->ti_current, random_number_star_formation); /* Can we form a star? */ return random_number < prob; @@ -203,9 +209,8 @@ INLINE static void star_formation_copy_properties( sp->birth.density = hydro_get_physical_density(p, cosmo); /* Store the birth temperature*/ - sp->birth.temperature = - cooling_get_temperature(phys_const, hydro_props, us, - cosmo, cooling, p, xp); + sp->birth.temperature = cooling_get_temperature(phys_const, hydro_props, us, + cosmo, cooling, p, xp); } /** @@ -227,11 +232,13 @@ INLINE static void starformation_print_backend( * @param cosmo The current cosmological model. */ __attribute__((always_inline)) INLINE static void star_formation_end_density( - struct part* restrict p, const struct star_formation* sf, const struct cosmology* cosmo) { + struct part* restrict p, const struct star_formation* sf, + const struct cosmology* cosmo) { // TODO move into pressure floor /* To finish the turbulence estimation we devide by the density */ - p->sf_data.sigma2 /= pow_dimension(p->h) * hydro_get_physical_density(p, cosmo); + p->sf_data.sigma2 /= + pow_dimension(p->h) * hydro_get_physical_density(p, cosmo); /* Add the cosmological factor */ p->sf_data.sigma2 *= cosmo->a * cosmo->a; @@ -285,11 +292,10 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, const struct cosmology* restrict cosmo, const struct star_formation* data, struct part* restrict p, - struct xpart* restrict xp) { + struct xpart* restrict xp) { /* Nothing special here */ star_formation_init_part(p, xp, data); } - #endif /* SWIFT_GEAR_STAR_FORMATION_H */ diff --git a/src/star_formation/GEAR/star_formation_iact.h b/src/star_formation/GEAR/star_formation_iact.h index 80de642275..7325b92af2 100644 --- a/src/star_formation/GEAR/star_formation_iact.h +++ b/src/star_formation/GEAR/star_formation_iact.h @@ -51,11 +51,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_star_formation( kernel_eval(sqrt(r2) / hj, &wj); /* Delta v */ - float dv[3] = { - pi->v[0] - pj->v[0], - pi->v[1] - pj->v[1], - pi->v[2] - pj->v[2] - }; + float dv[3] = {pi->v[0] - pj->v[0], pi->v[1] - pj->v[1], pi->v[2] - pj->v[2]}; /* Norms at power 2 */ const float norm_v2 = dv[0] * dv[0] + dv[1] * dv[1] + dv[2] * dv[2]; @@ -92,11 +88,7 @@ runner_iact_nonsym_star_formation(float r2, const float *dx, float hi, float hj, kernel_eval(sqrt(r2) / hi, &wi); /* Delta v */ - float dv[3] = { - pi->v[0] - pj->v[0], - pi->v[1] - pj->v[1], - pi->v[2] - pj->v[2] - }; + float dv[3] = {pi->v[0] - pj->v[0], pi->v[1] - pj->v[1], pi->v[2] - pj->v[2]}; /* Norms at power 2 */ const float norm_v2 = dv[0] * dv[0] + dv[1] * dv[1] + dv[2] * dv[2]; diff --git a/src/star_formation/GEAR/star_formation_io.h b/src/star_formation/GEAR/star_formation_io.h index a0fa0935ca..3e021f7844 100644 --- a/src/star_formation/GEAR/star_formation_io.h +++ b/src/star_formation/GEAR/star_formation_io.h @@ -38,11 +38,10 @@ __attribute__((always_inline)) INLINE static int star_formation_write_particles( const struct part* parts, const struct xpart* xparts, struct io_props* list) { -/* Nothing to write here */ + /* Nothing to write here */ return 0; } - /** * @brief initialization of the star formation law * @@ -60,20 +59,19 @@ INLINE static void starformation_init_backend( // TODO move into pressure floor starform->n_jeans_2_3 = parser_get_param_float(parameter_file, "GEARStarFormation:NJeans"); - starform->n_jeans_2_3 = pow(starform->n_jeans_2_3, 2./3.); + starform->n_jeans_2_3 = pow(starform->n_jeans_2_3, 2. / 3.); /* Star formation efficiency */ starform->star_formation_efficiency = parser_get_param_double( parameter_file, "GEARStarFormation:star_formation_efficiency"); /* Maximum temperature for star formation */ - starform->maximal_temperature = - parser_get_param_double(parameter_file, - "GEARStarFormation:maximal_temperature"); + starform->maximal_temperature = parser_get_param_double( + parameter_file, "GEARStarFormation:maximal_temperature"); /* Apply unit change */ starform->maximal_temperature *= - units_cgs_conversion_factor(us, UNIT_CONV_TEMPERATURE); + units_cgs_conversion_factor(us, UNIT_CONV_TEMPERATURE); } #endif /* SWIFT_STAR_FORMATION_GEAR_IO_H */ diff --git a/src/star_formation/GEAR/star_formation_logger.h b/src/star_formation/GEAR/star_formation_logger.h index 45d39b1843..84475909c0 100644 --- a/src/star_formation/GEAR/star_formation_logger.h +++ b/src/star_formation/GEAR/star_formation_logger.h @@ -166,8 +166,6 @@ INLINE static void star_formation_logger_log_inactive_part( const struct part *p, const struct xpart *xp, struct star_formation_history *sf) {} - - /** * @brief add a star formation history struct to an other star formation history * struct diff --git a/src/star_formation/GEAR/star_formation_logger_struct.h b/src/star_formation/GEAR/star_formation_logger_struct.h index f694cda643..63e3af06a7 100644 --- a/src/star_formation/GEAR/star_formation_logger_struct.h +++ b/src/star_formation/GEAR/star_formation_logger_struct.h @@ -32,7 +32,8 @@ struct star_formation_history { }; /** - * Structure containing the global star formation information (including time integrated variables). + * Structure containing the global star formation information (including time + * integrated variables). */ struct star_formation_history_accumulator { /*! Total stellar mass from the begining of the simulation */ diff --git a/src/star_formation/GEAR/star_formation_struct.h b/src/star_formation/GEAR/star_formation_struct.h index 960ccda293..2e9a7548f8 100644 --- a/src/star_formation/GEAR/star_formation_struct.h +++ b/src/star_formation/GEAR/star_formation_struct.h @@ -25,7 +25,6 @@ */ struct star_formation_xpart_data {}; - struct star_formation_part_data { // TODO move it to the pressure floor /*! Estimation of local turbulence (squared) */ @@ -38,7 +37,8 @@ struct star_formation_part_data { struct star_formation { // TODO move it to pressure floor - /*! Number of particle required to resolved the Jeans criterion (at power 2/3) */ + /*! Number of particle required to resolved the Jeans criterion (at power 2/3) + */ float n_jeans_2_3; /*! Maximal temperature for forming a star */ diff --git a/src/star_formation/none/star_formation.h b/src/star_formation/none/star_formation.h index 6ef1c11068..3275e1a4c4 100644 --- a/src/star_formation/none/star_formation.h +++ b/src/star_formation/none/star_formation.h @@ -219,6 +219,7 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, * @param data The global star_formation information. */ __attribute__((always_inline)) INLINE static void star_formation_init_part( - struct part* restrict p, struct xpart* restrict xp, const struct star_formation* data) {} + struct part* restrict p, struct xpart* restrict xp, + const struct star_formation* data) {} #endif /* SWIFT_NONE_STAR_FORMATION_H */ diff --git a/src/star_formation/none/star_formation_logger.h b/src/star_formation/none/star_formation_logger.h index 0a90bd4869..552df0c6ca 100644 --- a/src/star_formation/none/star_formation_logger.h +++ b/src/star_formation/none/star_formation_logger.h @@ -59,13 +59,12 @@ INLINE static void star_formation_logger_add( struct star_formation_history *sf_update, const struct star_formation_history *sf_add) {} - /** - * @brief add a star formation history accumulator struct to an other star formation history - * struct + * @brief add a star formation history accumulator struct to an other star + * formation history struct * - * @param sf_add the star formation accumulator struct which we want to add to the star - * formation history + * @param sf_add the star formation accumulator struct which we want to add to + * the star formation history * @param sf_update the star formation structure which we want to update */ INLINE static void star_formation_logger_add_to_accumulator( diff --git a/src/star_formation/none/star_formation_logger_struct.h b/src/star_formation/none/star_formation_logger_struct.h index c80d6b6f3f..b60c64f2eb 100644 --- a/src/star_formation/none/star_formation_logger_struct.h +++ b/src/star_formation/none/star_formation_logger_struct.h @@ -22,7 +22,6 @@ /* Starformation history struct */ struct star_formation_history {}; - /* Starformation history accumulator struct. This structure is only defined in the engine and allows the user to integrate some quantities over time. diff --git a/src/stars/GEAR/stars_io.h b/src/stars/GEAR/stars_io.h index 4551d8af2c..a538a2ba10 100644 --- a/src/stars/GEAR/stars_io.h +++ b/src/stars/GEAR/stars_io.h @@ -76,10 +76,11 @@ INLINE static void stars_write_particles(const struct spart *sparts, sparts, h); list[5] = io_make_output_field("BirthTime", FLOAT, 1, UNIT_CONV_TIME, sparts, birth_time); - list[6] = io_make_output_field("BirthDensity", FLOAT, 1, UNIT_CONV_DENSITY, sparts, - birth.density); - list[7] = io_make_output_field("BirthTemperature", FLOAT, 1, UNIT_CONV_TEMPERATURE, sparts, - birth.temperature); + list[6] = io_make_output_field("BirthDensity", FLOAT, 1, UNIT_CONV_DENSITY, + sparts, birth.density); + list[7] = + io_make_output_field("BirthTemperature", FLOAT, 1, UNIT_CONV_TEMPERATURE, + sparts, birth.temperature); list[8] = io_make_output_field("BirthMass", FLOAT, 1, UNIT_CONV_MASS, sparts, birth.mass); -- GitLab