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

wilsonp at engr.wisc.edu wilsonp at engr.wisc.edu
Thu Jun 2 22:31:01 CDT 2011


Author: wilsonp
Date: 2011-06-02 22:30:59 -0500 (Thu, 02 Jun 2011)
New Revision: 4939

Modified:
   cgm/trunk/itaps/testgeom.cc
Log:
Improved test for iGeom_getFacets.  Now more tolerant of sending array that is too small - resize and retry.
Also tests for correct results against results for a known geometry (size.sat).


Modified: cgm/trunk/itaps/testgeom.cc
===================================================================
--- cgm/trunk/itaps/testgeom.cc	2011-06-03 02:05:31 UTC (rev 4938)
+++ cgm/trunk/itaps/testgeom.cc	2011-06-03 03:30:59 UTC (rev 4939)
@@ -1370,12 +1370,19 @@
   err = get_entities( geom, iBase_REGION, vols,   id, &vol_ids   ); CHECK("");
   
   unsigned int ent;
-  SimpleArray<double> points(1024*1024);
-  SimpleArray<int> facets(1024*1024);
+  std::vector<double> points;
+  double *p_ptr = &points[0];
+  int p_size = 0, p_alloc=points.size();
+  std::vector<int> facets;
+  int *f_ptr = &facets[0];
+  int f_size = 0, f_alloc=facets.size();
+
   for (ent=0; ent < verts.size(); ent++)
     {
-      iGeom_getFacets(geom,verts[ent],dist_tolerance,
-		      ARRAY_INOUT(points), ARRAY_INOUT(facets), &err);
+      iGeom_getFacets(geom, verts[ent], dist_tolerance, 
+		      &p_ptr, &p_alloc, &p_size, 
+		      &f_ptr, &f_alloc, &f_size, 
+		      &err);
       if (iBase_INVALID_ENTITY_TYPE != err)
 	{
 	  err = iBase_FAILURE;
@@ -1384,24 +1391,65 @@
     }
    for (ent=0; ent < curves.size(); ent++)
     {
-      iGeom_getFacets(geom,curves[ent],dist_tolerance,
-		      ARRAY_INOUT(points), ARRAY_INOUT(facets), &err);
+      iGeom_getFacets(geom, curves[ent], dist_tolerance, 
+		      &p_ptr, &p_alloc, &p_size, 
+		      &f_ptr, &f_alloc, &f_size, 
+		      &err);
+      points.resize(p_size);
+      facets.resize(f_size);
+
+      if ( iBase_BAD_ARRAY_DIMENSION == err || iBase_BAD_ARRAY_SIZE == err)
+	{
+	  p_ptr = &points[0];
+	  p_alloc = points.size();
+	  f_ptr = &facets[0];
+	  f_alloc = facets.size();
+	  iGeom_getFacets(geom, curves[ent], dist_tolerance, 
+			  &p_ptr, &p_alloc, &p_size, 
+			  &f_ptr, &f_alloc, &f_size, 
+			  &err);


More information about the cgma-dev mailing list