aboutsummaryrefslogtreecommitdiff
path: root/src/nuc_eos/readtable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nuc_eos/readtable.c')
-rw-r--r--src/nuc_eos/readtable.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/nuc_eos/readtable.c b/src/nuc_eos/readtable.c
index 9dfb727..37c7472 100644
--- a/src/nuc_eos/readtable.c
+++ b/src/nuc_eos/readtable.c
@@ -31,19 +31,6 @@ void CCTK_FNAME(setup_eosmodule)
#fn_call, _error_code); \
}
-static int file_is_readable(const char* filename);
-static int file_is_readable(const char* filename)
-{
- FILE* fp = NULL;
- fp = fopen(filename, "r");
- if(fp != NULL)
- {
- fclose(fp);
- return 1;
- }
- return 0;
-}
-
// Cactus calls this function. It reads in the table and calls a fortran
// function to setup values for the fortran eos module
void EOS_OMNI_ReadTable(CCTK_ARGUMENTS)
@@ -66,7 +53,7 @@ void EOS_OMNI_ReadTable(CCTK_ARGUMENTS)
const int doIO = !read_table_on_single_process || CCTK_MyProc(cctkGH) == my_reader_process;
hid_t file = -1;
- if (doIO && !file_is_readable(nuceos_table_name))
+ if (doIO && ! H5Fis_hdf5(nuceos_table_name) > 0)
CCTK_VWarn(CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,
"Could not read nuceos_table_name'%s'",
nuceos_table_name);
@@ -100,6 +87,10 @@ void EOS_OMNI_ReadTable(CCTK_ARGUMENTS)
// Allocate memory for tables
CCTK_REAL *alltables, *logrho, *logtemp, *ye, energy_shift;
+ // protect our use of H5T_NATIVE_DOUBLE and H5T_NATIVE_INT
+ assert (sizeof(CCTK_REAL) == sizeof(double));
+ assert (sizeof(CCTK_INT) == sizeof(int));
+
if (!(alltables = (CCTK_REAL*)malloc(nrho * ntemp * nye * 19 * sizeof(CCTK_REAL))))
CCTK_WARN(CCTK_WARN_ABORT, "Cannot allocate memory for EOS table\n");
if (!(logrho = (CCTK_REAL*)malloc(nrho * sizeof(CCTK_REAL))))