/[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

revision 1071 by gross, Wed Oct 25 23:58:16 2006 UTC revision 1072 by gross, Thu Mar 29 06:44:30 2007 UTC
# Line 176  class Test_pdetools_noLumping(unittest.T Line 176  class Test_pdetools_noLumping(unittest.T
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.RES_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_with_reduced_input(self):
180        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
181        h=Lsup(self.domain.getSize())        p=Projector(self.domain,reduce=False,fast=False)
       p=Projector(self.domain,reduce=True,fast=True)  
182        td_ref=x[0]        td_ref=x[0]
183        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
184        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
185    
186      def testProjector_rank1_fast_reduced(self):      def testProjector_rank1_with_reduced_input(self):
187        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
188        h=Lsup(self.domain.getSize())        p=Projector(self.domain,reduce=False,fast=False)
       p=Projector(self.domain,reduce=True,fast=True)  
189        td_ref=x        td_ref=x
190        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
191        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
192    
193      def testProjector_rank2_fast_reduced(self):      def testProjector_rank2_with_reduced_input(self):
194        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
195        h=Lsup(self.domain.getSize())        p=Projector(self.domain,reduce=False,fast=False)
       p=Projector(self.domain,reduce=True,fast=True)  
196        td_ref=[[11.,12.],[21,22.]]*(x[0]+x[1])        td_ref=[[11.,12.],[21,22.]]*(x[0]+x[1])
197        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
198        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
199    
200      def testProjector_rank3_fast_reduced(self):      def testProjector_rank3_with_reduced_input(self):
201        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
202        h=Lsup(self.domain.getSize())        p=Projector(self.domain,reduce=False,fast=False)
       p=Projector(self.domain,reduce=True,fast=True)  
203        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])
204        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
205        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
206    
207      def testProjector_rank4_fast_reduced(self):      def testProjector_rank4_with_reduced_input(self):
208        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
209        h=Lsup(self.domain.getSize())        p=Projector(self.domain,reduce=False,fast=False)
       p=Projector(self.domain,reduce=True,fast=True)  
