Commit f2a6aab7 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

When loading a planetary EoS, check that the file exists first.

parent 8934a804
......@@ -86,7 +86,7 @@ INLINE static void load_table_HM80(struct HM80_params *mat, char *table_file) {
// Load table contents from file
FILE *f = fopen(table_file, "r");
int c;
if (f == NULL) error("Impossible to open HM80 EoS file '%s'", table_file);
// Ignore header lines
char buffer[100];
......@@ -96,8 +96,8 @@ INLINE static void load_table_HM80(struct HM80_params *mat, char *table_file) {
}
// Table properties
c = fscanf(f, "%f %f %d %f %f %d", &mat->log_rho_min, &mat->log_rho_max,
&mat->num_rho, &mat->log_u_min, &mat->log_u_max, &mat->num_u);
int c = fscanf(f, "%f %f %d %f %f %d", &mat->log_rho_min, &mat->log_rho_max,
&mat->num_rho, &mat->log_u_min, &mat->log_u_max, &mat->num_u);
if (c != 6) {
error("Failed to read EOS table %s", table_file);
}
......
......@@ -82,7 +82,7 @@ INLINE static void load_table_SESAME(struct SESAME_params *mat,
// Load table contents from file
FILE *f = fopen(table_file, "r");
int c;
if (f == NULL) error("Impossible to open SESAME EoS file '%s'", table_file);
// Ignore header lines
char buffer[100];
......@@ -93,7 +93,7 @@ INLINE static void load_table_SESAME(struct SESAME_params *mat,
float ignore;
// Table properties
c = fscanf(f, "%d %d", &mat->num_rho, &mat->num_T);
int c = fscanf(f, "%d %d", &mat->num_rho, &mat->num_T);
if (c != 2) {
error("Failed to read EOS table %s", table_file);
}
......
Supports Markdown
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