[cig-commits] r13738 - cs/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Wed Dec 17 02:32:41 PST 2008


Author: luis
Date: 2008-12-17 02:32:41 -0800 (Wed, 17 Dec 2008)
New Revision: 13738

Modified:
   cs/cigma/trunk/src/io_hdf5_writer.cpp
   cs/cigma/trunk/src/io_hdf5_writer.h
Log:
Functions for identifying group/dataset on a given location

Modified: cs/cigma/trunk/src/io_hdf5_writer.cpp
===================================================================
--- cs/cigma/trunk/src/io_hdf5_writer.cpp	2008-12-17 10:32:39 UTC (rev 13737)
+++ cs/cigma/trunk/src/io_hdf5_writer.cpp	2008-12-17 10:32:41 UTC (rev 13738)
@@ -58,7 +58,6 @@
     return 0;
 }
 
-
 int HDF5_Writer::writeDataset(const char *loc, const double *data, int nno, int ndim)
 {
     TRI_LOG_STR("HDF5_Writer::writeDataset()");
@@ -80,6 +79,28 @@
     return write_full_dataset<int,int>(file, loc, connectivity, nel, ndofs);
 }
 
+bool HDF5_Writer::locationIsGroup(const char *loc) const
+{
+    H5::Group* group = h5_open_group(file, loc);
+    if (group != 0)
+    {
+        delete group;
+        return true;
+    }
+    return false;
+}
+
+bool HDF5_Writer::locationIsDataset(const char *loc) const
+{
+    H5::DataSet* dataset = h5_open_dataset(file, loc);
+    if (dataset != 0)
+    {
+        delete dataset;
+        return true;
+    }
+    return false;
+}
+
 #else
 
 HDF5_Writer::HDF5_Writer()
@@ -117,4 +138,14 @@
     return -1;
 }
 
+bool HDF5_Writer::locationIsGroup(const char *loc) const
+{
+    return false;
+}
+
+bool HDF5_Writer::locationIsDataset(const char *loc) const
+{
+    return false;
+}
+
 #endif

Modified: cs/cigma/trunk/src/io_hdf5_writer.h
===================================================================
--- cs/cigma/trunk/src/io_hdf5_writer.h	2008-12-17 10:32:39 UTC (rev 13737)
+++ cs/cigma/trunk/src/io_hdf5_writer.h	2008-12-17 10:32:41 UTC (rev 13738)
@@ -27,6 +27,9 @@
     int writeCoordinates(const char *loc, const double *coordinates, int nno, int nsd);
     int writeConnectivity(const char *loc, const int *connectivity, int nel, int ndofs);
 
+    bool locationIsGroup(const char *loc) const;
+    bool locationIsDataset(const char *loc) const;
+
 #ifdef HAVE_HDF5
 public:
     H5::H5File *file;



More information about the CIG-COMMITS mailing list