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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/finley/test/python/test_utilOnFinley.py revision 589 by gross, Fri Mar 10 06:28:35 2006 UTC trunk/finley/test/python/run_utilOnFinley.py revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC
# Line 1  Line 1 
1    #
2  # $Id$  # $Id$
3    #
4    #######################################################
5    #
6    #           Copyright 2003-2007 by ACceSS MNRF
7    #       Copyright 2007 by University of Queensland
8    #
9    #                http://esscc.uq.edu.au
10    #        Primary Business: Queensland, Australia
11    #  Licensed under the Open Software License version 3.0
12    #     http://www.opensource.org/licenses/osl-3.0.php
13    #
14    #######################################################
15    #
16    
17    __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
18                        http://www.access.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  import unittest  import unittest
23  # from esys.escript.test_util import Test_util_no_tagged_data as Test_util  from test_util import Test_util as Test_util
24  from esys.escript.test_util import Test_util_with_tagged_data as Test_util  from test_util import Test_Util_SpatialFunctions, Test_Util_SpatialFunctions_noGradOnBoundary, Test_Util_SpatialFunctions_noGradOnBoundary_noContact
25  #from esys.escript.test_util import Test_util as Test_util  from test_symbols import Test_symbols
 from esys.escript.test_util import Test_Util_SpatialFunctions  
 from esys.escript.test_symbols import Test_symbols  
26    
27  from esys.escript import FunctionOnBoundary  from esys.escript import FunctionOnBoundary
28  from esys.finley import Rectangle,Brick,JoinFaces  from esys.finley import Rectangle,Brick,JoinFaces,ReadMesh
29  import sys  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=FINLEY_TEST_DATA+"/data_meshes/"
38    
39    
40    NE=4 # number elements, must be even
41    
42  class Test_UtilOnFinley(Test_util,Test_symbols):  class Test_UtilOnFinley(Test_util,Test_symbols):
43     def setUp(self):     def setUp(self):
44         self.domain =Rectangle(10,10,2)         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         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(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(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_SpatialFunctionsOnFinley2DOrder1(Test_Util_SpatialFunctions):  class Test_Util_SpatialFunctionsOnFinleyTet3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
67      def setUp(self):      def setUp(self):
68          self.order=1          self.order=1
69          d1 = Rectangle(n0=6,n1=12,l0=0.5,order=1,useElementsOnFace=True)          self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order1.fly",optimize=False)
70          d2 = Rectangle(n0=6,n1=12,l0=0.5,order=1,useElementsOnFace=True)      def tearDown(self):
71            del self.order
72            del self.domain
73    
74    class Test_Util_SpatialFunctionsOnFinleyTet3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
75        def setUp(self):
76            self.order=2
77            self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order2.fly",optimize=False)
78        def tearDown(self):
79            del self.order
80            del self.domain
81    
82    class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary):
83        def setUp(self):
84            self.order=1
85            d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1)
86            d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1)
87          d2.setX(d2.getX()+[0.5,0.])          d2.setX(d2.getX()+[0.5,0.])
88          self.domain = JoinFaces([d1,d2])          self.domain = JoinFaces([d1,d2],optimize=False)
89        def tearDown(self):
90            del self.order
91            del self.domain
92    
93  class Test_Util_SpatialFunctionsOnFinley2DOrder2(Test_Util_SpatialFunctions):  class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary):
94      def setUp(self):      def setUp(self):
95          self.order=2          self.order=2
96          d1 = Rectangle(n0=3,n1=6,l0=0.5,order=2,useElementsOnFace=True)          d1 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2)
97          d2 = Rectangle(n0=3,n1=6,l0=0.5,order=2,useElementsOnFace=True)          d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2)
98          d2.setX(d2.getX()+[0.5,0.])          d2.setX(d2.getX()+[0.5,0.])
99          self.domain = JoinFaces([d1,d2])          self.domain = JoinFaces([d1,d2],optimize=False)
100        def tearDown(self):
101            del self.order
102            del self.domain
103    
104  class Test_Util_SpatialFunctionsOnFinley3DOrder1(Test_Util_SpatialFunctions):  class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary):
105      def setUp(self):      def setUp(self):
106          self.order=1          self.order=1
107          d1 = Brick(n0=6,n1=12,n2=12,l0=0.5,order=1,useElementsOnFace=True)          d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1)
108          d2 = Brick(n0=6,n1=12,n2=12,l0=0.5,order=1,useElementsOnFace=True)          d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1)
109          d2.setX(d2.getX()+[0.5,0.,0.])          d2.setX(d2.getX()+[0.5,0.,0.])
110          self.domain = JoinFaces([d1,d2])          self.domain = JoinFaces([d1,d2],optimize=False)
111        def tearDown(self):
112            del self.order
113            del self.domain
114    
115  class Test_Util_SpatialFunctionsOnFinley3DOrder2(Test_Util_SpatialFunctions):  class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary):
116      def setUp(self):      def setUp(self):
117          self.order=2          self.order=2
118          d1 = Brick(n0=3,n1=6,n2=6,l0=0.5,order=2,useElementsOnFace=True)          d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2)
119          d2 = Brick(n0=3,n1=6,n2=6,l0=0.5,order=2,useElementsOnFace=True)          d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2)
120          d2.setX(d2.getX()+[0.5,0.,0.])          d2.setX(d2.getX()+[0.5,0.,0.])
121          self.domain = JoinFaces([d1,d2])          self.domain = JoinFaces([d1,d2],optimize=False)
122        def tearDown(self):
123            del self.order
124            del self.domain
125    
126    class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFace(Test_Util_SpatialFunctions):
127        def setUp(self):
128            self.order=1
129            d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
130            d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
131            d2.setX(d2.getX()+[0.5,0.])
132            self.domain = JoinFaces([d1,d2],optimize=False)
133        def tearDown(self):
134            del self.order
135            del self.domain
136    
137    class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFace(Test_Util_SpatialFunctions):
138        def setUp(self):
139            self.order=2
140            d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
141            d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
142            d2.setX(d2.getX()+[0.5,0.])
143            self.domain = JoinFaces([d1,d2],optimize=False)
144        def tearDown(self):
145            del self.order
146            del self.domain
147    
148    class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFace(Test_Util_SpatialFunctions):
149        def setUp(self):
150            self.order=1
151            d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
152            d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
153            d2.setX(d2.getX()+[0.5,0.,0.])
154            self.domain = JoinFaces([d1,d2],optimize=False)
155        def tearDown(self):
156            del self.order
157            del self.domain
158    
159    class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFace(Test_Util_SpatialFunctions):
160        def setUp(self):
161            self.order=2
162            d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
163            d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
164            d2.setX(d2.getX()+[0.5,0.,0.])
165            self.domain = JoinFaces([d1,d2],optimize=False)
166        def tearDown(self):
167            del self.order
168            del self.domain
169    
170  if __name__ == '__main__':  if __name__ == '__main__':
171     suite = unittest.TestSuite()     suite = unittest.TestSuite()
172     suite.addTest(unittest.makeSuite(Test_UtilOnFinley))     if True:
173     # suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinley2DOrder1))        suite.addTest(unittest.makeSuite(Test_UtilOnFinley))
174     # suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinley2DOrder2))        suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder1))
175     # suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinley3DOrder1))        suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder2))
176     # suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinley3DOrder2))        suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder1))
177     s=unittest.TextTestRunner(verbosity=2).run(suite)        suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder2))
178     if s.wasSuccessful():        suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DOrder1))
179       sys.exit(0)        suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DOrder2))
180          suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DOrder1))
181          suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DOrder2))
182          suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFace))
183          suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFace))
184          suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFace))
185          suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFace))
186     else:     else:
187       sys.exit(1)        pass
188         s=unittest.TextTestRunner(verbosity=2).run(suite)

Legend:
Removed from v.589  
changed lines
  Added in v.1312

  ViewVC Help
Powered by ViewVC 1.1.26