/[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 6651 - (show annotations)
Wed Feb 7 02:12:08 2018 UTC (20 months, 1 week ago) by jfenwick
File MIME type: text/x-python
File size: 37408 byte(s)
Make everyone sad by touching all the files

Copyright dates update

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26