/[escript]/branches/domexper/dudley/test/python/fixme_run_generators.py
ViewVC logotype

Annotation of /branches/domexper/dudley/test/python/fixme_run_generators.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 798 - (hide annotations)
Fri Aug 4 01:05:36 2006 UTC (13 years, 4 months ago) by gross
Original Path: trunk/finley/test/python/run_generators.py
File MIME type: text/x-python
File size: 6018 byte(s)
Reimplementation of the assemblage with persistent jacobeans.
There are also a few changes to the tests which has now
dramatically reduced the memory demand.


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26