/[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 3259 - (show annotations)
Mon Oct 11 01:48:14 2010 UTC (8 years, 10 months ago) by jfenwick
File MIME type: text/x-python
File size: 85580 byte(s)
Merging dudley and scons updates from branches

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2010 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-2010 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="https://launchpad.net/escript-finley"
21
22 """
23 Test suite for 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.dudley import Brick
29 class Test_DumpOnDudley(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_DumpOnDudley))
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 numpy
54 from esys.escript import *
55
56
57 class Test_TableInterpolation(unittest.TestCase):
58 RES_TOL=1.e-7 # RES_TOLerance to compare results
59
60
61 def test_NullFunctionSpace(self):
62 arL=[[0, -1, -2, -3, -4], [1, 1, -2, -3, -4], [2, 2, 2, -3, -4], [3, 3, 3, 3, -4], [4, 4, 4, 4, 4]]
63 arn=numpy.array(arL)
64 ars=[arL,arn]
65 d0=Data(0)
66 d1=Data(1)
67 d2=Data(2)
68 d35=Data(3.5)
69 d4=Data(4)
70 dm05=Data(-0.5)
71 d175=Data(1.75)
72 d225=Data(2.25)
73 for arr in ars:
74 self.failUnless(Lsup(d1.interpolateTable(arL,0, 1, d2, 0, 1, 100)+2)<self.RES_TOL)
75 self.failUnless(Lsup(d1.interpolateTable(arL,0, 1, d35, 0, 1, 100)+3.5)<self.RES_TOL)
76 self.failUnless(Lsup(d35.interpolateTable(arL,0,1, d2, 0, 1, 100)-3.5)<self.RES_TOL)
77 self.failUnless(Lsup(d175.interpolateTable(arL,0,1,d225,0,1, 100)-0)<self.RES_TOL)
78 # Point out of bounds
79 self.failUnlessRaises(RuntimeError, d1.interpolateTable,arL,0, 1, d4, 0, 0.5, 100, check_boundaries=True )
80 self.failUnlessRaises(RuntimeError, d4.interpolateTable, arL,0, 0.5, d1, 0, 1, 100, check_boundaries=True )
81 self.failUnlessRaises(RuntimeError, dm05.interpolateTable, arL,0,1, d1 , 0,1, 100, check_boundaries=True )
82 self.failUnlessRaises(RuntimeError, d1.interpolateTable, arL,0,1, dm05 , 0,1, 100,check_boundaries=True )
83 #Test to ensure not check_boundaries does not throw in the above cases
84 d1.interpolateTable(arL,0, 1, d4, 0, 0.5, 100, check_boundaries=False)
85 d4.interpolateTable( arL,0, 0.5, d1, 0, 1, 100, check_boundaries=False )
86 dm05.interpolateTable( arL,0,1, d1 , 0,1, 100, check_boundaries=False )
87 d1.interpolateTable( arL,0,1, dm05 , 0,1, 100,check_boundaries=False )
88
89 # interpolated value too large
90 self.failUnlessRaises(RuntimeError, d2.interpolateTable, arL, 0, 1, d2, 0, 1, 1 )
91
92
93 def test_FunctionSpace2D(self):
94 vs=[(1,3,5,7), (-1,1,-1,1), (0.5, 17, 0.25, 42)] #There is no particular significance to these numbers
95 for fs in self.functionspaces:
96 points=fs.getX()
97 for t in vs:
98 v0, v1, v2, v3 =t
99 x=points[0]
100 y=points[1]
101 xmax=sup(x)
102 xmin=inf(x)
103 ymax=sup(y)
104 ymin=inf(y)
105 xwidth=(xmax-xmin)/(self.xn-1)
106 ywidth=(ymax-ymin)/(self.yn-1)
107 table=[]
108 for j in xrange(self.yn):
109 row=[]
110 for i in xrange(self.xn):
111 row.append(v0+v1*xwidth*i+v2*ywidth*j+v3*i*j*xwidth*ywidth)
112 table.append(row)
113 ref=v0+v1*(x-xmin)+v2*(y-ymin)+v3*(x-xmin)*(y-ymin)
114 lsupref=Lsup(ref)
115 if lsupref!=0 and xwidth>0: #This will happen in cases where there are no samples on this rank
116 res=y.interpolateTable(table,ymin,ywidth,x, xmin, xwidth,500)
117 self.failUnless(Lsup(res-ref)/Lsup(ref)<self.RES_TOL,"Failed for %s"%str(fs))
118
119
120 def test_FunctionSpace1D(self):
121 vs=[(1,3), (-1,1), (0.5, 17)] #There is no particular significance to these numbers
122 for fs in self.functionspaces:
123 points=fs.getX()
124 for t in vs:
125 v0, v1 =t
126 x=points[0]
127 xmax=sup(x)
128 xmin=inf(x)
129 xwidth=(xmax-xmin)/(self.xn-1)
130 table=[]
131 for i in xrange(self.xn):
132 table.append(v0+v1*xwidth*i)
133 ref=v0+v1*(x-xmin)
134 lsupref=Lsup(ref)
135 if lsupref!=0 and xwidth>0: #This will happen in cases where there are no samples on this rank
136 res=x.interpolateTable(table, xmin, xwidth,500)
137 self.failUnless(Lsup(res-ref)/lsupref<self.RES_TOL,"Failed for %s"%str(fs))
138
139 class Test_saveCSV(unittest.TestCase):
140
141 def test_save1(self):
142 X=self.domain.getX()
143 X0=X[0]
144 fname="test_save1.csv"
145 saveDataCSV(fname,C=X, D=X0)
146 saveDataCSV(fname,append=True, J=X0, H=X)
147 self.failUnless(os.path.exists(fname), "test file not created")
148 f=open(fname,'r')
149 line=f.readline()
150 self.failUnless(line=="C_0, C_1, D\n") #This tests both separator strings
151 #Now we find out how many rows it has
152 linecount=0
153 while line != '':
154 linecount+=1
155 line=f.readline()
156 self.failUnless(linecount==self.linecount1*2)
157 f.close()
158 #Now to other output
159 T2=Tensor(7,X.getFunctionSpace())
160 T3=Tensor3(8,X.getFunctionSpace())
161 T4=Tensor4(9,X.getFunctionSpace())
162 saveDataCSV(fname,A=T2,B=T3,C=T4)
163 f=open(fname,'r')
164 line=f.readline()
165 self.failUnless(line=='A_0_0, A_1_0, A_0_1, A_1_1, B_0_0_0, B_0_0_1, B_1_0_0, B_1_0_1, B_0_1_0, B_0_1_1, B_1_1_0, B_1_1_1, C_0_0_0_0, C_0_0_0_1, C_0_0_1_0, C_0_0_1_1, C_1_0_0_0, C_1_0_0_1, C_1_0_1_0, C_1_0_1_1, C_0_1_0_0, C_0_1_0_1, C_0_1_1_0, C_0_1_1_1, C_1_1_0_0, C_1_1_0_1, C_1_1_1_0, C_1_1_1_1\n')
166 line=f.readline()
167 line_expected=[7.]*4+[8.]*8+[9.]*16
168 line_got=[float(elt) for elt in line.split(',')]
169 self.failUnless(line_got==line_expected)
170 linecount=1
171 while line != '':
172 linecount+=1
173 line=f.readline()
174 self.failUnless(linecount==self.linecount1)
175 f.close()
176 #Now to test separators and mask
177 saveDataCSV(fname, sep="|",csep="/", U=X, V=X0, mask=X0)
178 f=open(fname,'r')
179 line=f.readline()
180 self.failUnless(line=='U/0|U/1|V\n')
181 line=f.readline()
182 line_got=[float(elt) for elt in line.split('|')]
183 self.failUnless(self.line_expected==line_got)
184 linecount=1
185 while line!='':
186 linecount+=1
187 line=f.readline()
188 self.failUnless(linecount==self.linecount2)
189
190
191 class Test_Domain(unittest.TestCase):
192
193 def test_getListOfTags(self): # requires self.boundary_tag_list
194 tags=FunctionOnBoundary(self.domain).getListOfTags()
195 self.failUnless(len(self.boundary_tag_list) == len(tags), "tag list length does not match")
196 for i in self.boundary_tag_list:
197 self.failUnless(i in tags, "tag %s is missing."%i)
198
199 def test_Factories(self):
200 fs=Function(self.domain) # The choice of functionspace is arbitrary
201 dime=self.domain.getDim()
202 if dime>0:
203 z=[]
204 bad=[]
205 for i in range(dime):
206 z+=[i]
207 bad+=[i]
208 bad+=[i]
209 d=Vector(z,fs)
210 self.failUnless(d.getShape()==(dime,))
211 self.failUnlessRaises(RuntimeError, Vector, bad,fs) #test wrong shape
212 y=[]
213 bad=[]
214 for i in range(dime):
215 y+=[z]
216 bad+=[z]
217 bad+=[z]
218 z=y
219 d=Tensor(z,fs)
220 self.failUnless(d.getShape()==(dime,dime))
221 try:
222 Tensor(bad,fs)
223 except RuntimeError:
224 pass
225 else:
226 self.fail("Tensor should have rejected bad shape")
227 y=[]
228 bad=[]
229 for i in range(dime):
230 y+=[z]
231 bad+=[z]
232 bad+=[z]
233 z=y
234 d=Tensor3(z,fs)
235 self.failUnless(d.getShape()==(dime,dime,dime))
236 try:
237 Tensor3(bad,fs)
238 except RuntimeError:
239 pass
240 else:
241 self.fail("Tensor3 should have rejected bad shape")
242 y=[]
243 bad=[]
244 for i in range(dime):
245 y+=[z]
246 bad+=[z]
247 bad+=[z]
248 z=y
249 d=Tensor4(z,fs)
250 self.failUnless(d.getShape()==(dime,dime,dime,dime))
251 try:
252 Tensor4(bad,fs)
253 except RuntimeError:
254 pass
255 else:
256 self.fail("Tensor4 should have rejected bad shape")
257
258
259 def test_addTags(self):
260 tag1="A"
261 tag2="B"
262 tag3="C"
263 self.domain.setTagMap(tag1,1)
264 self.failUnless(self.domain.isValidTagName(tag1))
265 self.failUnless(not self.domain.isValidTagName(tag2))
266 self.domain.setTagMap(tag2,2)
267 self.failUnless(self.domain.isValidTagName(tag1))
268 self.failUnless(self.domain.isValidTagName(tag2))
269 self.failUnless(not self.domain.isValidTagName(tag3))
270 self.failUnless(self.domain.getTag(tag1)==1)
271 self.failUnless(self.domain.getTag(tag2)==2)
272 self.failUnlessRaises(RuntimeError,self.domain.getTag,tag3)
273
274 # set tag:
275 s=Scalar(0,Function(self.domain))
276 r=Scalar(0,Function(self.domain))
277 s.setTaggedValue(tag1,1.)
278 r.setTaggedValue(1,1.)
279 s.setTaggedValue(tag2,2.)
280 r.setTaggedValue(2,2.)
281 self.failUnlessRaises(RuntimeError,s.setTaggedValue,tag3,3.) #tag3 does not exist
282 self.failUnless(Lsup(s-r)<=0.)
283 # get tag:
284 names=getTagNames(self.domain)
285 self.failUnless(len(names) == 6)
286 self.failUnless( tag1 in names )
287 self.failUnless( tag2 in names )
288 self.failUnless(self.domain.isValidTagName(tag1))
289 self.failUnless(self.domain.isValidTagName(tag2))
290 # insert tag shortcut:
291 s2=insertTaggedValues(Scalar(0,Function(self.domain)),**{ tag1 : 1., tag2 : 2.})
292 self.failUnless(Lsup(s2-r)<=0.)
293 def test_functionspace_ContinuousFunction(self):
294 fs=ContinuousFunction(self.domain)
295 self.failUnless(fs.getDomain()==self.domain)
296 self.failUnless(self.domain.getDim() == fs.getDim())
297 x=fs.getX()
298 self.failUnless(x.getFunctionSpace() == fs)
299 self.failUnless(x.getShape() == (fs.getDim(),))
300 self.failUnless(inf(x[0])>=0.)
301 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
302 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
303 self.failUnless(sup(x[0])<=1.)
304 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
305 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
306
307 def test_functionspace_Solution(self):
308 fs=Solution(self.domain)
309 self.failUnless(fs.getDomain()==self.domain)
310 self.failUnless(self.domain.getDim() == fs.getDim())
311 x=fs.getX()
312 self.failUnless(x.getFunctionSpace() == fs)
313 self.failUnless(x.getShape() == (fs.getDim(),))
314 self.failUnless(inf(x[0])>=0.)
315 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
316 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
317 self.failUnless(sup(x[0])<=1.)
318 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
319 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
320
321 def test_functionspace_ReducedSolution(self):
322 fs=ReducedSolution(self.domain)
323 self.failUnless(fs.getDomain()==self.domain)
324 self.failUnless(self.domain.getDim() == fs.getDim())
325 x=fs.getX()
326 self.failUnless(x.getFunctionSpace() == fs)
327 self.failUnless(x.getShape() == (fs.getDim(),))
328 self.failUnless(inf(x[0])>=0.)
329 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
330 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
331 self.failUnless(sup(x[0])<=1.)
332 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
333 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
334
335 def test_functionspace_Function(self):
336 fs=Function(self.domain)
337 self.failUnless(fs.getDomain()==self.domain)
338 self.failUnless(self.domain.getDim() == fs.getDim())
339 x=fs.getX()
340 self.failUnless(x.getFunctionSpace() == fs)
341 self.failUnless(x.getShape() == (fs.getDim(),))
342 self.failUnless(inf(x[0])>=0.)
343 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
344 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
345 self.failUnless(sup(x[0])<=1.)
346 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
347 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
348
349 def test_functionspace_ReducedFunction(self):
350 fs=ReducedFunction(self.domain)
351 self.failUnless(fs.getDomain()==self.domain)
352 self.failUnless(self.domain.getDim() == fs.getDim())
353 x=fs.getX()
354 self.failUnless(x.getFunctionSpace() == fs)
355 self.failUnless(x.getShape() == (fs.getDim(),))
356 self.failUnless(inf(x[0])>=0.)
357 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
358 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
359 self.failUnless(sup(x[0])<=1.)
360 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
361 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
362 def test_functionspace_FunctionOnBoundary(self):
363 fs=FunctionOnBoundary(self.domain)
364 self.failUnless(fs.getDomain()==self.domain)
365 self.failUnless(self.domain.getDim() == fs.getDim())
366 x=fs.getX()
367 self.failUnless(x.getFunctionSpace() == fs)
368 self.failUnless(x.getShape() == (fs.getDim(),))
369 self.failUnless(inf(x[0])>=0.)
370 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
371 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
372 self.failUnless(sup(x[0])<=1.)
373 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
374 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
375
376 def test_functionspace_ReducedFunctionOnBoundary(self):
377 fs=ReducedFunctionOnBoundary(self.domain)
378 self.failUnless(fs.getDomain()==self.domain)
379 self.failUnless(self.domain.getDim() == fs.getDim())
380 x=fs.getX()
381 self.failUnless(x.getFunctionSpace() == fs)
382 self.failUnless(x.getShape() == (fs.getDim(),))
383 self.failUnless(inf(x[0])>=0.)
384 if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
385 if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
386 self.failUnless(sup(x[0])<=1.)
387 if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
388 if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
389 #===========================================================================
390
391 class Test_GlobalMinMax(unittest.TestCase):
392 def test_GlobalMinMax(self):
393 myrank=getMPIRankWorld()
394 d=Data(myrank,Function(self.domain))
395 minproc=inf(d)
396 maxproc=sup(d) #This tells us where to expect values to be
397 if d.getNumberOfDataPoints()>0:
398 d.setValueOfDataPoint(0,myrank-0.001);
399 p,n=d.minGlobalDataPoint()
400 self.failUnless(p==minproc,"Incorrect process indentified as holding min")
401 self.failUnless(n==0,"Incorrect position for min")
402 if d.getNumberOfDataPoints()>0:
403 d.setValueOfDataPoint(0,myrank+0.001)
404 p,n=d.maxGlobalDataPoint()
405 self.failUnless(p==maxproc,"Incorrect process indentified as holding min")
406 self.failUnless(n==0,"Incorrect position for min")
407
408
409
410 class Test_SetDataPointValue(unittest.TestCase):
411 arg0=9.81
412 arg1=numpy.array([3.098, -3.111])
413 arg2=numpy.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]])
414 arg3=numpy.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]]])
415 arg4=numpy.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]]]])
416 def test_SetDataPointValue_Function_Rank0(self):
417 d=Data(self.arg0,Function(self.domain))
418 d.setValueOfDataPoint(0,self.arg0*2)
419 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
420 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg0)
421 d_0=numpy.array(d.getTupleForDataPoint(0))
422 d_1=numpy.array(d.getTupleForDataPoint(1))
423 self.failUnless(Lsup(d_0-self.arg0*2)<=Lsup(self.arg0*2), "wrong setting")
424 self.failUnless(Lsup(d_1-self.arg0)<=Lsup(self.arg0), "wrong setting")
425 def test_SetDataPointValue_Function_Rank1(self):
426 d=Data(self.arg1,Function(self.domain))
427 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
428 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
429 d.setValueOfDataPoint(0,self.arg1*2)
430 d_0=numpy.array(d.getTupleForDataPoint(0))
431 d_1=numpy.array(d.getTupleForDataPoint(1))
432 self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")
433 self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
434 def test_SetDataPointValue_Function_Rank1_list(self):
435 d=Data(self.arg1,Function(self.domain))
436 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
437 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
438 d.setValueOfDataPoint(0,(self.arg1*2).tolist())
439 d_0=numpy.array(d.getTupleForDataPoint(0))
440 d_1=numpy.array(d.getTupleForDataPoint(1))
441 self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")
442 self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
443 def test_SetDataPointValue_Function_Rank2(self):
444 d=Data(self.arg2,Function(self.domain))
445 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
446 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
447 d.setValueOfDataPoint(0,self.arg2*2)
448 d_0=numpy.array(d.getTupleForDataPoint(0))
449 d_1=numpy.array(d.getTupleForDataPoint(1))
450 self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")
451 self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
452 def test_SetDataPointValue_Function_Rank2_list(self):
453 d=Data(self.arg2,Function(self.domain))
454 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
455 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
456 d.setValueOfDataPoint(0,(self.arg2*2).tolist())
457 d_0=numpy.array(d.getTupleForDataPoint(0))
458 d_1=numpy.array(d.getTupleForDataPoint(1))
459 self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")
460 self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
461 def test_SetDataPointValue_Function_Rank3(self):
462 d=Data(self.arg3,Function(self.domain))
463 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
464 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
465 d.setValueOfDataPoint(0,self.arg3*2)
466 d_0=numpy.array(d.getTupleForDataPoint(0))
467 d_1=numpy.array(d.getTupleForDataPoint(1))
468 self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")
469 self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
470 def test_SetDataPointValue_Function_Rank3_list(self):
471 d=Data(self.arg3,Function(self.domain))
472 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
473 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
474 d.setValueOfDataPoint(0,(self.arg3*2).tolist())
475 d_0=numpy.array(d.getTupleForDataPoint(0))
476 d_1=numpy.array(d.getTupleForDataPoint(1))
477 self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")
478 self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
479 def test_SetDataPointValue_Function_Rank4(self):
480 d=Data(self.arg4,Function(self.domain))
481 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
482 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
483 d.setValueOfDataPoint(0,self.arg4*2)
484 d_0=numpy.array(d.getTupleForDataPoint(0))
485 d_1=numpy.array(d.getTupleForDataPoint(1))
486 self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")
487 self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
488 def test_SetDataPointValue_Function_Rank4_list(self):
489 d=Data(self.arg4,Function(self.domain))
490 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
491 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
492 d.setValueOfDataPoint(0,(self.arg4*2).tolist())
493 d_0=numpy.array(d.getTupleForDataPoint(0))
494 d_1=numpy.array(d.getTupleForDataPoint(1))
495 self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")
496 self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
497 #===========================================================================
498 def test_SetDataPointValue_ReducedFunction_Rank0(self):
499 d=Data(self.arg0,ReducedFunction(self.domain))
500 d.setValueOfDataPoint(0,self.arg0*2)
501 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
502 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg0)
503 d_0=numpy.array(d.getTupleForDataPoint(0))
504 d_1=numpy.array(d.getTupleForDataPoint(1))
505 self.failUnless(Lsup(d_0-self.arg0*2)<=Lsup(self.arg0*2), "wrong setting")
506 self.failUnless(Lsup(d_1-self.arg0)<=Lsup(self.arg0), "wrong setting")
507 def test_SetDataPointValue_ReducedFunction_Rank1(self):
508 d=Data(self.arg1,ReducedFunction(self.domain))
509 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
510 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
511 d.setValueOfDataPoint(0,self.arg1*2)
512 d_0=numpy.array(d.getTupleForDataPoint(0))
513 d_1=numpy.array(d.getTupleForDataPoint(1))
514 self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")
515 self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
516 def test_SetDataPointValue_ReducedFunction_Rank1_list(self):
517 d=Data(self.arg1,ReducedFunction(self.domain))
518 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
519 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
520 d.setValueOfDataPoint(0,(self.arg1*2).tolist())
521 d_0=numpy.array(d.getTupleForDataPoint(0))
522 d_1=numpy.array(d.getTupleForDataPoint(1))
523 self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")
524 self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
525 def test_SetDataPointValue_ReducedFunction_Rank2(self):
526 d=Data(self.arg2,ReducedFunction(self.domain))
527 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
528 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
529 d.setValueOfDataPoint(0,self.arg2*2)
530 d_0=numpy.array(d.getTupleForDataPoint(0))
531 d_1=numpy.array(d.getTupleForDataPoint(1))
532 self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")
533 self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
534 def test_SetDataPointValue_ReducedFunction_Rank2_list(self):
535 d=Data(self.arg2,ReducedFunction(self.domain))
536 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
537 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
538 d.setValueOfDataPoint(0,(self.arg2*2).tolist())
539 d_0=numpy.array(d.getTupleForDataPoint(0))
540 d_1=numpy.array(d.getTupleForDataPoint(1))
541 self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")
542 self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
543 def test_SetDataPointValue_ReducedFunction_Rank3(self):
544 d=Data(self.arg3,ReducedFunction(self.domain))
545 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
546 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
547 d.setValueOfDataPoint(0,self.arg3*2)
548 d_0=numpy.array(d.getTupleForDataPoint(0))
549 d_1=numpy.array(d.getTupleForDataPoint(1))
550 self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")
551 self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
552 def test_SetDataPointValue_ReducedFunction_Rank3_list(self):
553 d=Data(self.arg3,ReducedFunction(self.domain))
554 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
555 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
556 d.setValueOfDataPoint(0,(self.arg3*2).tolist())
557 d_0=numpy.array(d.getTupleForDataPoint(0))
558 d_1=numpy.array(d.getTupleForDataPoint(1))
559 self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")
560 self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
561 def test_SetDataPointValue_ReducedFunction_Rank4(self):
562 d=Data(self.arg4,ReducedFunction(self.domain))
563 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
564 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
565 d.setValueOfDataPoint(0,self.arg4*2)
566 d_0=numpy.array(d.getTupleForDataPoint(0))
567 d_1=numpy.array(d.getTupleForDataPoint(1))
568 self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")
569 self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
570 def test_SetDataPointValue_ReducedFunction_Rank4_list(self):
571 d=Data(self.arg4,ReducedFunction(self.domain))
572 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
573 self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
574 d.setValueOfDataPoint(0,(self.arg4*2).tolist())
575 d_0=numpy.array(d.getTupleForDataPoint(0))
576 d_1=numpy.array(d.getTupleForDataPoint(1))
577 self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")
578 self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
579
580 class Test_Dump(unittest.TestCase):
581 arg0=9.81
582 arg1=numpy.array([3.098, -3.111])
583 arg2=numpy.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]])
584 arg3=numpy.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]]])
585 arg4=numpy.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]]]])
586
587 def _diffDataObjects(self,d_ref,filemame, use_old_file=False):
588 if not use_old_file: d_ref.dump(filemame)
589 d=load(filemame, d_ref.getDomain())
590 self.failUnless(not d.isEmpty(),"data in %s are empty."%filemame)
591 self.failUnless(d_ref.getRank() == d.getRank(), "different rank in %s. "%filemame)
592 self.failUnless(d_ref.getShape() == d.getShape(), "different shape %s. "%filemame)
593 self.failUnless(d_ref.getFunctionSpace() == d.getFunctionSpace(), "wrong function space in %s."%filemame)
594 self.failUnless(Lsup(d_ref-d)<=0., "different entries %s."%filemame)
595
596 #===========================================================================
597 def test_DumpAndLoad_Constant_Solution_Rank0(self):
598 if loadIsConfigured():
599 filemame=os.path.join(self.filename_base,"constant_solution_rank0.nc")
600 d=Data(self.arg0,Solution(self.domain))
601 self._diffDataObjects(d,filemame)
602
603 def test_DumpAndLoad_Constant_Solution_Rank1(self):
604 if loadIsConfigured():
605 filemame=os.path.join(self.filename_base,"constant_solution_rank1.nc")
606 d=Data(self.arg1,Solution(self.domain))
607 self._diffDataObjects(d,filemame)
608
609 def test_DumpAndLoad_Constant_Solution_Rank2(self):
610 if loadIsConfigured():
611 filemame=os.path.join(self.filename_base,"constant_solution_rank2.nc")
612 d=Data(self.arg2,Solution(self.domain))
613 self._diffDataObjects(d,filemame)
614
615 def test_DumpAndLoad_Constant_Solution_Rank3(self):
616 if loadIsConfigured():
617 filemame=os.path.join(self.filename_base,"constant_solution_rank3.nc")
618 d=Data(self.arg3,Solution(self.domain))
619 self._diffDataObjects(d,filemame)
620
621 def test_DumpAndLoad_Constant_Solution_Rank4(self):
622 if loadIsConfigured():
623 filemame=os.path.join(self.filename_base,"constant_solution_rank4.nc")
624 d=Data(self.arg4,Solution(self.domain))
625 self._diffDataObjects(d,filemame)
626 #===========================================================================
627 def test_DumpAndLoad_Constant_ReducedSolution_Rank0(self):
628 if loadIsConfigured():
629 filemame=os.path.join(self.filename_base,"constant_reduced_solution_rank0.nc")
630 d=Data(self.arg0,ReducedSolution(self.domain))
631 self._diffDataObjects(d,filemame)
632
633 def test_DumpAndLoad_Constant_ReducedSolution_Rank1(self):
634 if loadIsConfigured():
635 filemame=os.path.join(self.filename_base,"constant_reduced_solution_rank1.nc")
636 d=Data(self.arg1,ReducedSolution(self.domain))
637 self._diffDataObjects(d,filemame)
638
639 def test_DumpAndLoad_Constant_ReducedSolution_Rank2(self):
640 if loadIsConfigured():
641 filemame=os.path.join(self.filename_base,"constant_reduced_solution_rank2.nc")
642 d=Data(self.arg2,ReducedSolution(self.domain))
643 self._diffDataObjects(d,filemame)
644
645 def test_DumpAndLoad_Constant_ReducedSolution_Rank3(self):
646 if loadIsConfigured():
647 filemame=os.path.join(self.filename_base,"constant_reduced_solution_rank3.nc")
648 d=Data(self.arg3,ReducedSolution(self.domain))
649 self._diffDataObjects(d,filemame)
650
651 def test_DumpAndLoad_Constant_ReducedSolution_Rank4(self):
652 if loadIsConfigured():
653 filemame=os.path.join(self.filename_base,"constant_reduced_solution_rank4.nc")
654 d=Data(self.arg4,ReducedSolution(self.domain))
655 self._diffDataObjects(d,filemame)
656 #===========================================================================
657 def test_DumpAndLoad_Constant_ContinuousFunction_Rank0(self):
658 if loadIsConfigured():
659 filemame=os.path.join(self.filename_base,"constant_continuous_function_rank0.nc")
660 d=Data(self.arg0,ContinuousFunction(self.domain))
661 self._diffDataObjects(d,filemame)
662
663 def test_DumpAndLoad_Constant_ContinuousFunction_Rank1(self):
664 if loadIsConfigured():
665 filemame=os.path.join(self.filename_base,"constant_continuous_function_rank1.nc")
666 d=Data(self.arg1,ContinuousFunction(self.domain))
667 self._diffDataObjects(d,filemame)
668
669 def test_DumpAndLoad_Constant_ContinuousFunction_Rank2(self):
670 if loadIsConfigured():
671 filemame=os.path.join(self.filename_base,"constant_continuous_function_rank2.nc")
672 d=Data(self.arg2,ContinuousFunction(self.domain))
673 self._diffDataObjects(d,filemame)
674
675 def test_DumpAndLoad_Constant_ContinuousFunction_Rank3(self):
676 if loadIsConfigured():
677 filemame=os.path.join(self.filename_base,"constant_continuous_function_rank3.nc")
678 d=Data(self.arg3,ContinuousFunction(self.domain))
679 self._diffDataObjects(d,filemame)
680
681 def test_DumpAndLoad_Constant_ContinuousFunction_Rank4(self):
682 if loadIsConfigured():
683 filemame=os.path.join(self.filename_base,"constant_continuous_function_rank4.nc")
684 d=Data(self.arg4,ContinuousFunction(self.domain))
685 self._diffDataObjects(d,filemame)
686
687 #===========================================================================
688 def test_DumpAndLoad_Constant_Function_Rank0(self):
689 if loadIsConfigured():
690 filemame=os.path.join(self.filename_base,"constant_function_rank0.nc")
691 d=Data(self.arg0,Function(self.domain))
692 self._diffDataObjects(d,filemame)
693
694 def test_DumpAndLoad_Constant_Function_Rank1(self):
695 if loadIsConfigured():
696 filemame=os.path.join(self.filename_base,"constant_function_rank1.nc")
697 d=Data(self.arg1,Function(self.domain))
698 self._diffDataObjects(d,filemame)
699
700 def test_DumpAndLoad_Constant_Function_Rank2(self):
701 if loadIsConfigured():
702 filemame=os.path.join(self.filename_base,"constant_function_rank2.nc")
703 d=Data(self.arg2,Function(self.domain))
704 self._diffDataObjects(d,filemame)
705
706 def test_DumpAndLoad_Constant_Function_Rank3(self):
707 if loadIsConfigured():
708 filemame=os.path.join(self.filename_base,"constant_function_rank3.nc")
709 d=Data(self.arg3,Function(self.domain))
710 self._diffDataObjects(d,filemame)
711
712 #===========================================================================
713 def test_DumpAndLoad_Constant_ReducedFunction_Rank0(self):
714 if loadIsConfigured():
715 filemame=os.path.join(self.filename_base,"constant_reduced_function_rank0.nc")
716 d=Data(self.arg0,ReducedFunction(self.domain))
717 self._diffDataObjects(d,filemame)
718
719 def test_DumpAndLoad_Constant_ReducedFunction_Rank1(self):
720 if loadIsConfigured():
721 filemame=os.path.join(self.filename_base,"constant_reduced_function_rank1.nc")
722 d=Data(self.arg1,ReducedFunction(self.domain))
723 self._diffDataObjects(d,filemame)
724
725 def test_DumpAndLoad_Constant_ReducedFunction_Rank2(self):
726 if loadIsConfigured():
727 filemame=os.path.join(self.filename_base,"constant_reduced_function_rank2.nc")
728 d=Data(self.arg2,ReducedFunction(self.domain))
729 self._diffDataObjects(d,filemame)
730
731 def test_DumpAndLoad_Constant_ReducedFunction_Rank3(self):
732 if loadIsConfigured():
733 filemame=os.path.join(self.filename_base,"constant_reduced_function_rank3.nc")
734 d=Data(self.arg3,ReducedFunction(self.domain))
735 self._diffDataObjects(d,filemame)
736 def test_DumpAndLoad_Constant_ReducedFunction_Rank4(self):
737 if loadIsConfigured():
738 filemame=os.path.join(self.filename_base,"constant_reduced_function_rank4.nc")
739 d=Data(self.arg4,ReducedFunction(self.domain))
740 self._diffDataObjects(d,filemame)
741
742 #===========================================================================
743 def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank0(self):
744 if loadIsConfigured():
745 filemame=os.path.join(self.filename_base,"constant_function_on_boundary_rank0.nc")
746 d=Data(self.arg0,FunctionOnBoundary(self.domain))
747 self._diffDataObjects(d,filemame)
748
749 def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank1(self):
750 if loadIsConfigured():
751 filemame=os.path.join(self.filename_base,"constant_function_on_boundary_rank1.nc")
752 d=Data(self.arg1,FunctionOnBoundary(self.domain))
753 self._diffDataObjects(d,filemame)
754
755 def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank2(self):
756 if loadIsConfigured():
757 filemame=os.path.join(self.filename_base,"constant_function_on_boundary_rank2.nc")
758 d=Data(self.arg2,FunctionOnBoundary(self.domain))
759 self._diffDataObjects(d,filemame)
760
761 def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank3(self):
762 if loadIsConfigured():
763 filemame=os.path.join(self.filename_base,"constant_function_on_boundary_rank3.nc")
764 d=Data(self.arg3,FunctionOnBoundary(self.domain))
765 self._diffDataObjects(d,filemame)
766
767 def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank4(self):
768 if loadIsConfigured():
769 filemame=os.path.join(self.filename_base,"constant_function_on_boundary_rank4.nc")
770 d=Data(self.arg4,FunctionOnBoundary(self.domain))
771 self._diffDataObjects(d,filemame)
772
773 #===========================================================================
774 def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank0(self):
775 if loadIsConfigured():
776 filemame=os.path.join(self.filename_base,"constant_reduced_function_on_boundary_rank0.nc")
777 d=Data(self.arg0,FunctionOnBoundary(self.domain))
778 self._diffDataObjects(d,filemame)
779
780 def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank1(self):
781 if loadIsConfigured():
782 filemame=os.path.join(self.filename_base,"constant_reduced_function_on_boundary_rank1.nc")
783 d=Data(self.arg1,ReducedFunctionOnBoundary(self.domain))
784 self._diffDataObjects(d,filemame)
785
786 def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank2(self):
787 if loadIsConfigured():
788 filemame=os.path.join(self.filename_base,"constant_reduced_function_on_boundary_rank2.nc")
789 d=Data(self.arg2,ReducedFunctionOnBoundary(self.domain))
790 self._diffDataObjects(d,filemame)
791
792 def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank3(self):
793 if loadIsConfigured():
794 filemame=os.path.join(self.filename_base,"constant_reduced_function_on_boundary_rank3.nc")
795 d=Data(self.arg3,ReducedFunctionOnBoundary(self.domain))
796 self._diffDataObjects(d,filemame)
797
798 def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank4(self):
799 if loadIsConfigured():
800 filemame=os.path.join(self.filename_base,"constant_reduced_function_on_boundary_rank4.nc")
801 d=Data(self.arg4,ReducedFunctionOnBoundary(self.domain))
802 self._diffDataObjects(d,filemame)
803
804 #===========================================================================
805 def test_DumpAndLoad_Expanded_Solution_Rank0(self):
806 if loadIsConfigured():
807 filemame=os.path.join(self.filename_base,"expanded_solution_rank0.nc")
808 d=Data(length(Solution(self.domain).getX())*self.arg0,Solution(self.domain))
809 self._diffDataObjects(d,filemame)
810 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
811 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
812 if getMPISizeWorld() ==1:
813 d=Data(length(Solution(self.domain_with_different_sample_ordering).getX())*self.arg0,Solution(self.domain_with_different_sample_ordering))
814 self._diffDataObjects(d,filemame, use_old_file=True)
815
816 def test_DumpAndLoad_Expanded_Solution_Rank1(self):
817 if loadIsConfigured():
818 filemame=os.path.join(self.filename_base,"expanded_solution_rank1.nc")
819 d=Data(length(Solution(self.domain).getX())*self.arg1,Solution(self.domain))
820 self._diffDataObjects(d,filemame)
821 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
822 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
823 if getMPISizeWorld() ==1:
824 d=Data(length(Solution(self.domain_with_different_sample_ordering).getX())*self.arg1,Solution(self.domain_with_different_sample_ordering))
825 self._diffDataObjects(d,filemame, use_old_file=True)
826
827 def test_DumpAndLoad_Expanded_Solution_Rank2(self):
828 if loadIsConfigured():
829 filemame=os.path.join(self.filename_base,"expanded_solution_rank2.nc")
830 d=Data(length(Solution(self.domain).getX())*self.arg2,Solution(self.domain))
831 self._diffDataObjects(d,filemame)
832 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
833 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
834 if getMPISizeWorld() ==1:
835 d=Data(length(Solution(self.domain_with_different_sample_ordering).getX())*self.arg2,Solution(self.domain_with_different_sample_ordering))
836 self._diffDataObjects(d,filemame, use_old_file=True)
837
838 def test_DumpAndLoad_Expanded_Solution_Rank3(self):
839 if loadIsConfigured():
840 filemame=os.path.join(self.filename_base,"expanded_solution_rank3.nc")
841 d=Data(length(Solution(self.domain).getX())*self.arg3,Solution(self.domain))
842 self._diffDataObjects(d,filemame)
843 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
844 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
845 if getMPISizeWorld() ==1:
846 d=Data(length(Solution(self.domain_with_different_sample_ordering).getX())*self.arg3,Solution(self.domain_with_different_sample_ordering))
847 self._diffDataObjects(d,filemame, use_old_file=True)
848
849 def test_DumpAndLoad_Expanded_Solution_Rank4(self):
850 if loadIsConfigured():
851 filemame=os.path.join(self.filename_base,"expanded_solution_rank4.nc")
852 d=Data(length(Solution(self.domain).getX())*self.arg4,Solution(self.domain))
853 self._diffDataObjects(d,filemame)
854 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
855 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
856 if getMPISizeWorld() ==1:
857 d=Data(length(Solution(self.domain_with_different_sample_ordering).getX())*self.arg4,Solution(self.domain_with_different_sample_ordering))
858 self._diffDataObjects(d,filemame, use_old_file=True)
859 #===========================================================================
860 def test_DumpAndLoad_Expanded_ReducedSolution_Rank0(self):
861 if loadIsConfigured():
862 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank0.nc")
863 d=Data(length(ReducedSolution(self.domain).getX())*self.arg0,ReducedSolution(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(ReducedSolution(self.domain_with_different_sample_ordering).getX())*self.arg0,ReducedSolution(self.domain_with_different_sample_ordering))
869 self._diffDataObjects(d,filemame, use_old_file=True)
870
871 def test_DumpAndLoad_Expanded_ReducedSolution_Rank1(self):
872 if loadIsConfigured():
873 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank1.nc")
874 d=Data(length(ReducedSolution(self.domain).getX())*self.arg1,ReducedSolution(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(ReducedSolution(self.domain_with_different_sample_ordering).getX())*self.arg1,ReducedSolution(self.domain_with_different_sample_ordering))
880 self._diffDataObjects(d,filemame, use_old_file=True)
881
882 def test_DumpAndLoad_Expanded_ReducedSolution_Rank2(self):
883 if loadIsConfigured():
884 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank2.nc")
885 d=Data(length(ReducedSolution(self.domain).getX())*self.arg2,ReducedSolution(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(ReducedSolution(self.domain_with_different_sample_ordering).getX())*self.arg2,ReducedSolution(self.domain_with_different_sample_ordering))
891 self._diffDataObjects(d,filemame, use_old_file=True)
892
893 def test_DumpAndLoad_Expanded_ReducedSolution_Rank3(self):
894 if loadIsConfigured():
895 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank3.nc")
896 d=Data(length(ReducedSolution(self.domain).getX())*self.arg3,ReducedSolution(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(ReducedSolution(self.domain_with_different_sample_ordering).getX())*self.arg3,ReducedSolution(self.domain_with_different_sample_ordering))
902 self._diffDataObjects(d,filemame, use_old_file=True)
903
904 def test_DumpAndLoad_Expanded_ReducedSolution_Rank4(self):
905 if loadIsConfigured():
906 filemame=os.path.join(self.filename_base,"expanded_reduced_solution_rank4.nc")
907 d=Data(length(ReducedSolution(self.domain).getX())*self.arg4,ReducedSolution(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(ReducedSolution(self.domain_with_different_sample_ordering).getX())*self.arg4,ReducedSolution(self.domain_with_different_sample_ordering))
913 self._diffDataObjects(d,filemame, use_old_file=True)
914 #===========================================================================
915 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank0(self):
916 if loadIsConfigured():
917 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank0.nc")
918 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg0,ContinuousFunction(self.domain))
919 self._diffDataObjects(d,filemame)
920 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
921 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
922 if getMPISizeWorld() ==1:
923 d=Data(length(ContinuousFunction(self.domain_with_different_sample_ordering).getX())*self.arg0,ContinuousFunction(self.domain_with_different_sample_ordering))
924 self._diffDataObjects(d,filemame, use_old_file=True)
925
926 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank1(self):
927 if loadIsConfigured():
928 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank1.nc")
929 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
930 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg1,ContinuousFunction(self.domain))
931 self._diffDataObjects(d,filemame)
932 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
933 if getMPISizeWorld() ==1:
934 d=Data(length(ContinuousFunction(self.domain_with_different_sample_ordering).getX())*self.arg1,ContinuousFunction(self.domain_with_different_sample_ordering))
935 self._diffDataObjects(d,filemame, use_old_file=True)
936
937 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank2(self):
938 if loadIsConfigured():
939 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank2.nc")
940 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg2,ContinuousFunction(self.domain))
941 self._diffDataObjects(d,filemame)
942 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
943 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
944 if getMPISizeWorld() ==1:
945 d=Data(length(ContinuousFunction(self.domain_with_different_sample_ordering).getX())*self.arg2,ContinuousFunction(self.domain_with_different_sample_ordering))
946 self._diffDataObjects(d,filemame, use_old_file=True)
947
948 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank3(self):
949 if loadIsConfigured():
950 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank3.nc")
951 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg3,ContinuousFunction(self.domain))
952 self._diffDataObjects(d,filemame)
953 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
954 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
955 if getMPISizeWorld() ==1:
956 d=Data(length(ContinuousFunction(self.domain_with_different_sample_ordering).getX())*self.arg3,ContinuousFunction(self.domain_with_different_sample_ordering))
957 self._diffDataObjects(d,filemame, use_old_file=True)
958
959 def test_DumpAndLoad_Expanded_ContinuousFunction_Rank4(self):
960 if loadIsConfigured():
961 filemame=os.path.join(self.filename_base,"expanded_continuous_function_rank4.nc")
962 d=Data(length(ContinuousFunction(self.domain).getX())*self.arg4,ContinuousFunction(self.domain))
963 self._diffDataObjects(d,filemame)
964 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
965 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
966 if getMPISizeWorld() ==1:
967 d=Data(length(ContinuousFunction(self.domain_with_different_sample_ordering).getX())*self.arg4,ContinuousFunction(self.domain_with_different_sample_ordering))
968 self._diffDataObjects(d,filemame, use_old_file=True)
969
970 #===========================================================================
971 def test_DumpAndLoad_Expanded_Function_Rank0(self):
972 if loadIsConfigured():
973 filemame=os.path.join(self.filename_base,"expanded_function_rank0.nc")
974 d=Data(length(Function(self.domain).getX())*self.arg0,Function(self.domain))
975 self._diffDataObjects(d,filemame)
976 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
977 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
978 if getMPISizeWorld() ==1:
979 d=Data(length(Function(self.domain_with_different_sample_ordering).getX())*self.arg0,Function(self.domain_with_different_sample_ordering))
980 self._diffDataObjects(d,filemame, use_old_file=True)
981
982 def test_DumpAndLoad_Expanded_Function_Rank1(self):
983 if loadIsConfigured():
984 filemame=os.path.join(self.filename_base,"expanded_function_rank1.nc")
985 d=Data(length(Function(self.domain).getX())*self.arg1,Function(self.domain))
986 self._diffDataObjects(d,filemame)
987 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
988 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
989 if getMPISizeWorld() ==1:
990 d=Data(length(Function(self.domain_with_different_sample_ordering).getX())*self.arg1,Function(self.domain_with_different_sample_ordering))
991 self._diffDataObjects(d,filemame, use_old_file=True)
992
993 def test_DumpAndLoad_Expanded_Function_Rank2(self):
994 if loadIsConfigured():
995 filemame=os.path.join(self.filename_base,"expanded_function_rank2.nc")
996 d=Data(length(Function(self.domain).getX())*self.arg2,Function(self.domain))
997 self._diffDataObjects(d,filemame)
998 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
999 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1000 if getMPISizeWorld() ==1:
1001 d=Data(length(Function(self.domain_with_different_sample_ordering).getX())*self.arg2,Function(self.domain_with_different_sample_ordering))
1002 self._diffDataObjects(d,filemame, use_old_file=True)
1003
1004 def test_DumpAndLoad_Expanded_Function_Rank3(self):
1005 if loadIsConfigured():
1006 filemame=os.path.join(self.filename_base,"expanded_function_rank3.nc")
1007 d=Data(length(Function(self.domain).getX())*self.arg3,Function(self.domain))
1008 self._diffDataObjects(d,filemame)
1009 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1010 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1011 if getMPISizeWorld() ==1:
1012 d=Data(length(Function(self.domain_with_different_sample_ordering).getX())*self.arg3,Function(self.domain_with_different_sample_ordering))
1013 self._diffDataObjects(d,filemame, use_old_file=True)
1014
1015 def test_DumpAndLoad_Expanded_Function_Rank4(self):
1016 if loadIsConfigured():
1017 filemame=os.path.join(self.filename_base,"expanded_function_rank4.nc")
1018 d=Data(length(Function(self.domain).getX())*self.arg4,Function(self.domain))
1019 self._diffDataObjects(d,filemame)
1020 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1021 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1022 if getMPISizeWorld() ==1:
1023 d=Data(length(Function(self.domain_with_different_sample_ordering).getX())*self.arg4,Function(self.domain_with_different_sample_ordering))
1024 self._diffDataObjects(d,filemame, use_old_file=True)
1025
1026 #===========================================================================
1027 def test_DumpAndLoad_Expanded_ReducedFunction_Rank0(self):
1028 if loadIsConfigured():
1029 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank0.nc")
1030 d=Data(length(ReducedFunction(self.domain).getX())*self.arg0,ReducedFunction(self.domain))
1031 self._diffDataObjects(d,filemame)
1032 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1033 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1034 if getMPISizeWorld() ==1:
1035 d=Data(length(ReducedFunction(self.domain_with_different_sample_ordering).getX())*self.arg0,ReducedFunction(self.domain_with_different_sample_ordering))
1036 self._diffDataObjects(d,filemame, use_old_file=True)
1037
1038 def test_DumpAndLoad_Expanded_ReducedFunction_Rank1(self):
1039 if loadIsConfigured():
1040 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank1.nc")
1041 d=Data(length(ReducedFunction(self.domain).getX())*self.arg1,ReducedFunction(self.domain))
1042 self._diffDataObjects(d,filemame)
1043 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1044 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1045 if getMPISizeWorld() ==1:
1046 d=Data(length(ReducedFunction(self.domain_with_different_sample_ordering).getX())*self.arg1,ReducedFunction(self.domain_with_different_sample_ordering))
1047 self._diffDataObjects(d,filemame, use_old_file=True)
1048
1049 def test_DumpAndLoad_Expanded_ReducedFunction_Rank2(self):
1050 if loadIsConfigured():
1051 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank2.nc")
1052 d=Data(length(ReducedFunction(self.domain).getX())*self.arg2,ReducedFunction(self.domain))
1053 self._diffDataObjects(d,filemame)
1054 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1055 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1056 if getMPISizeWorld() ==1:
1057 d=Data(length(ReducedFunction(self.domain_with_different_sample_ordering).getX())*self.arg2,ReducedFunction(self.domain_with_different_sample_ordering))
1058 self._diffDataObjects(d,filemame, use_old_file=True)
1059
1060 def test_DumpAndLoad_Expanded_ReducedFunction_Rank3(self):
1061 if loadIsConfigured():
1062 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank3.nc")
1063 d=Data(length(ReducedFunction(self.domain).getX())*self.arg3,ReducedFunction(self.domain))
1064 self._diffDataObjects(d,filemame)
1065 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1066 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1067 if getMPISizeWorld() ==1:
1068 d=Data(length(ReducedFunction(self.domain_with_different_sample_ordering).getX())*self.arg3,ReducedFunction(self.domain_with_different_sample_ordering))
1069 self._diffDataObjects(d,filemame, use_old_file=True)
1070
1071 def test_DumpAndLoad_Expanded_ReducedFunction_Rank4(self):
1072 if loadIsConfigured():
1073 filemame=os.path.join(self.filename_base,"expanded_reduced_function_rank4.nc")
1074 d=Data(length(ReducedFunction(self.domain).getX())*self.arg4,ReducedFunction(self.domain))
1075 self._diffDataObjects(d,filemame)
1076 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1077 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1078 if getMPISizeWorld() ==1:
1079 d=Data(length(ReducedFunction(self.domain_with_different_sample_ordering).getX())*self.arg4,ReducedFunction(self.domain_with_different_sample_ordering))
1080 self._diffDataObjects(d,filemame, use_old_file=True)
1081
1082 #===========================================================================
1083 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank0(self):
1084 if loadIsConfigured():
1085 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank0.nc")
1086 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg0,FunctionOnBoundary(self.domain))
1087 self._diffDataObjects(d,filemame)
1088 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1089 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1090 if getMPISizeWorld() ==1:
1091 d=Data(length(FunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg0,FunctionOnBoundary(self.domain_with_different_sample_ordering))
1092 self._diffDataObjects(d,filemame, use_old_file=True)
1093
1094 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank1(self):
1095 if loadIsConfigured():
1096 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank1.nc")
1097 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg1,FunctionOnBoundary(self.domain))
1098 self._diffDataObjects(d,filemame)
1099 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1100 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1101 if getMPISizeWorld() ==1:
1102 d=Data(length(FunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg1,FunctionOnBoundary(self.domain_with_different_sample_ordering))
1103 self._diffDataObjects(d,filemame, use_old_file=True)
1104
1105 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank2(self):
1106 if loadIsConfigured():
1107 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank2.nc")
1108 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg2,FunctionOnBoundary(self.domain))
1109 self._diffDataObjects(d,filemame)
1110 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1111 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1112 if getMPISizeWorld() ==1:
1113 d=Data(length(FunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg2,FunctionOnBoundary(self.domain_with_different_sample_ordering))
1114 self._diffDataObjects(d,filemame, use_old_file=True)
1115
1116 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank3(self):
1117 if loadIsConfigured():
1118 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank3.nc")
1119 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg3,FunctionOnBoundary(self.domain))
1120 self._diffDataObjects(d,filemame)
1121 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1122 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1123 if getMPISizeWorld() ==1:
1124 d=Data(length(FunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg3,FunctionOnBoundary(self.domain_with_different_sample_ordering))
1125 self._diffDataObjects(d,filemame, use_old_file=True)
1126
1127 def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank4(self):
1128 if loadIsConfigured():
1129 filemame=os.path.join(self.filename_base,"expanded_function_on_boundary_rank4.nc")
1130 d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg4,FunctionOnBoundary(self.domain))
1131 self._diffDataObjects(d,filemame)
1132 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1133 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1134 if getMPISizeWorld() ==1:
1135 d=Data(length(FunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg4,FunctionOnBoundary(self.domain_with_different_sample_ordering))
1136 self._diffDataObjects(d,filemame, use_old_file=True)
1137
1138 #===========================================================================
1139 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank0(self):
1140 if loadIsConfigured():
1141 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank0.nc")
1142 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg0,ReducedFunctionOnBoundary(self.domain))
1143 self._diffDataObjects(d,filemame)
1144 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1145 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1146 if getMPISizeWorld() ==1:
1147 d=Data(length(ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg0,ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering))
1148 self._diffDataObjects(d,filemame, use_old_file=True)
1149
1150 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank1(self):
1151 if loadIsConfigured():
1152 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank1.nc")
1153 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg1,ReducedFunctionOnBoundary(self.domain))
1154 self._diffDataObjects(d,filemame)
1155 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1156 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1157 if getMPISizeWorld() ==1:
1158 d=Data(length(ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg1,ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering))
1159 self._diffDataObjects(d,filemame, use_old_file=True)
1160
1161 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank2(self):
1162 if loadIsConfigured():
1163 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank2.nc")
1164 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg2,ReducedFunctionOnBoundary(self.domain))
1165 self._diffDataObjects(d,filemame)
1166 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1167 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1168 if getMPISizeWorld() ==1:
1169 d=Data(length(ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg2,ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering))
1170 self._diffDataObjects(d,filemame, use_old_file=True)
1171
1172 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank3(self):
1173 if loadIsConfigured():
1174 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank3.nc")
1175 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg3,ReducedFunctionOnBoundary(self.domain))
1176 self._diffDataObjects(d,filemame)
1177 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1178 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1179 if getMPISizeWorld() ==1:
1180 d=Data(length(ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg3,ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering))
1181 self._diffDataObjects(d,filemame, use_old_file=True)
1182
1183 def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank4(self):
1184 if loadIsConfigured():
1185 filemame=os.path.join(self.filename_base,"expanded_reduced_function_on_boundary_rank4.nc")
1186 d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg4,ReducedFunctionOnBoundary(self.domain))
1187 self._diffDataObjects(d,filemame)
1188 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_samples)
1189 self.failUnlessRaises(RuntimeError, load, filemame, self.domain_with_different_number_of_data_points_per_sample)
1190 if getMPISizeWorld() ==1:
1191 d=Data(length(ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering).getX())*self.arg4,ReducedFunctionOnBoundary(self.domain_with_different_sample_ordering))
1192 self._diffDataObjects(d,filemame, use_old_file=True)
1193
1194 #===========================================================================
1195 ## This functionspace does not currently support tags.
1196 ## Instead, we test that the canTag() function throws in test_canTag_Failures.
1197
1198 #def test_DumpAndLoad_Tagged_Solution_Rank0(self):
1199 #if loadIsConfigured():
1200 #filemame=os.path.join(self.filename_base,"tagged_solution_rank0.nc")
1201 #d=Data(self.arg0,Solution(self.domain))
1202 #d.setTaggedValue(1,self.arg0*2)
1203 #d.setTaggedValue(10,self.arg0*3)
1204 #d.setTaggedValue(100,self.arg0*4)
1205 #self._diffDataObjects(d,filemame)
1206
1207 #def test_DumpAndLoad_Tagged_Solution_Rank1(self):
1208 #if loadIsConfigured():
1209 #filemame=os.path.join(self.filename_base,"tagged_solution_rank1.nc")
1210 #d=Data(self.arg1,Solution(self.domain))
1211 #d.setTaggedValue(1,self.arg1*2)
1212 #d.setTaggedValue(10,self.arg1*3)
1213 #d.setTaggedValue(100,self.arg1*4)
1214 #self._diffDataObjects(d,filemame)
1215
1216 #def test_DumpAndLoad_Tagged_Solution_Rank2(self):
1217 #if loadIsConfigured():
1218 #filemame=os.path.join(self.filename_base,"tagged_solution_rank2.nc")
1219 #d=Data(self.arg2,Solution(self.domain))
1220 #d.setTaggedValue(1,self.arg2*2)
1221 #d.setTaggedValue(10,self.arg2*3)
1222 #d.setTaggedValue(100,self.arg2*4)
1223 #self._diffDataObjects(d,filemame)
1224
1225 #def test_DumpAndLoad_Tagged_Solution_Rank3(self):
1226 #if loadIsConfigured():
1227 #filemame=os.path.join(self.filename_base,"tagged_solution_rank3.nc")
1228 #d=Data(self.arg3,Solution(self.domain))
1229 #d.setTaggedValue(1,self.arg3*2)
1230 #d.setTaggedValue(10,self.arg3*3)
1231 #d.setTaggedValue(100,self.arg3*4)
1232 #self._diffDataObjects(d,filemame)
1233
1234 #def test_DumpAndLoad_Tagged_Solution_Rank4(self):
1235 #if loadIsConfigured():
1236 #filemame=os.path.join(self.filename_base,"tagged_solution_rank4.nc")
1237 #d=Data(self.arg4,Solution(self.domain))
1238 #d.setTaggedValue(1,self.arg4*2)
1239 #d.setTaggedValue(10,self.arg4*3)
1240 #d.setTaggedValue(100,self.arg4*4)
1241 #self._diffDataObjects(d,filemame)
1242 ##===========================================================================
1243 ## This functionspace does not currently support tags.
1244 ## Instead, we test that the canTag() function throws in test_canTag_Failures.
1245
1246 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank0(self):
1247 #if loadIsConfigured():
1248 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank0.nc")
1249 #d=Data(self.arg0,ReducedSolution(self.domain))
1250 #d.setTaggedValue(1,self.arg0*2)
1251 #d.setTaggedValue(10,self.arg0*3)
1252 #d.setTaggedValue(100,self.arg0*4)
1253 #self._diffDataObjects(d,filemame)
1254
1255 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank1(self):
1256 #if loadIsConfigured():
1257 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank1.nc")
1258 #d=Data(self.arg1,ReducedSolution(self.domain))
1259 #d.setTaggedValue(1,self.arg1*2)
1260 #d.setTaggedValue(10,self.arg1*3)
1261 #d.setTaggedValue(100,self.arg1*4)
1262 #self._diffDataObjects(d,filemame)
1263
1264 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank2(self):
1265 #if loadIsConfigured():
1266 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank2.nc")
1267 #d=Data(self.arg2,ReducedSolution(self.domain))
1268 #d.setTaggedValue(1,self.arg2*2)
1269 #d.setTaggedValue(10,self.arg2*3)
1270 #d.setTaggedValue(100,self.arg2*4)
1271 #self._diffDataObjects(d,filemame)
1272
1273 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank3(self):
1274 #if loadIsConfigured():
1275 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank3.nc")
1276 #d=Data(self.arg3,ReducedSolution(self.domain))
1277 #d.setTaggedValue(1,self.arg3*2)
1278 #d.setTaggedValue(10,self.arg3*3)
1279 #d.setTaggedValue(100,self.arg3*4)
1280 #self._diffDataObjects(d,filemame)
1281
1282 #def test_DumpAndLoad_Tagged_ReducedSolution_Rank4(self):
1283 #if loadIsConfigured():
1284 #filemame=os.path.join(self.filename_base,"tagged_reduced_solution_rank4.nc")
1285 #d=Data(self.arg4,ReducedSolution(self.domain))
1286 #d.setTaggedValue(1,self.arg4*2)
1287 #d.setTaggedValue(10,self.arg4*3)
1288 #d.setTaggedValue(100,self.arg4*4)
1289 #self._diffDataObjects(d,filemame)
1290 ##===========================================================================
1291 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank0(self):
1292 if loadIsConfigured():
1293 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank0.nc")
1294 d=Data(self.arg0,ContinuousFunction(self.domain))
1295 d.setTaggedValue(1,self.arg0*2)
1296 d.setTaggedValue(10,self.arg0*3)
1297 d.setTaggedValue(100,self.arg0*4)
1298 self._diffDataObjects(d,filemame)
1299
1300 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank1(self):
1301 if loadIsConfigured():
1302 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank1.nc")
1303 d=Data(self.arg1,ContinuousFunction(self.domain))
1304 d.setTaggedValue(1,self.arg1*2)
1305 d.setTaggedValue(10,self.arg1*3)
1306 d.setTaggedValue(100,self.arg1*4)
1307 self._diffDataObjects(d,filemame)
1308
1309 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank2(self):
1310 if loadIsConfigured():
1311 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank2.nc")
1312 d=Data(self.arg2,ContinuousFunction(self.domain))
1313 d.setTaggedValue(1,self.arg2*2)
1314 d.setTaggedValue(10,self.arg2*3)
1315 d.setTaggedValue(100,self.arg2*4)
1316 self._diffDataObjects(d,filemame)
1317
1318 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank3(self):
1319 if loadIsConfigured():
1320 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank3.nc")
1321 d=Data(self.arg3,ContinuousFunction(self.domain))
1322 d.setTaggedValue(1,self.arg3*2)
1323 d.setTaggedValue(10,self.arg3*3)
1324 d.setTaggedValue(100,self.arg3*4)
1325 self._diffDataObjects(d,filemame)
1326
1327 def test_DumpAndLoad_Tagged_ContinuousFunction_Rank4(self):
1328 if loadIsConfigured():
1329 filemame=os.path.join(self.filename_base,"tagged_continuous_function_rank4.nc")
1330 d=Data(self.arg4,ContinuousFunction(self.domain))
1331 d.setTaggedValue(1,self.arg4*2)
1332 d.setTaggedValue(10,self.arg4*3)
1333 d.setTaggedValue(100,self.arg4*4)
1334 self._diffDataObjects(d,filemame)
1335
1336 #===========================================================================
1337 def test_DumpAndLoad_Tagged_Function_Rank0(self):
1338 if loadIsConfigured():
1339 filemame=os.path.join(self.filename_base,"tagged_function_rank0.nc")
1340 d=Data(self.arg0,Function(self.domain))
1341 d.setTaggedValue(1,self.arg0*2)
1342 d.setTaggedValue(10,self.arg0*3)
1343 d.setTaggedValue(100,self.arg0*4)
1344 self._diffDataObjects(d,filemame)
1345
1346 def test_DumpAndLoad_Tagged_Function_Rank1(self):
1347 if loadIsConfigured():
1348 filemame=os.path.join(self.filename_base,"tagged_function_rank1.nc")
1349 d=Data(self.arg1,Function(self.domain))
1350 d.setTaggedValue(1,self.arg1*2)
1351 d.setTaggedValue(10,self.arg1*3)
1352 d.setTaggedValue(100,self.arg1*4)
1353 self._diffDataObjects(d,filemame)
1354
1355 def test_DumpAndLoad_Tagged_Function_Rank2(self):
1356 if loadIsConfigured():
1357 filemame=os.path.join(self.filename_base,"tagged_function_rank2.nc")
1358 d=Data(self.arg2,Function(self.domain))
1359 d.setTaggedValue(1,self.arg2*2)
1360 d.setTaggedValue(10,self.arg2*3)
1361 d.setTaggedValue(100,self.arg2*4)
1362 self._diffDataObjects(d,filemame)
1363
1364 def test_DumpAndLoad_Tagged_Function_Rank3(self):
1365 if loadIsConfigured():
1366 filemame=os.path.join(self.filename_base,"tagged_function_rank3.nc")
1367 d=Data(self.arg3,Function(self.domain))
1368 d.setTaggedValue(1,self.arg3*2)
1369 d.setTaggedValue(10,self.arg3*3)
1370 d.setTaggedValue(100,self.arg3*4)
1371 self._diffDataObjects(d,filemame)
1372
1373 def test_DumpAndLoad_Tagged_Function_Rank4(self):
1374 if loadIsConfigured():
1375 filemame=os.path.join(self.filename_base,"tagged_function_rank4.nc")
1376 d=Data(self.arg4,Function(self.domain))
1377 d.setTaggedValue(1,self.arg4*2)
1378 d.setTaggedValue(10,self.arg4*3)
1379 d.setTaggedValue(100,self.arg4*4)
1380 self._diffDataObjects(d,filemame)
1381
1382 #===========================================================================
1383 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank0(self):
1384 if loadIsConfigured():
1385 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank0.nc")
1386 d=Data(self.arg0,FunctionOnBoundary(self.domain))
1387 d.setTaggedValue(1,self.arg0*2)
1388 d.setTaggedValue(10,self.arg0*3)
1389 d.setTaggedValue(100,self.arg0*4)
1390 self._diffDataObjects(d,filemame)
1391
1392 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank1(self):
1393 if loadIsConfigured():
1394 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank1.nc")
1395 d=Data(self.arg1,FunctionOnBoundary(self.domain))
1396 d.setTaggedValue(1,self.arg1*2)
1397 d.setTaggedValue(10,self.arg1*3)
1398 d.setTaggedValue(100,self.arg1*4)
1399 self._diffDataObjects(d,filemame)
1400
1401 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank2(self):
1402 if loadIsConfigured():
1403 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank2.nc")
1404 d=Data(self.arg2,FunctionOnBoundary(self.domain))
1405 d.setTaggedValue(1,self.arg2*2)
1406 d.setTaggedValue(10,self.arg2*3)
1407 d.setTaggedValue(100,self.arg2*4)
1408 self._diffDataObjects(d,filemame)
1409
1410 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank3(self):
1411 if loadIsConfigured():
1412 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank3.nc")
1413 d=Data(self.arg3,FunctionOnBoundary(self.domain))
1414 d.setTaggedValue(1,self.arg3*2)
1415 d.setTaggedValue(10,self.arg3*3)
1416 d.setTaggedValue(100,self.arg3*4)
1417 self._diffDataObjects(d,filemame)
1418
1419 def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank4(self):
1420 if loadIsConfigured():
1421 filemame=os.path.join(self.filename_base,"tagged_function_on_boundary_rank4.nc")
1422 d=Data(self.arg4,FunctionOnBoundary(self.domain))
1423 d.setTaggedValue(1,self.arg4*2)
1424 d.setTaggedValue(10,self.arg4*3)
1425 d.setTaggedValue(100,self.arg4*4)
1426 self._diffDataObjects(d,filemame)
1427 #===========================================================================
1428 def test_DumpAndLoad_Tagged_ReducedFunction_Rank0(self):
1429 if loadIsConfigured():
1430 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank0.nc")
1431 d=Data(self.arg0,ReducedFunction(self.domain))
1432 d.setTaggedValue(1,self.arg0*2)
1433 d.setTaggedValue(10,self.arg0*3)
1434 d.setTaggedValue(100,self.arg0*4)
1435 self._diffDataObjects(d,filemame)
1436
1437 def test_DumpAndLoad_Tagged_ReducedFunction_Rank1(self):
1438 if loadIsConfigured():
1439 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank1.nc")
1440 d=Data(self.arg1,ReducedFunction(self.domain))
1441 d.setTaggedValue(1,self.arg1*2)
1442 d.setTaggedValue(10,self.arg1*3)
1443 d.setTaggedValue(100,self.arg1*4)
1444 self._diffDataObjects(d,filemame)
1445
1446 def test_DumpAndLoad_Tagged_ReducedFunction_Rank2(self):
1447 if loadIsConfigured():
1448 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank2.nc")
1449 d=Data(self.arg2,ReducedFunction(self.domain))
1450 d.setTaggedValue(1,self.arg2*2)
1451 d.setTaggedValue(10,self.arg2*3)
1452 d.setTaggedValue(100,self.arg2*4)
1453 self._diffDataObjects(d,filemame)
1454
1455 def test_DumpAndLoad_Tagged_ReducedFunction_Rank3(self):
1456 if loadIsConfigured():
1457 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank3.nc")
1458 d=Data(self.arg3,ReducedFunction(self.domain))
1459 d.setTaggedValue(1,self.arg3*2)
1460 d.setTaggedValue(10,self.arg3*3)
1461 d.setTaggedValue(100,self.arg3*4)
1462 self._diffDataObjects(d,filemame)
1463
1464 def test_DumpAndLoad_Tagged_ReducedFunction_Rank4(self):
1465 if loadIsConfigured():
1466 filemame=os.path.join(self.filename_base,"tagged_reduced_function_rank4.nc")
1467 d=Data(self.arg4,ReducedFunction(self.domain))
1468 d.setTaggedValue(1,self.arg4*2)
1469 d.setTaggedValue(10,self.arg4*3)
1470 d.setTaggedValue(100,self.arg4*4)
1471 self._diffDataObjects(d,filemame)
1472
1473 #===========================================================================
1474 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank0(self):
1475 if loadIsConfigured():
1476 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank0.nc")
1477 d=Data(self.arg0,ReducedFunctionOnBoundary(self.domain))
1478 d.setTaggedValue(1,self.arg0*2)
1479 d.setTaggedValue(10,self.arg0*3)
1480 d.setTaggedValue(100,self.arg0*4)
1481 self._diffDataObjects(d,filemame)
1482
1483 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank1(self):
1484 if loadIsConfigured():
1485 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank1.nc")
1486 d=Data(self.arg1,ReducedFunctionOnBoundary(self.domain))
1487 d.setTaggedValue(1,self.arg1*2)
1488 d.setTaggedValue(10,self.arg1*3)
1489 d.setTaggedValue(100,self.arg1*4)
1490 self._diffDataObjects(d,filemame)
1491
1492 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank2(self):
1493 if loadIsConfigured():
1494 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank2.nc")
1495 d=Data(self.arg2,ReducedFunctionOnBoundary(self.domain))
1496 d.setTaggedValue(1,self.arg2*2)
1497 d.setTaggedValue(10,self.arg2*3)
1498 d.setTaggedValue(100,self.arg2*4)
1499 self._diffDataObjects(d,filemame)
1500
1501 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank3(self):
1502 if loadIsConfigured():
1503 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank3.nc")
1504 d=Data(self.arg3,ReducedFunctionOnBoundary(self.domain))
1505 d.setTaggedValue(1,self.arg3*2)
1506 d.setTaggedValue(10,self.arg3*3)
1507 d.setTaggedValue(100,self.arg3*4)
1508 self._diffDataObjects(d,filemame)
1509
1510 def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank4(self):
1511 if loadIsConfigured():
1512 filemame=os.path.join(self.filename_base,"tagged_reduced_function_on_boundary_rank4.nc")
1513 d=Data(self.arg4,ReducedFunctionOnBoundary(self.domain))
1514 d.setTaggedValue(1,self.arg4*2)
1515 d.setTaggedValue(10,self.arg4*3)
1516 d.setTaggedValue(100,self.arg4*4)
1517 self._diffDataObjects(d,filemame)
1518
1519 def test_canTag_Failures(self):
1520 d=Data(self.arg0,Solution(self.domain))
1521 self.failUnlessRaises(RuntimeError,d.setTaggedValue,1,self.arg0*2)
1522 d=Data(self.arg0,ReducedSolution(self.domain))
1523 self.failUnlessRaises(RuntimeError,d.setTaggedValue,1,self.arg0*2)
1524
1525 class Test_Lazy(unittest.TestCase):
1526 def makeLazyObj(self):
1527 d=delay(Data(1,self.mainfs,True))
1528 e=delay(Data(2,self.mainfs,True))
1529 p=(d+e*d)/e
1530 q=p/(3*d)
1531 r1=q*q
1532 r2=q+q
1533 r3=q/4
1534 f=delay(Data(4,self.otherfs,True))
1535 t=Data(4,self.mainfs)
1536 t.tag()
1537 t=delay(t)
1538 t=t*2
1539 return r1,r2,r3,f,t
1540
1541 def test_GroupRes(self):
1542 rr1,rr2,rr3,rf,rt=self.makeLazyObj()
1543 rr1=resolve(rr1)
1544 rr2=resolve(rr2)
1545 rr3=resolve(rr3)
1546 rf=resolve(rf)
1547 rt=resolve(rt)
1548 r1,r2,r3,f,t=self.makeLazyObj()
1549 resolveGroup((r1,r2,r3))
1550 err=Lsup(rr1-r1)+Lsup(rr2-r2)+Lsup(rr3-r3)
1551 self.failUnless(err<0.001, "Same functionspace group resolve")
1552 r1,r2,r3,f,t=self.makeLazyObj()
1553 resolveGroup((r1,r2,r3,rt))
1554 err=Lsup(rr1-r1)+Lsup(rr2-r2)+Lsup(rr3-r3)+Lsup(rt-t)
1555 self.failUnless(err<0.001, "Same functionspace group resolve with early collapse")
1556 r1,r2,r3,f,t=self.makeLazyObj()
1557 err=Lsup(rr1-r1)+Lsup(rr2-r2)+Lsup(rr3-r3)+Lsup(rt-t)+Lsup(rf-f)
1558 self.failUnless(err<0.001, "Same functionspace group resolve with mixed functionspaces")
1559
1560

  ViewVC Help
Powered by ViewVC 1.1.26