Commits

Sam Skillman committed e01ad22 Merge

Merging/

Comments (0)

Files changed (2)

src/enzo/Grid_ReadHierarchyInformationHDF5.C

 
 int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, int &Attribute, FILE *log_fptr);
 int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, float &Attribute, FILE *log_fptr);
-int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, FLOAT &Attribute, FILE *log_fptr);
+int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, Eint32 &Attribute, FILE *log_fptr);
+int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, Eint64 &Attribute, FILE *log_fptr);
+int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, Eflt32 &Attribute, FILE *log_fptr);
+int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, Eflt64 &Attribute, FILE *log_fptr);
+int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, Eflt128 &Attribute, FILE *log_fptr);
 int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, int Attribute[], int NumberOfElements, FILE *log_fptr);
 int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, char Attribute[], FILE *log_fptr);
-#ifdef CONFIG_PFLOAT_16
-int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, double &Attribute, FILE *log_fptr);
-#endif
 
 int HDF5_ReadDataset(hid_t group_id, const char *DatasetName, int &Dataset, FILE *log_fptr);
 int HDF5_ReadDataset(hid_t group_id, const char *DatasetName, int Dataset[], FILE *log_fptr);
 
 // HDF5 utility routines (to read attributes and datasets)
 
-// int
-int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, int &Attribute, FILE *log_fptr) {
+// 32-bit int (Eint32)
+int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, Eint32 &Attribute, FILE *log_fptr) {
 
   hid_t attr_id;
 
   attr_id = H5Aopen_name(group_id, AttributeName);
   if (io_log) fprintf(log_fptr, "H5Aopen_name: attr_id = %"ISYM"\n", (int) attr_id);
 
-  h5_status = H5Aread(attr_id, HDF5_INT, &Attribute);
+  h5_status = H5Aread(attr_id, HDF5_I4, &Attribute);
   if (io_log) fprintf(log_fptr, "H5Aread: status = %"ISYM"\n", (int) h5_status);
 
   h5_status = H5Aclose(attr_id);
   return SUCCESS;
 }
 
-// float
-#ifndef CONFIG_BFLOAT_8
-int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, float &Attribute, FILE *log_fptr) {
+// 64-bit int (Eint64)
+int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, Eint64 &Attribute, FILE *log_fptr) {
 
   hid_t attr_id;
 
   attr_id = H5Aopen_name(group_id, AttributeName);
   if (io_log) fprintf(log_fptr, "H5Aopen_name: attr_id = %"ISYM"\n", (int) attr_id);
 
-  h5_status = H5Aread(attr_id, HDF5_REAL, &Attribute);
+  h5_status = H5Aread(attr_id, HDF5_I8, &Attribute);
   if (io_log) fprintf(log_fptr, "H5Aread: status = %"ISYM"\n", (int) h5_status);
 
   h5_status = H5Aclose(attr_id);
 
   return SUCCESS;
 }
+
+// 32-bit float (Eflt32)
+int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, Eflt32 &Attribute, FILE *log_fptr) {
+
+  hid_t attr_id;
+
+  herr_t h5_status;
+
+  int io_log = 0;
+#ifdef IO_LOG
+  io_log = 1;
 #endif
+  attr_id = H5Aopen_name(group_id, AttributeName);
+  if (io_log) fprintf(log_fptr, "H5Aopen_name: attr_id = %"ISYM"\n", (int) attr_id);
 
-#ifdef CONFIG_PFLOAT_16
-// double
-int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, double &Attribute, FILE *log_fptr) {
+  h5_status = H5Aread(attr_id, HDF5_R4, &Attribute);
+  if (io_log) fprintf(log_fptr, "H5Aread: status = %"ISYM"\n", (int) h5_status);
+
+  h5_status = H5Aclose(attr_id);
+  if (io_log) fprintf(log_fptr, "H5Aclose: status = %"ISYM"\n", (int) h5_status);
+
+  return SUCCESS;
+}
+
+// 64-bit float (Eflt64)
+int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, Eflt64 &Attribute, FILE *log_fptr) {
 
   hid_t attr_id;
 
 
   return SUCCESS;
 }
-#endif
 
