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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4984 - (show annotations)
Mon Jun 2 02:50:34 2014 UTC (4 years, 10 months ago) by sshaw
File MIME type: text/x-python
File size: 37549 byte(s)
revamping testrunners, now uses automated discovery and allows running specific tests without modifying files (see escriptcore/py_src/testing.py for more info/examples)

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26