/[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 1856 - (show annotations)
Tue Oct 7 07:10:47 2008 UTC (11 years, 9 months ago) by gross
File MIME type: text/x-python
File size: 4936 byte(s)
The NC dump tests work now with MPI.
In fact the old test did not exactly what it supposed to


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__="http://www.uq.edu.au/esscc/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 try:
33 FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR']
34 except KeyError:
35 FINLEY_WORKDIR='.'
36
37 NE=4 # number elements, must be even
38 class Test_DomainOnFinley(Test_Domain):
39 def setUp(self):
40 self.domain =Rectangle(NE,NE+1,2)
41 def tearDown(self):
42 del self.domain
43
44 def test_tagsContinuousFunction(self):
45 ref_tags=[0]
46 tags=ContinuousFunction(self.domain).getListOfTags()
47 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
48 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
49
50 def test_tagsFunction(self):
51 ref_tags=[0]
52 tags=Function(self.domain).getListOfTags()
53 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
54 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
55 def test_tagsReducedFunction(self):
56 ref_tags=[0]
57 tags=ReducedFunction(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 def test_tagsFunctionOnBoundary(self):
61 ref_tags=[1, 2, 10, 20]
62 tags=FunctionOnBoundary(self.domain).getListOfTags()
63 # For an MPI-distributed domain some tags may be missing
64 if getMPISizeWorld() == 1: self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
65 for i in tags: self.failUnless(i in ref_tags,"tag %s is missing."%i)
66 def test_tagsReducedFunctionOnBoundary(self):
67 ref_tags=[1, 2, 10, 20]
68 tags=ReducedFunctionOnBoundary(self.domain).getListOfTags()
69 # For an MPI-distributed domain some tags may be missing
70 if getMPISizeWorld() == 1: self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
71 for i in tags: self.failUnless(i in ref_tags,"tag %s is missing."%i)
72 def test_tagsFunctionOnContactOne(self):
73 ref_tags=[]
74 tags=FunctionOnContactOne(self.domain).getListOfTags()
75 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
76 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
77 def test_tagsFunctionOnContactZero(self):
78 ref_tags=[]
79 tags=FunctionOnContactZero(self.domain).getListOfTags()
80 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
81 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
82 def test_tagsReducedFunctionOnContactOne(self):
83 ref_tags=[]
84 tags=ReducedFunctionOnContactOne(self.domain).getListOfTags()
85 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
86 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
87 def test_tagsReducedFunctionOnContactZero(self):
88 ref_tags=[]
89 tags=ReducedFunctionOnContactZero(self.domain).getListOfTags()
90 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
91 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
92
93 class Test_DataOpsOnFinley(Test_Dump, Test_SetDataPointValue):
94 def setUp(self):
95 self.domain =Rectangle(NE,NE+1,2)
96 self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)
97 self.domain_with_different_number_of_data_points_per_sample =Rectangle(2*NE,NE+1,2,integrationOrder=2)
98 self.domain_with_different_sample_ordering =Rectangle(NE,NE+1,2, optimize=True)
99 self.filename_base=FINLEY_WORKDIR
100
101 def tearDown(self):
102 del self.domain
103 del self.domain_with_different_number_of_samples
104 del self.domain_with_different_number_of_data_points_per_sample
105 del self.domain_with_different_sample_ordering
106
107 if __name__ == '__main__':
108 suite = unittest.TestSuite()
109 suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))
110 suite.addTest(unittest.makeSuite(Test_DomainOnFinley))
111 s=unittest.TextTestRunner(verbosity=2).run(suite)
112 if not s.wasSuccessful(): sys.exit(1)
113

  ViewVC Help
Powered by ViewVC 1.1.26