Commit 40ec350d authored by lhausamm's avatar lhausamm
Browse files

Remove const from params

parent edfdc754
......@@ -387,7 +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(const struct swift_params *params,
void cosmology_init(struct swift_params *params,
const struct unit_system *us,
const struct phys_const *phys_const, struct cosmology *c) {
......
......@@ -181,7 +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(const struct swift_params *params,
void cosmology_init(struct swift_params *params,
const struct unit_system *us,
const struct phys_const *phys_const, struct cosmology *c);
......
......@@ -5422,7 +5422,7 @@ void engine_unpin(void) {
* @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,
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,
......@@ -5553,7 +5553,7 @@ void engine_init(struct engine *e, struct space *s,
* @param restart_file The name of our restart file.
*/
void engine_config(int restart, struct engine *e,
const struct swift_params *params, int nr_nodes, int nodeID,
struct swift_params *params, int nr_nodes, int nodeID,
int nr_threads, int with_aff, int verbose,
const char *restart_file) {
......
......@@ -315,7 +315,7 @@ struct engine {
struct sourceterms *sourceterms;
/* The (parsed) parameter file */
const struct swift_params *parameter_file;
struct swift_params *parameter_file;
/* Temporary struct to hold a group of deferable properties (in MPI mode
* these are reduced together, but may not be required just yet). */
......@@ -355,7 +355,7 @@ 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,
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,
......@@ -367,7 +367,7 @@ void engine_init(struct engine *e, struct space *s,
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,
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);
......
......@@ -38,7 +38,7 @@
#define gravity_props_default_rebuild_frequency 0.01f
void gravity_props_init(struct gravity_props *p,
const struct swift_params *params,
struct swift_params *params,
const struct cosmology *cosmo) {
/* Tree updates */
......
......@@ -83,7 +83,7 @@ struct gravity_props {
void gravity_props_print(const struct gravity_props *p);
void gravity_props_init(struct gravity_props *p,
const struct swift_params *params,
struct swift_params *params,
const struct cosmology *cosmo);
void gravity_update(struct gravity_props *p, const struct cosmology *cosmo);
......
......@@ -52,7 +52,7 @@
void hydro_props_init(struct hydro_props *p,
const struct phys_const *phys_const,
const struct unit_system *us,
const struct swift_params *params) {
struct swift_params *params) {
/* Kernel properties */
p->eta_neighbours = parser_get_param_float(params, "SPH:resolution_eta");
......
......@@ -86,7 +86,7 @@ void hydro_props_print(const struct hydro_props *p);
void hydro_props_init(struct hydro_props *p,
const struct phys_const *phys_const,
const struct unit_system *us,
const struct swift_params *params);
struct swift_params *params);
#if defined(HAVE_HDF5)
void hydro_props_print_snapshot(hid_t h_grpsph, const struct hydro_props *p);
......
......@@ -890,7 +890,7 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
const struct xpart* xparts = e->s->xparts;
const struct gpart* gparts = e->s->gparts;
const struct spart* sparts = e->s->sparts;
const struct swift_params* params = e->parameter_file;
struct swift_params* params = e->parameter_file;
FILE* xmfFile = 0;
int periodic = e->s->periodic;
int numFiles = 1;
......@@ -1141,7 +1141,7 @@ void write_output_parallel(struct engine* e, const char* baseName,
struct gpart* dmparts = NULL;
const struct spart* sparts = e->s->sparts;
const struct cooling_function_data* cooling = e->cooling_func;
const struct swift_params* params = e->parameter_file;
struct swift_params* params = e->parameter_file;
/* Number of unassociated gparts */
const size_t Ndm = Ntot > 0 ? Ntot - (Ngas + Nstars) : 0;
......
......@@ -444,11 +444,10 @@ static void parse_section_param(char *line, int *isFirstParam,
* @param name Name of the parameter to be found
* @return Value of the parameter found
*/
int parser_get_param_int(const struct swift_params *params, const char *name) {
int parser_get_param_int(struct swift_params *params, const char *name) {
char str[PARSER_MAX_LINE_SIZE];
int retParam = 0;
struct swift_params *tmp = (struct swift_params*) params;
for (int i = 0; i < params->paramCount; i++) {
if (!strcmp(name, params->data[i].name)) {
......@@ -461,7 +460,7 @@ int parser_get_param_int(const struct swift_params *params, const char *name) {
}
/* this parameter has been used */
tmp->data[i].used = 1;
params->data[i].used = 1;
return retParam;
}
......@@ -479,12 +478,11 @@ int parser_get_param_int(const 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(const struct swift_params *params,
char parser_get_param_char(struct swift_params *params,
const char *name) {
char str[PARSER_MAX_LINE_SIZE];
char retParam = 0;
struct swift_params *tmp = (struct swift_params*) params;
for (int i = 0; i < params->paramCount; i++) {
if (!strcmp(name, params->data[i].name)) {
......@@ -497,7 +495,7 @@ char parser_get_param_char(const struct swift_params *params,
}
/* this parameter has been used */
tmp->data[i].used = 1;
params->data[i].used = 1;
return retParam;
}
......@@ -515,12 +513,11 @@ char parser_get_param_char(const struct swift_params *params,
* @param name Name of the parameter to be found
* @return Value of the parameter found
*/
float parser_get_param_float(const struct swift_params *params,
float parser_get_param_float(struct swift_params *params,
const char *name) {
char str[PARSER_MAX_LINE_SIZE];
float retParam = 0.f;
struct swift_params *tmp = (struct swift_params*) params;
for (int i = 0; i < params->paramCount; i++) {
if (!strcmp(name, params->data[i].name)) {
......@@ -533,7 +530,7 @@ float parser_get_param_float(const struct swift_params *params,
}
/* this parameter has been used */
tmp->data[i].used = 1;
params->data[i].used = 1;
return retParam;
}
......@@ -551,12 +548,11 @@ float parser_get_param_float(const struct swift_params *params,
* @param name Name of the parameter to be found
* @return Value of the parameter found
*/
double parser_get_param_double(const struct swift_params *params,
double parser_get_param_double(struct swift_params *params,
const char *name) {
char str[PARSER_MAX_LINE_SIZE];
double retParam = 0.;
struct swift_params *tmp = (struct swift_params*) params;
for (int i = 0; i < params->paramCount; i++) {
if (!strcmp(name, params->data[i].name)) {
......@@ -569,7 +565,7 @@ double parser_get_param_double(const struct swift_params *params,
}
/* this parameter has been used */
tmp->data[i].used = 1;
params->data[i].used = 1;
return retParam;
}
......@@ -587,14 +583,14 @@ double parser_get_param_double(const 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(const struct swift_params *params,
void parser_get_param_string(struct swift_params *params,
const char *name, char *retParam) {
struct swift_params *tmp = (struct swift_params*) params;
for (int i = 0; i < params->paramCount; i++) {
if (!strcmp(name, params->data[i].name)) {
strcpy(retParam, params->data[i].value);
/* this parameter has been used */
tmp->data[i].used = 1;
params->data[i].used = 1;
return;
}
}
......@@ -610,12 +606,11 @@ void parser_get_param_string(const 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(const struct swift_params *params,
int parser_get_opt_param_int(struct swift_params *params,
const char *name, int def) {
char str[PARSER_MAX_LINE_SIZE];
int retParam = 0;
struct swift_params *tmp = (struct swift_params*) params;
for (int i = 0; i < params->paramCount; i++) {
if (!strcmp(name, params->data[i].name)) {
......@@ -628,7 +623,7 @@ int parser_get_opt_param_int(const struct swift_params *params,
}
/* this parameter has been used */
tmp->data[i].used = 1;
params->data[i].used = 1;
return retParam;
}
......@@ -638,10 +633,10 @@ int parser_get_opt_param_int(const struct swift_params *params,
sprintf(str, "%s: %i", name, def);
/* Add it to params */
parser_set_param(tmp, str);
parser_set_param(params, str);
/* Set parameter as used */
tmp->data[params->paramCount-1].used = 1;
params->data[params->paramCount-1].used = 1;
return def;
}
......@@ -654,12 +649,11 @@ int parser_get_opt_param_int(const 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(const struct swift_params *params,
char parser_get_opt_param_char(struct swift_params *params,
const char *name, char def) {
char str[PARSER_MAX_LINE_SIZE];
char retParam = 0;
struct swift_params *tmp = (struct swift_params*) params;
for (int i = 0; i < params->paramCount; i++) {
if (!strcmp(name, params->data[i].name)) {
......@@ -672,7 +666,7 @@ char parser_get_opt_param_char(const struct swift_params *params,
}
/* this parameter has been used */
tmp->data[i].used = 1;
params->data[i].used = 1;
return retParam;
}
......@@ -682,10 +676,10 @@ char parser_get_opt_param_char(const struct swift_params *params,
sprintf(str, "%s: %c", name, def);
/* Add it to params */
parser_set_param(tmp, str);
parser_set_param(params, str);
/* Set parameter as used */
tmp->data[params->paramCount-1].used = 1;
params->data[params->paramCount-1].used = 1;
return def;
}
......@@ -698,12 +692,11 @@ char parser_get_opt_param_char(const 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(const struct swift_params *params,
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;
struct swift_params *tmp = (struct swift_params*) params;
for (int i = 0; i < params->paramCount; i++) {
if (!strcmp(name, params->data[i].name)) {
......@@ -716,7 +709,7 @@ float parser_get_opt_param_float(const struct swift_params *params,
}
/* this parameter has been used */
tmp->data[i].used = 1;
params->data[i].used = 1;
return retParam;
}
......@@ -726,10 +719,10 @@ float parser_get_opt_param_float(const struct swift_params *params,
sprintf(str, "%s: %f", name, def);
/* Add it to params */
parser_set_param(tmp, str);
parser_set_param(params, str);
/* Set parameter as used */
tmp->data[params->paramCount-1].used = 1;
params->data[params->paramCount-1].used = 1;
return def;
}
......@@ -742,12 +735,11 @@ float parser_get_opt_param_float(const struct swift_params *params,
* @param def Default value of the parameter of not found.
* @return Value of the parameter found
*/
double parser_get_opt_param_double(const struct swift_params *params,
double parser_get_opt_param_double(struct swift_params *params,
const char *name, double def) {
char str[PARSER_MAX_LINE_SIZE];
double retParam = 0.;
struct swift_params *tmp = (struct swift_params*) params;
for (int i = 0; i < params->paramCount; i++) {
if (!strcmp(name, params->data[i].name)) {
......@@ -760,7 +752,7 @@ double parser_get_opt_param_double(const struct swift_params *params,
}
/* this parameter has been used */
tmp->data[i].used = 1;
params->data[i].used = 1;
return retParam;
}
......@@ -770,10 +762,10 @@ double parser_get_opt_param_double(const struct swift_params *params,
sprintf(str, "%s: %lf", name, def);
/* Add it to params */
parser_set_param(tmp, str);
parser_set_param(params, str);
/* Set parameter as used */
tmp->data[params->paramCount-1].used = 1;
params->data[params->paramCount-1].used = 1;
return def;
}
......@@ -786,16 +778,16 @@ double parser_get_opt_param_double(const 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(const struct swift_params *params,
void parser_get_opt_param_string(struct swift_params *params,
const char *name, char *retParam,
const char *def) {
struct swift_params *tmp = (struct swift_params*) params;
for (int i = 0; i < params->paramCount; i++) {
if (!strcmp(name, params->data[i].name)) {
strcpy(retParam, params->data[i].value);
/* this parameter has been used */
tmp->data[i].used = 1;
params->data[i].used = 1;
return;
}
......@@ -806,10 +798,10 @@ void parser_get_opt_param_string(const struct swift_params *params,
sprintf(str, "%s: %s", name, def);
/* Add it to params */
parser_set_param(tmp, str);
parser_set_param(params, str);
/* Set parameter as used */
tmp->data[params->paramCount-1].used = 1;
params->data[params->paramCount-1].used = 1;
strcpy(retParam, def);
}
......
......@@ -64,24 +64,24 @@ void parser_write_params_to_file(const struct swift_params *params,
int write_all);
void parser_set_param(struct swift_params *params, const char *desc);
char parser_get_param_char(const struct swift_params *params, const char *name);
int parser_get_param_int(const struct swift_params *params, const char *name);
float parser_get_param_float(const struct swift_params *params,
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(const struct swift_params *params,
double parser_get_param_double(struct swift_params *params,
const char *name);
void parser_get_param_string(const struct swift_params *params,
void parser_get_param_string(struct swift_params *params,
const char *name, char *retParam);
char parser_get_opt_param_char(const struct swift_params *params,
char parser_get_opt_param_char(struct swift_params *params,
const char *name, char def);
int parser_get_opt_param_int(const struct swift_params *params,
int parser_get_opt_param_int(struct swift_params *params,
const char *name, int def);
float parser_get_opt_param_float(const struct swift_params *params,
float parser_get_opt_param_float(struct swift_params *params,
const char *name, float def);
double parser_get_opt_param_double(const struct swift_params *params,
double parser_get_opt_param_double(struct swift_params *params,
const char *name, double def);
void parser_get_opt_param_string(const struct swift_params *params,
void parser_get_opt_param_string(struct swift_params *params,
const char *name, char *retParam,
const char *def);
......
......@@ -1041,7 +1041,7 @@ void partition_initial_partition(struct partition *initial_partition,
*/
void partition_init(struct partition *partition,
struct repartition *repartition,
const struct swift_params *params, int nr_nodes) {
struct swift_params *params, int nr_nodes) {
#ifdef WITH_MPI
......
......@@ -76,7 +76,7 @@ int partition_space_to_space(double *oldh, double *oldcdim, int *oldnodeID,
struct space *s);
void partition_init(struct partition *partition,
struct repartition *repartition,
const struct swift_params *params, int nr_nodes);
struct swift_params *params, int nr_nodes);
/* Dump/restore. */
void partition_store_celllist(struct space *s, struct repartition *reparttype);
......
......@@ -39,7 +39,7 @@
* @param internal_const The physical constants to initialize.
*/
void phys_const_init(const struct unit_system *us,
const struct swift_params *params,
struct swift_params *params,
struct phys_const *internal_const) {
/* Units are declared as {U_M, U_L, U_t, U_I, U_T} */
......
......@@ -90,7 +90,7 @@ struct phys_const {
};
void phys_const_init(const struct unit_system* us,
const struct swift_params* params,
struct swift_params* params,
struct phys_const* internal_const);
void phys_const_print(const struct phys_const* internal_const);
......
......@@ -733,7 +733,7 @@ void write_output_serial(struct engine* e, const char* baseName,
struct gpart* dmparts = NULL;
const struct spart* sparts = e->s->sparts;
const struct cooling_function_data* cooling = e->cooling_func;
const struct swift_params* params = e->parameter_file;
struct swift_params* params = e->parameter_file;
FILE* xmfFile = 0;
/* Number of unassociated gparts */
......
......@@ -600,7 +600,7 @@ void write_output_single(struct engine* e, const char* baseName,
struct gpart* dmparts = NULL;
const struct spart* sparts = e->s->sparts;
const struct cooling_function_data* cooling = e->cooling_func;
const struct swift_params* params = e->parameter_file;
struct swift_params* params = e->parameter_file;
/* Number of unassociated gparts */
const size_t Ndm = Ntot > 0 ? Ntot - (Ngas + Nstars) : 0;
......
......@@ -2641,7 +2641,7 @@ void space_convert_quantities(struct space *s, int verbose) {
* parts with a cutoff below half the cell width are then split
* recursively.
*/
void space_init(struct space *s, const struct swift_params *params,
void space_init(struct space *s, struct swift_params *params,
const struct cosmology *cosmo, double dim[3],
struct part *parts, struct gpart *gparts, struct spart *sparts,
size_t Npart, size_t Ngpart, size_t Nspart, int periodic,
......
......@@ -200,7 +200,7 @@ void space_gparts_sort(struct gpart *gparts, struct part *parts,
void space_sparts_sort(struct spart *sparts, int *ind, int *counts,
int num_bins, ptrdiff_t sparts_offset);
void space_getcells(struct space *s, int nr_cells, struct cell **cells);
void space_init(struct space *s, const struct swift_params *params,
void space_init(struct space *s, struct swift_params *params,
const struct cosmology *cosmo, double dim[3],
struct part *parts, struct gpart *gparts, struct spart *sparts,
size_t Npart, size_t Ngpart, size_t Nspart, int periodic,
......
......@@ -78,7 +78,7 @@ void units_init(struct unit_system* us, double U_M_in_cgs, double U_L_in_cgs,
* @param category The section of the parameter file to read from.
*/
void units_init_from_params(struct unit_system* us,
const struct swift_params* params,
struct swift_params* params,
const char* category) {
char buffer[200];
......@@ -105,7 +105,7 @@ void units_init_from_params(struct unit_system* us,
* @param def The default unit system to copy from if required.
*/
void units_init_default(struct unit_system* us,
const struct swift_params* params, const char* category,
struct swift_params* params, const char* category,
const struct unit_system* def) {
if (!def) error("Default unit_system not allocated");
......
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