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

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

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

trunk/escript/py_src/test_pdetools.py revision 609 by elspeth, Tue Mar 21 09:46:39 2006 UTC trunk/escript/test/python/test_pdetools.py revision 880 by gross, Wed Oct 25 23:58:16 2006 UTC
# Line 7  The tests must be linked with a Domain c Line 7  The tests must be linked with a Domain c
7    
8     from esys.finley import Rectangle     from esys.finley import Rectangle
9     class Test_LinearPDEOnFinley(Test_LinearPDE):     class Test_LinearPDEOnFinley(Test_LinearPDE):
10           RES_TOL=1-8
11         def setUp(self):         def setUp(self):
12             self.domain = Rectangle(10,10,2)             self.domain = Rectangle(10,10,2)
13           def tearDown(self):
14               del self.domain
15     suite = unittest.TestSuite()     suite = unittest.TestSuite()
16     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley))     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley))
17     unittest.TextTestRunner(verbosity=2).run(suite)     unittest.TextTestRunner(verbosity=2).run(suite)
18    
19    @var __author__: name of author
20    @var __copyright__: copyrights
21    @var __license__: licence agreement
22    @var __url__: url entry point on documentation
23    @var __version__: version
24    @var __date__: date of the version
25  """  """
26    
27  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
28  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
29                      http://www.access.edu.au                      http://www.access.edu.au
30                  Primary Business: Queensland, Australia"""                  Primary Business: Queensland, Australia"""
31  __licence__="""Licensed under the Open Software License version 3.0  __license__="""Licensed under the Open Software License version 3.0
32               http://www.opensource.org/licences/osl-3.0.php"""               http://www.opensource.org/licenses/osl-3.0.php"""
33  __url__="http://www.iservo.edu.au/esys/escript"  __url__="http://www.iservo.edu.au/esys/escript"
34  __version__="$Revision$"  __version__="$Revision$"
35  __date__="$Date$"  __date__="$Date$"
# Line 29  import unittest Line 38  import unittest
38  from esys.escript import *  from esys.escript import *
39  from esys.escript.pdetools import Locator,Projector,TimeIntegrationManager,NoPDE  from esys.escript.pdetools import Locator,Projector,TimeIntegrationManager,NoPDE
40    
41  class Test_pdetools(unittest.TestCase):  class Test_pdetools_noLumping(unittest.TestCase):
     TOL=1.e-6  
