diff --git a/src/cell.c b/src/cell.c index 675b3f7781129eca81f935f9eea19e5bee83487a..f8b7297b6538c4305e60ab640480e8f6930f5219 100644 --- a/src/cell.c +++ b/src/cell.c @@ -5282,7 +5282,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) { tracers_after_init(p, xp, e->internal_units, e->physical_constants, with_cosmology, e->cosmology, e->hydro_properties, e->cooling_func, e->time); - rt_init_xpart(xp); + rt_init_part(p); } } diff --git a/src/distributed_io.c b/src/distributed_io.c index 220f6e48ef06cc80032e3f079d6fed6e42329679..df1f22f9e4fe1436e134bae735d126a6df92fc4f 100644 --- a/src/distributed_io.c +++ b/src/distributed_io.c @@ -518,7 +518,7 @@ void write_output_distributed(struct engine* e, num_fields += star_formation_write_particles(parts, xparts, list + num_fields); if (with_rt) { - num_fields += rt_write_particles(xparts, list + num_fields); + num_fields += rt_write_particles(parts, list + num_fields); } } else { @@ -563,7 +563,7 @@ void write_output_distributed(struct engine* e, num_fields += star_formation_write_particles( parts_written, xparts_written, list + num_fields); if (with_rt) { - num_fields += rt_write_particles(xparts_written, list + num_fields); + num_fields += rt_write_particles(parts_written, list + num_fields); } } } break; diff --git a/src/hydro/Gadget2/hydro_part.h b/src/hydro/Gadget2/hydro_part.h index 25dfd9353bba1dc97c498a0af21614f58fa7d179..e45b9b7c7f48c60a8ae64fd3e5d32faebc8dab65 100644 --- a/src/hydro/Gadget2/hydro_part.h +++ b/src/hydro/Gadget2/hydro_part.h @@ -72,9 +72,6 @@ struct xpart { /* Additional data used by the feedback */ struct feedback_part_data feedback_data; - /* Additional Radiative Transfer Data */ - struct rt_xpart_data rt_data; - #ifdef WITH_LOGGER /* Additional data for the particle logger */ struct logger_part_data logger_data; @@ -171,6 +168,9 @@ struct part { /*! Additional data used by the pressure floor */ struct pressure_floor_part_data pressure_floor_data; + /* Additional Radiative Transfer Data */ + struct rt_part_data rt_data; + /*! Time-step length */ timebin_t time_bin; diff --git a/src/line_of_sight.c b/src/line_of_sight.c index 0fad23b308734b22acfc803bde8598ba071822b5..3c686f99280f951a5d466d9b172c49e7c7c21a89 100644 --- a/src/line_of_sight.c +++ b/src/line_of_sight.c @@ -457,7 +457,7 @@ void write_los_hdf5_datasets(hid_t grp, const int j, const size_t N, num_fields += star_formation_write_particles(parts, xparts, list + num_fields); if (with_rt) { - num_fields += rt_write_particles(xparts, list + num_fields); + num_fields += rt_write_particles(parts, list + num_fields); } /* Loop over each output field */ diff --git a/src/parallel_io.c b/src/parallel_io.c index 5a298e370a858960e84f5a5c9a22f367fbf4c168..b34a06fb0fa648f7cbc951b8624feb1c756576e1 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -1271,7 +1271,7 @@ void prepare_file(struct engine* e, const char* fileName, velociraptor_write_parts(parts, xparts, list + num_fields); } if (with_rt) { - num_fields += rt_write_particles(xparts, list + num_fields); + num_fields += rt_write_particles(parts, list + num_fields); } break; @@ -1651,7 +1651,7 @@ void write_output_parallel(struct engine* e, num_fields += star_formation_write_particles(parts, xparts, list + num_fields); if (with_rt) { - num_fields += rt_write_particles(xparts, list + num_fields); + num_fields += rt_write_particles(parts, list + num_fields); } } else { @@ -1696,7 +1696,7 @@ void write_output_parallel(struct engine* e, num_fields += star_formation_write_particles( parts_written, xparts_written, list + num_fields); if (with_rt) { - num_fields += rt_write_particles(xparts_written, list + num_fields); + num_fields += rt_write_particles(parts_written, list + num_fields); } } } break; diff --git a/src/rt/M1closure/rt.h b/src/rt/M1closure/rt.h index 7c27dfe3ab86b251889bae59b430d3d83f474e92..0ab19a251fe1c1afdb30d2c2e534656c0133bb49 100644 --- a/src/rt/M1closure/rt.h +++ b/src/rt/M1closure/rt.h @@ -27,14 +27,14 @@ /** * @brief First initialisation of the RT extra hydro particle data. */ -__attribute__((always_inline)) INLINE static void rt_first_init_xpart( - struct xpart* restrict xp) {} +__attribute__((always_inline)) INLINE static void rt_first_init_part( + struct part* restrict p) {} /** * @brief Initialisation of the RT extra hydro particle data. */ -__attribute__((always_inline)) INLINE static void rt_init_xpart( - struct xpart* restrict xp) {} +__attribute__((always_inline)) INLINE static void rt_init_part( + struct part* restrict p) {} /** * @brief First initialisation of the RT extra star particle data. diff --git a/src/rt/M1closure/rt_iact.h b/src/rt/M1closure/rt_iact.h index af145328b86e3858473c0d242006e47b14fc14d8..05f3c4e1fc3ca4a1785ee5a6b1f76a1a11e9fb99 100644 --- a/src/rt/M1closure/rt_iact.h +++ b/src/rt/M1closure/rt_iact.h @@ -37,6 +37,6 @@ */ __attribute__((always_inline)) INLINE static void runner_iact_rt_inject( const float r2, float* dx, const float hi, const float hj, - struct spart* restrict si, struct xpart* restrict xpj) {} + struct spart* restrict si, struct part* restrict pj) {} #endif /* SWIFT_RT_IACT_M1CLOSURE_H */ diff --git a/src/rt/M1closure/rt_io.h b/src/rt/M1closure/rt_io.h index d343fb1a0feb92588f6193b40aa3498675a4add2..35e573d5b3d3f82d0482499f9e3d9bf708ec0fde 100644 --- a/src/rt/M1closure/rt_io.h +++ b/src/rt/M1closure/rt_io.h @@ -30,7 +30,7 @@ * @brief Creates additional output fields for the radiative * transfer data of hydro particles. */ -INLINE static int rt_write_particles(const struct xpart* xparts, +INLINE static int rt_write_particles(const struct part* parts, struct io_props* list) { return 0; } diff --git a/src/rt/M1closure/rt_struct.h b/src/rt/M1closure/rt_struct.h index 7b32497bc6cb5462ea6d9c64d85e459e34f92ecb..d6a51d073e8fd2741fb83b20aba8d5ef56726a34 100644 --- a/src/rt/M1closure/rt_struct.h +++ b/src/rt/M1closure/rt_struct.h @@ -24,8 +24,10 @@ * @brief Main header file for no radiative transfer struct. */ -struct rt_xpart_data {}; +/* Additional RT data in hydro particle struct */ +struct rt_part_data {}; +/* Additional RT data in star particle struct */ struct rt_spart_data {}; #endif /* SWIFT_RT_STRUCT_M1CLOSURE_H */ diff --git a/src/rt/debug/rt.h b/src/rt/debug/rt.h index c9f837786bb75808186981ff72a4f0376c6cdf10..e9a3a3f593bd335fcb3da96477a1862d0e9df0ae 100644 --- a/src/rt/debug/rt.h +++ b/src/rt/debug/rt.h @@ -27,26 +27,26 @@ /** * @brief First initialisation of the RT extra hydro particle data. */ -__attribute__((always_inline)) INLINE static void rt_first_init_xpart( - struct xpart* restrict xp) { +__attribute__((always_inline)) INLINE static void rt_first_init_part( + struct part* restrict p) { - xp->rt_data.iact_stars = 0; - xp->rt_data.calls_tot = 0; - xp->rt_data.calls_per_step = 0; - xp->rt_data.calls_self = 0; - xp->rt_data.calls_pair = 0; + p->rt_data.iact_stars = 0; + p->rt_data.calls_tot = 0; + p->rt_data.calls_per_step = 0; + p->rt_data.calls_self = 0; + p->rt_data.calls_pair = 0; } /** * @brief Initialisation of the RT extra hydro particle data. */ -__attribute__((always_inline)) INLINE static void rt_init_xpart( - struct xpart* restrict xp) { +__attribute__((always_inline)) INLINE static void rt_init_part( + struct part* restrict p) { - xp->rt_data.iact_stars = 0; - xp->rt_data.calls_per_step = 0; - xp->rt_data.calls_self = 0; - xp->rt_data.calls_pair = 0; + p->rt_data.iact_stars = 0; + p->rt_data.calls_per_step = 0; + p->rt_data.calls_self = 0; + p->rt_data.calls_pair = 0; } /** diff --git a/src/rt/debug/rt_iact.h b/src/rt/debug/rt_iact.h index ba3c800480b26c537c67aaad41ee50926d941998..cd2ec06ca1fdacdd8334c0cda30738ae7e5faadc 100644 --- a/src/rt/debug/rt_iact.h +++ b/src/rt/debug/rt_iact.h @@ -37,10 +37,10 @@ */ __attribute__((always_inline)) INLINE static void runner_iact_rt_inject( const float r2, float* dx, const float hi, const float hj, - struct spart* restrict si, struct xpart* restrict xpj) { + struct spart* restrict si, struct part* restrict pj) { struct rt_spart_data* restrict sd = &(si->rt_data); - struct rt_xpart_data* restrict pd = &(xpj->rt_data); + struct rt_part_data* restrict pd = &(pj->rt_data); sd->iact_hydro += 1; sd->calls_tot += 1; diff --git a/src/rt/debug/rt_io.h b/src/rt/debug/rt_io.h index 1af20b6440d30b817de12ec9fc793af3a10cff62..1b29a16039936361c847fbfd217358d453fb999f 100644 --- a/src/rt/debug/rt_io.h +++ b/src/rt/debug/rt_io.h @@ -30,25 +30,25 @@ * @brief Creates additional output fields for the radiative * transfer data of hydro particles. */ -INLINE static int rt_write_particles(const struct xpart* xparts, +INLINE static int rt_write_particles(const struct part* parts, struct io_props* list) { list[0] = io_make_output_field("RTStarIact", INT, 1, UNIT_CONV_NO_UNITS, 0, - xparts, rt_data.iact_stars, + parts, rt_data.iact_stars, "number of interactions between this hydro " "particle and any star particle"); list[1] = io_make_output_field( - "RTTotalCalls", INT, 1, UNIT_CONV_NO_UNITS, 0, xparts, rt_data.calls_tot, + "RTTotalCalls", INT, 1, UNIT_CONV_NO_UNITS, 0, parts, rt_data.calls_tot, "total number of calls to this particle during the run"); list[2] = io_make_output_field( - "RTCallsThisStep", INT, 1, UNIT_CONV_NO_UNITS, 0, xparts, + "RTCallsThisStep", INT, 1, UNIT_CONV_NO_UNITS, 0, parts, rt_data.calls_per_step, "number of calls to this particle during one time step"); list[3] = io_make_output_field( - "RTCallsSelf", INT, 1, UNIT_CONV_NO_UNITS, 0, xparts, rt_data.calls_self, + "RTCallsSelf", INT, 1, UNIT_CONV_NO_UNITS, 0, parts, rt_data.calls_self, "number of calls to this particle during one time step in self task"); list[4] = io_make_output_field( - "RTCallsPair", INT, 1, UNIT_CONV_NO_UNITS, 0, xparts, rt_data.calls_pair, + "RTCallsPair", INT, 1, UNIT_CONV_NO_UNITS, 0, parts, rt_data.calls_pair, "number of calls to this particle during one time step in self task"); return 5; diff --git a/src/rt/debug/rt_struct.h b/src/rt/debug/rt_struct.h index 2a4790360a10d73390ec04841e6d65f200d97a8d..7255c62c355c8c7a55b781e1bc86070153d53b2b 100644 --- a/src/rt/debug/rt_struct.h +++ b/src/rt/debug/rt_struct.h @@ -24,7 +24,8 @@ * @brief Main header file for the debug radiative transfer struct. */ -struct rt_xpart_data { +/* Additional RT data in hydro particle struct */ +struct rt_part_data { int iact_stars; /* how many stars this particle interacted with */ int calls_tot; /* total number of calls to this particle during entire run */ int calls_per_step; /* calls per time step to this particle */ @@ -32,6 +33,7 @@ struct rt_xpart_data { int calls_pair; }; +/* Additional RT data in star particle struct */ struct rt_spart_data { int iact_hydro; /* how many hydro particles this particle interacted with */ int calls_tot; /* total number of calls to this particle during entire run */ diff --git a/src/rt/none/rt.h b/src/rt/none/rt.h index dc7ec33201dc8e45cab7c4d0e08a3ac0d4992fd9..30039d8b9d4a917cc25b983e51d3f11fee2e891b 100644 --- a/src/rt/none/rt.h +++ b/src/rt/none/rt.h @@ -27,14 +27,14 @@ /** * @brief First initialisation of the RT extra hydro particle data. */ -__attribute__((always_inline)) INLINE static void rt_first_init_xpart( - struct xpart* restrict xp) {} +__attribute__((always_inline)) INLINE static void rt_first_init_part( + struct part* restrict p) {} /** * @brief Initialisation of the RT extra hydro particle data. */ -__attribute__((always_inline)) INLINE static void rt_init_xpart( - struct xpart* restrict xp) {} +__attribute__((always_inline)) INLINE static void rt_init_part( + struct part* restrict p) {} /** * @brief First initialisation of the RT extra star particle data. diff --git a/src/rt/none/rt_iact.h b/src/rt/none/rt_iact.h index 9da017fe12694eb19f27e4c3c20c739efdae9922..91be57712fb4f8fed2d21fc7d1eee6f0c44e9813 100644 --- a/src/rt/none/rt_iact.h +++ b/src/rt/none/rt_iact.h @@ -37,6 +37,6 @@ */ __attribute__((always_inline)) INLINE static void runner_iact_rt_inject( const float r2, float* dx, const float hi, const float hj, - struct spart* restrict si, struct xpart* restrict xpj) {} + struct spart* restrict si, struct part* restrict pj) {} #endif /* SWIFT_RT_IACT_NONE_H */ diff --git a/src/rt/none/rt_io.h b/src/rt/none/rt_io.h index 98aafa3f39b9f7817919f5b7cc998f86ead54207..c19fe308bc52f541fd0e2b2bd7a391946d9754b2 100644 --- a/src/rt/none/rt_io.h +++ b/src/rt/none/rt_io.h @@ -30,7 +30,7 @@ * @brief Creates additional output fields for the radiative * transfer data of hydro particles. */ -INLINE static int rt_write_particles(const struct xpart* xparts, +INLINE static int rt_write_particles(const struct part* parts, struct io_props* list) { return 0; } diff --git a/src/rt/none/rt_struct.h b/src/rt/none/rt_struct.h index 262ab80fbfa3cc4bc1e1cd5a37c83d98b52c4169..e2b46a36f1a15fc9bf8e949dac113b35e8993544 100644 --- a/src/rt/none/rt_struct.h +++ b/src/rt/none/rt_struct.h @@ -24,8 +24,10 @@ * @brief Main header file for no radiative transfer struct. */ -struct rt_xpart_data {}; +/* Additional RT data in hydro particle struct */ +struct rt_part_data {}; +/* Additional RT data in star particle struct */ struct rt_spart_data {}; #endif /* SWIFT_RT_STRUCT_NONE_H */ diff --git a/src/runner_doiact_functions_rt.h b/src/runner_doiact_functions_rt.h index f657bd716ee4df11bd8d899dfb738735dcb86e83..d05a41efdef7b15e438d9aee3e77d5593c4d67ba 100644 --- a/src/runner_doiact_functions_rt.h +++ b/src/runner_doiact_functions_rt.h @@ -45,7 +45,6 @@ void DOSELF1_RT(struct runner *r, struct cell *c, int timer) { struct spart *restrict sparts = c->stars.parts; struct part *restrict parts = c->hydro.parts; - struct xpart *restrict xparts = c->hydro.xparts; const int scount = c->stars.count; const int count = c->hydro.count; @@ -65,7 +64,6 @@ void DOSELF1_RT(struct runner *r, struct cell *c, int timer) { /* Loop over the (x)parts in cell */ for (int pid = 0; pid < count; pid++) { - struct xpart *restrict xpj = &xparts[pid]; struct part *restrict pj = &parts[pid]; /* Skip inhibited particles. */ @@ -81,7 +79,7 @@ void DOSELF1_RT(struct runner *r, struct cell *c, int timer) { float dx[3] = {six[0] - pjx[0], six[1] - pjx[1], six[2] - pjx[2]}; const float r2 = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; - if (r2 < hjg2) IACT_RT(r2, dx, hi, hj, si, xpj); + if (r2 < hjg2) IACT_RT(r2, dx, hi, hj, si, pj); } } @@ -106,7 +104,6 @@ void DOPAIR1_NONSYM_RT(struct runner *r, struct cell *ci, struct cell *cj) { const int count_j = cj->hydro.count; struct spart *restrict sparts_i = ci->stars.parts; struct part *restrict parts_j = cj->hydro.parts; - struct xpart *restrict xparts_j = cj->hydro.xparts; /* Get the relative distance between the pairs, wrapping. */ double shift[3] = {0.0, 0.0, 0.0}; @@ -136,7 +133,6 @@ void DOPAIR1_NONSYM_RT(struct runner *r, struct cell *ci, struct cell *cj) { /* Get a pointer to the jth particle. */ struct part *restrict pj = &parts_j[pjd]; - struct xpart *restrict xpj = &xparts_j[pjd]; const float hj = pj->h; const float hjg2 = hj * hj * kernel_gamma2; @@ -150,7 +146,7 @@ void DOPAIR1_NONSYM_RT(struct runner *r, struct cell *ci, struct cell *cj) { float dx[3] = {six[0] - pjx[0], six[1] - pjx[1], six[2] - pjx[2]}; const float r2 = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; - if (r2 < hjg2) IACT_RT(r2, dx, hi, hj, si, xpj); + if (r2 < hjg2) IACT_RT(r2, dx, hi, hj, si, pj); } /* loop over the parts in cj. */ } /* loop over the parts in ci. */ diff --git a/src/serial_io.c b/src/serial_io.c index 2f59f17739dd05c8e9aa336814a600b6553ae004..5381e4c4fcc9805b7cd57cc9c72877ad6c99eed8 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -1227,7 +1227,7 @@ void write_output_serial(struct engine* e, num_fields += star_formation_write_particles(parts, xparts, list + num_fields); if (with_rt) { - num_fields += rt_write_particles(xparts, list + num_fields); + num_fields += rt_write_particles(parts, list + num_fields); } } else { @@ -1275,7 +1275,7 @@ void write_output_serial(struct engine* e, parts_written, xparts_written, list + num_fields); if (with_rt) { num_fields += - rt_write_particles(xparts_written, list + num_fields); + rt_write_particles(parts_written, list + num_fields); } } } break; diff --git a/src/single_io.c b/src/single_io.c index e52d2c531601693580980d2762aea033a8a474fc..d978e4c4726cc6a1d7bdd102cdfa70d52f675c38 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -1019,7 +1019,7 @@ void write_output_single(struct engine* e, num_fields += star_formation_write_particles(parts, xparts, list + num_fields); if (with_rt) { - num_fields += rt_write_particles(xparts, list + num_fields); + num_fields += rt_write_particles(parts, list + num_fields); } } else { @@ -1064,7 +1064,7 @@ void write_output_single(struct engine* e, num_fields += star_formation_write_particles( parts_written, xparts_written, list + num_fields); if (with_rt) { - num_fields += rt_write_particles(xparts_written, list + num_fields); + num_fields += rt_write_particles(parts_written, list + num_fields); } } } break; diff --git a/src/space.c b/src/space.c index 78ea6a3e81fb9a4046495b9f2fec066c9bacefe3..83b2bf327505dbb0542e485d1e4d4db77ec4fc94 100644 --- a/src/space.c +++ b/src/space.c @@ -4926,7 +4926,7 @@ void space_first_init_parts_mapper(void *restrict map_data, int count, black_holes_mark_part_as_not_swallowed(&p[k].black_holes_data); /* And the radiative transfer */ - rt_first_init_xpart(&xp[k]); + rt_first_init_part(&p[k]); #ifdef SWIFT_DEBUG_CHECKS /* Check part->gpart->part linkeage. */ @@ -5283,7 +5283,7 @@ void space_init_parts_mapper(void *restrict map_data, int count, black_holes_init_potential(&parts[k].black_holes_data); chemistry_init_part(&parts[k], e->chemistry); pressure_floor_init_part(&parts[k], &xparts[k]); - rt_init_xpart(&xparts[k]); + rt_init_part(&parts[k]); star_formation_init_part(&parts[k], e->star_formation); tracers_after_init(&parts[k], &xparts[k], e->internal_units, e->physical_constants, with_cosmology, e->cosmology,