From 80196acc2df6d5118c62e31d368d4e42c5e87af2 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Mon, 18 Jun 2018 11:32:12 +0200 Subject: [PATCH] Code formatting --- examples/main.c | 1 - src/chemistry/EAGLE/chemistry.h | 7 +-- src/chemistry/GEAR/chemistry.h | 7 +-- src/chemistry/none/chemistry.h | 7 +-- src/cooling/EAGLE/cooling.h | 9 ++-- src/cooling/const_du/cooling.h | 8 +-- src/cooling/const_lambda/cooling.h | 8 +-- src/cooling/none/cooling.h | 9 ++-- src/cosmology.c | 3 +- src/cosmology.h | 3 +- src/engine.c | 14 +++--- src/engine.h | 14 +++--- src/gravity_properties.c | 3 +- src/gravity_properties.h | 3 +- src/parallel_io.c | 4 +- src/parser.c | 50 +++++++++---------- src/parser.h | 30 +++++------ src/physical_constants.c | 3 +- src/physical_constants.h | 3 +- src/potential/disc_patch/potential.h | 6 +-- src/potential/isothermal/potential.h | 6 +-- src/potential/none/potential.h | 6 +-- src/potential/point_mass/potential.h | 6 +-- src/potential/point_mass_ring/potential.h | 6 +-- src/potential/point_mass_softened/potential.h | 6 +-- src/potential/sine_wave/potential.h | 6 +-- src/serial_io.c | 4 +- src/single_io.c | 4 +- src/units.c | 8 ++- src/units.h | 5 +- tests/testParser.c | 3 +- 31 files changed, 118 insertions(+), 134 deletions(-) diff --git a/examples/main.c b/examples/main.c index ccf25c22c1..61b32c69dc 100644 --- a/examples/main.c +++ b/examples/main.c @@ -468,7 +468,6 @@ int main(int argc, char *argv[]) { "values."); for (int k = 0; k < nparams; k++) parser_set_param(params, cmdparams[k]); } - } #ifdef WITH_MPI /* Broadcast the parameter file */ diff --git a/src/chemistry/EAGLE/chemistry.h b/src/chemistry/EAGLE/chemistry.h index 8b007b40fa..96a645806a 100644 --- a/src/chemistry/EAGLE/chemistry.h +++ b/src/chemistry/EAGLE/chemistry.h @@ -124,9 +124,10 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part( * @param phys_const The physical constants in internal units. * @param data The properties to initialise. */ -static INLINE void chemistry_init_backend( - struct swift_params* parameter_file, const struct unit_system* us, - const struct phys_const* phys_const, struct chemistry_global_data* data) { +static INLINE void chemistry_init_backend(struct swift_params* parameter_file, + const struct unit_system* us, + const struct phys_const* phys_const, + struct chemistry_global_data* data) { /* Read the total metallicity */ data->initial_metal_mass_fraction_total = diff --git a/src/chemistry/GEAR/chemistry.h b/src/chemistry/GEAR/chemistry.h index abed5b9136..6212ed1efb 100644 --- a/src/chemistry/GEAR/chemistry.h +++ b/src/chemistry/GEAR/chemistry.h @@ -72,9 +72,10 @@ static INLINE void chemistry_print_backend( * @param phys_const The physical constants in internal units. * @param data The properties to initialise. */ -static INLINE void chemistry_init_backend( - struct swift_params* parameter_file, const struct unit_system* us, - const struct phys_const* phys_const, struct chemistry_global_data* data) { +static INLINE void chemistry_init_backend(struct swift_params* parameter_file, + const struct unit_system* us, + const struct phys_const* phys_const, + struct chemistry_global_data* data) { /* read parameters */ data->initial_metallicity = parser_get_opt_param_float( diff --git a/src/chemistry/none/chemistry.h b/src/chemistry/none/chemistry.h index 2114b1c85f..dce06ffda3 100644 --- a/src/chemistry/none/chemistry.h +++ b/src/chemistry/none/chemistry.h @@ -59,9 +59,10 @@ chemistry_get_element_name(enum chemistry_element elem) { * @param phys_const The physical constants in internal units. * @param data The global chemistry information (to be filled). */ -static INLINE void chemistry_init_backend( - struct swift_params* parameter_file, const struct unit_system* us, - const struct phys_const* phys_const, struct chemistry_global_data* data) {} +static INLINE void chemistry_init_backend(struct swift_params* parameter_file, + const struct unit_system* us, + const struct phys_const* phys_const, + struct chemistry_global_data* data) {} /** * @brief Prints the properties of the chemistry model to stdout. diff --git a/src/cooling/EAGLE/cooling.h b/src/cooling/EAGLE/cooling.h index 6227dd2426..f059d995c6 100644 --- a/src/cooling/EAGLE/cooling.h +++ b/src/cooling/EAGLE/cooling.h @@ -109,10 +109,11 @@ __attribute__((always_inline)) INLINE static float cooling_get_radiated_energy( * @param phys_const The physical constants in internal units. * @param cooling The cooling properties to initialize */ -static INLINE void cooling_init_backend( - struct swift_params* parameter_file, const struct unit_system* us, - const struct phys_const* phys_const, - struct cooling_function_data* cooling) {} +static INLINE void cooling_init_backend(struct swift_params* parameter_file, + const struct unit_system* us, + const struct phys_const* phys_const, + struct cooling_function_data* cooling) { +} /** * @brief Prints the properties of the cooling model to stdout. diff --git a/src/cooling/const_du/cooling.h b/src/cooling/const_du/cooling.h index f436e1e283..b6fea7eea7 100644 --- a/src/cooling/const_du/cooling.h +++ b/src/cooling/const_du/cooling.h @@ -163,10 +163,10 @@ __attribute__((always_inline)) INLINE static float cooling_get_radiated_energy( * @param phys_const The physical constants in internal units. * @param cooling The cooling properties to initialize */ -static INLINE void cooling_init_backend( - struct swift_params* parameter_file, const struct unit_system* us, - const struct phys_const* phys_const, - struct cooling_function_data* cooling) { +static INLINE void cooling_init_backend(struct swift_params* parameter_file, + const struct unit_system* us, + const struct phys_const* phys_const, + struct cooling_function_data* cooling) { cooling->cooling_rate = parser_get_param_double(parameter_file, "ConstCooling:cooling_rate"); diff --git a/src/cooling/const_lambda/cooling.h b/src/cooling/const_lambda/cooling.h index e54071204c..f1a7abdbe1 100644 --- a/src/cooling/const_lambda/cooling.h +++ b/src/cooling/const_lambda/cooling.h @@ -171,10 +171,10 @@ __attribute__((always_inline)) INLINE static float cooling_get_radiated_energy( * @param phys_const The physical constants in internal units. * @param cooling The cooling properties to initialize */ -static INLINE void cooling_init_backend( - struct swift_params* parameter_file, const struct unit_system* us, - const struct phys_const* phys_const, - struct cooling_function_data* cooling) { +static INLINE void cooling_init_backend(struct swift_params* parameter_file, + const struct unit_system* us, + const struct phys_const* phys_const, + struct cooling_function_data* cooling) { const double lambda_cgs = parser_get_param_double(parameter_file, "LambdaCooling:lambda_cgs"); diff --git a/src/cooling/none/cooling.h b/src/cooling/none/cooling.h index bf096ff84e..0cc465adcd 100644 --- a/src/cooling/none/cooling.h +++ b/src/cooling/none/cooling.h @@ -119,10 +119,11 @@ __attribute__((always_inline)) INLINE static float cooling_get_radiated_energy( * @param phys_const The physical constants in internal units. * @param cooling The cooling properties to initialize */ -static INLINE void cooling_init_backend( - struct swift_params* parameter_file, const struct unit_system* us, - const struct phys_const* phys_const, - struct cooling_function_data* cooling) {} +static INLINE void cooling_init_backend(struct swift_params* parameter_file, + const struct unit_system* us, + const struct phys_const* phys_const, + struct cooling_function_data* cooling) { +} /** * @brief Prints the properties of the cooling model to stdout. diff --git a/src/cosmology.c b/src/cosmology.c index 0cc528c8a0..09472fd77c 100644 --- a/src/cosmology.c +++ b/src/cosmology.c @@ -387,8 +387,7 @@ void cosmology_init_tables(struct cosmology *c) { * @param phys_const The physical constants in the current system of units. * @param c The #cosmology to initialise. */ -void cosmology_init(struct swift_params *params, - const struct unit_system *us, +void cosmology_init(struct swift_params *params, const struct unit_system *us, const struct phys_const *phys_const, struct cosmology *c) { /* Read in the cosmological parameters */ diff --git a/src/cosmology.h b/src/cosmology.h index 93751fba6f..ea992d12de 100644 --- a/src/cosmology.h +++ b/src/cosmology.h @@ -181,8 +181,7 @@ double cosmology_get_therm_kick_factor(const struct cosmology *cosmo, double cosmology_get_delta_time(const struct cosmology *c, double a1, double a2); -void cosmology_init(struct swift_params *params, - const struct unit_system *us, +void cosmology_init(struct swift_params *params, const struct unit_system *us, const struct phys_const *phys_const, struct cosmology *c); void cosmology_init_no_cosmo(struct cosmology *c); diff --git a/src/engine.c b/src/engine.c index c62feb434d..c7a87500aa 100644 --- a/src/engine.c +++ b/src/engine.c @@ -5421,10 +5421,9 @@ void engine_unpin(void) { * @param chemistry The chemistry information. * @param sourceterms The properties of the source terms function. */ -void engine_init(struct engine *e, struct space *s, - struct swift_params *params, long long Ngas, - long long Ngparts, long long Nstars, int policy, int verbose, - struct repartition *reparttype, +void engine_init(struct engine *e, struct space *s, struct swift_params *params, + long long Ngas, long long Ngparts, long long Nstars, + 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, @@ -5552,10 +5551,9 @@ void engine_init(struct engine *e, struct space *s, * @param verbose Is this #engine talkative ? * @param restart_file The name of our restart file. */ -void engine_config(int restart, struct engine *e, - struct swift_params *params, int nr_nodes, int nodeID, - int nr_threads, int with_aff, int verbose, - const char *restart_file) { +void engine_config(int restart, struct engine *e, struct swift_params *params, + int nr_nodes, int nodeID, int nr_threads, int with_aff, + int verbose, const char *restart_file) { /* Store the values and initialise global fields. */ e->nodeID = nodeID; diff --git a/src/engine.h b/src/engine.h index 877dbf3627..2b0af9aa60 100644 --- a/src/engine.h +++ b/src/engine.h @@ -354,10 +354,9 @@ 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, - struct swift_params *params, long long Ngas, - long long Ngparts, long long Nstars, int policy, int verbose, - struct repartition *reparttype, +void engine_init(struct engine *e, struct space *s, struct swift_params *params, + long long Ngas, long long Ngparts, long long Nstars, + 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, @@ -366,10 +365,9 @@ void engine_init(struct engine *e, struct space *s, const struct cooling_function_data *cooling_func, const struct chemistry_global_data *chemistry, struct sourceterms *sourceterms); -void engine_config(int restart, struct engine *e, - struct swift_params *params, int nr_nodes, int nodeID, - int nr_threads, int with_aff, int verbose, - const char *restart_file); +void engine_config(int restart, struct engine *e, struct swift_params *params, + int nr_nodes, int nodeID, int nr_threads, int with_aff, + int verbose, const char *restart_file); void engine_launch(struct engine *e); void engine_prepare(struct engine *e); void engine_init_particles(struct engine *e, int flag_entropy_ICs, diff --git a/src/gravity_properties.c b/src/gravity_properties.c index 05e28dc860..481ed2cd5e 100644 --- a/src/gravity_properties.c +++ b/src/gravity_properties.c @@ -37,8 +37,7 @@ #define gravity_props_default_r_cut_min 0.1f #define gravity_props_default_rebuild_frequency 0.01f -void gravity_props_init(struct gravity_props *p, - struct swift_params *params, +void gravity_props_init(struct gravity_props *p, struct swift_params *params, const struct cosmology *cosmo) { /* Tree updates */ diff --git a/src/gravity_properties.h b/src/gravity_properties.h index 6f0898a164..7faaa88d5e 100644 --- a/src/gravity_properties.h +++ b/src/gravity_properties.h @@ -82,8 +82,7 @@ struct gravity_props { }; void gravity_props_print(const struct gravity_props *p); -void gravity_props_init(struct gravity_props *p, - struct swift_params *params, +void gravity_props_init(struct gravity_props *p, struct swift_params *params, const struct cosmology *cosmo); void gravity_update(struct gravity_props *p, const struct cosmology *cosmo); diff --git a/src/parallel_io.c b/src/parallel_io.c index 8720a6ce6e..d37c863267 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -1022,8 +1022,8 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6], H5Gclose(h_grp); /* Print the runtime unused parameters */ - h_grp = - H5Gcreate(h_file, "/UnusedParameters", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + h_grp = H5Gcreate(h_file, "/UnusedParameters", H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); if (h_grp < 0) error("Error while creating parameters group"); parser_write_params_to_hdf5(e->parameter_file, h_grp, 0); H5Gclose(h_grp); diff --git a/src/parser.c b/src/parser.c index 58f5632ee0..78d8aef2c3 100644 --- a/src/parser.c +++ b/src/parser.c @@ -478,8 +478,7 @@ int parser_get_param_int(struct swift_params *params, const char *name) { * @param name Name of the parameter to be found * @return Value of the parameter found */ -char parser_get_param_char(struct swift_params *params, - const char *name) { +char parser_get_param_char(struct swift_params *params, const char *name) { char str[PARSER_MAX_LINE_SIZE]; char retParam = 0; @@ -513,8 +512,7 @@ char parser_get_param_char(struct swift_params *params, * @param name Name of the parameter to be found * @return Value of the parameter found */ -float parser_get_param_float(struct swift_params *params, - const char *name) { +float parser_get_param_float(struct swift_params *params, const char *name) { char str[PARSER_MAX_LINE_SIZE]; float retParam = 0.f; @@ -548,8 +546,7 @@ float parser_get_param_float(struct swift_params *params, * @param name Name of the parameter to be found * @return Value of the parameter found */ -double parser_get_param_double(struct swift_params *params, - const char *name) { +double parser_get_param_double(struct swift_params *params, const char *name) { char str[PARSER_MAX_LINE_SIZE]; double retParam = 0.; @@ -583,8 +580,8 @@ double parser_get_param_double(struct swift_params *params, * @param name Name of the parameter to be found * @param retParam (return) Value of the parameter found */ -void parser_get_param_string(struct swift_params *params, - const char *name, char *retParam) { +void parser_get_param_string(struct swift_params *params, const char *name, + char *retParam) { for (int i = 0; i < params->paramCount; i++) { if (!strcmp(name, params->data[i].name)) { @@ -606,8 +603,8 @@ void parser_get_param_string(struct swift_params *params, * @param def Default value of the parameter of not found. * @return Value of the parameter found */ -int parser_get_opt_param_int(struct swift_params *params, - const char *name, int def) { +int parser_get_opt_param_int(struct swift_params *params, const char *name, + int def) { char str[PARSER_MAX_LINE_SIZE]; int retParam = 0; @@ -636,7 +633,7 @@ int parser_get_opt_param_int(struct swift_params *params, parser_set_param(params, str); /* Set parameter as used */ - params->data[params->paramCount-1].used = 1; + params->data[params->paramCount - 1].used = 1; return def; } @@ -649,8 +646,8 @@ int parser_get_opt_param_int(struct swift_params *params, * @param def Default value of the parameter of not found. * @return Value of the parameter found */ -char parser_get_opt_param_char(struct swift_params *params, - const char *name, char def) { +char parser_get_opt_param_char(struct swift_params *params, const char *name, + char def) { char str[PARSER_MAX_LINE_SIZE]; char retParam = 0; @@ -679,7 +676,7 @@ char parser_get_opt_param_char(struct swift_params *params, parser_set_param(params, str); /* Set parameter as used */ - params->data[params->paramCount-1].used = 1; + params->data[params->paramCount - 1].used = 1; return def; } @@ -692,8 +689,8 @@ char parser_get_opt_param_char(struct swift_params *params, * @param def Default value of the parameter of not found. * @return Value of the parameter found */ -float parser_get_opt_param_float(struct swift_params *params, - const char *name, float def) { +float parser_get_opt_param_float(struct swift_params *params, const char *name, + float def) { char str[PARSER_MAX_LINE_SIZE]; float retParam = 0.f; @@ -722,7 +719,7 @@ float parser_get_opt_param_float(struct swift_params *params, parser_set_param(params, str); /* Set parameter as used */ - params->data[params->paramCount-1].used = 1; + params->data[params->paramCount - 1].used = 1; return def; } @@ -765,7 +762,7 @@ double parser_get_opt_param_double(struct swift_params *params, parser_set_param(params, str); /* Set parameter as used */ - params->data[params->paramCount-1].used = 1; + params->data[params->paramCount - 1].used = 1; return def; } @@ -778,9 +775,8 @@ double parser_get_opt_param_double(struct swift_params *params, * @param def Default value of the parameter of not found. * @param retParam (return) Value of the parameter found */ -void parser_get_opt_param_string(struct swift_params *params, - const char *name, char *retParam, - const char *def) { +void parser_get_opt_param_string(struct swift_params *params, const char *name, + char *retParam, const char *def) { for (int i = 0; i < params->paramCount; i++) { if (!strcmp(name, params->data[i].name)) { @@ -801,7 +797,7 @@ void parser_get_opt_param_string(struct swift_params *params, parser_set_param(params, str); /* Set parameter as used */ - params->data[params->paramCount-1].used = 1; + params->data[params->paramCount - 1].used = 1; strcpy(retParam, def); } @@ -844,13 +840,13 @@ void parser_write_params_to_file(const struct swift_params *params, for (int i = 0; i < params->paramCount; i++) { if (write_used && !params->data[i].used) { #ifdef SWIFT_DEBUG_CHECKS - message("Parameter `%s` was not used. " - "Only the parameter used are written.", - params->data[i].name); + message( + "Parameter `%s` was not used. " + "Only the parameter used are written.", + params->data[i].name); #endif continue; - } - else if (!write_used && params->data[i].used) + } else if (!write_used && params->data[i].used) continue; /* Check that the parameter name contains a section name. */ if (strchr(params->data[i].name, PARSER_VALUE_CHAR)) { diff --git a/src/parser.h b/src/parser.h index 09e787b9cd..2b06fce03c 100644 --- a/src/parser.h +++ b/src/parser.h @@ -60,30 +60,26 @@ void parser_init(const char *file_name, struct swift_params *params); void parser_read_file(const char *file_name, struct swift_params *params); void parser_print_params(const struct swift_params *params); void parser_write_params_to_file(const struct swift_params *params, - const char *file_name, - int write_all); + const char *file_name, int write_all); void parser_set_param(struct swift_params *params, const char *desc); char parser_get_param_char(struct swift_params *params, const char *name); int parser_get_param_int(struct swift_params *params, const char *name); -float parser_get_param_float(struct swift_params *params, - const char *name); -double parser_get_param_double(struct swift_params *params, - const char *name); -void parser_get_param_string(struct swift_params *params, - const char *name, char *retParam); +float parser_get_param_float(struct swift_params *params, const char *name); +double parser_get_param_double(struct swift_params *params, const char *name); +void parser_get_param_string(struct swift_params *params, const char *name, + char *retParam); -char parser_get_opt_param_char(struct swift_params *params, - const char *name, char def); -int parser_get_opt_param_int(struct swift_params *params, - const char *name, int def); -float parser_get_opt_param_float(struct swift_params *params, - const char *name, float def); +char parser_get_opt_param_char(struct swift_params *params, const char *name, + char def); +int parser_get_opt_param_int(struct swift_params *params, const char *name, + int def); +float parser_get_opt_param_float(struct swift_params *params, const char *name, + float def); double parser_get_opt_param_double(struct swift_params *params, const char *name, double def); -void parser_get_opt_param_string(struct swift_params *params, - const char *name, char *retParam, - const char *def); +void parser_get_opt_param_string(struct swift_params *params, const char *name, + char *retParam, const char *def); #if defined(HAVE_HDF5) void parser_write_params_to_hdf5(const struct swift_params *params, hid_t grp, diff --git a/src/physical_constants.c b/src/physical_constants.c index b0f0df7745..2c0ea6191b 100644 --- a/src/physical_constants.c +++ b/src/physical_constants.c @@ -38,8 +38,7 @@ * @param params The parsed parameter file. * @param internal_const The physical constants to initialize. */ -void phys_const_init(const struct unit_system *us, - struct swift_params *params, +void phys_const_init(const struct unit_system *us, struct swift_params *params, struct phys_const *internal_const) { /* Units are declared as {U_M, U_L, U_t, U_I, U_T} */ diff --git a/src/physical_constants.h b/src/physical_constants.h index 75b79bc0a5..606e7eeb58 100644 --- a/src/physical_constants.h +++ b/src/physical_constants.h @@ -89,8 +89,7 @@ struct phys_const { double const_earth_mass; }; -void phys_const_init(const struct unit_system* us, - struct swift_params* params, +void phys_const_init(const struct unit_system* us, struct swift_params* params, struct phys_const* internal_const); void phys_const_print(const struct phys_const* internal_const); diff --git a/src/potential/disc_patch/potential.h b/src/potential/disc_patch/potential.h index 290f4847e8..40c7473149 100644 --- a/src/potential/disc_patch/potential.h +++ b/src/potential/disc_patch/potential.h @@ -269,9 +269,9 @@ external_gravity_get_potential_energy( * @param potential The external potential properties to initialize */ static INLINE void potential_init_backend( - struct swift_params* parameter_file, - const struct phys_const* phys_const, const struct unit_system* us, - const struct space* s, struct external_potential* potential) { + struct swift_params* parameter_file, const struct phys_const* phys_const, + const struct unit_system* us, const struct space* s, + struct external_potential* potential) { potential->surface_density = parser_get_param_double( parameter_file, "DiscPatchPotential:surface_density"); diff --git a/src/potential/isothermal/potential.h b/src/potential/isothermal/potential.h index a9d3c7d6c3..4267c9becc 100644 --- a/src/potential/isothermal/potential.h +++ b/src/potential/isothermal/potential.h @@ -162,9 +162,9 @@ external_gravity_get_potential_energy( * @param potential The external potential properties to initialize */ static INLINE void potential_init_backend( - struct swift_params* parameter_file, - const struct phys_const* phys_const, const struct unit_system* us, - const struct space* s, struct external_potential* potential) { + struct swift_params* parameter_file, const struct phys_const* phys_const, + const struct unit_system* us, const struct space* s, + struct external_potential* potential) { potential->x = s->dim[0] / 2. + diff --git a/src/potential/none/potential.h b/src/potential/none/potential.h index c96b5e80f1..2303f2531d 100644 --- a/src/potential/none/potential.h +++ b/src/potential/none/potential.h @@ -98,9 +98,9 @@ external_gravity_get_potential_energy( * @param potential The external potential properties to initialize */ static INLINE void potential_init_backend( - struct swift_params* parameter_file, - const struct phys_const* phys_const, const struct unit_system* us, - const struct space* s, struct external_potential* potential) {} + struct swift_params* parameter_file, const struct phys_const* phys_const, + const struct unit_system* us, const struct space* s, + struct external_potential* potential) {} /** * @brief Prints the properties of the external potential to stdout. diff --git a/src/potential/point_mass/potential.h b/src/potential/point_mass/potential.h index 0939adcb07..db875842d5 100644 --- a/src/potential/point_mass/potential.h +++ b/src/potential/point_mass/potential.h @@ -152,9 +152,9 @@ external_gravity_get_potential_energy( * @param potential The external potential properties to initialize */ static INLINE void potential_init_backend( - struct swift_params* parameter_file, - const struct phys_const* phys_const, const struct unit_system* us, - const struct space* s, struct external_potential* potential) { + struct swift_params* parameter_file, const struct phys_const* phys_const, + const struct unit_system* us, const struct space* s, + struct external_potential* potential) { potential->x = parser_get_param_double(parameter_file, "PointMassPotential:position_x"); diff --git a/src/potential/point_mass_ring/potential.h b/src/potential/point_mass_ring/potential.h index 5c38380a23..551efe3252 100644 --- a/src/potential/point_mass_ring/potential.h +++ b/src/potential/point_mass_ring/potential.h @@ -192,9 +192,9 @@ external_gravity_get_potential_energy( * @param potential The external potential properties to initialize */ static INLINE void potential_init_backend( - struct swift_params* parameter_file, - const struct phys_const* phys_const, const struct unit_system* us, - const struct space* s, struct external_potential* potential) { + struct swift_params* parameter_file, const struct phys_const* phys_const, + const struct unit_system* us, const struct space* s, + struct external_potential* potential) { potential->x = parser_get_param_double(parameter_file, "PointMassPotential:position_x"); diff --git a/src/potential/point_mass_softened/potential.h b/src/potential/point_mass_softened/potential.h index 92f0ba1451..80959ec923 100644 --- a/src/potential/point_mass_softened/potential.h +++ b/src/potential/point_mass_softened/potential.h @@ -179,9 +179,9 @@ external_gravity_get_potential_energy( * @param potential The external potential properties to initialize */ static INLINE void potential_init_backend( - struct swift_params* parameter_file, - const struct phys_const* phys_const, const struct unit_system* us, - const struct space* s, struct external_potential* potential) { + struct swift_params* parameter_file, const struct phys_const* phys_const, + const struct unit_system* us, const struct space* s, + struct external_potential* potential) { potential->x = parser_get_param_double(parameter_file, "PointMassPotential:position_x"); diff --git a/src/potential/sine_wave/potential.h b/src/potential/sine_wave/potential.h index 9b72d36c1e..8a1786baaf 100644 --- a/src/potential/sine_wave/potential.h +++ b/src/potential/sine_wave/potential.h @@ -117,9 +117,9 @@ external_gravity_get_potential_energy( * @param potential The external potential properties to initialize */ static INLINE void potential_init_backend( - struct swift_params* parameter_file, - const struct phys_const* phys_const, const struct unit_system* us, - const struct space* s, struct external_potential* potential) { + struct swift_params* parameter_file, const struct phys_const* phys_const, + const struct unit_system* us, const struct space* s, + struct external_potential* potential) { potential->amplitude = parser_get_param_double(parameter_file, "SineWavePotential:amplitude"); diff --git a/src/serial_io.c b/src/serial_io.c index 136097f0e7..4074f9bd54 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -883,8 +883,8 @@ void write_output_serial(struct engine* e, const char* baseName, H5Gclose(h_grp); /* Print the runtime unused parameters */ - h_grp = - H5Gcreate(h_file, "/UnusedParameters", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + h_grp = H5Gcreate(h_file, "/UnusedParameters", H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); if (h_grp < 0) error("Error while creating parameters group"); parser_write_params_to_hdf5(e->parameter_file, h_grp, 0); H5Gclose(h_grp); diff --git a/src/single_io.c b/src/single_io.c index 31aa40b399..975487a1d9 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -736,8 +736,8 @@ void write_output_single(struct engine* e, const char* baseName, H5Gclose(h_grp); /* Print the runtime unused parameters */ - h_grp = - H5Gcreate(h_file, "/UnusedParameters", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + h_grp = H5Gcreate(h_file, "/UnusedParameters", H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); if (h_grp < 0) error("Error while creating parameters group"); parser_write_params_to_hdf5(e->parameter_file, h_grp, 0); H5Gclose(h_grp); diff --git a/src/units.c b/src/units.c index af11d7de40..48f0a3aee6 100644 --- a/src/units.c +++ b/src/units.c @@ -77,8 +77,7 @@ void units_init(struct unit_system* us, double U_M_in_cgs, double U_L_in_cgs, * @param params The parsed parameter file. * @param category The section of the parameter file to read from. */ -void units_init_from_params(struct unit_system* us, - struct swift_params* params, +void units_init_from_params(struct unit_system* us, struct swift_params* params, const char* category) { char buffer[200]; @@ -104,9 +103,8 @@ void units_init_from_params(struct unit_system* us, * @param category The section of the parameter file to read from. * @param def The default unit system to copy from if required. */ -void units_init_default(struct unit_system* us, - struct swift_params* params, const char* category, - const struct unit_system* def) { +void units_init_default(struct unit_system* us, struct swift_params* params, + const char* category, const struct unit_system* def) { if (!def) error("Default unit_system not allocated"); diff --git a/src/units.h b/src/units.h index 1f0ef3cbd7..829a1ce542 100644 --- a/src/units.h +++ b/src/units.h @@ -100,9 +100,8 @@ void units_init(struct unit_system* us, double U_M_in_cgs, double U_L_in_cgs, double U_t_in_cgs, double U_C_in_cgs, double U_T_in_cgs); void units_init_from_params(struct unit_system*, struct swift_params*, const char* category); -void units_init_default(struct unit_system* us, - struct swift_params* params, const char* category, - const struct unit_system* def); +void units_init_default(struct unit_system* us, struct swift_params* params, + const char* category, const struct unit_system* def); int units_are_equal(const struct unit_system* a, const struct unit_system* b); diff --git a/tests/testParser.c b/tests/testParser.c index 9a642fa23d..c50e9b1a54 100644 --- a/tests/testParser.c +++ b/tests/testParser.c @@ -47,7 +47,8 @@ int main(int argc, char *argv[]) { parser_get_param_double(¶m_file, "Simulation:start_time"); const int kernel = parser_get_param_int(¶m_file, "kernel"); - const int optional = parser_get_opt_param_int(¶m_file, "Simulation:optional", 1); + const int optional = + parser_get_opt_param_int(¶m_file, "Simulation:optional", 1); char ic_file[PARSER_MAX_LINE_SIZE]; parser_get_param_string(¶m_file, "IO:ic_file", ic_file); -- GitLab