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

walter at geodynamics.org walter at geodynamics.org
Wed Oct 11 13:46:03 PDT 2006


Author: walter
Date: 2006-10-11 13:46:02 -0700 (Wed, 11 Oct 2006)
New Revision: 4821

Modified:
   long/3D/Gale/trunk/src/StGermain/
   long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMultMath.0of1.expected
   long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMultMath.c
Log:
 r2878 at earth:  boo | 2006-10-11 13:42:28 -0700
  r2794 at earth (orig r3782):  KathleenHumble | 2006-09-05 22:14:59 -0700
  changed test for NonSquareMatrix_MatrixVectorMultiplication
  so that it has  the correct solution to compare against
  
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2877
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3781
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2878
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3782

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMultMath.0of1.expected
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMultMath.0of1.expected	2006-10-11 20:46:00 UTC (rev 4820)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMultMath.0of1.expected	2006-10-11 20:46:02 UTC (rev 4821)
@@ -1,4 +1,4 @@
-StGermain Framework revision 3772. Copyright (C) 2003-2005 VPAC.
+StGermain Framework revision 3780. Copyright (C) 2003-2005 VPAC.
 1e-14
 /*******************    Test 1   ************************/
 Test TensorArray Identity
@@ -401,4 +401,5 @@
       2	      6	     10	
       3	      7	     11	
 vector - {1.000000, 2.000000, 3.000000}
-solutionVector - {32.000000, 38.000000, 44.000000, 50.000000}
+SolutionVector within tolerance 0.000010 of solution:
+solutionVectorCompare - {32.000000, 38.000000, 44.000000, 50.000000}

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMultMath.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMultMath.c	2006-10-11 20:46:00 UTC (rev 4820)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMultMath.c	2006-10-11 20:46:02 UTC (rev 4821)
@@ -37,6 +37,7 @@
 
 #include <stdio.h>
 
+#define TENSORMULTMATH_TEST_ERROR 1e-05
 
 int main( int argc, char* argv[] ) {
 	MPI_Comm CommWorld;
@@ -778,17 +779,33 @@
 		Journal_Printf(stream, "\n/*******************    Test 20   ************************/\n");
 		Journal_Printf( stream, "Test function NonSquareMatrix_MatrixVectorMultiplication \n\n");
 		Journal_Printf( stream, "Tested against solutions at http://www.uni-bonn.de/~manfear/solve_lineq.php\n\n");
-		double solutionVector[4];
+		double solutionVector[4], solutionVectorCompare[4];
+		Bool error_flag;
 		
 		vector[0] = 1; vector[1] = 2; vector[2] = 3;
+		solutionVectorCompare[0] = 32; solutionVectorCompare[1] = 38;
+		solutionVectorCompare[2] = 44; solutionVectorCompare[3] = 50;
 
 		Journal_PrintNonSquareMatrix(stream, nonSquareMatrixAT, 4, 3);
 		StGermain_PrintNamedVector(stream, vector, 3);
 		
 		NonSquareMatrix_MatrixVectorMultiplication( nonSquareMatrixAT, 4, 3, vector, 3, solutionVector );
-
-		StGermain_PrintNamedVector(stream, solutionVector, 4);
-	
+		error_flag = False;
+		for ( row = 0; row < 4; row++ ) {
+			if (fabs(solutionVector[row] - solutionVectorCompare[row]) > TENSORMULTMATH_TEST_ERROR ) {
+				error_flag = True;
+				Journal_Printf(stream, "solutionVector[%d] not within tolerance  of solution, %f\n", row, solutionVectorCompare[row]);
+			}
+		}
+		if (error_flag == False) {
+			Journal_Printf(stream, "SolutionVector within tolerance %f of solution:\n", TENSORMULTMATH_TEST_ERROR);
+			StGermain_PrintNamedVector(stream, solutionVectorCompare, 4);
+		}
+		else {
+			Journal_Printf(stream, "SolutionVector not within tolerance %f of solution:\n", TENSORMULTMATH_TEST_ERROR);
+			StGermain_PrintNamedVector(stream, solutionVectorCompare, 4);
+		}
+		
 		Memory_Free(nonSquareMatrixA);
 		Memory_Free(nonSquareMatrixB);
 		Memory_Free(nonSquareMatrixAT);



More information about the cig-commits mailing list