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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 709 by gross, Wed Apr 26 06:35:36 2006 UTC revision 2416 by gross, Wed May 13 06:03:59 2009 UTC
# Line 1  Line 1 
 # $Id$  
1    
2    ########################################################
3    #
4    # Copyright (c) 2003-2008 by University of Queensland
5    # Earth Systems Science Computational Center (ESSCC)
6    # http://www.uq.edu.au/esscc
7    #
8    # Primary Business: Queensland, Australia
9    # Licensed under the Open Software License version 3.0
10    # http://www.opensource.org/licenses/osl-3.0.php
11    #
12    ########################################################
13    
14    __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15    Earth Systems Science Computational Center (ESSCC)
16    http://www.uq.edu.au/esscc
17    Primary Business: Queensland, Australia"""
18    __license__="""Licensed under the Open Software License version 3.0
19    http://www.opensource.org/licenses/osl-3.0.php"""
20    __url__="https://launchpad.net/escript-finley"
21    
22  """  """
23  checks the mesh generators against the reference meshes in test_meshes  checks the mesh generators against the reference meshes in test_meshes and test the finley integration schemes.
24  """  """
25    
 __copyright__="""  Copyright (c) 2006 by ACcESS MNRF  
                     http://www.access.edu.au  
                 Primary Business: Queensland, Australia"""  
 __license__="""Licensed under the Open Software License version 3.0  
              http://www.opensource.org/licenses/osl-3.0.php"""  
   
26  import sys  import sys
27  import os  import os
28  import unittest  import unittest
29  from esys.escript import *  from esys.escript import *
30  from esys.finley import Interval,Rectangle,Brick,JoinFaces  from esys.finley import Rectangle,Brick,JoinFaces, ReadGmsh, ReadMesh
31    
32  FINLEY_TEST_DATA_PATH=os.environ['FINLEY_TEST_DATA']+"/data_meshes/"  try:
33  FINLEY_WORKDIR_PATH=os.environ['FINLEY_WORKDIR']+"/"       FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
34    except KeyError:
35         FINLEY_TEST_DATA='.'
36    
37    try:
38         FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR']
39    except KeyError:
40         FINLEY_WORKDIR='.'
41    
42    FINLEY_TEST_MESH_PATH=os.path.join(FINLEY_TEST_DATA,"data_meshes")
43    #if os.name == "nt":
44    #   FINLEY_TEST_MESH_PATH = os.path.join(FINLEY_TEST_MESH_PATH,"win32")
45    FINLEY_WORKDIR_PATH=FINLEY_WORKDIR
46    
47  TEST_FILE_EXT=".test"  TEST_FILE_EXT=".test"
48  class Test_Generators(unittest.TestCase):  class Test_Generators(unittest.TestCase):
49    
50     def checker(self,dom,reference):     def checker(self,dom,reference):
51        dom_file=FINLEY_WORKDIR_PATH+TEST_FILE_EXT        dom_file=os.path.join(FINLEY_WORKDIR_PATH,TEST_FILE_EXT)
52        dom.write(dom_file)        dom.write(dom_file)
53        dom_string=open(dom_file).read().splitlines()  # Uncomment this section to dump the files for regression testing
54        ref_string=open(FINLEY_TEST_DATA_PATH+reference).read().splitlines()  #      if True:
55    #         dom.write(os.path.join(FINLEY_TEST_MESH_PATH,reference))
56          dom_string=open(dom_file).read().splitlines()
57          ref_string=open(os.path.join(FINLEY_TEST_MESH_PATH,reference)).read().splitlines()
58        self.failUnlessEqual(len(dom_string),len(ref_string),"number of lines in mesh files does not match reference")        self.failUnlessEqual(len(dom_string),len(ref_string),"number of lines in mesh files does not match reference")
59        for l in range(1,len(ref_string)):        for l in range(1,len(ref_string)):
60           self.failUnlessEqual(dom_string[l].strip(),ref_string[l].strip(),"line %d (%s) in mesh files does not match reference (%s)"%(l,ref_string[l].strip(),dom_string[l].strip()))       line=dom_string[l].strip()
61         if os.name == "nt":
62     def test_hex_1D_order1(self):             line=line.replace("e+00","e+0").replace("e-00","e-0")
63        file="hex_1D_order1.msh"           self.failUnlessEqual(line,ref_string[l].strip(),"line %d (%s) in mesh files does not match reference (%s)"%(l,ref_string[l].strip(),line))
       my_dom=Interval(1,1)  
       self.checker(my_dom,file)  
   
    def test_hex_1D_order1_onFace(self):  
       file="hex_1D_order1_onFace.msh"  
       my_dom=Interval(1,1,useElementsOnFace=1)  
       self.checker(my_dom,file)  
   
    def test_hex_1D_order2(self):  
       file="hex_1D_order2.msh"  
       my_dom=Interval(1,2)  
       self.checker(my_dom,file)  
   
    def test_hex_1D_order2_onFace(self):  
       file="hex_1D_order2_onFace.msh"  
       my_dom=Interval(1,2,useElementsOnFace=1)  
       self.checker(my_dom,file)  
64    
65     def test_hex_2D_order1(self):     def test_hex_2D_order1(self):
66        file="hex_2D_order1.msh"        file="hex_2D_order1.msh"
# Line 97  class Test_Generators(unittest.TestCase) Line 107  class Test_Generators(unittest.TestCase)
107        ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)        ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)
108        ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)        ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)
109        ms2.setX(ms2.getX()+[0,0.5])        ms2.setX(ms2.getX()+[0,0.5])
110        my_dom=JoinFaces([ms1,ms2])        my_dom=JoinFaces([ms1,ms2],optimize=False)
111        self.checker(my_dom,file)        self.checker(my_dom,file)
112    
113     def test_hex_contact_2D_order1_onFace(self):     def test_hex_contact_2D_order1_onFace(self):
# Line 105  class Test_Generators(unittest.TestCase) Line 115  class Test_Generators(unittest.TestCase)
115        ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)        ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)
116        ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)        ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)
117        ms2.setX(ms2.getX()+[0,0.5])        ms2.setX(ms2.getX()+[0,0.5])
118        my_dom=JoinFaces([ms1,ms2])        my_dom=JoinFaces([ms1,ms2],optimize=False)
119        self.checker(my_dom,file)        self.checker(my_dom,file)
120    
121     def test_hex_contact_2D_order2(self):     def test_hex_contact_2D_order2(self):
# Line 113  class Test_Generators(unittest.TestCase) Line 123  class Test_Generators(unittest.TestCase)
123        ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)        ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)
124        ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)        ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)
125        ms2.setX(ms2.getX()+[0,0.5])        ms2.setX(ms2.getX()+[0,0.5])
126        my_dom=JoinFaces([ms1,ms2])        my_dom=JoinFaces([ms1,ms2],optimize=False)
127        self.checker(my_dom,file)        self.checker(my_dom,file)
128    
129     def test_hex_contact_2D_order2_onFace(self):     def test_hex_contact_2D_order2_onFace(self):
# Line 121  class Test_Generators(unittest.TestCase) Line 131  class Test_Generators(unittest.TestCase)
131        ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)        ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)
132        ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)        ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)
133        ms2.setX(ms2.getX()+[0,0.5])        ms2.setX(ms2.getX()+[0,0.5])
134        my_dom=JoinFaces([ms1,ms2])        my_dom=JoinFaces([ms1,ms2],optimize=False)
135        self.checker(my_dom,file)        self.checker(my_dom,file)
136    
137     def test_hex_contact_3D_order1(self):     def test_hex_contact_3D_order1(self):
# Line 129  class Test_Generators(unittest.TestCase) Line 139  class Test_Generators(unittest.TestCase)
139        ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)        ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)
140        ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)        ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)
141        ms2.setX(ms2.getX()+[0,0,0.5])        ms2.setX(ms2.getX()+[0,0,0.5])
142        my_dom=JoinFaces([ms1,ms2])        my_dom=JoinFaces([ms1,ms2],optimize=False)
143        self.checker(my_dom,file)        self.checker(my_dom,file)
144    
145     def test_hex_contact_3D_order1_onFace(self):     def test_hex_contact_3D_order1_onFace(self):
# Line 137  class Test_Generators(unittest.TestCase) Line 147  class Test_Generators(unittest.TestCase)
147        ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)        ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)
148        ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)        ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)
149        ms2.setX(ms2.getX()+[0,0,0.5])        ms2.setX(ms2.getX()+[0,0,0.5])
150        my_dom=JoinFaces([ms1,ms2])        my_dom=JoinFaces([ms1,ms2],optimize=False)
151        self.checker(my_dom,file)        self.checker(my_dom,file)
152    
153     def test_hex_contact_3D_order2(self):     def test_hex_contact_3D_order2(self):
# Line 145  class Test_Generators(unittest.TestCase) Line 155  class Test_Generators(unittest.TestCase)
155        ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)        ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)
156        ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)        ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)
157        ms2.setX(ms2.getX()+[0,0,0.5])        ms2.setX(ms2.getX()+[0,0,0.5])
158        my_dom=JoinFaces([ms1,ms2])        my_dom=JoinFaces([ms1,ms2],optimize=False)
159        self.checker(my_dom,file)        self.checker(my_dom,file)
160    
161     def test_hex_contact_3D_order2_onFace(self):     def test_hex_contact_3D_order2_onFace(self):
# Line 153  class Test_Generators(unittest.TestCase) Line 163  class Test_Generators(unittest.TestCase)
163        ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)        ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)
164        ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)        ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)
165        ms2.setX(ms2.getX()+[0,0,0.5])        ms2.setX(ms2.getX()+[0,0,0.5])
166        my_dom=JoinFaces([ms1,ms2])        my_dom=JoinFaces([ms1,ms2],optimize=False)
167        self.checker(my_dom,file)        self.checker(my_dom,file)
168    
169    class Test_GMSHReader(unittest.TestCase):
170       def compare(self, test_file, reference_file):
171          dom_string=open(test_file).read().splitlines()
172          ref_string=open(reference_file).read().splitlines()
173          self.failUnlessEqual(len(dom_string),len(ref_string),"number of lines in mesh files does not match reference")
174          for l in range(1,len(ref_string)):
175         line=dom_string[l].strip()
176         if os.name == "nt":
177               line=line.replace("e+00","e+0").replace("e-00","e-0")
178             self.failUnlessEqual(line,ref_string[l].strip(),"line %d (%s) in mesh files does not match reference (%s)"%(l,ref_string[l].strip(),line))
179    
180       def test_Tri3(self):
181             file="tri3_gmsh.msh"
182             ref ="tri3.fly"
183             test = FINLEY_WORKDIR+os.sep+"tri3_test.fly"
184             dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,2,optimize=False)
185             dom.write(test)
186             self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
187    
188       def test_Tri6(self):
189             file="tri6_gmsh.msh"
190             ref="tri6.fly"
191             test = FINLEY_WORKDIR+os.sep+"tri8_test.fly"
192             dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,2,optimize=False)
193             dom.write(test)
194             self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
195    
196       def test_Tet4(self):
197             file="tet4_gmsh.msh"
198             ref="tet4.fly"
199             test = FINLEY_WORKDIR+os.sep+"tet4_test.fly"
200             dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,3,optimize=False)
201             dom.write(test)
202             self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
203    
204       def test_Tet10(self):
205             file="tet10_gmsh.msh"
206             ref="tet10.fly"
207             test = FINLEY_WORKDIR+os.sep+"tet10_test.fly"
208             dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,3,optimize=False)
209             dom.write(test)
210             self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
211    
212    class Test_Reader(unittest.TestCase):
213       def test_ReadWriteTagNames(self):
214           file="hex_2D_order2.msh"
215           test = FINLEY_WORKDIR+os.sep+"test.fly"
216           dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+file,3,optimize=False)
217           insertTagNames(dom,A=1,B=2)
218           dom.write(test)
219           dom2 = ReadMesh(test,3,optimize=False)
220           t=getTagNames(dom)
221           self.failUnless(len(t)==6)
222           self.failUnless("A" in t)
223           self.failUnless("B" in t)
224           self.failUnless(dom2.getTag("A") == 1)
225           self.failUnless(dom2.getTag("B") == 2)
226           self.failUnless(dom2.isValidTagName("A"))
227           self.failUnless(dom2.isValidTagName("B"))
228    
229    class Test_Integration(unittest.TestCase):
230       TOL=EPSILON*100.
231       def __test_2DQ(self,dom,order):
232           x=Function(dom).getX()
233           x_bound=FunctionOnBoundary(dom).getX()
234           for i in xrange(order+1):
235             for j in xrange(order+1):
236                 res=integrate(x[0]**i*x[1]**j)
237                 ref=1./((i+1)*(j+1))
238                 error=abs(res-ref)/abs(ref)
239                 self.failUnless(error<=self.TOL,"integration for order (%s,%s) failed. True value = %s, calculated = %s"%(i,j,ref,res))
240    
241                 res=integrate(x_bound[0]**i*x_bound[1]**j)
242                 ref=0
243                 if i == 0:
244                    ref += 2./(j+1)
245                 else:
246                    ref += 1./(j+1)
247                 if j == 0:
248                    ref += 2./(i+1)
249                 else:
250                    ref += 1./(i+1)
251                 error=abs(res-ref)/abs(ref)
252                 self.failUnless(error<=self.TOL,"surface integration for order (%s,%s) failed. True value = %s, calculated = %s"%(i,j,ref,res))
253                
254       def __test_2DT(self,dom,order,raise_tol=1.):
255           x=Function(dom).getX()
256           x_bound=FunctionOnBoundary(dom).getX()
257           for i in xrange(order+1):
258             for j in xrange(order+1):
259               if i+j<=order:
260                 res=integrate(x[0]**i*x[1]**j)
261                 ref=1./((i+1)*(j+1))
262                 error=abs(res-ref)/abs(ref)
263                 # print order,error
264                 self.failUnless(error<=self.TOL*raise_tol,"integration for order (%s,%s) failed. True value = %s, calculated = %s"%(i,j,ref,res))
265    
266                 res=integrate(x_bound[0]**i*x_bound[1]**j)
267                 ref=0
268                 if i == 0:
269                    ref += 2./(j+1)
270                 else:
271                    ref += 1./(j+1)
272                 if j == 0:
273                    ref += 2./(i+1)
274                 else:
275                    ref += 1./(i+1)
276                 error=abs(res-ref)/abs(ref)
277                 self.failUnless(error<=self.TOL*raise_tol,"surface integration for order (%s,%s) failed. True value = %s, calculated = %s"%(i,j,ref,res))
278    
279    
280       def __test_3DQ(self,dom,order):
281           x=Function(dom).getX()
282           x_bound=FunctionOnBoundary(dom).getX()
283           for i in xrange(order+1):
284             for j in xrange(order+1):
285               for k in xrange(order+1):
286                 res=integrate(x[0]**i*x[1]**j*x[2]**k)
287                 ref=1./((i+1)*(j+1)*(k+1))
288                 error=abs(res-ref)/abs(ref)
289                 self.failUnless(error<=self.TOL,"integration for order (%s,%s,%s) failed. True value = %s, calculated = %s"%(i,j,k,ref,res))
290    
291                 res=integrate(x_bound[0]**i*x_bound[1]**j*x_bound[2]**k)
292                 ref=0
293                 if i == 0:
294                    ref += 2./((j+1)*(k+1))
295                 else:
296                    ref += 1./((j+1)*(k+1))
297                 if j == 0:
298                    ref += 2./((i+1)*(k+1))
299                 else:
300                    ref += 1./((i+1)*(k+1))
301                 if k == 0:
302                    ref += 2./((i+1)*(j+1))
303                 else:
304                    ref += 1./((i+1)*(j+1))
305                 error=abs(res-ref)/abs(ref)
306                 self.failUnless(error<=self.TOL,"surface integration for order (%s,%s,%s) failed. True value = %s, calculated = %s"%(i,j,k,ref,res))
307    
308       def __test_3DT(self,dom,order,raise_tol=1.):
309           x=Function(dom).getX()
310           x_bound=FunctionOnBoundary(dom).getX()
311           for i in xrange(order+1):
312             for j in xrange(order+1):
313               for k in xrange(order+1):
314                 if i+j+k<=order:
315                    res=integrate(x[0]**i*x[1]**j*x[2]**k)
316                    ref=1./((i+1)*(j+1)*(k+1))
317                    error=abs(res-ref)/abs(ref)
318                    self.failUnless(error<=self.TOL*raise_tol,"integration for order (%s,%s,%s) failed. True value = %s, calculated = %s"%(i,j,k,ref,res))
319    
320                    res=integrate(x_bound[0]**i*x_bound[1]**j*x_bound[2]**k)
321                    ref=0
322                    if i == 0:
323                       ref += 2./((j+1)*(k+1))
324                    else:
325                       ref += 1./((j+1)*(k+1))
326                    if j == 0:
327                       ref += 2./((i+1)*(k+1))
328                    else:
329                       ref += 1./((i+1)*(k+1))
330                    if k == 0:
331                       ref += 2./((i+1)*(j+1))
332                    else:
333                       ref += 1./((i+1)*(j+1))
334                    error=abs(res-ref)/abs(ref)
335                    self.failUnless(error<=self.TOL*raise_tol,"surface integration for order (%s,%s,%s) failed. True value = %s, calculated = %s"%(i,j,k,ref,res))
336    
337       def test_hex2D_order1(self):
338          NE=getMPIRankWorld()
339          my_dom=Rectangle(NE,NE,integrationOrder=1)
340          self.__test_2DQ(my_dom,1)
341       def test_hex2D_order2(self):
342          NE=getMPIRankWorld()
343          my_dom=Rectangle(NE,NE,integrationOrder=2)
344          self.__test_2DQ(my_dom,2)
345       def test_hex2D_order3(self):
346          NE=getMPIRankWorld()
347          my_dom=Rectangle(NE,NE,integrationOrder=3)
348          self.__test_2DQ(my_dom,3)
349       def test_hex2D_order4(self):
350          NE=getMPIRankWorld()
351          my_dom=Rectangle(NE,NE,integrationOrder=4)
352          self.__test_2DQ(my_dom,4)
353       def test_hex2D_order5(self):
354          NE=getMPIRankWorld()
355          my_dom=Rectangle(NE,NE,integrationOrder=5)
356          self.__test_2DQ(my_dom,5)
357       def test_hex2D_order6(self):
358          NE=getMPIRankWorld()
359          my_dom=Rectangle(NE,NE,integrationOrder=6)
360          self.__test_2DQ(my_dom,6)
361       def test_hex2D_order7(self):
362          NE=getMPIRankWorld()
363          my_dom=Rectangle(NE,NE,integrationOrder=7)
364          self.__test_2DQ(my_dom,7)
365       def test_hex2D_order8(self):
366          NE=getMPIRankWorld()
367          my_dom=Rectangle(NE,NE,integrationOrder=8)
368          self.__test_2DQ(my_dom,8)
369       def test_hex2D_order9(self):
370          NE=getMPIRankWorld()
371          my_dom=Rectangle(NE,NE,integrationOrder=9)
372          self.__test_2DQ(my_dom,9)
373       def test_hex2D_order10(self):
374          NE=getMPIRankWorld()
375          my_dom=Rectangle(NE,NE,integrationOrder=10)
376          self.__test_2DQ(my_dom,10)
377    
378       def test_Tet2D_order1(self):
379          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tri3.fly",optimize=False,integrationOrder=1)
380          self.__test_2DT(my_dom,1)
381       def test_Tet2D_order2(self):
382          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tri3.fly",optimize=False,integrationOrder=2)
383          self.__test_2DT(my_dom,2)
384       def test_Tet2D_order3(self):
385          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tri3.fly",optimize=False,integrationOrder=3)
386          self.__test_2DT(my_dom,3)
387       def test_Tet2D_order4(self):
388          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tri3.fly",optimize=False,integrationOrder=4)
389          self.__test_2DT(my_dom,4)
390       def test_Tet2D_order5(self):
391          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tri3.fly",optimize=False,integrationOrder=5)
392          self.__test_2DT(my_dom,5)
393       def test_Tet2D_order6(self):
394          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tri3.fly",optimize=False,integrationOrder=6)
395          self.__test_2DT(my_dom,6)
396       def test_Tet2D_order7(self):
397          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tri3.fly",optimize=False,integrationOrder=7)
398          self.__test_2DT(my_dom,7)
399       def test_Tet2D_order8(self):
400          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tri3.fly",optimize=False,integrationOrder=8)
401          self.__test_2DT(my_dom,8,1./sqrt(EPSILON))
402       def test_Tet2D_order9(self):
403          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tri3.fly",optimize=False,integrationOrder=9)
404          self.__test_2DT(my_dom,9,1./sqrt(EPSILON))
405       def test_Tet2D_order10(self):
406          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tri3.fly",optimize=False,integrationOrder=10)
407          self.__test_2DT(my_dom,10)
408    
409       def test_hex3D_order1(self):
410          NE=getMPIRankWorld()
411          my_dom=Brick(NE,NE,NE,integrationOrder=1)
412          self.__test_3DQ(my_dom,1)
413       def test_hex3D_order2(self):
414          NE=getMPIRankWorld()
415          my_dom=Brick(NE,NE,NE,integrationOrder=2)
416          self.__test_3DQ(my_dom,2)
417       def test_hex3D_order3(self):
418          NE=getMPIRankWorld()
419          my_dom=Brick(NE,NE,NE,integrationOrder=3)
420          self.__test_3DQ(my_dom,3)
421       def test_hex3D_order4(self):
422          NE=getMPIRankWorld()
423          my_dom=Brick(NE,NE,NE,integrationOrder=4)
424          self.__test_3DQ(my_dom,4)
425       def test_hex3D_order5(self):
426          NE=getMPIRankWorld()
427          my_dom=Brick(NE,NE,NE,integrationOrder=5)
428          self.__test_3DQ(my_dom,5)
429       def test_hex3D_order6(self):
430          NE=getMPIRankWorld()
431          my_dom=Brick(NE,NE,NE,integrationOrder=6)
432          self.__test_3DQ(my_dom,6)
433       def test_hex3D_order7(self):
434          NE=getMPIRankWorld()
435          my_dom=Brick(NE,NE,NE,integrationOrder=7)
436          self.__test_3DQ(my_dom,7)
437       def test_hex3D_order8(self):
438          NE=getMPIRankWorld()
439          my_dom=Brick(NE,NE,NE,integrationOrder=8)
440          self.__test_3DQ(my_dom,8)
441       def test_hex3D_order9(self):
442          NE=getMPIRankWorld()
443          my_dom=Brick(NE,NE,NE,integrationOrder=9)
444          self.__test_3DQ(my_dom,9)
445       def test_hex3D_order10(self):
446          NE=getMPIRankWorld()
447          my_dom=Brick(NE,NE,NE,integrationOrder=10)
448          self.__test_3DQ(my_dom,10)
449    
450       def test_Tet3D_order1(self):
451          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tet4.fly",optimize=False,integrationOrder=1)
452          self.__test_3DT(my_dom,1)
453       def test_Tet3D_order2(self):
454          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tet4.fly",optimize=False,integrationOrder=2)
455          self.__test_3DT(my_dom,2)
456       def test_Tet3D_order3(self):
457          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tet4.fly",optimize=False,integrationOrder=3)
458          self.__test_3DT(my_dom,3)
459       def test_Tet3D_order4(self):
460          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tet4.fly",optimize=False,integrationOrder=4)
461          self.__test_3DT(my_dom,4)
462       def test_Tet3D_order5(self):
463          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tet4.fly",optimize=False,integrationOrder=5)
464          self.__test_3DT(my_dom,5)
465       def test_Tet3D_order6(self):
466          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tet4.fly",optimize=False,integrationOrder=6)
467          self.__test_3DT(my_dom,6,1./sqrt(EPSILON))
468       def test_Tet3D_order7(self):
469          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tet4.fly",optimize=False,integrationOrder=7)
470          self.__test_3DT(my_dom,7,1./sqrt(EPSILON))
471       def test_Tet3D_order8(self):
472          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tet4.fly",optimize=False,integrationOrder=8)
473          self.__test_3DT(my_dom,8,1./sqrt(EPSILON))
474       def test_Tet3D_order9(self):
475          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tet4.fly",optimize=False,integrationOrder=9)
476          self.__test_3DT(my_dom,9,1./sqrt(EPSILON))
477       def test_Tet3D_order10(self):
478          my_dom = ReadMesh(FINLEY_TEST_MESH_PATH+os.sep+"tet4.fly",optimize=False,integrationOrder=10)
479          self.__test_3DT(my_dom,10)
480    
481  if __name__ == '__main__':  if __name__ == '__main__':
482     suite = unittest.TestSuite()     suite = unittest.TestSuite()
483     suite.addTest(unittest.makeSuite(Test_Generators))  
484     s=unittest.TextTestRunner(verbosity=2).run(suite)     if getMPISizeWorld() == 1:
485     if s.wasSuccessful():          suite.addTest(unittest.makeSuite(Test_Generators))
      sys.exit(0)  
486     else:     else:
487       sys.exit(1)          print "Test_Generators is dropped as number of processors >1"
488    
489       if getMPISizeWorld() == 1:
490            suite.addTest(unittest.makeSuite(Test_GMSHReader))
491       else:
492            print "Test_GMSHReader is dropped as number of processors >1"
493    
494       if getMPISizeWorld() == 1:
495            suite.addTest(unittest.makeSuite(Test_Reader))
496       else:
497            print "Test_Reader is dropped as number of processors >1"
498    
499       suite.addTest(unittest.makeSuite(Test_Integration))
500       s=unittest.TextTestRunner(verbosity=2).run(suite)
501       if not s.wasSuccessful(): sys.exit(1)

Legend:
Removed from v.709  
changed lines
  Added in v.2416

  ViewVC Help
Powered by ViewVC 1.1.26