/[escript]/trunk/ripley/test/python/run_utilOnRipley.py
ViewVC logotype

Annotation of /trunk/ripley/test/python/run_utilOnRipley.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3792 - (hide annotations)
Wed Feb 1 06:16:25 2012 UTC (7 years, 2 months ago) by caltinay
File MIME type: text/x-python
File size: 2844 byte(s)
Merged ripley rectangular domain into trunk.

1 caltinay 3714
2     ########################################################
3     #
4 caltinay 3781 # Copyright (c) 2003-2012 by University of Queensland
5 caltinay 3714 # 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 caltinay 3781 __copyright__="""Copyright (c) 2003-2012 by University of Queensland
15 caltinay 3714 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 caltinay 3722 from test_util import Test_util
24 caltinay 3714 from test_util import Test_Util_SpatialFunctions, Test_Util_SpatialFunctions_noGradOnBoundary_noContact
25     from test_symbols import Test_symbols
26    
27     from esys.escript import *
28     from esys.ripley import Rectangle, Brick
29     import sys
30     import os
31    
32     try:
33     RIPLEY_TEST_DATA=os.environ['RIPLEY_TEST_DATA']
34     except KeyError:
35     RIPLEY_TEST_DATA='.'
36    
37     NE=4 # number elements
38    
39 caltinay 3764 mpiSize=getMPISizeWorld()
40     for x in [int(sqrt(mpiSize)),2,3,5,7,1]:
41     NX=x
42     NY=mpiSize/x
43     if NX*NY == mpiSize:
44     break
45    
46     for x in [(int(mpiSize**(1/3.)),int(mpiSize**(1/3.))),(2,3),(2,2),(1,2),(1,1)]:
47     NXb=x[0]
48     NYb=x[1]
49     NZb=mpiSize/(x[0]*x[1])
50     if NXb*NYb*NZb == mpiSize:
51     break
52    
53 caltinay 3722 class Test_UtilOnRipley(Test_util,Test_symbols):
54 caltinay 3764 def setUp(self):
55     self.domain=Rectangle(n0=NE*NX-1, n1=NE*NY-1, l0=1., l1=1., d0=NX, d1=NY)
56     self.functionspace = FunctionOnBoundary(self.domain) # due to a bug in escript python needs to hold a reference to the domain
57     def tearDown(self):
58     del self.functionspace
59     del self.domain
60 caltinay 3714
61     class Test_Util_SpatialFunctionsOnRipleyRect(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
62     def setUp(self):
63     self.order=1
64 caltinay 3764 self.domain = Rectangle(n0=NE*NX-1, n1=NE*NY-1, l0=1., l1=1., d0=NX, d1=NY)
65 caltinay 3714 def tearDown(self):
66     del self.order
67     del self.domain
68    
69     class Test_Util_SpatialFunctionsOnRipleyBrick(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
70     def setUp(self):
71     self.order=1
72 caltinay 3764 self.domain = Brick(n0=NE*NXb-1, n1=NE*NYb-1, n2=NE*NZb-1, l0=1., l1=1., l2=1., d0=NXb, d1=NYb, d2=NZb)
73 caltinay 3714 def tearDown(self):
74     del self.order
75     del self.domain
76    
77     if __name__ == '__main__':
78 caltinay 3764 suite = unittest.TestSuite()
79     suite.addTest(unittest.makeSuite(Test_UtilOnRipley))
80     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnRipleyRect))
81     suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnRipleyBrick))
82     s=unittest.TextTestRunner(verbosity=2).run(suite)
83     if not s.wasSuccessful(): sys.exit(1)
84 caltinay 3714

  ViewVC Help
Powered by ViewVC 1.1.26