/[escript]/branches/symbolic_from_3470/dudley/test/python/run_escriptOnDudley.py
ViewVC logotype

Annotation of /branches/symbolic_from_3470/dudley/test/python/run_escriptOnDudley.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3114 - (hide annotations)
Fri Aug 27 05:26:25 2010 UTC (8 years, 9 months ago) by jfenwick
Original Path: branches/domexper/dudley/test/python/run_escriptOnDudley.py
File MIME type: text/x-python
File size: 6197 byte(s)
It doesn't pass all tests but this is major progress

1 ksteube 1809
2     ########################################################
3 ksteube 1312 #
4 jfenwick 2881 # Copyright (c) 2003-2010 by University of Queensland
5 ksteube 1809 # 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 jfenwick 2881 __copyright__="""Copyright (c) 2003-2010 by University of Queensland
15 ksteube 1809 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 jfenwick 2344 __url__="https://launchpad.net/escript-finley"
21 ksteube 1809
22 gross 983 import unittest
23     import tempfile
24    
25     from esys.escript import *
26 jfenwick 3085 from esys.dudley import Rectangle
27 gross 983 import sys
28     import os
29 jfenwick 2646 from test_objects import Test_Dump, Test_SetDataPointValue, Test_saveCSV, Test_TableInterpolation
30 jfenwick 2799 from test_objects import Test_Domain, Test_GlobalMinMax, Test_Lazy
31 gross 983
32 jfenwick 2271 from test_shared import Test_Shared
33    
34 gross 983 try:
35 jfenwick 3087 DUDLEY_WORKDIR=os.environ['DUDLEY_WORKDIR']
36 gross 983 except KeyError:
37 jfenwick 3087 DUDLEY_WORKDIR='.'
38 gross 983
39     NE=4 # number elements, must be even
40 jfenwick 2271
41 jfenwick 3087 class Test_SharedOnDudley(Test_Shared):
42 jfenwick 2271 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 jfenwick 3087 class Test_DomainOnDudley(Test_Domain):
50 gross 1044 def setUp(self):
51 gross 2425 self.boundary_tag_list = [1, 2, 10, 20]
52 gross 1044 self.domain =Rectangle(NE,NE+1,2)
53     def tearDown(self):
54     del self.domain
55 gross 2425 del self.boundary_tag_list
56 gross 1716
57     def test_tagsContinuousFunction(self):
58     ref_tags=[0]
59     tags=ContinuousFunction(self.domain).getListOfTags()
60     self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
61     for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
62    
63     def test_tagsFunction(self):
64     ref_tags=[0]
65     tags=Function(self.domain).getListOfTags()
66     self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
67     for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
68     def test_tagsReducedFunction(self):
69     ref_tags=[0]
70     tags=ReducedFunction(self.domain).getListOfTags()
71     self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
72     for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
73     def test_tagsFunctionOnBoundary(self):
74 ksteube 1829 ref_tags=[1, 2, 10, 20]
75     tags=FunctionOnBoundary(self.domain).getListOfTags()
76     # For an MPI-distributed domain some tags may be missing
77     if getMPISizeWorld() == 1: self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
78     for i in tags: self.failUnless(i in ref_tags,"tag %s is missing."%i)
79 gross 1716 def test_tagsReducedFunctionOnBoundary(self):
80 ksteube 1829 ref_tags=[1, 2, 10, 20]
81     tags=ReducedFunctionOnBoundary(self.domain).getListOfTags()
82     # For an MPI-distributed domain some tags may be missing
83     if getMPISizeWorld() == 1: self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
84     for i in tags: self.failUnless(i in ref_tags,"tag %s is missing."%i)
85 gross 1716
86 jfenwick 3087 class Test_DataOpsOnDudley(Test_Dump, Test_SetDataPointValue, Test_GlobalMinMax, Test_Lazy):
87 gross 983 def setUp(self):
88     self.domain =Rectangle(NE,NE+1,2)
89     self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)
90     self.domain_with_different_number_of_data_points_per_sample =Rectangle(2*NE,NE+1,2,integrationOrder=2)
91 gross 1856 self.domain_with_different_sample_ordering =Rectangle(NE,NE+1,2, optimize=True)
92 jfenwick 3087 self.filename_base=DUDLEY_WORKDIR
93 jfenwick 2799 self.mainfs=Function(self.domain)
94     self.otherfs=Solution(self.domain)
95 gross 983
96     def tearDown(self):
97     del self.domain
98     del self.domain_with_different_number_of_samples
99     del self.domain_with_different_number_of_data_points_per_sample
100     del self.domain_with_different_sample_ordering
101 jfenwick 2799 del self.mainfs
102     del self.otherfs
103 jfenwick 2646
104 gross 983
105 jfenwick 2628
106 jfenwick 3087 class Test_TableInterpolationOnDudley(Test_TableInterpolation):
107 jfenwick 2646 def setUp(self):
108     self.domain=Rectangle(4,4)
109     self.functionspaces=[ContinuousFunction(self.domain), Function(self.domain), ReducedFunction(self.domain),
110 jfenwick 3090 FunctionOnBoundary(self.domain), ReducedFunctionOnBoundary(self.domain)]
111 jfenwick 2646 #We aren't testing DiracDeltaFunction
112     self.xn=3 # number of grids on x axis
113     self.yn=3 # number of grids on y axis
114 jfenwick 2628
115 jfenwick 2646 def tearDown(self):
116     del self.domain
117     del self.functionspaces
118    
119 jfenwick 2628
120    
121 jfenwick 2644
122 jfenwick 3087 class Test_CSVOnDudley(Test_saveCSV):
123 jfenwick 2644 def setUp(self):
124 jfenwick 3114 self.domain =Rectangle(NE,NE+1)
125     self.linecount1=31 #see test_save1 for the meaning of these params
126     self.linecount2=25
127 jfenwick 2644
128     def tearDown(self):
129     del self.domain
130    
131     #This test checks to see that all FunctionSpaces can be saved
132     def test_singleFS(self):
133     fname="test_singlefs.csv"
134     fss=[ContinuousFunction(self.domain), Function(self.domain), ReducedFunction(self.domain),
135     FunctionOnBoundary(self.domain), ReducedFunctionOnBoundary(self.domain),
136 jfenwick 2646 DiracDeltaFunction(self.domain)]
137 jfenwick 2644 for f in fss:
138     d=Data(7,f)
139     print "Testing "+str(f)+"\n"
140     saveDataCSV(fname, D=d)
141    
142     def test_multiFS(self):
143     fname="test_multifs.csv"
144     sol=Data(8,Solution(self.domain))
145     ctsfn=Data(9,ContinuousFunction(self.domain))
146     #test line 0
147     dirac=Data(-1,DiracDeltaFunction(self.domain))
148     saveDataCSV(fname, A=sol, B=ctsfn, C=dirac)
149     #test line 1
150     fun=Data(5,Function(self.domain))
151     rfun=Data(3,ReducedFunction(self.domain))
152     saveDataCSV(fname, A=sol,B=ctsfn,C=fun, D=rfun)
153     #test line 2
154     bound=Data(1,FunctionOnBoundary(self.domain))
155     rbound=Data(3,ReducedFunctionOnBoundary(self.domain))
156     saveDataCSV(fname,A=sol,B=ctsfn,C=bound, D=rbound)
157    
158    
159 gross 983 if __name__ == '__main__':
160     suite = unittest.TestSuite()
161 jfenwick 3114 #suite.addTest(unittest.makeSuite(Test_SharedOnDudley))
162     #suite.addTest(unittest.makeSuite(Test_DataOpsOnDudley))
163     #suite.addTest(unittest.makeSuite(Test_DomainOnDudley))
164     #suite.addTest(unittest.makeSuite(Test_TableInterpolationOnDudley))
165 jfenwick 3087 suite.addTest(unittest.makeSuite(Test_CSVOnDudley))
166 gross 983 s=unittest.TextTestRunner(verbosity=2).run(suite)
167 gross 1376 if not s.wasSuccessful(): sys.exit(1)
168    

Properties

Name Value
svn:mergeinfo /branches/lapack2681/finley/test/python/run_escriptOnFinley.py:2682-2741 /branches/restext/finley/test/python/run_escriptOnFinley.py:2610-2624 /branches/stage3.0/finley/test/python/run_escriptOnFinley.py:2569-2590 /release/3.0/finley/test/python/run_escriptOnFinley.py:2591-2601

  ViewVC Help
Powered by ViewVC 1.1.26