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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4984 - (show annotations)
Mon Jun 2 02:50:34 2014 UTC (5 years, 2 months ago) by sshaw
File MIME type: text/x-python
File size: 2925 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
27 from test_util import Test_Util_SpatialFunctions, Test_Util_SpatialFunctions_noGradOnBoundary_noContact
28 from test_symfuncs import Test_symfuncs
29
30 from esys.escript import *
31 from esys.ripley import Rectangle, Brick
32 import sys
33 import os
34
35 if HAVE_SYMBOLS:
36 from test_symfuncs import Test_symfuncs
37 else:
38 print("Skipping symbolic tests since sympy is not available")
39 class Test_symfuncs:
40 pass
41
42 try:
43 RIPLEY_TEST_DATA=os.environ['RIPLEY_TEST_DATA']
44 except KeyError:
45 RIPLEY_TEST_DATA='.'
46
47 NE=4 # number elements
48
49 mpiSize=getMPISizeWorld()
50 for x in [int(sqrt(mpiSize)),2,3,5,7,1]:
51 NX=x
52 NY=mpiSize//x
53 if NX*NY == mpiSize:
54 break
55
56 for x in [(int(mpiSize**(1/3.)),int(mpiSize**(1/3.))),(2,3),(2,2),(1,2),(1,1)]:
57 NXb=x[0]
58 NYb=x[1]
59 NZb=mpiSize//(x[0]*x[1])
60 if NXb*NYb*NZb == mpiSize:
61 break
62
63 class Test_UtilOnRipley(Test_util,Test_symfuncs):
64 def setUp(self):
65 self.domain=Rectangle(n0=NE*NX-1, n1=NE*NY-1, l0=1., l1=1., d0=NX, d1=NY)
66 self.functionspace = FunctionOnBoundary(self.domain) # due to a bug in escript python needs to hold a reference to the domain
67 def tearDown(self):
68 del self.functionspace
69 del self.domain
70
71 class Test_Util_SpatialFunctionsOnRipleyRect(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
72 def setUp(self):
73 self.order=1
74 self.domain = Rectangle(n0=NE*NX-1, n1=NE*NY-1, l0=1., l1=1., d0=NX, d1=NY)
75 def tearDown(self):
76 del self.order
77 del self.domain
78
79 class Test_Util_SpatialFunctionsOnRipleyBrick(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
80 def setUp(self):
81 self.order=1
82 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)
83 def tearDown(self):
84 del self.order
85 del self.domain
86
87 if __name__ == '__main__':
88 run_tests(__name__, exit_on_failure=True)
89

  ViewVC Help
Powered by ViewVC 1.1.26