42      DEBUG=False      DEBUG=False
43      VERBOSE=False      VERBOSE=False
44      def test_TimeIntegrationManager_scalar(self):      def test_TimeIntegrationManager_scalar(self):
# Line 41  class Test_pdetools(unittest.TestCase): Line 49  class Test_pdetools(unittest.TestCase):
49             t+=dt             t+=dt
50             tm.checkin(dt,t)             tm.checkin(dt,t)
51          v_guess=tm.extrapolate(dt)          v_guess=tm.extrapolate(dt)
52          self.failUnless(abs(v_guess-(tm.getTime()+dt))<self.TOL,"extrapolation is wrong")          self.failUnless(abs(v_guess-(tm.getTime()+dt))<self.RES_TOL,"extrapolation is wrong")
53    
54      def test_TimeIntegrationManager_vector(self):      def test_TimeIntegrationManager_vector(self):
55          t=0.          t=0.
# Line 52  class Test_pdetools(unittest.TestCase): Line 60  class Test_pdetools(unittest.TestCase):
60             tm.checkin(dt,t,3*t)             tm.checkin(dt,t,3*t)
61          v_guess=tm.extrapolate(dt)          v_guess=tm.extrapolate(dt)
62          e=max(abs(v_guess[0]-(tm.getTime()+dt)),abs(v_guess[1]-(tm.getTime()+dt)*3.))          e=max(abs(v_guess[0]-(tm.getTime()+dt)),abs(v_guess[1]-(tm.getTime()+dt)*3.))
63          self.failUnless(e<self.TOL,"extrapolation is wrong")          self.failUnless(e<self.RES_TOL,"extrapolation is wrong")
64    
65      def test_Locator(self):      def test_Locator(self):
66          x=self.domain.getX()          x=self.domain.getX()
# Line 64  class Test_pdetools(unittest.TestCase): Line 72  class Test_pdetools(unittest.TestCase):
72    
73          xx=l.getX()          xx=l.getX()
74          self.failUnless(isinstance(xx,numarray.NumArray),"wrong vector type")          self.failUnless(isinstance(xx,numarray.NumArray),"wrong vector type")
75          self.failUnless(Lsup(xx-numarray.ones((self.domain.getDim(),)))<self.TOL,"location wrong")          self.failUnless(Lsup(xx-numarray.ones((self.domain.getDim(),)))<self.RES_TOL,"location wrong")
76          xx=l(x)          xx=l(x)
77          self.failUnless(isinstance(xx,numarray.NumArray),"wrong vector type")          self.failUnless(isinstance(xx,numarray.NumArray),"wrong vector type")
78          self.failUnless(Lsup(xx-numarray.ones((self.domain.getDim(),)))<self.TOL,"value wrong vector")          self.failUnless(Lsup(xx-numarray.ones((self.domain.getDim(),)))<self.RES_TOL,"value wrong vector")
79          xx=l(x[0]+x[1])          xx=l(x[0]+x[1])
80          self.failUnless(isinstance(xx,float),"wrong scalar type")          self.failUnless(isinstance(xx,float),"wrong scalar type")
81          self.failUnless(abs(xx-2.)<self.TOL,"value wrong scalar")          self.failUnless(abs(xx-2.)<self.RES_TOL,"value wrong scalar")
82    
83        def test_Locator_withList(self):
84            x=self.domain.getX()
85            arg=[numarray.ones((self.domain.getDim(),)), numarray.zeros((self.domain.getDim(),))]
86            l=Locator(self.domain,arg)
87            self.failUnless(ContinuousFunction(self.domain)==l.getFunctionSpace(),"wrong function space from domain")
88    
89            l=Locator(ContinuousFunction(self.domain),arg)
90            self.failUnless(ContinuousFunction(self.domain)==l.getFunctionSpace(),"wrong function space")
91    
92            xx=l.getX()
93            self.failUnless(isinstance(xx,list),"list expected")
94            for i in range(len(xx)):
95               self.failUnless(isinstance(xx[i],numarray.NumArray),"vector expected for %s item"%i)
96               self.failUnless(Lsup(xx[i]-arg[i])<self.RES_TOL,"%s-th location is wrong"%i)
97            xx=l(x)
98            self.failUnless(isinstance(xx,list),"list expected (2)")
99            for i in range(len(xx)):
100               self.failUnless(isinstance(xx[i],numarray.NumArray),"vector expected for %s item (2)"%i)
101               self.failUnless(Lsup(xx[i]-arg[i])<self.RES_TOL,"%s-th location is wrong (2)"%i)
102            xx=l(x[0]+x[1])
103            self.failUnless(isinstance(xx,list),"list expected (3)")
104            for i in range(len(xx)):
105               self.failUnless(isinstance(xx[i],float),"wrong scalar type")
106               self.failUnless(abs(xx[i]-(arg[i][0]+arg[i][1]))<self.RES_TOL,"value wrong scalar")
107                
108      def testProjector_rank0(self):      def testProjector_rank0(self):
109        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
110        p=Projector(self.domain,reduce=False,fast=False)        p=Projector(self.domain,reduce=False,fast=False)
111        td_ref=x[0]        td_ref=x[0]
112        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
113        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.TOL,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
114    
115      def testProjector_rank1(self):      def testProjector_rank1(self):
116        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
117        p=Projector(self.domain,reduce=False,fast=False)        p=Projector(self.domain,reduce=False,fast=False)
118        td_ref=x        td_ref=x
119        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
120        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.TOL,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
121    
122      def testProjector_rank2(self):      def testProjector_rank2(self):
123        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
124        p=Projector(self.domain,reduce=False,fast=False)        p=Projector(self.domain,reduce=False,fast=False)
125        td_ref=[[11.,12.],[21,22.]]*(x[0]+x[1])        td_ref=[[11.,12.],[21,22.]]*(x[0]+x[1])
126        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
127        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.TOL,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
128    
129      def testProjector_rank3(self):      def testProjector_rank3(self):
130        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
131        p=Projector(self.domain,reduce=False,fast=False)        p=Projector(self.domain,reduce=False,fast=False)
132        td_ref=[[[111.,112.],[121,122.]],[[211.,212.],[221,222.]]]*(x[0]+x[1])        td_ref=[[[111.,112.],[121,122.]],[[211.,212.],[221,222.]]]*(x[0]+x[1])
133        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
134        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.TOL,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
135    
136      def testProjector_rank4(self):      def testProjector_rank4(self):
137        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
138        p=Projector(self.domain,reduce=False,fast=False)        p=Projector(self.domain,reduce=False,fast=False)
139        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])
140        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
141        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.TOL,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
   
     def testProjector_rank0_fast(self):  
       x=ContinuousFunction(self.domain).getX()  
       h=Lsup(self.domain.getSize())  
       p=Projector(self.domain,reduce=False,fast=True)  
       td_ref=x[0]  
       td=p(td_ref.interpolate(Function(self.domain)))  
       self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")  
   
     def testProjector_rank1_fast(self):  
       x=ContinuousFunction(self.domain).getX()  
       h=Lsup(self.domain.getSize())  
       p=Projector(self.domain,reduce=False,fast=True)  
       td_ref=x  
       td=p(td_ref.interpolate(Function(self.domain)))  
       self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")  
   
     def testProjector_rank2_fast(self):  
       x=ContinuousFunction(self.domain).getX()  
       h=Lsup(self.domain.getSize())  
       p=Projector(self.domain,reduce=False,fast=True)  
       td_ref=[[11.,12.],[21,22.]]*(x[0]+x[1])  
       td=p(td_ref.interpolate(Function(self.domain)))  
       self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")  
