Commit b1d4452a authored by lhausamm's avatar lhausamm Committed by Loic Hausammann
Browse files

Move last_output to xpart

parent 672f2d89
......@@ -447,14 +447,14 @@ __attribute__((always_inline)) INLINE static int spart_is_starting(
/**
* @brief Should this particle write its data now ?
*
* @param p The #part.
* @param xp The #xpart.
* @param e The #engine containing information about the current time.
* @return 1 if the #part should write, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int part_should_write(
const struct part *p, const struct engine *e) {
__attribute__((always_inline)) INLINE static int xpart_should_write(
const struct xpart *xp, const struct engine *e) {
return (p->last_output > e->logger_max_steps);
return (xp->last_output > e->logger_max_steps);
}
/**
......@@ -465,9 +465,9 @@ __attribute__((always_inline)) INLINE static int part_should_write(
* @return 1 if the #gpart should write, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int gpart_should_write(
const struct gpart *p, const struct engine *e) {
const struct gpart *gp, const struct engine *e) {
return (p->last_output > e->logger_max_steps);
return (gp->last_output > e->logger_max_steps);
}
/**
......@@ -478,9 +478,9 @@ __attribute__((always_inline)) INLINE static int gpart_should_write(
* @return 1 if the #spart should write, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int spart_should_write(
const struct spart *p, const struct engine *e) {
const struct spart *sp, const struct engine *e) {
return (p->last_output > e->logger_max_steps);
return (sp->last_output > e->logger_max_steps);
}
#endif /* SWIFT_ACTIVE_H */
......@@ -743,8 +743,8 @@ __attribute__((always_inline)) INLINE static void hydro_first_init_part(
struct part *restrict p, struct xpart *restrict xp) {
p->time_bin = 0;
p->last_output = 0;
p->last_offset = 0;
xp->last_output = 0;
xp->v_full[0] = p->v[0];
xp->v_full[1] = p->v[1];
xp->v_full[2] = p->v[2];
......
......@@ -55,6 +55,9 @@ struct xpart {
/* Additional data used to record cooling information */
struct cooling_xpart_data cooling_data;
/* Number of time step since last output */
short int last_output;
} SWIFT_STRUCT_ALIGN;
/* Data of a single particle. */
......@@ -90,9 +93,6 @@ struct part {
/* Entropy time derivative */
float entropy_dt;
/* Number of time step since last output */
short int last_output;
/* offset at last writing */
size_t last_offset;
......
......@@ -2705,7 +2705,7 @@ void runner_do_logger(struct runner *r, struct cell *c, int timer) {
const struct engine *e = r->e;
struct part *restrict parts = c->parts;
//struct xpart *restrict xparts = c->xparts;
struct xpart *restrict xparts = c->xparts;
struct gpart *restrict gparts = c->gparts;
struct spart *restrict sparts = c->sparts;
const int count = c->count;
......@@ -2730,12 +2730,12 @@ void runner_do_logger(struct runner *r, struct cell *c, int timer) {
/* Get a handle on the part. */
struct part *restrict p = &parts[k];
//struct xpart *restrict xp = &xparts[k];
struct xpart *restrict xp = &xparts[k];
/* If particle needs to be kicked */
if (part_is_starting(p, e)) {
if (part_should_write(p, e))
if (xpart_should_write(xp, e))
{
/* Write particle */
logger_log_part(p, logger_mask_x | logger_mask_v | logger_mask_a |
......@@ -2744,11 +2744,11 @@ void runner_do_logger(struct runner *r, struct cell *c, int timer) {
&p->last_offset, e->logger_dump);
//message("Offset: %lu", p->last_offset);
/* Set counter back to zero */
p->last_output = 0;
xp->last_output = 0;
}
else
/* Update counter */
p->last_output += 1;
xp->last_output += 1;
}
}
......
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