[Ptinpoly-commits] r31 - in pkg: man src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 27 03:25:51 CEST 2014


Author: jmaisog
Date: 2014-08-27 03:25:50 +0200 (Wed, 27 Aug 2014)
New Revision: 31

Modified:
   pkg/man/pip2d.Rd
   pkg/man/pip3d.Rd
   pkg/src/pinpolyhedronA.cc
Log:
Diagnostic maneuver to track down memory leak: revert memory allocations of int and double arrays of triplets to their original form, and comment out the test example of "bad" geometry in the man page for the 3D implementation.

Modified: pkg/man/pip2d.Rd
===================================================================
--- pkg/man/pip2d.Rd	2014-08-26 01:24:29 UTC (rev 30)
+++ pkg/man/pip2d.Rd	2014-08-27 01:25:50 UTC (rev 31)
@@ -69,8 +69,8 @@
 
 # Check whether test points are contained in the comb, spiral, and factal.
 # Most of these points will lie outside the polygons.
-containment1 = pip2d(comb,queries);
-containment2 = pip2d(spiral,queries);
-containment3 = pip2d(fractal,queries);
+containment1 <- pip2d(comb,queries);
+containment2 <- pip2d(spiral,queries);
+containment3 <- pip2d(fractal,queries);
 }
 \keyword{methods}

Modified: pkg/man/pip3d.Rd
===================================================================
--- pkg/man/pip3d.Rd	2014-08-26 01:24:29 UTC (rev 30)
+++ pkg/man/pip3d.Rd	2014-08-27 01:25:50 UTC (rev 31)
@@ -86,7 +86,7 @@
 # Test whether each point in 'queries' is contained in
 # the simple cube defined by 'verts' and 'faces'.
 # This should return "1  0  0  0 -1".
-containment = pip3d(verts,faces,queries);
+containment <- pip3d(verts,faces,queries);
 
 #-------------------------------------------
 # Torus example.
@@ -118,14 +118,15 @@
 
 # Check whether test points are contained in the torus.
 # Most of these points will lie outside the torus.
-containment = pip3d(Vertices,Faces,Queries);
+containment <- pip3d(Vertices,Faces,Queries);
 
 #-------------------------------------------
 # If you remove one of the faces of the cube, the resulting cube
 # becomes "leaky".  Running 'pip3d' on the resulting defective
 # polyhedron will return -2.
-
-badcube     = faces[1:11,]
-containment = pip3d(verts,badcube,queries);
+# NOT RUN
+#
+# badcube     <- faces[1:11,]
+# containment <- pip3d(verts,badcube,queries);
 }
 \keyword{methods}

Modified: pkg/src/pinpolyhedronA.cc
===================================================================
--- pkg/src/pinpolyhedronA.cc	2014-08-26 01:24:29 UTC (rev 30)
+++ pkg/src/pinpolyhedronA.cc	2014-08-27 01:25:50 UTC (rev 31)
@@ -361,16 +361,13 @@
 //	epsilonon=epsion;
 
 	numvert=numvi;
-//  vertcoord=(double (*)[3]) new double[3*numvert];
-	vertcoord = new double[numvert] [3];
+	vertcoord=(double (*)[3]) new double[3*numvert];
 	memcpy(vertcoord,vti,sizeof(double)*3*numvert);
 	numtri=numti;
-//  trips=(int (*)[3])new int[3*numtri];
-	trips = new int[numtri] [3];
+	trips=(int (*)[3])new int[3*numtri];
 	memcpy(trips, tris,sizeof(int)*3*numtri);
 
-//  tneighb=(int (*)[3]) new int [3*numtri];
-	tneighb = new int[numtri] [3];
+	tneighb=(int (*)[3]) new int [3*numtri];
 	triofnode=(int *) new int[numvert];
 	vertattrib= new int [numvert];
 	for(int i=0; i<numvert; i++)
@@ -727,8 +724,7 @@
 //Rprintf("PIP_jianfei_cpp: entered C++ function.\n");
 	// Transfer vertex data from flat double array to double[3] array.
 	double (*vert)[3];
-//  vert = ( double (*)[3]) new double [3*(*numV)];
-	vert = new double[*numV] [3];
+	vert = ( double (*)[3]) new double [3*(*numV)];
 #if 0
 	double minX = DLB_MAX, minY=DBL_MAX, minZ=DBL_MAX;
 #else
@@ -755,8 +751,7 @@
  	// Transfer face data from flat int array to int[3] array.
  	// Decrement vertex indices by 1, since Jianfei's code starts indexing at 0.
 	int (*tris)[3];
-//  tris = (int (*)[3]) new int [3*(*numF)];
-	tris = new int[*numF] [3];
+    tris = (int (*)[3]) new int [3*(*numF)];
     for( i=0; i<(*numF); i++) {
         tris[i][0] = faces[i+0*(*numF)] - 1;
         tris[i][1] = faces[i+1*(*numF)] - 1;
@@ -1909,8 +1904,7 @@
 //Rprintf("PIP_jianfei_cpp: entered C++ function.\n");
 	// Transfer vertex data from flat double array to double[3] array.
 	double (*vert)[2];
-//  vert = ( double (*)[2]) new double [2*(*numV)];
-	vert = new double[*numV] [2];
+	vert = ( double (*)[2]) new double [2*(*numV)];
 #if 0
 	double minX = DLB_MAX, minY=DBL_MAX;
 #else



More information about the Ptinpoly-commits mailing list