Skip to content
Snippets Groups Projects
Commit 7126bd32 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added debugging checks to the pair and self tasks to make sure cells have been...

Added debugging checks to the pair and self tasks to make sure cells have been drifted to this point before they get updated.
parent 6010f1da
Branches
Tags
No related merge requests found
...@@ -28,6 +28,34 @@ ...@@ -28,6 +28,34 @@
#include "engine.h" #include "engine.h"
#include "part.h" #include "part.h"
/**
* @brief Check that a cell been drifted to the current time.
*
* Only used for debugging. Calls error() if the cell has not
* been drifted. Does nothing if SWIFT_DEBUG_CHECKS is not defined.
*
* @param c The #cell.
* @param e The #engine containing information about the current time.
*/
__attribute__((always_inline)) INLINE static void cell_is_drifted(
const struct cell *c, const struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS
if (c->ti_old > e->ti_current)
error(
"Cell has been drifted too far forward in time! c->ti_old=%d "
"e->ti_current=%d",
c->ti_old, e->ti_current);
if (c->ti_old != e->ti_current) {
error(
"Cell has not been drifted to the current time c->ti_old=%d, "
"e->ti_current=%d",
c->ti_old, e->ti_current);
}
#endif
}
/** /**
* @brief Does a cell contain any active particle ? * @brief Does a cell contain any active particle ?
* *
......
...@@ -721,6 +721,11 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) { ...@@ -721,6 +721,11 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) {
/* Anything to do here? */ /* Anything to do here? */
if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) return; if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) return;
#ifdef SWIFT_DEBUG_CHECKS
cell_is_drifted(ci, e);
cell_is_drifted(cj, e);
#endif
/* Get the sort ID. */ /* Get the sort ID. */
double shift[3] = {0.0, 0.0, 0.0}; double shift[3] = {0.0, 0.0, 0.0};
const int sid = space_getsid(e->s, &ci, &cj, shift); const int sid = space_getsid(e->s, &ci, &cj, shift);
...@@ -913,6 +918,11 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { ...@@ -913,6 +918,11 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) {
/* Anything to do here? */ /* Anything to do here? */
if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) return; if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) return;
#ifdef SWIFT_DEBUG_CHECKS
cell_is_drifted(ci, e);
cell_is_drifted(cj, e);
#endif
/* Get the shift ID. */ /* Get the shift ID. */
double shift[3] = {0.0, 0.0, 0.0}; double shift[3] = {0.0, 0.0, 0.0};
const int sid = space_getsid(e->s, &ci, &cj, shift); const int sid = space_getsid(e->s, &ci, &cj, shift);
...@@ -1303,6 +1313,10 @@ void DOSELF1(struct runner *r, struct cell *restrict c) { ...@@ -1303,6 +1313,10 @@ void DOSELF1(struct runner *r, struct cell *restrict c) {
if (!cell_is_active(c, e)) return; if (!cell_is_active(c, e)) return;
#ifdef SWIFT_DEBUG_CHECKS
cell_is_drifted(ci, e);
#endif
struct part *restrict parts = c->parts; struct part *restrict parts = c->parts;
const int count = c->count; const int count = c->count;
...@@ -1534,6 +1548,10 @@ void DOSELF2(struct runner *r, struct cell *restrict c) { ...@@ -1534,6 +1548,10 @@ void DOSELF2(struct runner *r, struct cell *restrict c) {
if (!cell_is_active(c, e)) return; if (!cell_is_active(c, e)) return;
#ifdef SWIFT_DEBUG_CHECKS
cell_is_drifted(ci, e);
#endif
struct part *restrict parts = c->parts; struct part *restrict parts = c->parts;
const int count = c->count; const int count = c->count;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment