[cgma-dev] r3254 - cgm/trunk/itaps

jvporter at wisc.edu jvporter at wisc.edu
Fri Oct 30 02:09:30 CDT 2009


Author: jvporter
Date: 2009-10-30 02:09:30 -0500 (Fri, 30 Oct 2009)
New Revision: 3254

Modified:
   cgm/trunk/itaps/iGeom_CGMA.cc
Log:
* Fix casts in iGeom_isArrAdj
* Fix iteration in iGeom_getArrNrmlSense and iGeom_getEgFcArrSense


Modified: cgm/trunk/itaps/iGeom_CGMA.cc
===================================================================
--- cgm/trunk/itaps/iGeom_CGMA.cc	2009-10-29 22:48:07 UTC (rev 3253)
+++ cgm/trunk/itaps/iGeom_CGMA.cc	2009-10-30 07:09:30 UTC (rev 3254)
@@ -1131,8 +1131,8 @@
   CHECK_SIZE(*is_adjacent_info, int, count);
   for (int i = 0; i < count; ++i)
   {
-    TopologyEntity* ent1 = (TopologyEntity*)(*list_1_iter);
-    TopologyEntity* ent2 = (TopologyEntity*)(*list_2_iter);
+    TopologyEntity* ent1 = dynamic_cast<TopologyEntity*>(*list_1_iter);
+    TopologyEntity* ent2 = dynamic_cast<TopologyEntity*>(*list_2_iter);
     (*is_adjacent_info)[i] = ent1->is_directly_related(ent2);
     list_1_iter += list_1_step;
     list_2_iter += list_2_step;
@@ -3254,21 +3254,24 @@
     RETURN (iBase_INVALID_ENTITY_COUNT);
   }
   
-  RefEntity** face_array = (RefEntity**)faces;
-  RefEntity** region_array = (RefEntity**)regions;
+  RefEntity** face_iter = (RefEntity**)faces;
+  RefEntity** region_iter = (RefEntity**)regions;
   CHECK_SIZE( *senses, int, count );
   for (int i = 0; i < count; ++i) {
-    RefFace *face_ent = dynamic_cast<RefFace*>(face_array[i]);
+    RefFace *face_ent = dynamic_cast<RefFace*>(*face_iter);
     if (NULL == face_ent) {
       ERROR(iBase_INVALID_ENTITY_TYPE, "1st argument to getGnormalSense must be a face.");
     }
-    RefVolume *volume_ent = dynamic_cast<RefVolume*>(region_array[i]);
+    RefVolume *volume_ent = dynamic_cast<RefVolume*>(*region_iter);
     if (NULL == volume_ent) {
       ERROR(iBase_INVALID_ENTITY_TYPE, "2nd argument to getGnormalSense must be a region.");
     }
     (*senses)[i] = iGeom_get_nonmanifold_sense( face_ent, volume_ent, err );
     if (iBase_SUCCESS != *err)
       return;
+
+    face_iter += faces_step;
+    region_iter += regions_step;
   }
   
   RETURN(iBase_SUCCESS);
@@ -3332,21 +3335,24 @@
     ERROR( iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes" );
   }
   
-  RefEntity** face_array = (RefEntity**)faces;
-  RefEntity** edge_array = (RefEntity**)edges;
+  RefEntity** face_iter = (RefEntity**)faces;
+  RefEntity** edge_iter = (RefEntity**)edges;
   CHECK_SIZE( *senses, int, count );
   for (int i = 0; i < count; ++i) {
-    RefEdge *edge_ent = dynamic_cast<RefEdge*>(edge_array[i]);
+    RefEdge *edge_ent = dynamic_cast<RefEdge*>(*edge_iter);
     if (NULL == edge_ent) {
       ERROR(iBase_INVALID_ENTITY_TYPE, "1st argument to getGnormalSense must be a face.");
     }
-    RefFace *face_ent = dynamic_cast<RefFace*>(face_array[i]);
+    RefFace *face_ent = dynamic_cast<RefFace*>(*face_iter);
     if (NULL == face_ent) {
       ERROR(iBase_INVALID_ENTITY_TYPE, "2nd argument to getGnormalSense must be a region.");
     }
     (*senses)[i] = iGeom_get_nonmanifold_sense( edge_ent, face_ent, err );
     if (iBase_SUCCESS != *err)
       return;
+
+    face_iter += faces_step;
+    edge_iter += edges_step;
   }
   
   RETURN(iBase_SUCCESS);



More information about the cgma-dev mailing list