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

Contents of /trunk/finley/test/python/run_linearPDEsOnFinley.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1376 - (show annotations)
Wed Jan 9 01:38:18 2008 UTC (12 years, 2 months ago) by gross
File MIME type: text/x-python
File size: 10487 byte(s)
inserted sys.exit(1) into the tests so scons can detect the failure of the test. 
A similar statement has been removed from an earlier as it produces problems on 64bit Linux. Previously exit(0) was called in case of success but now this is not done in order to avoid a fatal end of the program. in the case of an error in the test there could be a fatal error so but I guess that this not really a problem.

PS: the fact that signal 0 was returned even for the case of an error lead to the illusion that all tests have been completed successfully.


1 #
2 # $Id$
3 #
4 #######################################################
5 #
6 # Copyright 2003-2007 by ACceSS MNRF
7 # Copyright 2007 by University of Queensland
8 #
9 # http://esscc.uq.edu.au
10 # Primary Business: Queensland, Australia
11 # Licensed under the Open Software License version 3.0
12 # http://www.opensource.org/licenses/osl-3.0.php
13 #
14 #######################################################
15 #
16
17 """
18 Test suite for the linearPDE and pdetools test on finley
19
20 @remark:
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 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
30 http://www.access.edu.au
31 Primary Business: Queensland, Australia"""
32 __license__="""Licensed under the Open Software License version 3.0
33 http://www.opensource.org/licenses/osl-3.0.php"""
34 __author__="Lutz Gross, l.gross@uq.edu.au"
35 __url__="http://www.iservo.edu.au/esys/escript"
36 __version__="$Revision$"
37 __date__="$Date$"
38
39
40 import unittest
41 from test_linearPDEs import Test_Poisson,Test_LinearPDE, Test_LinearPDE_noLumping
42 from test_assemblage import Test_assemblage_2Do1, Test_assemblage_2Do2, Test_assemblage_3Do1, Test_assemblage_3Do2, \
43 Test_assemblage_2Do1_Contact,Test_assemblage_2Do2_Contact, Test_assemblage_3Do1_Contact, Test_assemblage_3Do2_Contact
44 from test_pdetools import Test_pdetools, Test_pdetools_noLumping
45 from esys.escript import *
46 from esys.finley import Rectangle,Brick,JoinFaces, ReadMesh
47 import sys
48
49
50 try:
51 FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
52 except KeyError:
53 FINLEY_TEST_DATA='.'
54
55 FINLEY_TEST_MESH_PATH=FINLEY_TEST_DATA+"/data_meshes/"
56
57 NE=6 # number of element in each spatial direction (must be even)
58
59 class Test_LinearPDEOnFinleyHex2DOrder1(Test_LinearPDE):
60 # class Test_LinearPDEOnFinleyHex2DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do1):
61 RES_TOL=1.e-7
62 ABS_TOL=1.e-8
63 def setUp(self):
64 self.domain = Rectangle(NE,NE,1)
65 def tearDown(self):
66 del self.domain
67
68 class Test_LinearPDEOnFinleyHex2DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do2):
69 RES_TOL=1.e-7
70 ABS_TOL=1.e-8
71 def setUp(self):
72 self.domain = Rectangle(NE,NE,2)
73 def tearDown(self):
74 del self.domain
75
76 class Test_LinearPDEOnFinleyHex3DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do1):
77 RES_TOL=1.e-7
78 ABS_TOL=1.e-8
79 def setUp(self):
80 self.domain = Brick(NE,NE,NE,1)
81
82 class Test_LinearPDEOnFinleyHex3DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do2):
83 RES_TOL=1.e-7
84 ABS_TOL=1.e-8
85 def setUp(self):
86 self.domain = Brick(NE,NE,NE,2)
87 def tearDown(self):
88 del self.domain
89
90 class Test_LinearPDEOnFinleyTet2DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_2Do1):
91 RES_TOL=1.e-7
92 ABS_TOL=1.e-8
93 def setUp(self):
94 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_2D_order1.fly",optimize=False)
95 def tearDown(self):
96 del self.domain
97
98 class Test_LinearPDEOnFinleyTet2DOrder2(Test_LinearPDE_noLumping,Test_pdetools_noLumping,Test_assemblage_2Do2):
99 RES_TOL=1.e-7
100 ABS_TOL=1.e-8
101 def setUp(self):
102 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_2D_order2.fly",optimize=False)
103 def tearDown(self):
104 del self.domain
105
106 class Test_LinearPDEOnFinleyTet3DOrder1(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do1):
107 RES_TOL=1.e-7
108 ABS_TOL=1.e-8
109 def setUp(self):
110 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order1.fly",optimize=False)
111
112 class Test_LinearPDEOnFinleyTet3DOrder2(Test_LinearPDE,Test_pdetools,Test_assemblage_3Do2):
113 RES_TOL=1.e-7
114 ABS_TOL=1.e-8
115 def setUp(self):
116 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order2.fly",optimize=False)
117 def tearDown(self):
118 del self.domain
119
120 class Test_PoissonOnFinley(Test_Poisson):
121 RES_TOL=1.e-7
122 ABS_TOL=1.e-8
123 def setUp(self):
124 self.domain = Rectangle(NE,NE,2)
125 def tearDown(self):
126 del self.domain
127
128
129 class Test_AssemblePDEwithFinley_2Do1_Contact(Test_assemblage_2Do1_Contact):
130 RES_TOL=1.e-7
131 ABS_TOL=1.e-8
132 def setUp(self):
133 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
134 x1 = ContinuousFunction(d1).getX()
135 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
136 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1)
137 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
138 d2.setX(d2.getX()+[0.5,0.])
139 self.domain = JoinFaces([d1,d2],optimize=False)
140 def tearDown(self):
141 del self.domain
142
143 class Test_AssemblePDEwithFinley_2Do2_Contact(Test_assemblage_2Do2_Contact):
144 RES_TOL=1.e-7
145 ABS_TOL=1.e-8
146 def setUp(self):
147 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
148 x1 = ContinuousFunction(d1).getX()
149 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
150 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2)
151 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
152 d2.setX(d2.getX()+[0.5,0.])
153 self.domain = JoinFaces([d1,d2],optimize=False)
154 def tearDown(self):
155 del self.domain
156
157 class Test_AssemblePDEwithFinley_3Do1_Contact(Test_assemblage_3Do1_Contact):
158 RES_TOL=1.e-7
159 ABS_TOL=1.e-8
160 def setUp(self):
161 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
162 x1 = ContinuousFunction(d1).getX()
163 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
164 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1)
165 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
166 d2.setX(d2.getX()+[0.5,0.,0.])
167 self.domain = JoinFaces([d1,d2],optimize=False)
168 def tearDown(self):
169 del self.domain
170
171 class Test_AssemblePDEwithFinley_3Do2_Contact(Test_assemblage_3Do2_Contact):
172 RES_TOL=1.e-7
173 ABS_TOL=1.e-8
174 def setUp(self):
175 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
176 x1 = ContinuousFunction(d1).getX()
177 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
178 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2)
179 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
180 d2.setX(d2.getX()+[0.5,0.,0.])
181 self.domain = JoinFaces([d1,d2],optimize=False)
182 def tearDown(self):
183 del self.domain
184
185
186 class Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace(Test_assemblage_2Do1_Contact):
187 RES_TOL=1.e-7
188 ABS_TOL=1.e-8
189 def setUp(self):
190 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
191 x1 = ContinuousFunction(d1).getX()
192 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
193 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1,useElementsOnFace=True)
194 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
195 d2.setX(d2.getX()+[0.5,0.])
196 self.domain = JoinFaces([d1,d2],optimize=False)
197 def tearDown(self):
198 del self.domain
199
200 class Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace(Test_assemblage_2Do2_Contact):
201 RES_TOL=1.e-7
202 ABS_TOL=1.e-8
203 def setUp(self):
204 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
205 x1 = ContinuousFunction(d1).getX()
206 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
207 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=2,useElementsOnFace=True)
208 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
209 d2.setX(d2.getX()+[0.5,0.])
210 self.domain = JoinFaces([d1,d2],optimize=False)
211 def tearDown(self):
212 del self.domain
213
214 class Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace(Test_assemblage_3Do1_Contact):
215 RES_TOL=1.e-7
216 ABS_TOL=1.e-8
217 def setUp(self):
218 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
219 x1 = ContinuousFunction(d1).getX()
220 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
221 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
222 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
223 d2.setX(d2.getX()+[0.5,0.,0.])
224 self.domain = JoinFaces([d1,d2],optimize=False)
225 def tearDown(self):
226 del self.domain
227
228 class Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace(Test_assemblage_3Do2_Contact):
229 RES_TOL=1.e-7
230 ABS_TOL=1.e-8
231 def setUp(self):
232 d1 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
233 x1 = ContinuousFunction(d1).getX()
234 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1)))
235 d2 = Brick(n0=int(NE/2),n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
236 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2)))
237 d2.setX(d2.getX()+[0.5,0.,0.])
238 self.domain = JoinFaces([d1,d2],optimize=False)
239 def tearDown(self):
240 del self.domain
241
242 if __name__ == '__main__':
243 suite = unittest.TestSuite()
244 if True:
245 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex2DOrder1))
246 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex2DOrder2))
247 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex3DOrder1))
248 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyHex3DOrder2))
249
250 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet2DOrder1))
251 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet2DOrder2))
252 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet3DOrder1))
253 suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinleyTet3DOrder2))
254
255 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact))
256 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact))
257 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact))
258 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact))
259 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do1_Contact_withElementsOnFace))
260 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_2Do2_Contact_withElementsOnFace))
261 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do1_Contact_withElementsOnFace))
262 suite.addTest(unittest.makeSuite(Test_AssemblePDEwithFinley_3Do2_Contact_withElementsOnFace))
263 else:
264 pass
265
266 s=unittest.TextTestRunner(verbosity=2).run(suite)
267 if not s.wasSuccessful(): sys.exit(1)
268

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26