]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
An advance test
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 28 Sep 2016 05:46:08 +0000 (07:46 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 28 Sep 2016 05:46:08 +0000 (07:46 +0200)
src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py

index ee8ee019ba78ce76e88a634c269f21bc40cc4460..57951ce92795358d72314d96d471a1ad275519d9 100644 (file)
@@ -4393,9 +4393,22 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         res=arr.symmetry3DPlane([0,0,0],[-1.,1.,0.])
         self.assertTrue(res.isEqual(DataArrayDouble([3,2,4],1,3),1e-14))
         #
-        res=arr.symmetry3DPlane([0,0,0],[5.,4.,-7.])
-        print res
-        #self.assertTrue(res.isEqual(DataArrayDouble([3,2,4],1,3),1e-14))
+        plane=[5.,4.,-7.]
+        a=DataArrayDouble(DataArrayDouble.GiveBaseForPlane(plane))
+        self.assertAlmostEqual(DataArrayDouble.Dot(a[0],a[1]).magnitude()[0],0.,13)
+        self.assertAlmostEqual(DataArrayDouble.Dot(a[0],a[2]).magnitude()[0],0.,13)
+        self.assertAlmostEqual(DataArrayDouble.Dot(a[1],a[2]).magnitude()[0],0.,13)
+        coo=DataArrayDouble.Aggregate([10*a[0]+10*a[1],-10*a[0]+10*a[1],-10*a[0]-10*a[1],10*a[0]-10*a[1]])
+        m=MEDCouplingUMesh("",2) ; m.setCoords(coo) ; m.allocateCells()
+        m.insertNextCell(NORM_QUAD4,[0,1,2,3])
+        d,_=m.distanceToPoint(arr)
+        res=arr.symmetry3DPlane([0.,0.,0.],plane) #
+        d2,_=m.distanceToPoint(res)
+        self.assertAlmostEqual(abs(d-d2),0.,12)
+        self.assertAlmostEqual(DataArrayDouble.Dot(res-arr,a[0])[0],0.,12)
+        self.assertAlmostEqual(DataArrayDouble.Dot(res-arr,a[1])[0],0.,12)
+        self.assertAlmostEqual((res-arr).magnitude()[0]-2*d,0.,12)
+        self.assertTrue(res.isEqual(DataArrayDouble([2.666666666666667,3.5333333333333333,3.0666666666666666],1,3),1e-12))
         pass
     
     pass