/[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

temp_trunk_copy/finley/test/python/run_generators.py revision 1384 by phornby, Fri Jan 11 02:29:38 2008 UTC trunk/finley/test/python/run_generators.py revision 1829 by ksteube, Thu Oct 2 05:40:30 2008 UTC
# Line 1  Line 1 
1    
2    ########################################################
3  #  #
4  # $Id$  # Copyright (c) 2003-2008 by University of Queensland
5  #  # Earth Systems Science Computational Center (ESSCC)
6  #######################################################  # http://www.uq.edu.au/esscc
7  #  #
8  #           Copyright 2003-2007 by ACceSS MNRF  # Primary Business: Queensland, Australia
9  #       Copyright 2007 by University of Queensland  # Licensed under the Open Software License version 3.0
10  #  # http://www.opensource.org/licenses/osl-3.0.php
11  #                http://esscc.uq.edu.au  #
12  #        Primary Business: Queensland, Australia  ########################################################
13  #  Licensed under the Open Software License version 3.0  
14  #     http://www.opensource.org/licenses/osl-3.0.php  __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__="http://www.uq.edu.au/esscc/escript-finley"
21    
22  """  """
23  checks the mesh generators against the reference meshes in test_meshes and test the finley integration schemes.  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
# Line 41  except KeyError: Line 40  except KeyError:
40       FINLEY_WORKDIR='.'       FINLEY_WORKDIR='.'
41    
42  FINLEY_TEST_MESH_PATH=FINLEY_TEST_DATA+"/data_meshes/"  FINLEY_TEST_MESH_PATH=FINLEY_TEST_DATA+"/data_meshes/"
43  if os.name == "nt":  #if os.name == "nt":
44     FINLEY_TEST_MESH_PATH = FINLEY_TEST_MESH_PATH+"win32/"  #   FINLEY_TEST_MESH_PATH = FINLEY_TEST_MESH_PATH+"win32/"
45  FINLEY_WORKDIR_PATH=FINLEY_WORKDIR+"/"  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          if getMPISizeWorld() > 1: return
52        dom_file=FINLEY_WORKDIR_PATH+TEST_FILE_EXT        dom_file=FINLEY_WORKDIR_PATH+TEST_FILE_EXT
53        dom.write(dom_file)        dom.write(dom_file)
54  # Uncomment this section to dump the files for regression testing  # Uncomment this section to dump the files for regression testing
# Line 58  class Test_Generators(unittest.TestCase) Line 58  class Test_Generators(unittest.TestCase)
58        ref_string=open(FINLEY_TEST_MESH_PATH+reference).read().splitlines()        ref_string=open(FINLEY_TEST_MESH_PATH+reference).read().splitlines()
59        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")
60        for l in range(1,len(ref_string)):        for l in range(1,len(ref_string)):
61           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()
62         if os.name == "nt":
63               line=line.replace("e+00","e+0").replace("e-00","e-0")
64             self.failUnlessEqual(line,ref_string[l].strip(),"line %d (%s) in mesh files does not match reference (%s)"%(l,ref_string[l].strip(),line))
65    
66     def test_hex_2D_order1(self):     def test_hex_2D_order1(self):
67        file="hex_2D_order1.msh"        file="hex_2D_order1.msh"
# Line 170  class Test_GMSHReader(unittest.TestCase) Line 173  class Test_GMSHReader(unittest.TestCase)
173        ref_string=open(reference_file).read().splitlines()        ref_string=open(reference_file).read().splitlines()
174        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")
175        for l in range(1,len(ref_string)):        for l in range(1,len(ref_string)):
176           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()
177         if os.name == "nt":
178               line=line.replace("e+00","e+0").replace("e-00","e-0")
179             self.failUnlessEqual(line,ref_string[l].strip(),"line %d (%s) in mesh files does not match reference (%s)"%(l,ref_string[l].strip(),line))
180    
181     def test_Tri3(self):     def test_Tri3(self):
182         file="tri3_gmsh.msh"         # ReadGmsh is not MPI parallel
183         ref ="tri3.fly"         if getMPISizeWorld() == 1:
184         test = FINLEY_WORKDIR+os.sep+"tri3_test.fly"           file="tri3_gmsh.msh"
185         dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,2,optimize=False)           ref ="tri3.fly"
186         dom.write(test)           test = FINLEY_WORKDIR+os.sep+"tri3_test.fly"
187         self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)           dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,2,optimize=False)
188             dom.write(test)
189             self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
190    
191     def test_Tri6(self):     def test_Tri6(self):
192         file="tri6_gmsh.msh"         # ReadGmsh is not MPI parallel
193         ref="tri6.fly"         if getMPISizeWorld() == 1:
194         test = FINLEY_WORKDIR+os.sep+"tri8_test.fly"           file="tri6_gmsh.msh"
195         dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,2,optimize=False)           ref="tri6.fly"
196         dom.write(test)           test = FINLEY_WORKDIR+os.sep+"tri8_test.fly"
197         self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)           dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,2,optimize=False)
198             dom.write(test)
199             self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
200    
201     def test_Tet4(self):     def test_Tet4(self):
202         file="tet4_gmsh.msh"         # ReadGmsh is not MPI parallel
203         ref="tet4.fly"         if getMPISizeWorld() == 1:
204         test = FINLEY_WORKDIR+os.sep+"tet4_test.fly"           file="tet4_gmsh.msh"
205         dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,3,optimize=False)           ref="tet4.fly"
206         dom.write(test)           test = FINLEY_WORKDIR+os.sep+"tet4_test.fly"
207         self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)           dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,3,optimize=False)
208             dom.write(test)
209             self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
210    
211     def test_Tet10(self):     def test_Tet10(self):
212         file="tet10_gmsh.msh"         # ReadGmsh is not MPI parallel
213         ref="tet10.fly"         if getMPISizeWorld() == 1:
214         test = FINLEY_WORKDIR+os.sep+"tet10_test.fly"           file="tet10_gmsh.msh"
215         dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,3,optimize=False)           ref="tet10.fly"
216         dom.write(test)           test = FINLEY_WORKDIR+os.sep+"tet10_test.fly"
217         self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)           dom = ReadGmsh(FINLEY_TEST_MESH_PATH+os.sep+file,3,optimize=False)
218             dom.write(test)
219             self.compare(test, FINLEY_TEST_MESH_PATH+os.sep+ref)
220    
221  class Test_Reader(unittest.TestCase):  class Test_Reader(unittest.TestCase):
222     def test_ReadWriteTagNames(self):     def test_ReadWriteTagNames(self):

Legend:
Removed from v.1384  
changed lines
  Added in v.1829

  ViewVC Help
Powered by ViewVC 1.1.26