[MOAB-dev] r4791 - in MOAB/trunk: src src/io test/h5file test/parallel

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Mon May 2 17:07:51 CDT 2011


Author: kraftche
Date: 2011-05-02 17:07:51 -0500 (Mon, 02 May 2011)
New Revision: 4791

Modified:
   MOAB/trunk/src/FileOptions.cpp
   MOAB/trunk/src/FileOptions.hpp
   MOAB/trunk/src/io/ReadHDF5.cpp
   MOAB/trunk/src/io/ReadHDF5.hpp
   MOAB/trunk/test/h5file/h5partial.cpp
   MOAB/trunk/test/parallel/parallel_hdf5_test.cc
Log:
o Add FileOptions::get_toggle_option for options with yes/no/true/false values
o Change several #defines in ReadHDF5 to options controllable at runtime
o Add option to broadcast data rather than collectively read when reading
    the same data on all procs in ReadHDF5
o Add unit tests to test HDF5 reader with the above optional behaviors enabled


Modified: MOAB/trunk/src/FileOptions.cpp
===================================================================
--- MOAB/trunk/src/FileOptions.cpp	2011-05-02 18:08:11 UTC (rev 4790)
+++ MOAB/trunk/src/FileOptions.cpp	2011-05-02 22:07:51 UTC (rev 4791)
@@ -346,7 +346,33 @@
   return MB_FAILURE;
 }
 
+ErrorCode FileOptions::get_toggle_option( const char* name,
+                                          bool default_value,
+                                          bool& value ) const
+{
+  static const char* values[] = {
+    "true",  "yes", "1", "on",
+    "false", "no",  "0", "off",
+    0 };
+  const int num_true = 4;
+  
+  int index;
+  ErrorCode result = match_option( name, values, index );
+  if (result == MB_SUCCESS) {
+    value = index < num_true;
+  }
+  else if (result == MB_ENTITY_NOT_FOUND) {
+    value = default_value;
+    result = MB_SUCCESS;
+  }
+  else {
+    result = MB_TYPE_OUT_OF_RANGE;
+  }
+  
+  return result;
+}
 
+
 bool FileOptions::compare( const char* name, const char* option )
 {
   while (!strempty(name) && toupper(*name) == toupper(*option)) {

Modified: MOAB/trunk/src/FileOptions.hpp
===================================================================
--- MOAB/trunk/src/FileOptions.hpp	2011-05-02 18:08:11 UTC (rev 4790)
+++ MOAB/trunk/src/FileOptions.hpp	2011-05-02 22:07:51 UTC (rev 4791)
@@ -59,6 +59,22 @@
    */
   ErrorCode get_null_option( const char* name ) const;
   
+  
+  /**\brief Check for option with boolean (true/false, yes/no) value.
+   *
+   * Check for an option with a true/false value.  Allowable values


More information about the moab-dev mailing list