/[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 3892 - (show annotations)
Tue Apr 10 08:57:23 2012 UTC (6 years, 11 months ago) by jfenwick
File MIME type: text/x-python
File size: 90342 byte(s)
Merged changes across from the attempt2 branch.
This version builds and passes python2 tests.
It also passes most python3 tests.



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

  ViewVC Help
Powered by ViewVC 1.1.26