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

Annotation of /trunk/escript/test/python/LoadTest.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 373 - (hide annotations)
Fri Dec 16 01:31:06 2005 UTC (15 years, 4 months ago) by jgs
File MIME type: text/x-python
File size: 1643 byte(s)
modified number of data points in mesh to allow
testing with Bruce Function objects

1 jgs 123 """
2    
3     Load tests for escript/Data.
4    
5     Version $Id$
6    
7     """
8    
9     import sys
10     import unittest
11     import os
12    
13     import time
14    
15 jgs 149 from esys.escript import *
16 jgs 153 from esys import bruce
17 jgs 123
18     # ==============================================================
19    
20     arglist = [ \
21     [3,4], \
22     [[1,2],[3,4]], \
23     [[15,8],[12,8]], \
24     [[[15,8],[12,8]],[[-9,9],[13,8]]], \
25     3.0 \
26     ]
27    
28     # ==============================================================
29    
30     def prepareArg(val,ex,wh):
31     if ex=="Expanded":
32     exx=True
33     else:
34     exx=False
35     out=Data(val,what=wh,expand=exx)
36     return out
37    
38     def doTest(a,ex,wh):
39    
40     arg=prepareArg(a,ex,wh)
41    
42 jgs 315 arg._wherePositive()
43     arg._whereZero()
44     arg._trace()
45     arg._log()
46     arg._Lsup()
47     arg._maxval()
48     arg._sign()
49 jgs 123
50     arg+=arg
51     arg-=arg
52     arg*=arg
53     arg/=arg
54    
55     # ==============================================================
56    
57     testNum = 0
58    
59     totalTime = 0
60    
61 jgs 373 for x0 in [10, 100]:
62     for x1 in [10, 100]:
63 jgs 123
64     print "#### x0:", x0, "#### x1:", x1, "####"
65 jgs 153 msh=bruce.Rectangle(x0,x1)
66 jgs 123
67     for wh in [ContinuousFunction(msh),Function(msh)]:
68    
69     for ex in ["Constant","Expanded"]:
70    
71     for a in arglist:
72    
73     testNum+=1
74     print testNum, ": ----------------------------------------------"
75 jgs 373 print a, ex, wh
76 jgs 123
77     testElapsed = 0
78    
79     for j in range(10):
80    
81     starttime = time.clock()
82    
83     for i in range(1000):
84    
85     doTest(a,ex,wh)
86    
87     stoptime = time.clock()
88     elapsed = stoptime - starttime
89     testElapsed += elapsed
90     totalTime += elapsed
91    
92     print elapsed
93    
94     print "Test elapsed time: ", testElapsed
95    
96     print "Total elapsed time: ", totalTime
97    
98     # end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26