/[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 2271 - (hide annotations)
Mon Feb 16 05:08:29 2009 UTC (10 years, 4 months ago) by jfenwick
Original Path: trunk/finley/test/python/run_escriptOnFinley.py
File MIME type: text/x-python
File size: 5191 byte(s)
Merging version 2269 to trunk

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 jfenwick 2271 from test_shared import Test_Shared
33    
34 gross 983 try:
35     FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR']
36     except KeyError:
37     FINLEY_WORKDIR='.'
38    
39     NE=4 # number elements, must be even
40 jfenwick 2271
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 gross 1044 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 gross 1716
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 ksteube 1829 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 gross 1716 def test_tagsReducedFunctionOnBoundary(self):
78 ksteube 1829 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 gross 1716 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 gross 983 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 gross 1856 self.domain_with_different_sample_ordering =Rectangle(NE,NE+1,2, optimize=True)
110 gross 1141 self.filename_base=FINLEY_WORKDIR
111 gross 983
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 jfenwick 2271 suite.addTest(unittest.makeSuite(Test_SharedOnFinley))
121 gross 1141 suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))
122 gross 1185 suite.addTest(unittest.makeSuite(Test_DomainOnFinley))
123 gross 983 s=unittest.TextTestRunner(verbosity=2).run(suite)
124 gross 1376 if not s.wasSuccessful(): sys.exit(1)
125    

  ViewVC Help
Powered by ViewVC 1.1.26