Commit 9d85205d authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Initial rewrite of the stand-alone FOF driver routine.

parent b091183c
This diff is collapsed.
......@@ -2626,7 +2626,7 @@ void engine_prepare(struct engine *e) {
engine_drift_all(e, /*drift_mpole=*/0);
drifted_all = 1;
engine_fof(e);
engine_fof(e, /*dump_results=*/0, /*seed_black_holes=*/1);
}
/* Do we need repartitioning ? */
......@@ -5304,9 +5304,11 @@ void engine_config(int restart, struct engine *e, struct swift_params *params,
"+/- %.4f\n# Eta: %f\n# Config: %s\n# CFLAGS: %s\n",
hostname(), git_branch(), git_revision(), compiler_name(),
compiler_version(), e->nr_threads, e->nr_nodes, SPH_IMPLEMENTATION,
kernel_name, e->hydro_properties->target_neighbours,
e->hydro_properties->delta_neighbours,
e->hydro_properties->eta_neighbours, configuration_options(),
kernel_name,
e->hydro_properties ? e->hydro_properties->target_neighbours : 0.f,
e->hydro_properties ? e->hydro_properties->delta_neighbours: 0.f,
e->hydro_properties ? e->hydro_properties->eta_neighbours : 0.f,
configuration_options(),
compilation_cflags());
fprintf(
......@@ -6480,8 +6482,10 @@ void engine_activate_fof_tasks(struct engine *e) {
* @brief Run a FOF search.
*
* @param e the engine
* @param dump_results Are we writing group catalogues to output files?
* @param seed_black_holes Are we seeding black holes?
*/
void engine_fof(struct engine *e) {
void engine_fof(struct engine *e, const int dump_results, const int seed_black_holes) {
ticks tic = getticks();
......@@ -6513,8 +6517,8 @@ void engine_fof(struct engine *e) {
/* Perform FOF search over foreign particles and
* find groups which require black hole seeding. */
fof_search_tree(e->fof_properties, e->black_holes_properties,
e->physical_constants, e->cosmology, e->s, /*dump_results=*/0,
/*seed_black_holes=*/1);
e->physical_constants, e->cosmology, e->s, dump_results,
seed_black_holes);
/* Reset flag. */
e->run_fof = 0;
......
......@@ -535,7 +535,7 @@ void engine_unpin(void);
void engine_clean(struct engine *e);
int engine_estimate_nr_tasks(const struct engine *e);
void engine_print_task_counts(const struct engine *e);
void engine_fof(struct engine *e);
void engine_fof(struct engine *e, const int dump_results, const int seed_black_holes);
/* Function prototypes, engine_maketasks.c. */
void engine_maketasks(struct engine *e);
......
......@@ -637,6 +637,8 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
N[ptype] = (mpi_rank + 1) * N_total[ptype] / mpi_size - offset[ptype];
}
N[5] = 0;
/* Allocate memory to store SPH particles */
if (with_hydro) {
*Ngas = N[0];
......
......@@ -460,6 +460,8 @@ void read_ic_single(const char* fileName,
for (int ptype = 0; ptype < swift_type_count; ++ptype)
N[ptype] = (numParticles[ptype]) + (numParticles_highWord[ptype] << 32);
N[5] = 0;
/* Get the box size if not cubic */
dim[0] = boxSize[0];
dim[1] = (boxSize[1] < 0) ? boxSize[0] : boxSize[1];
......
......@@ -4017,8 +4017,8 @@ void space_first_init_parts_mapper(void *restrict map_data, int count,
const struct gravity_props *grav_props = s->e->gravity_properties;
const int with_gravity = e->policy & engine_policy_self_gravity;
const struct chemistry_global_data *chemistry = e->chemistry;
const struct star_formation *star_formation = e->star_formation;
//const struct chemistry_global_data *chemistry = e->chemistry;
//const struct star_formation *star_formation = e->star_formation;
const struct cooling_function_data *cool_func = e->cooling_func;
/* Check that the smoothing lengths are non-zero */
......@@ -4067,14 +4067,14 @@ void space_first_init_parts_mapper(void *restrict map_data, int count,
#endif
/* Also initialise the chemistry */
chemistry_first_init_part(phys_const, us, cosmo, chemistry, &p[k], &xp[k]);
//chemistry_first_init_part(phys_const, us, cosmo, chemistry, &p[k], &xp[k]);
/* Also initialise the star formation */
star_formation_first_init_part(phys_const, us, cosmo, star_formation, &p[k],
&xp[k]);
//star_formation_first_init_part(phys_const, us, cosmo, star_formation, &p[k],
//&xp[k]);
/* And the cooling */
cooling_first_init_part(phys_const, us, cosmo, cool_func, &p[k], &xp[k]);
//cooling_first_init_part(phys_const, us, cosmo, cool_func, &p[k], &xp[k]);
/* And the tracers */
tracers_first_init_xpart(&p[k], &xp[k], us, phys_const, cosmo, hydro_props,
......@@ -4175,7 +4175,7 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count,
const struct space *restrict s = (struct space *)extra_data;
const struct engine *e = s->e;
const struct chemistry_global_data *chemistry = e->chemistry;
//const struct chemistry_global_data *chemistry = e->chemistry;
#ifdef SWIFT_DEBUG_CHECKS
const ptrdiff_t delta = sp - s->sparts;
......@@ -4186,7 +4186,7 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count,
const int with_feedback = (e->policy & engine_policy_feedback);
const struct cosmology *cosmo = e->cosmology;
const struct stars_props *stars_properties = e->stars_properties;
//const struct stars_props *stars_properties = e->stars_properties;
const float a_factor_vel = cosmo->a;
/* Convert velocities to internal units */
......@@ -4222,10 +4222,10 @@ void space_first_init_sparts_mapper(void *restrict map_data, int count,
/* Initialise the rest */
for (int k = 0; k < count; k++) {
stars_first_init_spart(&sp[k], stars_properties);
//stars_first_init_spart(&sp[k], stars_properties);
/* Also initialise the chemistry */
chemistry_first_init_spart(chemistry, &sp[k]);
//chemistry_first_init_spart(chemistry, &sp[k]);
#ifdef SWIFT_DEBUG_CHECKS
if (sp[k].gpart && sp[k].gpart->id_or_neg_offset != -(k + delta))
......
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