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

  ViewVC Help
Powered by ViewVC 1.1.26