/[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 1312 - (hide annotations)
Mon Sep 24 06:18:44 2007 UTC (12 years, 4 months ago) by ksteube
File MIME type: text/x-python
File size: 9653 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

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