diff --git a/src/space.c b/src/space.c index df260d9bdb1eede2e0be26e5b4f6638b4e88475a..9439fe98f331779d53876e2ff75e9651617fc19e 100644 --- a/src/space.c +++ b/src/space.c @@ -710,20 +710,6 @@ void space_allocate_extras(struct space *s, int verbose) { 0.5 * cells[0].width[1], 0.5 * cells[0].width[2]}; - /* The dithering vector - * Note that we use the old dithering vector here since - * (new - old) will be added to all positions further down */ - const double pos_dithering[3] = {s->pos_dithering_old[0], - s->pos_dithering_old[1], - s->pos_dithering_old[2]}; -#ifdef SWIFT_DEBUG_CHECKS - if (!s->e->gravity_properties->with_dithering) { - if (s->pos_dithering[0] != 0. || s->pos_dithering[1] != 0. || - s->pos_dithering[2] != 0.) - error("Non-zero dithering vector when dithering is off!"); - } -#endif - /* The current number of particles (including spare ones) */ size_t nr_parts = s->nr_parts; size_t nr_gparts = s->nr_gparts; @@ -846,12 +832,9 @@ void space_allocate_extras(struct space *s, int verbose) { if (s->gparts[i].time_bin == time_bin_not_created) { /* We want the extra particles to be at the centre of their cell */ - s->gparts[i].x[0] = - cells[current_cell].loc[0] + half_cell_width[0] - pos_dithering[0]; - s->gparts[i].x[1] = - cells[current_cell].loc[1] + half_cell_width[1] - pos_dithering[1]; - s->gparts[i].x[2] = - cells[current_cell].loc[2] + half_cell_width[2] - pos_dithering[2]; + s->gparts[i].x[0] = cells[current_cell].loc[0] + half_cell_width[0]; + s->gparts[i].x[1] = cells[current_cell].loc[1] + half_cell_width[1]; + s->gparts[i].x[2] = cells[current_cell].loc[2] + half_cell_width[2]; ++count_in_cell; count_extra_gparts++; } @@ -941,12 +924,9 @@ void space_allocate_extras(struct space *s, int verbose) { if (s->parts[i].time_bin == time_bin_not_created) { /* We want the extra particles to be at the centre of their cell */ - s->parts[i].x[0] = - cells[current_cell].loc[0] + half_cell_width[0] - pos_dithering[0]; - s->parts[i].x[1] = - cells[current_cell].loc[1] + half_cell_width[1] - pos_dithering[1]; - s->parts[i].x[2] = - cells[current_cell].loc[2] + half_cell_width[2] - pos_dithering[2]; + s->parts[i].x[0] = cells[current_cell].loc[0] + half_cell_width[0]; + s->parts[i].x[1] = cells[current_cell].loc[1] + half_cell_width[1]; + s->parts[i].x[2] = cells[current_cell].loc[2] + half_cell_width[2]; ++count_in_cell; count_extra_parts++; } @@ -1026,12 +1006,9 @@ void space_allocate_extras(struct space *s, int verbose) { if (s->sparts[i].time_bin == time_bin_not_created) { /* We want the extra particles to be at the centre of their cell */ - s->sparts[i].x[0] = - cells[current_cell].loc[0] + half_cell_width[0] - pos_dithering[0]; - s->sparts[i].x[1] = - cells[current_cell].loc[1] + half_cell_width[1] - pos_dithering[1]; - s->sparts[i].x[2] = - cells[current_cell].loc[2] + half_cell_width[2] - pos_dithering[2]; + s->sparts[i].x[0] = cells[current_cell].loc[0] + half_cell_width[0]; + s->sparts[i].x[1] = cells[current_cell].loc[1] + half_cell_width[1]; + s->sparts[i].x[2] = cells[current_cell].loc[2] + half_cell_width[2]; ++count_in_cell; count_extra_sparts++; } @@ -1111,12 +1088,9 @@ void space_allocate_extras(struct space *s, int verbose) { if (s->bparts[i].time_bin == time_bin_not_created) { /* We want the extra particles to be at the centre of their cell */ - s->bparts[i].x[0] = - cells[current_cell].loc[0] + half_cell_width[0] - pos_dithering[0]; - s->bparts[i].x[1] = - cells[current_cell].loc[1] + half_cell_width[1] - pos_dithering[1]; - s->bparts[i].x[2] = - cells[current_cell].loc[2] + half_cell_width[2] - pos_dithering[2]; + s->bparts[i].x[0] = cells[current_cell].loc[0] + half_cell_width[0]; + s->bparts[i].x[1] = cells[current_cell].loc[1] + half_cell_width[1]; + s->bparts[i].x[2] = cells[current_cell].loc[2] + half_cell_width[2]; ++count_in_cell; count_extra_bparts++; } @@ -2183,7 +2157,7 @@ void space_parts_get_cell_index_mapper(void *map_data, int nr_parts, double old_pos_y = p->x[1]; double old_pos_z = p->x[2]; - if (periodic && dithering) { + if (periodic && dithering && p->time_bin != time_bin_not_created) { old_pos_x += delta_dithering_x; old_pos_y += delta_dithering_y; old_pos_z += delta_dithering_z; @@ -2230,11 +2204,6 @@ void space_parts_get_cell_index_mapper(void *map_data, int nr_parts, cell_counts[index]++; ++count_extra_part; - /* Update the position (since we may have dithered) */ - p->x[0] = pos_x; - p->x[1] = pos_y; - p->x[2] = pos_z; - } else { /* Normal case: list its top-level cell index */ ind[k] = index; @@ -2321,7 +2290,7 @@ void space_gparts_get_cell_index_mapper(void *map_data, int nr_gparts, double old_pos_y = gp->x[1]; double old_pos_z = gp->x[2]; - if (periodic && dithering) { + if (periodic && dithering && gp->time_bin != time_bin_not_created) { old_pos_x += delta_dithering_x; old_pos_y += delta_dithering_y; old_pos_z += delta_dithering_z; @@ -2368,11 +2337,6 @@ void space_gparts_get_cell_index_mapper(void *map_data, int nr_gparts, cell_counts[index]++; ++count_extra_gpart; - /* Update the position (since we may have dithered) */ - gp->x[0] = pos_x; - gp->x[1] = pos_y; - gp->x[2] = pos_z; - } else { /* List its top-level cell index */ ind[k] = index; @@ -2465,7 +2429,7 @@ void space_sparts_get_cell_index_mapper(void *map_data, int nr_sparts, double old_pos_y = sp->x[1]; double old_pos_z = sp->x[2]; - if (periodic && dithering) { + if (periodic && dithering && sp->time_bin != time_bin_not_created) { old_pos_x += delta_dithering_x; old_pos_y += delta_dithering_y; old_pos_z += delta_dithering_z; @@ -2512,11 +2476,6 @@ void space_sparts_get_cell_index_mapper(void *map_data, int nr_sparts, cell_counts[index]++; ++count_extra_spart; - /* Update the position (since we may have dithered) */ - sp->x[0] = pos_x; - sp->x[1] = pos_y; - sp->x[2] = pos_z; - } else { /* List its top-level cell index */ ind[k] = index; @@ -2605,7 +2564,7 @@ void space_bparts_get_cell_index_mapper(void *map_data, int nr_bparts, double old_pos_y = bp->x[1]; double old_pos_z = bp->x[2]; - if (periodic && dithering) { + if (periodic && dithering && bp->time_bin != time_bin_not_created) { old_pos_x += delta_dithering_x; old_pos_y += delta_dithering_y; old_pos_z += delta_dithering_z; @@ -2652,11 +2611,6 @@ void space_bparts_get_cell_index_mapper(void *map_data, int nr_bparts, cell_counts[index]++; ++count_extra_bpart; - /* Update the position (since we may have dithered) */ - bp->x[0] = pos_x; - bp->x[1] = pos_y; - bp->x[2] = pos_z; - } else { /* List its top-level cell index */ ind[k] = index;