/[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 4938 - (show annotations)
Wed May 14 01:13:23 2014 UTC (5 years, 3 months ago) by jfenwick
File MIME type: text/x-python
File size: 36944 byte(s)
Modify unit tests to read their classes from
esys.escriptcore.utestselect

Change the line in that file to switch between unittest and unittest2


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