diff --git a/examples/main.c b/examples/main.c index 87891ed14da81bd0e5e7cb76a5c8f41709a38666..e8577a353c8a4de48e26064c7dbd324feffe6119 100644 --- a/examples/main.c +++ b/examples/main.c @@ -309,7 +309,9 @@ int main(int argc, char *argv[]) { #ifdef HAVE_VELOCIRAPTOR with_structure_finding = 1; #else - error("Error: (-x) needs to have the code compiled with VELOCIraptor linked in."); + error( + "Error: (-x) needs to have the code compiled with VELOCIraptor " + "linked in."); #endif break; case 'y': @@ -492,15 +494,17 @@ int main(int argc, char *argv[]) { if (access(dirp, W_OK | X_OK) != 0) { error("Cannot write snapshots in directory %s (%s)", dirp, strerror(errno)); } - - /* Check that we can write the structure finding catalogues by testing if the output + + /* Check that we can write the structure finding catalogues by testing if the + * output * directory exists and is searchable and writable. */ - if(with_structure_finding) { + if (with_structure_finding) { char stfbasename[PARSER_MAX_LINE_SIZE]; parser_get_param_string(params, "StructureFinding:basename", stfbasename); const char *stfdirp = dirname(stfbasename); if (access(stfdirp, W_OK | X_OK) != 0) { - error("Cannot write stf catalogues in directory %s (%s)", stfdirp, strerror(errno)); + error("Cannot write stf catalogues in directory %s (%s)", stfdirp, + strerror(errno)); } } @@ -722,8 +726,7 @@ int main(int argc, char *argv[]) { #endif #if defined(WITH_MPI) && defined(HAVE_VELOCIRAPTOR) - if(with_structure_finding) - error("VEOCIraptor not yet enabled over MPI."); + if (with_structure_finding) error("VEOCIraptor not yet enabled over MPI."); #endif #ifdef SWIFT_DEBUG_CHECKS @@ -866,7 +869,8 @@ int main(int argc, char *argv[]) { if (with_cooling) engine_policies |= engine_policy_cooling; if (with_sourceterms) engine_policies |= engine_policy_sourceterms; if (with_stars) engine_policies |= engine_policy_stars; - if (with_structure_finding) engine_policies |= engine_policy_structure_finding; + if (with_structure_finding) + engine_policies |= engine_policy_structure_finding; /* Initialize the engine with the space and policies. */ if (myrank == 0) clocks_gettime(&tic); @@ -938,10 +942,9 @@ int main(int argc, char *argv[]) { /* Write the state of the system before starting time integration. */ engine_dump_snapshot(&e); engine_print_stats(&e); - - /* Call VELOCIraptor for the first time after the first snapshot dump. */ - //if (e.policy & engine_policy_structure_finding) velociraptor_invoke(&e); + /* Call VELOCIraptor for the first time after the first snapshot dump. */ + // if (e.policy & engine_policy_structure_finding) velociraptor_invoke(&e); } /* Legend */ @@ -1122,11 +1125,12 @@ int main(int argc, char *argv[]) { e.wallclock_time, e.step_props); fflush(stdout); - fprintf(e.file_timesteps, - " %6d %14e %14e %10.5f %14e %4d %4d %12lld %12lld %12lld %21.3f %6d\n", - e.step, e.time, e.cosmology->a, e.cosmology->z, e.time_step, e.min_active_bin, - e.max_active_bin, e.updates, e.g_updates, e.s_updates, - e.wallclock_time, e.step_props); + fprintf( + e.file_timesteps, + " %6d %14e %14e %10.5f %14e %4d %4d %12lld %12lld %12lld %21.3f %6d\n", + e.step, e.time, e.cosmology->a, e.cosmology->z, e.time_step, + e.min_active_bin, e.max_active_bin, e.updates, e.g_updates, e.s_updates, + e.wallclock_time, e.step_props); fflush(e.file_timesteps); } diff --git a/src/common_io.h b/src/common_io.h index fc391b4726224022a6943c3a5cfc337ede22e4de..152b40a8d7c931b3398f4f04d3a61e9cf7f1836c 100644 --- a/src/common_io.h +++ b/src/common_io.h @@ -60,10 +60,7 @@ enum IO_DATA_TYPE { * @brief The different formats for when to run structure finding. * */ -enum IO_STF_OUTPUT_FORMAT { - STEPS = 0, - TIME -}; +enum IO_STF_OUTPUT_FORMAT { STEPS = 0, TIME }; #if defined(HAVE_HDF5) diff --git a/src/engine.c b/src/engine.c index 66acc6b3ee41635c7da08c0614ac99712c07b1af..369dba72b4c9edac550a5726caba4c8311e3ccb0 100644 --- a/src/engine.c +++ b/src/engine.c @@ -84,8 +84,8 @@ #include "timers.h" #include "tools.h" #include "units.h" -#include "version.h" #include "velociraptor_interface.h" +#include "version.h" /* Particle cache size. */ #define CACHE_SIZE 512 @@ -2667,11 +2667,9 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements, if (t_subtype == task_subtype_density) { engine_addlink(e, &ci->density, t); - } - else if (t_subtype == task_subtype_grav) { + } else if (t_subtype == task_subtype_grav) { engine_addlink(e, &ci->grav, t); - } - else if (t_subtype == task_subtype_external_grav) { + } else if (t_subtype == task_subtype_external_grav) { engine_addlink(e, &ci->grav, t); } @@ -2683,8 +2681,7 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements, if (t_subtype == task_subtype_density) { engine_addlink(e, &ci->density, t); engine_addlink(e, &cj->density, t); - } - else if (t_subtype == task_subtype_grav) { + } else if (t_subtype == task_subtype_grav) { engine_addlink(e, &ci->grav, t); engine_addlink(e, &cj->grav, t); } @@ -2700,11 +2697,9 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements, if (t_subtype == task_subtype_density) { engine_addlink(e, &ci->density, t); - } - else if (t_subtype == task_subtype_grav) { + } else if (t_subtype == task_subtype_grav) { engine_addlink(e, &ci->grav, t); - } - else if (t_subtype == task_subtype_external_grav) { + } else if (t_subtype == task_subtype_external_grav) { engine_addlink(e, &ci->grav, t); } @@ -2716,8 +2711,7 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements, if (t_subtype == task_subtype_density) { engine_addlink(e, &ci->density, t); engine_addlink(e, &cj->density, t); - } - else if (t_subtype == task_subtype_grav) { + } else if (t_subtype == task_subtype_grav) { engine_addlink(e, &ci->grav, t); engine_addlink(e, &cj->grav, t); } @@ -4720,24 +4714,24 @@ void engine_step(struct engine *e) { /* Print some information to the screen */ printf( - " %6d %14e %14e %10.5f %14e %4d %4d %12lld %12lld %12lld %21.3f %6d\n", + " %6d %14e %14e %10.5f %14e %4d %4d %12lld %12lld %12lld %21.3f %6d\n", e->step, e->time, e->cosmology->a, e->cosmology->z, e->time_step, e->min_active_bin, e->max_active_bin, e->updates, e->g_updates, e->s_updates, e->wallclock_time, e->step_props); fflush(stdout); - if(!e->restarting) + if (!e->restarting) fprintf(e->file_timesteps, - " %6d %14e %14e %10.5f %14e %4d %4d %12lld %12lld %12lld %21.3f %6d\n", - e->step, e->time, e->cosmology->a, e->cosmology->z, e->time_step, e->min_active_bin, - e->max_active_bin, e->updates, e->g_updates, e->s_updates, - e->wallclock_time, e->step_props); + " %6d %14e %14e %10.5f %14e %4d %4d %12lld %12lld %12lld %21.3f " + "%6d\n", + e->step, e->time, e->cosmology->a, e->cosmology->z, e->time_step, + e->min_active_bin, e->max_active_bin, e->updates, e->g_updates, + e->s_updates, e->wallclock_time, e->step_props); fflush(e->file_timesteps); } /* We need some cells to exist but not the whole task stuff. */ - if(e->restarting) - space_rebuild(e->s, e->verbose); + if (e->restarting) space_rebuild(e->s, e->verbose); /* Move forward in time */ e->ti_old = e->ti_current; @@ -4748,8 +4742,7 @@ void engine_step(struct engine *e) { e->step_props = engine_step_prop_none; /* When restarting, move everyone to the current time. */ - if(e->restarting) - engine_drift_all(e); + if (e->restarting) engine_drift_all(e); /* Get the physical value of the time and time-step size */ if (e->policy & engine_policy_cosmology) { @@ -4864,9 +4857,10 @@ void engine_step(struct engine *e) { /* Do we want to perform structure finding? */ int run_stf = 0; if ((e->policy & engine_policy_structure_finding)) { - if(e->stf_output_freq_format == STEPS && e->step % e->deltaStepSTF == 0) + if (e->stf_output_freq_format == STEPS && e->step % e->deltaStepSTF == 0) run_stf = 1; - else if(e->stf_output_freq_format == TIME && e->ti_end_min >= e->ti_nextSTF && e->ti_nextSTF > 0) + else if (e->stf_output_freq_format == TIME && + e->ti_end_min >= e->ti_nextSTF && e->ti_nextSTF > 0) run_stf = 1; } @@ -4988,12 +4982,13 @@ void engine_step(struct engine *e) { /* Perform structure finding? */ if (run_stf) { - // MATTHIEU: Add a drift_all here. And check the order with the order i/o options. + // MATTHIEU: Add a drift_all here. And check the order with the order i/o + // options. velociraptor_invoke(e); - + /* ... and find the next output time */ - if(e->stf_output_freq_format == TIME) engine_compute_next_stf_time(e); + if (e->stf_output_freq_format == TIME) engine_compute_next_stf_time(e); } /* Restore the information we stored */ @@ -5034,8 +5029,7 @@ void engine_dump_restarts(struct engine *e, int drifted_all, int force) { #endif if (dump) { - if(e->nodeID == 0) - message("Writing restart files"); + if (e->nodeID == 0) message("Writing restart files"); /* Clean out the previous saved files, if found. Do this now as we are * MPI synchronized. */ @@ -5889,18 +5883,25 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, /* Initialise VELOCIraptor. */ if (e->policy & engine_policy_structure_finding) { - parser_get_param_string(params, "StructureFinding:basename", e->stfBaseName); - e->timeFirstSTFOutput = parser_get_param_double(params, "StructureFinding:time_first"); - e->a_first_stf = parser_get_opt_param_double(params, "StructureFinding:scale_factor_first", 0.1); - //velociraptor_init(e); - e->stf_output_freq_format = parser_get_param_int(params, "StructureFinding:output_time_format"); - if(e->stf_output_freq_format == STEPS) { - e->deltaStepSTF = parser_get_param_int(params, "StructureFinding:delta_step"); - } - else if(e->stf_output_freq_format == TIME) { - e->deltaTimeSTF = parser_get_param_double(params, "StructureFinding:delta_time"); - } - else error("Invalid flag (%d) set for output time format of structure finding.", e->stf_output_freq_format); + parser_get_param_string(params, "StructureFinding:basename", + e->stfBaseName); + e->timeFirstSTFOutput = + parser_get_param_double(params, "StructureFinding:time_first"); + e->a_first_stf = parser_get_opt_param_double( + params, "StructureFinding:scale_factor_first", 0.1); + // velociraptor_init(e); + e->stf_output_freq_format = + parser_get_param_int(params, "StructureFinding:output_time_format"); + if (e->stf_output_freq_format == STEPS) { + e->deltaStepSTF = + parser_get_param_int(params, "StructureFinding:delta_step"); + } else if (e->stf_output_freq_format == TIME) { + e->deltaTimeSTF = + parser_get_param_double(params, "StructureFinding:delta_time"); + } else + error( + "Invalid flag (%d) set for output time format of structure finding.", + e->stf_output_freq_format); } /* Get the number of queues */ @@ -6100,10 +6101,10 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, engine_step_prop_snapshot, engine_step_prop_restarts); fprintf(e->file_timesteps, - "# %6s %14s %14s %10s %14s %9s %12s %12s %12s %16s [%s] %6s\n", "Step", - "Time", "Scale-factor", "Redshift", "Time-step", "Time-bins", "Updates", - "g-Updates", "s-Updates", "Wall-clock time", clocks_getunit(), - "Props"); + "# %6s %14s %14s %10s %14s %9s %12s %12s %12s %16s [%s] %6s\n", + "Step", "Time", "Scale-factor", "Redshift", "Time-step", + "Time-bins", "Updates", "g-Updates", "s-Updates", + "Wall-clock time", clocks_getunit(), "Props"); fflush(e->file_timesteps); } } @@ -6168,7 +6169,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, if (e->delta_time_statistics <= 1.) error("Time between statistics (%e) must be > 1.", e->delta_time_statistics); - + if (e->a_first_snapshot < e->cosmology->a_begin) error( "Scale-factor of first snapshot (%e) must be after the simulation " @@ -6180,15 +6181,17 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, "Scale-factor of first stats output (%e) must be after the " "simulation start a=%e.", e->a_first_statistics, e->cosmology->a_begin); - - if ((e->policy & engine_policy_structure_finding) && (e->stf_output_freq_format == TIME)) { - + + if ((e->policy & engine_policy_structure_finding) && + (e->stf_output_freq_format == TIME)) { + if (e->deltaTimeSTF <= 1.) error("Time between STF (%e) must be > 1.", e->deltaTimeSTF); if (e->a_first_stf < e->cosmology->a_begin) error( - "Scale-factor of first stf output (%e) must be after the simulation " + "Scale-factor of first stf output (%e) must be after the " + "simulation " "start a=%e.", e->a_first_stf, e->cosmology->a_begin); } @@ -6200,7 +6203,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, if (e->delta_time_statistics <= 0.) error("Time between statistics (%e) must be positive.", - e->delta_time_statistics); + e->delta_time_statistics); /* Find the time of the first output */ if (e->time_first_snapshot < e->time_begin) @@ -6215,22 +6218,21 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, "t=%e.", e->time_first_statistics, e->time_begin); - if ((e->policy & engine_policy_structure_finding) && (e->stf_output_freq_format == TIME)) { + if ((e->policy & engine_policy_structure_finding) && + (e->stf_output_freq_format == TIME)) { if (e->deltaTimeSTF <= 0.) - error("Time between STF (%e) must be positive.", - e->deltaTimeSTF); + error("Time between STF (%e) must be positive.", e->deltaTimeSTF); if (e->timeFirstSTFOutput < e->time_begin) - error( - "Time of first STF (%e) must be after the simulation start t=%e.", - e->timeFirstSTFOutput, e->time_begin); + error("Time of first STF (%e) must be after the simulation start t=%e.", + e->timeFirstSTFOutput, e->time_begin); } } if (e->policy & engine_policy_structure_finding) { /* Find the time of the first stf output */ - if(e->stf_output_freq_format == TIME) { + if (e->stf_output_freq_format == TIME) { engine_compute_next_stf_time(e); message("Next STF step will be: %lld", e->ti_nextSTF); } @@ -6561,7 +6563,7 @@ void engine_compute_next_stf_time(struct engine *e) { /* Find next snasphot above current time */ double time = e->timeFirstSTFOutput; - + while (time < time_end) { /* Output time on the integer timeline */ diff --git a/src/engine.h b/src/engine.h index 9e44ab3a732a490104db48925904bb5629c6334d..a0cd9eab3587e6460f16a3976042b9246dde67f6 100644 --- a/src/engine.h +++ b/src/engine.h @@ -206,7 +206,7 @@ struct engine { /* The internal system of units */ const struct unit_system *internal_units; - + /* Top-level cell locations for VELOCIraptor. */ struct cell_loc *cell_loc; @@ -230,10 +230,10 @@ struct engine { double timeFirstSTFOutput; double deltaTimeSTF; int deltaStepSTF; - + /* Integer time of the next stf output */ integertime_t ti_nextSTF; - + char stfBaseName[PARSER_MAX_LINE_SIZE]; /* Statistics information */ diff --git a/src/gravity.c b/src/gravity.c index 24aa7f56b9a950227b04a92dde1ec5d9af4a84ed..1f88490b57d944fc69e7b2e07dcad39294dba732 100644 --- a/src/gravity.c +++ b/src/gravity.c @@ -690,7 +690,8 @@ void gravity_exact_force_check(struct space *s, const struct engine *e, "%18lld %16.8e %16.8e %16.8e %16.8e %16.8e %16.8e %16.8e %16.8e " "%16.8e %16.8e %16.8e\n", id, gpi->x[0], gpi->x[1], gpi->x[2], gpi->a_grav[0], - gpi->a_grav[1], gpi->a_grav[2], gpi->potential, gpi->a_grav_PM[0], + gpi->a_grav[1], gpi->a_grav[2], + gravity_get_comoving_potential(gpi), gpi->a_grav_PM[0], gpi->a_grav_PM[1], gpi->a_grav_PM[2], gpi->potential_PM); } } diff --git a/src/parser.c b/src/parser.c index 17f6c9f0a7be4c379f1bc58a9e4982af5e829563..d804be507e81ca265b31a6a2699d4f0b998f7c3b 100644 --- a/src/parser.c +++ b/src/parser.c @@ -524,36 +524,39 @@ static void parse_section_param(char *line, int *isFirstParam, // Retrieve parameter value from structure. TYPE is the data type, float, int // etc. FMT the format required for that data type, i.e. %f, %d etc. and DESC // a one word description of the type, "float", "int" etc. -#define PARSER_GET_VALUE(TYPE, FMT, DESC) \ - static int get_param_##TYPE(struct swift_params *params, const char *name, \ - TYPE *def, TYPE *result) { \ - char str[PARSER_MAX_LINE_SIZE]; \ - for (int i = 0; i < params->paramCount; i++) { \ - if (strcmp(name, params->data[i].name) == 0) { \ - /* Check that exactly one number is parsed, capture junk. */ \ - if (sscanf(params->data[i].value, " " FMT "%s ", result, str) != 1) { \ - error("Tried parsing " DESC \ - " '%s' but found '%s' with " \ - "illegal trailing characters '%s'.", \ - params->data[i].name, params->data[i].value, str); \ - } \ - /* Ensure same behavior if called multiple times for same parameter */\ - if (params->data[i].is_default && def == NULL) \ - error("Tried parsing %s again but cannot parse a default " \ - "parameter as mandatory", name); \ - if (params->data[i].is_default && *def != *result) \ - error("Tried parsing %s again but cannot parse a parameter with " \ - "two different default value (" FMT "!=" FMT ")", \ - name, *def, *result); \ - /* This parameter has been used */ \ - params->data[i].used = 1; \ - return 1; \ - } \ - } \ - if (def == NULL) \ - error("Cannot find '%s' in the structure, in file '%s'.", name, \ - params->fileName); \ - return 0; \ +#define PARSER_GET_VALUE(TYPE, FMT, DESC) \ + static int get_param_##TYPE(struct swift_params *params, const char *name, \ + TYPE *def, TYPE *result) { \ + char str[PARSER_MAX_LINE_SIZE]; \ + for (int i = 0; i < params->paramCount; i++) { \ + if (strcmp(name, params->data[i].name) == 0) { \ + /* Check that exactly one number is parsed, capture junk. */ \ + if (sscanf(params->data[i].value, " " FMT "%s ", result, str) != 1) { \ + error("Tried parsing " DESC \ + " '%s' but found '%s' with " \ + "illegal trailing characters '%s'.", \ + params->data[i].name, params->data[i].value, str); \ + } \ + /* Ensure same behavior if called multiple times for same parameter */ \ + if (params->data[i].is_default && def == NULL) \ + error( \ + "Tried parsing %s again but cannot parse a default " \ + "parameter as mandatory", \ + name); \ + if (params->data[i].is_default && *def != *result) \ + error( \ + "Tried parsing %s again but cannot parse a parameter with " \ + "two different default value (" FMT "!=" FMT ")", \ + name, *def, *result); \ + /* This parameter has been used */ \ + params->data[i].used = 1; \ + return 1; \ + } \ + } \ + if (def == NULL) \ + error("Cannot find '%s' in the structure, in file '%s'.", name, \ + params->fileName); \ + return 0; \ } // Set a parameter to a value and save for dumping. @@ -564,7 +567,7 @@ static void parse_section_param(char *line, int *isFirstParam, sprintf(str, "%s: " FMT, name, value); \ parser_set_param(params, str); \ params->data[params->paramCount - 1].used = 1; \ - params->data[params->paramCount - 1].is_default = 0; \ + params->data[params->paramCount - 1].is_default = 0; \ } /* Instantiations. */ @@ -643,8 +646,10 @@ void parser_get_param_string(struct swift_params *params, const char *name, for (int i = 0; i < params->paramCount; i++) { if (!strcmp(name, params->data[i].name)) { if (params->data[i].is_default) - error("Tried parsing %s again but cannot parse a " - "default parameter as mandatory", name); + error( + "Tried parsing %s again but cannot parse a " + "default parameter as mandatory", + name); strcpy(retParam, params->data[i].value); /* this parameter has been used */ params->data[i].used = 1; @@ -740,9 +745,10 @@ void parser_get_opt_param_string(struct swift_params *params, const char *name, /* Ensure same behavior if called multiple times for same parameter */ if (params->data[i].is_default && !strcmp(def, retParam)) - error("Tried parsing %s again but cannot parse a parameter with " - "two different default value ('%s' != '%s')", - name, def, retParam); + error( + "Tried parsing %s again but cannot parse a parameter with " + "two different default value ('%s' != '%s')", + name, def, retParam); /* this parameter has been used */ params->data[i].used = 1; return; @@ -768,9 +774,11 @@ void parser_get_opt_param_string(struct swift_params *params, const char *name, \ for (int i = 0; i < params->paramCount; i++) { \ if (!strcmp(name, params->data[i].name)) { \ - if (params->data[i].is_default && required) \ - error("Tried parsing %s again but cannot parse a default " \ - "parameter as mandatory", name); \ + if (params->data[i].is_default && required) \ + error( \ + "Tried parsing %s again but cannot parse a default " \ + "parameter as mandatory", \ + name); \ char *cp = cpy; \ strcpy(cp, params->data[i].value); \ cp = trim_both(cp); \ @@ -789,19 +797,21 @@ void parser_get_opt_param_string(struct swift_params *params, const char *name, * internal whitespace variations. */ \ char *p = strtok(cp, ","); \ for (int k = 0; k < nval; k++) { \ - if (p != NULL) { \ - TYPE tmp_value; \ - if (sscanf(p, fmt, &tmp_value, str) != 1) { \ + if (p != NULL) { \ + TYPE tmp_value; \ + if (sscanf(p, fmt, &tmp_value, str) != 1) { \ error("Tried parsing " DESC \ " '%s' but found '%s' with " \ "illegal " DESC " characters '%s'.", \ name, p, str); \ - } \ - if (params->data[i].is_default && tmp_value != values[k]) \ - error("Tried parsing %s again but cannot parse a " \ - "parameter with two different default value " \ - "(" FMT "!=" FMT ")", name, tmp_value, values[k]);\ - values[k] = tmp_value; \ + } \ + if (params->data[i].is_default && tmp_value != values[k]) \ + error( \ + "Tried parsing %s again but cannot parse a " \ + "parameter with two different default value " \ + "(" FMT "!=" FMT ")", \ + name, tmp_value, values[k]); \ + values[k] = tmp_value; \ } else { \ error( \ "Array '%s' with value '%s' has too few values, " \ @@ -832,7 +842,7 @@ void parser_get_opt_param_string(struct swift_params *params, const char *name, sprintf(&str[k], FMT "]", values[nval - 1]); \ parser_set_param(params, str); \ params->data[params->paramCount - 1].used = 1; \ - params->data[params->paramCount - 1].is_default = 0; \ + params->data[params->paramCount - 1].is_default = 0; \ return 0; \ } diff --git a/src/runner_doiact_grav.h b/src/runner_doiact_grav.h index 142601a2181432b039fec8242471dcb4edc5f93a..dcc3265f34e405a1a414085851ce8d30b9cd3d3d 100644 --- a/src/runner_doiact_grav.h +++ b/src/runner_doiact_grav.h @@ -1474,8 +1474,9 @@ static INLINE void runner_doself_recursive_grav(struct runner *r, * @param ci The first #cell. * @param cj The second #cell. */ -static INLINE void runner_dopair_grav_mm_symmetric(struct runner *r, struct cell *ci, - struct cell *cj) { +static INLINE void runner_dopair_grav_mm_symmetric(struct runner *r, + struct cell *ci, + struct cell *cj) { const struct engine *e = r->e; diff --git a/src/swift_vel_part.h b/src/swift_vel_part.h index f1225201755a743b821810564ef204139399f8f1..80ee94ba612299dbe8b451cf1ef9d0ee45f8bf53 100644 --- a/src/swift_vel_part.h +++ b/src/swift_vel_part.h @@ -42,7 +42,6 @@ struct swift_vel_part { /*! Type of the #gpart (DM, gas, star, ...) */ enum part_type type; - }; #endif /* SWIFT_VELOCIRAPTOR_PART_H */ diff --git a/src/velociraptor_interface.c b/src/velociraptor_interface.c index f16d7df896f5463c7fdf7d87895d9f394391a9d4..7fb7117976acd1d6b558a56a144ff9d3d29dac80 100644 --- a/src/velociraptor_interface.c +++ b/src/velociraptor_interface.c @@ -31,7 +31,8 @@ #include "common_io.h" /** - * @brief Initialise VELOCIraptor with input and output file names along with cosmological info needed to run. + * @brief Initialise VELOCIraptor with input and output file names along with + * cosmological info needed to run. * * @param e The #engine. * @@ -39,100 +40,115 @@ void velociraptor_init(struct engine *e) { #ifdef HAVE_VELOCIRAPTOR - struct space *s = e->s; - struct cosmoinfo cosmo_info; - struct unitinfo unit_info; - struct siminfo sim_info; - - /* Set cosmological constants. */ - cosmo_info.atime = e->cosmology->a; - cosmo_info.littleh = e->cosmology->h; - cosmo_info.Omega_m = e->cosmology->Omega_m; - cosmo_info.Omega_b = e->cosmology->Omega_b; - cosmo_info.Omega_Lambda = e->cosmology->Omega_lambda; - cosmo_info.Omega_cdm = e->cosmology->Omega_m - e->cosmology->Omega_b; - cosmo_info.w_de = e->cosmology->w; - - message("Scale factor: %e", cosmo_info.atime); - message("Little h: %e", cosmo_info.littleh); - message("Omega_m: %e", cosmo_info.Omega_m); - message("Omega_b: %e", cosmo_info.Omega_b); - message("Omega_Lambda: %e", cosmo_info.Omega_Lambda); - message("Omega_cdm: %e", cosmo_info.Omega_cdm); - message("w_de: %e", cosmo_info.w_de); - - /* Set unit conversions. */ - unit_info.lengthtokpc = 1.0; - unit_info.velocitytokms = 1.0; - unit_info.masstosolarmass = 1.0; - unit_info.energyperunitmass = 1.0; - unit_info.gravity = e->physical_constants->const_newton_G; - unit_info.hubbleunit = e->cosmology->H; /* TODO: double check this. */ - - message("Length conversion factor: %e", unit_info.lengthtokpc); - message("Velocity conversion factor: %e", unit_info.velocitytokms); - message("Mass conversion factor: %e", unit_info.masstosolarmass); - message("Potential conversion factor: %e", unit_info.energyperunitmass); - message("G: %e", unit_info.gravity); - message("H: %e", unit_info.hubbleunit); - - /* TODO: Find the total number of DM particles when running with star particles and BHs. */ - const int total_nr_dmparts = e->total_nr_gparts - e->total_nr_parts; - - /* Set simulation information. */ - if(e->s->periodic) { - sim_info.period = unit_info.lengthtokpc * s->dim[0]; /* Physical size of box in VELOCIraptor units (kpc). */ - } - else sim_info.period = 0.0; - sim_info.zoomhigresolutionmass = -1.0; /* Placeholder. */ - sim_info.interparticlespacing = sim_info.period / cbrt(total_nr_dmparts); - if(e->policy & engine_policy_cosmology) sim_info.icosmologicalsim = 1; - else sim_info.icosmologicalsim = 0; - sim_info.spacedimension[0] = unit_info.lengthtokpc * s->dim[0]; - sim_info.spacedimension[1] = unit_info.lengthtokpc * s->dim[1]; - sim_info.spacedimension[2] = unit_info.lengthtokpc * s->dim[2]; - sim_info.numcells = s->nr_cells; - - sim_info.cellwidth[0] = unit_info.lengthtokpc * s->cells_top[0].width[0]; - sim_info.cellwidth[1] = unit_info.lengthtokpc * s->cells_top[0].width[1]; - sim_info.cellwidth[2] = unit_info.lengthtokpc * s->cells_top[0].width[2]; - - sim_info.icellwidth[0] = s->iwidth[0] / unit_info.lengthtokpc; - sim_info.icellwidth[1] = s->iwidth[1] / unit_info.lengthtokpc; - sim_info.icellwidth[2] = s->iwidth[2] / unit_info.lengthtokpc; - - /* Allocate and populate top-level cell locations. */ - if (posix_memalign((void **)&(e->cell_loc), 32, - s->nr_cells * sizeof(struct cell_loc)) != 0) - error("Failed to allocate top-level cell locations for VELOCIraptor."); - - for(int i=0; i<s->nr_cells; i++) { - e->cell_loc[i].loc[0] = unit_info.lengthtokpc * s->cells_top[i].loc[0]; - e->cell_loc[i].loc[1] = unit_info.lengthtokpc * s->cells_top[i].loc[1]; - e->cell_loc[i].loc[2] = unit_info.lengthtokpc * s->cells_top[i].loc[2]; - } + struct space *s = e->s; + struct cosmoinfo cosmo_info; + struct unitinfo unit_info; + struct siminfo sim_info; + + /* Set cosmological constants. */ + cosmo_info.atime = e->cosmology->a; + cosmo_info.littleh = e->cosmology->h; + cosmo_info.Omega_m = e->cosmology->Omega_m; + cosmo_info.Omega_b = e->cosmology->Omega_b; + cosmo_info.Omega_Lambda = e->cosmology->Omega_lambda; + cosmo_info.Omega_cdm = e->cosmology->Omega_m - e->cosmology->Omega_b; + cosmo_info.w_de = e->cosmology->w; + + message("Scale factor: %e", cosmo_info.atime); + message("Little h: %e", cosmo_info.littleh); + message("Omega_m: %e", cosmo_info.Omega_m); + message("Omega_b: %e", cosmo_info.Omega_b); + message("Omega_Lambda: %e", cosmo_info.Omega_Lambda); + message("Omega_cdm: %e", cosmo_info.Omega_cdm); + message("w_de: %e", cosmo_info.w_de); + + /* Set unit conversions. */ + unit_info.lengthtokpc = 1.0; + unit_info.velocitytokms = 1.0; + unit_info.masstosolarmass = 1.0; + unit_info.energyperunitmass = 1.0; + unit_info.gravity = e->physical_constants->const_newton_G; + unit_info.hubbleunit = e->cosmology->H; /* TODO: double check this. */ + + message("Length conversion factor: %e", unit_info.lengthtokpc); + message("Velocity conversion factor: %e", unit_info.velocitytokms); + message("Mass conversion factor: %e", unit_info.masstosolarmass); + message("Potential conversion factor: %e", unit_info.energyperunitmass); + message("G: %e", unit_info.gravity); + message("H: %e", unit_info.hubbleunit); + + /* TODO: Find the total number of DM particles when running with star + * particles and BHs. */ + const int total_nr_dmparts = e->total_nr_gparts - e->total_nr_parts; + + /* Set simulation information. */ + if (e->s->periodic) { + sim_info.period = + unit_info.lengthtokpc * + s->dim[0]; /* Physical size of box in VELOCIraptor units (kpc). */ + } else + sim_info.period = 0.0; + sim_info.zoomhigresolutionmass = -1.0; /* Placeholder. */ + sim_info.interparticlespacing = sim_info.period / cbrt(total_nr_dmparts); + if (e->policy & engine_policy_cosmology) + sim_info.icosmologicalsim = 1; + else + sim_info.icosmologicalsim = 0; + sim_info.spacedimension[0] = unit_info.lengthtokpc * s->dim[0]; + sim_info.spacedimension[1] = unit_info.lengthtokpc * s->dim[1]; + sim_info.spacedimension[2] = unit_info.lengthtokpc * s->dim[2]; + sim_info.numcells = s->nr_cells; + + sim_info.cellwidth[0] = unit_info.lengthtokpc * s->cells_top[0].width[0]; + sim_info.cellwidth[1] = unit_info.lengthtokpc * s->cells_top[0].width[1]; + sim_info.cellwidth[2] = unit_info.lengthtokpc * s->cells_top[0].width[2]; - sim_info.cell_loc = e->cell_loc; - - char configfilename[PARSER_MAX_LINE_SIZE], outputFileName[PARSER_MAX_LINE_SIZE + 128]; - parser_get_param_string(e->parameter_file, "StructureFinding:config_file_name", configfilename); - snprintf(outputFileName, PARSER_MAX_LINE_SIZE + 128, "%s.VELOCIraptor", e->stfBaseName); - - message("Config file name: %s", configfilename); - message("Period: %e", sim_info.period); - message("Zoom high res mass: %e", sim_info.zoomhigresolutionmass); - message("Inter-particle spacing: %e", sim_info.interparticlespacing); - message("Cosmological: %d", sim_info.icosmologicalsim); - message("Space dimensions: (%e,%e,%e)", sim_info.spacedimension[0], sim_info.spacedimension[1], sim_info.spacedimension[2]); - message("No. of top-level cells: %d", sim_info.numcells); - message("Top-level cell locations range: (%e,%e,%e) -> (%e,%e,%e)", sim_info.cell_loc[0].loc[0], sim_info.cell_loc[0].loc[1], sim_info.cell_loc[0].loc[2], sim_info.cell_loc[sim_info.numcells - 1].loc[0], sim_info.cell_loc[sim_info.numcells - 1].loc[1], sim_info.cell_loc[sim_info.numcells - 1].loc[2]); - - /* Initialise VELOCIraptor. */ - if(!InitVelociraptor(configfilename, outputFileName, cosmo_info, unit_info, sim_info)) error("Exiting. VELOCIraptor initialisation failed."); + sim_info.icellwidth[0] = s->iwidth[0] / unit_info.lengthtokpc; + sim_info.icellwidth[1] = s->iwidth[1] / unit_info.lengthtokpc; + sim_info.icellwidth[2] = s->iwidth[2] / unit_info.lengthtokpc; + + /* Allocate and populate top-level cell locations. */ + if (posix_memalign((void **)&(e->cell_loc), 32, + s->nr_cells * sizeof(struct cell_loc)) != 0) + error("Failed to allocate top-level cell locations for VELOCIraptor."); + + for (int i = 0; i < s->nr_cells; i++) { + e->cell_loc[i].loc[0] = unit_info.lengthtokpc * s->cells_top[i].loc[0]; + e->cell_loc[i].loc[1] = unit_info.lengthtokpc * s->cells_top[i].loc[1]; + e->cell_loc[i].loc[2] = unit_info.lengthtokpc * s->cells_top[i].loc[2]; + } + + sim_info.cell_loc = e->cell_loc; + + char configfilename[PARSER_MAX_LINE_SIZE], + outputFileName[PARSER_MAX_LINE_SIZE + 128]; + parser_get_param_string(e->parameter_file, + "StructureFinding:config_file_name", configfilename); + snprintf(outputFileName, PARSER_MAX_LINE_SIZE + 128, "%s.VELOCIraptor", + e->stfBaseName); + + message("Config file name: %s", configfilename); + message("Period: %e", sim_info.period); + message("Zoom high res mass: %e", sim_info.zoomhigresolutionmass); + message("Inter-particle spacing: %e", sim_info.interparticlespacing); + message("Cosmological: %d", sim_info.icosmologicalsim); + message("Space dimensions: (%e,%e,%e)", sim_info.spacedimension[0], + sim_info.spacedimension[1], sim_info.spacedimension[2]); + message("No. of top-level cells: %d", sim_info.numcells); + message("Top-level cell locations range: (%e,%e,%e) -> (%e,%e,%e)", + sim_info.cell_loc[0].loc[0], sim_info.cell_loc[0].loc[1], + sim_info.cell_loc[0].loc[2], + sim_info.cell_loc[sim_info.numcells - 1].loc[0], + sim_info.cell_loc[sim_info.numcells - 1].loc[1], + sim_info.cell_loc[sim_info.numcells - 1].loc[2]); + + /* Initialise VELOCIraptor. */ + if (!InitVelociraptor(configfilename, outputFileName, cosmo_info, unit_info, + sim_info)) + error("Exiting. VELOCIraptor initialisation failed."); #else error("SWIFT not configure to run with VELOCIraptor."); #endif /* HAVE_VELOCIRAPTOR */ - } /** @@ -144,103 +160,111 @@ void velociraptor_init(struct engine *e) { void velociraptor_invoke(struct engine *e) { #ifdef HAVE_VELOCIRAPTOR - struct space *s = e->s; - struct gpart *gparts = s->gparts; - struct part *parts = s->parts; - const size_t nr_gparts = s->nr_gparts; - const size_t nr_hydro_parts = s->nr_parts; - const int nr_cells = s->nr_cells; - int *cell_node_ids = NULL; - - /* Allow thread to run on any core for the duration of the call to VELOCIraptor so that - * when OpenMP threads are spawned they can run on any core on the processor. */ - const int nr_cores = sysconf(_SC_NPROCESSORS_ONLN); - cpu_set_t cpuset; - pthread_t thread = pthread_self(); - - /* Set affinity mask to include all cores on the CPU for VELOCIraptor. */ - CPU_ZERO(&cpuset); - for (int j = 0; j < nr_cores; j++) - CPU_SET(j, &cpuset); - - pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset); - - ticks tic = getticks(); - - /* Allocate and populate array of cell node IDs. */ - if (posix_memalign((void **)&cell_node_ids, 32, - nr_cells * sizeof(int)) != 0) - error("Failed to allocate list of cells node IDs for VELOCIraptor."); - - for(int i=0; i<nr_cells; i++) cell_node_ids[i] = s->cells_top[i].nodeID; - - message("MPI rank %d sending %zu gparts to VELOCIraptor.", engine_rank, nr_gparts); - - /* Append base name with either the step number or time depending on what format is specified in the parameter file. */ - char outputFileName[PARSER_MAX_LINE_SIZE + 128]; - if(e->stf_output_freq_format == STEPS) { - snprintf(outputFileName, PARSER_MAX_LINE_SIZE + 128, "%s_%04i.VELOCIraptor", e->stfBaseName, - e->step); - } - else if(e->stf_output_freq_format == TIME) { - snprintf(outputFileName, PARSER_MAX_LINE_SIZE + 128, "%s_%04e.VELOCIraptor", e->stfBaseName, - e->time); - } + struct space *s = e->s; + struct gpart *gparts = s->gparts; + struct part *parts = s->parts; + const size_t nr_gparts = s->nr_gparts; + const size_t nr_hydro_parts = s->nr_parts; + const int nr_cells = s->nr_cells; + int *cell_node_ids = NULL; - /* Allocate and populate an array of swift_vel_parts to be passed to VELOCIraptor. */ - struct swift_vel_part *swift_parts = NULL; - - if (posix_memalign((void **)&swift_parts, part_align, - nr_gparts * sizeof(struct swift_vel_part)) != 0) - error("Failed to allocate array of particles for VELOCIraptor."); - - bzero(swift_parts, nr_gparts * sizeof(struct swift_vel_part)); - - const float energy_scale = 1.0; - const float a2 = e->cosmology->a * e->cosmology->a; - - message("Energy scaling factor: %f", energy_scale); - message("a^2: %f", a2); - - /* Convert particle properties into VELOCIraptor units */ - for(size_t i=0; i<nr_gparts; i++) { - swift_parts[i].x[0] = gparts[i].x[0]; - swift_parts[i].x[1] = gparts[i].x[1]; - swift_parts[i].x[2] = gparts[i].x[2]; - swift_parts[i].v[0] = gparts[i].v_full[0] / a2; //MATTHIEU: Check this a^2 !! - swift_parts[i].v[1] = gparts[i].v_full[1] / a2; - swift_parts[i].v[2] = gparts[i].v_full[2] / a2; - swift_parts[i].mass = gravity_get_mass(&gparts[i]); - swift_parts[i].potential = gravity_get_comoving_potential(&gparts[i]); //MATTHIEU: Need factors here? - swift_parts[i].type = gparts[i].type; - - /* Set gas particle IDs from their hydro counterparts and set internal energies. */ - if(gparts[i].type == swift_type_gas) { - swift_parts[i].id = parts[-gparts[i].id_or_neg_offset].id; - swift_parts[i].u = hydro_get_physical_internal_energy(&parts[-gparts[i].id_or_neg_offset], e->cosmology) * energy_scale; - } - else if (gparts[i].type == swift_type_dark_matter) { - swift_parts[i].id = gparts[i].id_or_neg_offset; - swift_parts[i].u = 0.f; - } - else { - error("Particle type not handled by velociraptor (yet?) !"); - } + /* Allow thread to run on any core for the duration of the call to + * VELOCIraptor so that + * when OpenMP threads are spawned they can run on any core on the processor. + */ + const int nr_cores = sysconf(_SC_NPROCESSORS_ONLN); + cpu_set_t cpuset; + pthread_t thread = pthread_self(); + + /* Set affinity mask to include all cores on the CPU for VELOCIraptor. */ + CPU_ZERO(&cpuset); + for (int j = 0; j < nr_cores; j++) CPU_SET(j, &cpuset); + + pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset); + + ticks tic = getticks(); + + /* Allocate and populate array of cell node IDs. */ + if (posix_memalign((void **)&cell_node_ids, 32, nr_cells * sizeof(int)) != 0) + error("Failed to allocate list of cells node IDs for VELOCIraptor."); + + for (int i = 0; i < nr_cells; i++) cell_node_ids[i] = s->cells_top[i].nodeID; + + message("MPI rank %d sending %zu gparts to VELOCIraptor.", engine_rank, + nr_gparts); + + /* Append base name with either the step number or time depending on what + * format is specified in the parameter file. */ + char outputFileName[PARSER_MAX_LINE_SIZE + 128]; + if (e->stf_output_freq_format == STEPS) { + snprintf(outputFileName, PARSER_MAX_LINE_SIZE + 128, "%s_%04i.VELOCIraptor", + e->stfBaseName, e->step); + } else if (e->stf_output_freq_format == TIME) { + snprintf(outputFileName, PARSER_MAX_LINE_SIZE + 128, "%s_%04e.VELOCIraptor", + e->stfBaseName, e->time); + } + + /* Allocate and populate an array of swift_vel_parts to be passed to + * VELOCIraptor. */ + struct swift_vel_part *swift_parts = NULL; + + if (posix_memalign((void **)&swift_parts, part_align, + nr_gparts * sizeof(struct swift_vel_part)) != 0) + error("Failed to allocate array of particles for VELOCIraptor."); + + bzero(swift_parts, nr_gparts * sizeof(struct swift_vel_part)); + + const float energy_scale = 1.0; + const float a2 = e->cosmology->a * e->cosmology->a; + + message("Energy scaling factor: %f", energy_scale); + message("a^2: %f", a2); + + /* Convert particle properties into VELOCIraptor units */ + for (size_t i = 0; i < nr_gparts; i++) { + swift_parts[i].x[0] = gparts[i].x[0]; + swift_parts[i].x[1] = gparts[i].x[1]; + swift_parts[i].x[2] = gparts[i].x[2]; + swift_parts[i].v[0] = + gparts[i].v_full[0] / a2; // MATTHIEU: Check this a^2 !! + swift_parts[i].v[1] = gparts[i].v_full[1] / a2; + swift_parts[i].v[2] = gparts[i].v_full[2] / a2; + swift_parts[i].mass = gravity_get_mass(&gparts[i]); + swift_parts[i].potential = gravity_get_comoving_potential( + &gparts[i]); // MATTHIEU: Need factors here? + swift_parts[i].type = gparts[i].type; + + /* Set gas particle IDs from their hydro counterparts and set internal + * energies. */ + if (gparts[i].type == swift_type_gas) { + swift_parts[i].id = parts[-gparts[i].id_or_neg_offset].id; + swift_parts[i].u = + hydro_get_physical_internal_energy( + &parts[-gparts[i].id_or_neg_offset], e->cosmology) * + energy_scale; + } else if (gparts[i].type == swift_type_dark_matter) { + swift_parts[i].id = gparts[i].id_or_neg_offset; + swift_parts[i].u = 0.f; + } else { + error("Particle type not handled by velociraptor (yet?) !"); } + } - /* Call VELOCIraptor. */ - if(!InvokeVelociraptor(nr_gparts, nr_hydro_parts, swift_parts, cell_node_ids, outputFileName)) error("Exiting. Call to VELOCIraptor failed on rank: %d.", e->nodeID); - - /* Reset the pthread affinity mask after VELOCIraptor returns. */ - pthread_setaffinity_np(thread, sizeof(cpu_set_t), engine_entry_affinity()); - - /* Free cell node ids after VELOCIraptor has copied them. */ - free(cell_node_ids); - free(swift_parts); - - message("VELOCIraptor took %.3f %s on rank %d.", - clocks_from_ticks(getticks() - tic), clocks_getunit(), engine_rank); + /* Call VELOCIraptor. */ + if (!InvokeVelociraptor(nr_gparts, nr_hydro_parts, swift_parts, cell_node_ids, + outputFileName)) + error("Exiting. Call to VELOCIraptor failed on rank: %d.", e->nodeID); + + /* Reset the pthread affinity mask after VELOCIraptor returns. */ + pthread_setaffinity_np(thread, sizeof(cpu_set_t), engine_entry_affinity()); + + /* Free cell node ids after VELOCIraptor has copied them. */ + free(cell_node_ids); + free(swift_parts); + + message("VELOCIraptor took %.3f %s on rank %d.", + clocks_from_ticks(getticks() - tic), clocks_getunit(), engine_rank); #else - error("SWIFT not configure to run with VELOCIraptor."); + error("SWIFT not configure to run with VELOCIraptor."); #endif /* HAVE_VELOCIRAPTOR */ } diff --git a/src/velociraptor_interface.h b/src/velociraptor_interface.h index f568dc7c5e058ff93205e409aa6a030c97be77b1..96c2b0fd13fb909571b968b3211192a689f5a971 100644 --- a/src/velociraptor_interface.h +++ b/src/velociraptor_interface.h @@ -41,7 +41,7 @@ struct cosmoinfo { /*! Baryon density parameter (cosmology.Omega_b) */ double Omega_b; - + /*! Radiation constant density parameter (cosmology.Omega_lambda) */ double Omega_Lambda; @@ -57,13 +57,13 @@ struct unitinfo { /* Length conversion factor to kpc. */ double lengthtokpc; - + /* Velocity conversion factor to km/s. */ double velocitytokms; - + /* Mass conversion factor to solar masses. */ double masstosolarmass; - + /* Potential conversion factor. */ double energyperunitmass; @@ -76,34 +76,38 @@ struct unitinfo { /* Structure to hold the location of a top-level cell. */ struct cell_loc { - - /* Coordinates x,y,z */ - double loc[3]; + /* Coordinates x,y,z */ + double loc[3]; }; /* Structure for passing simulation information to VELOCIraptor. */ struct siminfo { - double period, zoomhigresolutionmass, interparticlespacing, spacedimension[3]; - - /* Number of top-cells. */ - int numcells; - - /*! Locations of top-level cells. */ - struct cell_loc *cell_loc; - - /*! Top-level cell width. */ - double cellwidth[3]; - - /*! Inverse of the top-level cell width. */ - double icellwidth[3]; - - int icosmologicalsim; + double period, zoomhigresolutionmass, interparticlespacing, spacedimension[3]; + + /* Number of top-cells. */ + int numcells; + + /*! Locations of top-level cells. */ + struct cell_loc *cell_loc; + + /*! Top-level cell width. */ + double cellwidth[3]; + + /*! Inverse of the top-level cell width. */ + double icellwidth[3]; + + int icosmologicalsim; }; /* VELOCIraptor interface. */ -int InitVelociraptor(char* config_name, char* output_name, struct cosmoinfo cosmo_info, struct unitinfo unit_info, struct siminfo sim_info); -int InvokeVelociraptor(const size_t num_gravity_parts, const size_t num_hydro_parts, struct swift_vel_part *swift_parts, const int *cell_node_ids, char* output_name); +int InitVelociraptor(char *config_name, char *output_name, + struct cosmoinfo cosmo_info, struct unitinfo unit_info, + struct siminfo sim_info); +int InvokeVelociraptor(const size_t num_gravity_parts, + const size_t num_hydro_parts, + struct swift_vel_part *swift_parts, + const int *cell_node_ids, char *output_name); /* VELOCIraptor wrapper functions. */ void velociraptor_init(struct engine *e); diff --git a/tests/testParser.c b/tests/testParser.c index e679b2e4f96a977467d3443f91a9b827a72e1a39..3944e86fa19a1f623623383eabefe1094bf5addf 100644 --- a/tests/testParser.c +++ b/tests/testParser.c @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) { /* Check if we can read it again */ const int optional2 = - parser_get_opt_param_int(¶m_file, "Simulation:optional", 1); + parser_get_opt_param_int(¶m_file, "Simulation:optional", 1); /* Optional things not mentioned in parameter file. Should be in output * files.*/ @@ -71,16 +71,16 @@ int main(int argc, char *argv[]) { char csides[3]; parser_get_param_char_array(¶m_file, "Box:csides", 3, csides); - + int isides[3]; parser_get_param_int_array(¶m_file, "Box:isides", 3, isides); - + float fsides[3]; parser_get_param_float_array(¶m_file, "Box:fsides", 3, fsides); - + double dsides[3]; parser_get_param_double_array(¶m_file, "Box:dsides", 3, dsides); - + int optsides[5] = {1, 2, 3, 4, 5}; int haveopt1 = parser_get_opt_param_int_array(¶m_file, "Box:moresides", 5, optsides); diff --git a/tests/testPotentialPair.c b/tests/testPotentialPair.c index ebff860aa7c222ad454b37ae6beffb01c48c89d3..fd653434268a694142ab48dba9c2a427c6fbf60c 100644 --- a/tests/testPotentialPair.c +++ b/tests/testPotentialPair.c @@ -323,7 +323,8 @@ int main(int argc, char *argv[]) { gp->x[0] - mpole->CoM[0], epsilon, rlr); check_value(gp->a_grav[0], acc_true, "acceleration"); - /* message("x=%e f=%e f_true=%e pot=%e pot_true=%e", gp->x[0] - mpole->CoM[0], */ + /* message("x=%e f=%e f_true=%e pot=%e pot_true=%e", gp->x[0] - + * mpole->CoM[0], */ /* gp->a_grav[0], acc_true, gp->potential, pot_true); */ }