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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 150 - (hide annotations)
Thu Sep 15 03:44:45 2005 UTC (14 years, 2 months ago) by jgs
Original Path: trunk/esys2/finley/test/python/test_generators.py
File MIME type: text/x-python
File size: 5237 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-15

1 jgs 150 # $Id$
2    
3     import sys
4     import unittest
5     from esys.escript import *
6     from esys.finley import Interval,Rectangle,Brick,JoinFaces
7    
8     """
9     checks the mesh generators against the reference meshes in test_meshes
10     """
11    
12     TEST_FILE_EXT=".test"
13     REERFENCE_FILE_DIR="test_meshes"
14    
15     class Test_Generators(unittest.TestCase):
16    
17     def checker(self,dom,reference):
18     dom_file=reference+TEST_FILE_EXT
19     dom.write(dom_file)
20     dom_string=open(dom_file).read().splitlines()
21     ref_string=open(REERFENCE_FILE_DIR+"/"+reference).read().splitlines()
22     self.failUnlessEqual(len(dom_string),len(ref_string),"number of lines in mesh files does not match reference")
23     for l in range(1,len(ref_string)):
24     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()))
25    
26     def test_hex_1D_order1(self):
27     file="hex_1D_order1.msh"
28     my_dom=Interval(1,1)
29     self.checker(my_dom,file)
30    
31     def test_hex_1D_order1_onFace(self):
32     file="hex_1D_order1_onFace.msh"
33     my_dom=Interval(1,1,useElementsOnFace=1)
34     self.checker(my_dom,file)
35    
36     def test_hex_1D_order2(self):
37     file="hex_1D_order2.msh"
38     my_dom=Interval(1,2)
39     self.checker(my_dom,file)
40    
41     def test_hex_1D_order2_onFace(self):
42     file="hex_1D_order2_onFace.msh"
43     my_dom=Interval(1,2,useElementsOnFace=1)
44     self.checker(my_dom,file)
45    
46     def test_hex_2D_order1(self):
47     file="hex_2D_order1.msh"
48     my_dom=Rectangle(1,1,1)
49     self.checker(my_dom,file)
50    
51     def test_hex_2D_order1_onFace(self):
52     file="hex_2D_order1_onFace.msh"
53     my_dom=Rectangle(1,1,1,useElementsOnFace=1)
54     self.checker(my_dom,file)
55    
56     def test_hex_2D_order2(self):
57     file="hex_2D_order2.msh"
58     my_dom=Rectangle(1,1,2)
59     self.checker(my_dom,file)
60    
61     def test_hex_2D_order2_onFace(self):
62     file="hex_2D_order2_onFace.msh"
63     my_dom=Rectangle(1,1,2,useElementsOnFace=1)
64     self.checker(my_dom,file)
65    
66     def test_hex_3D_order1(self):
67     file="hex_3D_order1.msh"
68     my_dom=Brick(1,1,1,1)
69     self.checker(my_dom,file)
70    
71     def test_hex_3D_order1_onFace(self):
72     file="hex_3D_order1_onFace.msh"
73     my_dom=Brick(1,1,1,1,useElementsOnFace=1)
74     self.checker(my_dom,file)
75    
76     def test_hex_3D_order2(self):
77     file="hex_3D_order2.msh"
78     my_dom=Brick(1,1,1,2)
79     self.checker(my_dom,file)
80    
81     def test_hex_3D_order2_onFace(self):
82     file="hex_3D_order2_onFace.msh"
83     my_dom=Brick(1,1,1,2,useElementsOnFace=1)
84     self.checker(my_dom,file)
85    
86     def test_hex_contact_2D_order1(self):
87     file="hex_contact_2D_order1.msh"
88     ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)
89     ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)
90     ms2.setX(ms2.getX()+[0,0.5])
91     my_dom=JoinFaces([ms1,ms2])
92     self.checker(my_dom,file)
93    
94     def test_hex_contact_2D_order1_onFace(self):
95     file="hex_contact_2D_order1_onFace.msh"
96     ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)
97     ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)
98     ms2.setX(ms2.getX()+[0,0.5])
99     my_dom=JoinFaces([ms1,ms2])
100     self.checker(my_dom,file)
101    
102     def test_hex_contact_2D_order2(self):
103     file="hex_contact_2D_order2.msh"
104     ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)
105     ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)
106     ms2.setX(ms2.getX()+[0,0.5])
107     my_dom=JoinFaces([ms1,ms2])
108     self.checker(my_dom,file)
109    
110     def test_hex_contact_2D_order2_onFace(self):
111     file="hex_contact_2D_order2_onFace.msh"
112     ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)
113     ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)
114     ms2.setX(ms2.getX()+[0,0.5])
115     my_dom=JoinFaces([ms1,ms2])
116     self.checker(my_dom,file)
117    
118     def test_hex_contact_3D_order1(self):
119     file="hex_contact_3D_order1.msh"
120     ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)
121     ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)
122     ms2.setX(ms2.getX()+[0,0,0.5])
123     my_dom=JoinFaces([ms1,ms2])
124     self.checker(my_dom,file)
125    
126     def test_hex_contact_3D_order1_onFace(self):
127     file="hex_contact_3D_order1_onFace.msh"
128     ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)
129     ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)
130     ms2.setX(ms2.getX()+[0,0,0.5])
131     my_dom=JoinFaces([ms1,ms2])
132     self.checker(my_dom,file)
133    
134     def test_hex_contact_3D_order2(self):
135     file="hex_contact_3D_order2.msh"
136     ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)
137     ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)
138     ms2.setX(ms2.getX()+[0,0,0.5])
139     my_dom=JoinFaces([ms1,ms2])
140     self.checker(my_dom,file)
141    
142     def test_hex_contact_3D_order2_onFace(self):
143     file="hex_contact_3D_order2_onFace.msh"
144     ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)
145     ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)
146     ms2.setX(ms2.getX()+[0,0,0.5])
147     my_dom=JoinFaces([ms1,ms2])
148     self.checker(my_dom,file)
149    
150     if __name__ == '__main__':
151     suite = unittest.TestSuite()
152     suite.addTest(unittest.makeSuite(Test_Generators))
153     s=unittest.TextTestRunner(verbosity=2).run(suite)
154     if s.wasSuccessful():
155     sys.exit(0)
156     else:
157     sys.exit(1)

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26