[cig-commits] r4929 - in long/3D/Gale/trunk/src/Underworld: .
Rheology/tests/expected Rheology/tests/testDirectorRandomness
walter at geodynamics.org
walter at geodynamics.org
Wed Oct 11 13:54:06 PDT 2006
Author: walter
Date: 2006-10-11 13:54:05 -0700 (Wed, 11 Oct 2006)
New Revision: 4929
Modified:
long/3D/Gale/trunk/src/Underworld/
long/3D/Gale/trunk/src/Underworld/Rheology/tests/expected/testDirector2D_RandomDirs.0of1.testDirectorRandomness.dat.expected
long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorRandomness/testDirectorRandomness.c
Log:
r589 at earth: boo | 2006-10-11 13:52:08 -0700
r551 at earth (orig r328): KathleenHumble | 2006-09-10 19:50:07 -0700
changed the testDirector2D_RandomDirs test
so that it checks that the amount of
directors in each direction is within 3 standard
deviations of average.
Also checks the standard deviation to see that
it is accurate enough.
Property changes on: long/3D/Gale/trunk/src/Underworld
___________________________________________________________________
Name: svk:merge
- 9570c393-cf10-0410-b476-9a651db1e55a:/cig:588
c24a034b-ab11-0410-afe6-cfe714e2959e:/trunk:327
+ 9570c393-cf10-0410-b476-9a651db1e55a:/cig:589
c24a034b-ab11-0410-afe6-cfe714e2959e:/trunk:328
Modified: long/3D/Gale/trunk/src/Underworld/Rheology/tests/expected/testDirector2D_RandomDirs.0of1.testDirectorRandomness.dat.expected
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/tests/expected/testDirector2D_RandomDirs.0of1.testDirectorRandomness.dat.expected 2006-10-11 20:54:03 UTC (rev 4928)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/tests/expected/testDirector2D_RandomDirs.0of1.testDirectorRandomness.dat.expected 2006-10-11 20:54:05 UTC (rev 4929)
@@ -1,38 +1,5 @@
Swarm has 200 local particles, therefore expect average of 5.6 director normals in each 10 degrees of arc.
-Circle angle 0-9 count = 5
-Circle angle 10-19 count = 3
-Circle angle 20-29 count = 2
-Circle angle 30-39 count = 4
-Circle angle 40-49 count = 6
-Circle angle 50-59 count = 13
-Circle angle 60-69 count = 6
-Circle angle 70-79 count = 4
-Circle angle 80-89 count = 3
-Circle angle 90-99 count = 2
-Circle angle 100-109 count = 3
-Circle angle 110-119 count = 5
-Circle angle 120-129 count = 9
-Circle angle 130-139 count = 11
-Circle angle 140-149 count = 11
-Circle angle 150-159 count = 9
-Circle angle 160-169 count = 4
-Circle angle 170-179 count = 5
-Circle angle 180-189 count = 8
-Circle angle 190-199 count = 2
-Circle angle 200-209 count = 2
-Circle angle 210-219 count = 4
-Circle angle 220-229 count = 5
-Circle angle 230-239 count = 6
-Circle angle 240-249 count = 5
-Circle angle 250-259 count = 5
-Circle angle 260-269 count = 2
-Circle angle 270-279 count = 2
-Circle angle 280-289 count = 4
-Circle angle 290-299 count = 4
-Circle angle 300-309 count = 7
-Circle angle 310-319 count = 8
-Circle angle 320-329 count = 8
-Circle angle 330-339 count = 9
-Circle angle 340-349 count = 3
-Circle angle 350-359 count = 11
+The standard deviation of director normals is within tolerance, 0.1, of expected standard deviation, 2.8
+
+All circle angle counts are within range.
Modified: long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorRandomness/testDirectorRandomness.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorRandomness/testDirectorRandomness.c 2006-10-11 20:54:03 UTC (rev 4928)
+++ long/3D/Gale/trunk/src/Underworld/Rheology/tests/testDirectorRandomness/testDirectorRandomness.c 2006-10-11 20:54:05 UTC (rev 4929)
@@ -7,6 +7,8 @@
#include <assert.h>
+#define TEST_RAND_DIR_ERROR 1e-01
+
void Underworld_testDirectorRandomness_Function( FiniteElementContext* context ) {
AlignmentSwarmVariable* alignment = (AlignmentSwarmVariable*) LiveComponentRegister_Get( context->CF->LCRegister, "alignment" );
Director* director;
@@ -20,7 +22,11 @@
double angleBetween;
double circleAngle;
int circleAngleCounts[36];
-
+ Bool circleErrorFlag = False;
+ int circleAngleSum;
+ double circleAngleAverage;
+ double circleAngleStdDev;
+
assert( alignment );
swarm = alignment->swarm;
@@ -48,14 +54,38 @@
Journal_Printf( stream, "Swarm has %d local particles, therefore expect average of %.1f director "
"normals in each 10 degrees of arc.\n\n", swarm->particleLocalCount,
(double) swarm->particleLocalCount / 36 );
-
+ circleAngleAverage = (double)swarm->particleLocalCount / 36;
+ circleAngleSum = 0;
for ( ii =0; ii < 36; ii++ ) {
- Journal_Printf( stream, "Circle angle %d-%d count = %d\n", ii*10, ii*10+9, circleAngleCounts[ii] );
- if ( 0 == circleAngleCounts[ii] ) {
- Journal_Printf( stream, "Error: Circle angle %d-%d count = 0\n", ii*10, ii*10+9 );
+ if (( circleAngleCounts[ii] < 1 )|| (circleAngleCounts[ii] > 14)) {
+ Journal_Printf( stream, "Error: Circle angle %d-%d count = %d is outside range [1, 14].\n"
+ , ii*10, ii*10+9, circleAngleCounts[ii] );
+ circleErrorFlag = True;
}
+ circleAngleSum = ((circleAngleAverage - circleAngleCounts[ii]) *
+ (circleAngleAverage - circleAngleCounts[ii])) + circleAngleSum;
}
-
+ /* Calculate standard deviation */
+ circleAngleStdDev = sqrt(circleAngleSum / (36-1));
+
+ if (fabs(circleAngleStdDev - 2.82843) < TEST_RAND_DIR_ERROR ) {
+ Journal_Printf( stream, "The standard deviation of director normals is within "
+ "tolerance, %g, of expected standard deviation, %.1f \n\n",
+ TEST_RAND_DIR_ERROR, circleAngleStdDev);
+ }
+ else {
+ Journal_Printf( stream, "The standard deviation of director normals is not within"
+ "tolerance, %g, of expected standard deviation, %.1f \n\n",
+ TEST_RAND_DIR_ERROR, circleAngleStdDev);
+ }
+
+ if (circleErrorFlag == False) {
+ Journal_Printf( stream, "All circle angle counts are within range.\n");
+ }
+ else {
+ Journal_Printf( stream, "Some circle angle counts not within range \n");
+ }
+
Stream_Flush( stream );
}
More information about the cig-commits
mailing list