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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6651 - (show annotations)
Wed Feb 7 02:12:08 2018 UTC (20 months, 2 weeks ago) by jfenwick
File MIME type: text/x-python
File size: 13460 byte(s)
Make everyone sad by touching all the files

Copyright dates update

1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2018 by The University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Apache License, version 2.0
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 from __future__ import print_function, division
18
19 __copyright__="""Copyright (c) 2003-2018 by The University of Queensland
20 http://www.uq.edu.au
21 Primary Business: Queensland, Australia"""
22 __license__="""Licensed under the Apache License, version 2.0
23 http://www.apache.org/licenses/LICENSE-2.0"""
24 __url__="https://launchpad.net/escript-finley"
25
26 import esys.escriptcore.utestselect as unittest
27 from esys.escriptcore.testing import *
28 from test_util import Test_util, Test_Util_SpatialFunctions, \
29 Test_Util_SpatialFunctions_noGradOnBoundary, \
30 Test_Util_SpatialFunctions_noGradOnBoundary_noContact
31 from test_util_NaN_funcs import Test_util_NaN_funcs
32
33 from esys.escript import FunctionOnBoundary, getMPISizeWorld, HAVE_SYMBOLS
34 from esys.finley import Rectangle, Brick, JoinFaces, ReadMesh
35 import os
36
37 if HAVE_SYMBOLS:
38 from test_symfuncs import Test_symfuncs
39 else:
40 @unittest.skip("Skipping symbolic tests since sympy is not available")
41 class Test_symfuncs:
42 pass
43
44 try:
45 FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
46 except KeyError:
47 FINLEY_TEST_DATA='.'
48
49 FINLEY_TEST_MESH_PATH=os.path.join(FINLEY_TEST_DATA,"data_meshes")
50
51 FINLEY_MERGE_ERROR = "merge: more than 1 processor is not supported yet."
52
53 NE=4 # number elements, must be even
54
55 class Test_UtilOnFinley(Test_util):
56 def setUp(self):
57 try:
58 self.workdir=os.environ['FINLEY_WORKDIR']
59 except KeyError:
60 self.workdir='.'
61 self.domain = Rectangle(NE, NE+1, 2)
62 self.functionspace = FunctionOnBoundary(self.domain) # due to a bug in escript python needs to hold a reference to the domain
63 def tearDown(self):
64 del self.functionspace
65 del self.domain
66
67 class Test_SymFuncsOnFinley(Test_symfuncs,Test_util_NaN_funcs):
68 def setUp(self):
69 try:
70 self.workdir=os.environ['FINLEY_WORKDIR']
71 except KeyError:
72 self.workdir='.'
73 self.domain = Rectangle(NE, NE+1, 2)
74 self.functionspace = FunctionOnBoundary(self.domain) # due to a bug in escript python needs to hold a reference to the domain
75 def tearDown(self):
76 del self.functionspace
77 del self.domain
78
79 class Test_NaNFuncsOnFinley(Test_util_NaN_funcs):
80 def setUp(self):
81 try:
82 self.workdir=os.environ['FINLEY_WORKDIR']
83 except KeyError:
84 self.workdir='.'
85 self.domain = Rectangle(NE, NE+1, 2)
86 self.functionspace = FunctionOnBoundary(self.domain) # due to a bug in escript python needs to hold a reference to the domain
87 def tearDown(self):
88 del self.functionspace
89 del self.domain
90
91 class Test_Util_SpatialFunctionsOnFinleyTet2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
92 def setUp(self):
93 self.order=1
94 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_order1.fly"),optimize=False)
95 def tearDown(self):
96 del self.order
97 del self.domain
98
99 class Test_Util_SpatialFunctionsOnFinleyTet2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
100 def setUp(self):
101 self.order=2
102 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_order2.fly"),optimize=False)
103 def tearDown(self):
104 del self.order
105 del self.domain
106
107 class Test_Util_SpatialFunctionsOnFinleyTet2DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
108 def setUp(self):
109 self.order=1
110 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_macro.fly"),optimize=False)
111 def tearDown(self):
112 del self.order
113 del self.domain
114
115 class Test_Util_SpatialFunctionsOnFinleyTet3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
116 def setUp(self):
117 self.order=1
118 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_order1.fly"),optimize=False)
119 def tearDown(self):
120 del self.order
121 del self.domain
122
123 class Test_Util_SpatialFunctionsOnFinleyTet3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
124 def setUp(self):
125 self.order=2
126 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_order2.fly"),optimize=False)
127 def tearDown(self):
128 del self.order
129 del self.domain
130
131 class Test_Util_SpatialFunctionsOnFinleyTet3DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
132 def setUp(self):
133 self.order=1
134 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_macro.fly"),optimize=False)
135 def tearDown(self):
136 del self.order
137 del self.domain
138
139 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
140 def setUp(self):
141 self.order=1
142 self.domain = Rectangle(n0=NE,n1=NE,order=1,useElementsOnFace=0)
143 def tearDown(self):
144 del self.order
145 del self.domain
146
147 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
148 def setUp(self):
149 self.order=2
150 self.domain = Rectangle(n0=NE,n1=NE,order=2,useElementsOnFace=0)
151 def tearDown(self):
152 del self.order
153 del self.domain
154
155 class Test_Util_SpatialFunctionsOnFinleyHex2DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
156 def setUp(self):
157 self.order=1
158 self.domain = Rectangle(n0=NE,n1=NE,order=-1,useElementsOnFace=0)
159 def tearDown(self):
160 del self.order
161 del self.domain
162
163 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
164 def setUp(self):
165 self.order=1
166 self.domain = Brick(n0=NE,n1=NE,n2=NE,order=1,useElementsOnFace=0)
167 def tearDown(self):
168 del self.order
169 del self.domain
170
171 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
172 def setUp(self):
173 self.order=2
174 self.domain = Brick(n0=NE,n1=NE,n2=NE,order=2,useElementsOnFace=0)
175 def tearDown(self):
176 del self.order
177 del self.domain
178
179 class Test_Util_SpatialFunctionsOnFinleyHex3DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
180 def setUp(self):
181 self.order=1
182 self.domain = Brick(n0=NE,n1=NE,n2=NE,order=-1,useElementsOnFace=0)
183 def tearDown(self):
184 del self.order
185 del self.domain
186
187 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
188 def setUp(self):
189 self.order=1
190 d1 = Rectangle(n0=NE//2+1,n1=NE,l0=0.5,order=1,useElementsOnFace=0)
191 d2 = Rectangle(n0=NE//2,n1=NE,l0=0.5,order=1,useElementsOnFace=0)
192 d2.setX(d2.getX()+[0.5,0.])
193 if getMPISizeWorld() > 1:
194 with self.assertRaises(NotImplementedError) as pkg:
195 self.domain = JoinFaces([d1,d2],optimize=False)
196 e = pkg.exception
197 if FINLEY_MERGE_ERROR not in str(e):
198 raise e
199 raise unittest.SkipTest(FINLEY_MERGE_ERROR)
200 else:
201 self.domain = JoinFaces([d1,d2],optimize=False)
202 def tearDown(self):
203 del self.order
204 del self.domain
205
206 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
207 def setUp(self):
208 self.order=2
209 d1 = Rectangle(n0=NE//2,n1=NE,l0=0.5,order=2,useElementsOnFace=0)
210 d2 = Rectangle(n0=NE//2,n1=NE,l0=0.5,order=2,useElementsOnFace=0)
211 d2.setX(d2.getX()+[0.5,0.])
212 if getMPISizeWorld() > 1:
213 with self.assertRaises(NotImplementedError) as pkg:
214 self.domain = JoinFaces([d1,d2],optimize=False)
215 e = pkg.exception
216 if FINLEY_MERGE_ERROR not in str(e):
217 raise e
218 raise unittest.SkipTest(FINLEY_MERGE_ERROR)
219 else:
220 self.domain = JoinFaces([d1,d2],optimize=False)
221 def tearDown(self):
222 del self.order
223 del self.domain
224
225 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
226 def setUp(self):
227 self.order=1
228 d1 = Brick(n0=NE//2+1,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=0)
229 d2 = Brick(n0=NE//2,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=0)
230 d2.setX(d2.getX()+[0.5,0.,0.])
231 if getMPISizeWorld() > 1:
232 with self.assertRaises(NotImplementedError) as pkg:
233 self.domain = JoinFaces([d1,d2],optimize=False)
234 e = pkg.exception
235 if FINLEY_MERGE_ERROR not in str(e):
236 raise e
237 raise unittest.SkipTest(FINLEY_MERGE_ERROR)
238 else:
239 self.domain = JoinFaces([d1,d2],optimize=False)
240 def tearDown(self):
241 del self.order
242 del self.domain
243
244 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
245 def setUp(self):
246 self.order=2
247 d1 = Brick(n0=NE//2+1,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=0)
248 d2 = Brick(n0=NE//2,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=0)
249 d2.setX(d2.getX()+[0.5,0.,0.])
250 if getMPISizeWorld() > 1:
251 with self.assertRaises(NotImplementedError) as pkg:
252 self.domain = JoinFaces([d1,d2],optimize=False)
253 e = pkg.exception
254 if FINLEY_MERGE_ERROR not in str(e):
255 raise e
256 raise unittest.SkipTest(FINLEY_MERGE_ERROR)
257 else:
258 self.domain = JoinFaces([d1,d2],optimize=False)
259 def tearDown(self):
260 del self.order
261 del self.domain
262
263 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFacewithContact(Test_Util_SpatialFunctions):
264 def setUp(self):
265 self.order=1
266 d1 = Rectangle(n0=NE//2+1,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
267 d2 = Rectangle(n0=NE//2,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
268 d2.setX(d2.getX()+[0.5,0.])
269 if getMPISizeWorld() > 1:
270 with self.assertRaises(NotImplementedError) as pkg:
271 self.domain = JoinFaces([d1,d2],optimize=False)
272 e = pkg.exception
273 if FINLEY_MERGE_ERROR not in str(e):
274 raise e
275 raise unittest.SkipTest(FINLEY_MERGE_ERROR)
276 else:
277 self.domain = JoinFaces([d1,d2],optimize=False)
278 def tearDown(self):
279 del self.order
280 del self.domain
281
282 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFacewithContact(Test_Util_SpatialFunctions):
283 def setUp(self):
284 self.order=2
285 d1 = Rectangle(n0=NE//2+1,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
286 d2 = Rectangle(n0=NE//2,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
287 d2.setX(d2.getX()+[0.5,0.])
288 if getMPISizeWorld() > 1:
289 with self.assertRaises(NotImplementedError) as pkg:
290 self.domain = JoinFaces([d1,d2],optimize=False)
291 e = pkg.exception
292 if FINLEY_MERGE_ERROR not in str(e):
293 raise e
294 raise unittest.SkipTest(FINLEY_MERGE_ERROR)
295 else:
296 self.domain = JoinFaces([d1,d2],optimize=False)
297 def tearDown(self):
298 del self.order
299 del self.domain
300
301 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFacewithContact(Test_Util_SpatialFunctions):
302 def setUp(self):
303 self.order=1
304 d1 = Brick(n0=NE//2,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
305 d2 = Brick(n0=NE//2+1,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
306 d2.setX(d2.getX()+[0.5,0.,0.])
307 if getMPISizeWorld() > 1:
308 with self.assertRaises(NotImplementedError) as pkg:
309 self.domain = JoinFaces([d1,d2],optimize=False)
310 e = pkg.exception
311 if FINLEY_MERGE_ERROR not in str(e):
312 raise e
313 raise unittest.SkipTest(FINLEY_MERGE_ERROR)
314 else:
315 self.domain = JoinFaces([d1,d2],optimize=False)
316 def tearDown(self):
317 del self.order
318 del self.domain
319
320 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFacewithContact(Test_Util_SpatialFunctions):
321 def setUp(self):
322 self.order=2
323 d1 = Brick(n0=NE//2,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
324 d2 = Brick(n0=NE//2+1,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
325 d2.setX(d2.getX()+[0.5,0.,0.])
326 if getMPISizeWorld() > 1:
327 with self.assertRaises(NotImplementedError) as pkg:
328 self.domain = JoinFaces([d1,d2],optimize=False)
329 e = pkg.exception
330 if FINLEY_MERGE_ERROR not in str(e):
331 raise e
332 raise unittest.SkipTest(FINLEY_MERGE_ERROR)
333 else:
334 self.domain = JoinFaces([d1,d2],optimize=False)
335 def tearDown(self):
336 del self.order
337 del self.domain
338
339 if __name__ == '__main__':
340 run_tests(__name__, exit_on_failure=True)
341

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26