[cig-commits] r5657 - in long/3D/Gale/trunk/src/StGermain: . Discretisation/Mesh/src

walter at geodynamics.org walter at geodynamics.org
Fri Jan 5 11:35:09 PST 2007


Author: walter
Date: 2007-01-05 11:35:08 -0800 (Fri, 05 Jan 2007)
New Revision: 5657

Modified:
   long/3D/Gale/trunk/src/StGermain/
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c
Log:
 r3228 at earth (orig r3919):  LukeHodkinson | 2007-01-01 17:27:11 -0800
 Fixed an invalid memory read.
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3196
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/branches/decomp3d/StGermain:3918
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3899
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3196
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/branches/decomp3d/StGermain:3919
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3899

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c	2007-01-05 19:35:05 UTC (rev 5656)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c	2007-01-05 19:35:08 UTC (rev 5657)
@@ -386,16 +386,17 @@
 ** Public Functions
 */
 
-#define Vec_Sep( nDims, v0, v1 )					\
-	(((v0)[0] - (v1)[0]) * ((v0)[0] - (v1)[0]) +			\
-	 ((v0)[1] - (v1)[1]) * ((v0)[1] - (v1)[1]) +			\
-	 (((nDims) == 3) ? (((v0)[2] - (v1)[2]) * ((v0)[2] - (v1)[2])) : 0))
+#define Vec_Sep( nDims, v0, v1 )									\
+	(((v0)[0] - (v1)[0]) * ((v0)[0] - (v1)[0]) +							\
+	 (((nDims) >= 2) ? (((v0)[1] - (v1)[1]) * ((v0)[1] - (v1)[1]) + 				\
+			    (((nDims) == 3) ? (((v0)[2] - (v1)[2]) * ((v0)[2] - (v1)[2])) : 0)) : 0))
 
 unsigned Mesh_Algorithms_NearestVertexWithNeighbours( void* algorithms, double* point ) {
 	Mesh_Algorithms*	self = (Mesh_Algorithms*)algorithms;
 	Mesh*			mesh;
 	unsigned		nDims;
 	unsigned		curVert;
+	double*			vert;
 	double			sep;
 	Bool			done;
 	unsigned		nNbrs;
@@ -415,7 +416,8 @@
 	curVert = Mesh_GetDomainSize( mesh, MT_VERTEX ) / 2;
 
 	/* Calc distance squared to current node. */
-	sep = Vec_Sep( nDims, Mesh_GetVertex( mesh, curVert ), point );
+	vert = Mesh_GetVertex( mesh, curVert );
+	sep = Vec_Sep( nDims, vert, point );
 
 	/* Loop until we've found closest local node. */
 	do {



More information about the cig-commits mailing list