[MOAB-dev] r1650 - in MOAB/trunk: . mhdf/src

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Thu Mar 13 14:52:43 CDT 2008


Author: kraftche
Date: 2008-03-13 14:52:36 -0500 (Thu, 13 Mar 2008)
New Revision: 1650

Modified:
   MOAB/trunk/ReadHDF5.cpp
   MOAB/trunk/mhdf/src/adjacency.c
   MOAB/trunk/mhdf/src/file.c
   MOAB/trunk/mhdf/src/sets.c
   MOAB/trunk/mhdf/src/tags.c
   MOAB/trunk/mhdf/src/util.c
Log:
hdf5 1.8 API/ABI

Modified: MOAB/trunk/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/ReadHDF5.cpp	2008-03-13 19:31:27 UTC (rev 1649)
+++ MOAB/trunk/ReadHDF5.cpp	2008-03-13 19:52:36 UTC (rev 1650)
@@ -1195,7 +1195,11 @@
   if (array_size > 1)
   {
     hsize_t tmpsize = array_size;
+#if defined(H5Tarray_create_vers) && H5Tarray_create_vers > 1  
+    hdf_type = H5Tarray_create2( hdf_type, 1, &tmpsize );
+#else
     hdf_type = H5Tarray_create( hdf_type, 1, &tmpsize, NULL );
+#endif
     if (hdf_type < 0)
       return MB_FAILURE;
   }  

