/[escript]/trunk/finley/test/python/run_utilOnFinley.py
ViewVC logotype

Annotation of /trunk/finley/test/python/run_utilOnFinley.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2881 - (hide annotations)
Thu Jan 28 02:03:15 2010 UTC (9 years, 8 months ago) by jfenwick
File MIME type: text/x-python
File size: 11087 byte(s)
Don't panic.
Updating copyright stamps

1 ksteube 1809
2     ########################################################
3 ksteube 1312 #
4 jfenwick 2881 # Copyright (c) 2003-2010 by University of Queensland
5 ksteube 1809 # Earth Systems Science Computational Center (ESSCC)
6     # http://www.uq.edu.au/esscc
7 ksteube 1312 #
8 ksteube 1809 # Primary Business: Queensland, Australia
9     # Licensed under the Open Software License version 3.0
10     # http://www.opensource.org/licenses/osl-3.0.php
11 ksteube 1312 #
12 ksteube 1809 ########################################################
13 jgs 153
14 jfenwick 2881 __copyright__="""Copyright (c) 2003-2010 by University of Queensland
15 ksteube 1809 Earth Systems Science Computational Center (ESSCC)
16     http://www.uq.edu.au/esscc
17     Primary Business: Queensland, Australia"""
18 elspeth 617 __license__="""Licensed under the Open Software License version 3.0
19 ksteube 1809 http://www.opensource.org/licenses/osl-3.0.php"""
20 jfenwick 2344 __url__="https://launchpad.net/escript-finley"
21 ksteube 1809
22 jgs 153 import unittest
23 gross 707 from test_util import Test_util as Test_util
24 gross 855 from test_util import Test_Util_SpatialFunctions, Test_Util_SpatialFunctions_noGradOnBoundary, Test_Util_SpatialFunctions_noGradOnBoundary_noContact
25 gross 707 from test_symbols import Test_symbols
26 gross 526
27 ksteube 1830 from esys.escript import *
28 gross 855 from esys.finley import Rectangle,Brick,JoinFaces,ReadMesh
29 jgs 153 import sys
30 gross 855 import os
31 jgs 153
32 gross 855 try:
33     FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
34     except KeyError:
35     FINLEY_TEST_DATA='.'
36    
37 gross 2416 FINLEY_TEST_MESH_PATH=os.path.join(FINLEY_TEST_DATA,"data_meshes")
38 gross 855
39    
40 gross 777 NE=4 # number elements, must be even
41    
42 gross 526 class Test_UtilOnFinley(Test_util,Test_symbols):
43 jgs 153 def setUp(self):
44 gross 777 self.domain =Rectangle(NE,NE+1,2)
45 gross 442 self.functionspace = FunctionOnBoundary(self.domain) # due to a bug in escript python needs to hold a reference to the domain
46 gross 798 def tearDown(self):
47     del self.functionspace
48     del self.domain
49 jgs 153
50 gross 855 class Test_Util_SpatialFunctionsOnFinleyTet2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
51 gross 437 def setUp(self):
52     self.order=1
53 gross 2416 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_order1.fly"),optimize=False)
54 gross 855 def tearDown(self):
55     del self.order
56     del self.domain
57    
58     class Test_Util_SpatialFunctionsOnFinleyTet2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
59     def setUp(self):
60     self.order=2
61 gross 2416 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_order2.fly"),optimize=False)
62 gross 855 def tearDown(self):
63     del self.order
64     del self.domain
65    
66 gross 2722 class Test_Util_SpatialFunctionsOnFinleyTet2DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
67     def setUp(self):
68     self.order=1
69     self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_macro.fly"),optimize=False)
70     def tearDown(self):
71     del self.order
72     del self.domain
73    
74 gross 855 class Test_Util_SpatialFunctionsOnFinleyTet3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
75     def setUp(self):
76     self.order=1
77 gross 2416 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_order1.fly"),optimize=False)
78 gross 855 def tearDown(self):
79     del self.order
80     del self.domain
81    
82     class Test_Util_SpatialFunctionsOnFinleyTet3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
83     def setUp(self):
84     self.order=2
85 gross 2416 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_order2.fly"),optimize=False)
86 gross 855 def tearDown(self):
87     del self.order
88     del self.domain
89    
90 gross 2722 class Test_Util_SpatialFunctionsOnFinleyTet3DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
91     def setUp(self):
92     self.order=1
93     self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_macro.fly"),optimize=False)
94     def tearDown(self):
95     del self.order
96     del self.domain
97    
98 gross 2748 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
99 gross 855 def setUp(self):
100     self.order=1
101 gross 2748 self.domain = Rectangle(n0=NE,n1=NE,order=1)
102     def tearDown(self):
103     del self.order
104     del self.domain
105    
106     class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
107     def setUp(self):
108     self.order=2
109     self.domain = Rectangle(n0=NE,n1=NE,order=2)
110     def tearDown(self):
111     del self.order
112     del self.domain
113    
114     class Test_Util_SpatialFunctionsOnFinleyHex2DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
115     def setUp(self):
116     self.order=1
117     self.domain = Rectangle(n0=NE,n1=NE,order=-1)
118     def tearDown(self):
119     del self.order
120     del self.domain
121    
122     class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
123     def setUp(self):
124     self.order=1
125     self.domain = Brick(n0=NE,n1=NE,n2=NE,order=1)
126     def tearDown(self):
127     del self.order
128     del self.domain
129    
130     class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
131     def setUp(self):
132     self.order=2
133     self.domain = Brick(n0=NE,n1=NE,n2=NE,order=2)
134     def tearDown(self):
135     del self.order
136     del self.domain
137    
138     class Test_Util_SpatialFunctionsOnFinleyHex3DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
139     def setUp(self):
140     self.order=1
141     self.domain = Brick(n0=NE,n1=NE,n2=NE,order=-1)
142     def tearDown(self):
143     del self.order
144     del self.domain
145    
146     class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
147     def setUp(self):
148     self.order=1
149 gross 777 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1)
150     d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1)
151 gross 437 d2.setX(d2.getX()+[0.5,0.])
152 ksteube 1312 self.domain = JoinFaces([d1,d2],optimize=False)
153 gross 798 def tearDown(self):
154     del self.order
155     del self.domain
156 gross 437
157 gross 2748 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
158 gross 437 def setUp(self):
159     self.order=2
160 gross 777 d1 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2)
161     d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2)
162 gross 437 d2.setX(d2.getX()+[0.5,0.])
163 ksteube 1312 self.domain = JoinFaces([d1,d2],optimize=False)
164 gross 798 def tearDown(self):
165     del self.order
166     del self.domain
167 gross 437
168 gross 2748 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
169 gross 437 def setUp(self):
170     self.order=1
171 gross 777 d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1)
172     d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1)
173 gross 437 d2.setX(d2.getX()+[0.5,0.,0.])
174 ksteube 1312 self.domain = JoinFaces([d1,d2],optimize=False)
175 gross 798 def tearDown(self):
176     del self.order
177     del self.domain
178 gross 437
179 gross 2748 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
180 gross 437 def setUp(self):
181     self.order=2
182 gross 777 d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2)
183     d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2)
184 gross 437 d2.setX(d2.getX()+[0.5,0.,0.])
185 ksteube 1312 self.domain = JoinFaces([d1,d2],optimize=False)
186 gross 798 def tearDown(self):
187     del self.order
188     del self.domain
189 gross 437
190 gross 2748 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFacewithContact(Test_Util_SpatialFunctions):
191 gross 777 def setUp(self):
192     self.order=1
193     d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
194     d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
195     d2.setX(d2.getX()+[0.5,0.])
196 ksteube 1312 self.domain = JoinFaces([d1,d2],optimize=False)
197 gross 798 def tearDown(self):
198     del self.order
199     del self.domain
200 gross 777
201 gross 2748 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFacewithContact(Test_Util_SpatialFunctions):
202 gross 777 def setUp(self):
203     self.order=2
204     d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
205     d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
206     d2.setX(d2.getX()+[0.5,0.])
207 ksteube 1312 self.domain = JoinFaces([d1,d2],optimize=False)
208 gross 798 def tearDown(self):
209     del self.order
210     del self.domain
211 gross 777
212 gross 2748 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFacewithContact(Test_Util_SpatialFunctions):
213 gross 777 def setUp(self):
214     self.order=1
215     d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
216     d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
217     d2.setX(d2.getX()+[0.5,0.,0.])
218 ksteube 1312 self.domain = JoinFaces([d1,d2],optimize=False)
219 gross 798 def tearDown(self):
220     del self.order
221     del self.domain
222 gross 777
223 gross 2748 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFacewithContact(Test_Util_SpatialFunctions):
224 gross 777 def setUp(self):
225     self.order=2
226     d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
227     d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
228     d2.setX(d2.getX()+[0.5,0.,0.])
229 ksteube 1312 self.domain = JoinFaces([d1,d2],optimize=False)
230 gross 798 def tearDown(self):
231     del self.order
232     del self.domain
233 gross 777
234 jgs 153 if __name__ == '__main__':
235     suite = unittest.TestSuite()
236 gross 857 if True:
237     suite.addTest(unittest.makeSuite(Test_UtilOnFinley))
238     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DOrder1))
239     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DOrder2))
240 gross 2722 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DMacro))
241 gross 859 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DOrder1))
242     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DOrder2))
243 gross 2722 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DMacro))
244 gross 2748 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder1))
245     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder2))
246     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DMacro))
247     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder1))
248     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder2))
249     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DMacro))
250 ksteube 1830 # These tests use JoinFaces and are not MPI parallel
251     if getMPISizeWorld() == 1:
252 gross 2748 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder1withContact))
253     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder2withContact))
254     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder1withContact))
255     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder2withContact))
256     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFacewithContact))
257     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFacewithContact))
258     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFacewithContact))
259     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFacewithContact))
260 gross 857 else:
261 gross 859 pass
262 jgs 153 s=unittest.TextTestRunner(verbosity=2).run(suite)
263 gross 1376 if not s.wasSuccessful(): sys.exit(1)
264    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26