~vcs-imports/escript-finley/trunk

« back to all changes in this revision

Viewing changes to dudley/test/python/run_utilOnDudley.py

  • Committer: jfenwick
  • Date: 2010-10-11 01:48:14 UTC
  • Revision ID: svn-v4:77569008-7704-0410-b7a0-a92fef0b09fd:trunk:3259
Merging dudley and scons updates from branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
########################################################
 
3
#
 
4
# Copyright (c) 2003-2010 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-2010 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_noContact
 
25
from test_symbols import Test_symbols
 
26
 
 
27
from esys.escript import *
 
28
from esys.dudley import Rectangle,Brick,ReadMesh
 
29
import sys
 
30
import os
 
31
 
 
32
try:
 
33
     DUDLEY_TEST_DATA=os.environ['DUDLEY_TEST_DATA']
 
34
except KeyError:
 
35
     DUDLEY_TEST_DATA='.'
 
36
 
 
37
DUDLEY_TEST_MESH_PATH=os.path.join(DUDLEY_TEST_DATA,"data_meshes")
 
38
 
 
39
 
 
40
NE=4 # number elements, must be even
 
41
 
 
42
class Test_UtilOnDudley(Test_util,Test_symbols):
 
43
   def setUp(self):
 
44
       self.domain =Rectangle(NE,NE+1,1)
 
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_SpatialFunctionsOnDudleyTet2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
 
51
    def setUp(self):
 
52
        self.order=1
 
53
        self.domain = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet_2D_order1.fly"),optimize=False)
 
54
    def tearDown(self):
 
55
        del self.order
 
56
        del self.domain
 
57
 
 
58
 
 
59
class Test_Util_SpatialFunctionsOnDudleyTet3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
 
60
    def setUp(self):
 
61
        self.order=1
 
62
        self.domain = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"tet_3D_order1.fly"),optimize=False)
 
63
    def tearDown(self):
 
64
        del self.order
 
65
        del self.domain
 
66
 
 
67
class Test_Util_SpatialFunctionsOnDudleyRectOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
 
68
    def setUp(self):
 
69
        self.order=1
 
70
        self.domain = Rectangle(n0=NE,n1=NE,order=1)
 
71
    def tearDown(self):
 
72
        del self.order
 
73
        del self.domain
 
74
 
 
75
 
 
76
class Test_Util_SpatialFunctionsOnDudleyBrickOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
 
77
    def setUp(self):
 
78
        self.order=1
 
79
        self.domain = Brick(n0=NE,n1=NE,n2=NE,order=1)
 
80
    def tearDown(self):
 
81
        del self.order
 
82
        del self.domain
 
83
 
 
84
 
 
85
 
 
86
if __name__ == '__main__':
 
87
   suite = unittest.TestSuite()
 
88
   if True:
 
89
      suite.addTest(unittest.makeSuite(Test_UtilOnDudley))
 
90
      suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnDudleyTet2DOrder1))
 
91
      suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnDudleyTet3DOrder1))
 
92
      suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnDudleyRectOrder1))
 
93
      suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnDudleyBrickOrder1))
 
94
#      suite.addTest(Test_Util_SpatialFunctionsOnDudleyRectOrder1("test_normal_FunctionOnBoundary"))
 
95
   else:
 
96
      pass
 
97
   s=unittest.TextTestRunner(verbosity=2).run(suite)
 
98
   if not s.wasSuccessful(): sys.exit(1)
 
99