Commit 41eda0fa authored by Josh Borrow's avatar Josh Borrow
Browse files

Extended new output selection scheme to distributed, paralle, and serial i/o.

parent 56e494e7
......@@ -246,7 +246,8 @@ void write_output_distributed(struct engine* e,
const struct gpart* gparts = e->s->gparts;
const struct spart* sparts = e->s->sparts;
const struct bpart* bparts = e->s->bparts;
struct swift_params* params = e->parameter_file;
struct output_options* output_options = e->output_options;
struct output_list* output_list = e->output_list_snapshots;
const int with_cosmology = e->policy & engine_policy_cosmology;
const int with_cooling = e->policy & engine_policy_cooling;
const int with_temperature = e->policy & engine_policy_temperature;
......@@ -704,13 +705,20 @@ void write_output_distributed(struct engine* e,
}
/* Write everything that is not cancelled */
char current_selection_name[OUTPUT_LIST_SELECT_OUTPUT_MAX_LENGTH] =
"Default";
if (output_list->output_list_on) {
/* Users could have specified a different Select Output scheme for each
* snapshot. */
output_list_get_current_select_output(output_list,
&current_selection_name[0]);
}
for (int i = 0; i < num_fields; ++i) {
/* Did the user cancel this field? */
char field[PARSER_MAX_LINE_SIZE];
sprintf(field, "SelectOutput:%.*s_%s", FIELD_BUFFER_SIZE, list[i].name,
part_type_names[ptype]);
int should_write = parser_get_opt_param_int(params, field, 1);
const int should_write = output_options_should_write_field(
output_options, current_selection_name, list[i].name, ptype);
if (should_write)
write_distributed_array(e, h_grp, fileName, partTypeGroupName, list[i],
......
......@@ -51,6 +51,7 @@
#include "hydro_properties.h"
#include "io_properties.h"
#include "memuse.h"
#include "output_options.h"
#include "part.h"
#include "part_type.h"
#include "star_formation_io.h"
......@@ -1055,7 +1056,8 @@ void prepare_file(struct engine* e, const char* fileName,
const struct gpart* gparts = e->s->gparts;
const struct spart* sparts = e->s->sparts;
const struct bpart* bparts = e->s->bparts;
struct swift_params* params = e->parameter_file;
struct output_options* output_options = e->output_options;
struct output_list* output_list = e->output_list_snapshots;
const int with_cosmology = e->policy & engine_policy_cosmology;
const int with_cooling = e->policy & engine_policy_cooling;
const int with_temperature = e->policy & engine_policy_temperature;
......@@ -1257,13 +1259,20 @@ void prepare_file(struct engine* e, const char* fileName,
}
/* Prepare everything that is not cancelled */
char current_selection_name[OUTPUT_LIST_SELECT_OUTPUT_MAX_LENGTH] =
"Default";
if (output_list->output_list_on) {
/* Users could have specified a different Select Output scheme for each
* snapshot. */
output_list_get_current_select_output(output_list,
&current_selection_name[0]);
}
for (int i = 0; i < num_fields; ++i) {
/* Did the user cancel this field? */
char field[PARSER_MAX_LINE_SIZE];
sprintf(field, "SelectOutput:%.*s_%s", FIELD_BUFFER_SIZE, list[i].name,
part_type_names[ptype]);
int should_write = parser_get_opt_param_int(params, field, 1);
const int should_write = output_options_should_write_field(
output_options, current_selection_name, list[i].name, ptype);
if (should_write)
prepare_array_parallel(e, h_grp, fileName, xmfFile, partTypeGroupName,
......@@ -1315,7 +1324,8 @@ void write_output_parallel(struct engine* e,
const struct gpart* gparts = e->s->gparts;
const struct spart* sparts = e->s->sparts;
const struct bpart* bparts = e->s->bparts;
struct swift_params* params = e->parameter_file;
struct output_options* output_options = e->output_options;
struct output_list* output_list = e->output_list_snapshots;
const int with_cosmology = e->policy & engine_policy_cosmology;
const int with_cooling = e->policy & engine_policy_cooling;
const int with_temperature = e->policy & engine_policy_temperature;
......@@ -1767,13 +1777,19 @@ void write_output_parallel(struct engine* e,
}
/* Write everything that is not cancelled */
char current_selection_name[OUTPUT_LIST_SELECT_OUTPUT_MAX_LENGTH] =
"Default";
if (output_list->output_list_on) {
/* Users could have specified a different Select Output scheme for each
* snapshot. */
output_list_get_current_select_output(output_list,
&current_selection_name[0]);
}
for (int i = 0; i < num_fields; ++i) {
/* Did the user cancel this field? */
char field[PARSER_MAX_LINE_SIZE];
sprintf(field, "SelectOutput:%.*s_%s", FIELD_BUFFER_SIZE, list[i].name,
part_type_names[ptype]);
int should_write = parser_get_opt_param_int(params, field, 1);
const int should_write = output_options_should_write_field(
output_options, current_selection_name, list[i].name, ptype);
if (should_write)
write_array_parallel(e, h_grp, fileName, partTypeGroupName, list[i],
......
......@@ -51,6 +51,7 @@
#include "hydro_properties.h"
#include "io_properties.h"
#include "memuse.h"
#include "output_options.h"
#include "part.h"
#include "part_type.h"
#include "star_formation_io.h"
......@@ -868,7 +869,8 @@ void write_output_serial(struct engine* e,
const struct gpart* gparts = e->s->gparts;
const struct spart* sparts = e->s->sparts;
const struct bpart* bparts = e->s->bparts;
struct swift_params* params = e->parameter_file;
struct output_options* output_options = e->output_options;
struct output_list* output_list = e->output_list_snapshots;
const int with_cosmology = e->policy & engine_policy_cosmology;
const int with_cooling = e->policy & engine_policy_cooling;
const int with_temperature = e->policy & engine_policy_temperature;
......@@ -1386,13 +1388,20 @@ void write_output_serial(struct engine* e,
}
/* Write everything that is not cancelled */
char current_selection_name[OUTPUT_LIST_SELECT_OUTPUT_MAX_LENGTH] =
"Default";
if (output_list->output_list_on) {
/* Users could have specified a different Select Output scheme for
* each snapshot. */
output_list_get_current_select_output(output_list,
&current_selection_name[0]);
}
for (int i = 0; i < num_fields; ++i) {
/* Did the user cancel this field? */
char field[PARSER_MAX_LINE_SIZE];
sprintf(field, "SelectOutput:%.*s_%s", FIELD_BUFFER_SIZE,
list[i].name, part_type_names[ptype]);
int should_write = parser_get_opt_param_int(params, field, 1);
const int should_write = output_options_should_write_field(
output_options, current_selection_name, list[i].name, ptype);
if (should_write)
write_array_serial(e, h_grp, fileName, xmfFile, partTypeGroupName,
......
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