Commit bb257efb authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'h_max_should_be_float' into 'master'

Store h_max values as floats in the `struct cell`, as the h values themselves are also just `float`s.

See merge request !1021
parents 8828b585 61457add
...@@ -94,8 +94,11 @@ struct pcell { ...@@ -94,8 +94,11 @@ struct pcell {
/*! Hydro variables */ /*! Hydro variables */
struct { struct {
/*! Number of #part in this cell. */
int count;
/*! Maximal smoothing length. */ /*! Maximal smoothing length. */
double h_max; float h_max;
/*! Minimal integer end-of-timestep in this cell for hydro tasks */ /*! Minimal integer end-of-timestep in this cell for hydro tasks */
integertime_t ti_end_min; integertime_t ti_end_min;
...@@ -109,9 +112,6 @@ struct pcell { ...@@ -109,9 +112,6 @@ struct pcell {
/*! Integer time of the last drift of the #part in this cell */ /*! Integer time of the last drift of the #part in this cell */
integertime_t ti_old_part; integertime_t ti_old_part;
/*! Number of #part in this cell. */
int count;
} hydro; } hydro;
/*! Gravity variables */ /*! Gravity variables */
...@@ -159,7 +159,7 @@ struct pcell { ...@@ -159,7 +159,7 @@ struct pcell {
int count; int count;
/*! Maximal smoothing length. */ /*! Maximal smoothing length. */
double h_max; float h_max;
/*! Minimal integer end-of-timestep in this cell for stars tasks */ /*! Minimal integer end-of-timestep in this cell for stars tasks */
integertime_t ti_end_min; integertime_t ti_end_min;
...@@ -179,7 +179,7 @@ struct pcell { ...@@ -179,7 +179,7 @@ struct pcell {
int count; int count;
/*! Maximal smoothing length. */ /*! Maximal smoothing length. */
double h_max; float h_max;
/*! Minimal integer end-of-timestep in this cell for black hole tasks */ /*! Minimal integer end-of-timestep in this cell for black hole tasks */
integertime_t ti_end_min; integertime_t ti_end_min;
...@@ -386,9 +386,6 @@ struct cell { ...@@ -386,9 +386,6 @@ struct cell {
/*! Task for sorting the stars again after a SF event */ /*! Task for sorting the stars again after a SF event */
struct task *stars_resort; struct task *stars_resort;
/*! Max smoothing length in this cell. */
double h_max;
/*! Last (integer) time the cell's part were drifted forward in time. */ /*! Last (integer) time the cell's part were drifted forward in time. */
integertime_t ti_old_part; integertime_t ti_old_part;
...@@ -405,6 +402,9 @@ struct cell { ...@@ -405,6 +402,9 @@ struct cell {
/*! Spin lock for various uses (#part case). */ /*! Spin lock for various uses (#part case). */
swift_lock_type lock; swift_lock_type lock;
/*! Max smoothing length in this cell. */
float h_max;
/*! Maximum part movement in this cell since last construction. */ /*! Maximum part movement in this cell since last construction. */
float dx_max_part; float dx_max_part;
...@@ -569,9 +569,6 @@ struct cell { ...@@ -569,9 +569,6 @@ struct cell {
/*! Implicit tasks marking the exit of the stellar physics block of tasks */ /*! Implicit tasks marking the exit of the stellar physics block of tasks */
struct task *stars_out; struct task *stars_out;
/*! Max smoothing length in this cell. */
double h_max;
/*! Last (integer) time the cell's spart were drifted forward in time. */ /*! Last (integer) time the cell's spart were drifted forward in time. */
integertime_t ti_old_part; integertime_t ti_old_part;
...@@ -587,6 +584,9 @@ struct cell { ...@@ -587,6 +584,9 @@ struct cell {
/*! Nr of #spart this cell can hold after addition of new #spart. */ /*! Nr of #spart this cell can hold after addition of new #spart. */
int count_total; int count_total;
/*! Max smoothing length in this cell. */
float h_max;
/*! Values of h_max before the drifts, used for sub-cell tasks. */ /*! Values of h_max before the drifts, used for sub-cell tasks. */
float h_max_old; float h_max_old;
...@@ -678,9 +678,6 @@ struct cell { ...@@ -678,9 +678,6 @@ struct cell {
/*! Linked list of the tasks computing this cell's BH feedback. */ /*! Linked list of the tasks computing this cell's BH feedback. */
struct link *feedback; struct link *feedback;
/*! Max smoothing length in this cell. */
double h_max;
/*! Last (integer) time the cell's bpart were drifted forward in time. */ /*! Last (integer) time the cell's bpart were drifted forward in time. */
integertime_t ti_old_part; integertime_t ti_old_part;
...@@ -693,6 +690,9 @@ struct cell { ...@@ -693,6 +690,9 @@ struct cell {
/*! Nr of #bpart this cell can hold after addition of new #bpart. */ /*! Nr of #bpart this cell can hold after addition of new #bpart. */
int count_total; int count_total;
/*! Max smoothing length in this cell. */
float h_max;
/*! Values of h_max before the drifts, used for sub-cell tasks. */ /*! Values of h_max before the drifts, used for sub-cell tasks. */
float h_max_old; float h_max_old;
......
...@@ -472,7 +472,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) { ...@@ -472,7 +472,7 @@ void runner_do_stars_ghost(struct runner *r, struct cell *c, int timer) {
* Therefore we need to update h_max between the super- and top-levels */ * Therefore we need to update h_max between the super- and top-levels */
if (c->stars.ghost) { if (c->stars.ghost) {
for (struct cell *tmp = c->parent; tmp != NULL; tmp = tmp->parent) { for (struct cell *tmp = c->parent; tmp != NULL; tmp = tmp->parent) {
atomic_max_d(&tmp->stars.h_max, h_max); atomic_max_f(&tmp->stars.h_max, h_max);
} }
} }
...@@ -783,7 +783,7 @@ void runner_do_black_holes_density_ghost(struct runner *r, struct cell *c, ...@@ -783,7 +783,7 @@ void runner_do_black_holes_density_ghost(struct runner *r, struct cell *c,
* Therefore we need to update h_max between the super- and top-levels */ * Therefore we need to update h_max between the super- and top-levels */
if (c->black_holes.density_ghost) { if (c->black_holes.density_ghost) {
for (struct cell *tmp = c->parent; tmp != NULL; tmp = tmp->parent) { for (struct cell *tmp = c->parent; tmp != NULL; tmp = tmp->parent) {
atomic_max_d(&tmp->black_holes.h_max, h_max); atomic_max_f(&tmp->black_holes.h_max, h_max);
} }
} }
...@@ -1379,7 +1379,7 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { ...@@ -1379,7 +1379,7 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
* Therefore we need to update h_max between the super- and top-levels */ * Therefore we need to update h_max between the super- and top-levels */
if (c->hydro.ghost) { if (c->hydro.ghost) {
for (struct cell *tmp = c->parent; tmp != NULL; tmp = tmp->parent) { for (struct cell *tmp = c->parent; tmp != NULL; tmp = tmp->parent) {
atomic_max_d(&tmp->hydro.h_max, h_max); atomic_max_f(&tmp->hydro.h_max, h_max);
} }
} }
......
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