gitlab is upgraded to version 13, please report any issues and enjoy

Commit c06ca66d authored by lhausamm's avatar lhausamm
Browse files

Apply select io to all options

parent 53173af4
......@@ -261,13 +261,12 @@ int main(int argc, char *argv[]) {
}
break;
case 'o':
if (sscanf(optarg, "%s", outputFieldsFileName) != 1) {
if (myrank == 0)
{
printf("Error parsing output fields filename");
print_help_message();
}
}
if (sscanf(optarg, "%s", outputFieldsFileName) != 1) {
if (myrank == 0) {
printf("Error parsing output fields filename");
print_help_message();
}
}
break;
case 'P':
cmdparams[nparams] = optarg;
......@@ -470,9 +469,11 @@ int main(int argc, char *argv[]) {
/* Read output fields */
struct swift_params *output_fields =
(struct swift_params *)malloc(sizeof(struct swift_params));
if (output_fields == NULL) error("Error allocating memory for the output fields file.");
if (output_fields == NULL)
error("Error allocating memory for the output fields file.");
if (myrank == 0) {
message("Reading runtime output fields from file '%s'", outputFieldsFileName);
message("Reading runtime output fields from file '%s'",
outputFieldsFileName);
if (strcmp(outputFieldsFileName, "") != 0)
parser_read_file(outputFieldsFileName, output_fields);
else
......@@ -483,7 +484,8 @@ int main(int argc, char *argv[]) {
}
#ifdef WITH_MPI
/* Broadcast the parameter file */
MPI_Bcast(output_fields, sizeof(struct swift_params), MPI_BYTE, 0, MPI_COMM_WORLD);
MPI_Bcast(output_fields, sizeof(struct swift_params), MPI_BYTE, 0,
MPI_COMM_WORLD);
#endif
/* Check that we can write the snapshots by testing if the output
......
......@@ -49,48 +49,49 @@ int chemistry_write_particles(const struct part* parts, struct io_props* list) {
/* List what we want to write */
list[0] = io_make_output_field("ElementAbundance", FLOAT,
chemistry_element_count, UNIT_CONV_NO_UNITS,
parts, chemistry_data.metal_mass_fraction);
parts, chemistry_data.metal_mass_fraction, 1);
list[1] = io_make_output_field(
"SmoothedElementAbundance", FLOAT, chemistry_element_count,
UNIT_CONV_NO_UNITS, parts, chemistry_data.smoothed_metal_mass_fraction);
list[1] =
io_make_output_field("SmoothedElementAbundance", FLOAT,
chemistry_element_count, UNIT_CONV_NO_UNITS, parts,
chemistry_data.smoothed_metal_mass_fraction, 1);
list[2] =
io_make_output_field("Metallicity", FLOAT, 1, UNIT_CONV_NO_UNITS, parts,
chemistry_data.metal_mass_fraction_total);
chemistry_data.metal_mass_fraction_total, 1);
list[3] = io_make_output_field(
"SmoothedMetallicity", FLOAT, 1, UNIT_CONV_NO_UNITS, parts,
chemistry_data.smoothed_metal_mass_fraction_total);
chemistry_data.smoothed_metal_mass_fraction_total, 1);
list[4] = io_make_output_field("TotalMassFromSNIa", FLOAT, 1, UNIT_CONV_MASS,
parts, chemistry_data.mass_from_SNIa);
parts, chemistry_data.mass_from_SNIa, 1);
list[5] = io_make_output_field("MetalMassFracFromSNIa", FLOAT, 1,
UNIT_CONV_NO_UNITS, parts,
chemistry_data.metal_mass_fraction_from_SNIa);
list[5] = io_make_output_field(
"MetalMassFracFromSNIa", FLOAT, 1, UNIT_CONV_NO_UNITS, parts,
chemistry_data.metal_mass_fraction_from_SNIa, 1);
list[6] = io_make_output_field("TotalMassFromAGB", FLOAT, 1, UNIT_CONV_MASS,
parts, chemistry_data.mass_from_AGB);
parts, chemistry_data.mass_from_AGB, 1);
list[7] =
io_make_output_field("MetalMassFracFromAGB", FLOAT, 1, UNIT_CONV_NO_UNITS,
parts, chemistry_data.metal_mass_fraction_from_AGB);
list[7] = io_make_output_field(
"MetalMassFracFromAGB", FLOAT, 1, UNIT_CONV_NO_UNITS, parts,
chemistry_data.metal_mass_fraction_from_AGB, 1);
list[8] = io_make_output_field("TotalMassFromSNII", FLOAT, 1, UNIT_CONV_MASS,
parts, chemistry_data.mass_from_SNII);
parts, chemistry_data.mass_from_SNII, 1);
list[9] = io_make_output_field("MetalMassFracFromSNII", FLOAT, 1,
UNIT_CONV_NO_UNITS, parts,
chemistry_data.metal_mass_fraction_from_SNII);
list[9] = io_make_output_field(
"MetalMassFracFromSNII", FLOAT, 1, UNIT_CONV_NO_UNITS, parts,
chemistry_data.metal_mass_fraction_from_SNII, 1);
list[10] =
io_make_output_field("IronMassFracFromSNIa", FLOAT, 1, UNIT_CONV_NO_UNITS,
parts, chemistry_data.iron_mass_fraction_from_SNIa);
list[10] = io_make_output_field(
"IronMassFracFromSNIa", FLOAT, 1, UNIT_CONV_NO_UNITS, parts,
chemistry_data.iron_mass_fraction_from_SNIa, 1);
list[11] = io_make_output_field(
"SmoothedIronMassFracFromSNIa", FLOAT, 1, UNIT_CONV_NO_UNITS, parts,
chemistry_data.smoothed_iron_mass_fraction_from_SNIa);
chemistry_data.smoothed_iron_mass_fraction_from_SNIa, 1);
return 12;
}
......
......@@ -76,12 +76,13 @@ __attribute__((always_inline)) INLINE static int chemistry_write_particles(
list[0] = io_make_output_field(
"SmoothedElementAbundance", FLOAT, chemistry_element_count,
UNIT_CONV_NO_UNITS, parts, chemistry_data.smoothed_metal_mass_fraction);
list[1] = io_make_output_field("Z", FLOAT, 1, UNIT_CONV_NO_UNITS, parts,
chemistry_data.Z);
list[2] = io_make_output_field("ElementAbundance", FLOAT,
chemistry_element_count, UNIT_CONV_NO_UNITS,
parts, chemistry_data.metal_mass_fraction);
parts, chemistry_data.metal_mass_fraction, 1);
return 3;
}
......
......@@ -106,13 +106,14 @@ void darkmatter_write_particles(const struct gpart* gparts,
/* List what we want to write */
list[0] = io_make_output_field_convert_gpart(
"Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, gparts, convert_gpart_pos, 1);
"Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, gparts, convert_gpart_pos, 1);
list[1] = io_make_output_field_convert_gpart(
"Velocities", FLOAT, 3, UNIT_CONV_SPEED, gparts, convert_gpart_vel, 1);
"Velocities", FLOAT, 3, UNIT_CONV_SPEED, gparts, convert_gpart_vel, 1);
list[2] =
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, gparts, mass, 1);
list[3] = io_make_output_field("ParticleIDs", ULONGLONG, 1,
UNIT_CONV_NO_UNITS, gparts, id_or_neg_offset, 1);
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, gparts, mass, 1);
list[3] =
io_make_output_field("ParticleIDs", ULONGLONG, 1, UNIT_CONV_NO_UNITS,
gparts, id_or_neg_offset, 1);
list[4] = io_make_output_field("Potential", FLOAT, 1, UNIT_CONV_POTENTIAL,
gparts, potential, 1);
}
......
......@@ -127,22 +127,23 @@ void hydro_write_particles(const struct part* parts, const struct xpart* xparts,
/* List what we want to write */
list[0] = io_make_output_field_convert_part("Coordinates", DOUBLE, 3,
UNIT_CONV_LENGTH, parts, xparts,
convert_part_pos);
list[1] = io_make_output_field_convert_part(
"Velocities", FLOAT, 3, UNIT_CONV_SPEED, parts, xparts, convert_part_vel);
convert_part_pos, 1);
list[1] =
io_make_output_field_convert_part("Velocities", FLOAT, 3, UNIT_CONV_SPEED,
parts, xparts, convert_part_vel, 1);
list[2] =
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, parts, mass);
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, parts, mass, 1);
list[3] = io_make_output_field("SmoothingLength", FLOAT, 1, UNIT_CONV_LENGTH,
parts, h);
parts, h, 1);
list[4] = io_make_output_field("InternalEnergy", FLOAT, 1,
UNIT_CONV_ENERGY_PER_UNIT_MASS, parts, u);
UNIT_CONV_ENERGY_PER_UNIT_MASS, parts, u, 1);
list[5] = io_make_output_field("ParticleIDs", ULONGLONG, 1,
UNIT_CONV_NO_UNITS, parts, id);
list[6] =
io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts, rho);
list[7] = io_make_output_field_convert_part("Potential", FLOAT, 1,
UNIT_CONV_POTENTIAL, parts,
xparts, convert_part_potential);
UNIT_CONV_NO_UNITS, parts, id, 1);
list[6] = io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts,
rho, 1);
list[7] = io_make_output_field_convert_part(
"Potential", FLOAT, 1, UNIT_CONV_POTENTIAL, parts, xparts,
convert_part_potential, 1);
}
/**
......
......@@ -140,27 +140,29 @@ void hydro_write_particles(const struct part* parts, const struct xpart* xparts,
list[0] = io_make_output_field_convert_part("Coordinates", DOUBLE, 3,
UNIT_CONV_LENGTH, parts, xparts,
convert_part_pos, 1);
list[1] = io_make_output_field_convert_part(
"Velocities", FLOAT, 3, UNIT_CONV_SPEED, parts, xparts, convert_part_vel, 1);
list[1] =
io_make_output_field_convert_part("Velocities", FLOAT, 3, UNIT_CONV_SPEED,
parts, xparts, convert_part_vel, 1);
list[2] =
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, parts, mass, 1);
list[3] = io_make_output_field("SmoothingLength", FLOAT, 1, UNIT_CONV_LENGTH,
parts, h, 1);
list[4] = io_make_output_field(
"Entropy", FLOAT, 1, UNIT_CONV_ENTROPY_PER_UNIT_MASS, parts, entropy, 1);
"Entropy", FLOAT, 1, UNIT_CONV_ENTROPY_PER_UNIT_MASS, parts, entropy, 1);
list[5] = io_make_output_field("ParticleIDs", ULONGLONG, 1,
UNIT_CONV_NO_UNITS, parts, id, 1);
list[6] =
io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts, rho, 1);
list[6] = io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts,
rho, 1);
list[7] = io_make_output_field_convert_part("InternalEnergy", FLOAT, 1,
UNIT_CONV_ENERGY_PER_UNIT_MASS,
parts, xparts, convert_part_u, 1);
list[8] = io_make_output_field_convert_part(
"Pressure", FLOAT, 1, UNIT_CONV_PRESSURE, parts, xparts, convert_part_P, 1);
list[8] = io_make_output_field_convert_part("Pressure", FLOAT, 1,
UNIT_CONV_PRESSURE, parts, xparts,
convert_part_P, 1);
list[9] = io_make_output_field_convert_part("Potential", FLOAT, 1,
UNIT_CONV_POTENTIAL, parts,
xparts, convert_part_potential, 1);
list[9] = io_make_output_field_convert_part(
"Potential", FLOAT, 1, UNIT_CONV_POTENTIAL, parts, xparts,
convert_part_potential, 1);
#ifdef DEBUG_INTERACTIONS_SPH
......
......@@ -184,31 +184,32 @@ void hydro_write_particles(const struct part* parts, const struct xpart* xparts,
/* List what we want to write */
list[0] = io_make_output_field_convert_part("Coordinates", DOUBLE, 3,
UNIT_CONV_LENGTH, parts, xparts,
convert_part_pos);
list[1] = io_make_output_field_convert_part(
"Velocities", FLOAT, 3, UNIT_CONV_SPEED, parts, xparts, convert_part_vel);
convert_part_pos, 1);
list[1] =
io_make_output_field_convert_part("Velocities", FLOAT, 3, UNIT_CONV_SPEED,
parts, xparts, convert_part_vel, 1);
list[2] = io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, parts,
conserved.mass);
conserved.mass, 1);
list[3] = io_make_output_field("SmoothingLength", FLOAT, 1, UNIT_CONV_LENGTH,
parts, h);
parts, h, 1);
list[4] = io_make_output_field_convert_part("InternalEnergy", FLOAT, 1,
UNIT_CONV_ENERGY_PER_UNIT_MASS,
parts, xparts, convert_u);
parts, xparts, convert_u, 1);
list[5] = io_make_output_field("ParticleIDs", ULONGLONG, 1,
UNIT_CONV_NO_UNITS, parts, id);
UNIT_CONV_NO_UNITS, parts, id, 1);
list[6] = io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts,
primitives.rho);
primitives.rho, 1);
list[7] = io_make_output_field_convert_part(
"Entropy", FLOAT, 1, UNIT_CONV_ENTROPY, parts, xparts, convert_A);
"Entropy", FLOAT, 1, UNIT_CONV_ENTROPY, parts, xparts, convert_A, 1);
list[8] = io_make_output_field("Pressure", FLOAT, 1, UNIT_CONV_PRESSURE,
parts, primitives.P);
parts, primitives.P, 1);
list[9] = io_make_output_field_convert_part(
"TotEnergy", FLOAT, 1, UNIT_CONV_ENERGY, parts, xparts, convert_Etot);
"TotEnergy", FLOAT, 1, UNIT_CONV_ENERGY, parts, xparts, convert_Etot, 1);
list[10] = io_make_output_field_convert_part("Potential", FLOAT, 1,
UNIT_CONV_POTENTIAL, parts,
xparts, convert_part_potential);
list[10] = io_make_output_field_convert_part(
"Potential", FLOAT, 1, UNIT_CONV_POTENTIAL, parts, xparts,
convert_part_potential, 1);
}
/**
......
......@@ -154,28 +154,29 @@ void hydro_write_particles(const struct part* parts, const struct xpart* xparts,
/* List what we want to write */
list[0] = io_make_output_field_convert_part("Coordinates", DOUBLE, 3,
UNIT_CONV_LENGTH, parts, xparts,
convert_part_pos);
list[1] = io_make_output_field_convert_part(
"Velocities", FLOAT, 3, UNIT_CONV_SPEED, parts, xparts, convert_part_vel);
convert_part_pos, 1);
list[1] =
io_make_output_field_convert_part("Velocities", FLOAT, 3, UNIT_CONV_SPEED,
parts, xparts, convert_part_vel, 1);
list[2] =
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, parts, mass);
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, parts, mass, 1);
list[3] = io_make_output_field("SmoothingLength", FLOAT, 1, UNIT_CONV_LENGTH,
parts, h);
parts, h, 1);
list[4] = io_make_output_field("InternalEnergy", FLOAT, 1,
UNIT_CONV_ENERGY_PER_UNIT_MASS, parts, u);
UNIT_CONV_ENERGY_PER_UNIT_MASS, parts, u, 1);
list[5] = io_make_output_field("ParticleIDs", ULONGLONG, 1,
UNIT_CONV_NO_UNITS, parts, id);
list[6] =
io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts, rho);
UNIT_CONV_NO_UNITS, parts, id, 1);
list[6] = io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts,
rho, 1);
list[7] = io_make_output_field_convert_part("Entropy", FLOAT, 1,
UNIT_CONV_ENTROPY_PER_UNIT_MASS,
parts, xparts, convert_S);
parts, xparts, convert_S, 1);
list[8] = io_make_output_field_convert_part(
"Pressure", FLOAT, 1, UNIT_CONV_PRESSURE, parts, xparts, convert_P);
"Pressure", FLOAT, 1, UNIT_CONV_PRESSURE, parts, xparts, convert_P, 1);
list[9] = io_make_output_field_convert_part("Potential", FLOAT, 1,
UNIT_CONV_POTENTIAL, parts,
xparts, convert_part_potential);
list[9] = io_make_output_field_convert_part(
"Potential", FLOAT, 1, UNIT_CONV_POTENTIAL, parts, xparts,
convert_part_potential, 1);
}
/**
......
......@@ -151,29 +151,30 @@ void hydro_write_particles(const struct part* parts, const struct xpart* xparts,
/* List what we want to write */
list[0] = io_make_output_field_convert_part("Coordinates", DOUBLE, 3,
UNIT_CONV_LENGTH, parts, xparts,
convert_part_pos);
list[1] = io_make_output_field_convert_part(
"Velocities", FLOAT, 3, UNIT_CONV_SPEED, parts, xparts, convert_part_vel);
convert_part_pos, 1);
list[1] =
io_make_output_field_convert_part("Velocities", FLOAT, 3, UNIT_CONV_SPEED,
parts, xparts, convert_part_vel, 1);
list[2] =
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, parts, mass);
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, parts, mass, 1);
list[3] = io_make_output_field("SmoothingLength", FLOAT, 1, UNIT_CONV_LENGTH,
parts, h);
parts, h, 1);
list[4] = io_make_output_field(
"Entropy", FLOAT, 1, UNIT_CONV_ENTROPY_PER_UNIT_MASS, parts, entropy);
"Entropy", FLOAT, 1, UNIT_CONV_ENTROPY_PER_UNIT_MASS, parts, entropy, 1);
list[5] = io_make_output_field("ParticleIDs", ULONGLONG, 1,
UNIT_CONV_NO_UNITS, parts, id);
list[6] =
io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts, rho);
UNIT_CONV_NO_UNITS, parts, id, 1);
list[6] = io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts,
rho, 1);
list[7] = io_make_output_field_convert_part("InternalEnergy", FLOAT, 1,
UNIT_CONV_ENERGY_PER_UNIT_MASS,
parts, xparts, convert_u);
parts, xparts, convert_u, 1);
list[8] = io_make_output_field_convert_part(
"Pressure", FLOAT, 1, UNIT_CONV_PRESSURE, parts, xparts, convert_P);
"Pressure", FLOAT, 1, UNIT_CONV_PRESSURE, parts, xparts, convert_P, 1);
list[9] = io_make_output_field("WeightedDensity", FLOAT, 1, UNIT_CONV_DENSITY,
parts, rho_bar);
list[10] = io_make_output_field_convert_part("Potential", FLOAT, 1,
UNIT_CONV_POTENTIAL, parts,
xparts, convert_part_potential);
parts, rho_bar, 1);
list[10] = io_make_output_field_convert_part(
"Potential", FLOAT, 1, UNIT_CONV_POTENTIAL, parts, xparts,
convert_part_potential, 1);
}
/**
......
......@@ -138,28 +138,28 @@ void hydro_write_particles(const struct part* parts, const struct xpart* xparts,
UNIT_CONV_LENGTH, parts, xparts,
convert_part_pos);
list[1] = io_make_output_field("Velocities", FLOAT, 3, UNIT_CONV_SPEED, parts,
primitives.v);
primitives.v, 1);
list[2] = io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, parts,
conserved.mass);
conserved.mass, 1);
list[3] = io_make_output_field("SmoothingLength", FLOAT, 1, UNIT_CONV_LENGTH,
parts, h);
parts, h, 1);
list[4] = io_make_output_field_convert_part("InternalEnergy", FLOAT, 1,
UNIT_CONV_ENERGY_PER_UNIT_MASS,
parts, xparts, convert_u);
list[5] = io_make_output_field("ParticleIDs", ULONGLONG, 1,
UNIT_CONV_NO_UNITS, parts, id);
UNIT_CONV_NO_UNITS, parts, id, 1);
list[6] = io_make_output_field("Acceleration", FLOAT, 3,
UNIT_CONV_ACCELERATION, parts, a_hydro);
UNIT_CONV_ACCELERATION, parts, a_hydro, 1);
list[7] = io_make_output_field("Density", FLOAT, 1, UNIT_CONV_DENSITY, parts,
primitives.rho);
primitives.rho, 1);
list[8] = io_make_output_field("Volume", FLOAT, 1, UNIT_CONV_VOLUME, parts,
cell.volume);
cell.volume, 1);
list[9] = io_make_output_field("GradDensity", FLOAT, 3, UNIT_CONV_DENSITY,
parts, primitives.gradients.rho);
parts, primitives.gradients.rho, 1);
list[10] = io_make_output_field_convert_part(
"Entropy", FLOAT, 1, UNIT_CONV_ENTROPY, parts, xparts, convert_A);
list[11] = io_make_output_field("Pressure", FLOAT, 1, UNIT_CONV_PRESSURE,
parts, primitives.P);
parts, primitives.P, 1);
list[12] = io_make_output_field_convert_part(
"TotEnergy", FLOAT, 1, UNIT_CONV_ENERGY, parts, xparts, convert_Etot);
}
......
......@@ -107,7 +107,7 @@ struct io_props {
* @brief Constructs an #io_props from its parameters
*/
#define io_make_input_field(name, type, dim, importance, units, part, field) \
io_make_input_field_(name, type, dim, importance, units, \
io_make_input_field_(name, type, dim, importance, units, \
(char*)(&(part[0]).field), sizeof(part[0]))
/**
......@@ -151,7 +151,8 @@ INLINE static struct io_props io_make_input_field_(
/**
* @brief Constructs an #io_props from its parameters
*/
#define io_make_output_field(name, type, dim, units, part, field, default_output) \
#define io_make_output_field(name, type, dim, units, part, field, \
default_output) \
io_make_output_field_(name, type, dim, units, (char*)(&(part[0]).field), \
sizeof(part[0]), default_output)
......@@ -196,9 +197,10 @@ INLINE static struct io_props io_make_output_field_(
* @brief Constructs an #io_props (with conversion) from its parameters
*/
#define io_make_output_field_convert_part(name, type, dim, units, part, xpart, \
convert, default_output) \
io_make_output_field_convert_part_##type( \
name, type, dim, units, sizeof(part[0]), part, xpart, convert, default_output)
convert, default_output) \
io_make_output_field_convert_part_##type(name, type, dim, units, \
sizeof(part[0]), part, xpart, \
convert, default_output)
/**
* @brief Construct an #io_props from its parameters
......@@ -219,8 +221,7 @@ INLINE static struct io_props io_make_output_field_convert_part_FLOAT(
const char name[FIELD_BUFFER_SIZE], enum IO_DATA_TYPE type, int dimension,
enum unit_conversion_factor units, size_t partSize,
const struct part* parts, const struct xpart* xparts,
conversion_func_part_float functionPtr,
int default_output) {
conversion_func_part_float functionPtr, int default_output) {
struct io_props r;
strcpy(r.name, name);
......@@ -288,11 +289,11 @@ INLINE static struct io_props io_make_output_field_convert_part_DOUBLE(
/**
* @brief Constructs an #io_props (with conversion) from its parameters
*/
#define io_make_output_field_convert_gpart(name, type, dim, units, gpart, \
convert, default_output) \
io_make_output_field_convert_gpart_##type(name, type, dim, units, \
#define io_make_output_field_convert_gpart(name, type, dim, units, gpart, \
convert, default_output) \
io_make_output_field_convert_gpart_##type(name, type, dim, units, \
sizeof(gpart[0]), gpart, convert, \
default_output)
default_output)
/**
* @brief Construct an #io_props from its parameters
......@@ -312,7 +313,7 @@ INLINE static struct io_props io_make_output_field_convert_gpart_FLOAT(
const char name[FIELD_BUFFER_SIZE], enum IO_DATA_TYPE type, int dimension,
enum unit_conversion_factor units, size_t gpartSize,
const struct gpart* gparts, conversion_func_gpart_float functionPtr,
int default_output) {
int default_output) {
struct io_props r;
strcpy(r.name, name);
......@@ -353,7 +354,7 @@ INLINE static struct io_props io_make_output_field_convert_gpart_DOUBLE(
const char name[FIELD_BUFFER_SIZE], enum IO_DATA_TYPE type, int dimension,
enum unit_conversion_factor units, size_t gpartSize,
const struct gpart* gparts, conversion_func_gpart_double functionPtr,
int default_output) {
int default_output) {
struct io_props r;
strcpy(r.name, name);
......
......@@ -1265,11 +1265,12 @@ void write_output_parallel(struct engine* e, const char* baseName,
for (int i = 0; i < num_fields; ++i) {
char field[200] = "OutputFields:";
strcat(field, list[i].name);
int should_write = parser_get_opt_param_int(output_fields, field, list[i].default_output);
int should_write = parser_get_opt_param_int(output_fields, field,
list[i].default_output);
if (should_write)
writeArray(e, h_grp, fileName, partTypeGroupName, list[i], Nparticles,
N_total[ptype], mpi_rank, offset[ptype], internal_units,
snapshot_units);
writeArray(e, h_grp, fileName, partTypeGroupName, list[i], Nparticles,
N_total[ptype], mpi_rank, offset[ptype], internal_units,
snapshot_units);
}
/* Free temporary array */
......
......@@ -1007,14 +1007,15 @@ void write_output_serial(struct engine* e, const char* baseName,
/* Write everything */
for (int i = 0; i < num_fields; ++i) {
char field[200] = "OutputFields:";
strcat(field, list[i].name);
int should_write = parser_get_opt_param_int(output_fields, field, list[i].default_output);
if (should_write)
writeArray(e, h_grp, fileName, xmfFile, partTypeGroupName, list[i],
Nparticles, N_total[ptype], mpi_rank, offset[ptype],
internal_units, snapshot_units);
}
char field[200] = "OutputFields:";
strcat(field, list[i].name);
int should_write = parser_get_opt_param_int(output_fields, field,
list[i].default_output);
if (should_write)
writeArray(e, h_grp, fileName, xmfFile, partTypeGroupName, list[i],
Nparticles, N_total[ptype], mpi_rank, offset[ptype],
internal_units, snapshot_units);
}
/* Free temporary array */
if (dmparts) {
......
......@@ -829,10 +829,11 @@ void write_output_single(struct engine* e, const char* baseName,
for (int i = 0; i < num_fields; ++i) {
char field[200] = "OutputFields:";
strcat(field, list[i].name);
int should_write = parser_get_opt_param_int(output_fields, field, list[i].default_output);
int should_write = parser_get_opt_param_int(output_fields, field,
list[i].default_output);
if (should_write)
writeArray(e, h_grp, fileName, xmfFile, partTypeGroupName, list[i], N,
internal_units, snapshot_units);
writeArray(e, h_grp, fileName, xmfFile, partTypeGroupName, list[i], N,
internal_units, snapshot_units);
}
/* Free temporary array */
......
......@@ -61,10 +61,10 @@ void star_write_particles(const struct spart* sparts, struct io_props* list,
/* List what we want to read */
list[0] = io_make_output_field("Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH,
sparts, x, 1);
list[1] =
io_make_output_field("Velocities", FLOAT, 3, UNIT_CONV_SPEED, sparts, v, 1);
list[1] = io_make_output_field("Velocities", FLOAT, 3, UNIT_CONV_SPEED,
sparts, v, 1);
list[2] =
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, sparts, mass, 1);
io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, sparts, mass, 1);
list[3] = io_make_output_field("ParticleIDs", LONGLONG, 1, UNIT_CONV_NO_UNITS,
sparts, id, 1);
}
......
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