/[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 1856 - (show annotations)
Tue Oct 7 07:10:47 2008 UTC (10 years, 8 months ago) by gross
File MIME type: text/x-python
File size: 76825 byte(s)
The NC dump tests work now with MPI.
In fact the old test did not exactly what it supposed to


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, use_old_file=False):
366 if not use_old_file: 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 d=Data(length(Solution(self.domain).getX())*self.arg0,Solution(self.domain))
587 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
588 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
589 if getMPISizeWorld() ==1:
590 d=Data(length(Solution(self.domain_with_different_sample_ordering).getX())*self.arg0,Solution(self.domain_with_different_sample_ordering))
591 self._diffDataObjects(d,filemame, use_old_file=True)
592
593 def test_DumpAndLoad_Expanded_Solution_Rank1(self):
594 if loadIsConfigured():
595 filemame=os.path.join(self.filename_base,"expanded_solution_rank1.nc")
596 d=Data(length(Solution(self.domain).getX())*self.arg1,Solution(self.domain))
597 self._diffDataObjects(d,filemame)
598 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
599 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
600 if getMPISizeWorld() ==1:
601 d=Data(length(Solution(self.domain_with_different_sample_ordering).getX())*self.arg1,Solution(self.domain_with_different_sample_ordering))
602 self._diffDataObjects(d,filemame, use_old_file=True)
603
604 def test_DumpAndLoad_Expanded_Solution_Rank2(self):
605 if loadIsConfigured():
606 filemame=os.path.join(self.filename_base,"expanded_solution_rank2.nc")
607 d=Data(length(Solution(self.domain).getX())*self.arg2,Solution(self.domain))
608 self._diffDataObjects(d,filemame)
609 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
610 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
611 if getMPISizeWorld() ==1:
612 d=Data(length(Solution(self.domain_with_different_sample_ordering).getX())*self.arg2,Solution(self.domain_with_different_sample_ordering))
613 self._diffDataObjects(d,filemame, use_old_file=True)
614
615 def test_DumpAndLoad_Expanded_Solution_Rank3(self):
616 if loadIsConfigured():
617 filemame=os.path.join(self.filename_base,"expanded_solution_rank3.nc")
618 d=Data(length(Solution(self.domain).getX())*self.arg3,Solution(self.domain))
619 self._diffDataObjects(d,filemame)
620 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
621 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
622 if getMPISizeWorld() ==1:
623 d=Data(length(Solution(self.domain_with_different_sample_ordering).getX())*self.arg3,Solution(self.domain_with_different_sample_ordering))
624 self._diffDataObjects(d,filemame, use_old_file=True)
625
626 def test_DumpAndLoad_Expanded_Solution_Rank4(self):
627 if loadIsConfigured():
628 filemame=os.path.join(self.filename_base,"expanded_solution_rank4.nc")
629 d=Data(length(Solution(self.domain).getX())*self.arg4,Solution(self.domain))
630 self._diffDataObjects(d,filemame)
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 if getMPISizeWorld() ==1:
634 d=Data(length(Solution(self.domain_with_different_sample_ordering).getX())*self.arg4,Solution(self.domain_with_different_sample_ordering))
635 self._diffDataObjects(d,filemame, use_old_file=True)
636 #===========================================================================
637 def test_DumpAndLoad_Expanded_ReducedSolution_Rank0(self):
638 if loadIsConfigured():
639 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank0.nc")
640 d=Data(length(ReducedSolution(self.domain).getX())*self.arg0,ReducedSolution(self.domain))
641 self._diffDataObjects(d,filemame)
642 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
643 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
644 if getMPISizeWorld() ==1:
645 d=Data(length(ReducedSolution(self.domain_with_different_sample_ordering).getX())*self.arg0,ReducedSolution(self.domain_with_different_sample_ordering))
646 self._diffDataObjects(d,filemame, use_old_file=True)
647
648 def test_DumpAndLoad_Expanded_ReducedSolution_Rank1(self):
649 if loadIsConfigured():
650 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank1.nc")
651 d=Data(length(ReducedSolution(self.domain).getX())*self.arg1,ReducedSolution(self.domain))
652 self._diffDataObjects(d,filemame)
653 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
654 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
655 if getMPISizeWorld() ==1:
656 d=Data(length(ReducedSolution(self.domain_with_different_sample_ordering).getX())*self.arg1,ReducedSolution(self.domain_with_different_sample_ordering))
657 self._diffDataObjects(d,filemame, use_old_file=True)
658
659 def test_DumpAndLoad_Expanded_ReducedSolution_Rank2(self):
660 if loadIsConfigured():
661 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank2.nc")
662 d=Data(length(ReducedSolution(self.domain).getX())*self.arg2,ReducedSolution(self.domain))
663 self._diffDataObjects(d,filemame)
664 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
665 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
666 if getMPISizeWorld() ==1:
667 d=Data(length(ReducedSolution(self.domain_with_different_sample_ordering).getX())*self.arg2,ReducedSolution(self.domain_with_different_sample_ordering))
668 self._diffDataObjects(d,filemame, use_old_file=True)
669
670 def test_DumpAndLoad_Expanded_ReducedSolution_Rank3(self):
671 if loadIsConfigured():
672 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank3.nc")
673 d=Data(length(ReducedSolution(self.domain).getX())*self.arg3,ReducedSolution(self.domain))
674 self._diffDataObjects(d,filemame)
675 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
676 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
677 if getMPISizeWorld() ==1:
678 d=Data(length(ReducedSolution(self.domain_with_different_sample_ordering).getX())*self.arg3,ReducedSolution(self.domain_with_different_sample_ordering))
679 self._diffDataObjects(d,filemame, use_old_file=True)
680
681 def test_DumpAndLoad_Expanded_ReducedSolution_Rank4(self):
682 if loadIsConfigured():
683 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank4.nc")
684 d=Data(length(ReducedSolution(self.domain).getX())*self.arg4,ReducedSolution(self.domain))
685 self._diffDataObjects(d,filemame)
686 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
687 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
688 if getMPISizeWorld() ==1:
689 d=Data(length(ReducedSolution(self.domain_with_different_sample_ordering).getX())*self.arg4,ReducedSolution(self.domain_with_different_sample_ordering))
690 self._diffDataObjects(d,filemame, use_old_file=True)
691 #===========================================================================
692 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank0(self):
693 if loadIsConfigured():
694 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank0.nc")
695 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg0,ContinuousFunction(self.domain))
696 self._diffDataObjects(d,filemame)
697 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
698 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
699 if getMPISizeWorld() ==1:
700 d=Data(length(ContinuousFunction(self.domain_with_different_sample_ordering).getX())*self.arg0,ContinuousFunction(self.domain_with_different_sample_ordering))
701 self._diffDataObjects(d,filemame, use_old_file=True)
702
703 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank1(self):
704 if loadIsConfigured():
705 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank1.nc")
706 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
707 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg1,ContinuousFunction(self.domain))
708 self._diffDataObjects(d,filemame)
709 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
710 if getMPISizeWorld() ==1:
711 d=Data(length(ContinuousFunction(self.domain_with_different_sample_ordering).getX())*self.arg1,ContinuousFunction(self.domain_with_different_sample_ordering))
712 self._diffDataObjects(d,filemame, use_old_file=True)
713
714 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank2(self):
715 if loadIsConfigured():
716 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank2.nc")
717 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg2,ContinuousFunction(self.domain))
718 self._diffDataObjects(d,filemame)
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 if getMPISizeWorld() ==1:
722 d=Data(length(ContinuousFunction(self.domain_with_different_sample_ordering).getX())*self.arg2,ContinuousFunction(self.domain_with_different_sample_ordering))
723 self._diffDataObjects(d,filemame, use_old_file=True)
724
725 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank3(self):
726 if loadIsConfigured():
727 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank3.nc")
728 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg3,ContinuousFunction(self.domain))
729 self._diffDataObjects(d,filemame)
730 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
731 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
732 if getMPISizeWorld() ==1:
733 d=Data(length(ContinuousFunction(self.domain_with_different_sample_ordering).getX())*self.arg3,ContinuousFunction(self.domain_with_different_sample_ordering))
734 self._diffDataObjects(d,filemame, use_old_file=True)
735
736 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank4(self):
737 if loadIsConfigured():
738 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank4.nc")
739 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg4,ContinuousFunction(self.domain))
740 self._diffDataObjects(d,filemame)
741 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
742 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
743 if getMPISizeWorld() ==1:
744 d=Data(length(ContinuousFunction(self.domain_with_different_sample_ordering).getX())*self.arg4,ContinuousFunction(self.domain_with_different_sample_ordering))
745 self._diffDataObjects(d,filemame, use_old_file=True)
746
747 #===========================================================================
748 def test_DumpAndLoad_Expanded_Function_Rank0(self):
749 if loadIsConfigured():
750 filemame=os.path.join(self.filename_base,"expanded_function_rank0.nc")
751 d=Data(length(Function(self.domain).getX())*self.arg0,Function(self.domain))
752 self._diffDataObjects(d,filemame)
753 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
754 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
755 if getMPISizeWorld() ==1:
756 d=Data(length(Function(self.domain_with_different_sample_ordering).getX())*self.arg0,Function(self.domain_with_different_sample_ordering))
757 self._diffDataObjects(d,filemame, use_old_file=True)
758
759 def test_DumpAndLoad_Expanded_Function_Rank1(self):
760 if loadIsConfigured():
761 filemame=os.path.join(self.filename_base,"expanded_function_rank1.nc")
762 d=Data(length(Function(self.domain).getX())*self.arg1,Function(self.domain))
763 self._diffDataObjects(d,filemame)
764 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
765 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
766 if getMPISizeWorld() ==1:
767 d=Data(length(Function(self.domain_with_different_sample_ordering).getX())*self.arg1,Function(self.domain_with_different_sample_ordering))
768 self._diffDataObjects(d,filemame, use_old_file=True)
769
770 def test_DumpAndLoad_Expanded_Function_Rank2(self):
771 if loadIsConfigured():
772 filemame=os.path.join(self.filename_base,"expanded_function_rank2.nc")
773 d=Data(length(Function(self.domain).getX())*self.arg2,Function(self.domain))
774 self._diffDataObjects(d,filemame)
775 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
776 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
777 if getMPISizeWorld() ==1:
778 d=Data(length(Function(self.domain_with_different_sample_ordering).getX())*self.arg2,Function(self.domain_with_different_sample_ordering))
779 self._diffDataObjects(d,filemame, use_old_file=True)
780
781 def test_DumpAndLoad_Expanded_Function_Rank3(self):
782 if loadIsConfigured():
783 filemame=os.path.join(self.filename_base,"expanded_function_rank3.nc")
784 d=Data(length(Function(self.domain).getX())*self.arg3,Function(self.domain))
785 self._diffDataObjects(d,filemame)
786 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
787 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
788 if getMPISizeWorld() ==1:
789 d=Data(length(Function(self.domain_with_different_sample_ordering).getX())*self.arg3,Function(self.domain_with_different_sample_ordering))
790 self._diffDataObjects(d,filemame, use_old_file=True)
791
792 def test_DumpAndLoad_Expanded_Function_Rank4(self):
793 if loadIsConfigured():
794 filemame=os.path.join(self.filename_base,"expanded_function_rank4.nc")
795 d=Data(length(Function(self.domain).getX())*self.arg4,Function(self.domain))
796 self._diffDataObjects(d,filemame)
797 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
798 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
799 if getMPISizeWorld() ==1:
800 d=Data(length(Function(self.domain_with_different_sample_ordering).getX())*self.arg4,Function(self.domain_with_different_sample_ordering))
801 self._diffDataObjects(d,filemame, use_old_file=True)
802
803 #===========================================================================
804 def test_DumpAndLoad_Expanded_ReducedFunction_Rank0(self):
805 if loadIsConfigured():
806 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank0.nc")
807 d=Data(length(ReducedFunction(self.domain).getX())*self.arg0,ReducedFunction(self.domain))
808 self._diffDataObjects(d,filemame)
809 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
810 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
811 if getMPISizeWorld() ==1:
812 d=Data(length(ReducedFunction(self.domain_with_different_sample_ordering).getX())*self.arg0,ReducedFunction(self.domain_with_different_sample_ordering))
813 self._diffDataObjects(d,filemame, use_old_file=True)
814
815 def test_DumpAndLoad_Expanded_ReducedFunction_Rank1(self):
816 if loadIsConfigured():
817 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank1.nc")
818 d=Data(length(ReducedFunction(self.domain).getX())*self.arg1,ReducedFunction(self.domain))
819 self._diffDataObjects(d,filemame)
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 if getMPISizeWorld() ==1:
823 d=Data(length(ReducedFunction(self.domain_with_different_sample_ordering).getX())*self.arg1,ReducedFunction(self.domain_with_different_sample_ordering))
824 self._diffDataObjects(d,filemame, use_old_file=True)
825
826 def test_DumpAndLoad_Expanded_ReducedFunction_Rank2(self):
827 if loadIsConfigured():
828 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank2.nc")
829 d=Data(length(ReducedFunction(self.domain).getX())*self.arg2,ReducedFunction(self.domain))
830 self._diffDataObjects(d,filemame)
831 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
832 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
833 if getMPISizeWorld() ==1:
834 d=Data(length(ReducedFunction(self.domain_with_different_sample_ordering).getX())*self.arg2,ReducedFunction(self.domain_with_different_sample_ordering))
835 self._diffDataObjects(d,filemame, use_old_file=True)
836
837 def test_DumpAndLoad_Expanded_ReducedFunction_Rank3(self):
838 if loadIsConfigured():
839 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank3.nc")
840 d=Data(length(ReducedFunction(self.domain).getX())*self.arg3,ReducedFunction(self.domain))
841 self._diffDataObjects(d,filemame)
842 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
843 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
844 if getMPISizeWorld() ==1:
845 d=Data(length(ReducedFunction(self.domain_with_different_sample_ordering).getX())*self.arg3,ReducedFunction(self.domain_with_different_sample_ordering))
846 self._diffDataObjects(d,filemame, use_old_file=True)
847
848 def test_DumpAndLoad_Expanded_ReducedFunction_Rank4(self):
849 if loadIsConfigured():
850 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank4.nc")
851 d=Data(length(ReducedFunction(self.domain).getX())*self.arg4,ReducedFunction(self.domain))
852 self._diffDataObjects(d,filemame)
853 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
854 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
855 if getMPISizeWorld() ==1:
856 d=Data(length(ReducedFunction(self.domain_with_different_sample_ordering).getX())*self.arg4,ReducedFunction(self.domain_with_different_sample_ordering))
857 self._diffDataObjects(d,filemame, use_old_file=True)
858
859 #===========================================================================
860 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank0(self):
861 if loadIsConfigured():
862 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank0.nc")
863 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg0,FunctionOnBoundary(self.domain))
864 self._diffDataObjects(d,filemame)
865 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
866 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
867 if getMPISizeWorld() ==1:
868 d=Data(length(FunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg0,FunctionOnBoundary(self.domain_with_different_sample_ordering))
869 self._diffDataObjects(d,filemame, use_old_file=True)
870
871 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank1(self):
872 if loadIsConfigured():
873 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank1.nc")
874 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg1,FunctionOnBoundary(self.domain))
875 self._diffDataObjects(d,filemame)
876 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
877 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
878 if getMPISizeWorld() ==1:
879 d=Data(length(FunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg1,FunctionOnBoundary(self.domain_with_different_sample_ordering))
880 self._diffDataObjects(d,filemame, use_old_file=True)
881
882 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank2(self):
883 if loadIsConfigured():
884 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank2.nc")
885 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg2,FunctionOnBoundary(self.domain))
886 self._diffDataObjects(d,filemame)
887 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
888 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
889 if getMPISizeWorld() ==1:
890 d=Data(length(FunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg2,FunctionOnBoundary(self.domain_with_different_sample_ordering))
891 self._diffDataObjects(d,filemame, use_old_file=True)
892
893 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank3(self):
894 if loadIsConfigured():
895 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank3.nc")
896 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg3,FunctionOnBoundary(self.domain))
897 self._diffDataObjects(d,filemame)
898 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
899 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
900 if getMPISizeWorld() ==1:
901 d=Data(length(FunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg3,FunctionOnBoundary(self.domain_with_different_sample_ordering))
902 self._diffDataObjects(d,filemame, use_old_file=True)
903
904 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank4(self):
905 if loadIsConfigured():
906 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank4.nc")
907 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg4,FunctionOnBoundary(self.domain))
908 self._diffDataObjects(d,filemame)
909 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
910 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
911 if getMPISizeWorld() ==1:
912 d=Data(length(FunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg4,FunctionOnBoundary(self.domain_with_different_sample_ordering))
913 self._diffDataObjects(d,filemame, use_old_file=True)
914
915 #===========================================================================
916 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank0(self):
917 if loadIsConfigured():
918 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank0.nc")
919 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg0,ReducedFunctionOnBoundary(self.domain))
920 self._diffDataObjects(d,filemame)
921 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
922 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
923 if getMPISizeWorld() ==1:
924 d=Data(length(ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg0,ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering))
925 self._diffDataObjects(d,filemame, use_old_file=True)
926
927 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank1(self):
928 if loadIsConfigured():
929 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank1.nc")
930 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg1,ReducedFunctionOnBoundary(self.domain))
931 self._diffDataObjects(d,filemame)
932 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
933 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
934 if getMPISizeWorld() ==1:
935 d=Data(length(ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg1,ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering))
936 self._diffDataObjects(d,filemame, use_old_file=True)
937
938 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank2(self):
939 if loadIsConfigured():
940 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank2.nc")
941 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg2,ReducedFunctionOnBoundary(self.domain))
942 self._diffDataObjects(d,filemame)
943 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
944 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
945 if getMPISizeWorld() ==1:
946 d=Data(length(ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg2,ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering))
947 self._diffDataObjects(d,filemame, use_old_file=True)
948
949 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank3(self):
950 if loadIsConfigured():
951 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank3.nc")
952 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg3,ReducedFunctionOnBoundary(self.domain))
953 self._diffDataObjects(d,filemame)
954 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
955 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
956 if getMPISizeWorld() ==1:
957 d=Data(length(ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg3,ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering))
958 self._diffDataObjects(d,filemame, use_old_file=True)
959
960 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank4(self):
961 if loadIsConfigured():
962 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank4.nc")
963 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg4,ReducedFunctionOnBoundary(self.domain))
964 self._diffDataObjects(d,filemame)
965 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
966 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
967 if getMPISizeWorld() ==1:
968 d=Data(length(ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg4,ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering))
969 self._diffDataObjects(d,filemame, use_old_file=True)
970
971 #===========================================================================
972 ## This functionspace does not currently support tags.
973 ## Instead, we test that the canTag() function throws in test_canTag_Failures.
974
975 #def test_DumpAndLoad_Tagged_Solution_Rank0(self):
976 #if loadIsConfigured():
977 #filemame=os.path.join(self.filename_base,"tagged_solution_rank0.nc")
978 #d=Data(self.arg0,Solution(self.domain))
979 #d.setTaggedValue(1,self.arg0*2)
980 #d.setTaggedValue(10,self.arg0*3)
981 #d.setTaggedValue(100,self.arg0*4)
982 #self._diffDataObjects(d,filemame)
983
984 #def test_DumpAndLoad_Tagged_Solution_Rank1(self):
985 #if loadIsConfigured():
986 #filemame=os.path.join(self.filename_base,"tagged_solution_rank1.nc")
987 #d=Data(self.arg1,Solution(self.domain))
988 #d.setTaggedValue(1,self.arg1*2)
989 #d.setTaggedValue(10,self.arg1*3)
990 #d.setTaggedValue(100,self.arg1*4)
991 #self._diffDataObjects(d,filemame)
992
993 #def test_DumpAndLoad_Tagged_Solution_Rank2(self):
994 #if loadIsConfigured():
995 #filemame=os.path.join(self.filename_base,"tagged_solution_rank2.nc")
996 #d=Data(self.arg2,Solution(self.domain))
997 #d.setTaggedValue(1,self.arg2*2)
998 #d.setTaggedValue(10,self.arg2*3)
999 #d.setTaggedValue(100,self.arg2*4)
1000 #self._diffDataObjects(d,filemame)
1001
1002 #def test_DumpAndLoad_Tagged_Solution_Rank3(self):
1003 #if loadIsConfigured():
1004 #filemame=os.path.join(self.filename_base,"tagged_solution_rank3.nc")
1005 #d=Data(self.arg3,Solution(self.domain))
1006 #d.setTaggedValue(1,self.arg3*2)
1007 #d.setTaggedValue(10,self.arg3*3)
1008 #d.setTaggedValue(100,self.arg3*4)
1009 #self._diffDataObjects(d,filemame)
1010
1011 #def test_DumpAndLoad_Tagged_Solution_Rank4(self):
1012 #if loadIsConfigured():
1013 #filemame=os.path.join(self.filename_base,"tagged_solution_rank4.nc")
1014 #d=Data(self.arg4,Solution(self.domain))
1015 #d.setTaggedValue(1,self.arg4*2)
1016 #d.setTaggedValue(10,self.arg4*3)
1017 #d.setTaggedValue(100,self.arg4*4)
1018 #self._diffDataObjects(d,filemame)
1019 ##===========================================================================
1020 ## This functionspace does not currently support tags.
1021 ## Instead, we test that the canTag() function throws in test_canTag_Failures.
1022
1023 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank0(self):
1024 #if loadIsConfigured():
1025 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank0.nc")
1026 #d=Data(self.arg0,ReducedSolution(self.domain))
1027 #d.setTaggedValue(1,self.arg0*2)
1028 #d.setTaggedValue(10,self.arg0*3)
1029 #d.setTaggedValue(100,self.arg0*4)
1030 #self._diffDataObjects(d,filemame)
1031
1032 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank1(self):
1033 #if loadIsConfigured():
1034 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank1.nc")
1035 #d=Data(self.arg1,ReducedSolution(self.domain))
1036 #d.setTaggedValue(1,self.arg1*2)
1037 #d.setTaggedValue(10,self.arg1*3)
1038 #d.setTaggedValue(100,self.arg1*4)
1039 #self._diffDataObjects(d,filemame)
1040
1041 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank2(self):
1042 #if loadIsConfigured():
1043 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank2.nc")
1044 #d=Data(self.arg2,ReducedSolution(self.domain))
1045 #d.setTaggedValue(1,self.arg2*2)
1046 #d.setTaggedValue(10,self.arg2*3)
1047 #d.setTaggedValue(100,self.arg2*4)
1048 #self._diffDataObjects(d,filemame)
1049
1050 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank3(self):
1051 #if loadIsConfigured():
1052 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank3.nc")
1053 #d=Data(self.arg3,ReducedSolution(self.domain))
1054 #d.setTaggedValue(1,self.arg3*2)
1055 #d.setTaggedValue(10,self.arg3*3)
1056 #d.setTaggedValue(100,self.arg3*4)
1057 #self._diffDataObjects(d,filemame)
1058
1059 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank4(self):
1060 #if loadIsConfigured():
1061 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank4.nc")
1062 #d=Data(self.arg4,ReducedSolution(self.domain))
1063 #d.setTaggedValue(1,self.arg4*2)
1064 #d.setTaggedValue(10,self.arg4*3)
1065 #d.setTaggedValue(100,self.arg4*4)
1066 #self._diffDataObjects(d,filemame)
1067 ##===========================================================================
1068 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank0(self):
1069 if loadIsConfigured():
1070 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank0.nc")
1071 d=Data(self.arg0,ContinuousFunction(self.domain))
1072 d.setTaggedValue(1,self.arg0*2)
1073 d.setTaggedValue(10,self.arg0*3)
1074 d.setTaggedValue(100,self.arg0*4)
1075 self._diffDataObjects(d,filemame)
1076
1077 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank1(self):
1078 if loadIsConfigured():
1079 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank1.nc")
1080 d=Data(self.arg1,ContinuousFunction(self.domain))
1081 d.setTaggedValue(1,self.arg1*2)
1082 d.setTaggedValue(10,self.arg1*3)
1083 d.setTaggedValue(100,self.arg1*4)
1084 self._diffDataObjects(d,filemame)
1085
1086 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank2(self):
1087 if loadIsConfigured():
1088 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank2.nc")
1089 d=Data(self.arg2,ContinuousFunction(self.domain))
1090 d.setTaggedValue(1,self.arg2*2)
1091 d.setTaggedValue(10,self.arg2*3)
1092 d.setTaggedValue(100,self.arg2*4)
1093 self._diffDataObjects(d,filemame)
1094
1095 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank3(self):
1096 if loadIsConfigured():
1097 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank3.nc")
1098 d=Data(self.arg3,ContinuousFunction(self.domain))
1099 d.setTaggedValue(1,self.arg3*2)
1100 d.setTaggedValue(10,self.arg3*3)
1101 d.setTaggedValue(100,self.arg3*4)
1102 self._diffDataObjects(d,filemame)
1103
1104 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank4(self):
1105 if loadIsConfigured():
1106 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank4.nc")
1107 d=Data(self.arg4,ContinuousFunction(self.domain))
1108 d.setTaggedValue(1,self.arg4*2)
1109 d.setTaggedValue(10,self.arg4*3)
1110 d.setTaggedValue(100,self.arg4*4)
1111 self._diffDataObjects(d,filemame)
1112
1113 #===========================================================================
1114 def test_DumpAndLoad_Tagged_Function_Rank0(self):
1115 if loadIsConfigured():
1116 filemame=os.path.join(self.filename_base,"tagged_function_rank0.nc")
1117 d=Data(self.arg0,Function(self.domain))
1118 d.setTaggedValue(1,self.arg0*2)
1119 d.setTaggedValue(10,self.arg0*3)
1120 d.setTaggedValue(100,self.arg0*4)
1121 self._diffDataObjects(d,filemame)
1122
1123 def test_DumpAndLoad_Tagged_Function_Rank1(self):
1124 if loadIsConfigured():
1125 filemame=os.path.join(self.filename_base,"tagged_function_rank1.nc")
1126 d=Data(self.arg1,Function(self.domain))
1127 d.setTaggedValue(1,self.arg1*2)
1128 d.setTaggedValue(10,self.arg1*3)
1129 d.setTaggedValue(100,self.arg1*4)
1130 self._diffDataObjects(d,filemame)
1131
1132 def test_DumpAndLoad_Tagged_Function_Rank2(self):
1133 if loadIsConfigured():
1134 filemame=os.path.join(self.filename_base,"tagged_function_rank2.nc")
1135 d=Data(self.arg2,Function(self.domain))
1136 d.setTaggedValue(1,self.arg2*2)
1137 d.setTaggedValue(10,self.arg2*3)
1138 d.setTaggedValue(100,self.arg2*4)
1139 self._diffDataObjects(d,filemame)
1140
1141 def test_DumpAndLoad_Tagged_Function_Rank3(self):
1142 if loadIsConfigured():
1143 filemame=os.path.join(self.filename_base,"tagged_function_rank3.nc")
1144 d=Data(self.arg3,Function(self.domain))
1145 d.setTaggedValue(1,self.arg3*2)
1146 d.setTaggedValue(10,self.arg3*3)
1147 d.setTaggedValue(100,self.arg3*4)
1148 self._diffDataObjects(d,filemame)
1149
1150 def test_DumpAndLoad_Tagged_Function_Rank4(self):
1151 if loadIsConfigured():
1152 filemame=os.path.join(self.filename_base,"tagged_function_rank4.nc")
1153 d=Data(self.arg4,Function(self.domain))
1154 d.setTaggedValue(1,self.arg4*2)
1155 d.setTaggedValue(10,self.arg4*3)
1156 d.setTaggedValue(100,self.arg4*4)
1157 self._diffDataObjects(d,filemame)
1158
1159 #===========================================================================
1160 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank0(self):
1161 if loadIsConfigured():
1162 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank0.nc")
1163 d=Data(self.arg0,FunctionOnBoundary(self.domain))
1164 d.setTaggedValue(1,self.arg0*2)
1165 d.setTaggedValue(10,self.arg0*3)
1166 d.setTaggedValue(100,self.arg0*4)
1167 self._diffDataObjects(d,filemame)
1168
1169 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank1(self):
1170 if loadIsConfigured():
1171 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank1.nc")
1172 d=Data(self.arg1,FunctionOnBoundary(self.domain))
1173 d.setTaggedValue(1,self.arg1*2)
1174 d.setTaggedValue(10,self.arg1*3)
1175 d.setTaggedValue(100,self.arg1*4)
1176 self._diffDataObjects(d,filemame)
1177
1178 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank2(self):
1179 if loadIsConfigured():
1180 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank2.nc")
1181 d=Data(self.arg2,FunctionOnBoundary(self.domain))
1182 d.setTaggedValue(1,self.arg2*2)
1183 d.setTaggedValue(10,self.arg2*3)
1184 d.setTaggedValue(100,self.arg2*4)
1185 self._diffDataObjects(d,filemame)
1186
1187 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank3(self):
1188 if loadIsConfigured():
1189 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank3.nc")
1190 d=Data(self.arg3,FunctionOnBoundary(self.domain))
1191 d.setTaggedValue(1,self.arg3*2)
1192 d.setTaggedValue(10,self.arg3*3)
1193 d.setTaggedValue(100,self.arg3*4)
1194 self._diffDataObjects(d,filemame)
1195
1196 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank4(self):
1197 if loadIsConfigured():
1198 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank4.nc")
1199 d=Data(self.arg4,FunctionOnBoundary(self.domain))
1200 d.setTaggedValue(1,self.arg4*2)
1201 d.setTaggedValue(10,self.arg4*3)
1202 d.setTaggedValue(100,self.arg4*4)
1203 self._diffDataObjects(d,filemame)
1204 #===========================================================================
1205 def test_DumpAndLoad_Tagged_ReducedFunction_Rank0(self):
1206 if loadIsConfigured():
1207 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank0.nc")
1208 d=Data(self.arg0,ReducedFunction(self.domain))
1209 d.setTaggedValue(1,self.arg0*2)
1210 d.setTaggedValue(10,self.arg0*3)
1211 d.setTaggedValue(100,self.arg0*4)
1212 self._diffDataObjects(d,filemame)
1213
1214 def test_DumpAndLoad_Tagged_ReducedFunction_Rank1(self):
1215 if loadIsConfigured():
1216 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank1.nc")
1217 d=Data(self.arg1,ReducedFunction(self.domain))
1218 d.setTaggedValue(1,self.arg1*2)
1219 d.setTaggedValue(10,self.arg1*3)
1220 d.setTaggedValue(100,self.arg1*4)
1221 self._diffDataObjects(d,filemame)
1222
1223 def test_DumpAndLoad_Tagged_ReducedFunction_Rank2(self):
1224 if loadIsConfigured():
1225 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank2.nc")
1226 d=Data(self.arg2,ReducedFunction(self.domain))
1227 d.setTaggedValue(1,self.arg2*2)
1228 d.setTaggedValue(10,self.arg2*3)
1229 d.setTaggedValue(100,self.arg2*4)
1230 self._diffDataObjects(d,filemame)
1231
1232 def test_DumpAndLoad_Tagged_ReducedFunction_Rank3(self):
1233 if loadIsConfigured():
1234 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank3.nc")
1235 d=Data(self.arg3,ReducedFunction(self.domain))
1236 d.setTaggedValue(1,self.arg3*2)
1237 d.setTaggedValue(10,self.arg3*3)
1238 d.setTaggedValue(100,self.arg3*4)
1239 self._diffDataObjects(d,filemame)
1240
1241 def test_DumpAndLoad_Tagged_ReducedFunction_Rank4(self):
1242 if loadIsConfigured():
1243 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank4.nc")
1244 d=Data(self.arg4,ReducedFunction(self.domain))
1245 d.setTaggedValue(1,self.arg4*2)
1246 d.setTaggedValue(10,self.arg4*3)
1247 d.setTaggedValue(100,self.arg4*4)
1248 self._diffDataObjects(d,filemame)
1249
1250 #===========================================================================
1251 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank0(self):
1252 if loadIsConfigured():
1253 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank0.nc")
1254 d=Data(self.arg0,ReducedFunctionOnBoundary(self.domain))
1255 d.setTaggedValue(1,self.arg0*2)
1256 d.setTaggedValue(10,self.arg0*3)
1257 d.setTaggedValue(100,self.arg0*4)
1258 self._diffDataObjects(d,filemame)
1259
1260 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank1(self):
1261 if loadIsConfigured():
1262 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank1.nc")
1263 d=Data(self.arg1,ReducedFunctionOnBoundary(self.domain))
1264 d.setTaggedValue(1,self.arg1*2)
1265 d.setTaggedValue(10,self.arg1*3)
1266 d.setTaggedValue(100,self.arg1*4)
1267 self._diffDataObjects(d,filemame)
1268
1269 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank2(self):
1270 if loadIsConfigured():
1271 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank2.nc")
1272 d=Data(self.arg2,ReducedFunctionOnBoundary(self.domain))
1273 d.setTaggedValue(1,self.arg2*2)
1274 d.setTaggedValue(10,self.arg2*3)
1275 d.setTaggedValue(100,self.arg2*4)
1276 self._diffDataObjects(d,filemame)
1277
1278 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank3(self):
1279 if loadIsConfigured():
1280 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank3.nc")
1281 d=Data(self.arg3,ReducedFunctionOnBoundary(self.domain))
1282 d.setTaggedValue(1,self.arg3*2)
1283 d.setTaggedValue(10,self.arg3*3)
1284 d.setTaggedValue(100,self.arg3*4)
1285 self._diffDataObjects(d,filemame)
1286
1287 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank4(self):
1288 if loadIsConfigured():
1289 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank4.nc")
1290 d=Data(self.arg4,ReducedFunctionOnBoundary(self.domain))
1291 d.setTaggedValue(1,self.arg4*2)
1292 d.setTaggedValue(10,self.arg4*3)
1293 d.setTaggedValue(100,self.arg4*4)
1294 self._diffDataObjects(d,filemame)
1295
1296 def test_canTag_Failures(self):
1297 d=Data(self.arg0,Solution(self.domain))
1298 self.failUnlessRaises(RuntimeError,d.setTaggedValue,1,self.arg0*2)
1299 d=Data(self.arg0,ReducedSolution(self.domain))
1300 self.failUnlessRaises(RuntimeError,d.setTaggedValue,1,self.arg0*2)

  ViewVC Help
Powered by ViewVC 1.1.26