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