[cig-commits] r4057 - in long/3D/Gale/trunk/src/StGermain: . Discretisation/Geometry/tests

walter at geodynamics.org walter at geodynamics.org
Thu Jul 20 20:07:11 PDT 2006


Author: walter
Date: 2006-07-20 20:07:11 -0700 (Thu, 20 Jul 2006)
New Revision: 4057

Added:
   long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of1.expected
   long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of1.sh
   long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of2.expected
   long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of2.sh
   long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.c
Modified:
   long/3D/Gale/trunk/src/StGermain/
Log:
 r2538 at earth:  boo | 2006-07-20 20:01:44 -0700
  r2514 at earth (orig r3683):  RaquibulHassan | 2006-07-16 19:37:48 -0700
  Committing a set of tests for the parallel triangulator.
  
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2537
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3682
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2538
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3683

Added: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of1.expected
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of1.expected	2006-07-21 03:07:00 UTC (rev 4056)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of1.expected	2006-07-21 03:07:11 UTC (rev 4057)
@@ -0,0 +1,13 @@
+StGermain Framework revision 3667. Copyright (C) 2003-2005 VPAC.
+Num points 1000
+Irregular point-set parallel triangulation test passed..
+
+Num points 2000
+Irregular point-set parallel triangulation test passed..
+
+Num points 3000
+Irregular point-set parallel triangulation test passed..
+
+Num points 4000
+Irregular point-set parallel triangulation test passed..
+

Added: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of1.sh
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of1.sh	2006-07-21 03:07:00 UTC (rev 4056)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of1.sh	2006-07-21 03:07:11 UTC (rev 4057)
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+TEST_SCRIPT=./VMake/executableTester.sh
+until test -r ${TEST_SCRIPT} ; do
+        TEST_SCRIPT=../${TEST_SCRIPT}
+done
+. ${TEST_SCRIPT}
+
+runAndHandleSystemTest "testParallelDelaunay " "$0" "$@"


Property changes on: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of1.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of2.expected
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of2.expected	2006-07-21 03:07:00 UTC (rev 4056)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of2.expected	2006-07-21 03:07:11 UTC (rev 4057)
@@ -0,0 +1,13 @@
+StGermain Framework revision 3667. Copyright (C) 2003-2005 VPAC.
+Num points 1000
+Irregular point-set parallel triangulation test passed..
+
+Num points 2000
+Irregular point-set parallel triangulation test passed..
+
+Num points 3000
+Irregular point-set parallel triangulation test passed..
+
+Num points 4000
+Irregular point-set parallel triangulation test passed..
+

Added: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of2.sh
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of2.sh	2006-07-21 03:07:00 UTC (rev 4056)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of2.sh	2006-07-21 03:07:11 UTC (rev 4057)
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+TEST_SCRIPT=./VMake/executableTester.sh
+until test -r ${TEST_SCRIPT} ; do
+        TEST_SCRIPT=../${TEST_SCRIPT}
+done
+. ${TEST_SCRIPT}
+
+runAndHandleSystemTest "testParallelDelaunay " "$0" "$@"


Property changes on: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.0of2.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.c	2006-07-21 03:07:00 UTC (rev 4056)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testParallelDelaunay.c	2006-07-21 03:07:11 UTC (rev 4057)
@@ -0,0 +1,171 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testEdge.c 3462 2006-02-19 06:53:24Z WalterLandry $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include "Base/Base.h"
+
+#include "Discretisation/Geometry/Geometry.h"
+
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+
+typedef enum pointsType_t{
+	Irregular,
+	Regular,
+	Polygon
+}pointsType;
+
+#define PI 3.1415926535897932384626
+
+void generatePoints( CoordF *sites, int numSites, pointsType *p )
+{
+	int num, i, j;
+	
+	assert( sites );
+
+	num = numSites;
+	
+	if( *p == Irregular ){
+		for( i=0; i<num; i++ ){
+			sites[i][0] = drand48();
+			sites[i][1] = drand48();
+		}
+	}
+	else if (*p == Regular){
+		int count = 0;
+		num = sqrt((float)num);
+		for( i=0; i<num; i++ ){
+			for( j=0; j<num; j++ ){
+				sites[count][0] = ((float)i)*(1/((float)num));
+				sites[count][1] = ((float)j)*(1/((float)num));
+
+				count++;
+			}
+		}
+	}
+	else if( *p == Polygon ){
+		for( i=0; i<num-1; i++ ){
+			sites[i][0] = cos( ((float)i)*2.0*PI/((float)(num-1)) );
+			sites[i][1] = sin( ((float)i)*2.0*PI/((float)(num-1)) );
+		}
+	}
+}
+
+int main( int argc, char* argv[] ) {
+	MPI_Comm CommWorld;
+	int rank;
+	int numProcessors;
+	int procToWatch;
+	
+	/* Initialise MPI, get world info */
+	MPI_Init( &argc, &argv );
+	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+	MPI_Comm_size( CommWorld, &numProcessors );
+	MPI_Comm_rank( CommWorld, &rank );
+	
+	Base_Init( &argc, &argv );
+	
+	DiscretisationGeometry_Init( &argc, &argv );
+	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
+	
+	if( argc >= 2 ) {
+		procToWatch = atoi( argv[1] );
+	}
+	else {
+		procToWatch = 0;
+	}
+	if( 1 ) {
+		Delaunay *d = NULL;
+		ParallelDelaunay *pd = NULL;
+		DelaunayAttributes attr;
+		CoordF *sites;
+		int i = 0;
+		pointsType p;
+		Dictionary *dictionary = Dictionary_New();
+		
+		attr.BuildBoundingTriangle = 0;
+		attr.BuildTriangleIndices = 1;
+		attr.CreateVoronoiVertices = 1;
+		attr.CalculateVoronoiSides = 1;
+		attr.CalculateVoronoiSurfaceArea = 1;
+		attr.FindNeighbours = 1;
+
+		/* Testing irregular point-set */
+		{
+			int pass = 1;
+			
+			for( i=1000; i<5000; i+=1000 ){
+			
+				p = Irregular;
+				sites = malloc( sizeof( CoordF ) * i );
+				memset( sites, 0, sizeof( CoordF ) * i );
+		
+				generatePoints( sites, i, &p );
+				
+				if( rank == 0 ){
+					
+				
+					d = Delaunay_New( "Delaunay", dictionary, sites, i, 0, &attr );
+		
+					Stg_Component_Build( d, NULL, True );
+				}
+
+				pd = ParallelDelaunay_New( "Delaunay", dictionary, sites, i, rank, numProcessors, &CommWorld, &attr );
+				Stg_Component_Build( pd, NULL, True );
+
+				ParallelDelaunay_GatherTriangulation( pd );
+
+				if( rank == 0 ){
+					if( d->numTriangles != pd->numTriangles ) pass = 0;
+					printf( "Num points %d\n", i );
+					printf( "Irregular point-set parallel triangulation test %s\n\n", pass?"passed..":"failed..!" );
+					
+					Stg_Class_Delete( d );
+				}
+				
+				Stg_Class_Delete( pd );
+
+				free( sites );
+			}
+		}
+		
+		Stg_Class_Delete( dictionary );
+	}
+	
+	DiscretisationGeometry_Finalise();
+	
+	Base_Finalise();
+	
+	/* Close off MPI */
+	MPI_Finalize();
+	
+	return 0;
+}



More information about the cig-commits mailing list