Skip to content
Snippets Groups Projects
Commit 4e106f07 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

remember at which step the cell was last sorted, enforce during drift that no...

remember at which step the cell was last sorted, enforce during drift that no sort is older than its sub-cell sorts.
parent b49192e6
No related branches found
No related tags found
1 merge request!327Rebuild criteria
...@@ -1097,7 +1097,7 @@ void cell_drift(struct cell *c, const struct engine *e) { ...@@ -1097,7 +1097,7 @@ void cell_drift(struct cell *c, const struct engine *e) {
/* Drift from the last time the cell was drifted to the current time */ /* Drift from the last time the cell was drifted to the current time */
const double dt = (ti_current - ti_old) * timeBase; const double dt = (ti_current - ti_old) * timeBase;
float dx_max = 0.f, dx2_max = 0.f; float dx_max = 0.f, dx2_max = 0.f;
float dx_max_sort = c->dx_max_sort, dx2_max_sort = 0.f; float dx_max_sort = 0.0f, dx2_max_sort = 0.f;
float h_max = 0.f; float h_max = 0.f;
/* Check that we are actually going to move forward. */ /* Check that we are actually going to move forward. */
...@@ -1114,6 +1114,10 @@ void cell_drift(struct cell *c, const struct engine *e) { ...@@ -1114,6 +1114,10 @@ void cell_drift(struct cell *c, const struct engine *e) {
dx_max = max(dx_max, cp->dx_max); dx_max = max(dx_max, cp->dx_max);
dx_max_sort = max(dx_max_sort, cp->dx_max_sort); dx_max_sort = max(dx_max_sort, cp->dx_max_sort);
h_max = max(h_max, cp->h_max); h_max = max(h_max, cp->h_max);
if (cp->ti_sort > c->ti_sort)
c->sorted = 0;
else
c->sorted &= cp->sorted;
} }
} else if (ti_current > ti_old) { } else if (ti_current > ti_old) {
...@@ -1162,7 +1166,7 @@ void cell_drift(struct cell *c, const struct engine *e) { ...@@ -1162,7 +1166,7 @@ void cell_drift(struct cell *c, const struct engine *e) {
/* Now, get the maximal particle motion from its square */ /* Now, get the maximal particle motion from its square */
dx_max = sqrtf(dx2_max); dx_max = sqrtf(dx2_max);
dx_max_sort = max(dx_max_sort, sqrtf(dx2_max_sort)); dx_max_sort = sqrtf(dx2_max_sort);
} else { } else {
......
...@@ -227,6 +227,9 @@ struct cell { ...@@ -227,6 +227,9 @@ struct cell {
/*! Last (integer) time the cell's content was drifted forward in time. */ /*! Last (integer) time the cell's content was drifted forward in time. */
integertime_t ti_old; integertime_t ti_old;
/*! Last (integer) time the cell's sort arrays were updated. */
integertime_t ti_sort;
/*! Minimum dimension, i.e. smallest edge of this cell (min(width)). */ /*! Minimum dimension, i.e. smallest edge of this cell (min(width)). */
float dmin; float dmin;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment