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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4984 - (show annotations)
Mon Jun 2 02:50:34 2014 UTC (5 years ago) by sshaw
File MIME type: text/x-python
File size: 9532 byte(s)
revamping testrunners, now uses automated discovery and allows running specific tests without modifying files (see escriptcore/py_src/testing.py for more info/examples)

1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2014 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 __copyright__="""Copyright (c) 2003-2014 by University of Queensland
18 http://www.uq.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 __url__="https://launchpad.net/escript-finley"
23
24 import esys.escriptcore.utestselect as unittest
25 from esys.escriptcore.testing import *
26 from test_util import Test_util as Test_util
27 from test_util import Test_Util_SpatialFunctions, Test_Util_SpatialFunctions_noGradOnBoundary, Test_Util_SpatialFunctions_noGradOnBoundary_noContact
28
29 from esys.escript import *
30 from esys.finley import Rectangle,Brick,JoinFaces,ReadMesh
31 import sys
32 import os
33
34 if HAVE_SYMBOLS:
35 from test_symfuncs import Test_symfuncs
36 else:
37 print("Skipping symbolic tests since sympy is not available")
38 class Test_symfuncs:
39 pass
40
41 try:
42 FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
43 except KeyError:
44 FINLEY_TEST_DATA='.'
45
46 FINLEY_TEST_MESH_PATH=os.path.join(FINLEY_TEST_DATA,"data_meshes")
47
48
49 NE=4 # number elements, must be even
50
51 class Test_UtilOnFinley(Test_util,Test_symfuncs):
52 def setUp(self):
53 self.domain =Rectangle(NE,NE+1,2)
54 self.functionspace = FunctionOnBoundary(self.domain) # due to a bug in escript python needs to hold a reference to the domain
55 def tearDown(self):
56 del self.functionspace
57 del self.domain
58
59 class Test_Util_SpatialFunctionsOnFinleyTet2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
60 def setUp(self):
61 self.order=1
62 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_order1.fly"),optimize=False)
63 def tearDown(self):
64 del self.order
65 del self.domain
66
67 class Test_Util_SpatialFunctionsOnFinleyTet2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
68 def setUp(self):
69 self.order=2
70 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_order2.fly"),optimize=False)
71 def tearDown(self):
72 del self.order
73 del self.domain
74
75 class Test_Util_SpatialFunctionsOnFinleyTet2DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
76 def setUp(self):
77 self.order=1
78 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_macro.fly"),optimize=False)
79 def tearDown(self):
80 del self.order
81 del self.domain
82
83 class Test_Util_SpatialFunctionsOnFinleyTet3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
84 def setUp(self):
85 self.order=1
86 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_order1.fly"),optimize=False)
87 def tearDown(self):
88 del self.order
89 del self.domain
90
91 class Test_Util_SpatialFunctionsOnFinleyTet3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
92 def setUp(self):
93 self.order=2
94 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_order2.fly"),optimize=False)
95 def tearDown(self):
96 del self.order
97 del self.domain
98
99 class Test_Util_SpatialFunctionsOnFinleyTet3DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
100 def setUp(self):
101 self.order=1
102 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_macro.fly"),optimize=False)
103 def tearDown(self):
104 del self.order
105 del self.domain
106
107 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
108 def setUp(self):
109 self.order=1
110 self.domain = Rectangle(n0=NE,n1=NE,order=1,useElementsOnFace=0)
111 def tearDown(self):
112 del self.order
113 del self.domain
114
115 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
116 def setUp(self):
117 self.order=2
118 self.domain = Rectangle(n0=NE,n1=NE,order=2,useElementsOnFace=0)
119 def tearDown(self):
120 del self.order
121 del self.domain
122
123 class Test_Util_SpatialFunctionsOnFinleyHex2DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
124 def setUp(self):
125 self.order=1
126 self.domain = Rectangle(n0=NE,n1=NE,order=-1,useElementsOnFace=0)
127 def tearDown(self):
128 del self.order
129 del self.domain
130
131 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
132 def setUp(self):
133 self.order=1
134 self.domain = Brick(n0=NE,n1=NE,n2=NE,order=1,useElementsOnFace=0)
135 def tearDown(self):
136 del self.order
137 del self.domain
138
139 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
140 def setUp(self):
141 self.order=2
142 self.domain = Brick(n0=NE,n1=NE,n2=NE,order=2,useElementsOnFace=0)
143 def tearDown(self):
144 del self.order
145 del self.domain
146
147 class Test_Util_SpatialFunctionsOnFinleyHex3DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
148 def setUp(self):
149 self.order=1
150 self.domain = Brick(n0=NE,n1=NE,n2=NE,order=-1,useElementsOnFace=0)
151 def tearDown(self):
152 del self.order
153 del self.domain
154
155 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
156 def setUp(self):
157 self.order=1
158 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1,useElementsOnFace=0)
159 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1,useElementsOnFace=0)
160 d2.setX(d2.getX()+[0.5,0.])
161 self.domain = JoinFaces([d1,d2],optimize=False)
162 def tearDown(self):
163 del self.order
164 del self.domain
165
166 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
167 def setUp(self):
168 self.order=2
169 d1 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2,useElementsOnFace=0)
170 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2,useElementsOnFace=0)
171 d2.setX(d2.getX()+[0.5,0.])
172 self.domain = JoinFaces([d1,d2],optimize=False)
173 def tearDown(self):
174 del self.order
175 del self.domain
176
177 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
178 def setUp(self):
179 self.order=1
180 d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=0)
181 d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=0)
182 d2.setX(d2.getX()+[0.5,0.,0.])
183 self.domain = JoinFaces([d1,d2],optimize=False)
184 def tearDown(self):
185 del self.order
186 del self.domain
187
188 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2withContact(Test_Util_SpatialFunctions_noGradOnBoundary):
189 def setUp(self):
190 self.order=2
191 d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=0)
192 d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=0)
193 d2.setX(d2.getX()+[0.5,0.,0.])
194 self.domain = JoinFaces([d1,d2],optimize=False)
195 def tearDown(self):
196 del self.order
197 del self.domain
198
199 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFacewithContact(Test_Util_SpatialFunctions):
200 def setUp(self):
201 self.order=1
202 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
203 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
204 d2.setX(d2.getX()+[0.5,0.])
205 self.domain = JoinFaces([d1,d2],optimize=False)
206 def tearDown(self):
207 del self.order
208 del self.domain
209
210 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFacewithContact(Test_Util_SpatialFunctions):
211 def setUp(self):
212 self.order=2
213 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
214 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
215 d2.setX(d2.getX()+[0.5,0.])
216 self.domain = JoinFaces([d1,d2],optimize=False)
217 def tearDown(self):
218 del self.order
219 del self.domain
220
221 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFacewithContact(Test_Util_SpatialFunctions):
222 def setUp(self):
223 self.order=1
224 d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
225 d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
226 d2.setX(d2.getX()+[0.5,0.,0.])
227 self.domain = JoinFaces([d1,d2],optimize=False)
228 def tearDown(self):
229 del self.order
230 del self.domain
231
232 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFacewithContact(Test_Util_SpatialFunctions):
233 def setUp(self):
234 self.order=2
235 d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
236 d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
237 d2.setX(d2.getX()+[0.5,0.,0.])
238 self.domain = JoinFaces([d1,d2],optimize=False)
239 def tearDown(self):
240 del self.order
241 del self.domain
242
243 if __name__ == '__main__':
244 run_tests(__name__, exit_on_failure=True)
245

  ViewVC Help
Powered by ViewVC 1.1.26