Commit 89d490fa authored by Mladen Ivkovic's avatar Mladen Ivkovic
Browse files

moved rt data struct from xparts to parts struct

parent ac9ccd2d
......@@ -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);
}
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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;
......
......@@ -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.
......
......@@ -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 */
......@@ -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;
}
......
......@@ -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 */
......@@ -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;
}
/**
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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.
......
......@@ -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 */
......@@ -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;
}
......
......@@ -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 */
......@@ -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. */
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
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