[MOAB-dev] r2752 - MOAB/trunk

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Wed Mar 25 16:27:03 CDT 2009


Author: kraftche
Date: 2009-03-25 16:27:03 -0500 (Wed, 25 Mar 2009)
New Revision: 2752

Modified:
   MOAB/trunk/WriteHDF5.cpp
   MOAB/trunk/WriteHDF5.hpp
Log:
allow specification of non-standard write properties (e.g. collective IO)

Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp	2009-03-25 21:03:02 UTC (rev 2751)
+++ MOAB/trunk/WriteHDF5.cpp	2009-03-25 21:27:03 UTC (rev 2752)
@@ -39,6 +39,7 @@
 #include <string.h>
 #include <limits>
 #include <H5Tpublic.h>
+#include <H5Ppublic.h>
 #include "MBInterface.hpp"
 #include "MBInternals.hpp"
 #include "MBTagConventions.hpp"
@@ -266,7 +267,8 @@
     writeSets(false),
     writeSetContents(false),
     writeSetChildren(false),
-    writeSetParents(false)
+    writeSetParents(false),
+    writeProp( H5P_DEFAULT )
 {
 }
 
@@ -719,7 +721,7 @@
         memset( buffer, 0, count * sizeof(double) );
       }
     
-      mhdf_writeNodeCoord( node_table, offset, count, d, buffer, &status );
+      mhdf_writeNodeCoordWithOpt( node_table, offset, count, d, buffer, writeProp, &status );
       CHK_MHDF_ERR_1(status, node_table);
     }
     
@@ -775,8 +777,8 @@
       if (0 == (buffer[i] = idMap.find( buffer[i] )))
         return MB_FAILURE;
     
-    mhdf_writeConnectivity( elem_table, offset, count, 
-                            id_type, buffer, &status );
+    mhdf_writeConnectivityWithOpt( elem_table, offset, count, 
+                                   id_type, buffer, writeProp, &status );
     CHK_MHDF_ERR_1(status, elem_table);
     
     offset += count;
@@ -903,18 +905,20 @@
     
       if (id_list.size())
       {
-        mhdf_writeSetData( content_table, 
-                           content_offset,
-                           id_list.size(),
-                           id_type,
-                           &id_list[0],
-                           &status );
+        mhdf_writeSetDataWithOpt( content_table, 
+                                  content_offset,
+                                  id_list.size(),
+                                  id_type,
+                                  &id_list[0],
+                                  writeProp,
+                                  &status );
         CHK_MHDF_ERR_2C(status, set_table, writeSetContents, content_table );
         content_offset += data_size;
       }
     }
 
-    mhdf_writeSetMeta( set_table, set_offset, count, H5T_NATIVE_LONG, buffer, &status );
+    mhdf_writeSetMetaWithOpt( set_table, set_offset, count, H5T_NATIVE_LONG, 
+                              buffer, writeProp, &status );
     CHK_MHDF_ERR_2C(status, set_table, writeSetContents, content_table );
     set_offset += count;
   }
@@ -953,12 +957,13 @@
       CHK_MB_ERR_1(rval, child_table, status);
 
 
-      mhdf_writeSetParentsChildren( child_table, 
-                                    child_offset, 
-                                    id_list.size(), 
-                                    id_type, 
-                                    &id_list[0], 
-                                    &status );
+      mhdf_writeSetParentsChildrenWithOpt( child_table, 
+                                           child_offset, 
+                                           id_list.size(), 
+                                           id_type, 
+                                           &id_list[0], 
+                                           writeProp,
+                                           &status );
       CHK_MHDF_ERR_1(status, child_table);
       child_offset += id_list.size();
     }
@@ -991,12 +996,13 @@
       CHK_MB_ERR_1(rval, parent_table, status);
 
 
-      mhdf_writeSetParentsChildren( parent_table, 
-                                    parent_offset, 
-                                    id_list.size(), 
-                                    id_type, 
-                                    &id_list[0], 
-                                    &status );
+      mhdf_writeSetParentsChildrenWithOpt( parent_table, 
+                                           parent_offset, 
+                                           id_list.size(), 
+                                           id_type, 
+                                           &id_list[0], 
+                                           writeProp,
+                                           &status );
       CHK_MHDF_ERR_1(status, parent_table);
       parent_offset += id_list.size();
     }
