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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3911 - (show annotations)
Thu Jun 14 01:01:03 2012 UTC (7 years, 4 months ago) by jfenwick
File MIME type: text/x-python
File size: 9270 byte(s)
Copyright changes
1
2 ########################################################
3 #
4 # Copyright (c) 2003-2012 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-2012 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__="https://launchpad.net/escript-finley"
21
22 """
23 Test suite for the symbols.py module
24
25 :var __author__: name of author
26 :var __copyright__: copyrights
27 :var __license__: licence agreement
28 :var __url__: url entry point on documentation
29 :var __version__: version
30 :var __date__: date of the version
31 """
32
33 __author__="Lutz Gross, l.gross@uq.edu.au"
34
35 from esys.escript import *
36 from esys.escript.symbols import *
37 import unittest
38
39 class Test_symbols(unittest.TestCase):
40
41 def test_Symbol_Scalar_dNone(self):
42 s=ScalarSymbol(dim=None)
43 self.assertEqual(s.getRank(),0,"wrong rank.")
44 self.assertEqual(s.getShape(),(),"wrong shape.")
45 self.assertEqual(s.getDim(),None,"wrong spatial dimension.")
46 self.assertEqual(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.assertEqual(s.getRank(),0,"wrong rank.")
52 self.assertEqual(s.getShape(),(),"wrong shape.")
53 self.assertEqual(s.getDim(),d,"wrong spatial dimension.")
54 self.assertEqual(s.getArgument(),[],"wrong arguments.")
55 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56 def test_Symbol_Scalar_d1(self):
57 s=ScalarSymbol(dim=1)
58 self.assertEqual(s.getRank(),0,"wrong rank.")
59 self.assertEqual(s.getShape(),(),"wrong shape.")
60 self.assertEqual(s.getDim(),1,"wrong spatial dimension.")
61 self.assertEqual(s.getArgument(),[],"wrong arguments.")
62 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
63 def test_Symbol_Scalar_d2(self):
64 s=ScalarSymbol(dim=2)
65 self.assertEqual(s.getRank(),0,"wrong rank.")
66 self.assertEqual(s.getShape(),(),"wrong shape.")
67 self.assertEqual(s.getDim(),2,"wrong spatial dimension.")
68 self.assertEqual(s.getArgument(),[],"wrong arguments.")
69 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
70 def test_Symbol_Scalar_d3(self):
71 s=ScalarSymbol(dim=3)
72 self.assertEqual(s.getRank(),0,"wrong rank.")
73 self.assertEqual(s.getShape(),(),"wrong shape.")
74 self.assertEqual(s.getDim(),3,"wrong spatial dimension.")
75 self.assertEqual(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.assertEqual(s.getRank(),1,"wrong rank.")
81 self.assertEqual(s.getShape(),(d,),"wrong shape.")
82 self.assertEqual(s.getDim(),d,"wrong spatial dimension.")
83 self.assertEqual(s.getArgument(),[],"wrong arguments.")
84 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
85 def test_Symbol_Vector_d1(self):
86 s=VectorSymbol(dim=1)
87 self.assertEqual(s.getRank(),1,"wrong rank.")
88 self.assertEqual(s.getShape(),(1,),"wrong shape.")
89 self.assertEqual(s.getDim(),1,"wrong spatial dimension.")
90 self.assertEqual(s.getArgument(),[],"wrong arguments.")
91 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
92 def test_Symbol_Vector_d2(self):
93 s=VectorSymbol(dim=2)
94 self.assertEqual(s.getRank(),1,"wrong rank.")
95 self.assertEqual(s.getShape(),(2,),"wrong shape.")
96 self.assertEqual(s.getDim(),2,"wrong spatial dimension.")
97 self.assertEqual(s.getArgument(),[],"wrong arguments.")
98 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
99 def test_Symbol_Vector_d3(self):
100 s=VectorSymbol(dim=3)
101 self.assertEqual(s.getRank(),1,"wrong rank.")
102 self.assertEqual(s.getShape(),(3,),"wrong shape.")
103 self.assertEqual(s.getDim(),3,"wrong spatial dimension.")
104 self.assertEqual(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.assertEqual(s.getRank(),2,"wrong rank.")
110 self.assertEqual(s.getShape(),(d,d),"wrong shape.")
111 self.assertEqual(s.getDim(),d,"wrong spatial dimension.")
112 self.assertEqual(s.getArgument(),[],"wrong arguments.")
113 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
114 def test_Symbol_Tensor_d1(self):
115 s=TensorSymbol(dim=1)
116 self.assertEqual(s.getRank(),2,"wrong rank.")
117 self.assertEqual(s.getShape(),(1, 1),"wrong shape.")
118 self.assertEqual(s.getDim(),1,"wrong spatial dimension.")
119 self.assertEqual(s.getArgument(),[],"wrong arguments.")
120 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
121 def test_Symbol_Tensor_d2(self):
122 s=TensorSymbol(dim=2)
123 self.assertEqual(s.getRank(),2,"wrong rank.")
124 self.assertEqual(s.getShape(),(2, 2),"wrong shape.")
125 self.assertEqual(s.getDim(),2,"wrong spatial dimension.")
126 self.assertEqual(s.getArgument(),[],"wrong arguments.")
127 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
128 def test_Symbol_Tensor_d3(self):
129 s=TensorSymbol(dim=3)
130 self.assertEqual(s.getRank(),2,"wrong rank.")
131 self.assertEqual(s.getShape(),(3, 3),"wrong shape.")
132 self.assertEqual(s.getDim(),3,"wrong spatial dimension.")
133 self.assertEqual(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.assertEqual(s.getRank(),3,"wrong rank.")
139 self.assertEqual(s.getShape(),(d,d,d),"wrong shape.")
140 self.assertEqual(s.getDim(),d,"wrong spatial dimension.")
141 self.assertEqual(s.getArgument(),[],"wrong arguments.")
142 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
143 def test_Symbol_Tensor3_d1(self):
144 s=Tensor3Symbol(dim=1)
145 self.assertEqual(s.getRank(),3,"wrong rank.")
146 self.assertEqual(s.getShape(),(1, 1, 1),"wrong shape.")
147 self.assertEqual(s.getDim(),1,"wrong spatial dimension.")
148 self.assertEqual(s.getArgument(),[],"wrong arguments.")
149 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
150 def test_Symbol_Tensor3_d2(self):
151 s=Tensor3Symbol(dim=2)
152 self.assertEqual(s.getRank(),3,"wrong rank.")
153 self.assertEqual(s.getShape(),(2, 2, 2),"wrong shape.")
154 self.assertEqual(s.getDim(),2,"wrong spatial dimension.")
155 self.assertEqual(s.getArgument(),[],"wrong arguments.")
156 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
157 def test_Symbol_Tensor3_d3(self):
158 s=Tensor3Symbol(dim=3)
159 self.assertEqual(s.getRank(),3,"wrong rank.")
160 self.assertEqual(s.getShape(),(3, 3, 3),"wrong shape.")
161 self.assertEqual(s.getDim(),3,"wrong spatial dimension.")
162 self.assertEqual(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.assertEqual(s.getRank(),4,"wrong rank.")
168 self.assertEqual(s.getShape(),(d,d,d,d),"wrong shape.")
169 self.assertEqual(s.getDim(),d,"wrong spatial dimension.")
170 self.assertEqual(s.getArgument(),[],"wrong arguments.")
171 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
172 def test_Symbol_Tensor4_d1(self):
173 s=Tensor4Symbol(dim=1)
174 self.assertEqual(s.getRank(),4,"wrong rank.")
175 self.assertEqual(s.getShape(),(1, 1, 1, 1),"wrong shape.")
176 self.assertEqual(s.getDim(),1,"wrong spatial dimension.")
177 self.assertEqual(s.getArgument(),[],"wrong arguments.")
178 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
179 def test_Symbol_Tensor4_d2(self):
180 s=Tensor4Symbol(dim=2)
181 self.assertEqual(s.getRank(),4,"wrong rank.")
182 self.assertEqual(s.getShape(),(2, 2, 2, 2),"wrong shape.")
183 self.assertEqual(s.getDim(),2,"wrong spatial dimension.")
184 self.assertEqual(s.getArgument(),[],"wrong arguments.")
185 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
186 def test_Symbol_Tensor4_d3(self):
187 s=Tensor4Symbol(dim=3)
188 self.assertEqual(s.getRank(),4,"wrong rank.")
189 self.assertEqual(s.getShape(),(3, 3, 3, 3),"wrong shape.")
190 self.assertEqual(s.getDim(),3,"wrong spatial dimension.")
191 self.assertEqual(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