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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 857 - (show annotations)
Tue Sep 26 01:00:45 2006 UTC (13 years ago) by gross
File MIME type: text/x-python
File size: 7141 byte(s)
tests for order1 tetrahedron elements added
1 # $Id$
2
3 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
4 http://www.access.edu.au
5 Primary Business: Queensland, Australia"""
6 __license__="""Licensed under the Open Software License version 3.0
7 http://www.opensource.org/licenses/osl-3.0.php"""
8 import unittest
9 from test_util import Test_util as Test_util
10 from test_util import Test_Util_SpatialFunctions, Test_Util_SpatialFunctions_noGradOnBoundary, Test_Util_SpatialFunctions_noGradOnBoundary_noContact
11 from test_symbols import Test_symbols
12
13 from esys.escript import FunctionOnBoundary, saveVTK
14 from esys.finley import Rectangle,Brick,JoinFaces,ReadMesh
15 import sys
16 import os
17
18 try:
19 FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
20 except KeyError:
21 FINLEY_TEST_DATA='.'
22
23 FINLEY_TEST_MESH_PATH=FINLEY_TEST_DATA+"/data_meshes/"
24
25
26 NE=4 # number elements, must be even
27
28 class Test_UtilOnFinley(Test_util,Test_symbols):
29 def setUp(self):
30 self.domain =Rectangle(NE,NE+1,2)
31 self.functionspace = FunctionOnBoundary(self.domain) # due to a bug in escript python needs to hold a reference to the domain
32 def tearDown(self):
33 del self.functionspace
34 del self.domain
35
36 class Test_Util_SpatialFunctionsOnFinleyTet2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
37 def setUp(self):
38 self.order=1
39 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_2D_order1.fly")
40 def tearDown(self):
41 del self.order
42 del self.domain
43
44 class Test_Util_SpatialFunctionsOnFinleyTet2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
45 def setUp(self):
46 self.order=2
47 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_2D_order2.fly")
48 def tearDown(self):
49 del self.order
50 del self.domain
51
52 class Test_Util_SpatialFunctionsOnFinleyTet3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
53 def setUp(self):
54 self.order=1
55 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order1.fly")
56 def tearDown(self):
57 del self.order
58 del self.domain
59
60 class Test_Util_SpatialFunctionsOnFinleyTet3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
61 def setUp(self):
62 self.order=2
63 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order2.fly")
64 def tearDown(self):
65 del self.order
66 del self.domain
67
68 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary):
69 def setUp(self):
70 self.order=1
71 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1)
72 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1)
73 d2.setX(d2.getX()+[0.5,0.])
74 self.domain = JoinFaces([d1,d2])
75 def tearDown(self):
76 del self.order
77 del self.domain
78
79 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary):
80 def setUp(self):
81 self.order=2
82 d1 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2)
83 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2)
84 d2.setX(d2.getX()+[0.5,0.])
85 self.domain = JoinFaces([d1,d2])
86 def tearDown(self):
87 del self.order
88 del self.domain
89
90 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary):
91 def setUp(self):
92 self.order=1
93 d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1)
94 d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1)
95 d2.setX(d2.getX()+[0.5,0.,0.])
96 self.domain = JoinFaces([d1,d2])
97 def tearDown(self):
98 del self.order
99 del self.domain
100
101 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary):
102 def setUp(self):
103 self.order=2
104 d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2)
105 d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2)
106 d2.setX(d2.getX()+[0.5,0.,0.])
107 self.domain = JoinFaces([d1,d2])
108 def tearDown(self):
109 del self.order
110 del self.domain
111
112 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFace(Test_Util_SpatialFunctions):
113 def setUp(self):
114 self.order=1
115 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
116 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
117 d2.setX(d2.getX()+[0.5,0.])
118 self.domain = JoinFaces([d1,d2])
119 def tearDown(self):
120 del self.order
121 del self.domain
122
123 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFace(Test_Util_SpatialFunctions):
124 def setUp(self):
125 self.order=2
126 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
127 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
128 d2.setX(d2.getX()+[0.5,0.])
129 self.domain = JoinFaces([d1,d2])
130 def tearDown(self):
131 del self.order
132 del self.domain
133
134 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFace(Test_Util_SpatialFunctions):
135 def setUp(self):
136 self.order=1
137 d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
138 d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
139 d2.setX(d2.getX()+[0.5,0.,0.])
140 self.domain = JoinFaces([d1,d2])
141 def tearDown(self):
142 del self.order
143 del self.domain
144
145 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFace(Test_Util_SpatialFunctions):
146 def setUp(self):
147 self.order=2
148 d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
149 d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
150 d2.setX(d2.getX()+[0.5,0.,0.])
151 self.domain = JoinFaces([d1,d2])
152 def tearDown(self):
153 del self.order
154 del self.domain
155
156 if __name__ == '__main__':
157 suite = unittest.TestSuite()
158 if True:
159 suite.addTest(unittest.makeSuite(Test_UtilOnFinley))
160 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder1))
161 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder2))
162 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder1))
163 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder2))
164 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DOrder1))
165 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DOrder2))
166 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFace))
167 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFace))
168 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFace))
169 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFace))
170 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DOrder1))
171 else:
172 # suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DOrder2))
173 s=unittest.TextTestRunner(verbosity=2).run(suite)
174 if s.wasSuccessful():
175 sys.exit(0)
176 else:
177 sys.exit(1)
178

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26