@@ -1274,7 +1280,7 @@
     
     if (count + adj_list.size() + 2 > (unsigned long)chunk_size)
     {
-      mhdf_writeAdjacency( table, offset, count, id_type, buffer, &status );
+      mhdf_writeAdjacencyWithOpt( table, offset, count, id_type, buffer, writeProp, &status );
       CHK_MHDF_ERR_1(status, table);
       
       offset += count;
@@ -1291,7 +1297,7 @@
   
   if (count)
   {
-    mhdf_writeAdjacency( table, offset, count, id_type, buffer, &status );
+    mhdf_writeAdjacencyWithOpt( table, offset, count, id_type, buffer, writeProp, &status );
     CHK_MHDF_ERR_1(status, table);
 
     offset += count;
@@ -1481,7 +1487,7 @@
     }
     else CHK_MB_ERR_1( rval, data_handle, status );
     
-    mhdf_writeDenseTag( data_handle, offset, count, type, dataBuffer, &status );
+    mhdf_writeDenseTagWithOpt( data_handle, offset, count, type, dataBuffer, writeProp, &status );
     CHK_MHDF_ERR_1( status, data_handle );
     
     offset += count;
@@ -1527,8 +1533,8 @@
     CHK_MB_ERR_0( rval );
     
       // write the data
-    mhdf_writeSparseTagEntities( id_table, offset, count, id_type, 
-                                 id_buffer, &status );
+    mhdf_writeSparseTagEntitiesWithOpt( id_table, offset, count, id_type, 
+                                        id_buffer, writeProp, &status );
     CHK_MHDF_ERR_0( status );
    
     offset += count;
@@ -1646,8 +1652,8 @@
                           count * mb_size / sizeof(MBEntityHandle) );
     
       // write the data
-    mhdf_writeSparseTagValues( tables[1], offset, count,
-                               value_type, tag_buffer, &status );
+    mhdf_writeSparseTagValuesWithOpt( tables[1], offset, count,
+                                      value_type, tag_buffer, writeProp, &status );
     if (mhdf_isError(&status) && value_type && value_type != id_type)
       H5Tclose( value_type );
     CHK_MHDF_ERR_1(status, tables[1]);
@@ -1768,7 +1774,10 @@
       if (bytes + size > data_buffer_size) {
           // write out tag data buffer
         if (bytes) { // bytes might be zero if tag value is larger than buffer
-          mhdf_writeSparseTagValues( tables[1], data_offset, bytes / type_size, hdf_type, data_buffer, &status );
+          mhdf_writeSparseTagValuesWithOpt( tables[1], data_offset, 
+                                            bytes / type_size, 
+                                            hdf_type, data_buffer, 
+                                            writeProp, &status );
           CHK_MHDF_ERR_2(status, tables + 1);
           data_offset += bytes / type_size;
           bytes = 0;
@@ -1783,7 +1792,9 @@
                               &tmp_storage[0], tmp_storage.size() );
           ptr = &tmp_storage[0];
         }
-        mhdf_writeSparseTagValues( tables[1], data_offset, size / type_size, hdf_type, ptr, &status );
+        mhdf_writeSparseTagValuesWithOpt( tables[1], data_offset, 
+                                          size / type_size, hdf_type, ptr,
+                                          writeProp, &status );
         CHK_MHDF_ERR_2(status, tables + 1);
         data_offset += size / type_size;
       }
@@ -1800,7 +1811,9 @@
     }
     
       // write offsets
-    mhdf_writeSparseTagIndices( tables[2], offset_offset, count, H5T_NATIVE_LONG, offset_buffer, &status );
+    mhdf_writeSparseTagIndicesWithOpt( tables[2], offset_offset, count, 
+                                       H5T_NATIVE_LONG, offset_buffer, 
+                                       writeProp, &status );
     CHK_MHDF_ERR_2(status, tables + 1);
     offset_offset += count;
   }
@@ -1809,7 +1822,8 @@
     // flush data buffer
   if (bytes) {
       // write out tag data buffer
-    mhdf_writeSparseTagValues( tables[1], data_offset, bytes / type_size, hdf_type, data_buffer, &status );
+    mhdf_writeSparseTagValuesWithOpt( tables[1], data_offset, bytes / type_size,
+                                      hdf_type, data_buffer, writeProp, &status );
     CHK_MHDF_ERR_2(status, tables + 1);
     data_offset += bytes / type_size;
   }

Modified: MOAB/trunk/WriteHDF5.hpp
===================================================================
--- MOAB/trunk/WriteHDF5.hpp	2009-03-25 21:03:02 UTC (rev 2751)
+++ MOAB/trunk/WriteHDF5.hpp	2009-03-25 21:27:03 UTC (rev 2752)
@@ -242,6 +242,11 @@
 
   //! True if doing parallel write
   bool parallelWrite;
+  
+  //! Property set to pass to H5Dwrite calls. 
+  //! For serial, should be H5P_DEFAULTS.
+  //! For parallel, may request collective IO.
+  hid_t writeProp;
 
 private:
 



More information about the moab-dev mailing list