Skip to content
Snippets Groups Projects

Fix output_list

Merged Loic Hausammann requested to merge fix_output_list into master
1 unresolved thread
1 file
+ 7
4
Compare changes
  • Side-by-side
  • Inline
+ 7
4
@@ -28,6 +28,7 @@
#include "engine.h"
#include "error.h"
#include "restart.h"
#include "tools.h"
/* Some standard headers. */
#include <string.h>
@@ -72,11 +73,13 @@ void output_list_read_file(struct output_list *outputlist, const char *filename,
/* Find type of data in file */
int type = -1;
if (strcmp(line, "# Redshift") == 0)
trim_trailing(line);
if (strcasecmp(line, "# Redshift") == 0)
type = OUTPUT_LIST_REDSHIFT;
else if (strcmp(line, "# Time") == 0)
else if (strcasecmp(line, "# Time") == 0)
type = OUTPUT_LIST_AGE;
else if (strcmp(line, "# Scale Factor") == 0)
else if (strcasecmp(line, "# Scale Factor") == 0)
type = OUTPUT_LIST_SCALE_FACTOR;
else
error("Unable to interpret the header (%s) in file '%s'", line, filename);
@@ -102,7 +105,7 @@ void output_list_read_file(struct output_list *outputlist, const char *filename,
/* Transform input into correct time (e.g. ages or scale factor) */
if (type == OUTPUT_LIST_REDSHIFT) *time = 1. / (1. + *time);
if (type == OUTPUT_LIST_AGE)
if (cosmo && type == OUTPUT_LIST_AGE)
    • I had removed the cosmo here since we already test above whether we have cosmo and ages. But if you'd rather keep it, that's fine.

      • You check if cosmo with redshift or scale factor, but not with the cosmic time (maybe I should change the flag OUTPUT_LIST_AGE to OUTPUT_LIST_COSMIC_TIME?). Here I do not want to compute the scale factor from the cosmic time in a non cosmological simulation. In current master, the code just crash on a segmentation fault in this case.

      • Please register or sign in to reply
Please register or sign in to reply
*time = cosmology_get_scale_factor(cosmo, *time);
/* Update size */
Loading