[Commits] [svn:einsteintoolkit] EOS_Omni/trunk/src/nuc_eos/ (Rev. 66)
rhaas at tapir.caltech.edu
rhaas at tapir.caltech.edu
Thu Aug 9 19:43:39 CDT 2012
User: rhaas
Date: 2012/08/09 07:43 PM
Modified:
/trunk/src/nuc_eos/
readtable.c
Log:
EOS_Omni: use H5Fis_hdf5, protect assumed type sizes
From: Roland Haas <roland.haas at physics.gatech.edu>
File Changes:
Directory: /trunk/src/nuc_eos/
==============================
File [modified]: readtable.c
Delta lines: +5 -14
===================================================================
--- trunk/src/nuc_eos/readtable.c 2012-08-09 21:52:00 UTC (rev 65)
+++ trunk/src/nuc_eos/readtable.c 2012-08-10 00:43:38 UTC (rev 66)
@@ -31,19 +31,6 @@
#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 @@
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 @@
// 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))))
More information about the Commits
mailing list