/[escript]/trunk/escript/test/python/test_symbols.py
ViewVC logotype

Annotation of /trunk/escript/test/python/test_symbols.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1809 - (hide annotations)
Thu Sep 25 06:43:44 2008 UTC (11 years, 5 months ago) by ksteube
File MIME type: text/x-python
File size: 9611 byte(s)
Copyright updated in all python files

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 jgs 154
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     __license__="""Licensed under the Open Software License version 3.0
19     http://www.opensource.org/licenses/osl-3.0.php"""
20     __url__="http://www.uq.edu.au/esscc/escript-finley"
21    
22 jgs 154 """
23 gross 293 Test suite for the symbols.py module
24    
25     @var __author__: name of author
26 gross 637 @var __copyright__: copyrights
27 elspeth 614 @var __license__: licence agreement
28 gross 293 @var __url__: url entry point on documentation
29     @var __version__: version
30     @var __date__: date of the version
31 jgs 154 """
32    
33 gross 293 __author__="Lutz Gross, l.gross@uq.edu.au"
34 jgs 154
35 gross 293 from esys.escript import *
36     from esys.escript.symbols import *
37     import unittest
38 jgs 154
39 gross 293 class Test_symbols(unittest.TestCase):
40    
41     def test_Symbol_Scalar_dNone(self):
42     s=ScalarSymbol(dim=None)
43     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
44     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
45     self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")
46     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
47     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
48     def test_Symbol_Scalar_dd(self):
49     s=ScalarSymbol(dim=self.functionspace)
50     d=self.functionspace.getDim()
51     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
52     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
53     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
54     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
55     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56     def test_Symbol_Scalar_d1(self):
57     s=ScalarSymbol(dim=1)
58     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
59     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
60     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
61     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
62     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
63     def test_Symbol_Scalar_d2(self):
64     s=ScalarSymbol(dim=2)
65     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
66     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
67     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
68     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
69     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
70     def test_Symbol_Scalar_d3(self):
71     s=ScalarSymbol(dim=3)
72     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
73     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
74     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
75     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
76     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
77     def test_Symbol_Vector_dd(self):
78     s=VectorSymbol(dim=self.functionspace)
79     d=self.functionspace.getDim()
80     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
81     self.failUnlessEqual(s.getShape(),(d,),"wrong shape.")
82     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
83     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
84     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
85     def test_Symbol_Vector_d1(self):
86     s=VectorSymbol(dim=1)
87     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
88     self.failUnlessEqual(s.getShape(),(1,),"wrong shape.")
89     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
90     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
91     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
92     def test_Symbol_Vector_d2(self):
93     s=VectorSymbol(dim=2)
94     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
95     self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
96     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
97     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
98     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
99     def test_Symbol_Vector_d3(self):
100     s=VectorSymbol(dim=3)
101     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
102     self.failUnlessEqual(s.getShape(),(3,),"wrong shape.")
103     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
104     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
105     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
106     def test_Symbol_Tensor_dd(self):
107     s=TensorSymbol(dim=self.functionspace)
108     d=self.functionspace.getDim()
109     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
110     self.failUnlessEqual(s.getShape(),(d,d),"wrong shape.")
111     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
112     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
113     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
114     def test_Symbol_Tensor_d1(self):
115     s=TensorSymbol(dim=1)
116     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
117     self.failUnlessEqual(s.getShape(),(1, 1),"wrong shape.")
118     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
119     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
120     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
121     def test_Symbol_Tensor_d2(self):
122     s=TensorSymbol(dim=2)
123     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
124     self.failUnlessEqual(s.getShape(),(2, 2),"wrong shape.")
125     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
126     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
127     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
128     def test_Symbol_Tensor_d3(self):
129     s=TensorSymbol(dim=3)
130     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
131     self.failUnlessEqual(s.getShape(),(3, 3),"wrong shape.")
132     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
133     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
134     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
135     def test_Symbol_Tensor3_dd(self):
136     s=Tensor3Symbol(dim=self.functionspace)
137     d=self.functionspace.getDim()
138     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
139     self.failUnlessEqual(s.getShape(),(d,d,d),"wrong shape.")
140     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
141     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
142     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
143     def test_Symbol_Tensor3_d1(self):
144     s=Tensor3Symbol(dim=1)
145     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
146     self.failUnlessEqual(s.getShape(),(1, 1, 1),"wrong shape.")
147     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
148     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
149     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
150     def test_Symbol_Tensor3_d2(self):
151     s=Tensor3Symbol(dim=2)
152     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
153     self.failUnlessEqual(s.getShape(),(2, 2, 2),"wrong shape.")
154     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
155     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
156     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
157     def test_Symbol_Tensor3_d3(self):
158     s=Tensor3Symbol(dim=3)
159     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
160     self.failUnlessEqual(s.getShape(),(3, 3, 3),"wrong shape.")
161     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
162     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
163     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
164     def test_Symbol_Tensor4_dd(self):
165     s=Tensor4Symbol(dim=self.functionspace)
166     d=self.functionspace.getDim()
167     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
168     self.failUnlessEqual(s.getShape(),(d,d,d,d),"wrong shape.")
169     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
170     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
171     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
172     def test_Symbol_Tensor4_d1(self):
173     s=Tensor4Symbol(dim=1)
174     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
175     self.failUnlessEqual(s.getShape(),(1, 1, 1, 1),"wrong shape.")
176     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
177     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
178     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
179     def test_Symbol_Tensor4_d2(self):
180     s=Tensor4Symbol(dim=2)
181     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
182     self.failUnlessEqual(s.getShape(),(2, 2, 2, 2),"wrong shape.")
183     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
184     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
185     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
186     def test_Symbol_Tensor4_d3(self):
187     s=Tensor4Symbol(dim=3)
188     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
189     self.failUnlessEqual(s.getShape(),(3, 3, 3, 3),"wrong shape.")
190     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
191     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26