/[escript]/trunk/escript/test/python/test_util.py
ViewVC logotype

Diff of /trunk/escript/test/python/test_util.py

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

revision 153 by jgs, Tue Oct 25 01:51:20 2005 UTC revision 154 by jgs, Mon Nov 7 05:51:17 2005 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3  """  """
4  Test suite for the util.py module  Test suite for the util.py module.
5    
6  The tests must be linked with a function space class object in the setUp method:  The tests must be linked with a function space class object in the setUp method:
7    
8     from esys.finley import Rectangle     from esys.bruce import Brick
9     class Test_UtilOnFinley(Test_Util):     class Test_utilOnBruce(Test_util):
10         def setUp(self):         def setUp(self):
11             self.functionspace = FunctionOnBoundary(Rectangle(10,10,2))             self.domain = Brick(10,10,13)
12               self.functionspace = ContinuousFunction(self.domain)
13     suite = unittest.TestSuite()     suite = unittest.TestSuite()
14     suite.addTest(unittest.makeSuite(Test_UtilOnFinley))     suite.addTest(unittest.makeSuite(Test_utilOnBruce))
15     unittest.TextTestRunner(verbosity=2).run(suite)     unittest.TextTestRunner(verbosity=2).run(suite)
16    
17  The test assumes that that the functionspace has samples with tags equal to an different from 1.  For function spaces which support tagging there is the extended test case Test_util_with_tagged_Data available.
18    This test assumes that the functionspace has samples with tags equal to 1 and different from 1.
19    
20    @remark: at this stage thsi test will not pass as it tests for functionlity that has not been implemented yet. It also does not test the full functionalitu of util.py yet.
21    
22    @var __author__: name of author
23    @var __licence__: licence agreement
24    @var __url__: url entry point on documentation
25    @var __version__: version
26    @var __date__: date of the version
27  """  """
28    
29  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
30  __licence__="contact: esys@access.uq.edu.au"  __licence__="contact: esys@access.uq.edu.au"
31  __url__="http://www.iservo.edu.au/esys/escript"  __url__="http://www.iservo.edu.au/esys/escript"
32  __version__="$Revision"  __version__="$Revision$"
33  __date__="$Date$"  __date__="$Date$"
34    
35  import unittest  import unittest
36  import numarray  import numarray
37  from esys.escript import *  from esys.escript import *
38    
39  class Test_Util(unittest.TestCase):  class Test_util(unittest.TestCase):
40     tol=1.e-7     RES_TOL=1.e-7 # RES_TOLerance to compare results
41       DIFF_TOL=1.e-7 # RES_TOLerance to derivatices
42  #=========================================================  #=========================================================
43  #  constants  #  constants
44  #=========================================================  #=========================================================
# Line 248  class Test_Util(unittest.TestCase): Line 259  class Test_Util(unittest.TestCase):
259        ref=0.479077251703        ref=0.479077251703
260        res=Lsup(arg)        res=Lsup(arg)
261        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
262        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
263     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
264     def test_Lsup_array_rank0(self):     def test_Lsup_array_rank0(self):
265        arg=0.352800421569        arg=0.352800421569
266        ref=0.352800421569        ref=0.352800421569
267        res=Lsup(arg)        res=Lsup(arg)
268        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
269        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
270     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
271     def test_Lsup_array_rank1(self):     def test_Lsup_array_rank1(self):
272        arg=numarray.array([0.58364106865247445, 0.19224319360367659])        arg=numarray.array([0.58364106865247445, 0.19224319360367659])
273        ref=0.583641068652        ref=0.583641068652
274        res=Lsup(arg)        res=Lsup(arg)
275        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
276        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
277     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
278     def test_Lsup_array_rank2(self):     def test_Lsup_array_rank2(self):
279        arg=numarray.array([[0.67017748174064184, 0.27426357568545234, 0.99809374007262508, 0.0068333566694658288, -0.27942939334057559], [-0.41062296082648619, -0.036816602223561423, -0.50580074937952246, 0.93227848108675948, -0.061517050082725788], [0.36561750746233845, 0.41114839130078873, 0.52258027672142848, -0.16534372330544111, 0.20772668552253304], [0.821900382760401, -0.84255628577421948, -0.69396587198625026, -0.57918798921236458, -0.72171447032975466]])        arg=numarray.array([[0.67017748174064184, 0.27426357568545234, 0.99809374007262508, 0.0068333566694658288, -0.27942939334057559], [-0.41062296082648619, -0.036816602223561423, -0.50580074937952246, 0.93227848108675948, -0.061517050082725788], [0.36561750746233845, 0.41114839130078873, 0.52258027672142848, -0.16534372330544111, 0.20772668552253304], [0.821900382760401, -0.84255628577421948, -0.69396587198625026, -0.57918798921236458, -0.72171447032975466]])
280        ref=0.998093740073        ref=0.998093740073
281        res=Lsup(arg)        res=Lsup(arg)
282        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
283        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
284     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
285     def test_Lsup_array_rank3(self):     def test_Lsup_array_rank3(self):
286        arg=numarray.array([[[0.058641541671277109, -0.90451294682583527], [-0.24359709498927606, -0.57748558070477163]], [[0.035804882991596898, 0.62841290637910441], [-0.28533080116748288, -0.97886508166774955]], [[0.31393622401598642, -0.43905852202615403], [-0.86251727012547685, 0.028980168735740941]], [[0.64796855283921229, -0.48583038861071492], [0.18113352051559328, -0.41145930584343637]], [[0.039393878628251944, 0.8768398562091233], [-0.17607723439655953, -0.88597401556177768]], [[-0.015710131346685419, -0.1460065558640582], [0.97739538148461858, -0.96991499683153215]]])        arg=numarray.array([[[0.058641541671277109, -0.90451294682583527], [-0.24359709498927606, -0.57748558070477163]], [[0.035804882991596898, 0.62841290637910441], [-0.28533080116748288, -0.97886508166774955]], [[0.31393622401598642, -0.43905852202615403], [-0.86251727012547685, 0.028980168735740941]], [[0.64796855283921229, -0.48583038861071492], [0.18113352051559328, -0.41145930584343637]], [[0.039393878628251944, 0.8768398562091233], [-0.17607723439655953, -0.88597401556177768]], [[-0.015710131346685419, -0.1460065558640582], [0.97739538148461858, -0.96991499683153215]]])
287        ref=0.978865081668        ref=0.978865081668
288        res=Lsup(arg)        res=Lsup(arg)
289        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
290        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
291     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
292     def test_Lsup_array_rank4(self):     def test_Lsup_array_rank4(self):
293        arg=numarray.array([[[[-0.78982105495266985, -0.63220666806337955, 0.17512704833203396, 0.87905338838606228], [0.23198845220692799, 0.039972475068823288, 0.012169097173197807, 0.44188750570302382], [0.76550090905039703, 0.31693138180972436, 0.1053031163896907, -0.35110494947362092]], [[0.98438531435704557, 0.64830270240860366, 0.17255823042313656, -0.89376135594562944], [-0.24129437029981871, -0.142955980423916, 0.16557185988864043, 0.97182386578689162], [0.68369373227893937, -0.86170550438838256, 0.30120477894454822, 0.38702330237685523]]], [[[0.77139284396922037, 0.20032741426304668, 0.57845916425558697, -0.29867163908832151], [-0.068269410287581156, 0.5940891737261742, 0.076472990825278808, -0.099092183170674364], [-0.052727700907511776, 0.86303703635283835, -0.87561628108225542, 0.98706354430335175]], [[0.59243014649382819, 0.1550040875984271, -0.2755507051420949, -0.0013143184448647371], [0.49341486033505921, 0.47331310491746503, -0.79931467469262252, -0.90673470029976722], [-0.032268150780954796, 0.296035852616644, 0.51579882806939303, 0.46437108203184607]]], [[[-0.54940019219066349, 0.063961557315018069, 0.58950734587654585, -0.98334853918198539], [-0.3624096661573355, 0.41744569348555416, 0.30209950686844023, 0.51268273249278518], [0.18884359916930848, -0.71707023426140903, -0.30560603652072227, 0.50521867139895282]], [[0.48925658559264695, -0.22791551552340583, -0.0018172920946346593, -0.35038144063572618], [-0.92608233760416425, -0.58447575161042908, 0.6419293813902982, -0.9165521427783867], [0.32116313637555338, 0.64441081354246466, 0.57516697859586241, -0.30456483792192746]]]])        arg=numarray.array([[[[-0.78982105495266985, -0.63220666806337955, 0.17512704833203396, 0.87905338838606228], [0.23198845220692799, 0.039972475068823288, 0.012169097173197807, 0.44188750570302382], [0.76550090905039703, 0.31693138180972436, 0.1053031163896907, -0.35110494947362092]], [[0.98438531435704557, 0.64830270240860366, 0.17255823042313656, -0.89376135594562944], [-0.24129437029981871, -0.142955980423916, 0.16557185988864043, 0.97182386578689162], [0.68369373227893937, -0.86170550438838256, 0.30120477894454822, 0.38702330237685523]]], [[[0.77139284396922037, 0.20032741426304668, 0.57845916425558697, -0.29867163908832151], [-0.068269410287581156, 0.5940891737261742, 0.076472990825278808, -0.099092183170674364], [-0.052727700907511776, 0.86303703635283835, -0.87561628108225542, 0.98706354430335175]], [[0.59243014649382819, 0.1550040875984271, -0.2755507051420949, -0.0013143184448647371], [0.49341486033505921, 0.47331310491746503, -0.79931467469262252, -0.90673470029976722], [-0.032268150780954796, 0.296035852616644, 0.51579882806939303, 0.46437108203184607]]], [[[-0.54940019219066349, 0.063961557315018069, 0.58950734587654585, -0.98334853918198539], [-0.3624096661573355, 0.41744569348555416, 0.30209950686844023, 0.51268273249278518], [0.18884359916930848, -0.71707023426140903, -0.30560603652072227, 0.50521867139895282]], [[0.48925658559264695, -0.22791551552340583, -0.0018172920946346593, -0.35038144063572618], [-0.92608233760416425, -0.58447575161042908, 0.6419293813902982, -0.9165521427783867], [0.32116313637555338, 0.64441081354246466, 0.57516697859586241, -0.30456483792192746]]]])
294        ref=0.987063544303        ref=0.987063544303
295        res=Lsup(arg)        res=Lsup(arg)
296        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
297        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
298     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
299     def test_Lsup_constData_rank0(self):     def test_Lsup_constData_rank0(self):
300        arg=Data(0.196366308048,self.functionspace)        arg=Data(0.196366308048,self.functionspace)
301        ref=0.196366308048        ref=0.196366308048
302        res=Lsup(arg)        res=Lsup(arg)
303        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
304        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
305     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
306     def test_Lsup_constData_rank1(self):     def test_Lsup_constData_rank1(self):
307        arg=Data(numarray.array([-0.013183241788205846, 0.30081447346639489]),self.functionspace)        arg=Data(numarray.array([-0.013183241788205846, 0.30081447346639489]),self.functionspace)
308        ref=0.300814473466        ref=0.300814473466
309        res=Lsup(arg)        res=Lsup(arg)
310        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
311        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
312     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
313     def test_Lsup_constData_rank2(self):     def test_Lsup_constData_rank2(self):
314        arg=Data(numarray.array([[0.5711180583492661, 0.70931947195628298, -0.66895311699347904, 0.96005746113679025, 0.73085528334644767], [-0.63904611175106618, 0.2843691804450883, 0.44023994297671054, 0.74230048057601272, 0.32582591826440876], [0.058605148358656045, 0.17856553839104938, 0.92397360311332144, -0.96449976222010503, -0.2936728605307215], [-0.54599501106213921, 0.76941479487476183, 0.071247548913826231, 0.19101147233175308, -0.1697403800152153]]),self.functionspace)        arg=Data(numarray.array([[0.5711180583492661, 0.70931947195628298, -0.66895311699347904, 0.96005746113679025, 0.73085528334644767], [-0.63904611175106618, 0.2843691804450883, 0.44023994297671054, 0.74230048057601272, 0.32582591826440876], [0.058605148358656045, 0.17856553839104938, 0.92397360311332144, -0.96449976222010503, -0.2936728605307215], [-0.54599501106213921, 0.76941479487476183, 0.071247548913826231, 0.19101147233175308, -0.1697403800152153]]),self.functionspace)
315        ref=0.96449976222        ref=0.96449976222
316        res=Lsup(arg)        res=Lsup(arg)
317        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
318        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
319     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
320     def test_Lsup_constData_rank3(self):     def test_Lsup_constData_rank3(self):
321        arg=Data(numarray.array([[[0.72501574945437675, 0.097442689963523454], [0.81136110912526904, 0.30019286779005516]], [[-0.49590270028453376, 0.89873757442194169], [-0.77574675514072333, 0.00090692035026496143]], [[0.30313499990678294, -0.22304437168798286], [0.26434595235717628, 0.56043553186944139]], [[-0.82536121216538372, 0.017266274277504934], [0.15087851023611853, 0.85422443819044291]], [[-0.85528228633213454, 0.21599153787828373], [-0.8320606477196939, 0.8359530516934528]], [[-0.32478507656272382, 0.11549647741760993], [-0.87438785398253049, 0.58454806081387956]]]),self.functionspace)        arg=Data(numarray.array([[[0.72501574945437675, 0.097442689963523454], [0.81136110912526904, 0.30019286779005516]], [[-0.49590270028453376, 0.89873757442194169], [-0.77574675514072333, 0.00090692035026496143]], [[0.30313499990678294, -0.22304437168798286], [0.26434595235717628, 0.56043553186944139]], [[-0.82536121216538372, 0.017266274277504934], [0.15087851023611853, 0.85422443819044291]], [[-0.85528228633213454, 0.21599153787828373], [-0.8320606477196939, 0.8359530516934528]], [[-0.32478507656272382, 0.11549647741760993], [-0.87438785398253049, 0.58454806081387956]]]),self.functionspace)
322        ref=0.898737574422        ref=0.898737574422
323        res=Lsup(arg)        res=Lsup(arg)
324        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
325        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
326     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
327     def test_Lsup_constData_rank4(self):     def test_Lsup_constData_rank4(self):
328        arg=Data(numarray.array([[[[-0.1675633776917147, 0.33827478137880718, -0.93890402023643449, 0.65020437341791437], [0.29507018847480526, 0.98622587753446878, 0.12652012726316597, -0.31134038684685694], [-0.046095794370747178, 0.52924578464459526, -0.6479404156998898, -0.50108997075395512]], [[-0.89461015899273821, -0.079360196866752331, 0.24950542226018069, 0.6689436082056277], [0.92392213781413735, 0.3873078097702356, 0.19593123983162242, -0.24092882483013001], [-0.64621424798001881, 0.9822743623774457, 0.89791841241748926, 0.61910184653693512]]], [[[-0.93993640130694156, 0.86452728798536005, 0.094496916350070848, 0.59825417382728907], [0.55042390382543216, 0.83625046124041091, -0.59865905280251042, 0.60081510989738351], [0.96300656863917622, 0.45676715577013183, 0.96765574240961594, 0.35217159943804499]], [[-0.44344990079738578, -0.62540931368504271, 0.47046830875624712, 0.56727920796684694], [0.68754074058706793, -0.20419202844112316, -0.0095491803785341389, 0.013299778291189002], [0.17824394120278897, -0.27714200037108694, -0.2616405339148673, -0.32155257707876661]]], [[[0.47113927793594357, -0.99306136743656892, 0.30468996581271934, -0.55558797016447881], [0.83216176170936151, 0.016003159554198287, 0.50607924358488665, -0.44441953149310631], [0.81919419287951278, -0.65849894919643503, 0.91897977494732008, -0.52338741357416407]], [[0.71408966944475138, -0.49347702658095161, 0.35676281330171133, 0.87268025092466872], [0.38401738326898771, -0.66323897612738114, 0.57309433517459518, 0.72101582669934583], [-0.0289954568811297, 0.55204032281174009, 0.51120867863750807, -0.67373936301915327]]]]),self.functionspace)        arg=Data(numarray.array([[[[-0.1675633776917147, 0.33827478137880718, -0.93890402023643449, 0.65020437341791437], [0.29507018847480526, 0.98622587753446878, 0.12652012726316597, -0.31134038684685694], [-0.046095794370747178, 0.52924578464459526, -0.6479404156998898, -0.50108997075395512]], [[-0.89461015899273821, -0.079360196866752331, 0.24950542226018069, 0.6689436082056277], [0.92392213781413735, 0.3873078097702356, 0.19593123983162242, -0.24092882483013001], [-0.64621424798001881, 0.9822743623774457, 0.89791841241748926, 0.61910184653693512]]], [[[-0.93993640130694156, 0.86452728798536005, 0.094496916350070848, 0.59825417382728907], [0.55042390382543216, 0.83625046124041091, -0.59865905280251042, 0.60081510989738351], [0.96300656863917622, 0.45676715577013183, 0.96765574240961594, 0.35217159943804499]], [[-0.44344990079738578, -0.62540931368504271, 0.47046830875624712, 0.56727920796684694], [0.68754074058706793, -0.20419202844112316, -0.0095491803785341389, 0.013299778291189002], [0.17824394120278897, -0.27714200037108694, -0.2616405339148673, -0.32155257707876661]]], [[[0.47113927793594357, -0.99306136743656892, 0.30468996581271934, -0.55558797016447881], [0.83216176170936151, 0.016003159554198287, 0.50607924358488665, -0.44441953149310631], [0.81919419287951278, -0.65849894919643503, 0.91897977494732008, -0.52338741357416407]], [[0.71408966944475138, -0.49347702658095161, 0.35676281330171133, 0.87268025092466872], [0.38401738326898771, -0.66323897612738114, 0.57309433517459518, 0.72101582669934583], [-0.0289954568811297, 0.55204032281174009, 0.51120867863750807, -0.67373936301915327]]]]),self.functionspace)
329        ref=0.993061367437        ref=0.993061367437
330        res=Lsup(arg)        res=Lsup(arg)
331        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
332        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
333     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Lsup_taggedData_rank0(self):  
       arg=Data(0.860813503322,self.functionspace)  
       arg.setTaggedValue(1,0.860813503322)  
       res=Lsup(arg)  
       ref=0.860813503322  
       self.failUnless(isinstance(res,float),"wrong type of result.")  
       self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Lsup_taggedData_rank1(self):  
       arg=Data(numarray.array([-0.54932912559284452, 0.29396676960376178]),self.functionspace)  
       arg.setTaggedValue(1,[0.98025125990414441, -0.070257235982443378])  
       res=Lsup(arg)  
       ref=0.980251259904  
       self.failUnless(isinstance(res,float),"wrong type of result.")  
       self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Lsup_taggedData_rank2(self):  
       arg=Data(numarray.array([[-0.86895475746708128, 0.45103596542916824, 0.89202718384469271, 0.66165880808530297, 0.71929063210904221], [-0.054750345740449236, -0.26270085023397649, -0.44869339310367407, 0.84127602579890803, 0.4084040169910117], [-0.80258081555352101, 0.71946204694435134, -0.97606916814646971, -0.88087380297928397, 0.91540441306863141], [0.53133024472568935, -0.60623654813712635, 0.82280414663810242, 0.64010933901991374, 0.62566314353300356]]),self.functionspace)  
       arg.setTaggedValue(1,[[-0.84852153765445437, 0.13244202632711666, -0.64133508534494599, -0.73706953458433633, 0.55834403408867184], [0.27998214461793847, 0.31446145164831063, -0.63410404784852048, 0.2813747329563423, 0.41221195047082393], [-0.79513090436643696, 0.92563876120768263, 0.80602538500705001, 0.21092919617246042, -0.21449414451693616], [0.50885151366468984, -0.53247783698745965, -0.98502684901017235, 0.36104863911630503, -0.68481313205160554]])  
       res=Lsup(arg)  
       ref=0.98502684901  
       self.failUnless(isinstance(res,float),"wrong type of result.")  
       self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Lsup_taggedData_rank3(self):  
       arg=Data(numarray.array([[[-0.0289179522354861, -0.53873332225554216], [-0.87313007813556509, -0.47147149825784584]], [[0.046403579054177468, -0.66499184318911042], [-0.14945300648197457, 0.33023752485562841]], [[0.73609028529612153, 0.62400582710031194], [0.18047782954118574, 0.98299132707347403]], [[0.97452943106570422, -0.80052218344822124], [0.90989474269184356, 0.74467116925414456]], [[-0.40975095375636039, 0.35721815590834538], [-0.023117827122894896, 0.38726163442133732]], [[0.35214474483480052, 0.79626235681759927], [0.072063982160859297, -0.13255981975702369]]]),self.functionspace)  
       arg.setTaggedValue(1,[[[0.35540494212277429, -0.40452986468200347], [0.92646378475498059, -0.60976701230157482]], [[-0.17488076275939557, 0.1383489038535719], [0.87222102776136068, 0.05521388649844039]], [[-0.45846974731683399, 0.84645585780786292], [-0.36620222778926448, 0.8758026265447818]], [[0.55804586547774848, -0.19954715807059986], [0.51849302021923482, 0.29871500421422281]], [[0.98995968883285035, -0.78797081527577162], [0.3108075746688399, 0.5474101080348186]], [[-0.74670637823709085, 0.16925394395842575], [-0.76281911656771095, 0.79574461985041189]]])  
       res=Lsup(arg)  
       ref=0.989959688833  
       self.failUnless(isinstance(res,float),"wrong type of result.")  
       self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Lsup_taggedData_rank4(self):  
       arg=Data(numarray.array([[[[-0.17143955149003642, -0.0089504254973518105, 0.53089483578382191, 0.32381408252152899], [-0.77296292864801019, -0.089110721047862773, 0.46285355679515883, 0.62221785170960708], [-0.67474474335134915, 0.34682047265462157, 0.9384448074012548, 0.5682850087388498]], [[0.52652198841191855, 0.52394055634009762, 0.41923325950497858, -0.48507989905455706], [-0.90073796582592069, -0.40217266425438258, -0.60530063652424215, 0.68062718938448441], [-0.59931923693732347, -0.79549982795384744, -0.70714734772804722, -0.46042778371080284]]], [[[0.58538756755140686, 0.98385384505005846, 0.7777811719634411, -0.64306377174574281], [0.72961354558815694, 0.10696472171933968, -0.11372282342784068, 0.87929133681948879], [-0.67126196529672244, -0.64730190047646907, 0.64547629928395711, 0.50361974274373145]], [[0.96265942240931546, -0.20746026072477042, 0.47323657518133921, -0.78443796621025053], [0.61977887181220659, -0.0192018581010025, -0.0016015804221325425, 0.25446656696052594], [0.19964691572203019, -0.44122579240360293, 0.89836148991232134, -0.97914559157737457]]], [[[-0.32474221003830039, 0.50501185871734799, 0.081832847990893409, 0.49226411509256796], [-0.58561709012191865, -0.97753141368900409, 0.50702769958783778, 0.46965610524959978], [0.19394052487354463, 0.32118138849740641, 0.48348630138165749, -0.61570132061285632]], [[0.78997938799317668, 0.48729593728848108, 0.86690961213187001, -0.55317005853484491], [-0.38985400756166189, -0.79197087340853445, 0.150444446088422, 0.30366473850354492], [0.16673919050825758, -0.28616432413953641, -0.49042930009947883, -0.80964116966434485]]]]),self.functionspace)  
       arg.setTaggedValue(1,[[[[-0.72676590268291097, 0.98420782971554899, -0.58004995296952444, 0.37649505647780179], [-0.36963117451708949, -0.38478644500667469, 0.1606599749645139, 0.26146427896482427], [-0.99755391430668583, 0.96243322443760793, -0.34748898506056713, 0.28223401802658166]], [[0.41892282572460227, -0.068327589700850844, -0.92249969532644394, -0.2927104302765704], [0.63237889769391709, -0.61446924102341649, -0.9271255632289408, 0.72693928120951368], [-0.099138333893530106, -0.93278471458000989, 0.16805036953472618, 0.13406769552186848]]], [[[0.1322308020971239, -0.15094779056740282, 0.48419178200868274, -0.90259173990902308], [0.088806733010250438, -0.44134645109664827, 0.50169033175317468, -0.16413576472992863], [0.10447947060273766, 0.59946651445651744, -0.28648625172498821, -0.26114646276357711]], [[-0.17647875332717788, -0.95243401465773969, 0.066994364736289391, 0.76072295812282875], [-0.29974152935779652, -0.87018574916912828, -0.40027227651920905, -0.27566894336852044], [-0.87505794257603342, 0.53786153286888583, -0.23579951775243324, 0.29461110217796826]]], [[[-0.031292782596848978, 0.19001451946176351, 0.51137483078731094, 0.35855090738394124], [-0.62796181019314523, -0.017622867812650655, -0.20994152673731148, 0.21972116995451207], [-0.53419638828850147, 0.61964526276926013, 0.83633801914948402, -0.22627427949817003]], [[-0.25275677187826617, 0.92174213140825789, 0.29387486254521544, 0.2851840648022741], [0.99521823294639589, 0.30976825827796484, 0.39585066725930163, -0.037512976967312373], [-0.0098417329760405181, -0.72834591016301697, -0.2368701950529164, -0.075161686057492183]]]])  
       res=Lsup(arg)  
       ref=0.997553914307  
       self.failUnless(isinstance(res,float),"wrong type of result.")  
       self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")  
