/[escript]/trunk/dudley/test/python/fixme_run_generators.py
ViewVC logotype

Contents of /trunk/dudley/test/python/fixme_run_generators.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4576 - (show annotations)
Mon Dec 9 23:35:30 2013 UTC (4 years, 10 months ago) by sshaw
File MIME type: text/x-python
File size: 36844 byte(s)
python3ified things, replaced mixed whitespace and xrange calls
1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2013 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development since 2012 by School of Earth Sciences
13 #
14 ##############################################################################
15
16 __copyright__="""Copyright (c) 2003-2013 by University of Queensland
17 http://www.uq.edu.au
18 Primary Business: Queensland, Australia"""
19 __license__="""Licensed under the Open Software License version 3.0
20 http://www.opensource.org/licenses/osl-3.0.php"""
21 __url__="https://launchpad.net/escript-finley"
22
23 """
24 checks the mesh generators against the reference meshes in test_meshes and test the dudley integration schemes.
25 """
26
27 import sys
28 import os
29 import unittest
30 from esys.escript import *
31 from esys.dudley import Rectangle,Brick,JoinFaces, ReadGmsh, ReadMesh
32
33 try:
34 DUDLEY_TEST_DATA=os.environ['DUDLEY_TEST_DATA']
35 except KeyError:
36 DUDLEY_TEST_DATA='.'
37
38 try:
39 DUDLEY_WORKDIR=os.environ['DUDLEY_WORKDIR']
40 except KeyError:
41 DUDLEY_WORKDIR='.'
42
43 DUDLEY_TEST_MESH_PATH=os.path.join(DUDLEY_TEST_DATA,"data_meshes")
44 #if os.name == "nt":
45 # DUDLEY_TEST_MESH_PATH = os.path.join(DUDLEY_TEST_MESH_PATH,"win32")
46 DUDLEY_WORKDIR_PATH=DUDLEY_WORKDIR
47
48 TEST_FILE_PRE="test_"
49 class Test_Generators(unittest.TestCase):
50
51 def checker(self,dom,reference):
52 dom_file=os.path.join(DUDLEY_WORKDIR_PATH,TEST_FILE_PRE+reference)
53 dom.write(dom_file)
54 # Uncomment this section to dump the files for regression testing
55 # if True:
56 # dom.write(os.path.join(DUDLEY_TEST_MESH_PATH,reference))
57 dom_string=open(dom_file).read().splitlines()
58 ref_string=open(os.path.join(DUDLEY_TEST_MESH_PATH,reference)).read().splitlines()
59 self.assertEqual(len(dom_string),len(ref_string),"number of lines in mesh files does not match reference")
60 for l in range(1,len(ref_string)):
61 line=dom_string[l].strip()
62 if os.name == "nt":
63 line=line.replace("e+00","e+0").replace("e-00","e-0")
64 self.assertEqual(line,ref_string[l].strip(),"line %d (%s) in mesh files does not match reference (%s)"%(l,ref_string[l].strip(),line))
65
66 def test_hex_2D_order1(self):
67 file="hex_2D_order1.msh"
68 my_dom=Rectangle(1,1,1)
69 self.checker(my_dom,file)
70
71 def test_hex_2D_order1_onFace(self):
72 file="hex_2D_order1_onFace.msh"
73 my_dom=Rectangle(1,1,1,useElementsOnFace=1)
74 self.checker(my_dom,file)
75
76 def test_hex_2D_order2(self):
77 file="hex_2D_order2.msh"
78 my_dom=Rectangle(1,1,2)
79 self.checker(my_dom,file)
80
81 def test_hex_2D_order1_macro(self):
82 file="hex_2D_order1_macro.msh"
83 my_dom=Rectangle(1,1,-1)
84 self.checker(my_dom,file)
85
86 def test_hex_2D_order2_onFace(self):
87 file="hex_2D_order2_onFace.msh"
88 my_dom=Rectangle(1,1,2,useElementsOnFace=1)
89 self.checker(my_dom,file)
90
91 def test_hex_3D_order1(self):
92 file="hex_3D_order1.msh"
93 my_dom=Brick(1,1,1,1)
94 self.checker(my_dom,file)
95
96 def test_hex_3D_order1_onFace(self):
97 file="hex_3D_order1_onFace.msh"
98 my_dom=Brick(1,1,1,1,useElementsOnFace=1)
99 self.checker(my_dom,file)
100
101 def test_hex_3D_order2(self):
102 file="hex_3D_order2.msh"
103 my_dom=Brick(1,1,1,2)
104 self.checker(my_dom,file)
105
106 def test_hex_3D_order2(self):
107 file="hex_3D_order1_macro.msh"
108 my_dom=Brick(1,1,1,-1)
109 self.checker(my_dom,file)
110
111 def test_hex_3D_order2_onFace(self):
112 file="hex_3D_order2_onFace.msh"
113 my_dom=Brick(1,1,1,2,useElementsOnFace=1)
114 self.checker(my_dom,file)
115
116 def test_hex_contact_2D_order1(self):
117 file="hex_contact_2D_order1.msh"
118 ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)
119 ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)
120 ms2.setX(ms2.getX()+[0,0.5])
121 my_dom=JoinFaces([ms1,ms2],optimize=False)
122 self.checker(my_dom,file)
123
124 def test_hex_contact_2D_order1_onFace(self):
125 file="hex_contact_2D_order1_onFace.msh"
126 ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)
127 ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)
128 ms2.setX(ms2.getX()+[0,0.5])
129 my_dom=JoinFaces([ms1,ms2],optimize=False)
130 self.checker(my_dom,file)
131
132 def test_hex_contact_2D_order2(self):
133 file="hex_contact_2D_order2.msh"
134 ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)
135 ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)
136 ms2.setX(ms2.getX()+[0,0.5])
137 my_dom=JoinFaces([ms1,ms2],optimize=False)
138 self.checker(my_dom,file)
139
140 def test_hex_contact_2D_order2_onFace(self):
141 file="hex_contact_2D_order2_onFace.msh"
142 ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)
143 ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)
144 ms2.setX(ms2.getX()+[0,0.5])
145 my_dom=JoinFaces([ms1,ms2],optimize=False)
146 self.checker(my_dom,file)
147
148 def test_hex_contact_3D_order1(self):
149 file="hex_contact_3D_order1.msh"
150 ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)
151 ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)
152 ms2.setX(ms2.getX()+[0,0,0.5])
153 my_dom=JoinFaces([ms1,ms2],optimize=False)
154 self.checker(my_dom,file)
155
156 def test_hex_contact_3D_order1_onFace(self):
157 file="hex_contact_3D_order1_onFace.msh"
158 ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)
159 ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)
160 ms2.setX(ms2.getX()+[0,0,0.5])
161 my_dom=JoinFaces([ms1,ms2],optimize=False)
162 self.checker(my_dom,file)
163
164 def test_hex_contact_3D_order2(self):
165 file="hex_contact_3D_order2.msh"
166 ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)
167 ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)
168 ms2.setX(ms2.getX()+[0,0,0.5])
169 my_dom=JoinFaces([ms1,ms2],optimize=False)
170 self.checker(my_dom,file)
171
172 def test_hex_contact_3D_order2_onFace(self):
173 file="hex_contact_3D_order2_onFace.msh"
174 ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)
175 ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)
176 ms2.setX(ms2.getX()+[0,0,0.5])
177 my_dom=JoinFaces([ms1,ms2],optimize=False)
178 self.checker(my_dom,file)
179
180 class Test_GMSHReader(unittest.TestCase):
181 def compare(self, test_file, reference_file):
182 dom_string=open(test_file).read().splitlines()
183 ref_string=open(reference_file).read().splitlines()
184 self.assertEqual(len(dom_string),len(ref_string),"number of lines in mesh files does not match reference")
185 for l in range(1,len(ref_string)):
186 line=dom_string[l].strip()
187 if os.name == "nt":
188 line=line.replace("e+00","e+0").replace("e-00","e-0")
189 self.assertEqual(line,ref_string[l].strip(),"line %d (%s) in mesh files does not match reference (%s)"%(l,ref_string[l].strip(),line))
190
191 def test_Tri3(self):
192 file="tri3_gmsh.msh"
193 ref ="tri3.fly"
194 test = os.path.join(DUDLEY_WORKDIR,"tri3_test.fly")
195 dom = ReadGmsh(os.path.join(DUDLEY_TEST_MESH_PATH,file),2,optimize=False)
196 dom.write(test)
197 self.compare(test, os.path.join(DUDLEY_TEST_MESH_PATH,ref))
198
199 def test_Tri6(self):
200 file="tri6_gmsh.msh"
201 ref="tri6.fly"
202 test = os.path.join(DUDLEY_WORKDIR,"tri6_test.fly")
203 dom = ReadGmsh(os.path.join(DUDLEY_TEST_MESH_PATH,file),2,optimize=False)
204 dom.write(test)
205 self.compare(test, os.path.join(DUDLEY_TEST_MESH_PATH,ref))
206
207 def test_Tri6_macro(self):
208 file="tri6_gmsh.msh"
209 ref="tri6_macro.fly"
210 test = os.path.join(DUDLEY_WORKDIR,"tri6_macro_test.fly")
211 dom = ReadGmsh(os.path.join(DUDLEY_TEST_MESH_PATH,file),2,useMacroElements=True,optimize=False)
212 dom.write(test)
213 self.compare(test, os.path.join(DUDLEY_TEST_MESH_PATH,ref))
214
215 def test_Tet4(self):
216 file="tet4_gmsh.msh"
217 ref="tet4.fly"
218 test = os.path.join(DUDLEY_WORKDIR,"tet4_test.fly")
219 dom = ReadGmsh(os.path.join(DUDLEY_TEST_MESH_PATH,file),3,optimize=False)
220 dom.write(test)
221 self.compare(test, os.path.join(DUDLEY_TEST_MESH_PATH,ref))
222
223 def test_Tet10(self):
224 file="tet10_gmsh.msh"
225 ref="tet10.fly"
226 test = os.path.join(DUDLEY_WORKDIR,"tet10_test.fly")
227 dom = ReadGmsh(os.path.join(DUDLEY_TEST_MESH_PATH,file),3,optimize=False)
228 dom.write(test)
229 self.compare(test, os.path.join(DUDLEY_TEST_MESH_PATH,ref))
230
231 def test_Tet10_macro(self):
232 file="tet10_gmsh.msh"
233 ref="tet10_macro.fly"
234 test = os.path.join(DUDLEY_WORKDIR,"tet10_macro_test.fly")
235 dom = ReadGmsh(os.path.join(DUDLEY_TEST_MESH_PATH,file),3,useMacroElements=True,optimize=False)
236 dom.write(test)
237 self.compare(test, os.path.join(DUDLEY_TEST_MESH_PATH,ref))
238
239 class Test_Reader(unittest.TestCase):
240 def test_ReadWriteTagNames(self):
241 file="hex_2D_order2.msh"
242 test = os.path.join(DUDLEY_WORKDIR,"test.fly")
243 dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,file),3,optimize=False)
244 insertTagNames(dom,A=1,B=2)
245 dom.write(test)
246 dom2 = ReadMesh(test,3,optimize=False)
247 t=getTagNames(dom)
248 self.assertTrue(len(t)==6)
249 self.assertTrue("A" in t)
250 self.assertTrue("B" in t)
251 self.assertTrue(dom2.getTag("A") == 1)
252 self.assertTrue(dom2.getTag("B") == 2)
253 self.assertTrue(dom2.isValidTagName("A"))
254 self.assertTrue(dom2.isValidTagName("B"))
255
256 class Test_Integration(unittest.TestCase):
257 TOL=EPSILON*500.
258 def __test_2DQ(self,dom,order):
259 x=Function(dom).getX()
260 x_bound=FunctionOnBoundary(dom).getX()
261 for i in range(order+1):
262 for j in range(order+1):
263 res=integrate(x[0]**i*x[1]**j)
264 ref=1./((i+1)*(j+1))
265 error=abs(res-ref)/abs(ref)
266 self.assertTrue(error<=self.TOL,"integration for order (%s,%s) failed. True value = %s, calculated = %s"%(i,j,ref,res))
267
268 res=integrate(x_bound[0]**i*x_bound[1]**j)
269 ref=0
270 if i == 0:
271 ref += 2./(j+1)
272 else:
273 ref += 1./(j+1)
274 if j == 0:
275 ref += 2./(i+1)
276 else:
277 ref += 1./(i+1)
278 error=abs(res-ref)/abs(ref)
279 self.assertTrue(error<=self.TOL,"surface integration for order (%s,%s) failed. True value = %s, calculated = %s"%(i,j,ref,res))
280
281 def __test_2DT(self,dom,order,raise_tol=1.):
282 x=Function(dom).getX()
283 x_bound=FunctionOnBoundary(dom).getX()
284 for i in range(order+1):
285 for j in range(order+1):
286 if i+j<=order:
287 res=integrate(x[0]**i*x[1]**j)
288 ref=1./((i+1)*(j+1))
289 error=abs(res-ref)/abs(ref)
290 # print order,error
291 self.assertTrue(error<=self.TOL*raise_tol,"integration for order (%s,%s) failed. True value = %s, calculated = %s"%(i,j,ref,res))
292
293 res=integrate(x_bound[0]**i*x_bound[1]**j)
294 ref=0
295 if i == 0:
296 ref += 2./(j+1)
297 else:
298 ref += 1./(j+1)
299 if j == 0:
300 ref += 2./(i+1)
301 else:
302 ref += 1./(i+1)
303 error=abs(res-ref)/abs(ref)
304 self.assertTrue(error<=self.TOL*raise_tol,"surface integration for order (%s,%s) failed. True value = %s, calculated = %s"%(i,j,ref,res))
305
306
307 def __test_3DQ(self,dom,order):
308 x=Function(dom).getX()
309 x_bound=FunctionOnBoundary(dom).getX()
310 for i in range(order+1):
311 for j in range(order+1):
312 for k in range(order+1):
313 res=integrate(x[0]**i*x[1]**j*x[2]**k)
314 ref=1./((i+1)*(j+1)*(k+1))
315 error=abs(res-ref)/abs(ref)
316 self.assertTrue(error<=self.TOL,"integration for order (%s,%s,%s) failed. True value = %s, calculated = %s (error=%e)"%(i,j,k,ref,res, error))
317
318 res=integrate(x_bound[0]**i*x_bound[1]**j*x_bound[2]**k)
319 ref=0
320 if i == 0:
321 ref += 2./((j+1)*(k+1))
322 else:
323 ref += 1./((j+1)*(k+1))
324 if j == 0:
325 ref += 2./((i+1)*(k+1))
326 else:
327 ref += 1./((i+1)*(k+1))
328 if k == 0:
329 ref += 2./((i+1)*(j+1))
330 else:
331 ref += 1./((i+1)*(j+1))
332 error=abs(res-ref)/abs(ref)
333 self.assertTrue(error<=self.TOL,"surface integration for order (%s,%s,%s) failed. True value = %s, calculated = %s (error=%e)"%(i,j,k,ref,res, error))
334
335 def __test_3DT(self,dom,order,raise_tol=1.):
336 x=Function(dom).getX()
337 x_bound=FunctionOnBoundary(dom).getX()
338 for i in range(order+1):
339 for j in range(order+1):
340 for k in range(order+1):
341 if i+j+k<=order:
342 res=integrate(x[0]**i*x[1]**j*x[2]**k)
343 ref=1./((i+1)*(j+1)*(k+1))
344 error=abs(res-ref)/abs(ref)
345 self.assertTrue(error<=self.TOL*raise_tol,"integration for order (%s,%s,%s) failed. True value = %s, calculated = %s (error=%e)"%(i,j,k,ref,res,error))
346
347 res=integrate(x_bound[0]**i*x_bound[1]**j*x_bound[2]**k)
348 ref=0
349 if i == 0:
350 ref += 2./((j+1)*(k+1))
351 else:
352 ref += 1./((j+1)*(k+1))
353 if j == 0:
354 ref += 2./((i+1)*(k+1))
355 else:
356 ref += 1./((i+1)*(k+1))
357 if k == 0:
358 ref += 2./((i+1)*(j+1))
359 else:
360 ref += 1./((i+1)*(j+1))
361 error=abs(res-ref)/abs(ref)
362 self.assertTrue(error<=self.TOL*raise_tol,"surface integration for order (%s,%s,%s) failed. True value = %s, calculated = %s (error=%e)"%(i,j,k,ref,res,error))
363
364 #===================================================================================================
365 def test_hex2D_order1_integorder1(self):
366 NE=getMPIRankWorld()
367 my_dom=Rectangle(NE,NE,integrationOrder=1)
368 self.__test_2DQ(my_dom,1)
369 def test_hex2D_order1_integorder2(self):
370 NE=getMPIRankWorld()
371 my_dom=Rectangle(NE,NE,integrationOrder=2)
372 self.__test_2DQ(my_dom,2)
373 def test_hex2D_order1_integorder3(self):
374 NE=getMPIRankWorld()
375 my_dom=Rectangle(NE,NE,integrationOrder=3)
376 self.__test_2DQ(my_dom,3)
377 def test_hex2D_order1_integorder4(self):
378 NE=getMPIRankWorld()
379 my_dom=Rectangle(NE,NE,integrationOrder=4)
380 self.__test_2DQ(my_dom,4)
381 def test_hex2D_order1_integorder5(self):
382 NE=getMPIRankWorld()
383 my_dom=Rectangle(NE,NE,integrationOrder=5)
384 self.__test_2DQ(my_dom,5)
385 def test_hex2D_order1_integorder6(self):
386 NE=getMPIRankWorld()
387 my_dom=Rectangle(NE,NE,integrationOrder=6)
388 self.__test_2DQ(my_dom,6)
389 def test_hex2D_order1_integorder7(self):
390 NE=getMPIRankWorld()
391 my_dom=Rectangle(NE,NE,integrationOrder=7)
392 self.__test_2DQ(my_dom,7)
393 def test_hex2D_order1_integorder8(self):
394 NE=getMPIRankWorld()
395 my_dom=Rectangle(NE,NE,integrationOrder=8)
396 self.__test_2DQ(my_dom,8)
397 def test_hex2D_order1_integorder9(self):
398 NE=getMPIRankWorld()
399 my_dom=Rectangle(NE,NE,integrationOrder=9)
400 self.__test_2DQ(my_dom,9)
401 def test_hex2D_order1_integorder10(self):
402 NE=getMPIRankWorld()
403 my_dom=Rectangle(NE,NE,integrationOrder=10)
404 self.__test_2DQ(my_dom,10)
405 #===================================================================================================
406 def test_hex2D_order2_integorder1(self):
407 NE=getMPIRankWorld()
408 my_dom=Rectangle(NE,NE,order=2,integrationOrder=1)
409 self.__test_2DQ(my_dom,1)
410 def test_hex2D_order2_integorder2(self):
411 NE=getMPIRankWorld()
412 my_dom=Rectangle(NE,NE,order=2,integrationOrder=2)
413 self.__test_2DQ(my_dom,2)
414 def test_hex2D_order2_integorder3(self):
415 NE=getMPIRankWorld()
416 my_dom=Rectangle(NE,NE,order=2,integrationOrder=3)
417 self.__test_2DQ(my_dom,3)
418 def test_hex2D_order2_integorder4(self):
419 NE=getMPIRankWorld()
420 my_dom=Rectangle(NE,NE,order=2,integrationOrder=4)
421 self.__test_2DQ(my_dom,4)
422 def test_hex2D_order2_integorder5(self):
423 NE=getMPIRankWorld()
424 my_dom=Rectangle(NE,NE,order=2,integrationOrder=5)
425 self.__test_2DQ(my_dom,5)
426 def test_hex2D_order2_integorder6(self):
427 NE=getMPIRankWorld()
428 my_dom=Rectangle(NE,NE,order=2,integrationOrder=6)
429 self.__test_2DQ(my_dom,6)
430 def test_hex2D_order2_integorder7(self):
431 NE=getMPIRankWorld()
432 my_dom=Rectangle(NE,NE,order=2,integrationOrder=7)
433 self.__test_2DQ(my_dom,7)
434 def test_hex2D_order2_integorder8(self):
435 NE=getMPIRankWorld()
436 my_dom=Rectangle(NE,NE,order=2,integrationOrder=8)
437 self.__test_2DQ(my_dom,8)
438 def test_hex2D_order2_integorder9(self):
439 NE=getMPIRankWorld()
440 my_dom=Rectangle(NE,NE,order=2,integrationOrder=9)
441 self.__test_2DQ(my_dom,9)
442 def test_hex2D_order2_integorder10(self):
443 NE=getMPIRankWorld()
444 my_dom=Rectangle(NE,NE,order=2,integrationOrder=10)
445 self.__test_2DQ(my_dom,10)
446 #===================================================================================================
447 def test_hex2D_macro_integorder1(self):
448 NE=getMPIRankWorld()
449 my_dom=Rectangle(NE,NE,order=-1,integrationOrder=1)
450 self.__test_2DQ(my_dom,1)
451 def test_hex2D_macro_integmacro(self):
452 NE=getMPIRankWorld()
453 my_dom=Rectangle(NE,NE,order=-1,integrationOrder=2)
454 self.__test_2DQ(my_dom,2)
455 def test_hex2D_macro_integorder3(self):
456 NE=getMPIRankWorld()
457 my_dom=Rectangle(NE,NE,order=-1,integrationOrder=3)
458 self.__test_2DQ(my_dom,3)
459 def test_hex2D_macro_integorder4(self):
460 NE=getMPIRankWorld()
461 my_dom=Rectangle(NE,NE,order=-1,integrationOrder=4)
462 self.__test_2DQ(my_dom,4)
463 def test_hex2D_macro_integorder5(self):
464 NE=getMPIRankWorld()
465 my_dom=Rectangle(NE,NE,order=-1,integrationOrder=5)
466 self.__test_2DQ(my_dom,5)
467 def test_hex2D_macro_integorder6(self):
468 NE=getMPIRankWorld()
469 my_dom=Rectangle(NE,NE,order=-1,integrationOrder=6)
470 self.__test_2DQ(my_dom,6)
471 def test_hex2D_macro_integorder7(self):
472 NE=getMPIRankWorld()
473 my_dom=Rectangle(NE,NE,order=-1,integrationOrder=7)
474 self.__test_2DQ(my_dom,7)
475 def test_hex2D_macro_integorder8(self):
476 NE=getMPIRankWorld()
477 my_dom=Rectangle(NE,NE,order=-1,integrationOrder=8)
478 self.__test_2DQ(my_dom,8)
479 def test_hex2D_macro_integorder9(self):
480 NE=getMPIRankWorld()
481 my_dom=Rectangle(NE,NE,order=-1,integrationOrder=9)
482 self.__test_2DQ(my_dom,9)
483 def test_hex2D_macro_integorder10(self):
484 NE=getMPIRankWorld()
485 my_dom=Rectangle(NE,NE,order=-1,integrationOrder=10)
486 self.__test_2DQ(my_dom,10)
487 #===================================================================================================
488 def test_Tet2D_order1_integorder1(self):
489 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri3.fly"),optimize=False,integrationOrder=1)
490 self.__test_2DT(my_dom,1)
491 def test_Tet2D_order1_integorder2(self):
492 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri3.fly"),optimize=False,integrationOrder=2)
493 self.__test_2DT(my_dom,2)
494 def test_Tet2D_order1_integorder3(self):
495 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri3.fly"),optimize=False,integrationOrder=3)
496 self.__test_2DT(my_dom,3)
497 def test_Tet2D_order1_integorder4(self):
498 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri3.fly"),optimize=False,integrationOrder=4)
499 self.__test_2DT(my_dom,4)
500 def test_Tet2D_order1_integorder5(self):
501 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri3.fly"),optimize=False,integrationOrder=5)
502 self.__test_2DT(my_dom,5)
503 def test_Tet2D_order1_integorder6(self):
504 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri3.fly"),optimize=False,integrationOrder=6)
505 self.__test_2DT(my_dom,6)
506 def test_Tet2D_order1_integorder7(self):
507 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri3.fly"),optimize=False,integrationOrder=7)
508 self.__test_2DT(my_dom,7)
509 def test_Tet2D_order1_integorder8(self):
510 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri3.fly"),optimize=False,integrationOrder=8)
511 self.__test_2DT(my_dom,8,1./sqrt(EPSILON))
512 def test_Tet2D_order1_integorder9(self):
513 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri3.fly"),optimize=False,integrationOrder=9)
514 self.__test_2DT(my_dom,9,1./sqrt(EPSILON))
515 def test_Tet2D_order1_integorder10(self):
516 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri3.fly"),optimize=False,integrationOrder=10)
517 self.__test_2DT(my_dom,10)
518 #===================================================================================================
519 def test_Tet2D_order2_integorder2(self):
520 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6.fly"),optimize=False,integrationOrder=1)
521 self.__test_2DT(my_dom,1)
522 def test_Tet2D_order2_integorder2(self):
523 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6.fly"),optimize=False,integrationOrder=2)
524 self.__test_2DT(my_dom,2)
525 def test_Tet2D_order2_integorder3(self):
526 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6.fly"),optimize=False,integrationOrder=3)
527 self.__test_2DT(my_dom,3)
528 def test_Tet2D_order2_integorder4(self):
529 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6.fly"),optimize=False,integrationOrder=4)
530 self.__test_2DT(my_dom,4)
531 def test_Tet2D_order2_integorder5(self):
532 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6.fly"),optimize=False,integrationOrder=5)
533 self.__test_2DT(my_dom,5)
534 def test_Tet2D_order2_integorder6(self):
535 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6.fly"),optimize=False,integrationOrder=6)
536 self.__test_2DT(my_dom,6)
537 def test_Tet2D_order2_integorder7(self):
538 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6.fly"),optimize=False,integrationOrder=7)
539 self.__test_2DT(my_dom,7)
540 def test_Tet2D_order2_integorder8(self):
541 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6.fly"),optimize=False,integrationOrder=8)
542 self.__test_2DT(my_dom,8,1./sqrt(EPSILON))
543 def test_Tet2D_order2_integorder9(self):
544 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6.fly"),optimize=False,integrationOrder=9)
545 self.__test_2DT(my_dom,9,1./sqrt(EPSILON))
546 def test_Tet2D_order2_integorder10(self):
547 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6.fly"),optimize=False,integrationOrder=10)
548 self.__test_2DT(my_dom,10)
549 #===================================================================================================
550 def test_Tet2D_macro_integmacro(self):
551 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6_macro.fly"),optimize=False,integrationOrder=1)
552 self.__test_2DT(my_dom,1)
553 def test_Tet2D_macro_integmacro(self):
554 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6_macro.fly"),optimize=False,integrationOrder=2)
555 self.__test_2DT(my_dom,2)
556 def test_Tet2D_macro_integorder3(self):
557 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6_macro.fly"),optimize=False,integrationOrder=3)
558 self.__test_2DT(my_dom,3)
559 def test_Tet2D_macro_integorder4(self):
560 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6_macro.fly"),optimize=False,integrationOrder=4)
561 self.__test_2DT(my_dom,4)
562 def test_Tet2D_macro_integorder5(self):
563 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6_macro.fly"),optimize=False,integrationOrder=5)
564 self.__test_2DT(my_dom,5)
565 def test_Tet2D_macro_integorder6(self):
566 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6_macro.fly"),optimize=False,integrationOrder=6)
567 self.__test_2DT(my_dom,6)
568 def test_Tet2D_macro_integorder7(self):
569 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6_macro.fly"),optimize=False,integrationOrder=7)
570 self.__test_2DT(my_dom,7)
571 def test_Tet2D_macro_integorder8(self):
572 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6_macro.fly"),optimize=False,integrationOrder=8)
573 self.__test_2DT(my_dom,8,1./sqrt(EPSILON))
574 def test_Tet2D_macro_integorder9(self):
575 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6_macro.fly"),optimize=False,integrationOrder=9)
576 self.__test_2DT(my_dom,9,1./sqrt(EPSILON))
577 def test_Tet2D_macro_integorder10(self):
578 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tri6_macro.fly"),optimize=False,integrationOrder=10)
579 self.__test_2DT(my_dom,10)
580 #===================================================================================================
581 def test_hex3D_order1_integorder1(self):
582 NE=getMPIRankWorld()
583 my_dom=Brick(NE,NE,NE,integrationOrder=1)
584 self.__test_3DQ(my_dom,1)
585 def test_hex3D_order1_integorder2(self):
586 NE=getMPIRankWorld()
587 my_dom=Brick(NE,NE,NE,integrationOrder=2)
588 self.__test_3DQ(my_dom,2)
589 def test_hex3D_order1_integorder3(self):
590 NE=getMPIRankWorld()
591 my_dom=Brick(NE,NE,NE,integrationOrder=3)
592 self.__test_3DQ(my_dom,3)
593 def test_hex3D_order1_integorder4(self):
594 NE=getMPIRankWorld()
595 my_dom=Brick(NE,NE,NE,integrationOrder=4)
596 self.__test_3DQ(my_dom,4)
597 def test_hex3D_order1_integorder5(self):
598 NE=getMPIRankWorld()
599 my_dom=Brick(NE,NE,NE,integrationOrder=5)
600 self.__test_3DQ(my_dom,5)
601 def test_hex3D_order1_integorder6(self):
602 NE=getMPIRankWorld()
603 my_dom=Brick(NE,NE,NE,integrationOrder=6)
604 self.__test_3DQ(my_dom,6)
605 def test_hex3D_order1_integorder7(self):
606 NE=getMPIRankWorld()
607 my_dom=Brick(NE,NE,NE,integrationOrder=7)
608 self.__test_3DQ(my_dom,7)
609 def test_hex3D_order1_integorder8(self):
610 NE=getMPIRankWorld()
611 my_dom=Brick(NE,NE,NE,integrationOrder=8)
612 self.__test_3DQ(my_dom,8)
613 def test_hex3D_order1_integorder9(self):
614 NE=getMPIRankWorld()
615 my_dom=Brick(NE,NE,NE,integrationOrder=9)
616 self.__test_3DQ(my_dom,9)
617 def test_hex3D_order1_integorder10(self):
618 NE=getMPIRankWorld()
619 my_dom=Brick(NE,NE,NE,integrationOrder=10)
620 self.__test_3DQ(my_dom,10)
621 #===================================================================================================
622 def test_hex3D_order2_integorder2(self):
623 NE=getMPIRankWorld()
624 my_dom=Brick(NE,NE,NE,order=2,integrationOrder=1)
625 self.__test_3DQ(my_dom,1)
626 def test_hex3D_order2_integorder2(self):
627 NE=getMPIRankWorld()
628 my_dom=Brick(NE,NE,NE,order=2,integrationOrder=2)
629 self.__test_3DQ(my_dom,2)
630 def test_hex3D_order2_integorder3(self):
631 NE=getMPIRankWorld()
632 my_dom=Brick(NE,NE,NE,order=2,integrationOrder=3)
633 self.__test_3DQ(my_dom,3)
634 def test_hex3D_order2_integorder4(self):
635 NE=getMPIRankWorld()
636 my_dom=Brick(NE,NE,NE,order=2,integrationOrder=4)
637 self.__test_3DQ(my_dom,4)
638 def test_hex3D_order2_integorder5(self):
639 NE=getMPIRankWorld()
640 my_dom=Brick(NE,NE,NE,order=2,integrationOrder=5)
641 self.__test_3DQ(my_dom,5)
642 def test_hex3D_order2_integorder6(self):
643 NE=getMPIRankWorld()
644 my_dom=Brick(NE,NE,NE,order=2,integrationOrder=6)
645 self.__test_3DQ(my_dom,6)
646 def test_hex3D_order2_integorder7(self):
647 NE=getMPIRankWorld()
648 my_dom=Brick(NE,NE,NE,order=2,integrationOrder=7)
649 self.__test_3DQ(my_dom,7)
650 def test_hex3D_order2_integorder8(self):
651 NE=getMPIRankWorld()
652 my_dom=Brick(NE,NE,NE,order=2,integrationOrder=8)
653 self.__test_3DQ(my_dom,8)
654 def test_hex3D_order2_integorder9(self):
655 NE=getMPIRankWorld()
656 my_dom=Brick(NE,NE,NE,order=2,integrationOrder=9)
657 self.__test_3DQ(my_dom,9)
658 def test_hex3D_order2_integorder10(self):
659 NE=getMPIRankWorld()
660 my_dom=Brick(NE,NE,NE,order=2,integrationOrder=10)
661 self.__test_3DQ(my_dom,10)
662 #===================================================================================================
663 def test_hex3D_macro_integmacro(self):
664 NE=getMPIRankWorld()
665 my_dom=Brick(NE,NE,NE,order=-1,integrationOrder=1)
666 self.__test_3DQ(my_dom,1)
667 def test_hex3D_macro_integmacro(self):
668 NE=getMPIRankWorld()
669 my_dom=Brick(NE,NE,NE,order=-1,integrationOrder=2)
670 self.__test_3DQ(my_dom,2)
671 def test_hex3D_macro_integorder3(self):
672 NE=getMPIRankWorld()
673 my_dom=Brick(NE,NE,NE,order=-1,integrationOrder=3)
674 self.__test_3DQ(my_dom,3)
675 def test_hex3D_macro_integorder4(self):
676 NE=getMPIRankWorld()
677 my_dom=Brick(NE,NE,NE,order=-1,integrationOrder=4)
678 self.__test_3DQ(my_dom,4)
679 def test_hex3D_macro_integorder5(self):
680 NE=getMPIRankWorld()
681 my_dom=Brick(NE,NE,NE,order=-1,integrationOrder=5)
682 self.__test_3DQ(my_dom,5)
683 def test_hex3D_macro_integorder6(self):
684 NE=getMPIRankWorld()
685 my_dom=Brick(NE,NE,NE,order=-1,integrationOrder=6)
686 self.__test_3DQ(my_dom,6)
687 def test_hex3D_macro_integorder7(self):
688 NE=getMPIRankWorld()
689 my_dom=Brick(NE,NE,NE,order=-1,integrationOrder=7)
690 self.__test_3DQ(my_dom,7)
691 def test_hex3D_macro_integorder8(self):
692 NE=getMPIRankWorld()
693 my_dom=Brick(NE,NE,NE,order=-1,integrationOrder=8)
694 self.__test_3DQ(my_dom,8)
695 def test_hex3D_macro_integorder9(self):
696 NE=getMPIRankWorld()
697 my_dom=Brick(NE,NE,NE,order=-1,integrationOrder=9)
698 self.__test_3DQ(my_dom,9)
699 def test_hex3D_macro_integorder10(self):
700 NE=getMPIRankWorld()
701 my_dom=Brick(NE,NE,NE,order=-1,integrationOrder=10)
702 self.__test_3DQ(my_dom,10)
703 #==========================================================================================
704 def test_Tet3D_order1_integorder1(self):
705 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet4.fly"),optimize=False,integrationOrder=1)
706 self.__test_3DT(my_dom,1)
707 def test_Tet3D_order1_integorder2(self):
708 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet4.fly"),optimize=False,integrationOrder=2)
709 self.__test_3DT(my_dom,2)
710 def test_Tet3D_order1_integorder3(self):
711 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet4.fly"),optimize=False,integrationOrder=3)
712 self.__test_3DT(my_dom,3)
713 def test_Tet3D_order1_integorder4(self):
714 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet4.fly"),optimize=False,integrationOrder=4)
715 self.__test_3DT(my_dom,4)
716 def test_Tet3D_order1_integorder5(self):
717 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet4.fly"),optimize=False,integrationOrder=5)
718 self.__test_3DT(my_dom,5)
719 def test_Tet3D_order1_integorder6(self):
720 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet4.fly"),optimize=False,integrationOrder=6)
721 self.__test_3DT(my_dom,6,1./sqrt(EPSILON))
722 def test_Tet3D_order1_integorder7(self):
723 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet4.fly"),optimize=False,integrationOrder=7)
724 self.__test_3DT(my_dom,7,1./sqrt(EPSILON))
725 def test_Tet3D_order1_integorder8(self):
726 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet4.fly"),optimize=False,integrationOrder=8)
727 self.__test_3DT(my_dom,8,1./sqrt(EPSILON))
728 def test_Tet3D_order1_integorder9(self):
729 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet4.fly"),optimize=False,integrationOrder=9)
730 self.__test_3DT(my_dom,9,1./sqrt(EPSILON))
731 def test_Tet3D_order1_integorder10(self):
732 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet4.fly"),optimize=False,integrationOrder=10)
733 self.__test_3DT(my_dom,10,1./sqrt(EPSILON))
734 #==========================================================================================
735 def test_Tet3D_order2_integorder2(self):
736 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10.fly"),optimize=False,integrationOrder=1)
737 self.__test_3DT(my_dom,1)
738 def test_Tet3D_order2_integorder2(self):
739 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10.fly"),optimize=False,integrationOrder=2)
740 self.__test_3DT(my_dom,2)
741 def test_Tet3D_order2_integorder3(self):
742 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10.fly"),optimize=False,integrationOrder=3)
743 self.__test_3DT(my_dom,3)
744 def test_Tet3D_order2_integorder4(self):
745 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10.fly"),optimize=False,integrationOrder=4)
746 self.__test_3DT(my_dom,4)
747 def test_Tet3D_order2_integorder5(self):
748 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10.fly"),optimize=False,integrationOrder=5)
749 self.__test_3DT(my_dom,5)
750 def test_Tet3D_order2_integorder6(self):
751 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10.fly"),optimize=False,integrationOrder=6)
752 self.__test_3DT(my_dom,6,1./sqrt(EPSILON))
753 def test_Tet3D_order2_integorder7(self):
754 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10.fly"),optimize=False,integrationOrder=7)
755 self.__test_3DT(my_dom,7,1./sqrt(EPSILON))
756 def test_Tet3D_order2_integorder8(self):
757 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10.fly"),optimize=False,integrationOrder=8)
758 self.__test_3DT(my_dom,8,1./sqrt(EPSILON))
759 def test_Tet3D_order2_integorder9(self):
760 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10.fly"),optimize=False,integrationOrder=9)
761 self.__test_3DT(my_dom,9,1./sqrt(EPSILON))
762 def test_Tet3D_order2_integorder10(self):
763 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10.fly"),optimize=False,integrationOrder=10)
764 self.__test_3DT(my_dom,10,1./sqrt(EPSILON))
765 #==========================================================================================
766 def test_Tet3D_macro_integmacro(self):
767 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10_macro.fly"),optimize=False,integrationOrder=1)
768 self.__test_3DT(my_dom,1)
769 def test_Tet3D_macro_integmacro(self):
770 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10_macro.fly"),optimize=False,integrationOrder=2)
771 self.__test_3DT(my_dom,2)
772 def test_Tet3D_macro_integorder3(self):
773 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10_macro.fly"),optimize=False,integrationOrder=3)
774 self.__test_3DT(my_dom,3)
775 def test_Tet3D_macro_integorder4(self):
776 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10_macro.fly"),optimize=False,integrationOrder=4)
777 self.__test_3DT(my_dom,4)
778 def test_Tet3D_macro_integorder5(self):
779 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10_macro.fly"),optimize=False,integrationOrder=5)
780 self.__test_3DT(my_dom,5)
781 def test_Tet3D_macro_integorder6(self):
782 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10_macro.fly"),optimize=False,integrationOrder=6)
783 self.__test_3DT(my_dom,6,1./sqrt(EPSILON))
784 def test_Tet3D_macro_integorder7(self):
785 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10_macro.fly"),optimize=False,integrationOrder=7)
786 self.__test_3DT(my_dom,7,1./sqrt(EPSILON))
787 def test_Tet3D_macro_integorder8(self):
788 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10_macro.fly"),optimize=False,integrationOrder=8)
789 self.__test_3DT(my_dom,8,1./sqrt(EPSILON))
790 def test_Tet3D_macro_integorder9(self):
791 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10_macro.fly"),optimize=False,integrationOrder=9)
792 self.__test_3DT(my_dom,9,1./sqrt(EPSILON))
793 def test_Tet3D_macro_integorder10(self):
794 my_dom = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet10_macro.fly"),optimize=False,integrationOrder=10)
795 self.__test_3DT(my_dom,10,1./sqrt(EPSILON))
796
797 if __name__ == '__main__':
798 suite = unittest.TestSuite()
799
800 if getMPISizeWorld() == 1:
801 suite.addTest(unittest.makeSuite(Test_Generators))
802 else:
803 print("Test_Generators is dropped as number of processors >1")
804
805 if getMPISizeWorld() == 1:
806 suite.addTest(unittest.makeSuite(Test_GMSHReader))
807 else:
808 print("Test_GMSHReader is dropped as number of processors >1")
809
810 if getMPISizeWorld() == 1:
811 suite.addTest(unittest.makeSuite(Test_Reader))
812 else:
813 print("Test_Reader is dropped as number of processors >1")
814
815 suite.addTest(unittest.makeSuite(Test_Integration))
816 s=unittest.TextTestRunner(verbosity=2).run(suite)
817 if not s.wasSuccessful(): sys.exit(1)

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo /branches/pasowrap/dudley/test/python/fixme_run_generators.py:3661-3674 /branches/py3_attempt2/dudley/test/python/fixme_run_generators.py:3871-3891 /branches/ripleygmg_from_3668/dudley/test/python/fixme_run_generators.py:3669-3791 /branches/scons_revamp_from_3210/dudley/test/python/fixme_run_generators.py:3212-3243 /branches/symbolic_from_3470/dudley/test/python/fixme_run_generators.py:3471-3974 /branches/symbolic_from_3470/ripley/test/python/dudley/test/python/fixme_run_generators.py:3517-3974 /trunk/ripley/test/python/dudley/test/python/fixme_run_generators.py:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26