/[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 757 - (show annotations)
Mon Jun 26 13:12:56 2006 UTC (13 years, 5 months ago) by woo409
File MIME type: text/x-python
File size: 5848 byte(s)
+ Merge of intelc_win32 branch (revision 741:755) with trunk. Tested on iVEC altix (run_tests and py_tests all pass)

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 if os.name == "nt":
22 FINLEY_TEST_DATA_PATH = FINLEY_TEST_DATA_PATH+"win32/"
23 FINLEY_WORKDIR_PATH=os.environ['FINLEY_WORKDIR']+"/"
24
25 TEST_FILE_EXT=".test"
26 class Test_Generators(unittest.TestCase):
27
28 def checker(self,dom,reference):
29 dom_file=FINLEY_WORKDIR_PATH+TEST_FILE_EXT
30 dom.write(dom_file)
31 # Uncomment this section to dump the files for regression testing
32 # if True:
33 # dom.write(FINLEY_TEST_DATA_PATH+reference)
34 dom_string=open(dom_file).read().splitlines()
35 ref_string=open(FINLEY_TEST_DATA_PATH+reference).read().splitlines()
36 self.failUnlessEqual(len(dom_string),len(ref_string),"number of lines in mesh files does not match reference")
37 for l in range(1,len(ref_string)):
38 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()))
39
40 def test_hex_1D_order1(self):
41 file="hex_1D_order1.msh"
42 my_dom=Interval(1,1)
43 self.checker(my_dom,file)
44
45 def test_hex_1D_order1_onFace(self):
46 file="hex_1D_order1_onFace.msh"
47 my_dom=Interval(1,1,useElementsOnFace=1)
48 self.checker(my_dom,file)
49
50 def test_hex_1D_order2(self):
51 file="hex_1D_order2.msh"
52 my_dom=Interval(1,2)
53 self.checker(my_dom,file)
54
55 def test_hex_1D_order2_onFace(self):
56 file="hex_1D_order2_onFace.msh"
57 my_dom=Interval(1,2,useElementsOnFace=1)
58 self.checker(my_dom,file)
59
60 def test_hex_2D_order1(self):
61 file="hex_2D_order1.msh"
62 my_dom=Rectangle(1,1,1)
63 self.checker(my_dom,file)
64
65 def test_hex_2D_order1_onFace(self):
66 file="hex_2D_order1_onFace.msh"
67 my_dom=Rectangle(1,1,1,useElementsOnFace=1)
68 self.checker(my_dom,file)
69
70 def test_hex_2D_order2(self):
71 file="hex_2D_order2.msh"
72 my_dom=Rectangle(1,1,2)
73 self.checker(my_dom,file)
74
75 def test_hex_2D_order2_onFace(self):
76 file="hex_2D_order2_onFace.msh"
77 my_dom=Rectangle(1,1,2,useElementsOnFace=1)
78 self.checker(my_dom,file)
79
80 def test_hex_3D_order1(self):
81 file="hex_3D_order1.msh"
82 my_dom=Brick(1,1,1,1)
83 self.checker(my_dom,file)
84
85 def test_hex_3D_order1_onFace(self):
86 file="hex_3D_order1_onFace.msh"
87 my_dom=Brick(1,1,1,1,useElementsOnFace=1)
88 self.checker(my_dom,file)
89
90 def test_hex_3D_order2(self):
91 file="hex_3D_order2.msh"
92 my_dom=Brick(1,1,1,2)
93 self.checker(my_dom,file)
94
95 def test_hex_3D_order2_onFace(self):
96 file="hex_3D_order2_onFace.msh"
97 my_dom=Brick(1,1,1,2,useElementsOnFace=1)
98 self.checker(my_dom,file)
99
100 def test_hex_contact_2D_order1(self):
101 file="hex_contact_2D_order1.msh"
102 ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)
103 ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=False)
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_order1_onFace(self):
109 file="hex_contact_2D_order1_onFace.msh"
110 ms1=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)
111 ms2=Rectangle(1,1,1,l1=0.5,useElementsOnFace=True)
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(self):
117 file="hex_contact_2D_order2.msh"
118 ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)
119 ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=False)
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_2D_order2_onFace(self):
125 file="hex_contact_2D_order2_onFace.msh"
126 ms1=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)
127 ms2=Rectangle(1,1,2,l1=0.5,useElementsOnFace=True)
128 ms2.setX(ms2.getX()+[0,0.5])
129 my_dom=JoinFaces([ms1,ms2])
130 self.checker(my_dom,file)
131
132 def test_hex_contact_3D_order1(self):
133 file="hex_contact_3D_order1.msh"
134 ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)
135 ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=False)
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_order1_onFace(self):
141 file="hex_contact_3D_order1_onFace.msh"
142 ms1=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)
143 ms2=Brick(1,1,1,1,l2=0.5,useElementsOnFace=True)
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(self):
149 file="hex_contact_3D_order2.msh"
150 ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)
151 ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=False)
152 ms2.setX(ms2.getX()+[0,0,0.5])
153 my_dom=JoinFaces([ms1,ms2])
154 self.checker(my_dom,file)
155
156 def test_hex_contact_3D_order2_onFace(self):
157 file="hex_contact_3D_order2_onFace.msh"
158 ms1=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)
159 ms2=Brick(1,1,1,2,l2=0.5,useElementsOnFace=True)
160 ms2.setX(ms2.getX()+[0,0,0.5])
161 my_dom=JoinFaces([ms1,ms2])
162 self.checker(my_dom,file)
163
164 if __name__ == '__main__':
165 suite = unittest.TestSuite()
166 suite.addTest(unittest.makeSuite(Test_Generators))
167 s=unittest.TextTestRunner(verbosity=2).run(suite)
168 if s.wasSuccessful():
169 sys.exit(0)
170 else:
171 sys.exit(1)

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26