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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

1
2 ########################################################
3 #
4 # 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
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="http://www.uq.edu.au/esscc/escript-finley"
21
22 """
23 Test suite for data objects. at the moment for dump and load only.
24
25 The tests must be linked with some function space class object in the setUp method:
26 to run the use:
27
28 from esys.finley import Brick
29 class Test_DumpOnFinley(Test_Dump):
30 def setUp(self):
31 self.domain =Rectangle(NE,NE+1,2)
32 self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)
33 self.domain_with_different_number_of_data_points_per_sample =Rectangle(2*NE,NE+1,2,integrationOrder=2)
34 self.domain_with_different_sample_ordering =Rectangle(1,(NE+1)*NE,2)
35 self.filename_base="."
36
37 suite = unittest.TestSuite()
38 suite.addTest(unittest.makeSuite(Test_DumpOnFinley))
39 unittest.TextTestRunner(verbosity=2).run(suite)
40
41 @var __author__: name of author
42 @var __copyright__: copyrights
43 @var __license__: licence agreement
44 @var __url__: url entry point on documentation
45 @var __version__: version
46 @var __date__: date of the version
47 """
48
49 __author__="Lutz Gross, l.gross@uq.edu.au"
50
51 import unittest
52 import os
53 import numarray
54 from esys.escript import *
55
56 class Test_Domain(unittest.TestCase):
57 def test_addTags(self):
58 tag1="A"
59 tag2="B"
60 tag3="C"
61 self.domain.setTagMap(tag1,1)
62 self.failUnless(self.domain.isValidTagName(tag1))
63 self.failUnless(not self.domain.isValidTagName(tag2))
64 self.domain.setTagMap(tag2,2)
65 self.failUnless(self.domain.isValidTagName(tag1))
66 self.failUnless(self.domain.isValidTagName(tag2))
67 self.failUnless(not self.domain.isValidTagName(tag3))
68 self.failUnless(self.domain.getTag(tag1)==1)
69 self.failUnless(self.domain.getTag(tag2)==2)
70 self.failUnlessRaises(RuntimeError,self.domain.getTag,tag3)
71
72 # set tag:
73 s=Scalar(0,Function(self.domain))
74 r=Scalar(0,Function(self.domain))
75 s.setTaggedValue(tag1,1.)
76 r.setTaggedValue(1,1.)
77 s.setTaggedValue(tag2,2.)
78 r.setTaggedValue(2,2.)
79 s.setTaggedValue(tag3,3.)
80 self.failUnless(Lsup(s-r)<=0.)
81 # get tag:
82 names=getTagNames(self.domain)
83 self.failUnless(len(names) == 6)
84 self.failUnless( tag1 in names )
85 self.failUnless( tag2 in names )
86 self.failUnless(self.domain.isValidTagName(tag1))
87 self.failUnless(self.domain.isValidTagName(tag2))
88 # insert tag shortcut:
89 s2=insertTaggedValues(Scalar(0,Function(self.domain)),**{ tag1 : 1., tag2 : 2.})
90 self.failUnless(Lsup(s2-r)<=0.)
91 def test_functionspace_ContinuousFunction(self):
92 fs=ContinuousFunction(self.domain)
93 self.failUnless(fs.getDomain()==self.domain)
94 self.failUnless(self.domain.getDim() == fs.getDim())
95 x=fs.getX()
96 self.failUnless(x.getFunctionSpace() == fs)
97 self.failUnless(x.getShape() == (fs.getDim(),))
98 self.failUnless(inf(x[0])>=0.)
99 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
100 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
101 self.failUnless(sup(x[0])<=1.)
102 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
103 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
104
105 def test_functionspace_Solution(self):
106 fs=Solution(self.domain)
107 self.failUnless(fs.getDomain()==self.domain)
108 self.failUnless(self.domain.getDim() == fs.getDim())
109 x=fs.getX()
110 self.failUnless(x.getFunctionSpace() == fs)
111 self.failUnless(x.getShape() == (fs.getDim(),))
112 self.failUnless(inf(x[0])>=0.)
113 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
114 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
115 self.failUnless(sup(x[0])<=1.)
116 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
117 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
118
119 def test_functionspace_ReducedSolution(self):
120 fs=ReducedSolution(self.domain)
121 self.failUnless(fs.getDomain()==self.domain)
122 self.failUnless(self.domain.getDim() == fs.getDim())
123 x=fs.getX()
124 self.failUnless(x.getFunctionSpace() == fs)
125 self.failUnless(x.getShape() == (fs.getDim(),))
126 self.failUnless(inf(x[0])>=0.)
127 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
128 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
129 self.failUnless(sup(x[0])<=1.)
130 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
131 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
132
133 def test_functionspace_Function(self):
134 fs=Function(self.domain)
135 self.failUnless(fs.getDomain()==self.domain)
136 self.failUnless(self.domain.getDim() == fs.getDim())
137 x=fs.getX()
138 self.failUnless(x.getFunctionSpace() == fs)
139 self.failUnless(x.getShape() == (fs.getDim(),))
140 self.failUnless(inf(x[0])>=0.)
141 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
142 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
143 self.failUnless(sup(x[0])<=1.)
144 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
145 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
146
147 def test_functionspace_ReducedFunction(self):
148 fs=ReducedFunction(self.domain)
149 self.failUnless(fs.getDomain()==self.domain)
150 self.failUnless(self.domain.getDim() == fs.getDim())
151 x=fs.getX()
152 self.failUnless(x.getFunctionSpace() == fs)
153 self.failUnless(x.getShape() == (fs.getDim(),))
154 self.failUnless(inf(x[0])>=0.)
155 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
156 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
157 self.failUnless(sup(x[0])<=1.)
158 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
159 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
160 def test_functionspace_FunctionOnBoundary(self):
161 fs=FunctionOnBoundary(self.domain)
162 self.failUnless(fs.getDomain()==self.domain)
163 self.failUnless(self.domain.getDim() == fs.getDim())
164 x=fs.getX()
165 self.failUnless(x.getFunctionSpace() == fs)
166 self.failUnless(x.getShape() == (fs.getDim(),))
167 self.failUnless(inf(x[0])>=0.)
168 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
169 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
170 self.failUnless(sup(x[0])<=1.)
171 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
172 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
173
174 def test_functionspace_ReducedFunctionOnBoundary(self):
175 fs=ReducedFunctionOnBoundary(self.domain)
176 self.failUnless(fs.getDomain()==self.domain)
177 self.failUnless(self.domain.getDim() == fs.getDim())
178 x=fs.getX()
179 self.failUnless(x.getFunctionSpace() == fs)
180 self.failUnless(x.getShape() == (fs.getDim(),))
181 self.failUnless(inf(x[0])>=0.)
182 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
183 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
184 self.failUnless(sup(x[0])<=1.)
185 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
186 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
187 #===========================================================================
188 class Test_SetDataPointValue(unittest.TestCase):
189 arg0=9.81
190 arg1=numarray.array([3.098, -3.111])
191 arg2=numarray.array([[3.82, -3.81, -0.957, 0.892, -1.367], [-4.589, -1.835, -2.679, -1.517, -4.2515], [-4.909, 1.634, -2.883, -2.135, 1.187], [0.6431, 4.638, -4.616, -0.196, -4.370]])
192 arg3=numarray.array([[[-2.3667, -0.040], [-4.7398, -3.2412]], [[-2.125, -2.240], [2.237, -4.279]], [[0.68720, 2.4059], [-2.4964, 3.17453]], [[-4.907, -4.9431], [-0.3604, 0.4269]], [[1.4179, 3.326], [1.356, -0.4610]], [[3.378, 2.0902], [-2.6857, 1.3585]]])
193 arg4=numarray.array([[[[-3.810, -1.3597, -1.5307, 1.099], [-1.828, 0.2526, -1.4429, 2.326], [4.9732, -2.063, 1.3153, -3.809]], [[-4.8902, -4.714, 1.520, -1.931], [-3.8847, 4.3867, 1.894030, 2.432], [-1.2082, -0.8304, 2.2612, 4.6399]]], [[[-4.5922, -3.309, -0.8171, -0.7210], [2.8051, -4.93047, 0.08450, 4.3824], [0.43204, 2.1908, 4.512633, -1.8218]], [[2.2493, -4.190, -2.3893, -4.147], [-2.104, -4.635, -4.2767, -3.53151], [-2.351, -1.6614, 2.9385, 4.099]]], [[[1.710, 0.2235, -3.4917, 0.8713], [-0.2881, 4.6278, 3.603, -2.1211], [-0.565, 4.294, -2.210827, -0.37651]], [[0.6578, -2.869, -2.490, -4.789], [3.232, 2.483, 0.9531, 2.260], [-1.785, 0.42156, -1.8379, 4.212]]]])
194 def test_SetDataPointValue_Function_Rank0(self):
195 d=Data(self.arg0,Function(self.domain))
196 d.setValueOfDataPoint(0,self.arg0*2)
197 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
198 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg0)
199 d_0=d.getValueOfDataPoint(0)
200 d_1=d.getValueOfDataPoint(1)
201 self.failUnless(Lsup(d_0-self.arg0*2)<=Lsup(self.arg0*2), "wrong setting")
202 self.failUnless(Lsup(d_1-self.arg0)<=Lsup(self.arg0), "wrong setting")
203 def test_SetDataPointValue_Function_Rank1(self):
204 d=Data(self.arg1,Function(self.domain))
205 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
206 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
207 d.setValueOfDataPoint(0,self.arg1*2)
208 d_0=d.getValueOfDataPoint(0)
209 d_1=d.getValueOfDataPoint(1)
210 self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")
211 self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
212 def test_SetDataPointValue_Function_Rank1_list(self):
213 d=Data(self.arg1,Function(self.domain))
214 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
215 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
216 d.setValueOfDataPoint(0,numarray.array2list(self.arg1*2))
217 d_0=d.getValueOfDataPoint(0)
218 d_1=d.getValueOfDataPoint(1)
219 self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")
220 self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
221 def test_SetDataPointValue_Function_Rank2(self):
222 d=Data(self.arg2,Function(self.domain))
223 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
224 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
225 d.setValueOfDataPoint(0,self.arg2*2)
226 d_0=d.getValueOfDataPoint(0)
227 d_1=d.getValueOfDataPoint(1)
228 self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")
229 self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
230 def test_SetDataPointValue_Function_Rank2_list(self):
231 d=Data(self.arg2,Function(self.domain))
232 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
233 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
234 d.setValueOfDataPoint(0,numarray.array2list(self.arg2*2))
235 d_0=d.getValueOfDataPoint(0)
236 d_1=d.getValueOfDataPoint(1)
237 self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")
238 self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
239 def test_SetDataPointValue_Function_Rank3(self):
240 d=Data(self.arg3,Function(self.domain))
241 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
242 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
243 d.setValueOfDataPoint(0,self.arg3*2)
244 d_0=d.getValueOfDataPoint(0)
245 d_1=d.getValueOfDataPoint(1)
246 self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")
247 self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
248 def test_SetDataPointValue_Function_Rank3_list(self):
249 d=Data(self.arg3,Function(self.domain))
250 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
251 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
252 d.setValueOfDataPoint(0,numarray.array2list(self.arg3*2))
253 d_0=d.getValueOfDataPoint(0)
254 d_1=d.getValueOfDataPoint(1)
255 self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")
256 self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
257 def test_SetDataPointValue_Function_Rank4(self):
258 d=Data(self.arg4,Function(self.domain))
259 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
260 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
261 d.setValueOfDataPoint(0,self.arg4*2)
262 d_0=d.getValueOfDataPoint(0)
263 d_1=d.getValueOfDataPoint(1)
264 self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")
265 self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
266 def test_SetDataPointValue_Function_Rank4_list(self):
267 d=Data(self.arg4,Function(self.domain))
268 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
269 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
270 d.setValueOfDataPoint(0,numarray.array2list(self.arg4*2))
271 d_0=d.getValueOfDataPoint(0)
272 d_1=d.getValueOfDataPoint(1)
273 self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")
274 self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
275 #===========================================================================
276 def test_SetDataPointValue_ReducedFunction_Rank0(self):
277 d=Data(self.arg0,ReducedFunction(self.domain))
278 d.setValueOfDataPoint(0,self.arg0*2)
279 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
280 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg0)
281 d_0=d.getValueOfDataPoint(0)
282 d_1=d.getValueOfDataPoint(1)
283 self.failUnless(Lsup(d_0-self.arg0*2)<=Lsup(self.arg0*2), "wrong setting")
284 self.failUnless(Lsup(d_1-self.arg0)<=Lsup(self.arg0), "wrong setting")
285 def test_SetDataPointValue_ReducedFunction_Rank1(self):
286 d=Data(self.arg1,ReducedFunction(self.domain))
287 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
288 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
289 d.setValueOfDataPoint(0,self.arg1*2)
290 d_0=d.getValueOfDataPoint(0)
291 d_1=d.getValueOfDataPoint(1)
292 self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")
293 self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
294 def test_SetDataPointValue_ReducedFunction_Rank1_list(self):
295 d=Data(self.arg1,ReducedFunction(self.domain))
296 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
297 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
298 d.setValueOfDataPoint(0,numarray.array2list(self.arg1*2))
299 d_0=d.getValueOfDataPoint(0)
300 d_1=d.getValueOfDataPoint(1)
301 self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")
302 self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
303 def test_SetDataPointValue_ReducedFunction_Rank2(self):
304 d=Data(self.arg2,ReducedFunction(self.domain))
305 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
306 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
307 d.setValueOfDataPoint(0,self.arg2*2)
308 d_0=d.getValueOfDataPoint(0)
309 d_1=d.getValueOfDataPoint(1)
310 self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")
311 self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
312 def test_SetDataPointValue_ReducedFunction_Rank2_list(self):
313 d=Data(self.arg2,ReducedFunction(self.domain))
314 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
315 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
316 d.setValueOfDataPoint(0,numarray.array2list(self.arg2*2))
317 d_0=d.getValueOfDataPoint(0)
318 d_1=d.getValueOfDataPoint(1)
319 self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")
320 self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
321 def test_SetDataPointValue_ReducedFunction_Rank3(self):
322 d=Data(self.arg3,ReducedFunction(self.domain))
323 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
324 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
325 d.setValueOfDataPoint(0,self.arg3*2)
326 d_0=d.getValueOfDataPoint(0)
327 d_1=d.getValueOfDataPoint(1)
328 self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")
329 self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
330 def test_SetDataPointValue_ReducedFunction_Rank3_list(self):
331 d=Data(self.arg3,ReducedFunction(self.domain))
332 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
333 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
334 d.setValueOfDataPoint(0,numarray.array2list(self.arg3*2))
335 d_0=d.getValueOfDataPoint(0)
336 d_1=d.getValueOfDataPoint(1)
337 self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")
338 self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
339 def test_SetDataPointValue_ReducedFunction_Rank4(self):
340 d=Data(self.arg4,ReducedFunction(self.domain))
341 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
342 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
343 d.setValueOfDataPoint(0,self.arg4*2)
344 d_0=d.getValueOfDataPoint(0)
345 d_1=d.getValueOfDataPoint(1)
346 self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")
347 self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
348 def test_SetDataPointValue_ReducedFunction_Rank4_list(self):
349 d=Data(self.arg4,ReducedFunction(self.domain))
350 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
351 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
352 d.setValueOfDataPoint(0,numarray.array2list(self.arg4*2))
353 d_0=d.getValueOfDataPoint(0)
354 d_1=d.getValueOfDataPoint(1)
355 self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")
356 self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
357
358 class Test_Dump(unittest.TestCase):
359 arg0=9.81
360 arg1=numarray.array([3.098, -3.111])
361 arg2=numarray.array([[3.82, -3.81, -0.957, 0.892, -1.367], [-4.589, -1.835, -2.679, -1.517, -4.2515], [-4.909, 1.634, -2.883, -2.135, 1.187], [0.6431, 4.638, -4.616, -0.196, -4.370]])
362 arg3=numarray.array([[[-2.3667, -0.040], [-4.7398, -3.2412]], [[-2.125, -2.240], [2.237, -4.279]], [[0.68720, 2.4059], [-2.4964, 3.17453]], [[-4.907, -4.9431], [-0.3604, 0.4269]], [[1.4179, 3.326], [1.356, -0.4610]], [[3.378, 2.0902], [-2.6857, 1.3585]]])
363 arg4=numarray.array([[[[-3.810, -1.3597, -1.5307, 1.099], [-1.828, 0.2526, -1.4429, 2.326], [4.9732, -2.063, 1.3153, -3.809]], [[-4.8902, -4.714, 1.520, -1.931], [-3.8847, 4.3867, 1.894030, 2.432], [-1.2082, -0.8304, 2.2612, 4.6399]]], [[[-4.5922, -3.309, -0.8171, -0.7210], [2.8051, -4.93047, 0.08450, 4.3824], [0.43204, 2.1908, 4.512633, -1.8218]], [[2.2493, -4.190, -2.3893, -4.147], [-2.104, -4.635, -4.2767, -3.53151], [-2.351, -1.6614, 2.9385, 4.099]]], [[[1.710, 0.2235, -3.4917, 0.8713], [-0.2881, 4.6278, 3.603, -2.1211], [-0.565, 4.294, -2.210827, -0.37651]], [[0.6578, -2.869, -2.490, -4.789], [3.232, 2.483, 0.9531, 2.260], [-1.785, 0.42156, -1.8379, 4.212]]]])
364
365 def _diffDataObjects(self,d_ref,filemame):
366 d_ref.dump(filemame)
367 d=load(filemame, self.domain)
368 self.failUnless(not d.isEmpty(),"data in %s are empty."%filemame)
369 self.failUnless(d_ref.getFunctionSpace() == d.getFunctionSpace(), "wrong function space in %s."%filemame)
370 self.failUnless(d_ref.getRank() == d.getRank(), "different rank in %s. "%filemame)
371 self.failUnless(d_ref.getShape() == d.getShape(), "different shape %s. "%filemame)
372 self.failUnless(Lsup(d_ref-d)<=0., "different entries %s."%filemame)
373
374 #===========================================================================
375 def test_DumpAndLoad_Constant_Solution_Rank0(self):
376 if loadIsConfigured():
377 filemame=os.path.join(self.filename_base,"constant_solution_rank0.nc")
378 d=Data(self.arg0,Solution(self.domain))
379 self._diffDataObjects(d,filemame)
380
381 def test_DumpAndLoad_Constant_Solution_Rank1(self):
382 if loadIsConfigured():
383 filemame=os.path.join(self.filename_base,"constant_solution_rank1.nc")
384 d=Data(self.arg1,Solution(self.domain))
385 self._diffDataObjects(d,filemame)
386
387 def test_DumpAndLoad_Constant_Solution_Rank2(self):
388 if loadIsConfigured():
389 filemame=os.path.join(self.filename_base,"constant_solution_rank2.nc")
390 d=Data(self.arg2,Solution(self.domain))
391 self._diffDataObjects(d,filemame)
392
393 def test_DumpAndLoad_Constant_Solution_Rank3(self):
394 if loadIsConfigured():
395 filemame=os.path.join(self.filename_base,"constant_solution_rank3.nc")
396 d=Data(self.arg3,Solution(self.domain))
397 self._diffDataObjects(d,filemame)
398
399 def test_DumpAndLoad_Constant_Solution_Rank4(self):
400 if loadIsConfigured():
401 filemame=os.path.join(self.filename_base,"constant_solution_rank4.nc")
402 d=Data(self.arg4,Solution(self.domain))
403 self._diffDataObjects(d,filemame)
404 #===========================================================================
405 def test_DumpAndLoad_Constant_ReducedSolution_Rank0(self):
406 if loadIsConfigured():
407 filemame=os.path.join(self.filename_base,"constant_reduced_solution_rank0.nc")
408 d=Data(self.arg0,ReducedSolution(self.domain))
409 self._diffDataObjects(d,filemame)
410
411 def test_DumpAndLoad_Constant_ReducedSolution_Rank1(self):
412 if loadIsConfigured():
413 filemame=os.path.join(self.filename_base,"constant_reduced_solution_rank1.nc")
414 d=Data(self.arg1,ReducedSolution(self.domain))
415 self._diffDataObjects(d,filemame)
416
417 def test_DumpAndLoad_Constant_ReducedSolution_Rank2(self):
418 if loadIsConfigured():
419 filemame=os.path.join(self.filename_base,"constant_reduced_solution_rank2.nc")
420 d=Data(self.arg2,ReducedSolution(self.domain))
421 self._diffDataObjects(d,filemame)
422
423 def test_DumpAndLoad_Constant_ReducedSolution_Rank3(self):
424 if loadIsConfigured():
425 filemame=os.path.join(self.filename_base,"constant_reduced_solution_rank3.nc")
426 d=Data(self.arg3,ReducedSolution(self.domain))
427 self._diffDataObjects(d,filemame)
428
429 def test_DumpAndLoad_Constant_ReducedSolution_Rank4(self):
430 if loadIsConfigured():
431 filemame=os.path.join(self.filename_base,"constant_reduced_solution_rank4.nc")
432 d=Data(self.arg4,ReducedSolution(self.domain))
433 self._diffDataObjects(d,filemame)
434 #===========================================================================
435 def test_DumpAndLoad_Constant_ContinuousFunction_Rank0(self):
436 if loadIsConfigured():
437 filemame=os.path.join(self.filename_base,"constant_continuous_function_rank0.nc")
438 d=Data(self.arg0,ContinuousFunction(self.domain))
439 self._diffDataObjects(d,filemame)
440
441 def test_DumpAndLoad_Constant_ContinuousFunction_Rank1(self):
442 if loadIsConfigured():
443 filemame=os.path.join(self.filename_base,"constant_continuous_function_rank1.nc")
444 d=Data(self.arg1,ContinuousFunction(self.domain))
445 self._diffDataObjects(d,filemame)
446
447 def test_DumpAndLoad_Constant_ContinuousFunction_Rank2(self):
448 if loadIsConfigured():
449 filemame=os.path.join(self.filename_base,"constant_continuous_function_rank2.nc")
450 d=Data(self.arg2,ContinuousFunction(self.domain))
451 self._diffDataObjects(d,filemame)
452
453 def test_DumpAndLoad_Constant_ContinuousFunction_Rank3(self):
454 if loadIsConfigured():
455 filemame=os.path.join(self.filename_base,"constant_continuous_function_rank3.nc")
456 d=Data(self.arg3,ContinuousFunction(self.domain))
457 self._diffDataObjects(d,filemame)
458
459 def test_DumpAndLoad_Constant_ContinuousFunction_Rank4(self):
460 if loadIsConfigured():
461 filemame=os.path.join(self.filename_base,"constant_continuous_function_rank4.nc")
462 d=Data(self.arg4,ContinuousFunction(self.domain))
463 self._diffDataObjects(d,filemame)
464
465 #===========================================================================
466 def test_DumpAndLoad_Constant_Function_Rank0(self):
467 if loadIsConfigured():
468 filemame=os.path.join(self.filename_base,"constant_function_rank0.nc")
469 d=Data(self.arg0,Function(self.domain))
470 self._diffDataObjects(d,filemame)
471
472 def test_DumpAndLoad_Constant_Function_Rank1(self):
473 if loadIsConfigured():
474 filemame=os.path.join(self.filename_base,"constant_function_rank1.nc")
475 d=Data(self.arg1,Function(self.domain))
476 self._diffDataObjects(d,filemame)
477
478 def test_DumpAndLoad_Constant_Function_Rank2(self):
479 if loadIsConfigured():
480 filemame=os.path.join(self.filename_base,"constant_function_rank2.nc")
481 d=Data(self.arg2,Function(self.domain))
482 self._diffDataObjects(d,filemame)
483
484 def test_DumpAndLoad_Constant_Function_Rank3(self):
485 if loadIsConfigured():
486 filemame=os.path.join(self.filename_base,"constant_function_rank3.nc")
487 d=Data(self.arg3,Function(self.domain))
488 self._diffDataObjects(d,filemame)
489
490 #===========================================================================
491 def test_DumpAndLoad_Constant_ReducedFunction_Rank0(self):
492 if loadIsConfigured():
493 filemame=os.path.join(self.filename_base,"constant_reduced_function_rank0.nc")
494 d=Data(self.arg0,ReducedFunction(self.domain))
495 self._diffDataObjects(d,filemame)
496
497 def test_DumpAndLoad_Constant_ReducedFunction_Rank1(self):
498 if loadIsConfigured():
499 filemame=os.path.join(self.filename_base,"constant_reduced_function_rank1.nc")
500 d=Data(self.arg1,ReducedFunction(self.domain))
501 self._diffDataObjects(d,filemame)
502
503 def test_DumpAndLoad_Constant_ReducedFunction_Rank2(self):
504 if loadIsConfigured():
505 filemame=os.path.join(self.filename_base,"constant_reduced_function_rank2.nc")
506 d=Data(self.arg2,ReducedFunction(self.domain))
507 self._diffDataObjects(d,filemame)
508
509 def test_DumpAndLoad_Constant_ReducedFunction_Rank3(self):
510 if loadIsConfigured():
511 filemame=os.path.join(self.filename_base,"constant_reduced_function_rank3.nc")
512 d=Data(self.arg3,ReducedFunction(self.domain))
513 self._diffDataObjects(d,filemame)
514 def test_DumpAndLoad_Constant_ReducedFunction_Rank4(self):
515 if loadIsConfigured():
516 filemame=os.path.join(self.filename_base,"constant_reduced_function_rank4.nc")
517 d=Data(self.arg4,ReducedFunction(self.domain))
518 self._diffDataObjects(d,filemame)
519
520 #===========================================================================
521 def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank0(self):
522 if loadIsConfigured():
523 filemame=os.path.join(self.filename_base,"constant_function_on_boundary_rank0.nc")
524 d=Data(self.arg0,FunctionOnBoundary(self.domain))
525 self._diffDataObjects(d,filemame)
526
527 def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank1(self):
528 if loadIsConfigured():
529 filemame=os.path.join(self.filename_base,"constant_function_on_boundary_rank1.nc")
530 d=Data(self.arg1,FunctionOnBoundary(self.domain))
531 self._diffDataObjects(d,filemame)
532
533 def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank2(self):
534 if loadIsConfigured():
535 filemame=os.path.join(self.filename_base,"constant_function_on_boundary_rank2.nc")
536 d=Data(self.arg2,FunctionOnBoundary(self.domain))
537 self._diffDataObjects(d,filemame)
538
539 def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank3(self):
540 if loadIsConfigured():
541 filemame=os.path.join(self.filename_base,"constant_function_on_boundary_rank3.nc")
542 d=Data(self.arg3,FunctionOnBoundary(self.domain))
543 self._diffDataObjects(d,filemame)
544
545 def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank4(self):
546 if loadIsConfigured():
547 filemame=os.path.join(self.filename_base,"constant_function_on_boundary_rank4.nc")
548 d=Data(self.arg4,FunctionOnBoundary(self.domain))
549 self._diffDataObjects(d,filemame)
550
551 #===========================================================================
552 def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank0(self):
553 if loadIsConfigured():
554 filemame=os.path.join(self.filename_base,"constant_reduced_function_on_boundary_rank0.nc")
555 d=Data(self.arg0,FunctionOnBoundary(self.domain))
556 self._diffDataObjects(d,filemame)
557
558 def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank1(self):
559 if loadIsConfigured():
560 filemame=os.path.join(self.filename_base,"constant_reduced_function_on_boundary_rank1.nc")
561 d=Data(self.arg1,ReducedFunctionOnBoundary(self.domain))
562 self._diffDataObjects(d,filemame)
563
564 def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank2(self):
565 if loadIsConfigured():
566 filemame=os.path.join(self.filename_base,"constant_reduced_function_on_boundary_rank2.nc")
567 d=Data(self.arg2,ReducedFunctionOnBoundary(self.domain))
568 self._diffDataObjects(d,filemame)
569
570 def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank3(self):
571 if loadIsConfigured():
572 filemame=os.path.join(self.filename_base,"constant_reduced_function_on_boundary_rank3.nc")
573 d=Data(self.arg3,ReducedFunctionOnBoundary(self.domain))
574 self._diffDataObjects(d,filemame)
575
576 def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank4(self):
577 if loadIsConfigured():
578 filemame=os.path.join(self.filename_base,"constant_reduced_function_on_boundary_rank4.nc")
579 d=Data(self.arg4,ReducedFunctionOnBoundary(self.domain))
580 self._diffDataObjects(d,filemame)
581
582 #===========================================================================
583 def test_DumpAndLoad_Expanded_Solution_Rank0(self):
584 if loadIsConfigured():
585 filemame=os.path.join(self.filename_base,"expanded_solution_rank0.nc")
586 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
587 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
588 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
589 d=Data(length(Solution(self.domain).getX())*self.arg0,Solution(self.domain))
590 self._diffDataObjects(d,filemame)
591
592 def test_DumpAndLoad_Expanded_Solution_Rank1(self):
593 if loadIsConfigured():
594 filemame=os.path.join(self.filename_base,"expanded_solution_rank1.nc")
595 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
596 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
597 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
598 d=Data(length(Solution(self.domain).getX())*self.arg1,Solution(self.domain))
599 self._diffDataObjects(d,filemame)
600
601 def test_DumpAndLoad_Expanded_Solution_Rank2(self):
602 if loadIsConfigured():
603 filemame=os.path.join(self.filename_base,"expanded_solution_rank2.nc")
604 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
605 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
606 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
607 d=Data(length(Solution(self.domain).getX())*self.arg2,Solution(self.domain))
608 self._diffDataObjects(d,filemame)
609
610 def test_DumpAndLoad_Expanded_Solution_Rank3(self):
611 if loadIsConfigured():
612 filemame=os.path.join(self.filename_base,"expanded_solution_rank3.nc")
613 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
614 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
615 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
616 d=Data(length(Solution(self.domain).getX())*self.arg3,Solution(self.domain))
617 self._diffDataObjects(d,filemame)
618
619 def test_DumpAndLoad_Expanded_Solution_Rank4(self):
620 if loadIsConfigured():
621 filemame=os.path.join(self.filename_base,"expanded_solution_rank4.nc")
622 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
623 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
624 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
625 d=Data(length(Solution(self.domain).getX())*self.arg4,Solution(self.domain))
626 self._diffDataObjects(d,filemame)
627 #===========================================================================
628 def test_DumpAndLoad_Expanded_ReducedSolution_Rank0(self):
629 if loadIsConfigured():
630 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank0.nc")
631 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
632 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
633 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
634 d=Data(length(ReducedSolution(self.domain).getX())*self.arg0,ReducedSolution(self.domain))
635 self._diffDataObjects(d,filemame)
636
637 def test_DumpAndLoad_Expanded_ReducedSolution_Rank1(self):
638 if loadIsConfigured():
639 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank1.nc")
640 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
641 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
642 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
643 d=Data(length(ReducedSolution(self.domain).getX())*self.arg1,ReducedSolution(self.domain))
644 self._diffDataObjects(d,filemame)
645
646 def test_DumpAndLoad_Expanded_ReducedSolution_Rank2(self):
647 if loadIsConfigured():
648 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank2.nc")
649 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
650 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
651 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
652 d=Data(length(ReducedSolution(self.domain).getX())*self.arg2,ReducedSolution(self.domain))
653 self._diffDataObjects(d,filemame)
654
655 def test_DumpAndLoad_Expanded_ReducedSolution_Rank3(self):
656 if loadIsConfigured():
657 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank3.nc")
658 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
659 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
660 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
661 d=Data(length(ReducedSolution(self.domain).getX())*self.arg3,ReducedSolution(self.domain))
662 self._diffDataObjects(d,filemame)
663
664 def test_DumpAndLoad_Expanded_ReducedSolution_Rank4(self):
665 if loadIsConfigured():
666 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank4.nc")
667 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
668 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
669 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
670 d=Data(length(ReducedSolution(self.domain).getX())*self.arg4,ReducedSolution(self.domain))
671 self._diffDataObjects(d,filemame)
672 #===========================================================================
673 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank0(self):
674 if loadIsConfigured():
675 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank0.nc")
676 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
677 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
678 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
679 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg0,ContinuousFunction(self.domain))
680 self._diffDataObjects(d,filemame)
681
682 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank1(self):
683 if loadIsConfigured():
684 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank1.nc")
685 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
686 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
687 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
688 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg1,ContinuousFunction(self.domain))
689 self._diffDataObjects(d,filemame)
690
691 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank2(self):
692 if loadIsConfigured():
693 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank2.nc")
694 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
695 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
696 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
697 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg2,ContinuousFunction(self.domain))
698 self._diffDataObjects(d,filemame)
699
700 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank3(self):
701 if loadIsConfigured():
702 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank3.nc")
703 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg3,ContinuousFunction(self.domain))
704 self._diffDataObjects(d,filemame)
705
706 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank4(self):
707 if loadIsConfigured():
708 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank4.nc")
709 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
710 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
711 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
712 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg4,ContinuousFunction(self.domain))
713 self._diffDataObjects(d,filemame)
714
715 #===========================================================================
716 def test_DumpAndLoad_Expanded_Function_Rank0(self):
717 if loadIsConfigured():
718 filemame=os.path.join(self.filename_base,"expanded_function_rank0.nc")
719 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
720 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
721 # elements are not in different order: self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
722 d=Data(length(Function(self.domain).getX())*self.arg0,Function(self.domain))
723 self._diffDataObjects(d,filemame)
724
725 def test_DumpAndLoad_Expanded_Function_Rank1(self):
726 if loadIsConfigured():
727 filemame=os.path.join(self.filename_base,"expanded_function_rank1.nc")
728 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
729 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
730 # elements are not in different order: self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
731 d=Data(length(Function(self.domain).getX())*self.arg1,Function(self.domain))
732 self._diffDataObjects(d,filemame)
733
734 def test_DumpAndLoad_Expanded_Function_Rank2(self):
735 if loadIsConfigured():
736 filemame=os.path.join(self.filename_base,"expanded_function_rank2.nc")
737 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
738 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
739 # elements are not in different order: self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
740 d=Data(length(Function(self.domain).getX())*self.arg2,Function(self.domain))
741 self._diffDataObjects(d,filemame)
742
743 def test_DumpAndLoad_Expanded_Function_Rank3(self):
744 if loadIsConfigured():
745 filemame=os.path.join(self.filename_base,"expanded_function_rank3.nc")
746 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
747 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
748 # elements are not in different order: self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
749 d=Data(length(Function(self.domain).getX())*self.arg3,Function(self.domain))
750 self._diffDataObjects(d,filemame)
751
752 def test_DumpAndLoad_Expanded_Function_Rank4(self):
753 if loadIsConfigured():
754 filemame=os.path.join(self.filename_base,"expanded_function_rank4.nc")
755 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
756 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
757 # elements are not in different order: self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
758 d=Data(length(Function(self.domain).getX())*self.arg4,Function(self.domain))
759 self._diffDataObjects(d,filemame)
760
761 #===========================================================================
762 def test_DumpAndLoad_Expanded_ReducedFunction_Rank0(self):
763 if loadIsConfigured():
764 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank0.nc")
765 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
766 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
767 # elements are not in different order: self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
768 d=Data(length(ReducedFunction(self.domain).getX())*self.arg0,ReducedFunction(self.domain))
769 self._diffDataObjects(d,filemame)
770
771 def test_DumpAndLoad_Expanded_ReducedFunction_Rank1(self):
772 if loadIsConfigured():
773 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank1.nc")
774 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
775 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
776 # elements are not in different order: self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
777 d=Data(length(ReducedFunction(self.domain).getX())*self.arg1,ReducedFunction(self.domain))
778 self._diffDataObjects(d,filemame)
779
780 def test_DumpAndLoad_Expanded_ReducedFunction_Rank2(self):
781 if loadIsConfigured():
782 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank2.nc")
783 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
784 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
785 # elements are not in different order: self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
786 d=Data(length(ReducedFunction(self.domain).getX())*self.arg2,ReducedFunction(self.domain))
787 self._diffDataObjects(d,filemame)
788
789 def test_DumpAndLoad_Expanded_ReducedFunction_Rank3(self):
790 if loadIsConfigured():
791 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank3.nc")
792 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
793 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
794 # elements are not in different order: self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
795 d=Data(length(ReducedFunction(self.domain).getX())*self.arg3,ReducedFunction(self.domain))
796 self._diffDataObjects(d,filemame)
797
798 def test_DumpAndLoad_Expanded_ReducedFunction_Rank4(self):
799 if loadIsConfigured():
800 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank4.nc")
801 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
802 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
803 # elements are not in different order: self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
804 d=Data(length(ReducedFunction(self.domain).getX())*self.arg4,ReducedFunction(self.domain))
805 self._diffDataObjects(d,filemame)
806
807 #===========================================================================
808 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank0(self):
809 if loadIsConfigured():
810 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank0.nc")
811 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
812 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
813 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
814 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg0,FunctionOnBoundary(self.domain))
815 self._diffDataObjects(d,filemame)
816
817 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank1(self):
818 if loadIsConfigured():
819 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank1.nc")
820 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
821 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
822 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
823 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg1,FunctionOnBoundary(self.domain))
824 self._diffDataObjects(d,filemame)
825
826 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank2(self):
827 if loadIsConfigured():
828 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank2.nc")
829 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
830 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
831 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
832 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg2,FunctionOnBoundary(self.domain))
833 self._diffDataObjects(d,filemame)
834
835 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank3(self):
836 if loadIsConfigured():
837 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank3.nc")
838 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
839 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
840 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
841 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg3,FunctionOnBoundary(self.domain))
842 self._diffDataObjects(d,filemame)
843
844 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank4(self):
845 if loadIsConfigured():
846 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank4.nc")
847 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
848 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
849 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
850 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg4,FunctionOnBoundary(self.domain))
851 self._diffDataObjects(d,filemame)
852
853 #===========================================================================
854 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank0(self):
855 if loadIsConfigured():
856 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank0.nc")
857 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
858 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
859 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
860 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg0,ReducedFunctionOnBoundary(self.domain))
861 self._diffDataObjects(d,filemame)
862
863 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank1(self):
864 if loadIsConfigured():
865 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank1.nc")
866 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
867 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
868 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
869 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg1,ReducedFunctionOnBoundary(self.domain))
870 self._diffDataObjects(d,filemame)
871
872 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank2(self):
873 if loadIsConfigured():
874 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank2.nc")
875 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
876 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
877 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
878 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg2,ReducedFunctionOnBoundary(self.domain))
879 self._diffDataObjects(d,filemame)
880
881 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank3(self):
882 if loadIsConfigured():
883 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank3.nc")
884 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
885 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
886 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
887 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg3,ReducedFunctionOnBoundary(self.domain))
888 self._diffDataObjects(d,filemame)
889
890 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank4(self):
891 if loadIsConfigured():
892 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank4.nc")
893 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
894 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
895 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_sample_ordering)
896 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg4,ReducedFunctionOnBoundary(self.domain))
897 self._diffDataObjects(d,filemame)
898
899 #===========================================================================
900 ## This functionspace does not currently support tags.
901 ## Instead, we test that the canTag() function throws in test_canTag_Failures.
902
903 #def test_DumpAndLoad_Tagged_Solution_Rank0(self):
904 #if loadIsConfigured():
905 #filemame=os.path.join(self.filename_base,"tagged_solution_rank0.nc")
906 #d=Data(self.arg0,Solution(self.domain))
907 #d.setTaggedValue(1,self.arg0*2)
908 #d.setTaggedValue(10,self.arg0*3)
909 #d.setTaggedValue(100,self.arg0*4)
910 #self._diffDataObjects(d,filemame)
911
912 #def test_DumpAndLoad_Tagged_Solution_Rank1(self):
913 #if loadIsConfigured():
914 #filemame=os.path.join(self.filename_base,"tagged_solution_rank1.nc")
915 #d=Data(self.arg1,Solution(self.domain))
916 #d.setTaggedValue(1,self.arg1*2)
917 #d.setTaggedValue(10,self.arg1*3)
918 #d.setTaggedValue(100,self.arg1*4)
919 #self._diffDataObjects(d,filemame)
920
921 #def test_DumpAndLoad_Tagged_Solution_Rank2(self):
922 #if loadIsConfigured():
923 #filemame=os.path.join(self.filename_base,"tagged_solution_rank2.nc")
924 #d=Data(self.arg2,Solution(self.domain))
925 #d.setTaggedValue(1,self.arg2*2)
926 #d.setTaggedValue(10,self.arg2*3)
927 #d.setTaggedValue(100,self.arg2*4)
928 #self._diffDataObjects(d,filemame)
929
930 #def test_DumpAndLoad_Tagged_Solution_Rank3(self):
931 #if loadIsConfigured():
932 #filemame=os.path.join(self.filename_base,"tagged_solution_rank3.nc")
933 #d=Data(self.arg3,Solution(self.domain))
934 #d.setTaggedValue(1,self.arg3*2)
935 #d.setTaggedValue(10,self.arg3*3)
936 #d.setTaggedValue(100,self.arg3*4)
937 #self._diffDataObjects(d,filemame)
938
939 #def test_DumpAndLoad_Tagged_Solution_Rank4(self):
940 #if loadIsConfigured():
941 #filemame=os.path.join(self.filename_base,"tagged_solution_rank4.nc")
942 #d=Data(self.arg4,Solution(self.domain))
943 #d.setTaggedValue(1,self.arg4*2)
944 #d.setTaggedValue(10,self.arg4*3)
945 #d.setTaggedValue(100,self.arg4*4)
946 #self._diffDataObjects(d,filemame)
947 ##===========================================================================
948 ## This functionspace does not currently support tags.
949 ## Instead, we test that the canTag() function throws in test_canTag_Failures.
950
951 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank0(self):
952 #if loadIsConfigured():
953 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank0.nc")
954 #d=Data(self.arg0,ReducedSolution(self.domain))
955 #d.setTaggedValue(1,self.arg0*2)
956 #d.setTaggedValue(10,self.arg0*3)
957 #d.setTaggedValue(100,self.arg0*4)
958 #self._diffDataObjects(d,filemame)
959
960 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank1(self):
961 #if loadIsConfigured():
962 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank1.nc")
963 #d=Data(self.arg1,ReducedSolution(self.domain))
964 #d.setTaggedValue(1,self.arg1*2)
965 #d.setTaggedValue(10,self.arg1*3)
966 #d.setTaggedValue(100,self.arg1*4)
967 #self._diffDataObjects(d,filemame)
968
969 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank2(self):
970 #if loadIsConfigured():
971 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank2.nc")
972 #d=Data(self.arg2,ReducedSolution(self.domain))
973 #d.setTaggedValue(1,self.arg2*2)
974 #d.setTaggedValue(10,self.arg2*3)
975 #d.setTaggedValue(100,self.arg2*4)
976 #self._diffDataObjects(d,filemame)
977
978 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank3(self):
979 #if loadIsConfigured():
980 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank3.nc")
981 #d=Data(self.arg3,ReducedSolution(self.domain))
982 #d.setTaggedValue(1,self.arg3*2)
983 #d.setTaggedValue(10,self.arg3*3)
984 #d.setTaggedValue(100,self.arg3*4)
985 #self._diffDataObjects(d,filemame)
986
987 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank4(self):
988 #if loadIsConfigured():
989 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank4.nc")
990 #d=Data(self.arg4,ReducedSolution(self.domain))
991 #d.setTaggedValue(1,self.arg4*2)
992 #d.setTaggedValue(10,self.arg4*3)
993 #d.setTaggedValue(100,self.arg4*4)
994 #self._diffDataObjects(d,filemame)
995 ##===========================================================================
996 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank0(self):
997 if loadIsConfigured():
998 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank0.nc")
999 d=Data(self.arg0,ContinuousFunction(self.domain))
1000 d.setTaggedValue(1,self.arg0*2)
1001 d.setTaggedValue(10,self.arg0*3)
1002 d.setTaggedValue(100,self.arg0*4)
1003 self._diffDataObjects(d,filemame)
1004
1005 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank1(self):
1006 if loadIsConfigured():
1007 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank1.nc")
1008 d=Data(self.arg1,ContinuousFunction(self.domain))
1009 d.setTaggedValue(1,self.arg1*2)
1010 d.setTaggedValue(10,self.arg1*3)
1011 d.setTaggedValue(100,self.arg1*4)
1012 self._diffDataObjects(d,filemame)
1013
1014 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank2(self):
1015 if loadIsConfigured():
1016 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank2.nc")
1017 d=Data(self.arg2,ContinuousFunction(self.domain))
1018 d.setTaggedValue(1,self.arg2*2)
1019 d.setTaggedValue(10,self.arg2*3)
1020 d.setTaggedValue(100,self.arg2*4)
1021 self._diffDataObjects(d,filemame)
1022
1023 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank3(self):
1024 if loadIsConfigured():
1025 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank3.nc")
1026 d=Data(self.arg3,ContinuousFunction(self.domain))
1027 d.setTaggedValue(1,self.arg3*2)
1028 d.setTaggedValue(10,self.arg3*3)
1029 d.setTaggedValue(100,self.arg3*4)
1030 self._diffDataObjects(d,filemame)
1031
1032 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank4(self):
1033 if loadIsConfigured():
1034 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank4.nc")
1035 d=Data(self.arg4,ContinuousFunction(self.domain))
1036 d.setTaggedValue(1,self.arg4*2)
1037 d.setTaggedValue(10,self.arg4*3)
1038 d.setTaggedValue(100,self.arg4*4)
1039 self._diffDataObjects(d,filemame)
1040
1041 #===========================================================================
1042 def test_DumpAndLoad_Tagged_Function_Rank0(self):
1043 if loadIsConfigured():
1044 filemame=os.path.join(self.filename_base,"tagged_function_rank0.nc")
1045 d=Data(self.arg0,Function(self.domain))
1046 d.setTaggedValue(1,self.arg0*2)
1047 d.setTaggedValue(10,self.arg0*3)
1048 d.setTaggedValue(100,self.arg0*4)
1049 self._diffDataObjects(d,filemame)
1050
1051 def test_DumpAndLoad_Tagged_Function_Rank1(self):
1052 if loadIsConfigured():
1053 filemame=os.path.join(self.filename_base,"tagged_function_rank1.nc")
1054 d=Data(self.arg1,Function(self.domain))
1055 d.setTaggedValue(1,self.arg1*2)
1056 d.setTaggedValue(10,self.arg1*3)
1057 d.setTaggedValue(100,self.arg1*4)
1058 self._diffDataObjects(d,filemame)
1059
1060 def test_DumpAndLoad_Tagged_Function_Rank2(self):
1061 if loadIsConfigured():
1062 filemame=os.path.join(self.filename_base,"tagged_function_rank2.nc")
1063 d=Data(self.arg2,Function(self.domain))
1064 d.setTaggedValue(1,self.arg2*2)
1065 d.setTaggedValue(10,self.arg2*3)
1066 d.setTaggedValue(100,self.arg2*4)
1067 self._diffDataObjects(d,filemame)
1068
1069 def test_DumpAndLoad_Tagged_Function_Rank3(self):
1070 if loadIsConfigured():
1071 filemame=os.path.join(self.filename_base,"tagged_function_rank3.nc")
1072 d=Data(self.arg3,Function(self.domain))
1073 d.setTaggedValue(1,self.arg3*2)
1074 d.setTaggedValue(10,self.arg3*3)
1075 d.setTaggedValue(100,self.arg3*4)
1076 self._diffDataObjects(d,filemame)
1077
1078 def test_DumpAndLoad_Tagged_Function_Rank4(self):
1079 if loadIsConfigured():
1080 filemame=os.path.join(self.filename_base,"tagged_function_rank4.nc")
1081 d=Data(self.arg4,Function(self.domain))
1082 d.setTaggedValue(1,self.arg4*2)
1083 d.setTaggedValue(10,self.arg4*3)
1084 d.setTaggedValue(100,self.arg4*4)
1085 self._diffDataObjects(d,filemame)
1086
1087 #===========================================================================
1088 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank0(self):
1089 if loadIsConfigured():
1090 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank0.nc")
1091 d=Data(self.arg0,FunctionOnBoundary(self.domain))
1092 d.setTaggedValue(1,self.arg0*2)
1093 d.setTaggedValue(10,self.arg0*3)
1094 d.setTaggedValue(100,self.arg0*4)
1095 self._diffDataObjects(d,filemame)
1096
1097 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank1(self):
1098 if loadIsConfigured():
1099 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank1.nc")
1100 d=Data(self.arg1,FunctionOnBoundary(self.domain))
1101 d.setTaggedValue(1,self.arg1*2)
1102 d.setTaggedValue(10,self.arg1*3)
1103 d.setTaggedValue(100,self.arg1*4)
1104 self._diffDataObjects(d,filemame)
1105
1106 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank2(self):
1107 if loadIsConfigured():
1108 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank2.nc")
1109 d=Data(self.arg2,FunctionOnBoundary(self.domain))
1110 d.setTaggedValue(1,self.arg2*2)
1111 d.setTaggedValue(10,self.arg2*3)
1112 d.setTaggedValue(100,self.arg2*4)
1113 self._diffDataObjects(d,filemame)
1114
1115 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank3(self):
1116 if loadIsConfigured():
1117 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank3.nc")
1118 d=Data(self.arg3,FunctionOnBoundary(self.domain))
1119 d.setTaggedValue(1,self.arg3*2)
1120 d.setTaggedValue(10,self.arg3*3)
1121 d.setTaggedValue(100,self.arg3*4)
1122 self._diffDataObjects(d,filemame)
1123
1124 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank4(self):
1125 if loadIsConfigured():
1126 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank4.nc")
1127 d=Data(self.arg4,FunctionOnBoundary(self.domain))
1128 d.setTaggedValue(1,self.arg4*2)
1129 d.setTaggedValue(10,self.arg4*3)
1130 d.setTaggedValue(100,self.arg4*4)
1131 self._diffDataObjects(d,filemame)
1132 #===========================================================================
1133 def test_DumpAndLoad_Tagged_ReducedFunction_Rank0(self):
1134 if loadIsConfigured():
1135 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank0.nc")
1136 d=Data(self.arg0,ReducedFunction(self.domain))
1137 d.setTaggedValue(1,self.arg0*2)
1138 d.setTaggedValue(10,self.arg0*3)
1139 d.setTaggedValue(100,self.arg0*4)
1140 self._diffDataObjects(d,filemame)
1141
1142 def test_DumpAndLoad_Tagged_ReducedFunction_Rank1(self):
1143 if loadIsConfigured():
1144 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank1.nc")
1145 d=Data(self.arg1,ReducedFunction(self.domain))
1146 d.setTaggedValue(1,self.arg1*2)
1147 d.setTaggedValue(10,self.arg1*3)
1148 d.setTaggedValue(100,self.arg1*4)
1149 self._diffDataObjects(d,filemame)
1150
1151 def test_DumpAndLoad_Tagged_ReducedFunction_Rank2(self):
1152 if loadIsConfigured():
1153 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank2.nc")
1154 d=Data(self.arg2,ReducedFunction(self.domain))
1155 d.setTaggedValue(1,self.arg2*2)
1156 d.setTaggedValue(10,self.arg2*3)
1157 d.setTaggedValue(100,self.arg2*4)
1158 self._diffDataObjects(d,filemame)
1159
1160 def test_DumpAndLoad_Tagged_ReducedFunction_Rank3(self):
1161 if loadIsConfigured():
1162 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank3.nc")
1163 d=Data(self.arg3,ReducedFunction(self.domain))
1164 d.setTaggedValue(1,self.arg3*2)
1165 d.setTaggedValue(10,self.arg3*3)
1166 d.setTaggedValue(100,self.arg3*4)
1167 self._diffDataObjects(d,filemame)
1168
1169 def test_DumpAndLoad_Tagged_ReducedFunction_Rank4(self):
1170 if loadIsConfigured():
1171 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank4.nc")
1172 d=Data(self.arg4,ReducedFunction(self.domain))
1173 d.setTaggedValue(1,self.arg4*2)
1174 d.setTaggedValue(10,self.arg4*3)
1175 d.setTaggedValue(100,self.arg4*4)
1176 self._diffDataObjects(d,filemame)
1177
1178 #===========================================================================
1179 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank0(self):
1180 if loadIsConfigured():
1181 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank0.nc")
1182 d=Data(self.arg0,ReducedFunctionOnBoundary(self.domain))
1183 d.setTaggedValue(1,self.arg0*2)
1184 d.setTaggedValue(10,self.arg0*3)
1185 d.setTaggedValue(100,self.arg0*4)
1186 self._diffDataObjects(d,filemame)
1187
1188 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank1(self):
1189 if loadIsConfigured():
1190 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank1.nc")
1191 d=Data(self.arg1,ReducedFunctionOnBoundary(self.domain))
1192 d.setTaggedValue(1,self.arg1*2)
1193 d.setTaggedValue(10,self.arg1*3)
1194 d.setTaggedValue(100,self.arg1*4)
1195 self._diffDataObjects(d,filemame)
1196
1197 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank2(self):
1198 if loadIsConfigured():
1199 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank2.nc")
1200 d=Data(self.arg2,ReducedFunctionOnBoundary(self.domain))
1201 d.setTaggedValue(1,self.arg2*2)
1202 d.setTaggedValue(10,self.arg2*3)
1203 d.setTaggedValue(100,self.arg2*4)
1204 self._diffDataObjects(d,filemame)
1205
1206 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank3(self):
1207 if loadIsConfigured():
1208 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank3.nc")
1209 d=Data(self.arg3,ReducedFunctionOnBoundary(self.domain))
1210 d.setTaggedValue(1,self.arg3*2)
1211 d.setTaggedValue(10,self.arg3*3)
1212 d.setTaggedValue(100,self.arg3*4)
1213 self._diffDataObjects(d,filemame)
1214
1215 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank4(self):
1216 if loadIsConfigured():
1217 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank4.nc")
1218 d=Data(self.arg4,ReducedFunctionOnBoundary(self.domain))
1219 d.setTaggedValue(1,self.arg4*2)
1220 d.setTaggedValue(10,self.arg4*3)
1221 d.setTaggedValue(100,self.arg4*4)
1222 self._diffDataObjects(d,filemame)
1223
1224 def test_canTag_Failures(self):
1225 d=Data(self.arg0,Solution(self.domain))
1226 self.failUnlessRaises(RuntimeError,d.setTaggedValue,1,self.arg0*2)
1227 d=Data(self.arg0,ReducedSolution(self.domain))
1228 self.failUnlessRaises(RuntimeError,d.setTaggedValue,1,self.arg0*2)

  ViewVC Help
Powered by ViewVC 1.1.26