Commit 80196acc authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting

parent db1ba050
......@@ -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 */
......
......@@ -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 =
......
......@@ -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(
......
......@@ -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.
......
......@@ -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.
......
......@@ -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");
......
......@@ -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");
......
......@@ -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.
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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;
......
......@@ -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,
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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);
......
......@@ -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)) {
......
......@@ -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,
......
......@@ -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} */
......
......@@ -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);
......
......@@ -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");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment