[MOAB-dev] r1463 - in MOAB/trunk: . tools/qvdual

tautges at mcs.anl.gov tautges at mcs.anl.gov
Mon Dec 10 18:59:41 CST 2007


Author: tautges
Date: 2007-12-10 18:59:41 -0600 (Mon, 10 Dec 2007)
New Revision: 1463

Modified:
   MOAB/trunk/DualTool.cpp
   MOAB/trunk/tools/qvdual/DrawDual.cpp
Log:
Couple of changes from asserts to failures.



Modified: MOAB/trunk/DualTool.cpp
===================================================================
--- MOAB/trunk/DualTool.cpp	2007-12-10 19:12:17 UTC (rev 1462)
+++ MOAB/trunk/DualTool.cpp	2007-12-11 00:59:41 UTC (rev 1463)
@@ -2096,6 +2096,7 @@
     if (on_bdy_tmp) {
       assert(hstar_tmp.size() == qstar_tmp.size()-1);
       hstar_tmp.push_back(0);
+      on_bdy = true;
     }
     
       // get the position of first split quad in star
@@ -2375,7 +2376,10 @@
   result = mbImpl->get_connectivity(&middle_edge, 1, middle_connect); RR;
   result = mbImpl->get_connectivity(&(*vit), 1, dum_connect); RR;
   dum_connect = dum_connect.subtract(middle_connect);
-  assert(dum_connect.size() == 1);
+  if (dum_connect.size() != 1) {
+    std::cerr << "Trouble traversing chord." << std::endl;
+    return MB_FAILURE;
+  }
 
     // put in verts[0]
   verts[0] = *dum_connect.begin();
@@ -2383,11 +2387,14 @@
     // same with prev edge
   vit++;
   if (vit == chord_edges.end()) vit = chord_edges.begin();
-  else vit++;
+  vit++;
   dum_connect.clear();
   result = mbImpl->get_connectivity(&(*vit), 1, dum_connect); RR;
   dum_connect = dum_connect.subtract(middle_connect);
-  assert(dum_connect.size() == 1);
+  if (dum_connect.size() != 1) {
+    std::cerr << "Trouble traversing chord." << std::endl;
+    return MB_FAILURE;
+  }
 
     // put in verts[1]
   verts[1] = *dum_connect.begin();
@@ -2400,7 +2407,10 @@
     verts[1] = dum_h;
   }
   
-  assert(0 != mtu.common_entity(verts[0], connect[0], 1));
+  if (0 == mtu.common_entity(verts[0], connect[0], 1)) {
+    std::cerr << "Trouble traversing chord." << std::endl;
+    return MB_FAILURE;
+  }
   
   return MB_SUCCESS;
 }

Modified: MOAB/trunk/tools/qvdual/DrawDual.cpp
===================================================================
--- MOAB/trunk/tools/qvdual/DrawDual.cpp	2007-12-10 19:12:17 UTC (rev 1462)
+++ MOAB/trunk/tools/qvdual/DrawDual.cpp	2007-12-11 00:59:41 UTC (rev 1463)
@@ -344,7 +344,7 @@
       gDrawDual->update_high_polydatas();
     }
     else if (picked_ent == *picked_ents.begin()) {
-      std::cout << oss.str() << " (" << picked_ent << ")" << std::endl;
+        //std::cout << oss.str() << " (" << picked_ent << ")" << std::endl;
       pickLine2->setText(pickLine1->displayText());
       pickLine1->setText(QString(oss.str().c_str()));
 
@@ -863,7 +863,10 @@
           int num_connect;
           result = MBI->get_connectivity(*chord_edges[i].begin(), connect, num_connect); RR;
           result = MBI->get_adjacencies(connect, num_connect, 1, false, middle_edges); RR;
-          assert(1 == middle_edges.size());
+          if (1 != middle_edges.size()) {
+              // take off any edges that aren't on this sheet? no, just punt...
+            std::cout << "Warning: not a clear middle edge..." << std::endl;
+          }
         
             // get the points for the two vertices and the 3 edges
             // non-middle chord; get the edges too
@@ -1766,7 +1769,6 @@
     // from another that's not in the 1st set
   MBRange tmp_range;
   result = MBI->get_entities_by_dimension(chords[0], 1, tmp_range); RR;
-  assert(3 < tmp_range.size());
   const MBEntityHandle *connect;
   int num_connect;
   result = MBI->get_connectivity(*tmp_range.begin(), connect, num_connect); RR;
@@ -2286,7 +2288,20 @@
         // get all neighbor verts
       MBRange nverts, tmp_edges;
       result = mtu.get_bridge_adjacencies(this_point, 1, 0, nverts); RR;
-      assert(4 == nverts.size() || 3 == nverts.size());
+      if (!(4 == nverts.size() || 3 == nverts.size())) {
+        std::cerr << "Smoothing sheet failed; dumping file." << std::endl;
+        dualTool->delete_whole_dual();
+        MBEntityHandle save_set;
+        MBErrorCode result = vtkMOABUtils::mbImpl->create_meshset(MESHSET_SET, save_set);
+        if (MB_SUCCESS != result) return MB_FAILURE;
+        MBRange hexes;
+        result = vtkMOABUtils::mbImpl->get_entities_by_type(0, MBHEX, hexes);
+        if (MB_SUCCESS != result) return MB_FAILURE;
+        result = vtkMOABUtils::mbImpl->add_entities(save_set, hexes);
+        if (MB_SUCCESS != result) return MB_FAILURE;
+        vtkMOABUtils::mbImpl->write_file("tmp.h5m", NULL, NULL, &save_set, 1);
+        return MB_FAILURE;
+      }
       
       for (MBRange::iterator rit = nverts.begin(); rit != nverts.end(); rit++) {
         tmp_edges.clear();




More information about the moab-dev mailing list