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

tautges at mcs.anl.gov tautges at mcs.anl.gov
Thu Oct 11 14:09:08 CDT 2007


Author: tautges
Date: 2007-10-11 14:09:08 -0500 (Thu, 11 Oct 2007)
New Revision: 1309

Modified:
   MOAB/trunk/tools/dagmc/DagMC.cpp
   MOAB/trunk/tools/dagmc/DagMC.hpp
Log:

- Changing entHandles[] to surf_handles or vol_handles, to stay
consistent
- Adding version number to DagMC library
- Parsing facetingTolerance, and checking for error if facet tolerance
is set but application requests read of mesh file



Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2007-10-10 19:31:47 UTC (rev 1308)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2007-10-11 19:09:08 UTC (rev 1309)
@@ -181,6 +181,7 @@
     std::cerr << "Invalid source_cell = " << moabMCNPSourceCell << std::endl;
     exit(2);
   }
+
   distanceTolerance = strtod( options[1].value.c_str(), 0 );
   if (distanceTolerance <= 0 || distanceTolerance > 1) {
     std::cerr << "Invalid distance_tolerance = " << distanceTolerance << std::endl;
@@ -198,12 +199,19 @@
   }
 #endif  
     
+  facetingTolerance = strtod( options[4].value.c_str(), 0 );
+  if (facetingTolerance <= 0) {
+    std::cerr << "Invalid faceting_tolerance = " << facetingTolerance << std::endl;
+    exit(2);
+  }
+
 }
 
 void DagMC::read_settings( const char* filename )
 {
   int num_opt = sizeof(options) / sizeof(options[0]);
   FILE* file;
+  
   if (filename && (file = fopen( filename, "r" ))) {
     int line = 0;
     char buffer[256];
@@ -248,6 +256,7 @@
         if (options[i].name == p) {
           found = true;
           options[i].value = v;
+          options[i].user_set = true;
         }
       }
       if (!found) 
@@ -756,6 +765,10 @@
                 << " turning that parameter off for you." << std::endl;
       useCAD = 0;
     }
+    else if (options[4].user_set == true) {
+      std::cerr << "Warning: user-set tolerance won't apply to pre-generated mesh file." 
+                << std::endl;
+    }
   }
 
   MBRange surfs, vols;
@@ -1363,18 +1376,18 @@
     // store surf/vol handles lists (surf/vol by index) and
     // index by handle lists
   surf_handles().resize( surfs.size() + 1 );
-  std::vector<MBEntityHandle>::iterator iter = entHandles[2].begin();
+  std::vector<MBEntityHandle>::iterator iter = surf_handles().begin();
   *(iter++) = 0;
   std::copy( surfs.begin(), surfs.end(), iter );
-  entHandles[3].push_back(impl_compl_handle);
   int idx = 1;
   for (MBRange::iterator rit = surfs.begin(); rit != surfs.end(); rit++)
     entIndices[*rit-setOffset] = idx++;
   
-  entHandles[3].resize( vols.size() + 1 );
-  iter = entHandles[3].begin();
+  vol_handles().resize( vols.size() + 1 );
+  iter = vol_handles().begin();
   *(iter++) = 0;
   std::copy( vols.begin(), vols.end(), iter );
+  vol_handles().push_back(impl_compl_handle);
   idx = 1;
   int max_id = -1;
   for (MBRange::iterator rit = vols.begin(); rit != vols.end(); rit++)    {
@@ -1434,9 +1447,9 @@
                                                        group_val, 1, groups);
   if (MB_SUCCESS != rval)
     return rval;
-  entHandles[4].resize(groups.size()+1);
-  entHandles[4][0] = 0;
-  std::copy(groups.begin(), groups.end(), &entHandles[4][1]);
+  group_handles().resize(groups.size()+1);
+  group_handles()[0] = 0;
+  std::copy(groups.begin(), groups.end(), &group_handles()[1]);
 
     // populate root sets vector
   std::vector<MBEntityHandle> rsets;

Modified: MOAB/trunk/tools/dagmc/DagMC.hpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.hpp	2007-10-10 19:31:47 UTC (rev 1308)
+++ MOAB/trunk/tools/dagmc/DagMC.hpp	2007-10-11 19:09:08 UTC (rev 1309)
@@ -16,6 +16,9 @@
 class RefEntity;
 #endif
 
+#define DAGMC_VERSION 0.99
+#define DAGMC_VERSION_STRING "0.99"
+
 class DagMC 
 {
 public:
@@ -23,6 +26,9 @@
   
   ~DagMC();
   
+    // Return the version of this library
+  float version(std::string *version_string = NULL);
+
   MBErrorCode ray_fire(const MBEntityHandle cell, const MBEntityHandle last_surf_hit, 
                        const int num_pts,
                        const double uuu, const double vvv, const double www,
@@ -174,8 +180,9 @@
   public:
     Option(){}
     Option( const char* n, const char* d, const char* v )
-        : name(n), desc(d), value(v) {}
+        : name(n), desc(d), value(v), user_set(false) {}
     std::string name, desc, value;
+    bool user_set;
   };
 
   std::string itos(int ival);
@@ -230,6 +237,13 @@
   std::vector<double> distList;
 };
 
+inline float DagMC::version(std::string *version_string) 
+{
+  if (NULL != version_string)
+    *version_string = std::string("DagMC version ") + std::string(DAGMC_VERSION_STRING);
+  return DAGMC_VERSION;
+}
+
 inline char *DagMC::get_spec_reflect() 
 {
   return specReflectName;




More information about the moab-dev mailing list