Commit ad8864ae authored by Loic Hausammann's avatar Loic Hausammann
Browse files

First cleanup of star_Density done

parent a5000aa9
...@@ -126,8 +126,8 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h ...@@ -126,8 +126,8 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h
riemann/riemann_exact.h riemann/riemann_vacuum.h \ riemann/riemann_exact.h riemann/riemann_vacuum.h \
riemann/riemann_checks.h \ riemann/riemann_checks.h \
stars.h stars_io.h \ stars.h stars_io.h \
stars/Default/star.h stars/Default/star_iact.h stars/Default/star_io.h \ stars/Default/stars.h stars/Default/stars_iact.h stars/Default/stars_io.h \
stars/Default/star_debug.h stars/Default/star_part.h \ stars/Default/stars_debug.h stars/Default/stars_part.h \
potential/none/potential.h potential/point_mass/potential.h \ potential/none/potential.h potential/point_mass/potential.h \
potential/isothermal/potential.h potential/disc_patch/potential.h \ potential/isothermal/potential.h potential/disc_patch/potential.h \
potential/sine_wave/potential.h \ potential/sine_wave/potential.h \
......
...@@ -1115,7 +1115,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset, ...@@ -1115,7 +1115,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset,
if (gparts[j].type == swift_type_gas) { if (gparts[j].type == swift_type_gas) {
parts[-gparts[j].id_or_neg_offset - parts_offset].gpart = parts[-gparts[j].id_or_neg_offset - parts_offset].gpart =
&gparts[j]; &gparts[j];
} else if (gparts[j].type == swift_type_star) { } else if (gparts[j].type == swift_type_stars) {
sparts[-gparts[j].id_or_neg_offset - sparts_offset].gpart = sparts[-gparts[j].id_or_neg_offset - sparts_offset].gpart =
&gparts[j]; &gparts[j];
} }
...@@ -1125,7 +1125,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset, ...@@ -1125,7 +1125,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset,
gbuff[k] = temp_buff; gbuff[k] = temp_buff;
if (gparts[k].type == swift_type_gas) { if (gparts[k].type == swift_type_gas) {
parts[-gparts[k].id_or_neg_offset - parts_offset].gpart = &gparts[k]; parts[-gparts[k].id_or_neg_offset - parts_offset].gpart = &gparts[k];
} else if (gparts[k].type == swift_type_star) { } else if (gparts[k].type == swift_type_stars) {
sparts[-gparts[k].id_or_neg_offset - sparts_offset].gpart = sparts[-gparts[k].id_or_neg_offset - sparts_offset].gpart =
&gparts[k]; &gparts[k];
} }
......
...@@ -591,6 +591,30 @@ cell_can_recurse_in_self_hydro_task(const struct cell *c) { ...@@ -591,6 +591,30 @@ cell_can_recurse_in_self_hydro_task(const struct cell *c) {
return c->split && (kernel_gamma * c->h_max_old < 0.5f * c->dmin); return c->split && (kernel_gamma * c->h_max_old < 0.5f * c->dmin);
} }
/**
* @brief Can a sub-pair star task recurse to a lower level based
* on the status of the particles in the cell.
*
* @param c The #cell.
*/
__attribute__((always_inline)) INLINE static int
cell_can_recurse_in_pair_stars_task(const struct cell *c) {
return 0;
}
/**
* @brief Can a sub-self stars task recurse to a lower level based
* on the status of the particles in the cell.
*
* @param c The #cell.
*/
__attribute__((always_inline)) INLINE static int
cell_can_recurse_in_self_stars_task(const struct cell *c) {
return 0;
}
/** /**
* @brief Can a pair hydro task associated with a cell be split into smaller * @brief Can a pair hydro task associated with a cell be split into smaller
* sub-tasks. * sub-tasks.
......
...@@ -747,7 +747,7 @@ void io_duplicate_hydro_sparts_mapper(void* restrict data, int Nstars, ...@@ -747,7 +747,7 @@ void io_duplicate_hydro_sparts_mapper(void* restrict data, int Nstars,
gparts[i + Ndm].mass = sparts[i].mass; gparts[i + Ndm].mass = sparts[i].mass;
/* Set gpart type */ /* Set gpart type */
gparts[i + Ndm].type = swift_type_star; gparts[i + Ndm].type = swift_type_stars;
/* Link the particles */ /* Link the particles */
gparts[i + Ndm].id_or_neg_offset = -(long long)(offset + i); gparts[i + Ndm].id_or_neg_offset = -(long long)(offset + i);
...@@ -768,7 +768,7 @@ void io_duplicate_hydro_sparts_mapper(void* restrict data, int Nstars, ...@@ -768,7 +768,7 @@ void io_duplicate_hydro_sparts_mapper(void* restrict data, int Nstars,
* @param Nstars The number of stars particles read in. * @param Nstars The number of stars particles read in.
* @param Ndm The number of DM and gas particles read in. * @param Ndm The number of DM and gas particles read in.
*/ */
void io_duplicate_star_gparts(struct threadpool* tp, struct spart* const sparts, void io_duplicate_stars_gparts(struct threadpool* tp, struct spart* const sparts,
struct gpart* const gparts, size_t Nstars, struct gpart* const gparts, size_t Nstars,
size_t Ndm) { size_t Ndm) {
...@@ -853,8 +853,8 @@ void io_check_output_fields(const struct swift_params* params, ...@@ -853,8 +853,8 @@ void io_check_output_fields(const struct swift_params* params,
darkmatter_write_particles(&gp, list, &num_fields); darkmatter_write_particles(&gp, list, &num_fields);
break; break;
case swift_type_star: case swift_type_stars:
star_write_particles(&sp, list, &num_fields); stars_write_particles(&sp, list, &num_fields);
break; break;
default: default:
...@@ -939,8 +939,8 @@ void io_write_output_field_parameter(const char* filename) { ...@@ -939,8 +939,8 @@ void io_write_output_field_parameter(const char* filename) {
darkmatter_write_particles(NULL, list, &num_fields); darkmatter_write_particles(NULL, list, &num_fields);
break; break;
case swift_type_star: case swift_type_stars:
star_write_particles(NULL, list, &num_fields); stars_write_particles(NULL, list, &num_fields);
break; break;
default: default:
......
...@@ -104,7 +104,7 @@ void io_prepare_dm_gparts(struct threadpool* tp, struct gpart* const gparts, ...@@ -104,7 +104,7 @@ void io_prepare_dm_gparts(struct threadpool* tp, struct gpart* const gparts,
void io_duplicate_hydro_gparts(struct threadpool* tp, struct part* const parts, void io_duplicate_hydro_gparts(struct threadpool* tp, struct part* const parts,
struct gpart* const gparts, size_t Ngas, struct gpart* const gparts, size_t Ngas,
size_t Ndm); size_t Ndm);
void io_duplicate_star_gparts(struct threadpool* tp, struct spart* const sparts, void io_duplicate_stars_gparts(struct threadpool* tp, struct spart* const sparts,
struct gpart* const gparts, size_t Nstars, struct gpart* const gparts, size_t Nstars,
size_t Ndm); size_t Ndm);
......
...@@ -818,7 +818,7 @@ static void engine_redistribute_relink_mapper(void *map_data, int num_elements, ...@@ -818,7 +818,7 @@ static void engine_redistribute_relink_mapper(void *map_data, int num_elements,
} }
/* Does this gpart have a star partner ? */ /* Does this gpart have a star partner ? */
else if (s->gparts[k].type == swift_type_star) { else if (s->gparts[k].type == swift_type_stars) {
const ptrdiff_t partner_index = const ptrdiff_t partner_index =
offset_sparts - s->gparts[k].id_or_neg_offset; offset_sparts - s->gparts[k].id_or_neg_offset;
...@@ -2015,7 +2015,7 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts, ...@@ -2015,7 +2015,7 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts,
for (size_t k = 0; k < offset_gparts; k++) { for (size_t k = 0; k < offset_gparts; k++) {
if (s->gparts[k].type == swift_type_gas) { if (s->gparts[k].type == swift_type_gas) {
s->parts[-s->gparts[k].id_or_neg_offset].gpart = &s->gparts[k]; s->parts[-s->gparts[k].id_or_neg_offset].gpart = &s->gparts[k];
} else if (s->gparts[k].type == swift_type_star) { } else if (s->gparts[k].type == swift_type_stars) {
s->sparts[-s->gparts[k].id_or_neg_offset].gpart = &s->gparts[k]; s->sparts[-s->gparts[k].id_or_neg_offset].gpart = &s->gparts[k];
} }
} }
...@@ -2111,7 +2111,7 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts, ...@@ -2111,7 +2111,7 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts,
&s->parts[offset_parts + count_parts - gp->id_or_neg_offset]; &s->parts[offset_parts + count_parts - gp->id_or_neg_offset];
gp->id_or_neg_offset = s->parts - p; gp->id_or_neg_offset = s->parts - p;
p->gpart = gp; p->gpart = gp;
} else if (gp->type == swift_type_star) { } else if (gp->type == swift_type_stars) {
struct spart *sp = struct spart *sp =
&s->sparts[offset_sparts + count_sparts - gp->id_or_neg_offset]; &s->sparts[offset_sparts + count_sparts - gp->id_or_neg_offset];
gp->id_or_neg_offset = s->sparts - sp; gp->id_or_neg_offset = s->sparts - sp;
...@@ -3734,7 +3734,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, ...@@ -3734,7 +3734,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Activate the star density */ /* Activate the star density */
else if (t->type == task_type_self && else if (t->type == task_type_self &&
t->subtype == task_subtype_stars_density) { t->subtype == task_subtype_stars_density) {
if (cell_is_active_star(ci, e)) { if (cell_is_active_stars(ci, e)) {
scheduler_activate(s, t); scheduler_activate(s, t);
cell_activate_drift_part(ci, s); cell_activate_drift_part(ci, s);
} }
...@@ -3743,7 +3743,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements, ...@@ -3743,7 +3743,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Store current values of dx_max and h_max. */ /* Store current values of dx_max and h_max. */
else if (t->type == task_type_sub_self && else if (t->type == task_type_sub_self &&
t->subtype == task_subtype_stars_density) { t->subtype == task_subtype_stars_density) {
if (cell_is_active_star(ci, e)) { if (cell_is_active_stars(ci, e)) {
scheduler_activate(s, t); scheduler_activate(s, t);
cell_activate_subcell_hydro_tasks(ci, NULL, s); cell_activate_subcell_hydro_tasks(ci, NULL, s);
} }
...@@ -4120,10 +4120,12 @@ void engine_marktasks_mapper(void *map_data, int num_elements, ...@@ -4120,10 +4120,12 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
scheduler_activate(s, t); scheduler_activate(s, t);
} }
}
/* Star ghost tasks ? */ /* Star ghost tasks ? */
else if (t->type == task_type_stars_ghost || else if (t->type == task_type_stars_ghost ||
t->type == task_type_stars_ghost_in || t->type == task_type_stars_ghost_out) { t->type == task_type_stars_ghost_in || t->type == task_type_stars_ghost_out) {
if (cell_is_active_star(t->ci, e)) scheduler_activate(s, t); if (cell_is_active_stars(t->ci, e)) scheduler_activate(s, t);
} }
/* Time-step? */ /* Time-step? */
......
...@@ -150,7 +150,7 @@ __attribute__((always_inline)) INLINE static void kick_spart( ...@@ -150,7 +150,7 @@ __attribute__((always_inline)) INLINE static void kick_spart(
sp->gpart->v_full[2] = sp->v[2]; sp->gpart->v_full[2] = sp->v[2];
/* Kick extra variables */ /* Kick extra variables */
star_kick_extra(sp, dt_kick_grav); stars_kick_extra(sp, dt_kick_grav);
} }
#endif /* SWIFT_KICK_H */ #endif /* SWIFT_KICK_H */
...@@ -779,12 +779,12 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units, ...@@ -779,12 +779,12 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
bzero(*parts, *Ngas * sizeof(struct part)); bzero(*parts, *Ngas * sizeof(struct part));
} }
/* Allocate memory to store star particles */ /* Allocate memory to store stars particles */
if (with_stars) { if (with_stars) {
*Nstars = N[swift_type_star]; *Nstars = N[swift_type_stars];
if (posix_memalign((void**)sparts, spart_align, if (posix_memalign((void**)sparts, spart_align,
*Nstars * sizeof(struct spart)) != 0) *Nstars * sizeof(struct spart)) != 0)
error("Error while allocating memory for star particles"); error("Error while allocating memory for stars particles");
bzero(*sparts, *Nstars * sizeof(struct spart)); bzero(*sparts, *Nstars * sizeof(struct spart));
} }
...@@ -793,7 +793,7 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units, ...@@ -793,7 +793,7 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
Ndm = N[1]; Ndm = N[1];
*Ngparts = (with_hydro ? N[swift_type_gas] : 0) + *Ngparts = (with_hydro ? N[swift_type_gas] : 0) +
N[swift_type_dark_matter] + N[swift_type_dark_matter] +
(with_stars ? N[swift_type_star] : 0); (with_stars ? N[swift_type_stars] : 0);
if (posix_memalign((void**)gparts, gpart_align, if (posix_memalign((void**)gparts, gpart_align,
*Ngparts * sizeof(struct gpart)) != 0) *Ngparts * sizeof(struct gpart)) != 0)
error("Error while allocating memory for gravity particles"); error("Error while allocating memory for gravity particles");
...@@ -842,10 +842,10 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units, ...@@ -842,10 +842,10 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
} }
break; break;
case swift_type_star: case swift_type_stars:
if (with_stars) { if (with_stars) {
Nparticles = *Nstars; Nparticles = *Nstars;
star_read_particles(*sparts, list, &num_fields); stars_read_particles(*sparts, list, &num_fields);
} }
break; break;
...@@ -878,9 +878,9 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units, ...@@ -878,9 +878,9 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
/* Duplicate the hydro particles into gparts */ /* Duplicate the hydro particles into gparts */
if (with_hydro) io_duplicate_hydro_gparts(&tp, *parts, *gparts, *Ngas, Ndm); if (with_hydro) io_duplicate_hydro_gparts(&tp, *parts, *gparts, *Ngas, Ndm);
/* Duplicate the star particles into gparts */ /* Duplicate the stars particles into gparts */
if (with_stars) if (with_stars)
io_duplicate_star_gparts(&tp, *sparts, *gparts, *Nstars, Ndm + *Ngas); io_duplicate_stars_gparts(&tp, *sparts, *gparts, *Nstars, Ndm + *Ngas);
threadpool_clean(&tp); threadpool_clean(&tp);
} }
...@@ -1105,8 +1105,8 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6], ...@@ -1105,8 +1105,8 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
darkmatter_write_particles(gparts, list, &num_fields); darkmatter_write_particles(gparts, list, &num_fields);
break; break;
case swift_type_star: case swift_type_stars:
star_write_particles(sparts, list, &num_fields); stars_write_particles(sparts, list, &num_fields);
break; break;
default: default:
...@@ -1363,9 +1363,9 @@ void write_output_parallel(struct engine* e, const char* baseName, ...@@ -1363,9 +1363,9 @@ void write_output_parallel(struct engine* e, const char* baseName,
darkmatter_write_particles(dmparts, list, &num_fields); darkmatter_write_particles(dmparts, list, &num_fields);
break; break;
case swift_type_star: case swift_type_stars:
Nparticles = Nstars; Nparticles = Nstars;
star_write_particles(sparts, list, &num_fields); stars_write_particles(sparts, list, &num_fields);
break; break;
default: default:
......
...@@ -88,7 +88,7 @@ void part_relink_parts_to_gparts(struct gpart *gparts, size_t N, ...@@ -88,7 +88,7 @@ void part_relink_parts_to_gparts(struct gpart *gparts, size_t N,
void part_relink_sparts_to_gparts(struct gpart *gparts, size_t N, void part_relink_sparts_to_gparts(struct gpart *gparts, size_t N,
struct spart *sparts) { struct spart *sparts) {
for (size_t k = 0; k < N; k++) { for (size_t k = 0; k < N; k++) {
if (gparts[k].type == swift_type_star) { if (gparts[k].type == swift_type_stars) {
sparts[-gparts[k].id_or_neg_offset].gpart = &gparts[k]; sparts[-gparts[k].id_or_neg_offset].gpart = &gparts[k];
} }
} }
...@@ -108,7 +108,7 @@ void part_relink_all_parts_to_gparts(struct gpart *gparts, size_t N, ...@@ -108,7 +108,7 @@ void part_relink_all_parts_to_gparts(struct gpart *gparts, size_t N,
for (size_t k = 0; k < N; k++) { for (size_t k = 0; k < N; k++) {
if (gparts[k].type == swift_type_gas) { if (gparts[k].type == swift_type_gas) {
parts[-gparts[k].id_or_neg_offset].gpart = &gparts[k]; parts[-gparts[k].id_or_neg_offset].gpart = &gparts[k];
} else if (gparts[k].type == swift_type_star) { } else if (gparts[k].type == swift_type_stars) {
sparts[-gparts[k].id_or_neg_offset].gpart = &gparts[k]; sparts[-gparts[k].id_or_neg_offset].gpart = &gparts[k];
} }
} }
...@@ -171,11 +171,11 @@ void part_verify_links(struct part *parts, struct gpart *gparts, ...@@ -171,11 +171,11 @@ void part_verify_links(struct part *parts, struct gpart *gparts,
error("Linked particles are not at the same time !"); error("Linked particles are not at the same time !");
} }
else if (gparts[k].type == swift_type_star) { else if (gparts[k].type == swift_type_stars) {
/* Check that it is linked */ /* Check that it is linked */
if (gparts[k].id_or_neg_offset > 0) if (gparts[k].id_or_neg_offset > 0)
error("Star gpart not linked to anything !"); error("Stars gpart not linked to anything !");
/* Find its link */ /* Find its link */
const struct spart *spart = &sparts[-gparts[k].id_or_neg_offset]; const struct spart *spart = &sparts[-gparts[k].id_or_neg_offset];
......
...@@ -202,7 +202,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { ...@@ -202,7 +202,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
float h_new; float h_new;
int has_no_neighbours = 0; int has_no_neighbours = 0;
if (sp->wcount == 0.f) { /* No neighbours case */ if (sp->density.wcount == 0.f) { /* No neighbours case */
/* Flag that there were no neighbours */ /* Flag that there were no neighbours */
has_no_neighbours = 1; has_no_neighbours = 1;
...@@ -215,12 +215,12 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { ...@@ -215,12 +215,12 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
stars_end_density(sp, cosmo); stars_end_density(sp, cosmo);
/* Compute one step of the Newton-Raphson scheme */ /* Compute one step of the Newton-Raphson scheme */
const float n_sum = sp->wcount * h_old_dim; const float n_sum = sp->density.wcount * h_old_dim;
const float n_target = stars_eta_dim; const float n_target = stars_eta_dim;
const float f = n_sum - n_target; const float f = n_sum - n_target;
const float f_prime = const float f_prime =
sp->wcount_dh * h_old_dim + sp->density.wcount_dh * h_old_dim +
hydro_dimension * sp->wcount * h_old_dim_minus_one; hydro_dimension * sp->density.wcount * h_old_dim_minus_one;
/* Avoid floating point exception from f_prime = 0 */ /* Avoid floating point exception from f_prime = 0 */
h_new = h_old - f / (f_prime + FLT_MIN); h_new = h_old - f / (f_prime + FLT_MIN);
...@@ -269,7 +269,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { ...@@ -269,7 +269,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
/* We now have a particle whose smoothing length has converged */ /* We now have a particle whose smoothing length has converged */
/* Compute the stellar evolution */ /* Compute the stellar evolution */
stars_evolve_spart(sp, cosmo); stars_evolve_spart(sp, stars_properties, cosmo);
} }
......
...@@ -398,7 +398,7 @@ void runner_dosub_subset_stars_density(struct runner *r, struct cell *ci, struct ...@@ -398,7 +398,7 @@ void runner_dosub_subset_stars_density(struct runner *r, struct cell *ci, struct
if (cj == NULL) { if (cj == NULL) {
/* Recurse? */ /* Recurse? */
if (cell_can_recurse_in_self_task(ci)) { if (cell_can_recurse_in_self_stars_task(ci)) {
/* Loop over all progeny. */ /* Loop over all progeny. */
runner_dosub_subset_stars_density(r, sub, sparts, ind, scount, NULL, -1, 0); runner_dosub_subset_stars_density(r, sub, sparts, ind, scount, NULL, -1, 0);
...@@ -417,8 +417,8 @@ void runner_dosub_subset_stars_density(struct runner *r, struct cell *ci, struct ...@@ -417,8 +417,8 @@ void runner_dosub_subset_stars_density(struct runner *r, struct cell *ci, struct
else { else {
/* Recurse? */ /* Recurse? */
if (cell_can_recurse_in_pair_task(ci) && if (cell_can_recurse_in_pair_stars_task(ci) &&
cell_can_recurse_in_pair_task(cj)) { cell_can_recurse_in_pair_stars_task(cj)) {
/* Get the type of pair if not specified explicitly. */ /* Get the type of pair if not specified explicitly. */
double shift[3] = {0.0, 0.0, 0.0}; double shift[3] = {0.0, 0.0, 0.0};
...@@ -1067,7 +1067,7 @@ void runner_dosub_pair_stars_density(struct runner *r, struct cell *ci, struct c ...@@ -1067,7 +1067,7 @@ void runner_dosub_pair_stars_density(struct runner *r, struct cell *ci, struct c
sid = space_getsid(s, &ci, &cj, shift); sid = space_getsid(s, &ci, &cj, shift);
/* Recurse? */ /* Recurse? */
if (cell_can_recurse_in_pair_task(ci) && cell_can_recurse_in_pair_task(cj)) { if (cell_can_recurse_in_pair_stars_task(ci) && cell_can_recurse_in_pair_stars_task(cj)) {
/* Different types of flags. */ /* Different types of flags. */
switch (sid) { switch (sid) {
...@@ -1305,7 +1305,7 @@ void runner_dosub_self_stars_density(struct runner *r, struct cell *ci, int gett ...@@ -1305,7 +1305,7 @@ void runner_dosub_self_stars_density(struct runner *r, struct cell *ci, int gett
if (ci->scount == 0 || !cell_is_active_stars(ci, r->e)) return; if (ci->scount == 0 || !cell_is_active_stars(ci, r->e)) return;
/* Recurse? */ /* Recurse? */
if (cell_can_recurse_in_self_task(ci)) { if (cell_can_recurse_in_self_stars_task(ci)) {
/* Loop over all progeny. */ /* Loop over all progeny. */
for (int k = 0; k < 8; k++) for (int k = 0; k < 8; k++)
......
...@@ -580,12 +580,12 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units, ...@@ -580,12 +580,12 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
bzero(*parts, *Ngas * sizeof(struct part)); bzero(*parts, *Ngas * sizeof(struct part));
} }
/* Allocate memory to store star particles */ /* Allocate memory to store stars particles */
if (with_stars) { if (with_stars) {
*Nstars = N[swift_type_star]; *Nstars = N[swift_type_stars];
if (posix_memalign((void*)sparts, spart_align, if (posix_memalign((void*)sparts, spart_align,
*Nstars * sizeof(struct spart)) != 0) *Nstars * sizeof(struct spart)) != 0)
error("Error while allocating memory for star particles"); error("Error while allocating memory for stars particles");
bzero(*sparts, *Nstars * sizeof(struct spart)); bzero(*sparts, *Nstars * sizeof(struct spart));
} }
...@@ -594,7 +594,7 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units, ...@@ -594,7 +594,7 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
Ndm = N[1]; Ndm = N[1];
*Ngparts = (with_hydro ? N[swift_type_gas] : 0) + *Ngparts = (with_hydro ? N[swift_type_gas] : 0) +
N[swift_type_dark_matter] + N[swift_type_dark_matter] +
(with_stars ? N[swift_type_star] : 0); (with_stars ? N[swift_type_stars] : 0);
if (posix_memalign((void*)gparts, gpart_align, if (posix_memalign((void*)gparts, gpart_align,
*Ngparts * sizeof(struct gpart)) != 0) *Ngparts * sizeof(struct gpart)) != 0)
error("Error while allocating memory for gravity particles"); error("Error while allocating memory for gravity particles");
...@@ -655,10 +655,10 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units, ...@@ -655,10 +655,10 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
} }
break; break;
case swift_type_star: case swift_type_stars:
if (with_stars) { if (with_stars) {
Nparticles = *Nstars; Nparticles = *Nstars;
star_read_particles(*sparts, list, &num_fields); stars_read_particles(*sparts, list, &num_fields);
} }
break; break;
...@@ -700,9 +700,9 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units, ...@@ -700,9 +700,9 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
/* Duplicate the hydro particles into gparts */ /* Duplicate the hydro particles into gparts */
if (with_hydro) io_duplicate_hydro_gparts(&tp, *parts, *gparts, *Ngas, Ndm); if (with_hydro) io_duplicate_hydro_gparts(&tp, *parts, *gparts, *Ngas, Ndm);
/* Duplicate the star particles into gparts */ /* Duplicate the stars particles into gparts */
if (with_stars) if (with_stars)
io_duplicate_star_gparts(&tp, *sparts, *gparts, *Nstars, Ndm + *Ngas); io_duplicate_stars_gparts(&tp, *sparts, *gparts, *Nstars, Ndm + *Ngas);
threadpool_clean(&tp); threadpool_clean(&tp);
} }
...@@ -1039,9 +1039,9 @@ void write_output_serial(struct engine* e, const char* baseName, ...@@ -1039,9 +1039,9 @@ void write_output_serial(struct engine* e, const char* baseName,
darkmatter_write_particles(dmparts, list, &num_fields); darkmatter_write_particles(dmparts, list, &num_fields);
break; break;
case swift_type_star: case swift_type_stars:
Nparticles = Nstars; Nparticles = Nstars;
star_write_particles(sparts, list, &num_fields); stars_write_particles(sparts, list, &num_fields);
break; break;
default: default:
......
...@@ -471,10 +471,10 @@ void read_ic_single(const char* fileName, ...@@ -471,10 +471,10 @@ void read_ic_single(const char* fileName,
/* Allocate memory to store star particles */ /* Allocate memory to store star particles */
if (with_stars) { if (with_stars) {
*Nstars = N[swift_type_star];