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

Downstream fix to the LOS code which could overflow the parser parameter list...

Downstream fix to the LOS code which could overflow the parser parameter list size in the middle of a run. A check is now in place at the start
parent 64d2cb25
No related branches found
No related tags found
5 merge requests!1997Yet another master into zoom buffer branch merge (with formatting all done!),!1994Draft: Testing master -> zoom merge,!1987Update zoom_merge with master updates (after wrangling immense conflicts),!1982Update zoom merge branch with latest master developments,!1956Rename space_getsid to space_getsid_and_swap_cells() to try to prevent...
......@@ -37,6 +37,7 @@
/* Local headers. */
#include "fof.h"
#include "line_of_sight.h"
#include "mpiuse.h"
#include "part.h"
#include "pressure_floor.h"
......@@ -792,9 +793,11 @@ void engine_config(int restart, int fof, struct engine *e,
/* Find the time of the first statistics output */
engine_compute_next_statistics_time(e);
/* Find the time of the first line of sight output */
/* Find the time of the first line of sight output
* and verify the outputs */
if (e->policy & engine_policy_line_of_sight) {
engine_compute_next_los_time(e);
los_io_output_check(e);
}
/* Find the time of the first stf output */
......
......@@ -152,6 +152,40 @@ void los_init(const double dim[3], struct los_props *los_params,
los_params->range_when_shooting_down_axis[2]);
}
void los_io_output_check(const struct engine *e) {
/* What kind of run are we working with? */
struct swift_params *params = e->parameter_file;
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;
const int with_fof = e->policy & engine_policy_fof;
#ifdef HAVE_VELOCIRAPTOR
const int with_stf = (e->policy & engine_policy_structure_finding) &&
(e->s->gpart_group_data != NULL);
#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];
/* Find all the gas output fields */
io_select_hydro_fields(e->s->parts, e->s->xparts, with_cosmology, with_cooling,
with_temperature, with_fof, with_stf, with_rt, e,
&num_fields, list);
/* Loop over each output field */
for (int i = 0; i < num_fields; i++) {
/* Did the user cancel this field? */
char field[PARSER_MAX_LINE_SIZE];
sprintf(field, "SelectOutputLOS:%.*s", FIELD_BUFFER_SIZE, list[i].name);
parser_get_opt_param_int(params, field, 1);
}
}
/**
* @brief Create a #line_of_sight object from its attributes
*/
......
......@@ -25,9 +25,11 @@
#include <config.h>
/* Local includes. */
#include "engine.h"
#include "io_properties.h"
/* Pre-declarations */
struct engine;
/**
* @brief Maps the LOS axis geometry to the simulation axis geometry.
*
......@@ -117,6 +119,7 @@ void print_los_info(const struct line_of_sight *Los, const int i);
void do_line_of_sight(struct engine *e);
void los_init(const double dim[3], struct los_props *los_params,
struct swift_params *params);
void los_io_output_check(const struct engine *e);
void los_struct_dump(const struct los_props *internal_los, FILE *stream);
void los_struct_restore(const struct los_props *internal_los, FILE *stream);
......
......@@ -32,7 +32,7 @@
/* Some constants. */
#define PARSER_MAX_LINE_SIZE 256
#define PARSER_MAX_NO_OF_PARAMS 600
#define PARSER_MAX_NO_OF_PARAMS 700
#define PARSER_MAX_NO_OF_SECTIONS 64
/* A parameter in the input file */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment