/[escript]/branches/domexper/dudley/test/python/fixme_run_generators.py
ViewVC logotype

Diff of /branches/domexper/dudley/test/python/fixme_run_generators.py

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

revision 1809 by ksteube, Thu Sep 25 06:43:44 2008 UTC revision 2319 by gross, Thu Mar 19 03:19:41 2009 UTC
# Line 53  class Test_Generators(unittest.TestCase) Line 53  class Test_Generators(unittest.TestCase)
53  # Uncomment this section to dump the files for regression testing  # Uncomment this section to dump the files for regression testing
54  #      if True:  #      if True:
55  #         dom.write(FINLEY_TEST_MESH_PATH+reference)  #         dom.write(FINLEY_TEST_MESH_PATH+reference)
56        dom_string=open(dom_file).read().splitlines()        dom_string=open(dom_file).read().splitlines()
57        ref_string=open(FINLEY_TEST_MESH_PATH+reference).read().splitlines()        ref_string=open(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)):
# Line 178  class Test_GMSHReader(unittest.TestCase) Line 178  class Test_GMSHReader(unittest.TestCase)
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))           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):     def test_Tri3(self):
181         file="tri3_gmsh.msh"           file="tri3_gmsh.msh"
182         ref ="tri3.fly"           ref ="tri3.fly"
183         test = FINLEY_WORKDIR+os.sep+"tri3_test.fly"           test = FINLEY_WORKDIR+os.sep+"tri3_test.fly"
184         dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,2,optimize=False)           dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,2,optimize=False)
185         dom.write(test)           dom.write(test)
186         self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)           self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
187    
188     def test_Tri6(self):     def test_Tri6(self):
189         file="tri6_gmsh.msh"           file="tri6_gmsh.msh"
190         ref="tri6.fly"           ref="tri6.fly"
191         test = FINLEY_WORKDIR+os.sep+"tri8_test.fly"           test = FINLEY_WORKDIR+os.sep+"tri8_test.fly"
192         dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,2,optimize=False)           dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,2,optimize=False)
193         dom.write(test)           dom.write(test)
194         self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)           self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
195    
196     def test_Tet4(self):     def test_Tet4(self):
197         file="tet4_gmsh.msh"           file="tet4_gmsh.msh"
198         ref="tet4.fly"           ref="tet4.fly"
199         test = FINLEY_WORKDIR+os.sep+"tet4_test.fly"           test = FINLEY_WORKDIR+os.sep+"tet4_test.fly"
200         dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,3,optimize=False)           dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,3,optimize=False)
201         dom.write(test)           dom.write(test)
202         self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)           self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
203    
204     def test_Tet10(self):     def test_Tet10(self):
205         file="tet10_gmsh.msh"           file="tet10_gmsh.msh"
206         ref="tet10.fly"           ref="tet10.fly"
207         test = FINLEY_WORKDIR+os.sep+"tet10_test.fly"           test = FINLEY_WORKDIR+os.sep+"tet10_test.fly"
208         dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,3,optimize=False)           dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,3,optimize=False)
209         dom.write(test)           dom.write(test)
210         self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)           self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
211    
212  class Test_Reader(unittest.TestCase):  class Test_Reader(unittest.TestCase):
213     def test_ReadWriteTagNames(self):     def test_ReadWriteTagNames(self):
# Line 335  class Test_Integration(unittest.TestCase Line 335  class Test_Integration(unittest.TestCase
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))                  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):     def test_hex2D_order1(self):
338        my_dom=Rectangle(1,1,integrationOrder=1)        NE=getMPIRankWorld()
339          my_dom=Rectangle(NE,NE,integrationOrder=1)
340        self.__test_2DQ(my_dom,1)        self.__test_2DQ(my_dom,1)
341     def test_hex2D_order2(self):     def test_hex2D_order2(self):
342        my_dom=Rectangle(1,1,integrationOrder=2)        NE=getMPIRankWorld()
343          my_dom=Rectangle(NE,NE,integrationOrder=2)
344        self.__test_2DQ(my_dom,2)        self.__test_2DQ(my_dom,2)
345     def test_hex2D_order3(self):     def test_hex2D_order3(self):
346        my_dom=Rectangle(1,1,integrationOrder=3)        NE=getMPIRankWorld()
347          my_dom=Rectangle(NE,NE,integrationOrder=3)
348        self.__test_2DQ(my_dom,3)        self.__test_2DQ(my_dom,3)
349     def test_hex2D_order4(self):     def test_hex2D_order4(self):
350        my_dom=Rectangle(1,1,integrationOrder=4)        NE=getMPIRankWorld()
351          my_dom=Rectangle(NE,NE,integrationOrder=4)
352        self.__test_2DQ(my_dom,4)        self.__test_2DQ(my_dom,4)
353     def test_hex2D_order5(self):     def test_hex2D_order5(self):
354        my_dom=Rectangle(1,1,integrationOrder=5)        NE=getMPIRankWorld()
355          my_dom=Rectangle(NE,NE,integrationOrder=5)
356        self.__test_2DQ(my_dom,5)        self.__test_2DQ(my_dom,5)
357     def test_hex2D_order6(self):     def test_hex2D_order6(self):
358        my_dom=Rectangle(1,1,integrationOrder=6)        NE=getMPIRankWorld()
359          my_dom=Rectangle(NE,NE,integrationOrder=6)
360        self.__test_2DQ(my_dom,6)        self.__test_2DQ(my_dom,6)
361     def test_hex2D_order7(self):     def test_hex2D_order7(self):
362        my_dom=Rectangle(1,1,integrationOrder=7)        NE=getMPIRankWorld()
363          my_dom=Rectangle(NE,NE,integrationOrder=7)
364        self.__test_2DQ(my_dom,7)        self.__test_2DQ(my_dom,7)
365     def test_hex2D_order8(self):     def test_hex2D_order8(self):
366        my_dom=Rectangle(1,1,integrationOrder=8)        NE=getMPIRankWorld()
367          my_dom=Rectangle(NE,NE,integrationOrder=8)
368        self.__test_2DQ(my_dom,8)        self.__test_2DQ(my_dom,8)
369     def test_hex2D_order9(self):     def test_hex2D_order9(self):
370        my_dom=Rectangle(1,1,integrationOrder=9)        NE=getMPIRankWorld()
371          my_dom=Rectangle(NE,NE,integrationOrder=9)
372        self.__test_2DQ(my_dom,9)        self.__test_2DQ(my_dom,9)
373     def test_hex2D_order10(self):     def test_hex2D_order10(self):
374        my_dom=Rectangle(1,1,integrationOrder=10)        NE=getMPIRankWorld()
375          my_dom=Rectangle(NE,NE,integrationOrder=10)
376        self.__test_2DQ(my_dom,10)        self.__test_2DQ(my_dom,10)
377    
378     def test_Tet2D_order1(self):     def test_Tet2D_order1(self):
# Line 397  class Test_Integration(unittest.TestCase Line 407  class Test_Integration(unittest.TestCase
407        self.__test_2DT(my_dom,10)        self.__test_2DT(my_dom,10)
408    
409     def test_hex3D_order1(self):     def test_hex3D_order1(self):
410        my_dom=Brick(1,1,1,integrationOrder=1)        NE=getMPIRankWorld()
411          my_dom=Brick(NE,NE,NE,integrationOrder=1)
412        self.__test_3DQ(my_dom,1)        self.__test_3DQ(my_dom,1)
413     def test_hex3D_order2(self):     def test_hex3D_order2(self):
414        my_dom=Brick(1,1,1,integrationOrder=2)        NE=getMPIRankWorld()
415          my_dom=Brick(NE,NE,NE,integrationOrder=2)
416        self.__test_3DQ(my_dom,2)        self.__test_3DQ(my_dom,2)
417     def test_hex3D_order3(self):     def test_hex3D_order3(self):
418        my_dom=Brick(1,1,1,integrationOrder=3)        NE=getMPIRankWorld()
419          my_dom=Brick(NE,NE,NE,integrationOrder=3)
420        self.__test_3DQ(my_dom,3)        self.__test_3DQ(my_dom,3)
421     def test_hex3D_order4(self):     def test_hex3D_order4(self):
422        my_dom=Brick(1,1,1,integrationOrder=4)        NE=getMPIRankWorld()
423          my_dom=Brick(NE,NE,NE,integrationOrder=4)
424        self.__test_3DQ(my_dom,4)        self.__test_3DQ(my_dom,4)
425     def test_hex3D_order5(self):     def test_hex3D_order5(self):
426        my_dom=Brick(1,1,1,integrationOrder=5)        NE=getMPIRankWorld()
427          my_dom=Brick(NE,NE,NE,integrationOrder=5)
428        self.__test_3DQ(my_dom,5)        self.__test_3DQ(my_dom,5)
429     def test_hex3D_order6(self):     def test_hex3D_order6(self):
430        my_dom=Brick(1,1,1,integrationOrder=6)        NE=getMPIRankWorld()
431          my_dom=Brick(NE,NE,NE,integrationOrder=6)
432        self.__test_3DQ(my_dom,6)        self.__test_3DQ(my_dom,6)
433     def test_hex3D_order7(self):     def test_hex3D_order7(self):
434        my_dom=Brick(1,1,1,integrationOrder=7)        NE=getMPIRankWorld()
435          my_dom=Brick(NE,NE,NE,integrationOrder=7)
436        self.__test_3DQ(my_dom,7)        self.__test_3DQ(my_dom,7)
437     def test_hex3D_order8(self):     def test_hex3D_order8(self):
438        my_dom=Brick(1,1,1,integrationOrder=8)        NE=getMPIRankWorld()
439          my_dom=Brick(NE,NE,NE,integrationOrder=8)
440        self.__test_3DQ(my_dom,8)        self.__test_3DQ(my_dom,8)
441     def test_hex3D_order9(self):     def test_hex3D_order9(self):
442        my_dom=Brick(1,1,1,integrationOrder=9)        NE=getMPIRankWorld()
443          my_dom=Brick(NE,NE,NE,integrationOrder=9)
444        self.__test_3DQ(my_dom,9)        self.__test_3DQ(my_dom,9)
445     def test_hex3D_order10(self):     def test_hex3D_order10(self):
446        my_dom=Brick(1,1,1,integrationOrder=10)        NE=getMPIRankWorld()
447          my_dom=Brick(NE,NE,NE,integrationOrder=10)
448        self.__test_3DQ(my_dom,10)        self.__test_3DQ(my_dom,10)
449    
450     def test_Tet3D_order1(self):     def test_Tet3D_order1(self):
# Line 460  class Test_Integration(unittest.TestCase Line 480  class Test_Integration(unittest.TestCase
480    
481  if __name__ == '__main__':  if __name__ == '__main__':
482     suite = unittest.TestSuite()     suite = unittest.TestSuite()
483     suite.addTest(unittest.makeSuite(Test_Generators))  
484     suite.addTest(unittest.makeSuite(Test_GMSHReader))     if getMPISizeWorld() == 1:
485     suite.addTest(unittest.makeSuite(Test_Reader))          suite.addTest(unittest.makeSuite(Test_Generators))
486       else:
487            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))     suite.addTest(unittest.makeSuite(Test_Integration))
500     s=unittest.TextTestRunner(verbosity=2).run(suite)     s=unittest.TextTestRunner(verbosity=2).run(suite)
501     if not s.wasSuccessful(): sys.exit(1)     if not s.wasSuccessful(): sys.exit(1)
   

Legend:
Removed from v.1809  
changed lines
  Added in v.2319

  ViewVC Help
Powered by ViewVC 1.1.26