/[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 626 - (hide annotations)
Thu Mar 23 02:16:36 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: 5526 byte(s)
Copyright information inserted

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26