[MOAB-dev] r1341 - in MOAB/trunk: . tools/dagmc

tautges at mcs.anl.gov tautges at mcs.anl.gov
Thu Oct 25 07:35:09 CDT 2007


Author: tautges
Date: 2007-10-25 07:35:08 -0500 (Thu, 25 Oct 2007)
New Revision: 1341

Modified:
   MOAB/trunk/Tqdcfr.cpp
   MOAB/trunk/tools/dagmc/DagMC.cpp
   MOAB/trunk/tools/dagmc/DagMC.hpp
   MOAB/trunk/tools/dagmc/pt_vol_test.cc
   MOAB/trunk/tools/dagmc/test_geom.cc
Log:
Fixing DagMC so it builds again (but make check still fails there).

Fixing a 64 bit issue in Tqdcfr, where it was assuming sizeof(int) == sizeof(MBEntityHandle).
tqdcfr part of make check works on 64 bit machines now.



Modified: MOAB/trunk/Tqdcfr.cpp
===================================================================
--- MOAB/trunk/Tqdcfr.cpp	2007-10-25 12:33:33 UTC (rev 1340)
+++ MOAB/trunk/Tqdcfr.cpp	2007-10-25 12:35:08 UTC (rev 1341)
@@ -1095,24 +1095,32 @@
     
       // now do something with them...
 
-      // get the connectivity array
+      // get the connectivity array; be careful, the connectivity is stored
+      // in the file as ints, while the connect array is handles, which may
+      // be long; this will lead to problems on 64-bit machines
     int total_conn = num_elem * nodes_per_elem;
-    assert(sizeof(MBEntityHandle) == sizeof(int));
-    FREADIA(total_conn, reinterpret_cast<int*>(conn));
+    int *tmp_conn = reinterpret_cast<int*>(conn);
+    if (sizeof(MBEntityHandle) != sizeof(int))
+      tmp_conn = new int[total_conn];
+    
+    FREADIA(total_conn, tmp_conn);
 
       // post-process connectivity into handles
     MBEntityHandle new_handle, dum_handle;
     int dum_err;
     for (i = 0; i < total_conn; i++) {
       if (NULL == cubMOABVertexMap)
-        new_handle = CREATE_HANDLE(MBVERTEX, currNodeIdOffset+conn[i], dum_err);
-      else new_handle = (*cubMOABVertexMap)[conn[i]];
+        new_handle = CREATE_HANDLE(MBVERTEX, currNodeIdOffset+tmp_conn[i], dum_err);
+      else new_handle = (*cubMOABVertexMap)[tmp_conn[i]];
       assert(MB_SUCCESS == 
              mdbImpl->handle_from_id(MBVERTEX, mdbImpl->id_from_handle(new_handle), 
                                      dum_handle));
       conn[i] = new_handle;
     }
 
+    if (sizeof(MBEntityHandle) != sizeof(int))
+      delete [] tmp_conn;
+
       // add these elements into the entity's set
     MBRange dum_range(start_handle, start_handle+num_elem-1);
     result = mdbImpl->add_entities(entity->setHandle, dum_range);

Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2007-10-25 12:33:33 UTC (rev 1340)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2007-10-25 12:35:08 UTC (rev 1341)
@@ -1422,8 +1422,8 @@
   setOffset = (*surfs.begin() < *vols.begin() ? *surfs.begin() : *vols.begin());
   setOffset = (impl_compl_handle < setOffset ? impl_compl_handle : setOffset);
     // max
-  unsigned int tmp_offset = (surfs.back() > vols.back() ? 
-                             surfs.back() : vols.back());
+  MBEntityHandle tmp_offset = (surfs.back() > vols.back() ? 
+                               surfs.back() : vols.back());
   tmp_offset = (impl_compl_handle > tmp_offset ? 
                 impl_compl_handle : tmp_offset);
     // set size

Modified: MOAB/trunk/tools/dagmc/DagMC.hpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.hpp	2007-10-25 12:33:33 UTC (rev 1340)
+++ MOAB/trunk/tools/dagmc/DagMC.hpp	2007-10-25 12:35:08 UTC (rev 1341)
@@ -48,7 +48,8 @@
     // Return values: {0 : outside, 1: inside, -1: on boundary}
   MBErrorCode point_in_volume( MBEntityHandle volume, 
                                double x, double y, double z,
-                               int& result );
+                               int& result,
+                               double u, double v, double w);
 
     // Find the distance to the nearest surface
   MBErrorCode closest_to_location( MBEntityHandle volume,
@@ -156,6 +157,11 @@
                                 std::vector<MBEntityHandle> &surfaces, 
                                 double &len);
 
+  MBErrorCode boundary_case( MBEntityHandle volume, int& result, 
+                             double u, double v, double w,
+                             MBEntityHandle facet,
+                             MBEntityHandle surface);
+  
 private:
   bool have_obb_tree();
 

Modified: MOAB/trunk/tools/dagmc/pt_vol_test.cc
===================================================================
--- MOAB/trunk/tools/dagmc/pt_vol_test.cc	2007-10-25 12:33:33 UTC (rev 1340)
+++ MOAB/trunk/tools/dagmc/pt_vol_test.cc	2007-10-25 12:35:08 UTC (rev 1341)
@@ -18,7 +18,8 @@
 
   MBEntityHandle vol = dagmc.entity_by_id(3,volID);
 
-  rval = dagmc.point_in_volume( vol, xxx, yyy, zzz, inside);
+  double u, v, w;
+  rval = dagmc.point_in_volume( vol, xxx, yyy, zzz, inside, u, v, w);
   CHKERR;
   
   return MB_SUCCESS;

Modified: MOAB/trunk/tools/dagmc/test_geom.cc
===================================================================
--- MOAB/trunk/tools/dagmc/test_geom.cc	2007-10-25 12:33:33 UTC (rev 1340)
+++ MOAB/trunk/tools/dagmc/test_geom.cc	2007-10-25 12:35:08 UTC (rev 1341)
@@ -446,12 +446,12 @@
 
   for (int i = 0; i < num_test; ++i) {
     int result;
-    
+    double u, v, w;
     rval = dagmc.point_in_volume( vol, 
                                   tests[i].coords[0],
                                   tests[i].coords[1],
                                   tests[i].coords[2],
-                                  result );
+                                  result, u, v, w);
     CHKERR;
     if (result != tests[i].result) {
       std::cerr << "ERROR testing point_in_volume[" << i << "]:" << std::endl




More information about the moab-dev mailing list