← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2652: 1. Updated regression tests. Rotation engines.

 

------------------------------------------------------------
revno: 2652
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Thu 2011-01-13 16:24:47 +0100
message:
  1. Updated regression tests. Rotation engines.
modified:
  py/tests/omega.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'py/tests/omega.py'
--- py/tests/omega.py	2011-01-13 14:06:17 +0000
+++ py/tests/omega.py	2011-01-13 15:24:47 +0000
@@ -62,7 +62,7 @@
 	def testKinematicEngines(self):
 		'Engines: test kinematic engines'
 		tolerance = 1e-5
-		rotIndex=5.0
+		rotIndex=1.0
 		angVelTemp = pi/rotIndex
 		O.reset()
 		id_fixed_transl = O.bodies.append(utils.sphere((0.0,0.0,0.0),1.0,fixed=True))
@@ -81,10 +81,15 @@
 		O.dt = 1.0
 		for i in range(0,25):
 			O.step()
-			self.assertTrue((O.bodies[id_fixed_transl].state.pos[0] / O.iter - 1.0) < tolerance)									#Check translation of fixed bodies
-			self.assertTrue((O.bodies[id_nonfixed_transl].state.pos[0] / O.iter - 1.0) < tolerance)								#Check translation of nonfixed bodies
-			self.assertTrue((O.bodies[id_fixed_rot].state.pos[0]-10.0*sin(pi/angVelTemp*O.iter))<tolerance)		#Check rotation of fixed bodies
-			self.assertTrue((O.bodies[id_nonfixed_rot].state.pos[2] - 10*cos(pi/angVelTemp*O.iter))<tolerance)		#Check rotation of nonfixed bodies
+			self.assertTrue(abs(O.bodies[id_fixed_transl].state.pos[0] - O.iter) < tolerance)									#Check translation of fixed bodies
+			self.assertTrue(abs(O.bodies[id_nonfixed_transl].state.pos[0] - O.iter) < tolerance)								#Check translation of nonfixed bodies
+			self.assertTrue(abs(O.bodies[id_fixed_rot].state.pos[0]-10.0*sin(pi/angVelTemp*O.iter))<tolerance)		#Check rotation of fixed bodies X
+			self.assertTrue(abs(O.bodies[id_fixed_rot].state.pos[2]-10.0*cos(pi/angVelTemp*O.iter))<tolerance)		#Check rotation of fixed bodies Y
+			self.assertTrue(abs(O.bodies[id_fixed_rot].state.ori.toAxisAngle()[1]-Quaternion(Vector3(0.0,1.0,0.0),pi/angVelTemp*O.iter).toAxisAngle()[1])<tolerance)		#Check rotation of fixed bodies, angle
+			
+			self.assertTrue(abs(O.bodies[id_nonfixed_rot].state.pos[0] - 10*sin(pi/angVelTemp*O.iter))<tolerance)		#Check rotation of nonfixed bodies X
+			self.assertTrue(abs(O.bodies[id_nonfixed_rot].state.pos[2] - 10*cos(pi/angVelTemp*O.iter))<tolerance)		#Check rotation of nonfixed bodies Y
+			self.assertTrue(abs(O.bodies[id_nonfixed_rot].state.ori.toAxisAngle()[1]-Quaternion(Vector3(0.0,1.0,0.0),pi/angVelTemp*O.iter).toAxisAngle()[1])<tolerance)		#Check rotation of nonfixed bodies, angle
 
 
 class TestIO(unittest.TestCase):