Commit 8edac39d authored by Mladen Ivkovic's avatar Mladen Ivkovic

moved rt_write_* functions to correct files

parent d0aae46a
......@@ -42,6 +42,7 @@
#include "kernel_hydro.h"
#include "part.h"
#include "part_type.h"
#include "rt_io.h"
#include "sink_io.h"
#include "star_formation_io.h"
#include "stars_io.h"
......@@ -2867,6 +2868,7 @@ int get_ptype_fields(const int ptype, struct io_props* list,
num_fields += fof_write_parts(NULL, NULL, list + num_fields);
if (with_stf)
num_fields += velociraptor_write_parts(NULL, NULL, list + num_fields);
num_fields += rt_write_particles(NULL, list + num_fields);
break;
case swift_type_dark_matter:
......@@ -2892,6 +2894,7 @@ int get_ptype_fields(const int ptype, struct io_props* list,
if (with_fof) num_fields += fof_write_sparts(NULL, list + num_fields);
if (with_stf)
num_fields += velociraptor_write_sparts(NULL, list + num_fields);
num_fields += rt_write_stars(NULL, list + num_fields);
break;
case swift_type_sink:
......
......@@ -54,6 +54,7 @@
#include "output_options.h"
#include "part.h"
#include "part_type.h"
#include "rt_io.h"
#include "sink_io.h"
#include "star_formation_io.h"
#include "stars_io.h"
......@@ -268,6 +269,7 @@ void write_output_distributed(struct engine* e,
const int with_temperature = e->policy & engine_policy_temperature;
const int with_fof = e->policy & engine_policy_fof;
const int with_DM_background = e->s->with_DM_background;
const int with_rt = e->policy & engine_policy_rt;
#ifdef HAVE_VELOCIRAPTOR
const int with_stf = (e->policy & engine_policy_structure_finding) &&
(e->s->gpart_group_data != NULL);
......@@ -515,6 +517,9 @@ void write_output_distributed(struct engine* e,
parts, xparts, list + num_fields, with_cosmology);
num_fields +=
star_formation_write_particles(parts, xparts, list + num_fields);
if (with_rt) {
num_fields += rt_write_particles(xparts, list + num_fields);
}
} else {
......@@ -557,6 +562,9 @@ void write_output_distributed(struct engine* e,
parts_written, xparts_written, list + num_fields, with_cosmology);
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);
}
}
} break;
......@@ -691,6 +699,9 @@ void write_output_distributed(struct engine* e,
if (with_stf) {
num_fields += velociraptor_write_sparts(sparts, list + num_fields);
}
if (with_rt) {
num_fields += rt_write_stars(sparts, list + num_fields);
}
} else {
/* Ok, we need to fish out the particles we want */
......@@ -720,6 +731,9 @@ void write_output_distributed(struct engine* e,
num_fields +=
velociraptor_write_sparts(sparts_written, list + num_fields);
}
if (with_rt) {
num_fields += rt_write_stars(sparts_written, list + num_fields);
}
}
} break;
......
......@@ -24,7 +24,6 @@
#include "hydro_parameters.h"
#include "io_properties.h"
#include "kernel_hydro.h"
#include "rt_io.h"
/**
* @brief Specifies which particle fields to read from a dataset
......@@ -207,9 +206,6 @@ INLINE static void hydro_write_particles(const struct part* parts,
UNIT_CONV_NO_UNITS, parts, ids_ngbs_force);
#endif
/* add radiative transfer data */
rt_write_xparts(xparts, list, num_fields);
}
/**
......
......@@ -36,6 +36,7 @@
#include "kernel_hydro.h"
#include "line_of_sight.h"
#include "periodic.h"
#include "rt_io.h"
#include "star_formation_io.h"
#include "tracers_io.h"
#include "velociraptor_io.h"
......@@ -432,6 +433,7 @@ void write_los_hdf5_datasets(hid_t grp, const int j, const size_t N,
#else
const int with_stf = 0;
#endif
const int with_rt = e->policy & engine_policy_rt;
int num_fields = 0;
struct io_props list[100];
......@@ -454,6 +456,9 @@ void write_los_hdf5_datasets(hid_t grp, const int j, const size_t N,
tracers_write_particles(parts, xparts, list + num_fields, with_cosmology);
num_fields +=
star_formation_write_particles(parts, xparts, list + num_fields);
if (with_rt) {
num_fields += rt_write_particles(xparts, list + num_fields);
}
/* Loop over each output field */
for (int i = 0; i < num_fields; i++) {
......
......@@ -55,6 +55,7 @@
#include "output_options.h"
#include "part.h"
#include "part_type.h"
#include "rt_io.h"
#include "sink_io.h"
#include "star_formation_io.h"
#include "stars_io.h"
......@@ -1129,6 +1130,7 @@ void prepare_file(struct engine* e, const char* fileName,
#else
const int with_stf = 0;
#endif
const int with_rt = e->policy & engine_policy_rt;
FILE* xmfFile = 0;
int numFiles = 1;
......@@ -1268,6 +1270,9 @@ void prepare_file(struct engine* e, const char* fileName,
num_fields +=
velociraptor_write_parts(parts, xparts, list + num_fields);
}
if (with_rt) {
num_fields += rt_write_particles(xparts, list + num_fields);
}
break;
case swift_type_dark_matter:
......@@ -1309,6 +1314,9 @@ void prepare_file(struct engine* e, const char* fileName,
if (with_stf) {
num_fields += velociraptor_write_sparts(sparts, list + num_fields);
}
if (with_rt) {
num_fields += rt_write_stars(sparts, list + num_fields);
}
break;
case swift_type_black_hole:
......@@ -1370,7 +1378,7 @@ void prepare_file(struct engine* e, const char* fileName,
/**
* @brief Writes an HDF5 output file (GADGET-3 type) with
*its XMF descriptor
* its XMF descriptor
*
* @param e The engine containing all the system.
* @param internal_units The #unit_system used internally
......@@ -1413,6 +1421,7 @@ void write_output_parallel(struct engine* e,
#else
const int with_stf = 0;
#endif
const int with_rt = e->policy & engine_policy_rt;
/* Number of particles currently in the arrays */
const size_t Ntot = e->s->nr_gparts;
......@@ -1641,6 +1650,9 @@ void write_output_parallel(struct engine* e,
parts, xparts, list + num_fields, with_cosmology);
num_fields +=
star_formation_write_particles(parts, xparts, list + num_fields);
if (with_rt) {
num_fields += rt_write_particles(xparts, list + num_fields);
}
} else {
......@@ -1683,6 +1695,9 @@ void write_output_parallel(struct engine* e,
parts_written, xparts_written, list + num_fields, with_cosmology);
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);
}
}
} break;
......@@ -1818,6 +1833,10 @@ void write_output_parallel(struct engine* e,
if (with_stf) {
num_fields += velociraptor_write_sparts(sparts, list + num_fields);
}
if (with_rt) {
num_fields += rt_write_stars(sparts, list + num_fields);
}
} else {
/* Ok, we need to fish out the particles we want */
......@@ -1849,6 +1868,9 @@ void write_output_parallel(struct engine* e,
num_fields +=
velociraptor_write_sparts(sparts_written, list + num_fields);
}
if (with_rt) {
num_fields += rt_write_stars(sparts_written, list + num_fields);
}
}
} break;
......
......@@ -27,16 +27,20 @@
*/
/**
* @brief Creates additional output fields for the radiative transfer data of
* hydro particles. Intended to be called from inside hydro_write_particles().
* @brief Creates additional output fields for the radiative
* transfer data of hydro particles.
*/
INLINE static void rt_write_xparts(const struct xpart* xparts,
struct io_props* list, int* num_fields) {}
INLINE static int rt_write_particles(const struct xpart* xparts,
struct io_props* list) {
return 0;
}
/**
* @brief Creates additional output fields for the radiative transfer data of
* star particles. Intended to be called from inside hydro_write_particles().
* @brief Creates additional output fields for the radiative
* transfer data of star particles.
*/
INLINE static void rt_write_stars(const struct spart* sparts,
struct io_props* list, int* num_fields) {}
INLINE static int rt_write_stars(const struct spart* sparts,
struct io_props* list) {
return 0;
}
#endif /* SWIFT_RT_IO_M1CLOSURE_H */
......@@ -27,66 +27,64 @@
*/
/**
* @brief Creates additional output fields for the radiative transfer data of
* hydro particles. Intended to be called from inside hydro_write_particles().
* @brief Creates additional output fields for the radiative
* transfer data of hydro particles.
*/
INLINE static void rt_write_xparts(const struct xpart* xparts,
struct io_props* list, int* num_fields) {
INLINE static int rt_write_particles(const struct xpart* xparts,
struct io_props* list) {
list += *num_fields;
*num_fields += 5;
list[0] = io_make_output_field("RT_star_iact", INT, 1, UNIT_CONV_NO_UNITS,
1.f, xparts, rt_data.iact_stars,
list[0] = io_make_output_field("RTStarIact", INT, 1, UNIT_CONV_NO_UNITS, 1.f,
xparts, rt_data.iact_stars,
"number of interactions between this hydro "
"particle and any star particle");
list[1] = io_make_output_field(
"RT_total_calls", INT, 1, UNIT_CONV_NO_UNITS, 1.f, xparts,
"RTTotalCalls", INT, 1, UNIT_CONV_NO_UNITS, 1.f, xparts,
rt_data.calls_tot,
"total number of calls to this particle during the run");
list[2] = io_make_output_field(
"RT_calls_this_step", INT, 1, UNIT_CONV_NO_UNITS, 1.f, xparts,
"RTCallsThisStep", INT, 1, UNIT_CONV_NO_UNITS, 1.f, xparts,
rt_data.calls_per_step,
"number of calls to this particle during one time step");
list[3] = io_make_output_field(
"RT_calls_self", INT, 1, UNIT_CONV_NO_UNITS, 1.f, xparts,
"RTCallsSelf", INT, 1, UNIT_CONV_NO_UNITS, 1.f, xparts,
rt_data.calls_self,
"number of calls to this particle during one time step in self task");
list[4] = io_make_output_field(
"RT_calls_pair", INT, 1, UNIT_CONV_NO_UNITS, 1.f, xparts,
"RTCallsPair", INT, 1, UNIT_CONV_NO_UNITS, 1.f, xparts,
rt_data.calls_pair,
"number of calls to this particle during one time step in self task");
return (5);
}
/**
* @brief Creates additional output fields for the radiative transfer data of
* star particles. Intended to be called from inside hydro_write_particles().
* @brief Creates additional output fields for the radiative
* transfer data of star particles.
*/
INLINE static void rt_write_stars(const struct spart* sparts,
struct io_props* list, int* num_fields) {
INLINE static int rt_write_stars(const struct spart* sparts,
struct io_props* list) {
list += *num_fields;
*num_fields += 5;
list[0] = io_make_output_field("RT_hydro_iact", INT, 1, UNIT_CONV_NO_UNITS,
1.f, sparts, rt_data.iact_hydro,
list[0] = io_make_output_field("RTHydroIact", INT, 1, UNIT_CONV_NO_UNITS, 1.f,
sparts, rt_data.iact_hydro,
"number of interactions between this hydro "
"particle and any star particle");
list[1] = io_make_output_field(
"RT_total_calls", INT, 1, UNIT_CONV_NO_UNITS, 1.f, sparts,
"RTRotalCalls", INT, 1, UNIT_CONV_NO_UNITS, 1.f, sparts,
rt_data.calls_tot,
"total number of calls to this particle during the run");
list[2] = io_make_output_field(
"RT_calls_this_step", INT, 1, UNIT_CONV_NO_UNITS, 1.f, sparts,
"RTCallsThisStep", INT, 1, UNIT_CONV_NO_UNITS, 1.f, sparts,
rt_data.calls_per_step,
"number of calls to this particle during one time step");
list[3] = io_make_output_field(
"RT_calls_self", INT, 1, UNIT_CONV_NO_UNITS, 1.f, sparts,
"RTCallsSelf", INT, 1, UNIT_CONV_NO_UNITS, 1.f, sparts,
rt_data.calls_self,
"number of calls to this particle during one time step in self task");
list[4] = io_make_output_field(
"RT_calls_pair", INT, 1, UNIT_CONV_NO_UNITS, 1.f, sparts,
"RTCallsPair", INT, 1, UNIT_CONV_NO_UNITS, 1.f, sparts,
rt_data.calls_pair,
"number of calls to this particle during one time step in self task");
return (5);
}
#endif /* SWIFT_RT_IO_DEBUG_H */
......@@ -27,16 +27,20 @@
*/
/**
* @brief Creates additional output fields for the radiative transfer data of
* hydro particles. Intended to be called from inside hydro_write_particles().
* @brief Creates additional output fields for the radiative
* transfer data of hydro particles.
*/
INLINE static void rt_write_xparts(const struct xpart* xparts,
struct io_props* list, int* num_fields) {}
INLINE static int rt_write_particles(const struct xpart* xparts,
struct io_props* list) {
return 0;
}
/**
* @brief Creates additional output fields for the radiative transfer data of
* star particles. Intended to be called from inside hydro_write_particles().
* @brief Creates additional output fields for the radiative
* transfer data of star particles.
*/
INLINE static void rt_write_stars(const struct spart* sparts,
struct io_props* list, int* num_fields) {}
INLINE static int rt_write_stars(const struct spart* sparts,
struct io_props* list) {
return 0;
}
#endif /* SWIFT_RT_IO_NONE_H */
......@@ -55,6 +55,7 @@
#include "output_options.h"
#include "part.h"
#include "part_type.h"
#include "rt_io.h"
#include "sink_io.h"
#include "star_formation_io.h"
#include "stars_io.h"
......@@ -938,6 +939,7 @@ void write_output_serial(struct engine* e,
#else
const int with_stf = 0;
#endif
const int with_rt = e->policy & engine_policy_rt;
FILE* xmfFile = 0;
......@@ -1224,6 +1226,9 @@ void write_output_serial(struct engine* e,
parts, xparts, list + num_fields, with_cosmology);
num_fields += star_formation_write_particles(parts, xparts,
list + num_fields);
if (with_rt) {
num_fields += rt_write_particles(xparts, list + num_fields);
}
} else {
......@@ -1268,6 +1273,10 @@ void write_output_serial(struct engine* e,
list + num_fields, with_cosmology);
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);
}
}
} break;
......@@ -1411,6 +1420,9 @@ void write_output_serial(struct engine* e,
num_fields +=
velociraptor_write_sparts(sparts, list + num_fields);
}
if (with_rt) {
num_fields += rt_write_stars(sparts, list + num_fields);
}
} else {
/* Ok, we need to fish out the particles we want */
......@@ -1443,6 +1455,9 @@ void write_output_serial(struct engine* e,
num_fields += velociraptor_write_sparts(sparts_written,
list + num_fields);
}
if (with_rt) {
num_fields += rt_write_stars(sparts_written, list + num_fields);
}
}
} break;
......
......@@ -55,6 +55,7 @@
#include "output_options.h"
#include "part.h"
#include "part_type.h"
#include "rt_io.h"
#include "sink_io.h"
#include "star_formation_io.h"
#include "stars_io.h"
......@@ -795,6 +796,7 @@ void write_output_single(struct engine* e,
#else
const int with_stf = 0;
#endif
const int with_rt = e->policy & engine_policy_rt;
/* Number of particles currently in the arrays */
const size_t Ntot = e->s->nr_gparts;
......@@ -1016,6 +1018,9 @@ void write_output_single(struct engine* e,
parts, xparts, list + num_fields, with_cosmology);
num_fields +=
star_formation_write_particles(parts, xparts, list + num_fields);
if (with_rt) {
num_fields += rt_write_particles(xparts, list + num_fields);
}
} else {
......@@ -1058,6 +1063,9 @@ void write_output_single(struct engine* e,
parts_written, xparts_written, list + num_fields, with_cosmology);
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);
}
}
} break;
......@@ -1193,6 +1201,9 @@ void write_output_single(struct engine* e,
if (with_stf) {
num_fields += velociraptor_write_sparts(sparts, list + num_fields);
}
if (with_rt) {
num_fields += rt_write_stars(sparts, list + num_fields);
}
} else {
/* Ok, we need to fish out the particles we want */
......@@ -1224,6 +1235,9 @@ void write_output_single(struct engine* e,
num_fields +=
velociraptor_write_sparts(sparts_written, list + num_fields);
}
if (with_rt) {
num_fields += rt_write_stars(sparts_written, list + num_fields);
}
}
} break;
......
......@@ -20,7 +20,6 @@
#define SWIFT_GEAR_STARS_IO_H
#include "io_properties.h"
#include "rt_io.h"
#include "stars_part.h"
/**
......@@ -162,8 +161,6 @@ INLINE static void stars_write_particles(const struct spart *sparts,
MAX_NUM_OF_NEIGHBOURS_STARS,
UNIT_CONV_NO_UNITS, sparts, ids_ngbs_force);
#endif
rt_write_stars(sparts, list, num_fields);
}
/**
......
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