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

Annotation of /branches/domexper/finley/test/python/run_escriptOnFinley.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1856 - (hide annotations)
Tue Oct 7 07:10:47 2008 UTC (10 years, 8 months ago) by gross
Original Path: trunk/finley/test/python/run_escriptOnFinley.py
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 ksteube 1809
2     ########################################################
3 ksteube 1312 #
4 ksteube 1809 # Copyright (c) 2003-2008 by University of Queensland
5     # Earth Systems Science Computational Center (ESSCC)
6     # http://www.uq.edu.au/esscc
7 ksteube 1312 #
8 ksteube 1809 # 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 ksteube 1312 #
12 ksteube 1809 ########################################################
13 gross 983
14 ksteube 1809 __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 gross 983 __license__="""Licensed under the Open Software License version 3.0
19 ksteube 1809 http://www.opensource.org/licenses/osl-3.0.php"""
20     __url__="http://www.uq.edu.au/esscc/escript-finley"
21    
22 gross 983 import unittest
23     import tempfile
24    
25     from esys.escript import *
26     from esys.finley import Rectangle
27     import sys
28     import os
29 gross 1141 from test_objects import Test_Dump, Test_SetDataPointValue
30     from test_objects import Test_Domain
31 gross 983
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 gross 1044 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 gross 1716
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 ksteube 1829 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 gross 1716 def test_tagsReducedFunctionOnBoundary(self):
67 ksteube 1829 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 gross 1716 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 gross 983 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 gross 1856 self.domain_with_different_sample_ordering =Rectangle(NE,NE+1,2, optimize=True)
99 gross 1141 self.filename_base=FINLEY_WORKDIR
100 gross 983
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 gross 1141 suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))
110 gross 1185 suite.addTest(unittest.makeSuite(Test_DomainOnFinley))
111 gross 983 s=unittest.TextTestRunner(verbosity=2).run(suite)
112 gross 1376 if not s.wasSuccessful(): sys.exit(1)
113    

  ViewVC Help
Powered by ViewVC 1.1.26