142    
     def testProjector_rank3_fast(self):  
       x=ContinuousFunction(self.domain).getX()  
       h=Lsup(self.domain.getSize())  
       p=Projector(self.domain,reduce=False,fast=True)  
       td_ref=[[[111.,112.],[121,122.]],[[211.,212.],[221,222.]]]*(x[0]+x[1])  
       td=p(td_ref.interpolate(Function(self.domain)))  
       self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")  
   
     def testProjector_rank4_fast(self):  
       x=ContinuousFunction(self.domain).getX()  
       h=Lsup(self.domain.getSize())  
       p=Projector(self.domain,reduce=False,fast=True)  
       td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])  
       td=p(td_ref.interpolate(Function(self.domain)))  
       self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")  
143    
144      def testProjector_rank0_reduced(self):      def testProjector_rank0_reduced(self):
145        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
146        p=Projector(self.domain,reduce=True,fast=False)        p=Projector(self.domain,reduce=True,fast=False)
147        td_ref=x[0]        td_ref=x[0]
148        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
149        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.TOL,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
150    
151      def testProjector_rank1_reduced(self):      def testProjector_rank1_reduced(self):
152        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
153        p=Projector(self.domain,reduce=True,fast=False)        p=Projector(self.domain,reduce=True,fast=False)
154        td_ref=x        td_ref=x
155        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
156        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.TOL,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
157    
158      def testProjector_rank2_reduced(self):      def testProjector_rank2_reduced(self):
159        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
160        p=Projector(self.domain,reduce=True,fast=False)        p=Projector(self.domain,reduce=True,fast=False)
161        td_ref=[[11.,12.],[21,22.]]*(x[0]+x[1])        td_ref=[[11.,12.],[21,22.]]*(x[0]+x[1])
162        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
163        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.TOL,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
164    
165      def testProjector_rank3_reduced(self):      def testProjector_rank3_reduced(self):
166        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
167        p=Projector(self.domain,reduce=True,fast=False)        p=Projector(self.domain,reduce=True,fast=False)
168        td_ref=[[[111.,112.],[121,122.]],[[211.,212.],[221,222.]]]*(x[0]+x[1])        td_ref=[[[111.,112.],[121,122.]],[[211.,212.],[221,222.]]]*(x[0]+x[1])
169        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
170        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.TOL,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
171    
172      def testProjector_rank4_reduced(self):      def testProjector_rank4_reduced(self):
173        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
174        p=Projector(self.domain,reduce=True,fast=False)        p=Projector(self.domain,reduce=True,fast=False)
175        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])        td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])
176        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
177        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.TOL,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
178    
179      def testProjector_rank0_fast_reduced(self):      def testProjector_rank0_fast_reduced(self):
180        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
# Line 229  class Test_pdetools(unittest.TestCase): Line 223  class Test_pdetools(unittest.TestCase):
223        p.setValue(D=1.,Y=1.,q=msk)        p.setValue(D=1.,Y=1.,q=msk)
224        u=p.getSolution()        u=p.getSolution()
225        u_ex=(1.-msk)        u_ex=(1.-msk)
226        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.TOL,"value wrong")        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.RES_TOL,"value wrong")
227    
228      def test_NoPDE_scalar_missing_Y(self):      def test_NoPDE_scalar_missing_Y(self):
229        p=NoPDE(self.domain)        p=NoPDE(self.domain)
# Line 238  class Test_pdetools(unittest.TestCase): Line 232  class Test_pdetools(unittest.TestCase):
232        p.setValue(D=1.,q=msk,r=2.)        p.setValue(D=1.,q=msk,r=2.)
233        u=p.getSolution()        u=p.getSolution()
234        u_ex=msk*2.        u_ex=msk*2.
235        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.TOL,"value wrong")        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.RES_TOL,"value wrong")
236    
237      def test_NoPDE_scalar_constant(self):      def test_NoPDE_scalar_constant(self):
238        p=NoPDE(self.domain)        p=NoPDE(self.domain)
# Line 247  class Test_pdetools(unittest.TestCase): Line 241  class Test_pdetools(unittest.TestCase):
241        p.setValue(D=1.,Y=1.,q=msk,r=2.)        p.setValue(D=1.,Y=1.,q=msk,r=2.)
242        u=p.getSolution()        u=p.getSolution()
243        u_ex=(1.-msk)+msk*2.        u_ex=(1.-msk)+msk*2.
244        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.TOL,"value wrong")        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.RES_TOL,"value wrong")
245    
246      def test_NoPDE_scalar_variable(self):      def test_NoPDE_scalar_variable(self):
247        p=NoPDE(self.domain)        p=NoPDE(self.domain)
# Line 256  class Test_pdetools(unittest.TestCase): Line 250  class Test_pdetools(unittest.TestCase):
250        p.setValue(D=x[0],Y=2*x[0],q=msk,r=2.)        p.setValue(D=x[0],Y=2*x[0],q=msk,r=2.)
251        u=p.getSolution()        u=p.getSolution()
252        u_ex=2.        u_ex=2.
253        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.TOL,"value wrong")        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.RES_TOL,"value wrong")
254    
255      def test_NoPDE_vector_missing_Y(self):      def test_NoPDE_vector_missing_Y(self):
256        p=NoPDE(self.domain)        p=NoPDE(self.domain)
257        x=self.domain.getX()        x=self.domain.getX()
258        msk=whereZero(x[0])*[1.,0.]        msk=whereZero(x[0])*[1.,0.]
259        p.setValue(D=1.,q=msk,r=2.)        p.setValue(D=numarray.ones([2]),q=msk,r=2.)
260        u=p.getSolution()        u=p.getSolution()
261        u_ex=msk*2.        u_ex=msk*2.
262        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.TOL,"value wrong")        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.RES_TOL,"value wrong")
263    
264      def test_NoPDE_vector_missing_r(self):      def test_NoPDE_vector_missing_r(self):
265        p=NoPDE(self.domain)        p=NoPDE(self.domain)
266        x=self.domain.getX()        x=self.domain.getX()
267        msk=whereZero(x[0])*[1.,0.]        msk=whereZero(x[0])*[1.,0.]
268        p.setValue(D=1.,Y=1.,q=msk)        p.setValue(D=numarray.ones([2]),Y=numarray.ones([2]),q=msk)
269        u=p.getSolution()        u=p.getSolution()
270        u_ex=(1.-msk)        u_ex=(1.-msk)
271        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.TOL,"value wrong")        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.RES_TOL,"value wrong")
272    
273      def test_NoPDE_vector_constant(self):      def test_NoPDE_vector_constant(self):
274        p=NoPDE(self.domain)        p=NoPDE(self.domain)
275        x=self.domain.getX()        x=self.domain.getX()
276        msk=whereZero(x[0])*[1.,0.]        msk=whereZero(x[0])*[1.,0.]
277        p.setValue(D=1.,Y=1.,q=msk,r=2.)        p.setValue(D=numarray.ones([2]),Y=numarray.ones([2]),q=msk,r=2.)
278        u=p.getSolution()        u=p.getSolution()
279        u_ex=(1.-msk)+msk*2.        u_ex=(1.-msk)+msk*2.
280        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.TOL,"value wrong")        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.RES_TOL,"value wrong")
281    
282      def test_NoPDE_vector_variable(self):      def test_NoPDE_vector_variable(self):
283        p=NoPDE(self.domain)        p=NoPDE(self.domain)
# Line 292  class Test_pdetools(unittest.TestCase): Line 286  class Test_pdetools(unittest.TestCase):
286        p.setValue(D=x[:2],Y=2*x[:2],q=msk,r=2.)        p.setValue(D=x[:2],Y=2*x[:2],q=msk,r=2.)
287        u=p.getSolution()        u=p.getSolution()
288        u_ex=2.        u_ex=2.
289        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.TOL,"value wrong")        self.failUnless(Lsup(u_ex-u)<Lsup(u_ex)*self.RES_TOL,"value wrong")
290    
291    
292    class Test_pdetools(Test_pdetools_noLumping):
293        def testProjector_rank0_fast(self):
294          x=ContinuousFunction(self.domain).getX()
295          h=Lsup(self.domain.getSize())
296          p=Projector(self.domain,reduce=False,fast=True)
297          td_ref=x[0]
298          td=p(td_ref.interpolate(Function(self.domain)))
299          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
300    
301        def testProjector_rank1_fast(self):
302          x=ContinuousFunction(self.domain).getX()
303          h=Lsup(self.domain.getSize())
304          p=Projector(self.domain,reduce=False,fast=True)
305          td_ref=x
306          td=p(td_ref.interpolate(Function(self.domain)))
307          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
308    
309        def testProjector_rank2_fast(self):
310          x=ContinuousFunction(self.domain).getX()
311          h=Lsup(self.domain.getSize())
312          p=Projector(self.domain,reduce=False,fast=True)
313          td_ref=[[11.,12.],[21,22.]]*(x[0]+x[1])
314          td=p(td_ref.interpolate(Function(self.domain)))
315          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
316    
317        def testProjector_rank3_fast(self):
318          x=ContinuousFunction(self.domain).getX()
319          h=Lsup(self.domain.getSize())
320          p=Projector(self.domain,reduce=False,fast=True)
321          td_ref=[[[111.,112.],[121,122.]],[[211.,212.],[221,222.]]]*(x[0]+x[1])
322          td=p(td_ref.interpolate(Function(self.domain)))
323          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
324    
325        def testProjector_rank4_fast(self):
326          x=ContinuousFunction(self.domain).getX()
327          h=Lsup(self.domain.getSize())
328          p=Projector(self.domain,reduce=False,fast=True)
329          td_ref=[[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]]*(x[0]+x[1])
330          td=p(td_ref.interpolate(Function(self.domain)))
331          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")

Legend:
Removed from v.609  
changed lines
  Added in v.880

  ViewVC Help
Powered by ViewVC 1.1.26