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

Annotation of /branches/intelc_win32/finley/test/python/run_generators.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 747 - (hide annotations)
Sat Jun 24 12:58:50 2006 UTC (16 years, 1 month ago) by woo409
File MIME type: text/x-python
File size: 5713 byte(s)
+ re-enabled all the tests in run_generators.py
+ Fixed up some extra #includes left over from initial port
+ nelix_kb_options.py now has some additional optimisation flags for my notebooks pentium M processor
1 jgs 150 # $Id$
2    
3    
4     """
5     checks the mesh generators against the reference meshes in test_meshes
6     """
7    
8 elspeth 617 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
9     http://www.access.edu.au
10     Primary Business: Queensland, Australia"""
11     __license__="""Licensed under the Open Software License version 3.0
12     http://www.opensource.org/licenses/osl-3.0.php"""
13 jgs 150
14 elspeth 626 import sys
15 gross 706 import os
16 elspeth 626 import unittest
17     from esys.escript import *
18     from esys.finley import Interval,Rectangle,Brick,JoinFaces
19    
20 gross 709 FINLEY_TEST_DATA_PATH=os.environ['FINLEY_TEST_DATA']+"/data_meshes/"
21 woo409 745 if os.name == "nt":
22     FINLEY_TEST_DATA_PATH = FINLEY_TEST_DATA_PATH+"win32/"
23 gross 709 FINLEY_WORKDIR_PATH=os.environ['FINLEY_WORKDIR']+"/"
24    
25 gross 706 TEST_FILE_EXT=".test"
26 jgs 150 class Test_Generators(unittest.TestCase):
27    
28     def checker(self,dom,reference):
29 gross 709 dom_file=FINLEY_WORKDIR_PATH+TEST_FILE_EXT
30 jgs 150 dom.write(dom_file)
31     dom_string=open(dom_file).read().splitlines()
32 gross 709 ref_string=open(FINLEY_TEST_DATA_PATH+reference).read().splitlines()
33 jgs 150 self.failUnlessEqual(len(dom_string),len(ref_string),"number of lines in mesh files does not match reference")
34     for l in range(1,len(ref_string)):
35     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()))
36    
37     def test_hex_1D_order1(self):
38     file="hex_1D_order1.msh"
39     my_dom=Interval(1,1)
40     self.checker(my_dom,file)
41    
42     def test_hex_1D_order1_onFace(self):
43     file="hex_1D_order1_onFace.msh"
44     my_dom=Interval(1,1,useElementsOnFace=1)
45     self.checker(my_dom,file)
46    
47 woo409 746 def test_hex_1D_order2(self):
48     file="hex_1D_order2.msh"
49     my_dom=Interval(1,2)
50     self.checker(my_dom,file)
51    
52     def test_hex_1D_order2_onFace(self):
53     file="hex_1D_order2_onFace.msh"
54     my_dom=Interval(1,2,useElementsOnFace=1)
55     self.checker(my_dom,file)
56    
57 woo409 747 def test_hex_2D_order1(self):
58     file="hex_2D_order1.msh"
59     my_dom=Rectangle(1,1,1)
60     self.checker(my_dom,file)
61 jgs 150
62 woo409 747 def test_hex_2D_order1_onFace(self):
63     file="hex_2D_order1_onFace.msh"
64     my_dom=Rectangle(1,1,1,useElementsOnFace=1)
65     self.checker(my_dom,file)
66    
67     def test_hex_2D_order2(self):
68     file="hex_2D_order2.msh"
69     my_dom=Rectangle(1,1,2)
70     self.checker(my_dom,file)
71    
72     def test_hex_2D_order2_onFace(self):
73     file="hex_2D_order2_onFace.msh"
74     my_dom=Rectangle(1,1,2,useElementsOnFace=1)
75     self.checker(my_dom,file)
76    
77     def test_hex_3D_order1(self):
78     file="hex_3D_order1.msh"
79     my_dom=Brick(1,1,1,1)
80     self.checker(my_dom,file)
81    
82     def test_hex_3D_order1_onFace(self):
83     file="hex_3D_order1_onFace.msh"
84     my_dom=Brick(1,1,1,1,useElementsOnFace=1)
85     self.checker(my_dom,file)
86    
87     def test_hex_3D_order2(self):
88     file="hex_3D_order2.msh"
89     my_dom=Brick(1,1,1,2)
90     self.checker(my_dom,file)
91    
92     def test_hex_3D_order2_onFace(self):
93     file="hex_3D_order2_onFace.msh"
94     my_dom=Brick(1,1,1,2,useElementsOnFace=1)
95     self.checker(my_dom,file)
96    
97     def test_hex_contact_2D_order1(self):
98     file="hex_contact_2D_order1.msh"
99     ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)
100     ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)
101     ms2.setX(ms2.getX()+[0,0.5])
102     my_dom=JoinFaces([ms1,ms2])
103     self.checker(my_dom,file)
104    
105     def test_hex_contact_2D_order1_onFace(self):
106     file="hex_contact_2D_order1_onFace.msh"
107     ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)
108     ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)
109     ms2.setX(ms2.getX()+[0,0.5])
110     my_dom=JoinFaces([ms1,ms2])
111     self.checker(my_dom,file)
112    
113     def test_hex_contact_2D_order2(self):
114     file="hex_contact_2D_order2.msh"
115     ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)
116     ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)
117     ms2.setX(ms2.getX()+[0,0.5])
118     my_dom=JoinFaces([ms1,ms2])
119     self.checker(my_dom,file)
120    
121     def test_hex_contact_2D_order2_onFace(self):
122     file="hex_contact_2D_order2_onFace.msh"
123     ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)
124     ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)
125     ms2.setX(ms2.getX()+[0,0.5])
126     my_dom=JoinFaces([ms1,ms2])
127     self.checker(my_dom,file)
128    
129     def test_hex_contact_3D_order1(self):
130     file="hex_contact_3D_order1.msh"
131     ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)
132     ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)
133     ms2.setX(ms2.getX()+[0,0,0.5])
134     my_dom=JoinFaces([ms1,ms2])
135     self.checker(my_dom,file)
136    
137     def test_hex_contact_3D_order1_onFace(self):
138     file="hex_contact_3D_order1_onFace.msh"
139     ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)
140     ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)
141     ms2.setX(ms2.getX()+[0,0,0.5])
142     my_dom=JoinFaces([ms1,ms2])
143     self.checker(my_dom,file)
144    
145     def test_hex_contact_3D_order2(self):
146     file="hex_contact_3D_order2.msh"
147     ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)
148     ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)
149     ms2.setX(ms2.getX()+[0,0,0.5])
150     my_dom=JoinFaces([ms1,ms2])
151     self.checker(my_dom,file)
152    
153     def test_hex_contact_3D_order2_onFace(self):
154     file="hex_contact_3D_order2_onFace.msh"
155     ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)
156     ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)
157     ms2.setX(ms2.getX()+[0,0,0.5])
158     my_dom=JoinFaces([ms1,ms2])
159     self.checker(my_dom,file)
160    
161 jgs 150 if __name__ == '__main__':
162     suite = unittest.TestSuite()
163     suite.addTest(unittest.makeSuite(Test_Generators))
164     s=unittest.TextTestRunner(verbosity=2).run(suite)
165     if s.wasSuccessful():
166     sys.exit(0)
167     else:
168     sys.exit(1)

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26