/[escript]/trunk/dudley/test/python/run_utilOnDudley.py
ViewVC logotype

Contents of /trunk/dudley/test/python/run_utilOnDudley.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2722 - (show annotations)
Fri Oct 16 06:45:01 2009 UTC (9 years, 6 months ago) by gross
Original Path: trunk/finley/test/python/run_utilOnFinley.py
File MIME type: text/x-python
File size: 8735 byte(s)
First steps towards macro elements. at the monent a  macro element is identical to its counterpart of 2nd order.




1
2 ########################################################
3 #
4 # Copyright (c) 2003-2009 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2009 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="https://launchpad.net/escript-finley"
21
22 import unittest
23 from test_util import Test_util as Test_util
24 from test_util import Test_Util_SpatialFunctions, Test_Util_SpatialFunctions_noGradOnBoundary, Test_Util_SpatialFunctions_noGradOnBoundary_noContact
25 from test_symbols import Test_symbols
26
27 from esys.escript import *
28 from esys.finley import Rectangle,Brick,JoinFaces,ReadMesh
29 import sys
30 import os
31
32 try:
33 FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
34 except KeyError:
35 FINLEY_TEST_DATA='.'
36
37 FINLEY_TEST_MESH_PATH=os.path.join(FINLEY_TEST_DATA,"data_meshes")
38
39
40 NE=4 # number elements, must be even
41
42 class Test_UtilOnFinley(Test_util,Test_symbols):
43 def setUp(self):
44 self.domain =Rectangle(NE,NE+1,2)
45 self.functionspace = FunctionOnBoundary(self.domain) # due to a bug in escript python needs to hold a reference to the domain
46 def tearDown(self):
47 del self.functionspace
48 del self.domain
49
50 class Test_Util_SpatialFunctionsOnFinleyTet2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
51 def setUp(self):
52 self.order=1
53 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_order1.fly"),optimize=False)
54 def tearDown(self):
55 del self.order
56 del self.domain
57
58 class Test_Util_SpatialFunctionsOnFinleyTet2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
59 def setUp(self):
60 self.order=2
61 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_order2.fly"),optimize=False)
62 def tearDown(self):
63 del self.order
64 del self.domain
65
66 class Test_Util_SpatialFunctionsOnFinleyTet2DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
67 def setUp(self):
68 self.order=1
69 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_2D_macro.fly"),optimize=False)
70 def tearDown(self):
71 del self.order
72 del self.domain
73
74 class Test_Util_SpatialFunctionsOnFinleyTet3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
75 def setUp(self):
76 self.order=1
77 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_order1.fly"),optimize=False)
78 def tearDown(self):
79 del self.order
80 del self.domain
81
82 class Test_Util_SpatialFunctionsOnFinleyTet3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
83 def setUp(self):
84 self.order=2
85 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_order2.fly"),optimize=False)
86 def tearDown(self):
87 del self.order
88 del self.domain
89
90 class Test_Util_SpatialFunctionsOnFinleyTet3DMacro(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
91 def setUp(self):
92 self.order=1
93 self.domain = ReadMesh(os.path.join(FINLEY_TEST_MESH_PATH,"tet_3D_macro.fly"),optimize=False)
94 def tearDown(self):
95 del self.order
96 del self.domain
97
98 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary):
99 def setUp(self):
100 self.order=1
101 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1)
102 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1)
103 d2.setX(d2.getX()+[0.5,0.])
104 self.domain = JoinFaces([d1,d2],optimize=False)
105 def tearDown(self):
106 del self.order
107 del self.domain
108
109 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary):
110 def setUp(self):
111 self.order=2
112 d1 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2)
113 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2)
114 d2.setX(d2.getX()+[0.5,0.])
115 self.domain = JoinFaces([d1,d2],optimize=False)
116 def tearDown(self):
117 del self.order
118 del self.domain
119
120 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary):
121 def setUp(self):
122 self.order=1
123 d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1)
124 d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1)
125 d2.setX(d2.getX()+[0.5,0.,0.])
126 self.domain = JoinFaces([d1,d2],optimize=False)
127 def tearDown(self):
128 del self.order
129 del self.domain
130
131 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary):
132 def setUp(self):
133 self.order=2
134 d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2)
135 d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2)
136 d2.setX(d2.getX()+[0.5,0.,0.])
137 self.domain = JoinFaces([d1,d2],optimize=False)
138 def tearDown(self):
139 del self.order
140 del self.domain
141
142 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFace(Test_Util_SpatialFunctions):
143 def setUp(self):
144 self.order=1
145 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
146 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
147 d2.setX(d2.getX()+[0.5,0.])
148 self.domain = JoinFaces([d1,d2],optimize=False)
149 def tearDown(self):
150 del self.order
151 del self.domain
152
153 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFace(Test_Util_SpatialFunctions):
154 def setUp(self):
155 self.order=2
156 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
157 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
158 d2.setX(d2.getX()+[0.5,0.])
159 self.domain = JoinFaces([d1,d2],optimize=False)
160 def tearDown(self):
161 del self.order
162 del self.domain
163
164 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFace(Test_Util_SpatialFunctions):
165 def setUp(self):
166 self.order=1
167 d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
168 d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
169 d2.setX(d2.getX()+[0.5,0.,0.])
170 self.domain = JoinFaces([d1,d2],optimize=False)
171 def tearDown(self):
172 del self.order
173 del self.domain
174
175 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFace(Test_Util_SpatialFunctions):
176 def setUp(self):
177 self.order=2
178 d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
179 d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
180 d2.setX(d2.getX()+[0.5,0.,0.])
181 self.domain = JoinFaces([d1,d2],optimize=False)
182 def tearDown(self):
183 del self.order
184 del self.domain
185
186 if __name__ == '__main__':
187 suite = unittest.TestSuite()
188 if True:
189 suite.addTest(unittest.makeSuite(Test_UtilOnFinley))
190 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DOrder1))
191 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DOrder2))
192 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DMacro))
193 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DOrder1))
194 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DOrder2))
195 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DMacro))
196 # These tests use JoinFaces and are not MPI parallel
197 if getMPISizeWorld() == 1:
198 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder1))
199 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder2))
200 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder1))
201 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder2))
202 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFace))
203 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFace))
204 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFace))
205 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFace))
206 else:
207 pass
208 s=unittest.TextTestRunner(verbosity=2).run(suite)
209 if not s.wasSuccessful(): sys.exit(1)
210

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26