Skip to content
Snippets Groups Projects
Commit f4daa0f3 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added debugging function to crash if trying to write an inhibited particle to a snapshot.

parent 2bc335b9
No related branches found
No related tags found
1 merge request!632Add functions to permanently remove particles from a simulation
...@@ -128,6 +128,16 @@ INLINE static void convert_part_potential(const struct engine* e, ...@@ -128,6 +128,16 @@ INLINE static void convert_part_potential(const struct engine* e,
ret[0] = 0.f; ret[0] = 0.f;
} }
INLINE static void convert_part_inhibited(const struct engine* e,
const struct part* p,
const struct xpart* xp, float* ret) {
if (p->time_bin == time_bin_inhibited)
error("Writing inhibited particle to the snapshot!");
ret[0] = p->time_bin;
}
/** /**
* @brief Specifies which particle fields to write to a dataset * @brief Specifies which particle fields to write to a dataset
* *
...@@ -141,7 +151,7 @@ INLINE static void hydro_write_particles(const struct part* parts, ...@@ -141,7 +151,7 @@ INLINE static void hydro_write_particles(const struct part* parts,
struct io_props* list, struct io_props* list,
int* num_fields) { int* num_fields) {
*num_fields = 10; *num_fields = 12;
/* List what we want to write */ /* List what we want to write */
list[0] = io_make_output_field_convert_part("Coordinates", DOUBLE, 3, list[0] = io_make_output_field_convert_part("Coordinates", DOUBLE, 3,
...@@ -169,6 +179,13 @@ INLINE static void hydro_write_particles(const struct part* parts, ...@@ -169,6 +179,13 @@ INLINE static void hydro_write_particles(const struct part* parts,
UNIT_CONV_POTENTIAL, parts, UNIT_CONV_POTENTIAL, parts,
xparts, convert_part_potential); xparts, convert_part_potential);
list[10] = io_make_output_field("Timebin", CHAR, 1, UNIT_CONV_NO_UNITS, parts,
time_bin);
list[11] = io_make_output_field_convert_part("Inhibited", FLOAT, 1,
UNIT_CONV_NO_UNITS, parts,
xparts, convert_part_inhibited);
#ifdef DEBUG_INTERACTIONS_SPH #ifdef DEBUG_INTERACTIONS_SPH
list += *num_fields; list += *num_fields;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment