/[escript]/trunk/escript/py_src/test_util_unary_with_tagged_data.py
ViewVC logotype

Diff of /trunk/escript/py_src/test_util_unary_with_tagged_data.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 535 by gross, Wed Feb 15 07:11:00 2006 UTC revision 536 by gross, Fri Feb 17 03:20:53 2006 UTC
# Line 1690  class Test_util_unary_with_tagged_data(T Line 1690  class Test_util_unary_with_tagged_data(T
1690        self.failUnless(isinstance(res,Data),"wrong type of result.")        self.failUnless(isinstance(res,Data),"wrong type of result.")
1691        self.failUnlessEqual(res.getShape(),(3,),"wrong shape of result.")        self.failUnlessEqual(res.getShape(),(3,),"wrong shape of result.")
1692        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1693       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1694       def test_symmetric_taggedData_rank2(self):
1695          arg=Data(numarray.array([[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0]]),self.functionspace)
1696          arg.setTaggedValue(1,numarray.array([[-0.0, -1.0, -2.0], [-3.0, -4.0, -5.0], [-6.0, -7.0, -8.0]]))
1697          res=symmetric(arg)
1698          ref=Data(numarray.array([[0.0, 2.0, 4.0], [2.0, 4.0, 6.0], [4.0, 6.0, 8.0]]),self.functionspace)
1699          ref.setTaggedValue(1,numarray.array([[-0.0, -2.0, -4.0], [-2.0, -4.0, -6.0], [-4.0, -6.0, -8.0]]))
1700          self.failUnless(isinstance(res,Data),"wrong type of result.")
1701          self.failUnlessEqual(res.getShape(),(3, 3),"wrong shape of result.")
1702          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1703       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1704       def test_symmetric_taggedData_rank4(self):
1705          arg=Data(numarray.array([[[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]], [[6.0, 7.0, 8.0], [9.0, 10.0, 11.0]], [[12.0, 13.0, 14.0], [15.0, 16.0, 17.0]]], [[[18.0, 19.0, 20.0], [21.0, 22.0, 23.0]], [[24.0, 25.0, 26.0], [27.0, 28.0, 29.0]], [[30.0, 31.0, 32.0], [33.0, 34.0, 35.0]]]]),self.functionspace)
1706          arg.setTaggedValue(1,numarray.array([[[[-0.0, -1.0, -2.0], [-3.0, -4.0, -5.0]], [[-6.0, -7.0, -8.0], [-9.0, -10.0, -11.0]], [[-12.0, -13.0, -14.0], [-15.0, -16.0, -17.0]]], [[[-18.0, -19.0, -20.0], [-21.0, -22.0, -23.0]], [[-24.0, -25.0, -26.0], [-27.0, -28.0, -29.0]], [[-30.0, -31.0, -32.0], [-33.0, -34.0, -35.0]]]]))
1707          res=symmetric(arg)
1708          ref=Data(numarray.array([[[[0.0, 3.5, 7.0], [10.5, 14.0, 17.5]], [[3.5, 7.0, 10.5], [14.0, 17.5, 21.0]], [[7.0, 10.5, 14.0], [17.5, 21.0, 24.5]]], [[[10.5, 14.0, 17.5], [21.0, 24.5, 28.0]], [[14.0, 17.5, 21.0], [24.5, 28.0, 31.5]], [[17.5, 21.0, 24.5], [28.0, 31.5, 35.0]]]]),self.functionspace)
1709          ref.setTaggedValue(1,numarray.array([[[[-0.0, -3.5, -7.0], [-10.5, -14.0, -17.5]], [[-3.5, -7.0, -10.5], [-14.0, -17.5, -21.0]], [[-7.0, -10.5, -14.0], [-17.5, -21.0, -24.5]]], [[[-10.5, -14.0, -17.5], [-21.0, -24.5, -28.0]], [[-14.0, -17.5, -21.0], [-24.5, -28.0, -31.5]], [[-17.5, -21.0, -24.5], [-28.0, -31.5, -35.0]]]]))
1710          self.failUnless(isinstance(res,Data),"wrong type of result.")
1711          self.failUnlessEqual(res.getShape(),(2, 3, 2, 3),"wrong shape of result.")
1712          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1713       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1714       def test_nonsymmetric_taggedData_rank2(self):
1715          arg=Data(numarray.array([[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0]]),self.functionspace)
1716          arg.setTaggedValue(1,numarray.array([[-0.0, -1.0, -2.0], [-3.0, -4.0, -5.0], [-6.0, -7.0, -8.0]]))
1717          res=nonsymmetric(arg)
1718          ref=Data(numarray.array([[0.0, -1.0, -2.0], [1.0, 0.0, -1.0], [2.0, 1.0, 0.0]]),self.functionspace)
1719          ref.setTaggedValue(1,numarray.array([[0.0, 1.0, 2.0], [-1.0, 0.0, 1.0], [-2.0, -1.0, 0.0]]))
1720          self.failUnless(isinstance(res,Data),"wrong type of result.")
1721          self.failUnlessEqual(res.getShape(),(3, 3),"wrong shape of result.")
1722          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1723       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1724       def test_nonsymmetric_taggedData_rank4(self):
1725          arg=Data(numarray.array([[[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]], [[6.0, 7.0, 8.0], [9.0, 10.0, 11.0]], [[12.0, 13.0, 14.0], [15.0, 16.0, 17.0]]], [[[18.0, 19.0, 20.0], [21.0, 22.0, 23.0]], [[24.0, 25.0, 26.0], [27.0, 28.0, 29.0]], [[30.0, 31.0, 32.0], [33.0, 34.0, 35.0]]]]),self.functionspace)
1726          arg.setTaggedValue(1,numarray.array([[[[-0.0, -1.0, -2.0], [-3.0, -4.0, -5.0]], [[-6.0, -7.0, -8.0], [-9.0, -10.0, -11.0]], [[-12.0, -13.0, -14.0], [-15.0, -16.0, -17.0]]], [[[-18.0, -19.0, -20.0], [-21.0, -22.0, -23.0]], [[-24.0, -25.0, -26.0], [-27.0, -28.0, -29.0]], [[-30.0, -31.0, -32.0], [-33.0, -34.0, -35.0]]]]))
1727          res=nonsymmetric(arg)
1728          ref=Data(numarray.array([[[[0.0, -2.5, -5.0], [-7.5, -10.0, -12.5]], [[2.5, 0.0, -2.5], [-5.0, -7.5, -10.0]], [[5.0, 2.5, 0.0], [-2.5, -5.0, -7.5]]], [[[7.5, 5.0, 2.5], [0.0, -2.5, -5.0]], [[10.0, 7.5, 5.0], [2.5, 0.0, -2.5]], [[12.5, 10.0, 7.5], [5.0, 2.5, 0.0]]]]),self.functionspace)
1729          ref.setTaggedValue(1,numarray.array([[[[0.0, 2.5, 5.0], [7.5, 10.0, 12.5]], [[-2.5, 0.0, 2.5], [5.0, 7.5, 10.0]], [[-5.0, -2.5, 0.0], [2.5, 5.0, 7.5]]], [[[-7.5, -5.0, -2.5], [0.0, 2.5, 5.0]], [[-10.0, -7.5, -5.0], [-2.5, 0.0, 2.5]], [[-12.5, -10.0, -7.5], [-5.0, -2.5, 0.0]]]]))
1730          self.failUnless(isinstance(res,Data),"wrong type of result.")
1731          self.failUnlessEqual(res.getShape(),(2, 3, 2, 3),"wrong shape of result.")
1732          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")

Legend:
Removed from v.535  
changed lines
  Added in v.536

  ViewVC Help
Powered by ViewVC 1.1.26