/[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 3792 - (show annotations)
Wed Feb 1 06:16:25 2012 UTC (7 years, 1 month ago) by caltinay
File MIME type: text/x-python
File size: 36740 byte(s)
Merged ripley rectangular domain into trunk.

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

  ViewVC Help
Powered by ViewVC 1.1.26