[MOAB-dev] r4289 - MOAB/trunk/tools/mcnpmit

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Fri Nov 19 09:26:52 CST 2010


Author: kraftche
Date: 2010-11-19 09:26:51 -0600 (Fri, 19 Nov 2010)
New Revision: 4289

Modified:
   MOAB/trunk/tools/mcnpmit/main.cpp
   MOAB/trunk/tools/mcnpmit/mcnpmit.cpp
   MOAB/trunk/tools/mcnpmit/mcnpmit.hpp
Log:
portability fixes

Modified: MOAB/trunk/tools/mcnpmit/main.cpp
===================================================================
--- MOAB/trunk/tools/mcnpmit/main.cpp	2010-11-19 15:26:37 UTC (rev 4288)
+++ MOAB/trunk/tools/mcnpmit/main.cpp	2010-11-19 15:26:51 UTC (rev 4289)
@@ -400,11 +400,7 @@
       if (j > slen)
 	j = slen;
 
-      // Extract the number out of the string
-      char cn[j-i];
-      s.copy(cn,j-i,i);
-
-      d = std::atof(cn);
+      d = std::atof(s.substr(i,j-i).c_str());
       p = j+1;
 
       return MCNP_SUCCESS;
@@ -428,11 +424,7 @@
       if (j > slen)
 	j = slen;
 
-      // Extract the number out of the string
-      char cn[j-i];
-      s.copy(cn,j-i,i);
-
-      k = std::atoi(cn);
+      k = std::atoi(s.substr(i,j-i).c_str());
       p = j+1;
 
       return MCNP_SUCCESS;

Modified: MOAB/trunk/tools/mcnpmit/mcnpmit.cpp
===================================================================
--- MOAB/trunk/tools/mcnpmit/mcnpmit.cpp	2010-11-19 15:26:37 UTC (rev 4288)
+++ MOAB/trunk/tools/mcnpmit/mcnpmit.cpp	2010-11-19 15:26:51 UTC (rev 4289)
@@ -7,6 +7,11 @@
 
 moab::Interface* mb_instance();
 
+// Parameters
+const double pi   = 3.141592653589793;
+const double c2pi = 0.1591549430918954;
+const double cpi  = 0.3183098861837907;
+
 MCNPError next_number(std::string, double&, int&);
 int how_many_numbers(std::string);
 MCNPError read_numbers(std::string, int, std::vector<double>&);
@@ -362,11 +367,7 @@
                         j = slen;
 
                   // Extract the number out of the string


More information about the moab-dev mailing list