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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26