210        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])
211        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
212        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
213    
214    
215        def testProjector_rank0_reduced_with_reduced_input(self):
216          x=ContinuousFunction(self.domain).getX()
217          p=Projector(self.domain,reduce=True,fast=False)
218          td_ref=1.
219          td=p(Data(td_ref,ReducedFunction(self.domain)))
220          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
221    
222        def testProjector_rank1_reduced_with_reduced_input(self):
223          x=ContinuousFunction(self.domain).getX()
224          p=Projector(self.domain,reduce=True,fast=False)
225          td_ref=numarray.array([1.,2.,3.])
226          td=p(Data(td_ref,ReducedFunction(self.domain)))
227          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
228    
229        def testProjector_rank2_reduced_with_reduced_input(self):
230          x=ContinuousFunction(self.domain).getX()
231          p=Projector(self.domain,reduce=True,fast=False)
232          td_ref=numarray.array([[11.,12.],[21,22.]])
233          td=p(Data(td_ref,ReducedFunction(self.domain)))
234          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
235    
236        def testProjector_rank3_reduced_with_reduced_input(self):
237          x=ContinuousFunction(self.domain).getX()
238          p=Projector(self.domain,reduce=True,fast=False)
239          td_ref=numarray.array([[[111.,112.],[121,122.]],[[211.,212.],[221,222.]]])
240          td=p(Data(td_ref,ReducedFunction(self.domain)))
241          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
242    
243        def testProjector_rank4_reduced_with_reduced_input(self):
244          x=ContinuousFunction(self.domain).getX()
245          p=Projector(self.domain,reduce=True,fast=False)
246          td_ref=numarray.array([[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]])
247          td=p(Data(td_ref,ReducedFunction(self.domain)))
248          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*self.RES_TOL,"value wrong")
249    
250    
251      def test_NoPDE_scalar_missing_r(self):      def test_NoPDE_scalar_missing_r(self):
252        p=NoPDE(self.domain)        p=NoPDE(self.domain)
# Line 290  class Test_pdetools_noLumping(unittest.T Line 322  class Test_pdetools_noLumping(unittest.T
322    
323    
324  class Test_pdetools(Test_pdetools_noLumping):  class Test_pdetools(Test_pdetools_noLumping):
325      def testProjector_rank0_fast(self):      def testProjector_rank0_fast_reduced(self):
326        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
327        h=Lsup(self.domain.getSize())        h=Lsup(self.domain.getSize())
328        p=Projector(self.domain,reduce=False,fast=True)        p=Projector(self.domain,reduce=True,fast=True)
329        td_ref=x[0]        td_ref=x[0]
330        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
331        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
332    
333      def testProjector_rank1_fast(self):      def testProjector_rank1_fast_reduced(self):
334        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
335        h=Lsup(self.domain.getSize())        h=Lsup(self.domain.getSize())
336        p=Projector(self.domain,reduce=False,fast=True)        p=Projector(self.domain,reduce=True,fast=True)
337        td_ref=x        td_ref=x
338        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
339        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
340    
341      def testProjector_rank2_fast(self):      def testProjector_rank2_fast_reduced(self):
342        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
343        h=Lsup(self.domain.getSize())        h=Lsup(self.domain.getSize())
344        p=Projector(self.domain,reduce=False,fast=True)        p=Projector(self.domain,reduce=True,fast=True)
345        td_ref=[[11.,12.],[21,22.]]*(x[0]+x[1])        td_ref=[[11.,12.],[21,22.]]*(x[0]+x[1])
346        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
347        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
348    
349      def testProjector_rank3_fast(self):      def testProjector_rank3_fast_reduced(self):
350        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
351        h=Lsup(self.domain.getSize())        h=Lsup(self.domain.getSize())
352        p=Projector(self.domain,reduce=False,fast=True)        p=Projector(self.domain,reduce=True,fast=True)
353        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])
354        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
355        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
356    
357      def testProjector_rank4_fast(self):      def testProjector_rank4_fast_reduced(self):
358        x=ContinuousFunction(self.domain).getX()        x=ContinuousFunction(self.domain).getX()
359        h=Lsup(self.domain.getSize())        h=Lsup(self.domain.getSize())
360        p=Projector(self.domain,reduce=False,fast=True)        p=Projector(self.domain,reduce=True,fast=True)
361        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])
362        td=p(td_ref.interpolate(Function(self.domain)))        td=p(td_ref.interpolate(Function(self.domain)))
363        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")        self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
364    
365        def testProjector_rank0_fast_reduced_with_reduced_input(self):
366          x=ContinuousFunction(self.domain).getX()
367          h=Lsup(self.domain.getSize())
368          p=Projector(self.domain,reduce=True,fast=True)
369          td_ref=1.
370          td=p(Data(td_ref,ReducedFunction(self.domain)))
371          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
372    
373        def testProjector_rank1_fast_reduced_with_reduced_input(self):
374          x=ContinuousFunction(self.domain).getX()
375          h=Lsup(self.domain.getSize())
376          p=Projector(self.domain,reduce=True,fast=True)
377          td_ref=numarray.array([1.,2.,3.])
378          td=p(Data(td_ref,ReducedFunction(self.domain)))
379          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
380    
381        def testProjector_rank2_fast_reduced_with_reduced_input(self):
382          x=ContinuousFunction(self.domain).getX()
383          h=Lsup(self.domain.getSize())
384          p=Projector(self.domain,reduce=True,fast=True)
385          td_ref=numarray.array([[11.,12.],[21,22.]])
386          td=p(Data(td_ref,ReducedFunction(self.domain)))
387          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
388    
389        def testProjector_rank3_fast_reduced_with_reduced_input(self):
390          x=ContinuousFunction(self.domain).getX()
391          h=Lsup(self.domain.getSize())
392          p=Projector(self.domain,reduce=True,fast=True)
393          td_ref=numarray.array([[[111.,112.],[121,122.]],[[211.,212.],[221,222.]]])
394          td=p(Data(td_ref,ReducedFunction(self.domain)))
395          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
396    
397        def testProjector_rank4_fast_reduced_with_reduced_input(self):
398          x=ContinuousFunction(self.domain).getX()
399          h=Lsup(self.domain.getSize())
400          p=Projector(self.domain,reduce=True,fast=True)
401          td_ref=numarray.array([[[[1111.,1112.],[1121,1122.]],[[1211.,1212.],[1221,1222.]]],[[[2111.,2112.],[2121,2122.]],[[2211.,2212.],[2221,2222.]]]])
402          td=p(Data(td_ref,ReducedFunction(self.domain)))
403          self.failUnless(Lsup(td-td_ref)<Lsup(td_ref)*h,"value wrong")
404    

Legend:
Removed from v.1071  
changed lines
  Added in v.1072

  ViewVC Help
Powered by ViewVC 1.1.26