[MOAB-dev] r3377 - MOAB/trunk/tools/dagmc

sjackson at cae.wisc.edu sjackson at cae.wisc.edu
Fri Nov 20 11:39:29 CST 2009


Author: sjackson
Date: 2009-11-20 11:39:29 -0600 (Fri, 20 Nov 2009)
New Revision: 3377

Modified:
   MOAB/trunk/tools/dagmc/DagMC.cpp
Log:
Make DagMC check for MB_UNHANDLED_OPTION upon file load, and emit a warning 
if the error code is found unexpectedly.


Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2009-11-20 17:22:57 UTC (rev 3376)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2009-11-20 17:39:29 UTC (rev 3377)
@@ -900,20 +900,17 @@
   char options[120] = "CGM_ATTRIBS=yes;FACET_DISTANCE_TOLERANCE=";
   strcat(options,facetTolStr);
 
-  // As of r3273, loading fails if we pass options that a file reader can't recognize.
-  // In particular, the h5m reader does not recognize the options given above.
-  // As a temporary workaround, check for an .h5m filename and throw
-  // away the options if one is found.  -- sjackson, 11/16/09
-  {
+  rval = MBI->load_file(cfile, 0, options, NULL, 0, 0);
+  
+  if( MB_UNHANDLED_OPTION == rval ){
+    // Some options were unhandled; this is common for loading h5m files.
+    // Print a warning if an option was unhandled for a file that does not end in '.h5m'
     std::string filename(cfile);
-    if( filename.length() > 4 && filename.substr(filename.length()-4) == ".h5m"){
-      options[0]='\0';
+    if( filename.length() < 4 || filename.substr(filename.length()-4) != ".h5m"){
+      std::cerr << "DagMC warning: unhandled file loading options." << std::endl;
     }
   }
-
-    
-  rval = MBI->load_file(cfile, 0, options, NULL, 0, 0);
-  if (MB_SUCCESS != rval) {
+  else if (MB_SUCCESS != rval) {
     std::cerr << "Couldn't read file " << cfile << std::endl;
     return rval;
   }



More information about the moab-dev mailing list