334     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
335     def test_Lsup_expandedData_rank0(self):     def test_Lsup_expandedData_rank0(self):
336        arg=Data(0.907507663119,self.functionspace,True)        msk=whereNegative(self.functionspace.getX()[0]-0.5)
337        arg.setTaggedValue(1,0.907507663119)        arg=msk*0.907507663119+(1.-msk)*0.907507663119
338    
339          # arg=Data(0.907507663119,self.functionspace,True)
340          # arg.setTaggedValue(1,0.907507663119)
341        res=Lsup(arg)        res=Lsup(arg)
342        ref=0.907507663119        ref=0.907507663119
343        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
344        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
345     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
346     def test_Lsup_expandedData_rank1(self):     def test_Lsup_expandedData_rank1(self):
347        arg=Data(numarray.array([0.64842023599463228, 0.7950449048151853]),self.functionspace,True)  
348        arg.setTaggedValue(1,[-0.53356920308809608, -0.30392740367264159])        msk=whereNegative(self.functionspace.getX()[0]-0.5)
349          arg=msk*numarray.array([0.64842023599463228, 0.7950449048151853])+(1.-msk)*numarray.array([-0.53356920308809608, -0.30392740367264159])
350    
351          # arg=Data(numarray.array([0.64842023599463228, 0.7950449048151853]),self.functionspace,True)
352          # arg.setTaggedValue(1,[-0.53356920308809608, -0.30392740367264159])
353        res=Lsup(arg)        res=Lsup(arg)
354        ref=0.795044904815        ref=0.795044904815
355        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
356        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
357     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
358     def test_Lsup_expandedData_rank2(self):     def test_Lsup_expandedData_rank2(self):
359        arg=Data(numarray.array([[0.72772455370935374, -0.47120637916343311, -0.82075870555018726, -0.13186541688079845, 0.14046405940683471], [0.10791450121551649, 0.043686402172190775, 0.4587164889316806, -0.16569163575870283, 0.64477762072726041], [0.62628246294878309, -0.46538827310659792, 0.58089235621217727, -0.745300901798017, -0.1072674226756638], [0.93074707226494824, 0.17195108914746116, 0.77645205158899833, -0.55814650711894975, -0.68929261213084403]]),self.functionspace,True)  
360        arg.setTaggedValue(1,[[-0.25856012658041871, -0.64132706411711782, -0.90934384682634128, 0.13076992241789931, 0.23456684296051011], [0.54052140856785269, 0.78868044275368643, 0.20419986484049479, 0.64782383948156319, 0.12883249735345115], [-0.44575026820636654, -0.86972644697707824, 0.74937006939719653, 0.64390867433141019, 0.57227950445890885], [-0.59430616226417832, -0.77932115906125854, 0.60864641730739155, 0.909083762068297, -0.5444504332265574]])        msk=whereNegative(self.functionspace.getX()[0]-0.5)
361          arg=msk*numarray.array([[0.72772455370935374, -0.47120637916343311, -0.82075870555018726, -0.13186541688079845, 0.14046405940683471], [0.10791450121551649, 0.043686402172190775, 0.4587164889316806, -0.16569163575870283, 0.64477762072726041], [0.62628246294878309, -0.46538827310659792, 0.58089235621217727, -0.745300901798017, -0.1072674226756638], [0.93074707226494824, 0.17195108914746116, 0.77645205158899833, -0.55814650711894975, -0.68929261213084403]])+(1.-msk)*numarray.array([[-0.25856012658041871, -0.64132706411711782, -0.90934384682634128, 0.13076992241789931, 0.23456684296051011], [0.54052140856785269, 0.78868044275368643, 0.20419986484049479, 0.64782383948156319, 0.12883249735345115], [-0.44575026820636654, -0.86972644697707824, 0.74937006939719653, 0.64390867433141019, 0.57227950445890885], [-0.59430616226417832, -0.77932115906125854, 0.60864641730739155, 0.909083762068297, -0.5444504332265574]])
362    
363          # arg=Data(numarray.array([[0.72772455370935374, -0.47120637916343311, -0.82075870555018726, -0.13186541688079845, 0.14046405940683471], [0.10791450121551649, 0.043686402172190775, 0.4587164889316806, -0.16569163575870283, 0.64477762072726041], [0.62628246294878309, -0.46538827310659792, 0.58089235621217727, -0.745300901798017, -0.1072674226756638], [0.93074707226494824, 0.17195108914746116, 0.77645205158899833, -0.55814650711894975, -0.68929261213084403]]),self.functionspace,True)
364          # arg.setTaggedValue(1,[[-0.25856012658041871, -0.64132706411711782, -0.90934384682634128, 0.13076992241789931, 0.23456684296051011], [0.54052140856785269, 0.78868044275368643, 0.20419986484049479, 0.64782383948156319, 0.12883249735345115], [-0.44575026820636654, -0.86972644697707824, 0.74937006939719653, 0.64390867433141019, 0.57227950445890885], [-0.59430616226417832, -0.77932115906125854, 0.60864641730739155, 0.909083762068297, -0.5444504332265574]])
365        res=Lsup(arg)        res=Lsup(arg)
366        ref=0.930747072265        ref=0.930747072265
367        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
368        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
369     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
370     def test_Lsup_expandedData_rank3(self):     def test_Lsup_expandedData_rank3(self):
371        arg=Data(numarray.array([[[0.31609964814729086, -0.59322042077218184], [0.62671563648606643, -0.99924882354010092]], [[-0.81285219908299133, -0.91261945476639861], [-0.66394864058744174, -0.070011911370653657]], [[-0.4798784324091383, -0.017929635369934749], [0.87935995021589952, 0.73748462709583618]], [[-0.89673095768516986, 0.44255562883781563], [-0.33009427566326166, 0.89415170271508537]], [[-0.070411620428932897, 0.34854312339042304], [-0.54088506672687542, 0.57996368816677069]], [[0.98447862226498417, 0.31010343079927294], [0.18832525314748882, 0.46594491838516161]]]),self.functionspace,True)  
372        arg.setTaggedValue(1,[[[0.036725320623094637, -0.95874317021810596], [-0.66138152872168576, -0.52870418789420959]], [[0.59182952544611012, -0.31117513196914603], [0.17957160072325573, -0.93130315483187909]], [[0.33548100103066814, -0.6503677585469938], [-0.15995741665912955, -0.79138987042982367]], [[0.12353483100690976, -0.72197260504479188], [-0.35933752275788389, -0.46752695895022667]], [[0.7611306903818762, -0.88807332904594882], [0.91131651925077373, 0.81255438802194258]], [[-0.56892641899978824, 0.0010213385566093525], [0.40194539652124472, -0.006585080723547021]]])        msk=whereNegative(self.functionspace.getX()[0]-0.5)
373          arg=msk*numarray.array([[[0.31609964814729086, -0.59322042077218184], [0.62671563648606643, -0.99924882354010092]], [[-0.81285219908299133, -0.91261945476639861], [-0.66394864058744174, -0.070011911370653657]], [[-0.4798784324091383, -0.017929635369934749], [0.87935995021589952, 0.73748462709583618]], [[-0.89673095768516986, 0.44255562883781563], [-0.33009427566326166, 0.89415170271508537]], [[-0.070411620428932897, 0.34854312339042304], [-0.54088506672687542, 0.57996368816677069]], [[0.98447862226498417, 0.31010343079927294], [0.18832525314748882, 0.46594491838516161]]])+(1.-msk)*numarray.array([[[0.036725320623094637, -0.95874317021810596], [-0.66138152872168576, -0.52870418789420959]], [[0.59182952544611012, -0.31117513196914603], [0.17957160072325573, -0.93130315483187909]], [[0.33548100103066814, -0.6503677585469938], [-0.15995741665912955, -0.79138987042982367]], [[0.12353483100690976, -0.72197260504479188], [-0.35933752275788389, -0.46752695895022667]], [[0.7611306903818762, -0.88807332904594882], [0.91131651925077373, 0.81255438802194258]], [[-0.56892641899978824, 0.0010213385566093525], [0.40194539652124472, -0.006585080723547021]]])
374    
375          # arg=Data(numarray.array([[[0.31609964814729086, -0.59322042077218184], [0.62671563648606643, -0.99924882354010092]], [[-0.81285219908299133, -0.91261945476639861], [-0.66394864058744174, -0.070011911370653657]], [[-0.4798784324091383, -0.017929635369934749], [0.87935995021589952, 0.73748462709583618]], [[-0.89673095768516986, 0.44255562883781563], [-0.33009427566326166, 0.89415170271508537]], [[-0.070411620428932897, 0.34854312339042304], [-0.54088506672687542, 0.57996368816677069]], [[0.98447862226498417, 0.31010343079927294], [0.18832525314748882, 0.46594491838516161]]]),self.functionspace,True)
376          # arg.setTaggedValue(1,[[[0.036725320623094637, -0.95874317021810596], [-0.66138152872168576, -0.52870418789420959]], [[0.59182952544611012, -0.31117513196914603], [0.17957160072325573, -0.93130315483187909]], [[0.33548100103066814, -0.6503677585469938], [-0.15995741665912955, -0.79138987042982367]], [[0.12353483100690976, -0.72197260504479188], [-0.35933752275788389, -0.46752695895022667]], [[0.7611306903818762, -0.88807332904594882], [0.91131651925077373, 0.81255438802194258]], [[-0.56892641899978824, 0.0010213385566093525], [0.40194539652124472, -0.006585080723547021]]])
377        res=Lsup(arg)        res=Lsup(arg)
378        ref=0.99924882354        ref=0.99924882354
379        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
380        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
381     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
382     def test_Lsup_expandedData_rank4(self):     def test_Lsup_expandedData_rank4(self):
383        arg=Data(numarray.array([[[[0.4996033665120716, -0.074132654028136846, 0.2908837888281397, 0.79804117547820219], [0.25334186456470942, -0.10892196087517791, 0.90411872189757747, -0.21372334914190327], [0.65549677694560438, 0.97979738684954532, -0.29737844854710138, 0.93659843329597914]], [[0.22668444631484608, -0.92481913749465305, -0.9980815386745403, -0.022502768980955601], [-0.21769755240946398, 0.77216348666766876, -0.19843685166706204, 0.54270333879579558], [-0.11274856721131221, -0.29600869223659299, 0.1458222910080329, -0.83739782177046851]]], [[[0.86722932032155531, 0.39888432468517876, -0.8991679849590255, -0.088621935923834272], [-0.58464076321585412, -0.09564380294323116, 0.18232602464536307, 0.7910046931530843], [0.15923450234841652, -0.39331159996226872, 0.18298541750645669, 0.99889484861795563]], [[0.36793558813747418, -0.64593764280975363, 0.048503028175158613, -0.8304805399530264], [0.072019074767407432, -0.066883567381289311, -0.55849542620276127, -0.32521841292447484], [0.83256632210175896, -0.52124955617445723, -0.0047287521832242163, 0.84184001532121422]]], [[[-0.81375499823702158, 0.12901434959756353, -0.51500727423485215, 0.52626362435118912], [-0.47602620905811044, 0.81525173294213982, 0.023145745277130203, 0.5818744103097242], [-0.26074066195347489, 0.62737248392572886, 0.24246935026650718, 0.86155298917514145]], [[0.40180649524587109, -0.13468267908829512, -0.66576279256576543, -0.97664336021962694], [-0.81183732113700424, -0.10477655696019839, -0.90212494842448732, 0.50784279020015499], [0.29352929816605089, 0.10640245030222295, -0.16640870997460122, 0.91371366707232826]]]]),self.functionspace,True)  
384        arg.setTaggedValue(1,[[[[0.6465819200939884, 0.21755363919340609, 0.73973535907059662, -0.36114669719855241], [0.16087051863228452, -0.96295075570141986, 0.93283344105282717, 0.8498346294196879], [-0.62871563035312805, 0.028501977366871101, -0.76183996578150004, -0.42396762024023338]], [[0.45139869884828876, 0.9085099092003921, 0.90516675545818392, -0.2797423591331305], [-0.012176715080714828, 0.40935600076669765, -0.010156279663344314, -0.45527372677880185], [-0.56697253731600106, -0.88076957837377901, -0.43708368779823448, -0.98115855535334329]]], [[[-0.6812131434679467, -0.75007359636996074, 0.52195871968240559, 0.74207747673309732], [0.53576769134014213, -0.19432873205999046, -0.87970756195132904, -0.36970944422105911], [0.18377651984390431, -0.30093639418244189, 0.30640551056952825, -0.95779743159891284]], [[0.3069655071293016, 0.42532244942656305, 0.27182877898608804, 0.89926151593228765], [-0.94227360921249192, 0.17309985459832045, -0.067341615594060267, -0.24017528169767255], [0.72377020653147883, -0.60287365881872312, 0.17612550848074338, -0.89499327987049915]]], [[[-0.8985020338092089, -0.27805317471704494, -0.096352572725887375, 0.26107376060313836], [-0.98264038134460852, -0.40101944215897967, 0.80787105663414827, -0.91046803072373206], [-0.11056024039811629, -0.35146855329949345, 0.62639019941990948, 0.029258586953160748]], [[0.5190564210634494, 0.25178673168519605, -0.095466912631134937, -0.66223610619416462], [0.86572944270431917, -0.0070686656495086986, -0.56404011740509774, 0.5156978630437381], [0.15106963134402651, 0.12900511640038159, 0.6022471822104567, 0.48643914768022012]]]])        msk=whereNegative(self.functionspace.getX()[0]-0.5)
385          arg=msk*numarray.array([[[[0.4996033665120716, -0.074132654028136846, 0.2908837888281397, 0.79804117547820219], [0.25334186456470942, -0.10892196087517791, 0.90411872189757747, -0.21372334914190327], [0.65549677694560438, 0.97979738684954532, -0.29737844854710138, 0.93659843329597914]], [[0.22668444631484608, -0.92481913749465305, -0.9980815386745403, -0.022502768980955601], [-0.21769755240946398, 0.77216348666766876, -0.19843685166706204, 0.54270333879579558], [-0.11274856721131221, -0.29600869223659299, 0.1458222910080329, -0.83739782177046851]]], [[[0.86722932032155531, 0.39888432468517876, -0.8991679849590255, -0.088621935923834272], [-0.58464076321585412, -0.09564380294323116, 0.18232602464536307, 0.7910046931530843], [0.15923450234841652, -0.39331159996226872, 0.18298541750645669, 0.99889484861795563]], [[0.36793558813747418, -0.64593764280975363, 0.048503028175158613, -0.8304805399530264], [0.072019074767407432, -0.066883567381289311, -0.55849542620276127, -0.32521841292447484], [0.83256632210175896, -0.52124955617445723, -0.0047287521832242163, 0.84184001532121422]]], [[[-0.81375499823702158, 0.12901434959756353, -0.51500727423485215, 0.52626362435118912], [-0.47602620905811044, 0.81525173294213982, 0.023145745277130203, 0.5818744103097242], [-0.26074066195347489, 0.62737248392572886, 0.24246935026650718, 0.86155298917514145]], [[0.40180649524587109, -0.13468267908829512, -0.66576279256576543, -0.97664336021962694], [-0.81183732113700424, -0.10477655696019839, -0.90212494842448732, 0.50784279020015499], [0.29352929816605089, 0.10640245030222295, -0.16640870997460122, 0.91371366707232826]]]])+(1.-msk)*numarray.array([[[[0.6465819200939884, 0.21755363919340609, 0.73973535907059662, -0.36114669719855241], [0.16087051863228452, -0.96295075570141986, 0.93283344105282717, 0.8498346294196879], [-0.62871563035312805, 0.028501977366871101, -0.76183996578150004, -0.42396762024023338]], [[0.45139869884828876, 0.9085099092003921, 0.90516675545818392, -0.2797423591331305], [-0.012176715080714828, 0.40935600076669765, -0.010156279663344314, -0.45527372677880185], [-0.56697253731600106, -0.88076957837377901, -0.43708368779823448, -0.98115855535334329]]], [[[-0.6812131434679467, -0.75007359636996074, 0.52195871968240559, 0.74207747673309732], [0.53576769134014213, -0.19432873205999046, -0.87970756195132904, -0.36970944422105911], [0.18377651984390431, -0.30093639418244189, 0.30640551056952825, -0.95779743159891284]], [[0.3069655071293016, 0.42532244942656305, 0.27182877898608804, 0.89926151593228765], [-0.94227360921249192, 0.17309985459832045, -0.067341615594060267, -0.24017528169767255], [0.72377020653147883, -0.60287365881872312, 0.17612550848074338, -0.89499327987049915]]], [[[-0.8985020338092089, -0.27805317471704494, -0.096352572725887375, 0.26107376060313836], [-0.98264038134460852, -0.40101944215897967, 0.80787105663414827, -0.91046803072373206], [-0.11056024039811629, -0.35146855329949345, 0.62639019941990948, 0.029258586953160748]], [[0.5190564210634494, 0.25178673168519605, -0.095466912631134937, -0.66223610619416462], [0.86572944270431917, -0.0070686656495086986, -0.56404011740509774, 0.5156978630437381], [0.15106963134402651, 0.12900511640038159, 0.6022471822104567, 0.48643914768022012]]]])
386    
387          # arg=Data(numarray.array([[[[0.4996033665120716, -0.074132654028136846, 0.2908837888281397, 0.79804117547820219], [0.25334186456470942, -0.10892196087517791, 0.90411872189757747, -0.21372334914190327], [0.65549677694560438, 0.97979738684954532, -0.29737844854710138, 0.93659843329597914]], [[0.22668444631484608, -0.92481913749465305, -0.9980815386745403, -0.022502768980955601], [-0.21769755240946398, 0.77216348666766876, -0.19843685166706204, 0.54270333879579558], [-0.11274856721131221, -0.29600869223659299, 0.1458222910080329, -0.83739782177046851]]], [[[0.86722932032155531, 0.39888432468517876, -0.8991679849590255, -0.088621935923834272], [-0.58464076321585412, -0.09564380294323116, 0.18232602464536307, 0.7910046931530843], [0.15923450234841652, -0.39331159996226872, 0.18298541750645669, 0.99889484861795563]], [[0.36793558813747418, -0.64593764280975363, 0.048503028175158613, -0.8304805399530264], [0.072019074767407432, -0.066883567381289311, -0.55849542620276127, -0.32521841292447484], [0.83256632210175896, -0.52124955617445723, -0.0047287521832242163, 0.84184001532121422]]], [[[-0.81375499823702158, 0.12901434959756353, -0.51500727423485215, 0.52626362435118912], [-0.47602620905811044, 0.81525173294213982, 0.023145745277130203, 0.5818744103097242], [-0.26074066195347489, 0.62737248392572886, 0.24246935026650718, 0.86155298917514145]], [[0.40180649524587109, -0.13468267908829512, -0.66576279256576543, -0.97664336021962694], [-0.81183732113700424, -0.10477655696019839, -0.90212494842448732, 0.50784279020015499], [0.29352929816605089, 0.10640245030222295, -0.16640870997460122, 0.91371366707232826]]]]),self.functionspace,True)
388          # arg.setTaggedValue(1,[[[[0.6465819200939884, 0.21755363919340609, 0.73973535907059662, -0.36114669719855241], [0.16087051863228452, -0.96295075570141986, 0.93283344105282717, 0.8498346294196879], [-0.62871563035312805, 0.028501977366871101, -0.76183996578150004, -0.42396762024023338]], [[0.45139869884828876, 0.9085099092003921, 0.90516675545818392, -0.2797423591331305], [-0.012176715080714828, 0.40935600076669765, -0.010156279663344314, -0.45527372677880185], [-0.56697253731600106, -0.88076957837377901, -0.43708368779823448, -0.98115855535334329]]], [[[-0.6812131434679467, -0.75007359636996074, 0.52195871968240559, 0.74207747673309732], [0.53576769134014213, -0.19432873205999046, -0.87970756195132904, -0.36970944422105911], [0.18377651984390431, -0.30093639418244189, 0.30640551056952825, -0.95779743159891284]], [[0.3069655071293016, 0.42532244942656305, 0.27182877898608804, 0.89926151593228765], [-0.94227360921249192, 0.17309985459832045, -0.067341615594060267, -0.24017528169767255], [0.72377020653147883, -0.60287365881872312, 0.17612550848074338, -0.89499327987049915]]], [[[-0.8985020338092089, -0.27805317471704494, -0.096352572725887375, 0.26107376060313836], [-0.98264038134460852, -0.40101944215897967, 0.80787105663414827, -0.91046803072373206], [-0.11056024039811629, -0.35146855329949345, 0.62639019941990948, 0.029258586953160748]], [[0.5190564210634494, 0.25178673168519605, -0.095466912631134937, -0.66223610619416462], [0.86572944270431917, -0.0070686656495086986, -0.56404011740509774, 0.5156978630437381], [0.15106963134402651, 0.12900511640038159, 0.6022471822104567, 0.48643914768022012]]]])
389        res=Lsup(arg)        res=Lsup(arg)
390        ref=0.998894848618        ref=0.998894848618
391        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
392        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
393     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
394     def test_sup_float_rank0(self):     def test_sup_float_rank0(self):
395        arg=0.870743835413        arg=0.870743835413
396        ref=0.870743835413        ref=0.870743835413
397        res=sup(arg)        res=sup(arg)
398        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
399        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
400     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
401     def test_sup_array_rank0(self):     def test_sup_array_rank0(self):
402        arg=0.469212543992        arg=0.469212543992
403        ref=0.469212543992        ref=0.469212543992
404        res=sup(arg)        res=sup(arg)
405        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
406        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
407     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
408     def test_sup_array_rank1(self):     def test_sup_array_rank1(self):
409        arg=numarray.array([0.8163530200305178, 0.7844191729334391])        arg=numarray.array([0.8163530200305178, 0.7844191729334391])
410        ref=0.816353020031        ref=0.816353020031
411        res=sup(arg)        res=sup(arg)
412        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
413        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
414     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
415     def test_sup_array_rank2(self):     def test_sup_array_rank2(self):
416        arg=numarray.array([[-0.52338785100595131, 0.72523140545134046, -0.23883623210726745, 0.29329903553233394, 0.77300897701720128], [0.56646202903477705, -0.67833617682539948, 0.71280801753916911, 0.108973189514324, -0.86675353843929437], [0.37080584846118247, 0.61817009100957776, -0.20780655998890807, 0.085315295987765438, -0.73527023026482174], [-0.97586476277122935, 0.14501540684207481, 0.57375473938632338, 0.08516777342367865, -0.22644451314946301]])        arg=numarray.array([[-0.52338785100595131, 0.72523140545134046, -0.23883623210726745, 0.29329903553233394, 0.77300897701720128], [0.56646202903477705, -0.67833617682539948, 0.71280801753916911, 0.108973189514324, -0.86675353843929437], [0.37080584846118247, 0.61817009100957776, -0.20780655998890807, 0.085315295987765438, -0.73527023026482174], [-0.97586476277122935, 0.14501540684207481, 0.57375473938632338, 0.08516777342367865, -0.22644451314946301]])
417        ref=0.773008977017        ref=0.773008977017
418        res=sup(arg)        res=sup(arg)
419        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
420        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
421     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
422     def test_sup_array_rank3(self):     def test_sup_array_rank3(self):
423        arg=numarray.array([[[0.16933183602716984, -0.42964457496769226], [-0.63714228263554573, -0.28513481547494179]], [[0.72479530443714335, -0.097501515360919111], [-0.28611653510816737, -0.58370472731498535]], [[-0.18432738416022554, 0.79010596522300558], [-0.65367387441910196, 0.90861652898349976]], [[0.56004415223670123, 0.20178156913861489], [0.90730594499457595, 0.91196305151516754]], [[-0.46179421349599847, -0.54555869532019163], [0.36014998847058499, -0.70585188726413306]], [[0.49988705904335418, -0.52181171665742077], [0.14475259007357621, -0.94336078709637383]]])        arg=numarray.array([[[0.16933183602716984, -0.42964457496769226], [-0.63714228263554573, -0.28513481547494179]], [[0.72479530443714335, -0.097501515360919111], [-0.28611653510816737, -0.58370472731498535]], [[-0.18432738416022554, 0.79010596522300558], [-0.65367387441910196, 0.90861652898349976]], [[0.56004415223670123, 0.20178156913861489], [0.90730594499457595, 0.91196305151516754]], [[-0.46179421349599847, -0.54555869532019163], [0.36014998847058499, -0.70585188726413306]], [[0.49988705904335418, -0.52181171665742077], [0.14475259007357621, -0.94336078709637383]]])
424        ref=0.911963051515        ref=0.911963051515
425        res=sup(arg)        res=sup(arg)
426        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
427        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
428     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
429     def test_sup_array_rank4(self):     def test_sup_array_rank4(self):
430        arg=numarray.array([[[[0.085213773984220698, -0.9837351364458633, -0.23428780807935823, -0.54350985593703971], [-0.021654619752513593, -0.58267295960777465, -0.95135334805945893, -0.82172163939108089], [0.92970460708060565, 0.12721615089598348, 0.36243089042630872, 0.50434042290503855]], [[0.20617957875725845, 0.13657289785878368, 0.7942986246389756, -0.92641374730818571], [0.30431241116181762, -0.13563881945622858, 0.37921852742514695, -0.39275408991812211], [-0.016546769015328033, 0.50932041928102878, -0.27343457607173893, -0.0076289641375255624]]], [[[0.97189015970083137, -0.71286035174080009, 0.10143028964095313, -0.41856292303563181], [-0.97563458262665792, 0.79724078659701769, -0.70932749973904685, 0.018497784992804522], [-0.86374122662275021, 0.047715471334789816, -0.95453593058418518, 0.54562170290354794]], [[0.40249406070198157, -0.54609432046574469, -0.22682900899629166, 0.98394939138178539], [0.11049172557176901, 0.42172241721325388, 0.71050000578192951, 0.35353993854713206], [0.35412886303451896, -0.98169699399727617, 0.04758881049644037, 0.96971205948237493]]], [[[0.44672925866052249, -0.51476498049696828, 0.56442823935318875, -0.39769248164928039], [-0.40340965812893304, -0.87947712857546945, 0.55927022788356706, -0.89941016574892707], [-0.43878304559423431, 0.20915357555548764, -0.76548553334601799, -0.67202522557876954]], [[-0.56749721271516318, -0.10244683680777245, 0.17727779142251943, -0.57219284260940473], [-0.17044718853145446, 0.91117482665936023, -0.30039592703806584, -0.73813808369358713], [0.63771084365736663, -0.61427668096170129, 0.34365587989446378, -0.11877233448104674]]]])        arg=numarray.array([[[[0.085213773984220698, -0.9837351364458633, -0.23428780807935823, -0.54350985593703971], [-0.021654619752513593, -0.58267295960777465, -0.95135334805945893, -0.82172163939108089], [0.92970460708060565, 0.12721615089598348, 0.36243089042630872, 0.50434042290503855]], [[0.20617957875725845, 0.13657289785878368, 0.7942986246389756, -0.92641374730818571], [0.30431241116181762, -0.13563881945622858, 0.37921852742514695, -0.39275408991812211], [-0.016546769015328033, 0.50932041928102878, -0.27343457607173893, -0.0076289641375255624]]], [[[0.97189015970083137, -0.71286035174080009, 0.10143028964095313, -0.41856292303563181], [-0.97563458262665792, 0.79724078659701769, -0.70932749973904685, 0.018497784992804522], [-0.86374122662275021, 0.047715471334789816, -0.95453593058418518, 0.54562170290354794]], [[0.40249406070198157, -0.54609432046574469, -0.22682900899629166, 0.98394939138178539], [0.11049172557176901, 0.42172241721325388, 0.71050000578192951, 0.35353993854713206], [0.35412886303451896, -0.98169699399727617, 0.04758881049644037, 0.96971205948237493]]], [[[0.44672925866052249, -0.51476498049696828, 0.56442823935318875, -0.39769248164928039], [-0.40340965812893304, -0.87947712857546945, 0.55927022788356706, -0.89941016574892707], [-0.43878304559423431, 0.20915357555548764, -0.76548553334601799, -0.67202522557876954]], [[-0.56749721271516318, -0.10244683680777245, 0.17727779142251943, -0.57219284260940473], [-0.17044718853145446, 0.91117482665936023, -0.30039592703806584, -0.73813808369358713], [0.63771084365736663, -0.61427668096170129, 0.34365587989446378, -0.11877233448104674]]]])
431        ref=0.983949391382        ref=0.983949391382
432        res=sup(arg)        res=sup(arg)
433        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
434        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
435     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
436     def test_sup_constData_rank0(self):     def test_sup_constData_rank0(self):
437        arg=Data(0.165371505685,self.functionspace)        arg=Data(0.165371505685,self.functionspace)
438        ref=0.165371505685        ref=0.165371505685
439        res=sup(arg)        res=sup(arg)
440        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
441        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
442     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
443     def test_sup_constData_rank1(self):     def test_sup_constData_rank1(self):
444        arg=Data(numarray.array([-0.89603386749185288, -0.68712608295212729]),self.functionspace)        arg=Data(numarray.array([-0.89603386749185288, -0.68712608295212729]),self.functionspace)
445        ref=-0.687126082952        ref=-0.687126082952
446        res=sup(arg)        res=sup(arg)
447        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
448        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
449     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
450     def test_sup_constData_rank2(self):     def test_sup_constData_rank2(self):
451        arg=Data(numarray.array([[0.60272743728014655, 0.26067131689446787, -0.48488892003697837, -0.54328378217335027, -0.96627165443113894], [0.38861396631681999, -0.14210447298121753, -0.84480805358330624, -0.25397651427390566, 0.25670041011662192], [-0.062982523786134337, -0.149708363807598, -0.63332360725934489, -0.49175302564011525, -0.97647588301352473], [0.52022334705669038, -0.69717039787412727, -0.28284586409251511, 0.99642563937215467, -0.67058148736338885]]),self.functionspace)        arg=Data(numarray.array([[0.60272743728014655, 0.26067131689446787, -0.48488892003697837, -0.54328378217335027, -0.96627165443113894], [0.38861396631681999, -0.14210447298121753, -0.84480805358330624, -0.25397651427390566, 0.25670041011662192], [-0.062982523786134337, -0.149708363807598, -0.63332360725934489, -0.49175302564011525, -0.97647588301352473], [0.52022334705669038, -0.69717039787412727, -0.28284586409251511, 0.99642563937215467, -0.67058148736338885]]),self.functionspace)
452        ref=0.996425639372        ref=0.996425639372
453        res=sup(arg)        res=sup(arg)
454        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
455        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
456     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
457     def test_sup_constData_rank3(self):     def test_sup_constData_rank3(self):
458        arg=Data(numarray.array([[[-0.98552936119306023, -0.58995212270861552], [0.51743177430155907, 0.68576837981065508]], [[-0.61618414432919089, -0.12325580790677049], [0.32387395300714172, -0.95456083598524333]], [[0.89779642579517049, 0.98676270760314266], [0.71959629907181966, -0.9949078223284622]], [[-0.81547040114414271, 0.10033634427970006], [-0.21591232734408217, -0.68608679705274822]], [[0.30423138886571999, 0.34122142527426802], [-0.4344532377066066, -0.31076903154305779]], [[-0.46111628105416602, -0.18371998359850483], [0.63606993796228117, -0.10703087143670587]]]),self.functionspace)        arg=Data(numarray.array([[[-0.98552936119306023, -0.58995212270861552], [0.51743177430155907, 0.68576837981065508]], [[-0.61618414432919089, -0.12325580790677049], [0.32387395300714172, -0.95456083598524333]], [[0.89779642579517049, 0.98676270760314266], [0.71959629907181966, -0.9949078223284622]], [[-0.81547040114414271, 0.10033634427970006], [-0.21591232734408217, -0.68608679705274822]], [[0.30423138886571999, 0.34122142527426802], [-0.4344532377066066, -0.31076903154305779]], [[-0.46111628105416602, -0.18371998359850483], [0.63606993796228117, -0.10703087143670587]]]),self.functionspace)
459        ref=0.986762707603        ref=0.986762707603
460        res=sup(arg)        res=sup(arg)
461        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
462        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
463     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
464     def test_sup_constData_rank4(self):     def test_sup_constData_rank4(self):
465        arg=Data(numarray.array([[[[0.89488524023952776, 0.8669396968091807, -0.45769331537553315, -0.89738195395075349], [0.39077366764066168, -0.71075932241646922, -0.51096889323130612, 0.87130290122807663], [0.17079807940685177, -0.6198922248677714, -0.41261700237404653, -0.30627765803812368]], [[-0.0659839868001868, -0.54367942190111385, 0.79254440140135607, -0.28895269724305006], [0.2554732744127961, -0.0076696085190677277, 0.6846601760873452, 0.38696598742090393], [-0.77125424651939789, 0.63909999575689591, -0.87840142433528379, 0.41711809974302594]]], [[[-0.99322035791310692, 0.27097830567855352, -0.4253855401144222, 0.15768186455727529], [-0.49181115516922302, -0.36126829134959304, 0.52357599944776667, 0.91209852597809005], [0.069076441159411361, -0.18292686281510551, -0.6497679800515983, 0.022610374934600719]], [[0.28755759348156507, -0.08281906224050295, 0.76036900801429907, 0.54802231074240826], [-0.033682724326368874, -0.7414032372095134, -0.86699767465780231, 0.40592904057808044], [0.51593363738292841, -0.72087130860034332, 0.35672334112134374, -0.090721746979026463]]], [[[-0.54866684145444511, -0.96738751715836968, -0.21201752332220436, -0.099425492405464277], [-0.76528700517307313, -0.85955622688708644, -0.10492266626403257, 0.69311319310724762], [-0.33886276086664902, -0.6846128323156393, 0.05873264876508566, 0.88498228323799433]], [[-0.28404277561384639, -0.63570388064518468, -0.67775264818658387, 0.20825454125346576], [-0.84788984114351473, 0.037932422136330635, 0.021981819447397299, -0.2709264612684219], [-0.64072476278735468, 0.46126191894728197, -0.37456096950035489, 0.85599593427453957]]]]),self.functionspace)        arg=Data(numarray.array([[[[0.89488524023952776, 0.8669396968091807, -0.45769331537553315, -0.89738195395075349], [0.39077366764066168, -0.71075932241646922, -0.51096889323130612, 0.87130290122807663], [0.17079807940685177, -0.6198922248677714, -0.41261700237404653, -0.30627765803812368]], [[-0.0659839868001868, -0.54367942190111385, 0.79254440140135607, -0.28895269724305006], [0.2554732744127961, -0.0076696085190677277, 0.6846601760873452, 0.38696598742090393], [-0.77125424651939789, 0.63909999575689591, -0.87840142433528379, 0.41711809974302594]]], [[[-0.99322035791310692, 0.27097830567855352, -0.4253855401144222, 0.15768186455727529], [-0.49181115516922302, -0.36126829134959304, 0.52357599944776667, 0.91209852597809005], [0.069076441159411361, -0.18292686281510551, -0.6497679800515983, 0.022610374934600719]], [[0.28755759348156507, -0.08281906224050295, 0.76036900801429907, 0.54802231074240826], [-0.033682724326368874, -0.7414032372095134, -0.86699767465780231, 0.40592904057808044], [0.51593363738292841, -0.72087130860034332, 0.35672334112134374, -0.090721746979026463]]], [[[-0.54866684145444511, -0.96738751715836968, -0.21201752332220436, -0.099425492405464277], [-0.76528700517307313, -0.85955622688708644, -0.10492266626403257, 0.69311319310724762], [-0.33886276086664902, -0.6846128323156393, 0.05873264876508566, 0.88498228323799433]], [[-0.28404277561384639, -0.63570388064518468, -0.67775264818658387, 0.20825454125346576], [-0.84788984114351473, 0.037932422136330635, 0.021981819447397299, -0.2709264612684219], [-0.64072476278735468, 0.46126191894728197, -0.37456096950035489, 0.85599593427453957]]]]),self.functionspace)
466        ref=0.912098525978        ref=0.912098525978
467        res=sup(arg)        res=sup(arg)
468        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
469        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_sup_taggedData_rank0(self):  
       arg=Data(0.649634736435,self.functionspace)  
       arg.setTaggedValue(1,0.649634736435)  
       res=sup(arg)  
       ref=0.649634736435  
       self.failUnless(isinstance(res,float),"wrong type of result.")  
       self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_sup_taggedData_rank1(self):  
       arg=Data(numarray.array([-0.91775874675364899, -0.44518660348335226]),self.functionspace)  
       arg.setTaggedValue(1,[-0.91030878048996744, -0.36380755471992954])  
       res=sup(arg)  
       ref=-0.36380755472  
       self.failUnless(isinstance(res,float),"wrong type of result.")  
       self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_sup_taggedData_rank2(self):  
       arg=Data(numarray.array([[-0.086523811957357255, -0.42774060865319008, 0.35170422393945833, -0.24772487756509576, 0.85056214851195744], [-0.31877386278938702, 0.28773006836605641, 0.44932528141129979, -0.56724416115855569, 0.80633095352264816], [-0.53652434245562564, -0.26697043576159984, -0.88767305488188519, -0.029691195696610828, 0.67899103041623876], [0.92484508322389836, 0.18625473102022339, -0.27285903116359256, 0.63921542460538938, -0.9221199231145456]]),self.functionspace)  
       arg.setTaggedValue(1,[[0.65738567253805136, -0.6778218395330815, 0.40806699669092361, 0.34540048412849589, -0.11704616494950493], [0.38512651510421825, 0.74221788961938562, 0.95314896284964967, -0.040871082359481337, 0.73045537711619035], [0.10490367249326416, -0.24457205097868751, 0.23569203929084925, -0.4833470179537227, 0.13727107062761412], [-0.34956075762939753, -0.40510846111177878, -0.60113099618774268, -0.8694743269747125, 0.8300938895447072]])  
       res=sup(arg)  
       ref=0.95314896285  
       self.failUnless(isinstance(res,float),"wrong type of result.")  
       self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_sup_taggedData_rank3(self):  
       arg=Data(numarray.array([[[0.50181406381755478, 0.12696291412348604], [0.45580252908683372, -0.69381529096260919]], [[-0.44711719663105876, -0.49939480373343814], [0.49163505815095565, 0.70755602744123269]], [[-0.32952519817455106, -0.56163922933132882], [0.020194551395573912, 0.74013090992747421]], [[-0.13639620097611793, -0.5402749306510144], [-0.71348777995694368, -0.07149424731352183]], [[-0.81298057712035066, -0.12510197890662789], [-0.30874509775629533, -0.58120893128076712]], [[0.86654409796596377, -0.50673775089683915], [-0.12239574780538409, 0.81691821472857717]]]),self.functionspace)  
       arg.setTaggedValue(1,[[[-0.57151921079320256, 0.95258628100636189], [-0.77681734612402287, 0.95978727375688866]], [[0.76493561669286803, 0.51125225923442486], [-0.24392383855124655, 0.014944647833669666]], [[-0.93836576145690231, -0.044479851632975853], [-0.30511938835638897, 0.0091738439461943599]], [[0.71921984284603702, -0.22105010374862499], [-0.78589399511594116, -0.8895142672649694]], [[0.6735135460868733, -0.56646772685337399], [0.73605625715117484, -0.68735959525940049]], [[0.38440898374441201, 0.87186026279634277], [-0.59320035048324327, -0.87430848491656854]]])  
       res=sup(arg)  
       ref=0.959787273757  
       self.failUnless(isinstance(res,float),"wrong type of result.")  
       self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_sup_taggedData_rank4(self):  
       arg=Data(numarray.array([[[[0.65078702842768221, -0.73900875462993776, -0.65984653996722176, -0.97539191158251093], [0.99720731720088596, -0.19242629799409516, -0.16320360691406655, -0.043083875914333492], [0.59108757025274139, 0.88522336612612706, 0.74088460755604268, 0.80676177752104627]], [[0.82498945289642323, 0.23110039892583623, -0.13089698664065774, -0.400241064232296], [-0.67523171276117, -0.72699269118844501, 0.53208807038398409, -0.49611668096456474], [-0.20482996861953673, 0.83614314521551858, -0.82232394050773272, -0.71904026227092044]]], [[[0.34003140388599551, 0.31905118515154363, 0.51883291903272832, -0.76898011700894209], [-0.00054352334236540401, -0.42459032663080087, 0.72331023817772211, -0.50647033418441123], [0.76195696335445318, -0.22666337528546276, -0.40740135145605061, -0.81651333897992373]], [[-0.9819499586934739, -0.95616911480063527, -0.2900474363658565, -0.16636609538100222], [0.66435123810546681, -0.30523563374854135, -0.21355210817886849, -0.74243246288718034], [0.82105586828161425, -0.93524621329362057, 0.36308161224720026, 0.76840492117538539]]], [[[-0.22872302699935965, 0.047300841535470761, -0.93216772922157576, -0.40541971639813301], [0.22921538079079262, 0.1958937804621288, 0.27198494374967619, 0.55888236453433282], [0.97179646000620856, 0.53691052552944973, -0.13695340427959324, -0.10499588580374764]], [[-0.4821448283439782, -0.96593591454069139, -0.95284453814535297, -0.35311046977499583], [0.4857495870271038, -0.66584818036412852, -0.04957796396188785, 0.28223147859593767], [-0.2171789936962405, -0.016212404435609562, 0.16258357268143042, -0.6781166044152207]]]]),self.functionspace)  
       arg.setTaggedValue(1,[[[[0.80768589260978896, -0.22702941364663487, -0.72896606223385407, 0.11413326357409237], [0.40571664072592251, -0.9311405487001907, 0.80450361552618688, 0.56480640933432991], [-0.33782609968052979, 0.39512515837757123, 0.73591694462004398, 0.24768959674737778]], [[0.56569618270183164, -0.93779341659685, 0.64969642196738708, -0.77336556098096976], [0.41311175212178153, 0.056953746906872826, 0.25300968955971204, -0.35019321925911262], [-0.8863122403302417, -0.89705763853428677, 0.3060047535556778, -0.92592167036041095]]], [[[0.45649019646929379, -0.29843125838513096, -0.20714508244855367, 0.246705639144563], [-0.32477747411703084, 0.30488751585973306, 0.53390827733820756, -0.84339943975046583], [-0.12373671376305295, -0.1640054521913612, -0.87414144472044897, -0.0021211693404443732]], [[0.38273461960506805, 0.70999974995969617, 0.22361687978370237, -0.098549468178965371], [0.81724211804899904, -0.88965787513620009, -0.39375673885748119, 0.69490920308416371], [-0.65400552410197754, -0.82376412930222931, 0.046545365304690778, -0.21012949605343434]]], [[[-0.27643919361415081, -0.44880727610691973, -0.57364607821939151, -0.14013355075911993], [-0.99302452440223621, 0.70400083788517742, 0.29183091261608896, 0.57457780218190213], [0.20084128112884403, 0.98904695078892235, 0.87503585272015294, -0.26131933340055569]], [[0.94633204265993198, -0.73295197510079446, 0.56975658926329098, -0.83390352955122538], [0.2617682886960544, 0.14649180808291562, -0.29972426982703726, -0.015848496464521356], [-0.96680270201151153, -0.79982829582732196, -0.29552300849179347, 0.66620264190912515]]]])  
       res=sup(arg)  
       ref=0.997207317201  
       self.failUnless(isinstance(res,float),"wrong type of result.")  
       self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")  
