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

Diff of /trunk/dudley/test/python/run_escriptOnDudley.py

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

revision 4983 by jfenwick, Wed May 14 01:13:23 2014 UTC revision 4984 by sshaw, Mon Jun 2 02:50:34 2014 UTC
# Line 24  __url__="https://launchpad.net/escript-f Line 24  __url__="https://launchpad.net/escript-f
24  import os  import os
25  import sys  import sys
26  import esys.escriptcore.utestselect as unittest  import esys.escriptcore.utestselect as unittest
27    from esys.escriptcore.testing import *
28  from esys.escript import *  from esys.escript import *
29  from esys.dudley import Rectangle, Brick  from esys.dudley import Rectangle, Brick
30  from test_objects import Test_Dump, Test_SetDataPointValue, Test_saveCSV, \  from test_objects import Test_Dump, Test_SetDataPointValue, Test_saveCSV, \
# Line 46  class Test_SharedOnDudley(Test_Shared): Line 46  class Test_SharedOnDudley(Test_Shared):
46          del self.domain          del self.domain
47          del self.tol          del self.tol
48    
49    @unittest.skip("Test not previously tested")
50  class Test_DomainOnDudley(Test_Domain):  class Test_DomainOnDudley(Test_Domain):
51     def setUp(self):     def setUp(self):
52         self.boundary_tag_list = [1, 2, 10, 20]         self.boundary_tag_list = [1, 2, 10, 20]
# Line 78  class Test_DomainOnDudley(Test_Domain): Line 78  class Test_DomainOnDudley(Test_Domain):
78         tags=Function(self.domain).getListOfTags()         tags=Function(self.domain).getListOfTags()
79         self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")         self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
80         for i in ref_tags: self.assertTrue(i in tags,"tag %s is missing."%i)         for i in ref_tags: self.assertTrue(i in tags,"tag %s is missing."%i)
81    
82     def test_tagsReducedFunction(self):     def test_tagsReducedFunction(self):
83         ref_tags=[0]         ref_tags=[0]
84         tags=ReducedFunction(self.domain).getListOfTags()         tags=ReducedFunction(self.domain).getListOfTags()
85         self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")         self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
86         for i in ref_tags: self.assertTrue(i in tags,"tag %s is missing."%i)         for i in ref_tags: self.assertTrue(i in tags,"tag %s is missing."%i)
87    
88     def test_tagsFunctionOnBoundary(self):     def test_tagsFunctionOnBoundary(self):
89         ref_tags=[1, 2, 10, 20]         ref_tags=[1, 2, 10, 20]
90         tags=FunctionOnBoundary(self.domain).getListOfTags()         tags=FunctionOnBoundary(self.domain).getListOfTags()
91         # For an MPI-distributed domain some tags may be missing         # For an MPI-distributed domain some tags may be missing
92         if getMPISizeWorld() == 1: self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")         if getMPISizeWorld() == 1: self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
93         for i in tags: self.assertTrue(i in ref_tags,"tag %s is missing."%i)         for i in tags: self.assertTrue(i in ref_tags,"tag %s is missing."%i)
94    
95     def test_tagsReducedFunctionOnBoundary(self):     def test_tagsReducedFunctionOnBoundary(self):
96         ref_tags=[1, 2, 10, 20]         ref_tags=[1, 2, 10, 20]
97         tags=ReducedFunctionOnBoundary(self.domain).getListOfTags()         tags=ReducedFunctionOnBoundary(self.domain).getListOfTags()
# Line 96  class Test_DomainOnDudley(Test_Domain): Line 99  class Test_DomainOnDudley(Test_Domain):
99         if getMPISizeWorld() == 1: self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")         if getMPISizeWorld() == 1: self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
100         for i in tags: self.assertTrue(i in ref_tags,"tag %s is missing."%i)         for i in tags: self.assertTrue(i in ref_tags,"tag %s is missing."%i)
101    
102    @unittest.skip("Test not previously tested")
103  class Test_DataOpsOnDudley(Test_Dump, Test_SetDataPointValue, Test_GlobalMinMax, Test_Lazy):  class Test_DataOpsOnDudley(Test_Dump, Test_SetDataPointValue, Test_GlobalMinMax, Test_Lazy):
104     def setUp(self):     def setUp(self):
105         self.domain =Rectangle(NE,NE+1,2)         self.domain =Rectangle(NE,NE+1,2)
# Line 160  class Test_CSVOnDudley(Test_saveCSV): Line 164  class Test_CSVOnDudley(Test_saveCSV):
164      def tearDown(self):      def tearDown(self):
165          del self.domain          del self.domain
166    
167        #@unittest.skipIf(getMPISizeWorld() > 1, "Skipping since MPI size > 1")
168      def test_csv_multiFS(self):      def test_csv_multiFS(self):
169          if getMPISizeWorld() == 1:          fname=os.path.join(DUDLEY_WORKDIR, "test_multifs.csv")
170              fname=os.path.join(DUDLEY_WORKDIR, "test_multifs.csv")          sol=Data(8,Solution(self.domain))
171              sol=Data(8,Solution(self.domain))          ctsfn=Data(9,ContinuousFunction(self.domain))
172              ctsfn=Data(9,ContinuousFunction(self.domain))          #test line 0
173              #test line 0          dirac=Data(-1,DiracDeltaFunctions(self.domain))
174              dirac=Data(-1,DiracDeltaFunctions(self.domain))          saveDataCSV(fname, A=sol, B=ctsfn, C=dirac)
175              saveDataCSV(fname, A=sol, B=ctsfn, C=dirac)          #test line 1
176              #test line 1          fun=Data(5,Function(self.domain))
177              fun=Data(5,Function(self.domain))          rfun=Data(3,ReducedFunction(self.domain))
178              rfun=Data(3,ReducedFunction(self.domain))          saveDataCSV(fname, A=sol,B=ctsfn,C=fun, D=rfun)
179              saveDataCSV(fname, A=sol,B=ctsfn,C=fun, D=rfun)          #test line 2
180              #test line 2          bound=Data(1,FunctionOnBoundary(self.domain))
181              bound=Data(1,FunctionOnBoundary(self.domain))          rbound=Data(3,ReducedFunctionOnBoundary(self.domain))
182              rbound=Data(3,ReducedFunctionOnBoundary(self.domain))          saveDataCSV(fname,A=sol,B=ctsfn,C=bound, D=rbound)
             saveDataCSV(fname,A=sol,B=ctsfn,C=bound, D=rbound)  
         else:  
             print("Skipping CSV multiFS tests on dudley since MPI size > 1")  
183    
184    
185  if __name__ == '__main__':  if __name__ == '__main__':
186     suite = unittest.TestSuite()      run_tests(__name__, exit_on_failure=True)
    suite.addTest(unittest.makeSuite(Test_SharedOnDudley))  
    # These two assume macro elements are supported  
    #suite.addTest(unittest.makeSuite(Test_DataOpsOnDudley))  
    #suite.addTest(unittest.makeSuite(Test_DomainOnDudley))  
    suite.addTest(unittest.makeSuite(Test_TableInterpolationOnDudley))  
    suite.addTest(unittest.makeSuite(Test_CSVOnDudley))  
    s=unittest.TextTestRunner(verbosity=2).run(suite)  
    if not s.wasSuccessful(): sys.exit(1)  
187    

Legend:
Removed from v.4983  
changed lines
  Added in v.4984

  ViewVC Help
Powered by ViewVC 1.1.26