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

Contents of /trunk/finley/test/python/run_escriptOnFinley.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2344 - (show annotations)
Mon Mar 30 02:13:58 2009 UTC (10 years, 4 months ago) by jfenwick
File MIME type: text/x-python
File size: 5186 byte(s)
Change __url__ to launchpad site

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 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-2008 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 import tempfile
24
25 from esys.escript import *
26 from esys.finley import Rectangle
27 import sys
28 import os
29 from test_objects import Test_Dump, Test_SetDataPointValue
30 from test_objects import Test_Domain
31
32 from test_shared import Test_Shared
33
34 try:
35 FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR']
36 except KeyError:
37 FINLEY_WORKDIR='.'
38
39 NE=4 # number elements, must be even
40
41 class Test_SharedOnFinley(Test_Shared):
42 def setUp(self):
43 self.domain=Rectangle(NE,NE)
44 self.tol=0.001
45 def tearDown(self):
46 del self.domain
47 del self.tol
48
49 class Test_DomainOnFinley(Test_Domain):
50 def setUp(self):
51 self.domain =Rectangle(NE,NE+1,2)
52 def tearDown(self):
53 del self.domain
54
55 def test_tagsContinuousFunction(self):
56 ref_tags=[0]
57 tags=ContinuousFunction(self.domain).getListOfTags()
58 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
59 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
60
61 def test_tagsFunction(self):
62 ref_tags=[0]
63 tags=Function(self.domain).getListOfTags()
64 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
65 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
66 def test_tagsReducedFunction(self):
67 ref_tags=[0]
68 tags=ReducedFunction(self.domain).getListOfTags()
69 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
70 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
71 def test_tagsFunctionOnBoundary(self):
72 ref_tags=[1, 2, 10, 20]
73 tags=FunctionOnBoundary(self.domain).getListOfTags()
74 # For an MPI-distributed domain some tags may be missing
75 if getMPISizeWorld() == 1: self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
76 for i in tags: self.failUnless(i in ref_tags,"tag %s is missing."%i)
77 def test_tagsReducedFunctionOnBoundary(self):
78 ref_tags=[1, 2, 10, 20]
79 tags=ReducedFunctionOnBoundary(self.domain).getListOfTags()
80 # For an MPI-distributed domain some tags may be missing
81 if getMPISizeWorld() == 1: self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
82 for i in tags: self.failUnless(i in ref_tags,"tag %s is missing."%i)
83 def test_tagsFunctionOnContactOne(self):
84 ref_tags=[]
85 tags=FunctionOnContactOne(self.domain).getListOfTags()
86 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
87 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
88 def test_tagsFunctionOnContactZero(self):
89 ref_tags=[]
90 tags=FunctionOnContactZero(self.domain).getListOfTags()
91 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
92 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
93 def test_tagsReducedFunctionOnContactOne(self):
94 ref_tags=[]
95 tags=ReducedFunctionOnContactOne(self.domain).getListOfTags()
96 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
97 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
98 def test_tagsReducedFunctionOnContactZero(self):
99 ref_tags=[]
100 tags=ReducedFunctionOnContactZero(self.domain).getListOfTags()
101 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
102 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
103
104 class Test_DataOpsOnFinley(Test_Dump, Test_SetDataPointValue):
105 def setUp(self):
106 self.domain =Rectangle(NE,NE+1,2)
107 self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)
108 self.domain_with_different_number_of_data_points_per_sample =Rectangle(2*NE,NE+1,2,integrationOrder=2)
109 self.domain_with_different_sample_ordering =Rectangle(NE,NE+1,2, optimize=True)
110 self.filename_base=FINLEY_WORKDIR
111
112 def tearDown(self):
113 del self.domain
114 del self.domain_with_different_number_of_samples
115 del self.domain_with_different_number_of_data_points_per_sample
116 del self.domain_with_different_sample_ordering
117
118 if __name__ == '__main__':
119 suite = unittest.TestSuite()
120 suite.addTest(unittest.makeSuite(Test_SharedOnFinley))
121 suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))
122 suite.addTest(unittest.makeSuite(Test_DomainOnFinley))
123 s=unittest.TextTestRunner(verbosity=2).run(suite)
124 if not s.wasSuccessful(): sys.exit(1)
125

  ViewVC Help
Powered by ViewVC 1.1.26