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

sjackson at cae.wisc.edu sjackson at cae.wisc.edu
Tue Jun 22 13:15:51 CDT 2010


Author: sjackson
Date: 2010-06-22 13:15:50 -0500 (Tue, 22 Jun 2010)
New Revision: 4015

Modified:
   MOAB/trunk/tools/dagmc/DagMC.hpp
   MOAB/trunk/tools/dagmc/ray_fire_test.cc
Log:
Fix DagMC's broken interface_revision() function

Modified: MOAB/trunk/tools/dagmc/DagMC.hpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.hpp	2010-06-21 20:48:31 UTC (rev 4014)
+++ MOAB/trunk/tools/dagmc/DagMC.hpp	2010-06-22 18:15:50 UTC (rev 4015)
@@ -7,7 +7,8 @@
 #include <vector>
 #include <string>
 #include <assert.h>
-#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include "moab/OrientedBoxTreeTool.hpp"
 
@@ -31,7 +32,7 @@
   ~DagMC();
 
   /** Return the version of this library */
-  float version(std::string *version_string = NULL);  /* PPHW: should this be static? */
+  static float version(std::string *version_string = NULL);
   /** Get subversion revision of this file (DagMC.hpp) */
   static unsigned int interface_revision();
 
@@ -395,7 +396,11 @@
 inline unsigned int DagMC::interface_revision()
 {
   unsigned int result = 0;
-  sscanf( DAGMC_INTERFACE_REVISION, "$Rev$\n", &result );
+  const char* interface_string = DAGMC_INTERFACE_REVISION; 
+  if( strlen(interface_string) >= 5 ){
+    // start looking for the revision number after "$Rev: " 
+    result = strtol( interface_string+5, NULL, 10 ); 
+  }
   return result;
 }
   

Modified: MOAB/trunk/tools/dagmc/ray_fire_test.cc
===================================================================
--- MOAB/trunk/tools/dagmc/ray_fire_test.cc	2010-06-21 20:48:31 UTC (rev 4014)
+++ MOAB/trunk/tools/dagmc/ray_fire_test.cc	2010-06-22 18:15:50 UTC (rev 4015)
@@ -233,6 +233,9 @@
     }
   }
 
+  std::cout << "DagMC Version: " << DagMC::version()
+	    << ", svn revision: " << DagMC::interface_revision() << std::endl;
+
   if( !filename ){
     usage("No filename specified", 0, argv[0] );
   }


More information about the moab-dev mailing list