470     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
471     def test_sup_expandedData_rank0(self):     def test_sup_expandedData_rank0(self):
472        arg=Data(0.842459260157,self.functionspace,True)  
473        arg.setTaggedValue(1,0.842459260157)        msk=whereNegative(self.functionspace.getX()[0]-0.5)
474          arg=msk*0.842459260157+(1.-msk)*0.985691469761
475    
476          # arg=Data(0.842459260157,self.functionspace,True)
477          # arg.setTaggedValue(1,0.842459260157)
478        res=sup(arg)        res=sup(arg)
479        ref=0.985691469761        ref=0.985691469761
480        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
481        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
482     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
483     def test_sup_expandedData_rank1(self):     def test_sup_expandedData_rank1(self):
484        arg=Data(numarray.array([0.47024430020620023, -0.40410868427962021]),self.functionspace,True)  
485        arg.setTaggedValue(1,[0.34568516056640197, -0.43342673126146103])        msk=whereNegative(self.functionspace.getX()[0]-0.5)
486          arg=msk*numarray.array([0.47024430020620023, -0.40410868427962021])+(1.-msk)*numarray.array([0.34568516056640197, -0.43342673126146103])
487    
488          # arg=Data(numarray.array([0.47024430020620023, -0.40410868427962021]),self.functionspace,True)
489          # arg.setTaggedValue(1,[0.34568516056640197, -0.43342673126146103])
490        res=sup(arg)        res=sup(arg)
491        ref=0.470244300206        ref=0.470244300206
492        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
493        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
494     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
495     def test_sup_expandedData_rank2(self):     def test_sup_expandedData_rank2(self):
496        arg=Data(numarray.array([[-0.88351146515427814, 0.87526615684362929, 0.80242059303502922, -0.6048006248682789, 0.42108402102305953], [0.11385226207304888, -0.66232044805160473, 0.69874162972474063, 0.22449470583280284, -0.19986159203927545], [0.17102700533232951, -0.9790459454968905, 0.4374092200111821, -0.4343902463997138, 0.72993175063985705], [-0.42636794385375065, -0.88420160799308434, -0.073357336228458081, -0.96071213693656698, -0.28591564459422769]]),self.functionspace,True)  
497        arg.setTaggedValue(1,[[-0.66507554751323883, 0.90956185314332916, 0.39373039994051529, 0.20185922272970869, 0.56272045770025914], [-0.81603670050480082, -0.98308666677421708, 0.081972418155825233, 0.98933334281872432, -0.67280110519862579], [-0.67384516784043069, 0.19168471924963759, -0.59938113619504896, 0.22266455997006829, -0.93324865777959265], [0.93134589933544842, -0.10311385886401503, -0.2331509870020978, 0.37315747180467018, 0.73551730577813057]])        msk=whereNegative(self.functionspace.getX()[0]-0.5)
498          arg=msk*numarray.array([[-0.88351146515427814, 0.87526615684362929, 0.80242059303502922, -0.6048006248682789, 0.42108402102305953], [0.11385226207304888, -0.66232044805160473, 0.69874162972474063, 0.22449470583280284, -0.19986159203927545], [0.17102700533232951, -0.9790459454968905, 0.4374092200111821, -0.4343902463997138, 0.72993175063985705], [-0.42636794385375065, -0.88420160799308434, -0.073357336228458081, -0.96071213693656698, -0.28591564459422769]])+(1.-msk)*numarray.array([[-0.66507554751323883, 0.90956185314332916, 0.39373039994051529, 0.20185922272970869, 0.56272045770025914], [-0.81603670050480082, -0.98308666677421708, 0.081972418155825233, 0.98933334281872432, -0.67280110519862579], [-0.67384516784043069, 0.19168471924963759, -0.59938113619504896, 0.22266455997006829, -0.93324865777959265], [0.93134589933544842, -0.10311385886401503, -0.2331509870020978, 0.37315747180467018, 0.73551730577813057]])
499    
500          # arg=Data(numarray.array([[-0.88351146515427814, 0.87526615684362929, 0.80242059303502922, -0.6048006248682789, 0.42108402102305953], [0.11385226207304888, -0.66232044805160473, 0.69874162972474063, 0.22449470583280284, -0.19986159203927545], [0.17102700533232951, -0.9790459454968905, 0.4374092200111821, -0.4343902463997138, 0.72993175063985705], [-0.42636794385375065, -0.88420160799308434, -0.073357336228458081, -0.96071213693656698, -0.28591564459422769]]),self.functionspace,True)
501          # arg.setTaggedValue(1,[[-0.66507554751323883, 0.90956185314332916, 0.39373039994051529, 0.20185922272970869, 0.56272045770025914], [-0.81603670050480082, -0.98308666677421708, 0.081972418155825233, 0.98933334281872432, -0.67280110519862579], [-0.67384516784043069, 0.19168471924963759, -0.59938113619504896, 0.22266455997006829, -0.93324865777959265], [0.93134589933544842, -0.10311385886401503, -0.2331509870020978, 0.37315747180467018, 0.73551730577813057]])
502        res=sup(arg)        res=sup(arg)
503        ref=0.989333342819        ref=0.989333342819
504        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
505        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
506     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
507     def test_sup_expandedData_rank3(self):     def test_sup_expandedData_rank3(self):
508        arg=Data(numarray.array([[[-0.69867440642271283, -0.37489565319806606], [-0.66485463581725601, 0.18238313710104448]], [[-0.78388494323459157, 0.24027472943325923], [-0.4377158808146262, -0.34262284842949864]], [[-0.8539094490313166, 0.62109328106735684], [-0.20715549218162899, -0.33320905765908693]], [[-0.25702886172082651, 0.94651536183641283], [-0.2229696935051404, 0.84771132395539794]], [[0.52244706935442076, -0.89344888833386804], [0.064322796922618108, 0.36966382541443532]], [[0.55710175300577691, -0.22780561634551688], [0.89548548132750594, -0.77561238906399077]]]),self.functionspace,True)  
509        arg.setTaggedValue(1,[[[-0.86933240372621312, 0.32078825553642276], [0.36873095289245739, 0.20578150283627239]], [[-0.13143164944725427, 0.89920065296927199], [0.79295913398164197, 0.78838875458878954]], [[0.068510791358111334, 0.87754319283313054], [-0.96880448620091553, -0.012058603734139028]], [[0.44680342907934811, -0.52293412412648466], [0.51117158355443149, -0.6794979840301234]], [[0.55644022070667498, 0.082838767459920026], [-0.64861425420762142, -0.20781169747814943]], [[0.52302454039265078, -0.71078210239352546], [0.67348959224612859, 0.18668184392186915]]])        msk=whereNegative(self.functionspace.getX()[0]-0.5)
510          arg=msk*numarray.array([[[-0.69867440642271283, -0.37489565319806606], [-0.66485463581725601, 0.18238313710104448]], [[-0.78388494323459157, 0.24027472943325923], [-0.4377158808146262, -0.34262284842949864]], [[-0.8539094490313166, 0.62109328106735684], [-0.20715549218162899, -0.33320905765908693]], [[-0.25702886172082651, 0.94651536183641283], [-0.2229696935051404, 0.84771132395539794]], [[0.52244706935442076, -0.89344888833386804], [0.064322796922618108, 0.36966382541443532]], [[0.55710175300577691, -0.22780561634551688], [0.89548548132750594, -0.77561238906399077]]])+(1.-msk)*numarray.array([[[-0.86933240372621312, 0.32078825553642276], [0.36873095289245739, 0.20578150283627239]], [[-0.13143164944725427, 0.89920065296927199], [0.79295913398164197, 0.78838875458878954]], [[0.068510791358111334, 0.87754319283313054], [-0.96880448620091553, -0.012058603734139028]], [[0.44680342907934811, -0.52293412412648466], [0.51117158355443149, -0.6794979840301234]], [[0.55644022070667498, 0.082838767459920026], [-0.64861425420762142, -0.20781169747814943]], [[0.52302454039265078, -0.71078210239352546], [0.67348959224612859, 0.18668184392186915]]])
511    
512          # arg=Data(numarray.array([[[-0.69867440642271283, -0.37489565319806606], [-0.66485463581725601, 0.18238313710104448]], [[-0.78388494323459157, 0.24027472943325923], [-0.4377158808146262, -0.34262284842949864]], [[-0.8539094490313166, 0.62109328106735684], [-0.20715549218162899, -0.33320905765908693]], [[-0.25702886172082651, 0.94651536183641283], [-0.2229696935051404, 0.84771132395539794]], [[0.52244706935442076, -0.89344888833386804], [0.064322796922618108, 0.36966382541443532]], [[0.55710175300577691, -0.22780561634551688], [0.89548548132750594, -0.77561238906399077]]]),self.functionspace,True)
513          # arg.setTaggedValue(1,[[[-0.86933240372621312, 0.32078825553642276], [0.36873095289245739, 0.20578150283627239]], [[-0.13143164944725427, 0.89920065296927199], [0.79295913398164197, 0.78838875458878954]], [[0.068510791358111334, 0.87754319283313054], [-0.96880448620091553, -0.012058603734139028]], [[0.44680342907934811, -0.52293412412648466], [0.51117158355443149, -0.6794979840301234]], [[0.55644022070667498, 0.082838767459920026], [-0.64861425420762142, -0.20781169747814943]], [[0.52302454039265078, -0.71078210239352546], [0.67348959224612859, 0.18668184392186915]]])
514        res=sup(arg)        res=sup(arg)
515        ref=0.946515361836        ref=0.946515361836
516        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
517        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
518     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
519     def test_sup_expandedData_rank4(self):     def test_sup_expandedData_rank4(self):
520        arg=Data(numarray.array([[[[-0.97992610933200397, -0.25896245628971326, -0.70483438344031946, -0.99381143197943023], [-0.94915117581748709, -0.41900816047650036, -0.73354223723879386, 0.75059333884969881], [-0.76848095939834238, -0.75674819943701244, 0.065477641668864495, -0.42345850130975426]], [[-0.86758200423510234, -0.91179084363212071, -0.95127824910458103, 0.44686792515820439], [0.24843166983163689, -0.78829756520109728, -0.29421842880871774, 0.081312723661290498], [-0.73676127398786795, 0.91442315487631975, -0.64075473615377643, -0.68228346762450576]]], [[[-0.52913624371899504, 0.18611492696208209, 0.87647965087074042, 0.81733477764270401], [-0.45994626037000352, -0.72068350777641998, -0.67722337882139305, 0.53688427407036721], [-0.62155086776441348, -0.16407031198819877, 0.27545162813408264, 0.82180316351563087]], [[0.86221555518143278, -0.038942303505028031, 0.99073092777336114, -0.59207542384567113], [-0.42324210154238218, 0.76649013040311842, 0.86242470461616949, 0.49956796372115009], [-0.3983839684487791, 0.50100130531149967, -0.61285700166494195, -0.77581662400471862]]], [[[0.393847951204221, -0.72453857578029801, 0.97194727576353768, -0.95039782864739597], [-0.33546269250215266, 0.4831646699512071, -0.36084136685304102, -0.21835205500655297], [-0.82932637046105562, 0.70351683765540218, -0.058619290451321637, -0.2054802590132303]], [[0.94447147902776929, -0.42312399627562503, -0.11683182283655591, -0.40970199303413191], [-0.057628087834810326, -0.92418858637343759, 0.17632737701884516, -0.45930384359491305], [-0.47612419752878798, -0.96256404924809247, 0.10415265869578216, -0.63202348546194909]]]]),self.functionspace,True)  
521        arg.setTaggedValue(1,[[[[-0.97434762405813102, 0.7014239623245393, 0.62448079624150288, -0.37769806924712546], [-0.85193729675303742, -0.77375392434251022, 0.36142120851055592, 0.26580596564769365], [-0.87276378893603579, 0.38973819311591718, 0.98354255063199636, -0.66795317131402343]], [[0.90231744676982428, -0.27585106370360957, -0.32108129691288001, 0.60440834831736634], [-0.045905880902579188, -0.29199624499256793, 0.025945636614535861, -0.098321374439206854], [-0.56344512008582659, -0.3766256629210043, -0.16641839175601203, -0.47355537095296341]]], [[[-0.98963277387073156, -0.84954014836916003, 0.58413699452656576, -0.90574771672091781], [-0.076165236495137068, -0.33185579541568311, 0.71508582816996036, 0.092982625872773284], [-0.59803076383019627, 0.96534061564337792, -0.86101074809006883, 0.4514321077629706]], [[0.68169942993010979, -0.46839019201575827, 0.86748862862295062, 0.077239140299438347], [-0.41039932807903745, 0.77351932859252215, -0.91858786520587499, -0.83803209999478323], [-0.66149540952220676, 0.21690925014134543, 0.49329666114093262, 0.22750525795569843]]], [[[0.49476796496001074, 0.54374663478072427, -0.64963120626875592, 0.57704965092442939], [0.74520801893525035, -0.18704889796101698, -0.73119506283113278, 0.30233417986347821], [-0.40842036405150561, -0.58450470869605797, 0.084020496164487923, -0.58538663622202569]], [[0.75611417989143481, -0.52196566347687212, 0.47144797786301607, -0.99505702762998172], [-0.0043333507755138889, -0.8740422871734248, 0.69683145050592943, -0.015830354510735223], [-0.047302931197539255, -0.033238606395723957, -0.95126827803180114, 0.88954001433619978]]]])        msk=whereNegative(self.functionspace.getX()[0]-0.5)
522          arg=msk*numarray.array([[[[-0.97992610933200397, -0.25896245628971326, -0.70483438344031946, -0.99381143197943023], [-0.94915117581748709, -0.41900816047650036, -0.73354223723879386, 0.75059333884969881], [-0.76848095939834238, -0.75674819943701244, 0.065477641668864495, -0.42345850130975426]], [[-0.86758200423510234, -0.91179084363212071, -0.95127824910458103, 0.44686792515820439], [0.24843166983163689, -0.78829756520109728, -0.29421842880871774, 0.081312723661290498], [-0.73676127398786795, 0.91442315487631975, -0.64075473615377643, -0.68228346762450576]]], [[[-0.52913624371899504, 0.18611492696208209, 0.87647965087074042, 0.81733477764270401], [-0.45994626037000352, -0.72068350777641998, -0.67722337882139305, 0.53688427407036721], [-0.62155086776441348, -0.16407031198819877, 0.27545162813408264, 0.82180316351563087]], [[0.86221555518143278, -0.038942303505028031, 0.99073092777336114, -0.59207542384567113], [-0.42324210154238218, 0.76649013040311842, 0.86242470461616949, 0.49956796372115009], [-0.3983839684487791, 0.50100130531149967, -0.61285700166494195, -0.77581662400471862]]], [[[0.393847951204221, -0.72453857578029801, 0.97194727576353768, -0.95039782864739597], [-0.33546269250215266, 0.4831646699512071, -0.36084136685304102, -0.21835205500655297], [-0.82932637046105562, 0.70351683765540218, -0.058619290451321637, -0.2054802590132303]], [[0.94447147902776929, -0.42312399627562503, -0.11683182283655591, -0.40970199303413191], [-0.057628087834810326, -0.92418858637343759, 0.17632737701884516, -0.45930384359491305], [-0.47612419752878798, -0.96256404924809247, 0.10415265869578216, -0.63202348546194909]]]])+(1.-msk)*numarray.array([[[[-0.97434762405813102, 0.7014239623245393, 0.62448079624150288, -0.37769806924712546], [-0.85193729675303742, -0.77375392434251022, 0.36142120851055592, 0.26580596564769365], [-0.87276378893603579, 0.38973819311591718, 0.98354255063199636, -0.66795317131402343]], [[0.90231744676982428, -0.27585106370360957, -0.32108129691288001, 0.60440834831736634], [-0.045905880902579188, -0.29199624499256793, 0.025945636614535861, -0.098321374439206854], [-0.56344512008582659, -0.3766256629210043, -0.16641839175601203, -0.47355537095296341]]], [[[-0.98963277387073156, -0.84954014836916003, 0.58413699452656576, -0.90574771672091781], [-0.076165236495137068, -0.33185579541568311, 0.71508582816996036, 0.092982625872773284], [-0.59803076383019627, 0.96534061564337792, -0.86101074809006883, 0.4514321077629706]], [[0.68169942993010979, -0.46839019201575827, 0.86748862862295062, 0.077239140299438347], [-0.41039932807903745, 0.77351932859252215, -0.91858786520587499, -0.83803209999478323], [-0.66149540952220676, 0.21690925014134543, 0.49329666114093262, 0.22750525795569843]]], [[[0.49476796496001074, 0.54374663478072427, -0.64963120626875592, 0.57704965092442939], [0.74520801893525035, -0.18704889796101698, -0.73119506283113278, 0.30233417986347821], [-0.40842036405150561, -0.58450470869605797, 0.084020496164487923, -0.58538663622202569]], [[0.75611417989143481, -0.52196566347687212, 0.47144797786301607, -0.99505702762998172], [-0.0043333507755138889, -0.8740422871734248, 0.69683145050592943, -0.015830354510735223], [-0.047302931197539255, -0.033238606395723957, -0.95126827803180114, 0.88954001433619978]]]])
523    
524          # arg=Data(numarray.array([[[[-0.97992610933200397, -0.25896245628971326, -0.70483438344031946, -0.99381143197943023], [-0.94915117581748709, -0.41900816047650036, -0.73354223723879386, 0.75059333884969881], [-0.76848095939834238, -0.75674819943701244, 0.065477641668864495, -0.42345850130975426]], [[-0.86758200423510234, -0.91179084363212071, -0.95127824910458103, 0.44686792515820439], [0.24843166983163689, -0.78829756520109728, -0.29421842880871774, 0.081312723661290498], [-0.73676127398786795, 0.91442315487631975, -0.64075473615377643, -0.68228346762450576]]], [[[-0.52913624371899504, 0.18611492696208209, 0.87647965087074042, 0.81733477764270401], [-0.45994626037000352, -0.72068350777641998, -0.67722337882139305, 0.53688427407036721], [-0.62155086776441348, -0.16407031198819877, 0.27545162813408264, 0.82180316351563087]], [[0.86221555518143278, -0.038942303505028031, 0.99073092777336114, -0.59207542384567113], [-0.42324210154238218, 0.76649013040311842, 0.86242470461616949, 0.49956796372115009], [-0.3983839684487791, 0.50100130531149967, -0.61285700166494195, -0.77581662400471862]]], [[[0.393847951204221, -0.72453857578029801, 0.97194727576353768, -0.95039782864739597], [-0.33546269250215266, 0.4831646699512071, -0.36084136685304102, -0.21835205500655297], [-0.82932637046105562, 0.70351683765540218, -0.058619290451321637, -0.2054802590132303]], [[0.94447147902776929, -0.42312399627562503, -0.11683182283655591, -0.40970199303413191], [-0.057628087834810326, -0.92418858637343759, 0.17632737701884516, -0.45930384359491305], [-0.47612419752878798, -0.96256404924809247, 0.10415265869578216, -0.63202348546194909]]]]),self.functionspace,True)
525          # arg.setTaggedValue(1,[[[[-0.97434762405813102, 0.7014239623245393, 0.62448079624150288, -0.37769806924712546], [-0.85193729675303742, -0.77375392434251022, 0.36142120851055592, 0.26580596564769365], [-0.87276378893603579, 0.38973819311591718, 0.98354255063199636, -0.66795317131402343]], [[0.90231744676982428, -0.27585106370360957, -0.32108129691288001, 0.60440834831736634], [-0.045905880902579188, -0.29199624499256793, 0.025945636614535861, -0.098321374439206854], [-0.56344512008582659, -0.3766256629210043, -0.16641839175601203, -0.47355537095296341]]], [[[-0.98963277387073156, -0.84954014836916003, 0.58413699452656576, -0.90574771672091781], [-0.076165236495137068, -0.33185579541568311, 0.71508582816996036, 0.092982625872773284], [-0.59803076383019627, 0.96534061564337792, -0.86101074809006883, 0.4514321077629706]], [[0.68169942993010979, -0.46839019201575827, 0.86748862862295062, 0.077239140299438347], [-0.41039932807903745, 0.77351932859252215, -0.91858786520587499, -0.83803209999478323], [-0.66149540952220676, 0.21690925014134543, 0.49329666114093262, 0.22750525795569843]]], [[[0.49476796496001074, 0.54374663478072427, -0.64963120626875592, 0.57704965092442939], [0.74520801893525035, -0.18704889796101698, -0.73119506283113278, 0.30233417986347821], [-0.40842036405150561, -0.58450470869605797, 0.084020496164487923, -0.58538663622202569]], [[0.75611417989143481, -0.52196566347687212, 0.47144797786301607, -0.99505702762998172], [-0.0043333507755138889, -0.8740422871734248, 0.69683145050592943, -0.015830354510735223], [-0.047302931197539255, -0.033238606395723957, -0.95126827803180114, 0.88954001433619978]]]])
526        res=sup(arg)        res=sup(arg)
527        ref=0.990730927773        ref=0.990730927773
528        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
529        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
530     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
531     def test_inf_float_rank0(self):     def test_inf_float_rank0(self):
532        arg=0.857535693433        arg=0.857535693433
533        ref=0.857535693433        ref=0.857535693433
534        res=inf(arg)        res=inf(arg)
535        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
536        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
537     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
538     def test_inf_array_rank0(self):     def test_inf_array_rank0(self):
539        arg=0.170725403135        arg=0.170725403135
540        ref=0.170725403135        ref=0.170725403135
541        res=inf(arg)        res=inf(arg)
542        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
543        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
544     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
545     def test_inf_array_rank1(self):     def test_inf_array_rank1(self):
546        arg=numarray.array([-0.20582799927627726, 0.0065475369467946631])        arg=numarray.array([-0.20582799927627726, 0.0065475369467946631])
547        ref=-0.205827999276        ref=-0.205827999276
548        res=inf(arg)        res=inf(arg)
549        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
550        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
551     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
552     def test_inf_array_rank2(self):     def test_inf_array_rank2(self):
553        arg=numarray.array([[-0.00088705991533410966, -0.78884753663192009, 0.51871980588812661, -0.58204851803513313, 0.14241101940826861], [0.79094574969805964, 0.79672216617995617, -0.5690477768894624, 0.51157272654417052, 0.18066938665191556], [0.32364745994353683, 0.4748425103497671, 0.66679519455306924, -0.69644515487912217, -0.37494171775165297], [-0.18679695095262239, -0.78312977298360509, 0.044885312146701661, -0.44016241609550066, -0.49756845096624081]])        arg=numarray.array([[-0.00088705991533410966, -0.78884753663192009, 0.51871980588812661, -0.58204851803513313, 0.14241101940826861], [0.79094574969805964, 0.79672216617995617, -0.5690477768894624, 0.51157272654417052, 0.18066938665191556], [0.32364745994353683, 0.4748425103497671, 0.66679519455306924, -0.69644515487912217, -0.37494171775165297], [-0.18679695095262239, -0.78312977298360509, 0.044885312146701661, -0.44016241609550066, -0.49756845096624081]])
554        ref=-0.788847536632        ref=-0.788847536632
555        res=inf(arg)        res=inf(arg)
556        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
557        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
558     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
559     def test_inf_array_rank3(self):     def test_inf_array_rank3(self):
560        arg=numarray.array([[[-0.8081125483464171, -0.39512178653285135], [-0.88509761616456495, 0.27821695074525521]], [[-0.12065704909614361, 0.68332883926843135], [0.3403814721074454, -0.32879966956330042]], [[-0.7045229028656752, -0.1577338131736914], [-0.5966034105188045, 0.73456332700634985]], [[0.87843639147943997, 0.94490362642776882], [-0.45552277927474183, -0.9768135246661469]], [[-0.65451540143458864, -0.2796668209543185], [-0.085396852552783953, 0.83466766003117332]], [[0.43465138886082078, 0.61441480296663342], [0.92555078046558337, -0.24612584648713121]]])        arg=numarray.array([[[-0.8081125483464171, -0.39512178653285135], [-0.88509761616456495, 0.27821695074525521]], [[-0.12065704909614361, 0.68332883926843135], [0.3403814721074454, -0.32879966956330042]], [[-0.7045229028656752, -0.1577338131736914], [-0.5966034105188045, 0.73456332700634985]], [[0.87843639147943997, 0.94490362642776882], [-0.45552277927474183, -0.9768135246661469]], [[-0.65451540143458864, -0.2796668209543185], [-0.085396852552783953, 0.83466766003117332]], [[0.43465138886082078, 0.61441480296663342], [0.92555078046558337, -0.24612584648713121]]])
561        ref=-0.976813524666        ref=-0.976813524666
562        res=inf(arg)        res=inf(arg)
563        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
564        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
565     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
566     def test_inf_array_rank4(self):     def test_inf_array_rank4(self):
567        arg=numarray.array([[[[-0.05536021838962446, -0.0098764348632232046, -0.52953548051740618, 0.58523070076080819], [0.10613609818504877, 0.67324697282212087, 0.54615663777618906, -0.67572666188479613], [-0.14390410848091539, 0.54011444546397591, -0.85609073171970373, 0.077099187121419277]], [[-0.20493469025659716, 0.90647730634569368, -0.71749107354722064, -0.12332697315517271], [0.63551267588618598, -0.60802528409862266, 0.052319255834022638, -0.95394697709081688], [-0.88612629669117959, 0.32248454322667519, 0.0072741938614420132, -0.69013368898879235]]], [[[-0.10462047858216028, -0.30097012474135698, -0.050016775782701028, 0.54822125876578376], [0.84395749034726886, -0.53249513893193168, -0.88004100855031275, -0.80779542570577179], [-0.79677629667791683, 0.95096027764472169, 0.63643207567783144, 0.97757008271555401]], [[-0.65415697736192047, -0.97050764835238645, -0.84814693021942777, -0.43855897064286542], [-0.37135308255264543, 0.041120751125186095, 0.036995657114785807, -0.35706630152349828], [-0.0030591331649565401, 0.48192500000712779, 0.18102011879743984, -0.78573775232009435]]], [[[-0.31965876602783605, 0.10351748464331689, 0.067424791069963907, -0.049524027182576535], [-0.5213817364489115, 0.027521683153738818, -0.24734661576641237, 0.24321699964875232], [-0.83947613904690699, 0.77162806253216987, -0.90740945316368071, -0.3420545897410685]], [[0.91845344502663262, -0.70878381509801414, 0.90861837177726379, -0.4013061463136427], [-0.18540388033546473, 0.9254510240675875, 0.30634230347058677, -0.97817133509804033], [-0.43975591131244984, 0.30020642565479139, 0.36841633323637479, 0.3066739733421715]]]])        arg=numarray.array([[[[-0.05536021838962446, -0.0098764348632232046, -0.52953548051740618, 0.58523070076080819], [0.10613609818504877, 0.67324697282212087, 0.54615663777618906, -0.67572666188479613], [-0.14390410848091539, 0.54011444546397591, -0.85609073171970373, 0.077099187121419277]], [[-0.20493469025659716, 0.90647730634569368, -0.71749107354722064, -0.12332697315517271], [0.63551267588618598, -0.60802528409862266, 0.052319255834022638, -0.95394697709081688], [-0.88612629669117959, 0.32248454322667519, 0.0072741938614420132, -0.69013368898879235]]], [[[-0.10462047858216028, -0.30097012474135698, -0.050016775782701028, 0.54822125876578376], [0.84395749034726886, -0.53249513893193168, -0.88004100855031275, -0.80779542570577179], [-0.79677629667791683, 0.95096027764472169, 0.63643207567783144, 0.97757008271555401]], [[-0.65415697736192047, -0.97050764835238645, -0.84814693021942777, -0.43855897064286542], [-0.37135308255264543, 0.041120751125186095, 0.036995657114785807, -0.35706630152349828], [-0.0030591331649565401, 0.48192500000712779, 0.18102011879743984, -0.78573775232009435]]], [[[-0.31965876602783605, 0.10351748464331689, 0.067424791069963907, -0.049524027182576535], [-0.5213817364489115, 0.027521683153738818, -0.24734661576641237, 0.24321699964875232], [-0.83947613904690699, 0.77162806253216987, -0.90740945316368071, -0.3420545897410685]], [[0.91845344502663262, -0.70878381509801414, 0.90861837177726379, -0.4013061463136427], [-0.18540388033546473, 0.9254510240675875, 0.30634230347058677, -0.97817133509804033], [-0.43975591131244984, 0.30020642565479139, 0.36841633323637479, 0.3066739733421715]]]])
568        ref=-0.978171335098        ref=-0.978171335098
569        res=inf(arg)        res=inf(arg)
570        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
571        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
572     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
573     def test_inf_constData_rank0(self):     def test_inf_constData_rank0(self):
574        arg=Data(0.0114629834279,self.functionspace)        arg=Data(0.0114629834279,self.functionspace)
575        ref=0.0114629834279        ref=0.0114629834279
576        res=inf(arg)        res=inf(arg)
577        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
578        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
579     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
580     def test_inf_constData_rank1(self):     def test_inf_constData_rank1(self):
581        arg=Data(numarray.array([-0.13734485813185704, -0.54812466656634307]),self.functionspace)        arg=Data(numarray.array([-0.13734485813185704, -0.54812466656634307]),self.functionspace)
582        ref=-0.548124666566        ref=-0.548124666566
583        res=inf(arg)        res=inf(arg)
584        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
585        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
586     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
587     def test_inf_constData_rank2(self):     def test_inf_constData_rank2(self):
588        arg=Data(numarray.array([[-0.89509582806410015, 0.10780316690435621, -0.93073500763754335, -0.38534759506991545, -0.6935160645644014], [-0.056672310128515813, 0.6285075027787359, 0.73632355512072167, -0.60238897825476267, 0.77403597203864094], [-0.5930215600641755, 0.72623233579382429, -0.32117191475695361, -0.081104170523293773, 0.62137628665436373], [0.2669734570396014, -0.65030905665614136, -0.53589374176691495, -0.48334830355881309, -0.89125004784938211]]),self.functionspace)        arg=Data(numarray.array([[-0.89509582806410015, 0.10780316690435621, -0.93073500763754335, -0.38534759506991545, -0.6935160645644014], [-0.056672310128515813, 0.6285075027787359, 0.73632355512072167, -0.60238897825476267, 0.77403597203864094], [-0.5930215600641755, 0.72623233579382429, -0.32117191475695361, -0.081104170523293773, 0.62137628665436373], [0.2669734570396014, -0.65030905665614136, -0.53589374176691495, -0.48334830355881309, -0.89125004784938211]]),self.functionspace)
589        ref=-0.930735007638        ref=-0.930735007638
590        res=inf(arg)        res=inf(arg)
591        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
592        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
593     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
594     def test_inf_constData_rank3(self):     def test_inf_constData_rank3(self):
595        arg=Data(numarray.array([[[0.94493948950092999, 0.13737629155757691], [-0.81599535906086107, -0.35832278646984816]], [[-0.53692839435234041, 0.53679590218669571], [0.038856705021854232, -0.18543838436402926]], [[0.19718168292863836, -0.55405958298613656], [0.16477861536800242, 0.17787953041277582]], [[0.51547288009005165, 0.35889372726595203], [-0.033476505587150873, -0.42142418570614026]], [[0.80507204877418204, -0.79581688922832838], [-0.85909254497735588, 0.66095083521227149]], [[0.46206420953978222, 0.53654696439305005], [0.57618105395776831, -0.22241758047110038]]]),self.functionspace)        arg=Data(numarray.array([[[0.94493948950092999, 0.13737629155757691], [-0.81599535906086107, -0.35832278646984816]], [[-0.53692839435234041, 0.53679590218669571], [0.038856705021854232, -0.18543838436402926]], [[0.19718168292863836, -0.55405958298613656], [0.16477861536800242, 0.17787953041277582]], [[0.51547288009005165, 0.35889372726595203], [-0.033476505587150873, -0.42142418570614026]], [[0.80507204877418204, -0.79581688922832838], [-0.85909254497735588, 0.66095083521227149]], [[0.46206420953978222, 0.53654696439305005], [0.57618105395776831, -0.22241758047110038]]]),self.functionspace)
596        ref=-0.859092544977        ref=-0.859092544977
597        res=inf(arg)        res=inf(arg)
598        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
599        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
600     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
601     def test_inf_constData_rank4(self):     def test_inf_constData_rank4(self):
602        arg=Data(numarray.array([[[[0.50544713768476202, 0.96922321849050874, -0.81524480218696649, -0.36499730379849193], [-0.48131882706974372, 0.026812357207576465, 0.090903267401989618, -0.24742363369877829], [-0.51631372893805438, 0.30410275437953183, -0.75149566289642533, -0.19930300338453599]], [[0.82034878499482788, -0.70904661587698792, -0.27637223434426073, -0.34818734117560401], [0.11686048779802416, -0.76746266142163178, -0.75578186306174833, 0.14509316330390232], [0.1590050723141736, 0.69684384552537937, -0.58747105640080832, -0.28640840371441523]]], [[[0.14956532194045669, 0.081514192262221119, 0.32061383569406399, -0.2444346881437609], [0.79564139071785278, -0.5456680167461434, 0.24722978802719742, 0.28286130725068315], [0.10385207763921711, -0.064749181840278336, 0.21325254547672734, -0.71875644540473838]], [[0.58552496009870802, 0.35472373485671338, -0.18411162994671826, 0.71609038134967773], [-0.20966804574945064, -0.49286619989346314, 0.85116051808632553, -0.94417114370961075], [-0.40434528979823714, 0.62250343758157611, 0.64860074098639742, 0.0043146814280992096]]], [[[-0.14242849200713259, 0.42551908502898095, 0.7691157770973962, -0.37595641162856674], [0.026655444032149589, -0.82186407521644167, 0.40285091480648783, -0.53328831035315982], [-0.12887729257054481, 0.75610663428133451, 0.022049613835531723, 0.59949338706293043]], [[-0.34506254315071772, 0.019719877473602043, 0.10216765908478709, 0.022681548062032153], [0.2228614880408597, 0.26944547311401901, -0.10122095357202965, -0.51019076850180589], [-0.081439546799124463, 0.18829632566943544, 0.12366885442775377, 0.73651436499107814]]]]),self.functionspace)        arg=Data(numarray.array([[[[0.50544713768476202, 0.96922321849050874, -0.81524480218696649, -0.36499730379849193], [-0.48131882706974372, 0.026812357207576465, 0.090903267401989618, -0.24742363369877829], [-0.51631372893805438, 0.30410275437953183, -0.75149566289642533, -0.19930300338453599]], [[0.82034878499482788, -0.70904661587698792, -0.27637223434426073, -0.34818734117560401], [0.11686048779802416, -0.76746266142163178, -0.75578186306174833, 0.14509316330390232], [0.1590050723141736, 0.69684384552537937, -0.58747105640080832, -0.28640840371441523]]], [[[0.14956532194045669, 0.081514192262221119, 0.32061383569406399, -0.2444346881437609], [0.79564139071785278, -0.5456680167461434, 0.24722978802719742, 0.28286130725068315], [0.10385207763921711, -0.064749181840278336, 0.21325254547672734, -0.71875644540473838]], [[0.58552496009870802, 0.35472373485671338, -0.18411162994671826, 0.71609038134967773], [-0.20966804574945064, -0.49286619989346314, 0.85116051808632553, -0.94417114370961075], [-0.40434528979823714, 0.62250343758157611, 0.64860074098639742, 0.0043146814280992096]]], [[[-0.14242849200713259, 0.42551908502898095, 0.7691157770973962, -0.37595641162856674], [0.026655444032149589, -0.82186407521644167, 0.40285091480648783, -0.53328831035315982], [-0.12887729257054481, 0.75610663428133451, 0.022049613835531723, 0.59949338706293043]], [[-0.34506254315071772, 0.019719877473602043, 0.10216765908478709, 0.022681548062032153], [0.2228614880408597, 0.26944547311401901, -0.10122095357202965, -0.51019076850180589], [-0.081439546799124463, 0.18829632566943544, 0.12366885442775377, 0.73651436499107814]]]]),self.functionspace)
603        ref=-0.94417114371        ref=-0.94417114371
604        res=inf(arg)        res=inf(arg)
605        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
606        self.failUnless(abs(res-ref)<=self.tol*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
607       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
608       def test_inf_expandedData_rank0(self):
609    
610          msk=whereNegative(self.functionspace.getX()[0]-0.5)
611          arg=msk*0.97331285569+(1.-msk)*0.911344578019
612    
613          # arg=Data(0.97331285569,self.functionspace,True)
614          #arg.setTaggedValue(1,0.97331285569)
615          res=inf(arg)
616          ref=0.911344578019
617          self.failUnless(isinstance(res,float),"wrong type of result.")
618          self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
619       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
620       def test_inf_expandedData_rank1(self):
621    
622          msk=whereNegative(self.functionspace.getX()[0]-0.5)
623          arg=msk*numarray.array([-0.025782649803792301, 0.15017595667012174])+(1.-msk)*numarray.array([-0.69996944983865683, 0.23286168827412723])
624    
625          # arg=Data(numarray.array([-0.025782649803792301, 0.15017595667012174]),self.functionspace,True)
626          # arg.setTaggedValue(1,[-0.69996944983865683, 0.23286168827412723])
627          res=inf(arg)
628          ref=-0.699969449839
629          self.failUnless(isinstance(res,float),"wrong type of result.")
630          self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
631       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
632       def test_inf_expandedData_rank2(self):
633    
634          msk=whereNegative(self.functionspace.getX()[0]-0.5)
635          arg=msk*numarray.array([[-0.11924617230337731, -0.69281409701569552, 0.8819805848672797, 0.67606672557817737, -0.15719846909292801], [-0.91958498979699277, 0.35156143886023572, -0.66768679685578647, -0.48673444352737993, -0.33274286155542288], [-0.011930486621410052, -0.035661622752792166, 0.8109198510155371, 0.2680383999767102, 0.38679270088753159], [-0.64107995512896321, 0.58836944145799008, -0.55856121453754959, 0.63346354980998365, -0.74990799644898765]])+(1.-msk)*numarray.array([[0.075603512293304975, 0.65374459813382813, -0.68190855977115938, 0.023184369691352069, -0.15500904033575869], [-0.28865053906142646, 0.94679590620919218, -0.53701383780009748, -0.5413294941411595, -0.1693286769782183], [-0.34870739946353968, -0.92230175409787241, -0.95867600429924127, -0.0012605712136730673, 0.33180267589091184], [-0.60152160703395885, 0.3397221706065463, 0.58860878406913142, 0.59589494790106934, -0.96157487116725071]])
636    
637          # arg=Data(numarray.array([[-0.11924617230337731, -0.69281409701569552, 0.8819805848672797, 0.67606672557817737, -0.15719846909292801], [-0.91958498979699277, 0.35156143886023572, -0.66768679685578647, -0.48673444352737993, -0.33274286155542288], [-0.011930486621410052, -0.035661622752792166, 0.8109198510155371, 0.2680383999767102, 0.38679270088753159], [-0.64107995512896321, 0.58836944145799008, -0.55856121453754959, 0.63346354980998365, -0.74990799644898765]]),self.functionspace,True)
638          # arg.setTaggedValue(1,[[0.075603512293304975, 0.65374459813382813, -0.68190855977115938, 0.023184369691352069, -0.15500904033575869], [-0.28865053906142646, 0.94679590620919218, -0.53701383780009748, -0.5413294941411595, -0.1693286769782183], [-0.34870739946353968, -0.92230175409787241, -0.95867600429924127, -0.0012605712136730673, 0.33180267589091184], [-0.60152160703395885, 0.3397221706065463, 0.58860878406913142, 0.59589494790106934, -0.96157487116725071]])
639          res=inf(arg)
640          ref=-0.961574871167
641          self.failUnless(isinstance(res,float),"wrong type of result.")
642          self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
643       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
644       def test_inf_expandedData_rank3(self):
645    
646          msk=whereNegative(self.functionspace.getX()[0]-0.5)
647          arg=msk*numarray.array([[[0.76729109013175933, 0.93446692332588199], [-0.85883010569426133, 0.94426468618035608]], [[0.93376991286356659, -0.31027020688815887], [0.68776369494826284, -0.71422083083074273]], [[0.88895851954297633, -0.0041028262794304826], [-0.56213269421968981, -0.53305350433881493]], [[0.91080353792869873, 0.87460732654624618], [-0.43411934331432445, -0.66454826732696648]], [[-0.7458989571542316, 0.0054889915153857327], [-0.43786572648758848, 0.45559010284736901]], [[0.97274627384999923, 0.28719064869132427], [-0.068944574283213989, 0.92462015394940389]]])+(1.-msk)*numarray.array([[[0.45653716082021401, -0.23702471933521396], [-0.45177153258555913, -0.41351543065221219]], [[0.24913453932538854, -0.29954039408048372], [0.47106013214852771, -0.86663080347446608]], [[-0.75781905181266151, 0.18918623668675538], [-0.66636479853389385, 0.74776214919244066]], [[-0.1199599974824086, 0.90306995612278795], [0.77248429149482201, 0.094536885699270545]], [[-0.5505821492977705, -0.42454185319972981], [-0.035064708067998662, -0.75303714911308206]], [[-0.63966405281134198, -0.5545794126646626], [-0.010523374154368881, -0.6779302443539712]]])
648    
649          # arg=Data(numarray.array([[[0.76729109013175933, 0.93446692332588199], [-0.85883010569426133, 0.94426468618035608]], [[0.93376991286356659, -0.31027020688815887], [0.68776369494826284, -0.71422083083074273]], [[0.88895851954297633, -0.0041028262794304826], [-0.56213269421968981, -0.53305350433881493]], [[0.91080353792869873, 0.87460732654624618], [-0.43411934331432445, -0.66454826732696648]], [[-0.7458989571542316, 0.0054889915153857327], [-0.43786572648758848, 0.45559010284736901]], [[0.97274627384999923, 0.28719064869132427], [-0.068944574283213989, 0.92462015394940389]]]),self.functionspace,True)
650          # arg.setTaggedValue(1,[[[0.45653716082021401, -0.23702471933521396], [-0.45177153258555913, -0.41351543065221219]], [[0.24913453932538854, -0.29954039408048372], [0.47106013214852771, -0.86663080347446608]], [[-0.75781905181266151, 0.18918623668675538], [-0.66636479853389385, 0.74776214919244066]], [[-0.1199599974824086, 0.90306995612278795], [0.77248429149482201, 0.094536885699270545]], [[-0.5505821492977705, -0.42454185319972981], [-0.035064708067998662, -0.75303714911308206]], [[-0.63966405281134198, -0.5545794126646626], [-0.010523374154368881, -0.6779302443539712]]])
651          res=inf(arg)
652          ref=-0.866630803474
653          self.failUnless(isinstance(res,float),"wrong type of result.")
654          self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
655       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
656       def test_inf_expandedData_rank4(self):
657    
658          msk=whereNegative(self.functionspace.getX()[0]-0.5)
659          arg=msk*numarray.array([[[[0.59301561766072242, 0.6053289847447505, 0.1720524601196014, 0.4833679091408507], [-0.09424534157102582, 0.91976800441974427, -0.11950945037648264, -0.10547294628619919], [0.045302052907340462, -0.26699801365763864, -0.59100789693502542, 0.8220898248447317]], [[-0.71764117646989489, -0.31097048109028447, -0.36880919201656037, -0.12380648590370025], [0.71171672214402615, -0.87716399369053821, 0.53673002158727501, -0.29732656272582969], [-0.71737153055394787, -0.18861795164190798, -0.55325559014387649, 0.50828072891961451]]], [[[0.7139879661021804, -0.54655602578694507, -0.62738810494945163, -0.71453639471562314], [0.25287437655577372, 0.47571671295036144, -0.86354401602062025, -0.45354287599804666], [0.44863440392806031, -0.64112646326775291, 0.91877609169151908, 0.98277738739744636]], [[-0.23627452345538003, 0.26824331838587279, -0.11255839194272887, 0.62327509528972769], [0.87773514238000572, 0.62819546928589953, 0.53463187163744053, -0.11780048176113112], [0.17743656841726674, -0.47418242507357755, 0.37012543459814751, 0.84217962384585232]]], [[[-0.51615332690558602, -0.32180746309362296, -0.86871747985681558, -0.89347967000489548], [0.79236651642797762, -0.82769899986382356, -0.27503369025221813, 0.70491420567015894], [-0.46319485284379014, -0.71191635366918904, -0.4935498645964489, 0.42096986386791024]], [[-0.95241673224815648, -0.99507534300684708, -0.76759978752396862, -0.1621109099401965], [0.011495974208982407, 0.90547796535927083, -0.79651097416963368, 0.44382172569512224], [-0.11210429012307821, 0.28303519643554576, -0.59783370185364437, 0.75478113456483809]]]])+(1.-msk)*numarray.array([[[[0.70392145790103089, -0.7532260844479588, -0.53422583924595046, 0.29798767877629717], [0.87516135156666075, -0.40276494310086908, -0.070320230959511232, 0.13669067815714553], [0.26690559342737163, -0.0067218741792103298, 0.79272133073277207, -0.90080452301155178]], [[-0.90606808543363915, 0.94927254364127123, -0.15130300474521019, -0.34632615506118936], [0.29908319964670294, -0.71717585217034374, -0.11325472101126977, 0.60911487311528911], [0.055579283773870003, -0.42895625110409941, 0.22788310989168781, 0.50000680777627848]]], [[[-0.56683598589959683, 0.05720680440798942, 0.27949696950971137, 0.028472427888231566], [-0.51619860801944828, 0.73067372155966415, 0.81910302859539108, 0.97736576074434089], [-0.68851989268805447, 0.93303896549540433, -0.21083269397032622, -0.93122611728597304]], [[-0.13573136829275501, -0.30858456571228721, 0.86534434039603658, 0.79114631697533278], [-0.32870753097283112, 0.68472493656951161, -0.071089197922887593, -0.032936485145198757], [0.40875380316397925, -0.27280027645573401, -0.27155299841136848, -0.81500786568603067]]], [[[0.080473457255322733, -0.54931257643900566, 0.19082193004877501, -0.52744293877995374], [0.44447571282767639, -0.0060974808128133606, -0.87810788913565485, -0.92670043304972327], [0.45760340069120065, -0.7504981866011311, -0.95431384972577082, 0.4644557658783679]], [[0.18449401878090566, -0.73315009595487135, -0.59404794479416467, 0.076556365298426687], [0.65441299213898763, -0.91649003079073932, -0.082437357750317686, 0.88150531806538579], [-0.45829076922310796, 0.91236619416957021, -0.91128142664652279, 0.9524897339484899]]]])
660    
661          # arg=Data(numarray.array([[[[0.59301561766072242, 0.6053289847447505, 0.1720524601196014, 0.4833679091408507], [-0.09424534157102582, 0.91976800441974427, -0.11950945037648264, -0.10547294628619919], [0.045302052907340462, -0.26699801365763864, -0.59100789693502542, 0.8220898248447317]], [[-0.71764117646989489, -0.31097048109028447, -0.36880919201656037, -0.12380648590370025], [0.71171672214402615, -0.87716399369053821, 0.53673002158727501, -0.29732656272582969], [-0.71737153055394787, -0.18861795164190798, -0.55325559014387649, 0.50828072891961451]]], [[[0.7139879661021804, -0.54655602578694507, -0.62738810494945163, -0.71453639471562314], [0.25287437655577372, 0.47571671295036144, -0.86354401602062025, -0.45354287599804666], [0.44863440392806031, -0.64112646326775291, 0.91877609169151908, 0.98277738739744636]], [[-0.23627452345538003, 0.26824331838587279, -0.11255839194272887, 0.62327509528972769], [0.87773514238000572, 0.62819546928589953, 0.53463187163744053, -0.11780048176113112], [0.17743656841726674, -0.47418242507357755, 0.37012543459814751, 0.84217962384585232]]], [[[-0.51615332690558602, -0.32180746309362296, -0.86871747985681558, -0.89347967000489548], [0.79236651642797762, -0.82769899986382356, -0.27503369025221813, 0.70491420567015894], [-0.46319485284379014, -0.71191635366918904, -0.4935498645964489, 0.42096986386791024]], [[-0.95241673224815648, -0.99507534300684708, -0.76759978752396862, -0.1621109099401965], [0.011495974208982407, 0.90547796535927083, -0.79651097416963368, 0.44382172569512224], [-0.11210429012307821, 0.28303519643554576, -0.59783370185364437, 0.75478113456483809]]]]),self.functionspace,True)
662          # arg.setTaggedValue(1,[[[[0.70392145790103089, -0.7532260844479588, -0.53422583924595046, 0.29798767877629717], [0.87516135156666075, -0.40276494310086908, -0.070320230959511232, 0.13669067815714553], [0.26690559342737163, -0.0067218741792103298, 0.79272133073277207, -0.90080452301155178]], [[-0.90606808543363915, 0.94927254364127123, -0.15130300474521019, -0.34632615506118936], [0.29908319964670294, -0.71717585217034374, -0.11325472101126977, 0.60911487311528911], [0.055579283773870003, -0.42895625110409941, 0.22788310989168781, 0.50000680777627848]]], [[[-0.56683598589959683, 0.05720680440798942, 0.27949696950971137, 0.028472427888231566], [-0.51619860801944828, 0.73067372155966415, 0.81910302859539108, 0.97736576074434089], [-0.68851989268805447, 0.93303896549540433, -0.21083269397032622, -0.93122611728597304]], [[-0.13573136829275501, -0.30858456571228721, 0.86534434039603658, 0.79114631697533278], [-0.32870753097283112, 0.68472493656951161, -0.071089197922887593, -0.032936485145198757], [0.40875380316397925, -0.27280027645573401, -0.27155299841136848, -0.81500786568603067]]], [[[0.080473457255322733, -0.54931257643900566, 0.19082193004877501, -0.52744293877995374], [0.44447571282767639, -0.0060974808128133606, -0.87810788913565485, -0.92670043304972327], [0.45760340069120065, -0.7504981866011311, -0.95431384972577082, 0.4644557658783679]], [[0.18449401878090566, -0.73315009595487135, -0.59404794479416467, 0.076556365298426687], [0.65441299213898763, -0.91649003079073932, -0.082437357750317686, 0.88150531806538579], [-0.45829076922310796, 0.91236619416957021, -0.91128142664652279, 0.9524897339484899]]]])
663          res=inf(arg)
664          ref=-0.995075343007
665          self.failUnless(isinstance(res,float),"wrong type of result.")
666          self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
667    #=========================================================
668    #  Symbols
669    #=========================================================
670       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
671       def test_Symbol_rank0_dNone_nargs0(self):
672          s2=Symbol(shape=())
673          s=Symbol(shape=(),dim=None,args=[])
674          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
675          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
676          self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")
677          self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
678    
679          ss=s.substitute({s:numarray.zeros(())})
680          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
681          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
682          try:
683            s.substitute({s:numarray.zeros((5,))})
684            fail("illegal substition was successful")
685          except TypeError:
686            pass
687    
688          dsdarg=s.diff(Symbol(shape=()))
689          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
690          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
691          dsdarg=s.diff(Symbol(shape=(2,)))
692          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
693          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
694          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
695          dsdarg=s.diff(Symbol(shape=(4, 5)))
696          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
697          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
698          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
699          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
700          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
701          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
702          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
703          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
704          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
705          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
706          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
707    
708          dsds=s.diff(s)
709          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
710          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
711    
712          sa=s.getSubstitutedArguments({s2:-10})
713          self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")
714    
715          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
716          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
717          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")
718          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
719          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
720          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
721          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
722       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
723       def test_Symbol_rank0_dNone_nargs1(self):
724          s2=Symbol(shape=())
725          s=Symbol(shape=(),dim=None,args=[s2])
726          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
727          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
728          self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")
729          self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")
730    
731          ss=s.substitute({s:numarray.zeros(())})
732          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
733          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
734          try:
735            s.substitute({s:numarray.zeros((5,))})
736            fail("illegal substition was successful")
737          except TypeError:
738            pass
739    
740          dsdarg=s.diff(Symbol(shape=()))
741          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
742          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
743          dsdarg=s.diff(Symbol(shape=(2,)))
744          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
745          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
746          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
747          dsdarg=s.diff(Symbol(shape=(4, 5)))
748          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
749          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
750          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
751          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
752          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
753          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
754          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
755          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
756          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
757          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
758          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
759    
760          dsds=s.diff(s)
761          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
762          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
763    
764          self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")
765          sa=s.getSubstitutedArguments({s2:-10})
766          self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")
767          self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")
768    
769          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
770          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
771          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")
772          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
773          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
774          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
775          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
776       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
777       def test_Symbol_rank0_dNone_nargs2(self):
778          s2=Symbol(shape=())
779          s=Symbol(shape=(),dim=None,args=[1, -1.0])
780          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
781          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
782          self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")
783          self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")
784    
785          ss=s.substitute({s:numarray.zeros(())})
786          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
787          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
788          try:
789            s.substitute({s:numarray.zeros((5,))})
790            fail("illegal substition was successful")
791          except TypeError:
792            pass
793    
794          dsdarg=s.diff(Symbol(shape=()))
795          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
796          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
797          dsdarg=s.diff(Symbol(shape=(2,)))
798          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
799          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
800          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
801          dsdarg=s.diff(Symbol(shape=(4, 5)))
802          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
803          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
804          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
805          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
806          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
807          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
808          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
809          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
810          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
811          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
812          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
813    
814          dsds=s.diff(s)
815          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
816          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
817    
818          self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")
819          self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")
820          sa=s.getSubstitutedArguments({s2:-10})
821          self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")
822          self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")
823          self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")
824    
825          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
826          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
827          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")
828          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
829          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
830          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
831          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
832       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
833       def test_Symbol_rank0_dd_nargs0(self):
834          s2=Symbol(shape=())
835          s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[])
836          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
837          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
838          self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")
839          self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
840    
841          ss=s.substitute({s:numarray.zeros(())})
842          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
843          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
844          try:
845            s.substitute({s:numarray.zeros((5,))})
846            fail("illegal substition was successful")
847          except TypeError:
848            pass
849    
850          dsdarg=s.diff(Symbol(shape=()))
851          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
852          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
853          dsdarg=s.diff(Symbol(shape=(2,)))
854          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
855          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
856          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
857          dsdarg=s.diff(Symbol(shape=(4, 5)))
858          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
859          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
860          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
861          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
862          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
863          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
864          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
865          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
866          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
867          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
868          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
869    
870          dsds=s.diff(s)
871          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
872          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
873    
874          sa=s.getSubstitutedArguments({s2:-10})
875          self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")
876    
877          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
878          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
879          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")
880          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
881          self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")
882          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
883          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
884          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
885       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
886       def test_Symbol_rank0_dd_nargs1(self):
887          s2=Symbol(shape=())
888          s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[s2])
889          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
890          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
891          self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")
892          self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")
893    
894          ss=s.substitute({s:numarray.zeros(())})
895          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
896          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
897          try:
898            s.substitute({s:numarray.zeros((5,))})
899            fail("illegal substition was successful")
900          except TypeError:
901            pass
902    
903          dsdarg=s.diff(Symbol(shape=()))
904          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
905          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
906          dsdarg=s.diff(Symbol(shape=(2,)))
907          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
908          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
909          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
910          dsdarg=s.diff(Symbol(shape=(4, 5)))
911          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
912          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
913          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
914          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
915          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
916          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
917          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
918          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
919          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
920          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
921          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
922    
923          dsds=s.diff(s)
924          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
925          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
926    
927          self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")
928          sa=s.getSubstitutedArguments({s2:-10})
929          self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")
930          self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")
931    
932          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
933          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
934          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")
935          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
936          self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")
937          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
938          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
939          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
940       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
941       def test_Symbol_rank0_dd_nargs2(self):
942          s2=Symbol(shape=())
943          s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[1, -1.0])
944          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
945          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
946          self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")
947          self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")
948    
949          ss=s.substitute({s:numarray.zeros(())})
950          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
951          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
952          try:
953            s.substitute({s:numarray.zeros((5,))})
954            fail("illegal substition was successful")
955          except TypeError:
956            pass
957    
958          dsdarg=s.diff(Symbol(shape=()))
959          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
960          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
961          dsdarg=s.diff(Symbol(shape=(2,)))
962          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
963          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
964          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
965          dsdarg=s.diff(Symbol(shape=(4, 5)))
966          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
967          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
968          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
969          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
970          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
971          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
972          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
973          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
974          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
975          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
976          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
977    
978          dsds=s.diff(s)
979          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
980          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
981    
982          self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")
983          self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")
984          sa=s.getSubstitutedArguments({s2:-10})
985          self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")
986          self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")
987          self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")
988    
989          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
990          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
991          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")
992          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
993          self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")
994          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
995          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
996          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
997       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
998       def test_Symbol_rank0_d1_nargs0(self):
999          s2=Symbol(shape=())
1000          s=Symbol(shape=(),dim=1,args=[])
1001          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
1002          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
1003          self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
1004          self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
1005    
1006          ss=s.substitute({s:numarray.zeros(())})
1007          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1008          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
1009          try:
1010            s.substitute({s:numarray.zeros((5,))})
1011            fail("illegal substition was successful")
1012          except TypeError:
1013            pass
1014    
1015          dsdarg=s.diff(Symbol(shape=()))
1016          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
1017          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1018          dsdarg=s.diff(Symbol(shape=(2,)))
1019          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1020          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
1021          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1022          dsdarg=s.diff(Symbol(shape=(4, 5)))
1023          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1024          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
1025          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1026          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1027          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1028          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1029          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1030          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
1031          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
1032          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
1033          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
1034    
1035          dsds=s.diff(s)
1036          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
1037          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
1038    
1039          sa=s.getSubstitutedArguments({s2:-10})
1040          self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")
1041    
1042          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
1043          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
1044          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")
1045          self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")
1046          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1047          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
1048          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1049       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1050       def test_Symbol_rank0_d1_nargs1(self):
1051          s2=Symbol(shape=())
1052          s=Symbol(shape=(),dim=1,args=[s2])
1053          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
1054          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
1055          self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
1056          self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")
1057    
1058          ss=s.substitute({s:numarray.zeros(())})
1059          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1060          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
1061          try:
1062            s.substitute({s:numarray.zeros((5,))})
1063            fail("illegal substition was successful")
1064          except TypeError:
1065            pass
1066    
1067          dsdarg=s.diff(Symbol(shape=()))
1068          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
1069          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1070          dsdarg=s.diff(Symbol(shape=(2,)))
1071          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1072          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
1073          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1074          dsdarg=s.diff(Symbol(shape=(4, 5)))
1075          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1076          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
1077          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1078          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1079          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1080          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1081          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1082          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
1083          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
1084          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
1085          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
1086    
1087          dsds=s.diff(s)
1088          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
1089          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
1090    
1091          self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")
1092          sa=s.getSubstitutedArguments({s2:-10})
1093          self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")
1094          self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")
1095    
1096          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
1097          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
1098          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")
1099          self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")
1100          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1101          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
1102          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1103       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1104       def test_Symbol_rank0_d1_nargs2(self):
1105          s2=Symbol(shape=())
1106          s=Symbol(shape=(),dim=1,args=[1, -1.0])
1107          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
1108          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
1109          self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
1110          self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")
1111    
1112          ss=s.substitute({s:numarray.zeros(())})
1113          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1114          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
1115          try:
1116            s.substitute({s:numarray.zeros((5,))})
1117            fail("illegal substition was successful")
1118          except TypeError:
1119            pass
1120    
1121          dsdarg=s.diff(Symbol(shape=()))
1122          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
1123          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1124          dsdarg=s.diff(Symbol(shape=(2,)))
1125          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1126          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
1127          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1128          dsdarg=s.diff(Symbol(shape=(4, 5)))
1129          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1130          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
1131          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1132          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1133          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1134          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1135          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1136          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
1137          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
1138          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
1139          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
1140    
1141          dsds=s.diff(s)
1142          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
1143          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
1144    
1145          self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")
1146          self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")
1147          sa=s.getSubstitutedArguments({s2:-10})
1148          self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")
1149          self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")
1150          self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")
1151    
1152          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
1153          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
1154          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")
1155          self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")
1156          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1157          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
1158          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1159       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1160       def test_Symbol_rank0_d2_nargs0(self):
1161          s2=Symbol(shape=())
1162          s=Symbol(shape=(),dim=2,args=[])
1163          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
1164          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
1165          self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
1166          self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
1167    
1168          ss=s.substitute({s:numarray.zeros(())})
1169          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1170          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
1171          try:
1172            s.substitute({s:numarray.zeros((5,))})
1173            fail("illegal substition was successful")
1174          except TypeError:
1175            pass
1176    
1177          dsdarg=s.diff(Symbol(shape=()))
1178          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
1179          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1180          dsdarg=s.diff(Symbol(shape=(2,)))
1181          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1182          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
1183          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1184          dsdarg=s.diff(Symbol(shape=(4, 5)))
1185          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1186          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
1187          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1188          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1189          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1190          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1191          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1192          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
1193          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
1194          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
1195          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
1196    
1197          dsds=s.diff(s)
1198          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
1199          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
1200    
1201          sa=s.getSubstitutedArguments({s2:-10})
1202          self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")
1203    
1204          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
1205          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
1206          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")
1207          self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")
1208          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1209          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
1210          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1211       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1212       def test_Symbol_rank0_d2_nargs1(self):
1213          s2=Symbol(shape=())
1214          s=Symbol(shape=(),dim=2,args=[s2])
1215          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
1216          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
1217          self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
1218          self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")
1219    
1220          ss=s.substitute({s:numarray.zeros(())})
1221          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1222          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
1223          try:
1224            s.substitute({s:numarray.zeros((5,))})
1225            fail("illegal substition was successful")
1226          except TypeError:
1227            pass
1228    
1229          dsdarg=s.diff(Symbol(shape=()))
1230          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
1231          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1232          dsdarg=s.diff(Symbol(shape=(2,)))
1233          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1234          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
1235          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1236          dsdarg=s.diff(Symbol(shape=(4, 5)))
1237          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1238          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
1239          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1240          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1241          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1242          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1243          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1244          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
1245          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
1246          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
1247          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
1248    
1249          dsds=s.diff(s)
1250          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
1251          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
1252    
1253          self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")
1254          sa=s.getSubstitutedArguments({s2:-10})
1255          self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")
1256          self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")
1257    
1258          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
1259          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
1260          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")
1261          self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")
1262          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1263          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
1264          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1265       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1266       def test_Symbol_rank0_d2_nargs2(self):
1267          s2=Symbol(shape=())
1268          s=Symbol(shape=(),dim=2,args=[1, -1.0])
1269          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
1270          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
1271          self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
1272          self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")
1273    
1274          ss=s.substitute({s:numarray.zeros(())})
1275          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1276          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
1277          try:
1278            s.substitute({s:numarray.zeros((5,))})
1279            fail("illegal substition was successful")
1280          except TypeError:
1281            pass
1282    
1283          dsdarg=s.diff(Symbol(shape=()))
1284          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
1285          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1286          dsdarg=s.diff(Symbol(shape=(2,)))
1287          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1288          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
1289          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1290          dsdarg=s.diff(Symbol(shape=(4, 5)))
1291          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1292          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
1293          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1294          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1295          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1296          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1297          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1298          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
1299          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
1300          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
1301          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
1302    
1303          dsds=s.diff(s)
1304          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
1305          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
1306    
1307          self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")
1308          self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")
1309          sa=s.getSubstitutedArguments({s2:-10})
1310          self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")
1311          self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")
1312          self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")
1313    
1314          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
1315          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
1316          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")
1317          self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")
1318          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1319          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
1320          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1321       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1322       def test_Symbol_rank0_d3_nargs0(self):
1323          s2=Symbol(shape=())
1324          s=Symbol(shape=(),dim=3,args=[])
1325          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
1326          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
1327          self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
1328          self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
1329    
1330          ss=s.substitute({s:numarray.zeros(())})
1331          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1332          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
1333          try:
1334            s.substitute({s:numarray.zeros((5,))})
1335            fail("illegal substition was successful")
1336          except TypeError:
1337            pass
1338    
1339          dsdarg=s.diff(Symbol(shape=()))
1340          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
1341          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1342          dsdarg=s.diff(Symbol(shape=(2,)))
1343          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1344          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
1345          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1346          dsdarg=s.diff(Symbol(shape=(4, 5)))
1347          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1348          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
1349          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1350          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1351          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1352          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1353          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1354          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
1355          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
1356          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
1357          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
1358    
1359          dsds=s.diff(s)
1360          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
1361          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
1362    
1363          sa=s.getSubstitutedArguments({s2:-10})
1364          self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")
1365    
1366          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
1367          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
1368          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")
1369          self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")
1370          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1371          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
1372          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1373       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1374       def test_Symbol_rank0_d3_nargs1(self):
1375          s2=Symbol(shape=())
1376          s=Symbol(shape=(),dim=3,args=[s2])
1377          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
1378          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
1379          self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
1380          self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")
1381    
1382          ss=s.substitute({s:numarray.zeros(())})
1383          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1384          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
1385          try:
1386            s.substitute({s:numarray.zeros((5,))})
1387            fail("illegal substition was successful")
1388          except TypeError:
1389            pass
1390    
1391          dsdarg=s.diff(Symbol(shape=()))
1392          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
1393          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1394          dsdarg=s.diff(Symbol(shape=(2,)))
1395          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1396          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
1397          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1398          dsdarg=s.diff(Symbol(shape=(4, 5)))
1399          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1400          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
1401          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1402          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1403          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1404          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1405          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1406          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
1407          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
1408          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
1409          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
1410    
1411          dsds=s.diff(s)
1412          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
1413          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
1414    
1415          self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")
1416          sa=s.getSubstitutedArguments({s2:-10})
1417          self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")
1418          self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")
1419    
1420          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
1421          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
1422          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")
1423          self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")
1424          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1425          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
1426          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1427       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1428       def test_Symbol_rank0_d3_nargs2(self):
1429          s2=Symbol(shape=())
1430          s=Symbol(shape=(),dim=3,args=[1, -1.0])
1431          self.failUnlessEqual(s.getRank(),0,"wrong rank.")
1432          self.failUnlessEqual(s.getShape(),(),"wrong shape.")
1433          self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
1434          self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")
1435    
1436          ss=s.substitute({s:numarray.zeros(())})
1437          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1438          self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")
1439          try:
1440            s.substitute({s:numarray.zeros((5,))})
1441            fail("illegal substition was successful")
1442          except TypeError:
1443            pass
1444    
1445          dsdarg=s.diff(Symbol(shape=()))
1446          self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")
1447          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1448          dsdarg=s.diff(Symbol(shape=(2,)))
1449          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1450          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")
1451          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1452          dsdarg=s.diff(Symbol(shape=(4, 5)))
1453          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1454          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")
1455          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1456          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1457          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1458          self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1459          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1460          dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))
1461          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")
1462          self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")
1463          self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")
1464    
1465          dsds=s.diff(s)
1466          self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")
1467          self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")
1468    
1469          self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")
1470          self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")
1471          sa=s.getSubstitutedArguments({s2:-10})
1472          self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")
1473          self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")
1474          self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")
1475    
1476          self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")
1477          self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")
1478          self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")
1479          self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")
1480          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1481          self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")
1482          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1483       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1484       def test_Symbol_rank1_dNone_nargs0(self):
1485          s2=Symbol(shape=())
1486          s=Symbol(shape=(2,),dim=None,args=[])
1487          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
1488          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
1489          self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")
1490          self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
1491    
1492          ss=s.substitute({s:numarray.zeros((2,))})
1493          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1494          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
1495          try:
1496            s.substitute({s:numarray.zeros((5,))})
1497            fail("illegal substition was successful")
1498          except TypeError:
1499            pass
1500    
1501          dsdarg=s.diff(Symbol(shape=()))
1502          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
1503          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
1504          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1505          dsdarg=s.diff(Symbol(shape=(2,)))
1506          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1507          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
1508          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1509          dsdarg=s.diff(Symbol(shape=(4, 5)))
1510          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1511          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
1512          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1513          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1514          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1515          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1516          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1517    
1518          dsds=s.diff(s)
1519          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
1520          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
1521          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
1522          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
1523          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
1524          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
1525    
1526          sa=s.getSubstitutedArguments({s2:-10})
1527          self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")
1528    
1529          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
1530          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
1531          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")
1532          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
1533          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1534          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
1535          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1536       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1537       def test_Symbol_rank1_dNone_nargs1(self):
1538          s2=Symbol(shape=())
1539          s=Symbol(shape=(2,),dim=None,args=[s2])
1540          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
1541          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
1542          self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")
1543          self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")
1544    
1545          ss=s.substitute({s:numarray.zeros((2,))})
1546          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1547          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
1548          try:
1549            s.substitute({s:numarray.zeros((5,))})
1550            fail("illegal substition was successful")
1551          except TypeError:
1552            pass
1553    
1554          dsdarg=s.diff(Symbol(shape=()))
1555          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
1556          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
1557          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1558          dsdarg=s.diff(Symbol(shape=(2,)))
1559          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1560          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
1561          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1562          dsdarg=s.diff(Symbol(shape=(4, 5)))
1563          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1564          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
1565          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1566          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1567          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1568          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1569          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1570    
1571          dsds=s.diff(s)
1572          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
1573          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
1574          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
1575          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
1576          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
1577          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
1578    
1579          self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")
1580          sa=s.getSubstitutedArguments({s2:-10})
1581          self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")
1582          self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")
1583    
1584          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
1585          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
1586          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")
1587          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
1588          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1589          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
1590          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1591       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1592       def test_Symbol_rank1_dNone_nargs2(self):
1593          s2=Symbol(shape=())
1594          s=Symbol(shape=(2,),dim=None,args=[1, -1.0])
1595          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
1596          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
1597          self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")
1598          self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")
1599    
1600          ss=s.substitute({s:numarray.zeros((2,))})
1601          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1602          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
1603          try:
1604            s.substitute({s:numarray.zeros((5,))})
1605            fail("illegal substition was successful")
1606          except TypeError:
1607            pass
1608    
1609          dsdarg=s.diff(Symbol(shape=()))
1610          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
1611          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
1612          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1613          dsdarg=s.diff(Symbol(shape=(2,)))
1614          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1615          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
1616          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1617          dsdarg=s.diff(Symbol(shape=(4, 5)))
1618          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1619          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
1620          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1621          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1622          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1623          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1624          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1625    
1626          dsds=s.diff(s)
1627          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
1628          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
1629          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
1630          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
1631          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
1632          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
1633    
1634          self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")
1635          self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")
1636          sa=s.getSubstitutedArguments({s2:-10})
1637          self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")
1638          self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")
1639          self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")
1640    
1641          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
1642          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
1643          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")
1644          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
1645          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1646          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
1647          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1648       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1649       def test_Symbol_rank1_dd_nargs0(self):
1650          s2=Symbol(shape=())
1651          s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[])
1652          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
1653          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
1654          self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")
1655          self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
1656    
1657          ss=s.substitute({s:numarray.zeros((2,))})
1658          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1659          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
1660          try:
1661            s.substitute({s:numarray.zeros((5,))})
1662            fail("illegal substition was successful")
1663          except TypeError:
1664            pass
1665    
1666          dsdarg=s.diff(Symbol(shape=()))
1667          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
1668          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
1669          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1670          dsdarg=s.diff(Symbol(shape=(2,)))
1671          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1672          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
1673          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1674          dsdarg=s.diff(Symbol(shape=(4, 5)))
1675          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1676          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
1677          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1678          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1679          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1680          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1681          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1682    
1683          dsds=s.diff(s)
1684          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
1685          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
1686          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
1687          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
1688          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
1689          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
1690    
1691          sa=s.getSubstitutedArguments({s2:-10})
1692          self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")
1693    
1694          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
1695          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
1696          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")
1697          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
1698          self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute")
1699          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1700          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
1701          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1702       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1703       def test_Symbol_rank1_dd_nargs1(self):
1704          s2=Symbol(shape=())
1705          s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[s2])
1706          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
1707          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
1708          self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")
1709          self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")
1710    
1711          ss=s.substitute({s:numarray.zeros((2,))})
1712          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1713          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
1714          try:
1715            s.substitute({s:numarray.zeros((5,))})
1716            fail("illegal substition was successful")
1717          except TypeError:
1718            pass
1719    
1720          dsdarg=s.diff(Symbol(shape=()))
1721          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
1722          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
1723          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1724          dsdarg=s.diff(Symbol(shape=(2,)))
1725          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1726          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
1727          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1728          dsdarg=s.diff(Symbol(shape=(4, 5)))
1729          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1730          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
1731          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1732          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1733          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1734          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1735          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1736    
1737          dsds=s.diff(s)
1738          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
1739          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
1740          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
1741          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
1742          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
1743          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
1744    
1745          self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")
1746          sa=s.getSubstitutedArguments({s2:-10})
1747          self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")
1748          self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")
1749    
1750          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
1751          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
1752          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")
1753          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
1754          self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute")
1755          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1756          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
1757          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1758       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1759       def test_Symbol_rank1_dd_nargs2(self):
1760          s2=Symbol(shape=())
1761          s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[1, -1.0])
1762          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
1763          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
1764          self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")
1765          self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")
1766    
1767          ss=s.substitute({s:numarray.zeros((2,))})
1768          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1769          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
1770          try:
1771            s.substitute({s:numarray.zeros((5,))})
1772            fail("illegal substition was successful")
1773          except TypeError:
1774            pass
1775    
1776          dsdarg=s.diff(Symbol(shape=()))
1777          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
1778          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
1779          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1780          dsdarg=s.diff(Symbol(shape=(2,)))
1781          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1782          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
1783          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1784          dsdarg=s.diff(Symbol(shape=(4, 5)))
1785          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1786          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
1787          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1788          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1789          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1790          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1791          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1792    
1793          dsds=s.diff(s)
1794          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
1795          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
1796          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
1797          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
1798          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
1799          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
1800    
1801          self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")
1802          self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")
1803          sa=s.getSubstitutedArguments({s2:-10})
1804          self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")
1805          self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")
1806          self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")
1807    
1808          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
1809          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
1810          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")
1811          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
1812          self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute")
1813          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1814          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
1815          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1816       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1817       def test_Symbol_rank1_d1_nargs0(self):
1818          s2=Symbol(shape=())
1819          s=Symbol(shape=(2,),dim=1,args=[])
1820          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
1821          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
1822          self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
1823          self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
1824    
1825          ss=s.substitute({s:numarray.zeros((2,))})
1826          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1827          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
1828          try:
1829            s.substitute({s:numarray.zeros((5,))})
1830            fail("illegal substition was successful")
1831          except TypeError:
1832            pass
1833    
1834          dsdarg=s.diff(Symbol(shape=()))
1835          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
1836          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
1837          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1838          dsdarg=s.diff(Symbol(shape=(2,)))
1839          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1840          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
1841          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1842          dsdarg=s.diff(Symbol(shape=(4, 5)))
1843          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1844          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
1845          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1846          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1847          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1848          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1849          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1850    
1851          dsds=s.diff(s)
1852          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
1853          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
1854          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
1855          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
1856          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
1857          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
1858    
1859          sa=s.getSubstitutedArguments({s2:-10})
1860          self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")
1861    
1862          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
1863          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
1864          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=1)),"Symbol is appropriate substitute")
1865          self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is not appropriate substitute (dim)")
1866          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1867          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
1868          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1869       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1870       def test_Symbol_rank1_d1_nargs1(self):
1871          s2=Symbol(shape=())
1872          s=Symbol(shape=(2,),dim=1,args=[s2])
1873          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
1874          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
1875          self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
1876          self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")
1877    
1878          ss=s.substitute({s:numarray.zeros((2,))})
1879          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1880          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
1881          try:
1882            s.substitute({s:numarray.zeros((5,))})
1883            fail("illegal substition was successful")
1884          except TypeError:
1885            pass
1886    
1887          dsdarg=s.diff(Symbol(shape=()))
1888          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
1889          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
1890          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1891          dsdarg=s.diff(Symbol(shape=(2,)))
1892          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1893          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
1894          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1895          dsdarg=s.diff(Symbol(shape=(4, 5)))
1896          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1897          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
1898          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1899          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1900          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1901          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1902          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1903    
1904          dsds=s.diff(s)
1905          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
1906          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
1907          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
1908          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
1909          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
1910          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
1911    
1912          self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")
1913          sa=s.getSubstitutedArguments({s2:-10})
1914          self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")
1915          self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")
1916    
1917          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
1918          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
1919          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=1)),"Symbol is appropriate substitute")
1920          self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is not appropriate substitute (dim)")
1921          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1922          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
1923          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1924       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1925       def test_Symbol_rank1_d1_nargs2(self):
1926          s2=Symbol(shape=())
1927          s=Symbol(shape=(2,),dim=1,args=[1, -1.0])
1928          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
1929          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
1930          self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
1931          self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")
1932    
1933          ss=s.substitute({s:numarray.zeros((2,))})
1934          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1935          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
1936          try:
1937            s.substitute({s:numarray.zeros((5,))})
1938            fail("illegal substition was successful")
1939          except TypeError:
1940            pass
1941    
1942          dsdarg=s.diff(Symbol(shape=()))
1943          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
1944          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
1945          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
1946          dsdarg=s.diff(Symbol(shape=(2,)))
1947          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
1948          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
1949          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
1950          dsdarg=s.diff(Symbol(shape=(4, 5)))
1951          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
1952          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
1953          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
1954          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
1955          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
1956          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
1957          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
1958    
1959          dsds=s.diff(s)
1960          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
1961          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
1962          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
1963          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
1964          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
1965          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
1966    
1967          self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")
1968          self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")
1969          sa=s.getSubstitutedArguments({s2:-10})
1970          self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")
1971          self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")
1972          self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")
1973    
1974          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
1975          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
1976          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=1)),"Symbol is appropriate substitute")
1977          self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is not appropriate substitute (dim)")
1978          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
1979          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
1980          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
1981       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1982       def test_Symbol_rank1_d2_nargs0(self):
1983          s2=Symbol(shape=())
1984          s=Symbol(shape=(2,),dim=2,args=[])
1985          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
1986          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
1987          self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
1988          self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
1989    
1990          ss=s.substitute({s:numarray.zeros((2,))})
1991          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
1992          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
1993          try:
1994            s.substitute({s:numarray.zeros((5,))})
1995            fail("illegal substition was successful")
1996          except TypeError:
1997            pass
1998    
1999          dsdarg=s.diff(Symbol(shape=()))
2000          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
2001          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
2002          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
2003          dsdarg=s.diff(Symbol(shape=(2,)))
2004          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
2005          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
2006          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
2007          dsdarg=s.diff(Symbol(shape=(4, 5)))
2008          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
2009          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
2010          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
2011          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
2012          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
2013          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
2014          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
2015    
2016          dsds=s.diff(s)
2017          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
2018          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
2019          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
2020          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
2021          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
2022          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
2023    
2024          sa=s.getSubstitutedArguments({s2:-10})
2025          self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")
2026    
2027          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
2028          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
2029          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is appropriate substitute")
2030          self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is not appropriate substitute (dim)")
2031          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
2032          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
2033          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
2034       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2035       def test_Symbol_rank1_d2_nargs1(self):
2036          s2=Symbol(shape=())
2037          s=Symbol(shape=(2,),dim=2,args=[s2])
2038          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
2039          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
2040          self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
2041          self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")
2042    
2043          ss=s.substitute({s:numarray.zeros((2,))})
2044          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
2045          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
2046          try:
2047            s.substitute({s:numarray.zeros((5,))})
2048            fail("illegal substition was successful")
2049          except TypeError:
2050            pass
2051    
2052          dsdarg=s.diff(Symbol(shape=()))
2053          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
2054          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
2055          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
2056          dsdarg=s.diff(Symbol(shape=(2,)))
2057          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
2058          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
2059          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
2060          dsdarg=s.diff(Symbol(shape=(4, 5)))
2061          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
2062          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
2063          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
2064          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
2065          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
2066          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
2067          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
2068    
2069          dsds=s.diff(s)
2070          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
2071          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
2072          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
2073          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
2074          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
2075          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
2076    
2077          self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")
2078          sa=s.getSubstitutedArguments({s2:-10})
2079          self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")
2080          self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")
2081    
2082          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
2083          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
2084          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is appropriate substitute")
2085          self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is not appropriate substitute (dim)")
2086          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
2087          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
2088          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
2089       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2090       def test_Symbol_rank1_d2_nargs2(self):
2091          s2=Symbol(shape=())
2092          s=Symbol(shape=(2,),dim=2,args=[1, -1.0])
2093          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
2094          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
2095          self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
2096          self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")
2097    
2098          ss=s.substitute({s:numarray.zeros((2,))})
2099          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
2100          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
2101          try:
2102            s.substitute({s:numarray.zeros((5,))})
2103            fail("illegal substition was successful")
2104          except TypeError:
2105            pass
2106    
2107          dsdarg=s.diff(Symbol(shape=()))
2108          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
2109          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
2110          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
2111          dsdarg=s.diff(Symbol(shape=(2,)))
2112          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
2113          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
2114          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
2115          dsdarg=s.diff(Symbol(shape=(4, 5)))
2116          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
2117          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
2118          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
2119          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
2120          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
2121          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
2122          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
2123    
2124          dsds=s.diff(s)
2125          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
2126          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
2127          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
2128          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
2129          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
2130          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
2131    
2132          self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")
2133          self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")
2134          sa=s.getSubstitutedArguments({s2:-10})
2135          self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")
2136          self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")
2137          self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")
2138    
2139          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
2140          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
2141          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is appropriate substitute")
2142          self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is not appropriate substitute (dim)")
2143          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
2144          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
2145          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
2146       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2147       def test_Symbol_rank1_d3_nargs0(self):
2148          s2=Symbol(shape=())
2149          s=Symbol(shape=(2,),dim=3,args=[])
2150          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
2151          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
2152          self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
2153          self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
2154    
2155          ss=s.substitute({s:numarray.zeros((2,))})
2156          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
2157          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
2158          try:
2159            s.substitute({s:numarray.zeros((5,))})
2160            fail("illegal substition was successful")
2161          except TypeError:
2162            pass
2163    
2164          dsdarg=s.diff(Symbol(shape=()))
2165          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
2166          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
2167          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
2168          dsdarg=s.diff(Symbol(shape=(2,)))
2169          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
2170          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
2171          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
2172          dsdarg=s.diff(Symbol(shape=(4, 5)))
2173          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
2174          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
2175          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
2176          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
2177          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
2178          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
2179          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
2180    
2181          dsds=s.diff(s)
2182          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
2183          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
2184          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
2185          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
2186          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
2187          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
2188    
2189          sa=s.getSubstitutedArguments({s2:-10})
2190          self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")
2191    
2192          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
2193          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
2194          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is appropriate substitute")
2195          self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=4)),"Symbol is not appropriate substitute (dim)")
2196          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
2197          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
2198          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
2199       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2200       def test_Symbol_rank1_d3_nargs1(self):
2201          s2=Symbol(shape=())
2202          s=Symbol(shape=(2,),dim=3,args=[s2])
2203          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
2204          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
2205          self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
2206          self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")
2207    
2208          ss=s.substitute({s:numarray.zeros((2,))})
2209          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
2210          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
2211          try:
2212            s.substitute({s:numarray.zeros((5,))})
2213            fail("illegal substition was successful")
2214          except TypeError:
2215            pass
2216    
2217          dsdarg=s.diff(Symbol(shape=()))
2218          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
2219          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
2220          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
2221          dsdarg=s.diff(Symbol(shape=(2,)))
2222          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
2223          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
2224          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
2225          dsdarg=s.diff(Symbol(shape=(4, 5)))
2226          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
2227          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
2228          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
2229          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
2230          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
2231          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
2232          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
2233    
2234          dsds=s.diff(s)
2235          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
2236          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
2237          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
2238          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
2239          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
2240          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
2241    
2242          self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")
2243          sa=s.getSubstitutedArguments({s2:-10})
2244          self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")
2245          self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")
2246    
2247          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
2248          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
2249          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is appropriate substitute")
2250          self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=4)),"Symbol is not appropriate substitute (dim)")
2251          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
2252          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
2253          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
2254       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2255       def test_Symbol_rank1_d3_nargs2(self):
2256          s2=Symbol(shape=())
2257          s=Symbol(shape=(2,),dim=3,args=[1, -1.0])
2258          self.failUnlessEqual(s.getRank(),1,"wrong rank.")
2259          self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
2260          self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
2261          self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")
2262    
2263          ss=s.substitute({s:numarray.zeros((2,))})
2264          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
2265          self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")
2266          try:
2267            s.substitute({s:numarray.zeros((5,))})
2268            fail("illegal substition was successful")
2269          except TypeError:
2270            pass
2271    
2272          dsdarg=s.diff(Symbol(shape=()))
2273          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
2274          self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")
2275          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
2276          dsdarg=s.diff(Symbol(shape=(2,)))
2277          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
2278          self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")
2279          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
2280          dsdarg=s.diff(Symbol(shape=(4, 5)))
2281          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
2282          self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")
2283          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
2284          dsdarg=s.diff(Symbol(shape=(6, 2, 2)))
2285          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")
2286          self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")
2287          self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")
2288    
2289          dsds=s.diff(s)
2290          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
2291          self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")
2292          self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")
2293          self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")
2294          self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")
2295          self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")
2296    
2297          self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")
2298          self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")
2299          sa=s.getSubstitutedArguments({s2:-10})
2300          self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")
2301          self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")
2302          self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")
2303    
2304          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
2305          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
2306          self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is appropriate substitute")
2307          self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=4)),"Symbol is not appropriate substitute (dim)")
2308          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
2309          self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")
2310          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
2311       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2312       def test_Symbol_rank2_dNone_nargs0(self):
2313          s2=Symbol(shape=())
2314          s=Symbol(shape=(4, 5),dim=None,args=[])
2315          self.failUnlessEqual(s.getRank(),2,"wrong rank.")
2316          self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.")
2317          self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")
2318          self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
2319    
2320          ss=s.substitute({s:numarray.zeros((4, 5))})
2321          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
2322          self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape")
2323          try:
2324            s.substitute({s:numarray.zeros((5,))})
2325            fail("illegal substition was successful")
2326          except TypeError:
2327            pass
2328    
2329          dsdarg=s.diff(Symbol(shape=()))
2330          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
2331          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.")
2332          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
2333          dsdarg=s.diff(Symbol(shape=(2,)))
2334          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
2335          self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.")
2336          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
2337          dsdarg=s.diff(Symbol(shape=(4, 5)))
2338          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
2339          self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.")
2340          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
2341    
2342          dsds=s.diff(s)
2343          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
2344          self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.")
2345          self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).")
2346          self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).")
2347          self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).")
2348          self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).")
2349          self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).")
2350          self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).")
2351          self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).")
2352          self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).")
2353          self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).")
2354          self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).")
2355          self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).")
2356          self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).")
2357          self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).")
2358          self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).")
2359          self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).")
2360          self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).")
2361          self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).")
2362          self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).")
2363          self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).")
2364          self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).")
2365          self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).")
2366          self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).")
2367          self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (0,1,0,2).")
2368          self.failUnlessEqual(dsds[0,1,0,3],0.0,"ds/ds has wrong value at (0,1,0,3).")
2369          self.failUnlessEqual(dsds[0,1,0,4],0.0,"ds/ds has wrong value at (0,1,0,4).")
2370          self.failUnlessEqual(dsds[0,1,1,0],0.0,"ds/ds has wrong value at (0,1,1,0).")
2371          self.failUnlessEqual(dsds[0,1,1,1],0.0,"ds/ds has wrong value at (0,1,1,1).")
2372          self.failUnlessEqual(dsds[0,1,1,2],0.0,"ds/ds has wrong value at (0,1,1,2).")
2373          self.failUnlessEqual(dsds[0,1,1,3],0.0,"ds/ds has wrong value at (0,1,1,3).")
2374          self.failUnlessEqual(dsds[0,1,1,4],0.0,"ds/ds has wrong value at (0,1,1,4).")
2375          self.failUnlessEqual(dsds[0,1,2,0],0.0,"ds/ds has wrong value at (0,1,2,0).")
2376          self.failUnlessEqual(dsds[0,1,2,1],0.0,"ds/ds has wrong value at (0,1,2,1).")
2377          self.failUnlessEqual(dsds[0,1,2,2],0.0,"ds/ds has wrong value at (0,1,2,2).")
2378          self.failUnlessEqual(dsds[0,1,2,3],0.0,"ds/ds has wrong value at (0,1,2,3).")
2379          self.failUnlessEqual(dsds[0,1,2,4],0.0,"ds/ds has wrong value at (0,1,2,4).")
2380          self.failUnlessEqual(dsds[0,1,3,0],0.0,"ds/ds has wrong value at (0,1,3,0).")
2381          self.failUnlessEqual(dsds[0,1,3,1],0.0,"ds/ds has wrong value at (0,1,3,1).")
2382          self.failUnlessEqual(dsds[0,1,3,2],0.0,"ds/ds has wrong value at (0,1,3,2).")
2383          self.failUnlessEqual(dsds[0,1,3,3],0.0,"ds/ds has wrong value at (0,1,3,3).")
2384          self.failUnlessEqual(dsds[0,1,3,4],0.0,"ds/ds has wrong value at (0,1,3,4).")
2385          self.failUnlessEqual(dsds[0,2,0,0],0.0,"ds/ds has wrong value at (0,2,0,0).")
2386          self.failUnlessEqual(dsds[0,2,0,1],0.0,"ds/ds has wrong value at (0,2,0,1).")
2387          self.failUnlessEqual(dsds[0,2,0,2],1.0,"ds/ds has wrong value at (0,2,0,2).")
2388          self.failUnlessEqual(dsds[0,2,0,3],0.0,"ds/ds has wrong value at (0,2,0,3).")
2389          self.failUnlessEqual(dsds[0,2,0,4],0.0,"ds/ds has wrong value at (0,2,0,4).")
2390          self.failUnlessEqual(dsds[0,2,1,0],0.0,"ds/ds has wrong value at (0,2,1,0).")
2391          self.failUnlessEqual(dsds[0,2,1,1],0.0,"ds/ds has wrong value at (0,2,1,1).")
2392          self.failUnlessEqual(dsds[0,2,1,2],0.0,"ds/ds has wrong value at (0,2,1,2).")
2393          self.failUnlessEqual(dsds[0,2,1,3],0.0,"ds/ds has wrong value at (0,2,1,3).")
2394          self.failUnlessEqual(dsds[0,2,1,4],0.0,"ds/ds has wrong value at (0,2,1,4).")
2395          self.failUnlessEqual(dsds[0,2,2,0],0.0,"ds/ds has wrong value at (0,2,2,0).")
2396          self.failUnlessEqual(dsds[0,2,2,1],0.0,"ds/ds has wrong value at (0,2,2,1).")
2397          self.failUnlessEqual(dsds[0,2,2,2],0.0,"ds/ds has wrong value at (0,2,2,2).")
2398          self.failUnlessEqual(dsds[0,2,2,3],0.0,"ds/ds has wrong value at (0,2,2,3).")
2399          self.failUnlessEqual(dsds[0,2,2,4],0.0,"ds/ds has wrong value at (0,2,2,4).")
2400          self.failUnlessEqual(dsds[0,2,3,0],0.0,"ds/ds has wrong value at (0,2,3,0).")
2401          self.failUnlessEqual(dsds[0,2,3,1],0.0,"ds/ds has wrong value at (0,2,3,1).")
2402          self.failUnlessEqual(dsds[0,2,3,2],0.0,"ds/ds has wrong value at (0,2,3,2).")
2403          self.failUnlessEqual(dsds[0,2,3,3],0.0,"ds/ds has wrong value at (0,2,3,3).")
2404          self.failUnlessEqual(dsds[0,2,3,4],0.0,"ds/ds has wrong value at (0,2,3,4).")
2405          self.failUnlessEqual(dsds[0,3,0,0],0.0,"ds/ds has wrong value at (0,3,0,0).")
2406          self.failUnlessEqual(dsds[0,3,0,1],0.0,"ds/ds has wrong value at (0,3,0,1).")
2407          self.failUnlessEqual(dsds[0,3,0,2],0.0,"ds/ds has wrong value at (0,3,0,2).")
2408          self.failUnlessEqual(dsds[0,3,0,3],1.0,"ds/ds has wrong value at (0,3,0,3).")
2409          self.failUnlessEqual(dsds[0,3,0,4],0.0,"ds/ds has wrong value at (0,3,0,4).")
2410          self.failUnlessEqual(dsds[0,3,1,0],0.0,"ds/ds has wrong value at (0,3,1,0).")
2411          self.failUnlessEqual(dsds[0,3,1,1],0.0,"ds/ds has wrong value at (0,3,1,1).")
2412          self.failUnlessEqual(dsds[0,3,1,2],0.0,"ds/ds has wrong value at (0,3,1,2).")
2413          self.failUnlessEqual(dsds[0,3,1,3],0.0,"ds/ds has wrong value at (0,3,1,3).")
2414          self.failUnlessEqual(dsds[0,3,1,4],0.0,"ds/ds has wrong value at (0,3,1,4).")
2415          self.failUnlessEqual(dsds[0,3,2,0],0.0,"ds/ds has wrong value at (0,3,2,0).")
2416          self.failUnlessEqual(dsds[0,3,2,1],0.0,"ds/ds has wrong value at (0,3,2,1).")
2417          self.failUnlessEqual(dsds[0,3,2,2],0.0,"ds/ds has wrong value at (0,3,2,2).")
2418          self.failUnlessEqual(dsds[0,3,2,3],0.0,"ds/ds has wrong value at (0,3,2,3).")
2419          self.failUnlessEqual(dsds[0,3,2,4],0.0,"ds/ds has wrong value at (0,3,2,4).")
2420          self.failUnlessEqual(dsds[0,3,3,0],0.0,"ds/ds has wrong value at (0,3,3,0).")
2421          self.failUnlessEqual(dsds[0,3,3,1],0.0,"ds/ds has wrong value at (0,3,3,1).")
2422          self.failUnlessEqual(dsds[0,3,3,2],0.0,"ds/ds has wrong value at (0,3,3,2).")
2423          self.failUnlessEqual(dsds[0,3,3,3],0.0,"ds/ds has wrong value at (0,3,3,3).")
2424          self.failUnlessEqual(dsds[0,3,3,4],0.0,"ds/ds has wrong value at (0,3,3,4).")
2425          self.failUnlessEqual(dsds[0,4,0,0],0.0,"ds/ds has wrong value at (0,4,0,0).")
2426          self.failUnlessEqual(dsds[0,4,0,1],0.0,"ds/ds has wrong value at (0,4,0,1).")
2427          self.failUnlessEqual(dsds[0,4,0,2],0.0,"ds/ds has wrong value at (0,4,0,2).")
2428          self.failUnlessEqual(dsds[0,4,0,3],0.0,"ds/ds has wrong value at (0,4,0,3).")
2429          self.failUnlessEqual(dsds[0,4,0,4],1.0,"ds/ds has wrong value at (0,4,0,4).")
2430          self.failUnlessEqual(dsds[0,4,1,0],0.0,"ds/ds has wrong value at (0,4,1,0).")
2431          self.failUnlessEqual(dsds[0,4,1,1],0.0,"ds/ds has wrong value at (0,4,1,1).")
2432          self.failUnlessEqual(dsds[0,4,1,2],0.0,"ds/ds has wrong value at (0,4,1,2).")
2433          self.failUnlessEqual(dsds[0,4,1,3],0.0,"ds/ds has wrong value at (0,4,1,3).")
2434          self.failUnlessEqual(dsds[0,4,1,4],0.0,"ds/ds has wrong value at (0,4,1,4).")
2435          self.failUnlessEqual(dsds[0,4,2,0],0.0,"ds/ds has wrong value at (0,4,2,0).")
2436          self.failUnlessEqual(dsds[0,4,2,1],0.0,"ds/ds has wrong value at (0,4,2,1).")
2437          self.failUnlessEqual(dsds[0,4,2,2],0.0,"ds/ds has wrong value at (0,4,2,2).")
2438          self.failUnlessEqual(dsds[0,4,2,3],0.0,"ds/ds has wrong value at (0,4,2,3).")
2439          self.failUnlessEqual(dsds[0,4,2,4],0.0,"ds/ds has wrong value at (0,4,2,4).")
2440          self.failUnlessEqual(dsds[0,4,3,0],0.0,"ds/ds has wrong value at (0,4,3,0).")
2441          self.failUnlessEqual(dsds[0,4,3,1],0.0,"ds/ds has wrong value at (0,4,3,1).")
2442          self.failUnlessEqual(dsds[0,4,3,2],0.0,"ds/ds has wrong value at (0,4,3,2).")
2443          self.failUnlessEqual(dsds[0,4,3,3],0.0,"ds/ds has wrong value at (0,4,3,3).")
2444          self.failUnlessEqual(dsds[0,4,3,4],0.0,"ds/ds has wrong value at (0,4,3,4).")
2445          self.failUnlessEqual(dsds[1,0,0,0],0.0,"ds/ds has wrong value at (1,0,0,0).")
2446          self.failUnlessEqual(dsds[1,0,0,1],0.0,"ds/ds has wrong value at (1,0,0,1).")
2447          self.failUnlessEqual(dsds[1,0,0,2],0.0,"ds/ds has wrong value at (1,0,0,2).")
2448          self.failUnlessEqual(dsds[1,0,0,3],0.0,"ds/ds has wrong value at (1,0,0,3).")
2449          self.failUnlessEqual(dsds[1,0,0,4],0.0,"ds/ds has wrong value at (1,0,0,4).")
2450          self.failUnlessEqual(dsds[1,0,1,0],1.0,"ds/ds has wrong value at (1,0,1,0).")
2451          self.failUnlessEqual(dsds[1,0,1,1],0.0,"ds/ds has wrong value at (1,0,1,1).")
2452          self.failUnlessEqual(dsds[1,0,1,2],0.0,"ds/ds has wrong value at (1,0,1,2).")
2453          self.failUnlessEqual(dsds[1,0,1,3],0.0,"ds/ds has wrong value at (1,0,1,3).")
2454          self.failUnlessEqual(dsds[1,0,1,4],0.0,"ds/ds has wrong value at (1,0,1,4).")
2455          self.failUnlessEqual(dsds[1,0,2,0],0.0,"ds/ds has wrong value at (1,0,2,0).")
2456          self.failUnlessEqual(dsds[1,0,2,1],0.0,"ds/ds has wrong value at (1,0,2,1).")
2457          self.failUnlessEqual(dsds[1,0,2,2],0.0,"ds/ds has wrong value at (1,0,2,2).")
2458          self.failUnlessEqual(dsds[1,0,2,3],0.0,"ds/ds has wrong value at (1,0,2,3).")
2459          self.failUnlessEqual(dsds[1,0,2,4],0.0,"ds/ds has wrong value at (1,0,2,4).")
2460          self.failUnlessEqual(dsds[1,0,3,0],0.0,"ds/ds has wrong value at (1,0,3,0).")
2461          self.failUnlessEqual(dsds[1,0,3,1],0.0,"ds/ds has wrong value at (1,0,3,1).")
2462          self.failUnlessEqual(dsds[1,0,3,2],0.0,"ds/ds has wrong value at (1,0,3,2).")
2463          self.failUnlessEqual(dsds[1,0,3,3],0.0,"ds/ds has wrong value at (1,0,3,3).")
2464          self.failUnlessEqual(dsds[1,0,3,4],0.0,"ds/ds has wrong value at (1,0,3,4).")
2465          self.failUnlessEqual(dsds[1,1,0,0],0.0,"ds/ds has wrong value at (1,1,0,0).")
2466          self.failUnlessEqual(dsds[1,1,0,1],0.0,"ds/ds has wrong value at (1,1,0,1).")
2467          self.failUnlessEqual(dsds[1,1,0,2],0.0,"ds/ds has wrong value at (1,1,0,2).")
2468          self.failUnlessEqual(dsds[1,1,0,3],0.0,"ds/ds has wrong value at (1,1,0,3).")
2469          self.failUnlessEqual(dsds[1,1,0,4],0.0,"ds/ds has wrong value at (1,1,0,4).")
2470          self.failUnlessEqual(dsds[1,1,1,0],0.0,"ds/ds has wrong value at (1,1,1,0).")
2471          self.failUnlessEqual(dsds[1,1,1,1],1.0,"ds/ds has wrong value at (1,1,1,1).")
2472          self.failUnlessEqual(dsds[1,1,1,2],0.0,"ds/ds has wrong value at (1,1,1,2).")
2473          self.failUnlessEqual(dsds[1,1,1,3],0.0,"ds/ds has wrong value at (1,1,1,3).")
2474          self.failUnlessEqual(dsds[1,1,1,4],0.0,"ds/ds has wrong value at (1,1,1,4).")
2475          self.failUnlessEqual(dsds[1,1,2,0],0.0,"ds/ds has wrong value at (1,1,2,0).")
2476          self.failUnlessEqual(dsds[1,1,2,1],0.0,"ds/ds has wrong value at (1,1,2,1).")
2477          self.failUnlessEqual(dsds[1,1,2,2],0.0,"ds/ds has wrong value at (1,1,2,2).")
2478          self.failUnlessEqual(dsds[1,1,2,3],0.0,"ds/ds has wrong value at (1,1,2,3).")
2479          self.failUnlessEqual(dsds[1,1,2,4],0.0,"ds/ds has wrong value at (1,1,2,4).")
2480          self.failUnlessEqual(dsds[1,1,3,0],0.0,"ds/ds has wrong value at (1,1,3,0).")
2481          self.failUnlessEqual(dsds[1,1,3,1],0.0,"ds/ds has wrong value at (1,1,3,1).")
2482          self.failUnlessEqual(dsds[1,1,3,2],0.0,"ds/ds has wrong value at (1,1,3,2).")
2483          self.failUnlessEqual(dsds[1,1,3,3],0.0,"ds/ds has wrong value at (1,1,3,3).")
2484          self.failUnlessEqual(dsds[1,1,3,4],0.0,"ds/ds has wrong value at (1,1,3,4).")
2485          self.failUnlessEqual(dsds[1,2,0,0],0.0,"ds/ds has wrong value at (1,2,0,0).")
2486          self.failUnlessEqual(dsds[1,2,0,1],0.0,"ds/ds has wrong value at (1,2,0,1).")
2487          self.failUnlessEqual(dsds[1,2,0,2],0.0,"ds/ds has wrong value at (1,2,0,2).")
2488          self.failUnlessEqual(dsds[1,2,0,3],0.0,"ds/ds has wrong value at (1,2,0,3).")
2489          self.failUnlessEqual(dsds[1,2,0,4],0.0,"ds/ds has wrong value at (1,2,0,4).")
2490          self.failUnlessEqual(dsds[1,2,1,0],0.0,"ds/ds has wrong value at (1,2,1,0).")
2491          self.failUnlessEqual(dsds[1,2,1,1],0.0,"ds/ds has wrong value at (1,2,1,1).")
2492          self.failUnlessEqual(dsds[1,2,1,2],1.0,"ds/ds has wrong value at (1,2,1,2).")
2493          self.failUnlessEqual(dsds[1,2,1,3],0.0,"ds/ds has wrong value at (1,2,1,3).")
2494          self.failUnlessEqual(dsds[1,2,1,4],0.0,"ds/ds has wrong value at (1,2,1,4).")
2495          self.failUnlessEqual(dsds[1,2,2,0],0.0,"ds/ds has wrong value at (1,2,2,0).")
2496          self.failUnlessEqual(dsds[1,2,2,1],0.0,"ds/ds has wrong value at (1,2,2,1).")
2497          self.failUnlessEqual(dsds[1,2,2,2],0.0,"ds/ds has wrong value at (1,2,2,2).")
2498          self.failUnlessEqual(dsds[1,2,2,3],0.0,"ds/ds has wrong value at (1,2,2,3).")
2499          self.failUnlessEqual(dsds[1,2,2,4],0.0,"ds/ds has wrong value at (1,2,2,4).")
2500          self.failUnlessEqual(dsds[1,2,3,0],0.0,"ds/ds has wrong value at (1,2,3,0).")
2501          self.failUnlessEqual(dsds[1,2,3,1],0.0,"ds/ds has wrong value at (1,2,3,1).")
2502          self.failUnlessEqual(dsds[1,2,3,2],0.0,"ds/ds has wrong value at (1,2,3,2).")
2503          self.failUnlessEqual(dsds[1,2,3,3],0.0,"ds/ds has wrong value at (1,2,3,3).")
2504          self.failUnlessEqual(dsds[1,2,3,4],0.0,"ds/ds has wrong value at (1,2,3,4).")
2505          self.failUnlessEqual(dsds[1,3,0,0],0.0,"ds/ds has wrong value at (1,3,0,0).")
2506          self.failUnlessEqual(dsds[1,3,0,1],0.0,"ds/ds has wrong value at (1,3,0,1).")
2507          self.failUnlessEqual(dsds[1,3,0,2],0.0,"ds/ds has wrong value at (1,3,0,2).")
2508          self.failUnlessEqual(dsds[1,3,0,3],0.0,"ds/ds has wrong value at (1,3,0,3).")
2509          self.failUnlessEqual(dsds[1,3,0,4],0.0,"ds/ds has wrong value at (1,3,0,4).")
2510          self.failUnlessEqual(dsds[1,3,1,0],0.0,"ds/ds has wrong value at (1,3,1,0).")
2511          self.failUnlessEqual(dsds[1,3,1,1],0.0,"ds/ds has wrong value at (1,3,1,1).")
2512          self.failUnlessEqual(dsds[1,3,1,2],0.0,"ds/ds has wrong value at (1,3,1,2).")
2513          self.failUnlessEqual(dsds[1,3,1,3],1.0,"ds/ds has wrong value at (1,3,1,3).")
2514          self.failUnlessEqual(dsds[1,3,1,4],0.0,"ds/ds has wrong value at (1,3,1,4).")
2515          self.failUnlessEqual(dsds[1,3,2,0],0.0,"ds/ds has wrong value at (1,3,2,0).")
2516          self.failUnlessEqual(dsds[1,3,2,1],0.0,"ds/ds has wrong value at (1,3,2,1).")
2517          self.failUnlessEqual(dsds[1,3,2,2],0.0,"ds/ds has wrong value at (1,3,2,2).")
2518          self.failUnlessEqual(dsds[1,3,2,3],0.0,"ds/ds has wrong value at (1,3,2,3).")
2519          self.failUnlessEqual(dsds[1,3,2,4],0.0,"ds/ds has wrong value at (1,3,2,4).")
2520          self.failUnlessEqual(dsds[1,3,3,0],0.0,"ds/ds has wrong value at (1,3,3,0).")
2521          self.failUnlessEqual(dsds[1,3,3,1],0.0,"ds/ds has wrong value at (1,3,3,1).")
2522          self.failUnlessEqual(dsds[1,3,3,2],0.0,"ds/ds has wrong value at (1,3,3,2).")
2523          self.failUnlessEqual(dsds[1,3,3,3],0.0,"ds/ds has wrong value at (1,3,3,3).")
2524          self.failUnlessEqual(dsds[1,3,3,4],0.0,"ds/ds has wrong value at (1,3,3,4).")
2525          self.failUnlessEqual(dsds[1,4,0,0],0.0,"ds/ds has wrong value at (1,4,0,0).")
2526          self.failUnlessEqual(dsds[1,4,0,1],0.0,"ds/ds has wrong value at (1,4,0,1).")
2527          self.failUnlessEqual(dsds[1,4,0,2],0.0,"ds/ds has wrong value at (1,4,0,2).")
2528          self.failUnlessEqual(dsds[1,4,0,3],0.0,"ds/ds has wrong value at (1,4,0,3).")
2529          self.failUnlessEqual(dsds[1,4,0,4],0.0,"ds/ds has wrong value at (1,4,0,4).")
2530          self.failUnlessEqual(dsds[1,4,1,0],0.0,"ds/ds has wrong value at (1,4,1,0).")
2531          self.failUnlessEqual(dsds[1,4,1,1],0.0,"ds/ds has wrong value at (1,4,1,1).")
2532          self.failUnlessEqual(dsds[1,4,1,2],0.0,"ds/ds has wrong value at (1,4,1,2).")
2533          self.failUnlessEqual(dsds[1,4,1,3],0.0,"ds/ds has wrong value at (1,4,1,3).")
2534          self.failUnlessEqual(dsds[1,4,1,4],1.0,"ds/ds has wrong value at (1,4,1,4).")
2535          self.failUnlessEqual(dsds[1,4,2,0],0.0,"ds/ds has wrong value at (1,4,2,0).")
2536          self.failUnlessEqual(dsds[1,4,2,1],0.0,"ds/ds has wrong value at (1,4,2,1).")
2537          self.failUnlessEqual(dsds[1,4,2,2],0.0,"ds/ds has wrong value at (1,4,2,2).")
2538          self.failUnlessEqual(dsds[1,4,2,3],0.0,"ds/ds has wrong value at (1,4,2,3).")
2539          self.failUnlessEqual(dsds[1,4,2,4],0.0,"ds/ds has wrong value at (1,4,2,4).")
2540          self.failUnlessEqual(dsds[1,4,3,0],0.0,"ds/ds has wrong value at (1,4,3,0).")
2541          self.failUnlessEqual(dsds[1,4,3,1],0.0,"ds/ds has wrong value at (1,4,3,1).")
2542          self.failUnlessEqual(dsds[1,4,3,2],0.0,"ds/ds has wrong value at (1,4,3,2).")
2543          self.failUnlessEqual(dsds[1,4,3,3],0.0,"ds/ds has wrong value at (1,4,3,3).")
2544          self.failUnlessEqual(dsds[1,4,3,4],0.0,"ds/ds has wrong value at (1,4,3,4).")
2545          self.failUnlessEqual(dsds[2,0,0,0],0.0,"ds/ds has wrong value at (2,0,0,0).")
2546          self.failUnlessEqual(dsds[2,0,0,1],0.0,"ds/ds has wrong value at (2,0,0,1).")
2547          self.failUnlessEqual(dsds[2,0,0,2],0.0,"ds/ds has wrong value at (2,0,0,2).")
2548          self.failUnlessEqual(dsds[2,0,0,3],0.0,"ds/ds has wrong value at (2,0,0,3).")
2549          self.failUnlessEqual(dsds[2,0,0,4],0.0,"ds/ds has wrong value at (2,0,0,4).")
2550          self.failUnlessEqual(dsds[2,0,1,0],0.0,"ds/ds has wrong value at (2,0,1,0).")
2551          self.failUnlessEqual(dsds[2,0,1,1],0.0,"ds/ds has wrong value at (2,0,1,1).")
2552          self.failUnlessEqual(dsds[2,0,1,2],0.0,"ds/ds has wrong value at (2,0,1,2).")
2553          self.failUnlessEqual(dsds[2,0,1,3],0.0,"ds/ds has wrong value at (2,0,1,3).")
2554          self.failUnlessEqual(dsds[2,0,1,4],0.0,"ds/ds has wrong value at (2,0,1,4).")
2555          self.failUnlessEqual(dsds[2,0,2,0],1.0,"ds/ds has wrong value at (2,0,2,0).")
2556          self.failUnlessEqual(dsds[2,0,2,1],0.0,"ds/ds has wrong value at (2,0,2,1).")
2557          self.failUnlessEqual(dsds[2,0,2,2],0.0,"ds/ds has wrong value at (2,0,2,2).")
2558          self.failUnlessEqual(dsds[2,0,2,3],0.0,"ds/ds has wrong value at (2,0,2,3).")
2559          self.failUnlessEqual(dsds[2,0,2,4],0.0,"ds/ds has wrong value at (2,0,2,4).")
2560          self.failUnlessEqual(dsds[2,0,3,0],0.0,"ds/ds has wrong value at (2,0,3,0).")
2561          self.failUnlessEqual(dsds[2,0,3,1],0.0,"ds/ds has wrong value at (2,0,3,1).")
2562          self.failUnlessEqual(dsds[2,0,3,2],0.0,"ds/ds has wrong value at (2,0,3,2).")
2563          self.failUnlessEqual(dsds[2,0,3,3],0.0,"ds/ds has wrong value at (2,0,3,3).")
2564          self.failUnlessEqual(dsds[2,0,3,4],0.0,"ds/ds has wrong value at (2,0,3,4).")
2565          self.failUnlessEqual(dsds[2,1,0,0],0.0,"ds/ds has wrong value at (2,1,0,0).")
2566          self.failUnlessEqual(dsds[2,1,0,1],0.0,"ds/ds has wrong value at (2,1,0,1).")
2567          self.failUnlessEqual(dsds[2,1,0,2],0.0,"ds/ds has wrong value at (2,1,0,2).")
2568          self.failUnlessEqual(dsds[2,1,0,3],0.0,"ds/ds has wrong value at (2,1,0,3).")
2569          self.failUnlessEqual(dsds[2,1,0,4],0.0,"ds/ds has wrong value at (2,1,0,4).")
2570          self.failUnlessEqual(dsds[2,1,1,0],0.0,"ds/ds has wrong value at (2,1,1,0).")
2571          self.failUnlessEqual(dsds[2,1,1,1],0.0,"ds/ds has wrong value at (2,1,1,1).")
2572          self.failUnlessEqual(dsds[2,1,1,2],0.0,"ds/ds has wrong value at (2,1,1,2).")
2573          self.failUnlessEqual(dsds[2,1,1,3],0.0,"ds/ds has wrong value at (2,1,1,3).")
2574          self.failUnlessEqual(dsds[2,1,1,4],0.0,"ds/ds has wrong value at (2,1,1,4).")
2575          self.failUnlessEqual(dsds[2,1,2,0],0.0,"ds/ds has wrong value at (2,1,2,0).")
2576          self.failUnlessEqual(dsds[2,1,2,1],1.0,"ds/ds has wrong value at (2,1,2,1).")
2577          self.failUnlessEqual(dsds[2,1,2,2],0.0,"ds/ds has wrong value at (2,1,2,2).")
2578          self.failUnlessEqual(dsds[2,1,2,3],0.0,"ds/ds has wrong value at (2,1,2,3).")
2579          self.failUnlessEqual(dsds[2,1,2,4],0.0,"ds/ds has wrong value at (2,1,2,4).")
2580          self.failUnlessEqual(dsds[2,1,3,0],0.0,"ds/ds has wrong value at (2,1,3,0).")
2581          self.failUnlessEqual(dsds[2,1,3,1],0.0,"ds/ds has wrong value at (2,1,3,1).")
2582          self.failUnlessEqual(dsds[2,1,3,2],0.0,"ds/ds has wrong value at (2,1,3,2).")
2583          self.failUnlessEqual(dsds[2,1,3,3],0.0,"ds/ds has wrong value at (2,1,3,3).")
2584          self.failUnlessEqual(dsds[2,1,3,4],0.0,"ds/ds has wrong value at (2,1,3,4).")
2585          self.failUnlessEqual(dsds[2,2,0,0],0.0,"ds/ds has wrong value at (2,2,0,0).")
2586          self.failUnlessEqual(dsds[2,2,0,1],0.0,"ds/ds has wrong value at (2,2,0,1).")
2587          self.failUnlessEqual(dsds[2,2,0,2],0.0,"ds/ds has wrong value at (2,2,0,2).")
2588          self.failUnlessEqual(dsds[2,2,0,3],0.0,"ds/ds has wrong value at (2,2,0,3).")
2589          self.failUnlessEqual(dsds[2,2,0,4],0.0,"ds/ds has wrong value at (2,2,0,4).")
2590          self.failUnlessEqual(dsds[2,2,1,0],0.0,"ds/ds has wrong value at (2,2,1,0).")
2591          self.failUnlessEqual(dsds[2,2,1,1],0.0,"ds/ds has wrong value at (2,2,1,1).")
2592          self.failUnlessEqual(dsds[2,2,1,2],0.0,"ds/ds has wrong value at (2,2,1,2).")
2593          self.failUnlessEqual(dsds[2,2,1,3],0.0,"ds/ds has wrong value at (2,2,1,3).")
2594          self.failUnlessEqual(dsds[2,2,1,4],0.0,"ds/ds has wrong value at (2,2,1,4).")
2595          self.failUnlessEqual(dsds[2,2,2,0],0.0,"ds/ds has wrong value at (2,2,2,0).")
2596          self.failUnlessEqual(dsds[2,2,2,1],0.0,"ds/ds has wrong value at (2,2,2,1).")
2597          self.failUnlessEqual(dsds[2,2,2,2],1.0,"ds/ds has wrong value at (2,2,2,2).")
2598          self.failUnlessEqual(dsds[2,2,2,3],0.0,"ds/ds has wrong value at (2,2,2,3).")
2599          self.failUnlessEqual(dsds[2,2,2,4],0.0,"ds/ds has wrong value at (2,2,2,4).")
2600          self.failUnlessEqual(dsds[2,2,3,0],0.0,"ds/ds has wrong value at (2,2,3,0).")
2601          self.failUnlessEqual(dsds[2,2,3,1],0.0,"ds/ds has wrong value at (2,2,3,1).")
2602          self.failUnlessEqual(dsds[2,2,3,2],0.0,"ds/ds has wrong value at (2,2,3,2).")
2603          self.failUnlessEqual(dsds[2,2,3,3],0.0,"ds/ds has wrong value at (2,2,3,3).")
2604          self.failUnlessEqual(dsds[2,2,3,4],0.0,"ds/ds has wrong value at (2,2,3,4).")
2605          self.failUnlessEqual(dsds[2,3,0,0],0.0,"ds/ds has wrong value at (2,3,0,0).")
2606          self.failUnlessEqual(dsds[2,3,0,1],0.0,"ds/ds has wrong value at (2,3,0,1).")
2607          self.failUnlessEqual(dsds[2,3,0,2],0.0,"ds/ds has wrong value at (2,3,0,2).")
2608          self.failUnlessEqual(dsds[2,3,0,3],0.0,"ds/ds has wrong value at (2,3,0,3).")
2609          self.failUnlessEqual(dsds[2,3,0,4],0.0,"ds/ds has wrong value at (2,3,0,4).")
2610          self.failUnlessEqual(dsds[2,3,1,0],0.0,"ds/ds has wrong value at (2,3,1,0).")
2611          self.failUnlessEqual(dsds[2,3,1,1],0.0,"ds/ds has wrong value at (2,3,1,1).")
2612          self.failUnlessEqual(dsds[2,3,1,2],0.0,"ds/ds has wrong value at (2,3,1,2).")
2613          self.failUnlessEqual(dsds[2,3,1,3],0.0,"ds/ds has wrong value at (2,3,1,3).")
2614          self.failUnlessEqual(dsds[2,3,1,4],0.0,"ds/ds has wrong value at (2,3,1,4).")
2615          self.failUnlessEqual(dsds[2,3,2,0],0.0,"ds/ds has wrong value at (2,3,2,0).")
2616          self.failUnlessEqual(dsds[2,3,2,1],0.0,"ds/ds has wrong value at (2,3,2,1).")
2617          self.failUnlessEqual(dsds[2,3,2,2],0.0,"ds/ds has wrong value at (2,3,2,2).")
2618          self.failUnlessEqual(dsds[2,3,2,3],1.0,"ds/ds has wrong value at (2,3,2,3).")
2619          self.failUnlessEqual(dsds[2,3,2,4],0.0,"ds/ds has wrong value at (2,3,2,4).")
2620          self.failUnlessEqual(dsds[2,3,3,0],0.0,"ds/ds has wrong value at (2,3,3,0).")
2621          self.failUnlessEqual(dsds[2,3,3,1],0.0,"ds/ds has wrong value at (2,3,3,1).")
2622          self.failUnlessEqual(dsds[2,3,3,2],0.0,"ds/ds has wrong value at (2,3,3,2).")
2623          self.failUnlessEqual(dsds[2,3,3,3],0.0,"ds/ds has wrong value at (2,3,3,3).")
2624          self.failUnlessEqual(dsds[2,3,3,4],0.0,"ds/ds has wrong value at (2,3,3,4).")
2625          self.failUnlessEqual(dsds[2,4,0,0],0.0,"ds/ds has wrong value at (2,4,0,0).")
2626          self.failUnlessEqual(dsds[2,4,0,1],0.0,"ds/ds has wrong value at (2,4,0,1).")
2627          self.failUnlessEqual(dsds[2,4,0,2],0.0,"ds/ds has wrong value at (2,4,0,2).")
2628          self.failUnlessEqual(dsds[2,4,0,3],0.0,"ds/ds has wrong value at (2,4,0,3).")
2629          self.failUnlessEqual(dsds[2,4,0,4],0.0,"ds/ds has wrong value at (2,4,0,4).")
2630          self.failUnlessEqual(dsds[2,4,1,0],0.0,"ds/ds has wrong value at (2,4,1,0).")
2631          self.failUnlessEqual(dsds[2,4,1,1],0.0,"ds/ds has wrong value at (2,4,1,1).")
2632          self.failUnlessEqual(dsds[2,4,1,2],0.0,"ds/ds has wrong value at (2,4,1,2).")
2633          self.failUnlessEqual(dsds[2,4,1,3],0.0,"ds/ds has wrong value at (2,4,1,3).")
2634          self.failUnlessEqual(dsds[2,4,1,4],0.0,"ds/ds has wrong value at (2,4,1,4).")
2635          self.failUnlessEqual(dsds[2,4,2,0],0.0,"ds/ds has wrong value at (2,4,2,0).")
2636          self.failUnlessEqual(dsds[2,4,2,1],0.0,"ds/ds has wrong value at (2,4,2,1).")
2637          self.failUnlessEqual(dsds[2,4,2,2],0.0,"ds/ds has wrong value at (2,4,2,2).")
2638          self.failUnlessEqual(dsds[2,4,2,3],0.0,"ds/ds has wrong value at (2,4,2,3).")
2639          self.failUnlessEqual(dsds[2,4,2,4],1.0,"ds/ds has wrong value at (2,4,2,4).")
2640          self.failUnlessEqual(dsds[2,4,3,0],0.0,"ds/ds has wrong value at (2,4,3,0).")
2641          self.failUnlessEqual(dsds[2,4,3,1],0.0,"ds/ds has wrong value at (2,4,3,1).")
2642          self.failUnlessEqual(dsds[2,4,3,2],0.0,"ds/ds has wrong value at (2,4,3,2).")
2643          self.failUnlessEqual(dsds[2,4,3,3],0.0,"ds/ds has wrong value at (2,4,3,3).")
2644          self.failUnlessEqual(dsds[2,4,3,4],0.0,"ds/ds has wrong value at (2,4,3,4).")
2645          self.failUnlessEqual(dsds[3,0,0,0],0.0,"ds/ds has wrong value at (3,0,0,0).")
2646          self.failUnlessEqual(dsds[3,0,0,1],0.0,"ds/ds has wrong value at (3,0,0,1).")
2647          self.failUnlessEqual(dsds[3,0,0,2],0.0,"ds/ds has wrong value at (3,0,0,2).")
2648          self.failUnlessEqual(dsds[3,0,0,3],0.0,"ds/ds has wrong value at (3,0,0,3).")
2649          self.failUnlessEqual(dsds[3,0,0,4],0.0,"ds/ds has wrong value at (3,0,0,4).")
2650          self.failUnlessEqual(dsds[3,0,1,0],0.0,"ds/ds has wrong value at (3,0,1,0).")
2651          self.failUnlessEqual(dsds[3,0,1,1],0.0,"ds/ds has wrong value at (3,0,1,1).")
2652          self.failUnlessEqual(dsds[3,0,1,2],0.0,"ds/ds has wrong value at (3,0,1,2).")
2653          self.failUnlessEqual(dsds[3,0,1,3],0.0,"ds/ds has wrong value at (3,0,1,3).")
2654          self.failUnlessEqual(dsds[3,0,1,4],0.0,"ds/ds has wrong value at (3,0,1,4).")
2655          self.failUnlessEqual(dsds[3,0,2,0],0.0,"ds/ds has wrong value at (3,0,2,0).")
2656          self.failUnlessEqual(dsds[3,0,2,1],0.0,"ds/ds has wrong value at (3,0,2,1).")
2657          self.failUnlessEqual(dsds[3,0,2,2],0.0,"ds/ds has wrong value at (3,0,2,2).")
2658          self.failUnlessEqual(dsds[3,0,2,3],0.0,"ds/ds has wrong value at (3,0,2,3).")
2659          self.failUnlessEqual(dsds[3,0,2,4],0.0,"ds/ds has wrong value at (3,0,2,4).")
2660          self.failUnlessEqual(dsds[3,0,3,0],1.0,"ds/ds has wrong value at (3,0,3,0).")
2661          self.failUnlessEqual(dsds[3,0,3,1],0.0,"ds/ds has wrong value at (3,0,3,1).")
2662          self.failUnlessEqual(dsds[3,0,3,2],0.0,"ds/ds has wrong value at (3,0,3,2).")
2663          self.failUnlessEqual(dsds[3,0,3,3],0.0,"ds/ds has wrong value at (3,0,3,3).")
2664          self.failUnlessEqual(dsds[3,0,3,4],0.0,"ds/ds has wrong value at (3,0,3,4).")
2665          self.failUnlessEqual(dsds[3,1,0,0],0.0,"ds/ds has wrong value at (3,1,0,0).")
2666          self.failUnlessEqual(dsds[3,1,0,1],0.0,"ds/ds has wrong value at (3,1,0,1).")
2667          self.failUnlessEqual(dsds[3,1,0,2],0.0,"ds/ds has wrong value at (3,1,0,2).")
2668          self.failUnlessEqual(dsds[3,1,0,3],0.0,"ds/ds has wrong value at (3,1,0,3).")
2669          self.failUnlessEqual(dsds[3,1,0,4],0.0,"ds/ds has wrong value at (3,1,0,4).")
2670          self.failUnlessEqual(dsds[3,1,1,0],0.0,"ds/ds has wrong value at (3,1,1,0).")
2671          self.failUnlessEqual(dsds[3,1,1,1],0.0,"ds/ds has wrong value at (3,1,1,1).")
2672          self.failUnlessEqual(dsds[3,1,1,2],0.0,"ds/ds has wrong value at (3,1,1,2).")
2673          self.failUnlessEqual(dsds[3,1,1,3],0.0,"ds/ds has wrong value at (3,1,1,3).")
2674          self.failUnlessEqual(dsds[3,1,1,4],0.0,"ds/ds has wrong value at (3,1,1,4).")
2675          self.failUnlessEqual(dsds[3,1,2,0],0.0,"ds/ds has wrong value at (3,1,2,0).")
2676          self.failUnlessEqual(dsds[3,1,2,1],0.0,"ds/ds has wrong value at (3,1,2,1).")
2677          self.failUnlessEqual(dsds[3,1,2,2],0.0,"ds/ds has wrong value at (3,1,2,2).")
2678          self.failUnlessEqual(dsds[3,1,2,3],0.0,"ds/ds has wrong value at (3,1,2,3).")
2679          self.failUnlessEqual(dsds[3,1,2,4],0.0,"ds/ds has wrong value at (3,1,2,4).")
2680          self.failUnlessEqual(dsds[3,1,3,0],0.0,"ds/ds has wrong value at (3,1,3,0).")
2681          self.failUnlessEqual(dsds[3,1,3,1],1.0,"ds/ds has wrong value at (3,1,3,1).")
2682          self.failUnlessEqual(dsds[3,1,3,2],0.0,"ds/ds has wrong value at (3,1,3,2).")
2683          self.failUnlessEqual(dsds[3,1,3,3],0.0,"ds/ds has wrong value at (3,1,3,3).")
2684          self.failUnlessEqual(dsds[3,1,3,4],0.0,"ds/ds has wrong value at (3,1,3,4).")
2685          self.failUnlessEqual(dsds[3,2,0,0],0.0,"ds/ds has wrong value at (3,2,0,0).")
2686          self.failUnlessEqual(dsds[3,2,0,1],0.0,"ds/ds has wrong value at (3,2,0,1).")
2687          self.failUnlessEqual(dsds[3,2,0,2],0.0,"ds/ds has wrong value at (3,2,0,2).")
2688          self.failUnlessEqual(dsds[3,2,0,3],0.0,"ds/ds has wrong value at (3,2,0,3).")
2689          self.failUnlessEqual(dsds[3,2,0,4],0.0,"ds/ds has wrong value at (3,2,0,4).")
2690          self.failUnlessEqual(dsds[3,2,1,0],0.0,"ds/ds has wrong value at (3,2,1,0).")
2691          self.failUnlessEqual(dsds[3,2,1,1],0.0,"ds/ds has wrong value at (3,2,1,1).")
2692          self.failUnlessEqual(dsds[3,2,1,2],0.0,"ds/ds has wrong value at (3,2,1,2).")
2693          self.failUnlessEqual(dsds[3,2,1,3],0.0,"ds/ds has wrong value at (3,2,1,3).")
2694          self.failUnlessEqual(dsds[3,2,1,4],0.0,"ds/ds has wrong value at (3,2,1,4).")
2695          self.failUnlessEqual(dsds[3,2,2,0],0.0,"ds/ds has wrong value at (3,2,2,0).")
2696          self.failUnlessEqual(dsds[3,2,2,1],0.0,"ds/ds has wrong value at (3,2,2,1).")
2697          self.failUnlessEqual(dsds[3,2,2,2],0.0,"ds/ds has wrong value at (3,2,2,2).")
2698          self.failUnlessEqual(dsds[3,2,2,3],0.0,"ds/ds has wrong value at (3,2,2,3).")
2699          self.failUnlessEqual(dsds[3,2,2,4],0.0,"ds/ds has wrong value at (3,2,2,4).")
2700          self.failUnlessEqual(dsds[3,2,3,0],0.0,"ds/ds has wrong value at (3,2,3,0).")
2701          self.failUnlessEqual(dsds[3,2,3,1],0.0,"ds/ds has wrong value at (3,2,3,1).")
2702          self.failUnlessEqual(dsds[3,2,3,2],1.0,"ds/ds has wrong value at (3,2,3,2).")
2703          self.failUnlessEqual(dsds[3,2,3,3],0.0,"ds/ds has wrong value at (3,2,3,3).")
2704          self.failUnlessEqual(dsds[3,2,3,4],0.0,"ds/ds has wrong value at (3,2,3,4).")
2705          self.failUnlessEqual(dsds[3,3,0,0],0.0,"ds/ds has wrong value at (3,3,0,0).")
2706          self.failUnlessEqual(dsds[3,3,0,1],0.0,"ds/ds has wrong value at (3,3,0,1).")
2707          self.failUnlessEqual(dsds[3,3,0,2],0.0,"ds/ds has wrong value at (3,3,0,2).")
2708          self.failUnlessEqual(dsds[3,3,0,3],0.0,"ds/ds has wrong value at (3,3,0,3).")
2709          self.failUnlessEqual(dsds[3,3,0,4],0.0,"ds/ds has wrong value at (3,3,0,4).")
2710          self.failUnlessEqual(dsds[3,3,1,0],0.0,"ds/ds has wrong value at (3,3,1,0).")
2711          self.failUnlessEqual(dsds[3,3,1,1],0.0,"ds/ds has wrong value at (3,3,1,1).")
2712          self.failUnlessEqual(dsds[3,3,1,2],0.0,"ds/ds has wrong value at (3,3,1,2).")
2713          self.failUnlessEqual(dsds[3,3,1,3],0.0,"ds/ds has wrong value at (3,3,1,3).")
2714          self.failUnlessEqual(dsds[3,3,1,4],0.0,"ds/ds has wrong value at (3,3,1,4).")
2715          self.failUnlessEqual(dsds[3,3,2,0],0.0,"ds/ds has wrong value at (3,3,2,0).")
2716          self.failUnlessEqual(dsds[3,3,2,1],0.0,"ds/ds has wrong value at (3,3,2,1).")
2717          self.failUnlessEqual(dsds[3,3,2,2],0.0,"ds/ds has wrong value at (3,3,2,2).")
2718          self.failUnlessEqual(dsds[3,3,2,3],0.0,"ds/ds has wrong value at (3,3,2,3).")
2719          self.failUnlessEqual(dsds[3,3,2,4],0.0,"ds/ds has wrong value at (3,3,2,4).")
2720          self.failUnlessEqual(dsds[3,3,3,0],0.0,"ds/ds has wrong value at (3,3,3,0).")
2721          self.failUnlessEqual(dsds[3,3,3,1],0.0,"ds/ds has wrong value at (3,3,3,1).")
2722          self.failUnlessEqual(dsds[3,3,3,2],0.0,"ds/ds has wrong value at (3,3,3,2).")
2723          self.failUnlessEqual(dsds[3,3,3,3],1.0,"ds/ds has wrong value at (3,3,3,3).")
2724          self.failUnlessEqual(dsds[3,3,3,4],0.0,"ds/ds has wrong value at (3,3,3,4).")
2725          self.failUnlessEqual(dsds[3,4,0,0],0.0,"ds/ds has wrong value at (3,4,0,0).")
2726          self.failUnlessEqual(dsds[3,4,0,1],0.0,"ds/ds has wrong value at (3,4,0,1).")
2727          self.failUnlessEqual(dsds[3,4,0,2],0.0,"ds/ds has wrong value at (3,4,0,2).")
2728          self.failUnlessEqual(dsds[3,4,0,3],0.0,"ds/ds has wrong value at (3,4,0,3).")
2729          self.failUnlessEqual(dsds[3,4,0,4],0.0,"ds/ds has wrong value at (3,4,0,4).")
2730          self.failUnlessEqual(dsds[3,4,1,0],0.0,"ds/ds has wrong value at (3,4,1,0).")
2731          self.failUnlessEqual(dsds[3,4,1,1],0.0,"ds/ds has wrong value at (3,4,1,1).")
2732          self.failUnlessEqual(dsds[3,4,1,2],0.0,"ds/ds has wrong value at (3,4,1,2).")
2733          self.failUnlessEqual(dsds[3,4,1,3],0.0,"ds/ds has wrong value at (3,4,1,3).")
2734          self.failUnlessEqual(dsds[3,4,1,4],0.0,"ds/ds has wrong value at (3,4,1,4).")
2735          self.failUnlessEqual(dsds[3,4,2,0],0.0,"ds/ds has wrong value at (3,4,2,0).")
2736          self.failUnlessEqual(dsds[3,4,2,1],0.0,"ds/ds has wrong value at (3,4,2,1).")
2737          self.failUnlessEqual(dsds[3,4,2,2],0.0,"ds/ds has wrong value at (3,4,2,2).")
2738          self.failUnlessEqual(dsds[3,4,2,3],0.0,"ds/ds has wrong value at (3,4,2,3).")
2739          self.failUnlessEqual(dsds[3,4,2,4],0.0,"ds/ds has wrong value at (3,4,2,4).")
2740          self.failUnlessEqual(dsds[3,4,3,0],0.0,"ds/ds has wrong value at (3,4,3,0).")
2741          self.failUnlessEqual(dsds[3,4,3,1],0.0,"ds/ds has wrong value at (3,4,3,1).")
2742          self.failUnlessEqual(dsds[3,4,3,2],0.0,"ds/ds has wrong value at (3,4,3,2).")
2743          self.failUnlessEqual(dsds[3,4,3,3],0.0,"ds/ds has wrong value at (3,4,3,3).")
2744          self.failUnlessEqual(dsds[3,4,3,4],1.0,"ds/ds has wrong value at (3,4,3,4).")
2745    
2746          sa=s.getSubstitutedArguments({s2:-10})
2747          self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")
2748    
2749          self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")
2750          self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")
2751          self.failUnless(s.isAppropriateValue(Symbol(shape=(4, 5),dim=None)),"Symbol is appropriate substitute")
2752          self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")
2753          self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")
2754          self.failUnless(s.isAppropriateValue(numarray.zeros((4, 5))),"NumArray is appropriate substitute")
2755          self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")
2756       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2757       def test_Symbol_rank2_dNone_nargs1(self):
2758          s2=Symbol(shape=())
2759          s=Symbol(shape=(4, 5),dim=None,args=[s2])
2760          self.failUnlessEqual(s.getRank(),2,"wrong rank.")
2761          self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.")
2762          self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")
2763          self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")
2764    
2765          ss=s.substitute({s:numarray.zeros((4, 5))})
2766          self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")
2767          self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape")
2768          try:
2769            s.substitute({s:numarray.zeros((5,))})
2770            fail("illegal substition was successful")
2771          except TypeError:
2772            pass
2773    
2774          dsdarg=s.diff(Symbol(shape=()))
2775          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")
2776          self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.")
2777          self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")
2778          dsdarg=s.diff(Symbol(shape=(2,)))
2779          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")
2780          self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.")
2781          self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")
2782          dsdarg=s.diff(Symbol(shape=(4, 5)))
2783          self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")
2784          self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.")
2785          self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")
2786    
2787          dsds=s.diff(s)
2788          self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")
2789          self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.")
2790          self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).")
2791          self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).")
2792          self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).")
2793          self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).")
2794          self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).")
2795          self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).")
2796          self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).")
2797          self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).")
2798          self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).")
2799          self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).")
2800          self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).")
2801          self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).")
2802          self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).")
2803          self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).")
2804          self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).")
2805          self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).")
2806          self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).")
2807          self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).")
2808          self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).")
2809          self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).")
2810          self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).")
2811          self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).")
2812          self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (