[MOAB-dev] r4855 - in MOAB/trunk/src: . moab
    iulian at mcs.anl.gov 
    iulian at mcs.anl.gov
       
    Fri May 20 10:10:23 CDT 2011
    
    
  
Author: iulian
Date: 2011-05-20 10:10:23 -0500 (Fri, 20 May 2011)
New Revision: 4855
Modified:
   MOAB/trunk/src/FBEngine.cpp
   MOAB/trunk/src/moab/FBEngine.hpp
Log:
first pass at splitting quads 
when FBEngine is initialized, a duplicated gtt model will be build if
quads are detected.
FBEngine will point to the new gtt model, in which the quads are split along 
the shortest diagonal. 
No test added yet.
Modified: MOAB/trunk/src/FBEngine.cpp
===================================================================
--- MOAB/trunk/src/FBEngine.cpp	2011-05-20 12:40:48 UTC (rev 4854)
+++ MOAB/trunk/src/FBEngine.cpp	2011-05-20 15:10:23 UTC (rev 4855)
@@ -225,6 +225,9 @@
     ErrorCode rval = _my_geomTopoTool->find_geomsets(_my_gsets);
     assert(rval == MB_SUCCESS);
 
+    rval = split_quads();
+    assert (rval == MB_SUCCESS);
+
     rval = _my_geomTopoTool->construct_obb_trees();
     assert(rval == MB_SUCCESS);
 
@@ -412,7 +415,7 @@
 
 ErrorCode FBEngine::getRootSet(EntityHandle * root_set)
 {
-  *root_set = _mbImpl->get_root_set();
+  *root_set =  _my_geomTopoTool-> get_root_model_set();
   return MB_SUCCESS;
 }
 
@@ -2480,6 +2483,82 @@
 
   return MB_SUCCESS;
 }
+
+// split the quads if needed; it will create a new gtt, which will
+// contain triangles instead of quads
+ErrorCode FBEngine::split_quads()
+{
+  // first see if we have any quads in the 2d faces
+  //  _my_gsets[2] is a range of surfaces (moab sets of dimension 2)
+  int num_quads=0;
+  for (Range::iterator it=_my_gsets[2].begin(); it!=_my_gsets[2].end(); it++)
+  {
+    EntityHandle surface = *it;
+    int num_q=0;
+    _mbImpl->get_number_entities_by_type(surface, MBQUAD, num_q);
+    num_quads+=num_q;
+  }
+
+  if (num_quads==0)
+    return MB_SUCCESS; // nothing to do
+
+  GeomTopoTool * new_gtt = _my_geomTopoTool->duplicate_model();
+  if (this->_t_created)
+    delete _my_geomTopoTool;
+
+  _t_created = true; // this one is for sure created here, even if the original gtt was not
    
    
More information about the moab-dev
mailing list