Modified: MOAB/trunk/mhdf/src/adjacency.c
===================================================================
--- MOAB/trunk/mhdf/src/adjacency.c	2008-03-13 19:31:27 UTC (rev 1649)
+++ MOAB/trunk/mhdf/src/adjacency.c	2008-03-13 19:52:36 UTC (rev 1650)
@@ -37,7 +37,11 @@
   
   if (elem_group == mhdf_node_type_handle())
   {
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+    elem_id = H5Gopen( file_ptr->hdf_handle, NODE_GROUP, H5P_DEFAULT );
+#else
     elem_id = H5Gopen( file_ptr->hdf_handle, NODE_GROUP );
+#endif
     if (elem_id < 0)
     {
       mhdf_setFail( status, "H5Gopen( \"%s\" ) failed.\n", NODE_GROUP );

Modified: MOAB/trunk/mhdf/src/file.c
===================================================================
--- MOAB/trunk/mhdf/src/file.c	2008-03-13 19:31:27 UTC (rev 1649)
+++ MOAB/trunk/mhdf/src/file.c	2008-03-13 19:52:36 UTC (rev 1650)
@@ -83,7 +83,11 @@
   }
   
     /* Store the max ID as an attribite on the /tstt/ group */
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( file_ptr->hdf_handle, ROOT_GROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( file_ptr->hdf_handle, ROOT_GROUP );
+#endif
   rval = mhdf_create_scalar_attrib( group_id, 
                                     MAX_ID_ATTRIB, 
                                     H5T_NATIVE_ULONG, 
@@ -120,7 +124,11 @@
       return NULL;
     }
   }
+#if defined(H5Tcommit_vers) && H5Tcommit_vers > 1
+  if (H5Tcommit2( file_ptr->hdf_handle, TYPE_ENUM_PATH, enum_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT ) < 0)  
+#else
   if (H5Tcommit( file_ptr->hdf_handle, TYPE_ENUM_PATH, enum_id ) < 0)  
+#endif
   {
     mhdf_setFail( status, "Failed to store elem type list." );
     H5Fclose( file_ptr->hdf_handle );
@@ -159,10 +167,18 @@
   int rank;
   hsize_t dims[2];
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  elem_id = H5Gopen2( group_id, subgroup, H5P_DEFAULT );
+#else
   elem_id = H5Gopen( group_id, subgroup );
+#endif
   if (elem_id < 0) return (herr_t)-1;
   
+#if defined(H5Dopen_vers) && H5Dopen_vers > 1  
+  conn_id = H5Dopen2( elem_id, datatable, H5P_DEFAULT );
+#else
   conn_id = H5Dopen( elem_id, datatable );
+#endif
   H5Gclose( elem_id );
   if (conn_id < 0) return (herr_t)-1;
   
@@ -202,7 +218,11 @@
   herr_t rval;
   
     /* Check for new format, with max_id as attrib of root group */
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( file_ptr->hdf_handle, ROOT_GROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( file_ptr->hdf_handle, ROOT_GROUP );
+#endif
   if (group_id < 0)
   {
     mhdf_setFail( status, "Internal error - invalid file.");
@@ -287,7 +307,11 @@
   }
   
     /* Check for TSTT data in file */
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( file_ptr->hdf_handle, ROOT_GROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( file_ptr->hdf_handle, ROOT_GROUP );
+#endif
   if (group_id < 0)
   {
     mhdf_setFail( status, "Invalid file \"%s\"\n", filename );
@@ -464,8 +488,12 @@
       name );
     return;
   }
-  
+
+#if defined(H5Gcreate_vers) && H5Gcreate_vers > 1
+  group_id = H5Gcreate2( file_ptr->hdf_handle, path, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+#else
   group_id = H5Gcreate( file_ptr->hdf_handle, path, 3 );
+#endif
   if (group_id < 0)
   {
     mhdf_setFail( status, "Creation of \"%s\" group failed.\n", path );
@@ -474,7 +502,11 @@
   }
   free( path );
   
+#if defined(H5Gcreate_vers) && H5Gcreate_vers > 1
+  tag_id = H5Gcreate2( group_id, DENSE_TAG_SUBGROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+#else
   tag_id = H5Gcreate( group_id, DENSE_TAG_SUBGROUP, 0 );
+#endif
   if (tag_id < 0)
   {
     H5Gclose( group_id );
@@ -530,7 +562,11 @@
   if (!mhdf_check_valid_file( file_ptr, status ))
     return NULL;
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( file_ptr->hdf_handle, ELEMENT_GROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( file_ptr->hdf_handle, ELEMENT_GROUP );
+#endif
   if (group_id < 0) 
   {
     mhdf_setFail( status, "Invalid file -- element group does not exist." );
@@ -643,7 +679,11 @@
 static int
 make_hdf_group( const char* path, hid_t file, size_t size, mhdf_Status* status )
 {
+#if defined(H5Gcreate_vers) && H5Gcreate_vers > 1
+  hid_t handle = H5Gcreate2( file, path, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+#else
   hid_t handle = H5Gcreate( file, path, size );
+#endif
   if (handle < 0)
   {
     mhdf_setFail( status, "Failed to create \"%s\" group.", path );
@@ -726,7 +766,11 @@
     return;
   }
   
+#if defined(H5Dcreate_vers) && H5Dcreate_vers > 1
+  data_id = H5Dcreate2( file_ptr->hdf_handle, HISTORY_PATH, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+#else
   data_id = H5Dcreate( file_ptr->hdf_handle, HISTORY_PATH, type_id, space_id, H5P_DEFAULT );
+#endif
   H5Sclose( space_id );
   if (data_id < 0)
   {
@@ -766,7 +810,11 @@
     return NULL;
   
     /* check if file contains history data */
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( file_ptr->hdf_handle, ROOT_GROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( file_ptr->hdf_handle, ROOT_GROUP );
+#endif
   if (group_id < 0)
   {
     mhdf_setFail( status, "Could not open root group.  Invalid file." );
@@ -783,7 +831,11 @@
     return NULL;
   }
   
+#if defined(H5Dopen_vers) && H5Dopen_vers > 1  
+  data_id = H5Dopen2( group_id, HISTORY_NAME, H5P_DEFAULT );
+#else
   data_id = H5Dopen( group_id, HISTORY_NAME );
+#endif
   H5Gclose( group_id );
   if (data_id < 0)
   {

Modified: MOAB/trunk/mhdf/src/sets.c
===================================================================
--- MOAB/trunk/mhdf/src/sets.c	2008-03-13 19:31:27 UTC (rev 1649)
+++ MOAB/trunk/mhdf/src/sets.c	2008-03-13 19:52:36 UTC (rev 1650)
@@ -38,8 +38,12 @@
   
   if (!mhdf_check_valid_file( file_ptr, status ))
     return -1;
-  
+
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  root_id = H5Gopen2( file_ptr->hdf_handle, ROOT_GROUP, H5P_DEFAULT );
+#else
   root_id = H5Gopen( file_ptr->hdf_handle, ROOT_GROUP );
+#endif
   if (root_id < 0)
   {
     mhdf_setFail( status, "H5Gopen( \"%s\" ) failed.", ROOT_GROUP );
@@ -53,7 +57,11 @@
     return result;
   }
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  set_id = H5Gopen2( root_id, SET_GROUP_NAME, H5P_DEFAULT );
+#else
   set_id = H5Gopen( root_id, SET_GROUP_NAME );
+#endif
   H5Gclose( root_id );
   if (set_id < 0)
   {

Modified: MOAB/trunk/mhdf/src/tags.c
===================================================================
--- MOAB/trunk/mhdf/src/tags.c	2008-03-13 19:31:27 UTC (rev 1649)
+++ MOAB/trunk/mhdf/src/tags.c	2008-03-13 19:52:36 UTC (rev 1650)
@@ -117,7 +117,11 @@
   if (NULL == path)
     return -1;
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( file_ptr->hdf_handle, TAG_GROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( file_ptr->hdf_handle, TAG_GROUP );
+#endif
   if (group_id < 0)
   {
     mhdf_setFail( status, "Failed to open tag group." );
@@ -125,7 +129,11 @@
     return -1;
   }
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  tag_id = H5Gopen2( group_id, path, H5P_DEFAULT );
+#else
   tag_id = H5Gopen( group_id, path );
+#endif
   H5Gclose( group_id );
   free( path );
   if (tag_id < 0)
@@ -145,14 +153,22 @@
 {
   hid_t group_id, tag_id, type_id;
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( file_ptr->hdf_handle, TAG_GROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( file_ptr->hdf_handle, TAG_GROUP );
+#endif
   if (group_id < 0)
   {
     mhdf_setFail( status, "Failed to open tag group." );
     return -1;
   }
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  tag_id = H5Gopen2( group_id, tag_path, H5P_DEFAULT );
+#else
   tag_id = H5Gopen( group_id, tag_path );
+#endif
   H5Gclose( group_id );
   if (tag_id < 0)
   {
@@ -160,7 +176,11 @@
     return -1;
   }
   
+#if defined(H5Topen_vers) && H5Topen_vers > 1  
+  type_id = H5Topen2( tag_id, TAG_TYPE_NAME, H5P_DEFAULT );
+#else
   type_id = H5Topen( tag_id, TAG_TYPE_NAME );
+#endif
   H5Gclose( tag_id );
   if (type_id < 0)
   {
@@ -191,10 +211,16 @@
   int rval;
   if (value_size == 1) 
     write_type = type_id;
-  else if (H5Tget_class(type_id) == H5T_OPAQUE) 
+  else if (H5Tget_class(type_id) == H5T_OPAQUE) {
     write_type = H5Tcreate( H5T_OPAQUE, abs(value_size) );
-  else
+  }
+  else {
+#if defined(H5Tarray_create_vers) && H5Tarray_create_vers > 1  
+    write_type = H5Tarray_create2( type_id, 1, &value_size );
+#else
     write_type = H5Tarray_create( type_id, 1, &value_size, 0 );
+#endif
+  }
   
   if (write_type < 0) {
     mhdf_setFail( status, "Error constructing type object for tag mesh/default value" );
@@ -245,7 +271,11 @@
   
     /* Open the tag group */
 
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( file_ptr->hdf_handle, TAG_GROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( file_ptr->hdf_handle, TAG_GROUP );
+#endif
   if (group_id < 0)
   {
     mhdf_setFail( status, "H5Gopen(\"%s\") failed.", TAG_GROUP );
@@ -263,7 +293,11 @@
   
     /* Create group for this tag */
 
+#if defined(H5Gcreate_vers) && H5Gcreate_vers > 1
+  tag_id = H5Gcreate2( group_id, path, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+#else
   tag_id = H5Gcreate( group_id, path, 3 );
+#endif
   if (tag_id < 0)
   {
      mhdf_setFail( status, "H5Gcreate( \"%s\" ) failed.", path );
@@ -387,7 +421,11 @@
   }
   else if (arr_len > 1)
   {
+#if defined(H5Tarray_create_vers) && H5Tarray_create_vers > 1  
+    temp_id = H5Tarray_create2( hdf_type, 1, &arr_len);
+#else
     temp_id = H5Tarray_create( hdf_type, 1, &arr_len, NULL );
+#endif
     H5Tclose( hdf_type );
     if (temp_id < 0)
     {
@@ -403,7 +441,11 @@
   
     /* Create tag type object, or write attribute if opaque */
  
+#if defined(H5Tcommit_vers) && H5Tcommit_vers > 1
+  rval = H5Tcommit2( tag_id, TAG_TYPE_NAME, hdf_type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+#else
   rval = H5Tcommit( tag_id, TAG_TYPE_NAME, hdf_type );
+#endif
   if (rval < 0)
   {
     mhdf_setFail( status, "H5Tcommit failed for tag \"%s\"", tag_name );
@@ -530,7 +572,11 @@
   
     /* Open the tags group */
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( file_ptr->hdf_handle, TAG_GROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( file_ptr->hdf_handle, TAG_GROUP );
+#endif
   if (group_id < 0)
   {
     mhdf_setFail( status, "H5Gopen(\"%s\") failed", TAG_GROUP);
@@ -574,7 +620,11 @@
   
     /* Open the tags group */
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( file_ptr->hdf_handle, TAG_GROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( file_ptr->hdf_handle, TAG_GROUP );
+#endif
   if (group_id < 0)
   {
     mhdf_setFail( status, "H5Gopen(\"%s\") failed", TAG_GROUP);
@@ -656,7 +706,11 @@
       dims[0] = H5Tget_size( type_id );
       break;
     case H5T_ARRAY:
+#if defined(H5Tget_array_dims_vers) && H5Tget_array_dims_vers > 1
+      rank = H5Tget_array_dims2( type_id, dims );
+#else
       rank = H5Tget_array_dims( type_id, dims, perm );
+#endif
       if (rank == 1)
         break;
       else
@@ -823,7 +877,10 @@
   is_handle = rval;
     
     /* Get tag type */
-  type_id = H5Topen( tag_id, TAG_TYPE_NAME );
+#if defined(H5Topen_vers) && H5Topen_vers > 1  
+  type_id = H5Topen2( tag_id, TAG_TYPE_NAME, H5P_DEFAULT );
+#else
+#endif
   if (type_id < 0)
   {
     H5Gclose( tag_id );
@@ -881,7 +938,11 @@
     
     case H5T_ARRAY:
       
+#if defined(H5Tget_array_dims_vers) && H5Tget_array_dims_vers > 1
+      rank = H5Tget_array_dims2( type_id, dims );
+#else
       rank = H5Tget_array_dims( type_id, dims, perm );
+#endif
       if (rank <= 0)
       {
         mhdf_setFail( status, "H5Tget_size failed." );
@@ -976,7 +1037,7 @@
 read_tag_attrib_data( hid_t tag_id, 
                       const char* attrib_name, 
                       hid_t type_id,
-                      const void* data, 
+                      void* data, 
                       int is_var_len, 
                       mhdf_Status* status )
 {
@@ -1009,8 +1070,13 @@
       /* caller passes type_id == 0 for OPAQUE */
     if (0 == type_id)
       read_type = H5Tcreate( H5T_OPAQUE, len );
-    else
+    else {
+#if defined(H5Tarray_create_vers) && H5Tarray_create_vers > 1  
+      read_type = H5Tarray_create2( type_id, 1, &len );
+#else
       read_type = H5Tarray_create( type_id, 1, &len, 0 );
+#endif
+    }
     if (read_type < 0)
     {
       mhdf_setFail( status, "Failed to read mesh/default value for tag" );
@@ -1100,13 +1166,21 @@
   
   if (type_handle == mhdf_node_type_handle())
   {
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+    elem_id = H5Gopen2( file_ptr->hdf_handle, NODE_GROUP, H5P_DEFAULT );
+#else
     elem_id = H5Gopen( file_ptr->hdf_handle, NODE_GROUP );
+#endif
     if (elem_id < 0)
       mhdf_setFail( status, "Could not open node group." );
   }
   else if (type_handle == mhdf_set_type_handle())
   {
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+    elem_id = H5Gopen2( file_ptr->hdf_handle, SET_GROUP, H5P_DEFAULT );
+#else
     elem_id = H5Gopen( file_ptr->hdf_handle, SET_GROUP );
+#endif
     if (elem_id < 0)
       mhdf_setFail( status, "Could not open set group." );
   }
@@ -1129,7 +1203,11 @@
     return 0;
   }
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( elem_id, DENSE_TAG_SUBGROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( elem_id, DENSE_TAG_SUBGROUP );
+#endif
   H5Gclose( elem_id );
   if (group_id < 0)
   {
@@ -1172,13 +1250,21 @@
   
   if (type_handle == mhdf_node_type_handle())
   {
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+    elem_id = H5Gopen2( file_ptr->hdf_handle, NODE_GROUP, H5P_DEFAULT );
+#else
     elem_id = H5Gopen( file_ptr->hdf_handle, NODE_GROUP );
+#endif
     if (elem_id < 0)
       mhdf_setFail( status, "Could not open node group." );
   }
   else if (type_handle == mhdf_set_type_handle())
   {
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+    elem_id = H5Gopen2( file_ptr->hdf_handle, SET_GROUP, H5P_DEFAULT );
+#else
     elem_id = H5Gopen( file_ptr->hdf_handle, SET_GROUP );
+#endif
     if (elem_id < 0)
       mhdf_setFail( status, "Could not open set group." );
   }
@@ -1233,13 +1319,21 @@
   
   if (type_handle == mhdf_node_type_handle())
   {
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+    elem_id = H5Gopen2( file_ptr->hdf_handle, NODE_GROUP, H5P_DEFAULT );
+#else
     elem_id = H5Gopen( file_ptr->hdf_handle, NODE_GROUP );
+#endif
     if (elem_id < 0)
       mhdf_setFail( status, "Could not open node group." );
   }
   else if (type_handle == mhdf_set_type_handle())
   {
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+    elem_id = H5Gopen2( file_ptr->hdf_handle, SET_GROUP, H5P_DEFAULT );
+#else
     elem_id = H5Gopen( file_ptr->hdf_handle, SET_GROUP );
+#endif
     if (elem_id < 0)
       mhdf_setFail( status, "Could not open set group." );
   }
@@ -1350,7 +1444,11 @@
   tag_id = get_tag( file_handle, tag_name, status );
   if (tag_id < 0) return ;
   
+#if defined(H5Topen_vers) && H5Topen_vers > 1  
+  type_id = H5Topen2( tag_id, TAG_TYPE_NAME, H5P_DEFAULT );
+#else
   type_id = H5Topen( tag_id, TAG_TYPE_NAME );
+#endif
   if (type_id < 0)
   {
     H5Gclose( tag_id );
@@ -1399,7 +1497,11 @@
   tag_id = get_tag( file_handle, tag_name, status );
   if (tag_id < 0) return ;
   
+#if defined(H5Topen_vers) && H5Topen_vers > 1  
+  type_id = H5Topen2( tag_id, TAG_TYPE_NAME, H5P_DEFAULT );
+#else
   type_id = H5Topen( tag_id, TAG_TYPE_NAME );
+#endif
   if (type_id < 0)
   {
     H5Gclose( tag_id );

Modified: MOAB/trunk/mhdf/src/util.c
===================================================================
--- MOAB/trunk/mhdf/src/util.c	2008-03-13 19:31:27 UTC (rev 1649)
+++ MOAB/trunk/mhdf/src/util.c	2008-03-13 19:52:36 UTC (rev 1650)
@@ -146,7 +146,11 @@
   if (NULL == path)
     return -1;
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  result = H5Gopen2( file_ptr->hdf_handle, path, H5P_DEFAULT );
+#else
   result = H5Gopen( file_ptr->hdf_handle, path );
+#endif
   free( path );
   if (result < 0)
     mhdf_setFail( status, "Failed to open element group: \"%s\"", elem_handle );
@@ -169,7 +173,11 @@
     return 0;
   }
  
+#if defined(H5Acreate_vers) && H5Acreate_vers > 1
+  attr_id = H5Acreate2( object, name, type, dspace_id, H5P_DEFAULT, H5P_DEFAULT );
+#else
   attr_id = H5Acreate( object, name, type, dspace_id, H5P_DEFAULT );
+#endif
   H5Sclose( dspace_id );
   if (attr_id < 0)
   {
@@ -232,7 +240,11 @@
   return 1;
 }
 
+#if defined(H5Aiterate_vers) && H5Aiterate_vers > 1
+static herr_t find_attr_by_name( hid_t handle, const char* name, const H5A_info_t* info, void* mydata )
+#else
 static herr_t find_attr_by_name( hid_t handle, const char* name, void* mydata )
+#endif
   { return !strcmp( name, (const char*)mydata ); } 
 
 int mhdf_find_attribute ( hid_t object, 
@@ -241,8 +253,14 @@
                           mhdf_Status* status )
 {
   herr_t rval;
+#if defined(H5Aiterate_vers) && H5Aiterate_vers > 1
+  hsize_t idx = 0;
+  rval = H5Aiterate2( object, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, &idx, &find_attr_by_name, (void*)attrib_name );
+  *index_out = (unsigned int)idx;
+#else
   *index_out = 0;
   rval = H5Aiterate( object, index_out, &find_attr_by_name, (void*)attrib_name );
+#endif
   if (rval < 0)
     mhdf_setFail( status, "Internal error calling H5Aiterate." );
   return (int)rval;
@@ -510,7 +528,11 @@
     return -1;
   }
   
+#if defined(H5Dcreate_vers) && H5Dcreate_vers > 1
+  table_id = H5Dcreate2( group_id, path, type, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+#else
   table_id = H5Dcreate( group_id, path, type, space_id, H5P_DEFAULT );
+#endif
   H5Sclose(space_id);
   if (table_id < 0)
   {
@@ -534,7 +556,11 @@
   hsize_t dims[2];
   int rank;
   
+#if defined(H5Dopen_vers) && H5Dopen_vers > 1  
+  table_id = H5Dopen2( group_id, path, H5P_DEFAULT );
+#else
   table_id = H5Dopen( group_id, path );
+#endif
   if (table_id < 0)
   {
     mhdf_setFail( status, "HDF5 DataSet creation failed.");
@@ -582,7 +608,11 @@
 {
   hid_t table_id, space_id;
   
+#if defined(H5Dopen_vers) && H5Dopen_vers > 1  
+  table_id = H5Dopen2( group_id, path, H5P_DEFAULT );
+#else
   table_id = H5Dopen( group_id, path );
+#endif
   if (table_id < 0)
   {
     mhdf_setFail( status, "HDF5 DataSet creation failed.");
@@ -691,7 +721,11 @@
 get_elem_type_enum( FileHandle* file_ptr, mhdf_Status* status )
 {
   hid_t result;
+#if defined(H5Topen_vers) && H5Topen_vers > 1  
+  result = H5Topen2( file_ptr->hdf_handle, TYPE_ENUM_PATH, H5P_DEFAULT );
+#else
   result = H5Topen( file_ptr->hdf_handle, TYPE_ENUM_PATH );
+#endif
   if (result < 0)
     mhdf_setFail( status, "Element type enum does not exist in file.  Invalid file." );
   return result;
@@ -703,7 +737,11 @@
   hid_t group_id, attr_id, space_id;
   herr_t rval;
   
+#if defined(H5Gopen_vers) && H5Gopen_vers > 1  
+  group_id = H5Gopen2( file_ptr->hdf_handle, ROOT_GROUP, H5P_DEFAULT );
+#else
   group_id = H5Gopen( file_ptr->hdf_handle, ROOT_GROUP );
+#endif
   if (group_id < 0)
   {
     mhdf_setFail( status, "Internal error -- file invalid." );
@@ -714,11 +752,20 @@
   if (attr_id < 0)
   {
     space_id = H5Screate( H5S_SCALAR );
+#if defined(H5Acreate_vers) && H5Acreate_vers > 1
+    attr_id = H5Acreate2( group_id, 
+                          MAX_ID_ATTRIB, 
+                          H5T_NATIVE_ULONG,
+                          space_id, 
+                          H5P_DEFAULT,
+                          H5P_DEFAULT );
+#else
     attr_id = H5Acreate( group_id, 
                          MAX_ID_ATTRIB, 
                          H5T_NATIVE_ULONG,
                          space_id, 
                          H5P_DEFAULT );
+#endif
     H5Sclose( space_id );
   }
   H5Gclose( group_id );




More information about the moab-dev mailing list