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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2549 by jfenwick, Mon Jul 20 06:43:47 2009 UTC revision 2799 by jfenwick, Thu Dec 3 01:35:08 2009 UTC
# Line 26  from esys.escript import * Line 26  from esys.escript import *
26  from esys.finley import Rectangle  from esys.finley import Rectangle
27  import sys  import sys
28  import os  import os
29  from test_objects import Test_Dump, Test_SetDataPointValue  from test_objects import Test_Dump, Test_SetDataPointValue, Test_saveCSV, Test_TableInterpolation
30  from test_objects import Test_Domain  from test_objects import Test_Domain, Test_GlobalMinMax, Test_Lazy
31    
32  from test_shared import Test_Shared  from test_shared import Test_Shared
33    
# Line 103  class Test_DomainOnFinley(Test_Domain): Line 103  class Test_DomainOnFinley(Test_Domain):
103         self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")         self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
104         for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)         for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
105    
106  class Test_DataOpsOnFinley(Test_Dump, Test_SetDataPointValue):  class Test_DataOpsOnFinley(Test_Dump, Test_SetDataPointValue, Test_GlobalMinMax, Test_Lazy):
107     def setUp(self):     def setUp(self):
108         self.domain =Rectangle(NE,NE+1,2)         self.domain =Rectangle(NE,NE+1,2)
109         self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)         self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)
110         self.domain_with_different_number_of_data_points_per_sample =Rectangle(2*NE,NE+1,2,integrationOrder=2)         self.domain_with_different_number_of_data_points_per_sample =Rectangle(2*NE,NE+1,2,integrationOrder=2)
111         self.domain_with_different_sample_ordering =Rectangle(NE,NE+1,2, optimize=True)         self.domain_with_different_sample_ordering =Rectangle(NE,NE+1,2, optimize=True)
112         self.filename_base=FINLEY_WORKDIR         self.filename_base=FINLEY_WORKDIR
113           self.mainfs=Function(self.domain)
114           self.otherfs=Solution(self.domain)
115    
116     def tearDown(self):     def tearDown(self):
117         del self.domain         del self.domain
118         del self.domain_with_different_number_of_samples         del self.domain_with_different_number_of_samples
119         del self.domain_with_different_number_of_data_points_per_sample         del self.domain_with_different_number_of_data_points_per_sample
120         del self.domain_with_different_sample_ordering         del self.domain_with_different_sample_ordering
121           del self.mainfs
122           del self.otherfs
123          
124    
125    
126    class Test_TableInterpolationOnFinley(Test_TableInterpolation):
127        def setUp(self):
128        self.domain=Rectangle(4,4)
129        self.functionspaces=[ContinuousFunction(self.domain), Function(self.domain), ReducedFunction(self.domain),
130            FunctionOnBoundary(self.domain), ReducedFunctionOnBoundary(self.domain),
131            FunctionOnContactZero(self.domain), FunctionOnContactOne(self.domain),
132            ReducedFunctionOnContactZero(self.domain), ReducedFunctionOnContactOne(self.domain)]
133            #We aren't testing DiracDeltaFunction
134        self.xn=3   # number of grids on x axis
135        self.yn=3   # number of grids on y axis
136    
137        def tearDown(self):
138        del self.domain
139        del self.functionspaces
140    
141        
142            
143            
144    class Test_CSVOnFinley(Test_saveCSV):
145       def setUp(self):
146           self.domain =Rectangle(NE,NE+1,2)
147           self.linecount1=20       #see test_save1 for the meaning of these params
148           self.linecount2=69
149          
150       def tearDown(self):
151           del self.domain
152          
153       #This test checks to see that all FunctionSpaces can be saved
154       def test_singleFS(self):
155        fname="test_singlefs.csv"
156        fss=[ContinuousFunction(self.domain), Function(self.domain), ReducedFunction(self.domain),
157        FunctionOnBoundary(self.domain), ReducedFunctionOnBoundary(self.domain),
158        FunctionOnContactZero(self.domain), FunctionOnContactOne(self.domain),
159        ReducedFunctionOnContactZero(self.domain), ReducedFunctionOnContactOne(self.domain),
160        DiracDeltaFunction(self.domain)]
161        for f in fss:
162            d=Data(7,f)
163            print "Testing "+str(f)+"\n"
164            saveDataCSV(fname, D=d)
165    
166       def test_multiFS(self):
167        fname="test_multifs.csv"
168        sol=Data(8,Solution(self.domain))
169        ctsfn=Data(9,ContinuousFunction(self.domain))
170        #test line 0
171        dirac=Data(-1,DiracDeltaFunction(self.domain))
172        saveDataCSV(fname, A=sol, B=ctsfn, C=dirac)
173        #test line 1
174        fun=Data(5,Function(self.domain))
175        rfun=Data(3,ReducedFunction(self.domain))
176        saveDataCSV(fname, A=sol,B=ctsfn,C=fun, D=rfun)
177        #test line 2
178        bound=Data(1,FunctionOnBoundary(self.domain))
179        rbound=Data(3,ReducedFunctionOnBoundary(self.domain))
180        saveDataCSV(fname,A=sol,B=ctsfn,C=bound, D=rbound)
181        #test line 3
182        conzz=Data(7,FunctionOnContactZero(self.domain))
183        rconz=Data(8,ReducedFunctionOnContactZero(self.domain))
184        saveDataCSV(fname,A=sol,B=ctsfn, C=conzz, D=rconz)
185        #check for cross line exceptions
186        self.failUnlessRaises(RuntimeError, saveDataCSV, fname, A=dirac, B=rfun)
187        self.failUnlessRaises(RuntimeError, saveDataCSV, fname, A=bound, B=conzz)
188    
189        
190  if __name__ == '__main__':  if __name__ == '__main__':
191     suite = unittest.TestSuite()     suite = unittest.TestSuite()
192     suite.addTest(unittest.makeSuite(Test_SharedOnFinley))     suite.addTest(unittest.makeSuite(Test_SharedOnFinley))
193     suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))     suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))
194     suite.addTest(unittest.makeSuite(Test_DomainOnFinley))     suite.addTest(unittest.makeSuite(Test_DomainOnFinley))
195       suite.addTest(unittest.makeSuite(Test_TableInterpolationOnFinley))
196       suite.addTest(unittest.makeSuite(Test_CSVOnFinley))
197     s=unittest.TextTestRunner(verbosity=2).run(suite)     s=unittest.TextTestRunner(verbosity=2).run(suite)
198     if not s.wasSuccessful(): sys.exit(1)     if not s.wasSuccessful(): sys.exit(1)
199    

Legend:
Removed from v.2549  
changed lines
  Added in v.2799

  ViewVC Help
Powered by ViewVC 1.1.26