-// FLOAT
-int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, FLOAT &Attribute, FILE *log_fptr) {
+// 128-bit float (Eflt128)
+int HDF5_ReadAttribute(hid_t group_id, const char *AttributeName, Eflt128 &Attribute, FILE *log_fptr) {
 
   hid_t attr_id;
 
   attr_id = H5Aopen_name(group_id, AttributeName);
   if (io_log) fprintf(log_fptr, "H5Aopen_name: attr_id = %"ISYM"\n", (int) attr_id);
 
-  h5_status = H5Aread(attr_id, HDF5_PREC, &Attribute);
+  h5_status = H5Aread(attr_id, HDF5_R16, &Attribute);
   if (io_log) fprintf(log_fptr, "H5Aread: status = %"ISYM"\n", (int) h5_status);
 
   h5_status = H5Aclose(attr_id);

src/enzo/Grid_WriteHierarchyInformationHDF5.C

 
 //#define IO_LOG
 
-
-int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, int Attribute, FILE *log_fptr);
-int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, FLOAT Attribute, FILE *log_fptr);
+int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, Eint32 Attribute, FILE *log_fptr);
+int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, Eint64 Attribute, FILE *log_fptr);
+int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, Eflt32 Attribute, FILE *log_fptr);
+int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, Eflt64 Attribute, FILE *log_fptr);
+int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, Eflt128 Attribute, FILE *log_fptr);
 int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, int *Attribute, int NumberOfElements, FILE *log_fptr);
 int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, char *Attribute, FILE *log_fptr);
-#ifdef CONFIG_PFLOAT_16
-int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, double Attribute, FILE *log_fptr);
-#endif
-#ifdef SMALL_INTS
-int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, Eint64 Attribute, FILE *log_fptr);
-#endif
 
 int HDF5_WriteDataset(hid_t group_id, const char *DatasetName, int Dataset, FILE *log_fptr);
 int HDF5_WriteDataset(hid_t group_id, const char *DatasetName, int *Dataset, int NumberOfElements, FILE *log_fptr);
 // HDF5 utility routines (to write attributes and datasets)
 
 // int
-int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, int Attribute, FILE *log_fptr) {
+int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, Eint32 Attribute, FILE *log_fptr) {
 
   hid_t dspace_id, attr_id;
 
   return SUCCESS;
 }
 
-// int
-#ifdef SMALL_INTS
 int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, Eint64 Attribute, FILE *log_fptr) {
 
   hid_t dspace_id, attr_id;
 
   return SUCCESS;
 }
+
+
+// 32-bit float (Eflt32)
+int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, Eflt32 Attribute, FILE *log_fptr) {
+
+  hid_t dspace_id, attr_id;
+
+  herr_t h5_status;
+
+  int io_log = 0;
+#ifdef IO_LOG
+  io_log = 1;
 #endif
 
+  dspace_id = H5Screate(H5S_SCALAR);
+  if (io_log) fprintf(log_fptr, "H5Screate: dspace_id = %"ISYM"\n", (int) dspace_id);
 
-#ifdef CONFIG_PFLOAT_16
-// double
-int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, double Attribute, FILE *log_fptr) {
+  attr_id = H5Acreate(group_id, AttributeName, HDF5_R4, dspace_id, H5P_DEFAULT);
+  if (io_log) fprintf(log_fptr, "H5Acreate: attr_id = %"ISYM"\n", (int) attr_id);
+
+  h5_status = H5Awrite(attr_id,  HDF5_R4, &Attribute);
+  if (io_log) fprintf(log_fptr, "H5Awrite: status = %"ISYM"\n", (int) h5_status);
+
+  h5_status = H5Aclose(attr_id);
+  if (io_log) fprintf(log_fptr, "H5Aclose: status = %"ISYM"\n", (int) h5_status);
+  
+  h5_status = H5Sclose(dspace_id);
+  if (io_log) fprintf(log_fptr, "H5Sclose: status = %"ISYM"\n", (int) h5_status);
+
+  return SUCCESS;
+}
+
+
+// 64-bit float (Eflt64)
+int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, Eflt64 Attribute, FILE *log_fptr) {
 
   hid_t dspace_id, attr_id;
 
 
   return SUCCESS;
 }
-#endif
 
-// FLOAT
-int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, FLOAT Attribute, FILE *log_fptr) {
+// 128-bit float (Eflt128)
+int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, Eflt128 Attribute, FILE *log_fptr) {
 
   hid_t dspace_id, attr_id;
 
   dspace_id = H5Screate(H5S_SCALAR);
   if (io_log) fprintf(log_fptr, "H5Screate: dspace_id = %"ISYM"\n", (int) dspace_id);
 
-  attr_id = H5Acreate(group_id, AttributeName, HDF5_FILE_PREC, dspace_id, H5P_DEFAULT);
+  attr_id = H5Acreate(group_id, AttributeName, HDF5_R16, dspace_id, H5P_DEFAULT);
   if (io_log) fprintf(log_fptr, "H5Acreate: attr_id = %"ISYM"\n", (int) attr_id);
 
-  h5_status = H5Awrite(attr_id,  HDF5_PREC, &Attribute);
+  h5_status = H5Awrite(attr_id,  HDF5_R16, &Attribute);
   if (io_log) fprintf(log_fptr, "H5Awrite: status = %"ISYM"\n", (int) h5_status);
 
   h5_status = H5Aclose(attr_id);
   return SUCCESS;
 }
 
+
 // int vector
 int HDF5_WriteAttribute(hid_t group_id, const char *AttributeName, int *Attribute, int NumberOfElements, FILE *log_fptr) {