Commit 85efcc54 authored by Loic Hausammann's avatar Loic Hausammann
Browse files

Add init_parts

parent 08d81da1
......@@ -64,6 +64,7 @@
#include "scheduler.h"
#include "space.h"
#include "space_getsid.h"
#include "star_formation.h"
#include "stars.h"
#include "timers.h"
#include "tools.h"
......@@ -4207,6 +4208,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
if (part_is_active(p, e)) {
hydro_init_part(p, &e->s->hs);
chemistry_init_part(p, e->chemistry);
star_formation_init_part(p, e->star_formation);
tracers_after_init(p, xp, e->internal_units, e->physical_constants,
with_cosmology, e->cosmology, e->hydro_properties,
e->cooling_func, e->time);
......
......@@ -1926,6 +1926,9 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
const struct cosmology *cosmo = e->cosmology;
const struct chemistry_global_data *chemistry = e->chemistry;
const struct star_formation *star_formation = e->star_formation;
const int with_cosmology = (e->policy & engine_policy_cosmology);
const float hydro_h_max = e->hydro_properties->h_max;
const float hydro_h_min = e->hydro_properties->h_min;
const float eps = e->hydro_properties->h_tolerance;
......@@ -2071,7 +2074,6 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
/* Calculate the time-step for passing to hydro_prepare_force, used
* for the evolution of alpha factors (i.e. those involved in the
* artificial viscosity and thermal conduction terms) */
const int with_cosmology = (e->policy & engine_policy_cosmology);
const double time_base = e->time_base;
const integertime_t ti_current = e->ti_current;
double dt_alpha;
......@@ -2168,6 +2170,9 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
hydro_init_part(p, hs);
chemistry_init_part(p, chemistry);
star_formation_init_part(p, star_formation);
tracers_after_init(p, xp, e->internal_units, e->physical_constants,
with_cosmology, e->cosmology,
e->hydro_properties, e->cooling_func, e->time);
/* Off we go ! */
continue;
......@@ -2222,7 +2227,6 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
/* Calculate the time-step for passing to hydro_prepare_force, used for
* the evolution of alpha factors (i.e. those involved in the artificial
* viscosity and thermal conduction terms) */
const int with_cosmology = (e->policy & engine_policy_cosmology);
const double time_base = e->time_base;
const integertime_t ti_current = e->ti_current;
double dt_alpha;
......
......@@ -4333,8 +4333,21 @@ void space_init_parts_mapper(void *restrict map_data, int count,
void *restrict extra_data) {
struct part *restrict parts = (struct part *)map_data;
const struct hydro_space *restrict hs = (struct hydro_space *)extra_data;
for (int k = 0; k < count; k++) hydro_init_part(&parts[k], hs);
const struct engine *restrict e = (struct engine *)extra_data;
const struct hydro_space *restrict hs = &e->s->hs;
const int with_cosmology = (e->policy & engine_policy_cosmology);
size_t ind = parts - e->s->parts;
struct xpart *restrict xparts = e->s->xparts + ind;
for (int k = 0; k < count; k++) {
hydro_init_part(&parts[k], hs);
chemistry_init_part(&parts[k], e->chemistry);
star_formation_init_part(&parts[k], e->star_formation);
tracers_after_init(&parts[k], &xparts[k], e->internal_units,
e->physical_constants, with_cosmology, e->cosmology,
e->hydro_properties, e->cooling_func, e->time);
}
}
/**
......@@ -4349,7 +4362,7 @@ void space_init_parts(struct space *s, int verbose) {
if (s->nr_parts > 0)
threadpool_map(&s->e->threadpool, space_init_parts_mapper, s->parts,
s->nr_parts, sizeof(struct part), 0, &s->hs);
s->nr_parts, sizeof(struct part), 0, &s->e);
if (verbose)
message("took %.3f %s.", clocks_from_ticks(getticks() - tic),
clocks_getunit());
......
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