/[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 617 - (hide annotations)
Wed Mar 22 02:58:17 2006 UTC (13 years, 7 months ago) by elspeth
Original Path: trunk/finley/test/python/test_generators.py
File MIME type: text/x-python
File size: 5525 byte(s)
More copyright.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26