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

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

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

revision 1414 by gross, Thu Feb 14 10:01:43 2008 UTC revision 2344 by jfenwick, Mon Mar 30 02:13:58 2009 UTC
# Line 1  Line 1 
 #  
 # $Id:$  
 #  
 #######################################################  
 #  
 #           Copyright 2003-2007 by ACceSS MNRF  
 #       Copyright 2007 by University of Queensland  
 #  
 #                http://esscc.uq.edu.au  
 #        Primary Business: Queensland, Australia  
 #  Licensed under the Open Software License version 3.0  
 #     http://www.opensource.org/licenses/osl-3.0.php  
 #  
 #######################################################  
 #  
1    
2  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF  ########################################################
3                      http://www.access.edu.au  #
4                  Primary Business: Queensland, Australia"""  # Copyright (c) 2003-2008 by University of Queensland
5    # Earth Systems Science Computational Center (ESSCC)
6    # http://www.uq.edu.au/esscc
7    #
8    # 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    #
12    ########################################################
13    
14    __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  __license__="""Licensed under the Open Software License version 3.0  __license__="""Licensed under the Open Software License version 3.0
19               http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
20    __url__="https://launchpad.net/escript-finley"
21    
22  import unittest  import unittest
23  import tempfile  import tempfile
24    
# Line 29  import os Line 29  import os
29  from test_objects import Test_Dump, Test_SetDataPointValue  from test_objects import Test_Dump, Test_SetDataPointValue
30  from test_objects import Test_Domain  from test_objects import Test_Domain
31    
32    from test_shared import Test_Shared
33    
34  try:  try:
35       FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR']       FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR']
36  except KeyError:  except KeyError:
37       FINLEY_WORKDIR='.'       FINLEY_WORKDIR='.'
38    
39  NE=4 # number elements, must be even  NE=4 # number elements, must be even
40    
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  class Test_DomainOnFinley(Test_Domain):  class Test_DomainOnFinley(Test_Domain):
50     def setUp(self):     def setUp(self):
51         self.domain =Rectangle(NE,NE+1,2)         self.domain =Rectangle(NE,NE+1,2)
52     def tearDown(self):     def tearDown(self):
53         del self.domain         del self.domain
54  class Test_DataOpsOnFinley(Test_Dump): # , Test_SetDataPointValue):  
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           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       def test_tagsReducedFunctionOnBoundary(self):
78           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       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     def setUp(self):     def setUp(self):
106         self.domain =Rectangle(NE,NE+1,2)         self.domain =Rectangle(NE,NE+1,2)
107         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)
108         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)
109         self.domain_with_different_sample_ordering =Rectangle(1,(NE+1)*NE,2)         self.domain_with_different_sample_ordering =Rectangle(NE,NE+1,2, optimize=True)
110         self.filename_base=FINLEY_WORKDIR         self.filename_base=FINLEY_WORKDIR
111    
112     def tearDown(self):     def tearDown(self):
# Line 56  class Test_DataOpsOnFinley(Test_Dump): # Line 117  class Test_DataOpsOnFinley(Test_Dump): #
117    
118  if __name__ == '__main__':  if __name__ == '__main__':
119     suite = unittest.TestSuite()     suite = unittest.TestSuite()
120       suite.addTest(unittest.makeSuite(Test_SharedOnFinley))
121     suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))     suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))
122     suite.addTest(unittest.makeSuite(Test_DomainOnFinley))     suite.addTest(unittest.makeSuite(Test_DomainOnFinley))
123     s=unittest.TextTestRunner(verbosity=2).run(suite)     s=unittest.TextTestRunner(verbosity=2).run(suite)

Legend:
Removed from v.1414  
changed lines
  Added in v.2344

  ViewVC Help
Powered by ViewVC 1.1.26