/[escript]/trunk/escript/test/python/test_objects.py
ViewVC logotype

Annotation of /trunk/escript/test/python/test_objects.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1023 - (hide annotations)
Tue Mar 13 05:43:36 2007 UTC (15 years, 5 months ago) by gross
File MIME type: text/x-python
File size: 36458 byte(s)
netCDF can now be switched off at compilation. Consequently load and dump of data objects is not available then.
1 gross 983 # $Id:$
2     """
3     Test suite for data objects. at the moment for dump and load only.
4    
5     The tests must be linked with some function space class object in the setUp method:
6     to run the use:
7    
8     from esys.finley import Brick
9     class Test_DumpOnFinley(Test_Dump):
10     def setUp(self):
11     self.domain =Rectangle(NE,NE+1,2)
12     self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)
13     self.domain_with_different_number_of_data_points_per_sample =Rectangle(2*NE,NE+1,2,integrationOrder=2)
14     self.domain_with_different_sample_ordering =Rectangle(1,(NE+1)*NE,2)
15     self.filebase="."
16    
17     suite = unittest.TestSuite()
18     suite.addTest(unittest.makeSuite(Test_DumpOnFinley))
19     unittest.TextTestRunner(verbosity=2).run(suite)
20    
21     @var __author__: name of author
22     @var __copyright__: copyrights
23     @var __license__: licence agreement
24     @var __url__: url entry point on documentation
25     @var __version__: version
26     @var __date__: date of the version
27     """
28    
29     __author__="Lutz Gross, l.gross@uq.edu.au"
30     __copyright__=""" Copyright (c) 2006, 2007 by ACcESS MNRF
31     http://www.access.edu.au
32     Primary Business: Queensland, Australia"""
33     __license__="""Licensed under the Open Software License version 3.0
34     http://www.opensource.org/licenses/osl-3.0.php"""
35     __url__="http://www.iservo.edu.au/esys/escript"
36     __version__="$Revision:$"
37     __date__="$Date:$"
38    
39     import unittest
40     import os
41     import numarray
42     from esys.escript import *
43    
44     class Test_Dump(unittest.TestCase):
45     arg0=9.81
46     arg1=numarray.array([3.098, -3.111])
47     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]])
48     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]]])
49     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]]]])
50    
51     def _diffDataObjects(self,d_ref,file):
52     d_ref.dump(file)
53     d=load(file, self.domain)
54     self.failUnless(not d.isEmpty(),"data in %s are empty."%file)
55     self.failUnless(d_ref.getFunctionSpace() == d.getFunctionSpace(), "wrong function space in %s."%file)
56     self.failUnless(d_ref.getRank() == d.getRank(), "different rank in %s. "%file)
57     self.failUnless(d_ref.getShape() == d.getShape(), "different shape %s. "%file)
58     self.failUnless(Lsup(d_ref-d)<=0., "different entries %s."%file)
59    
60     #===========================================================================
61     def test_DumpAndLoad_Constant_Solution_Rank0(self):
62 gross 1023 if loadIsConfigured():
63     file=os.path.join(self.filebase,"constant_solution_rank0.nc")
64     d=Data(self.arg0,Solution(self.domain))
65     self._diffDataObjects(d,file)
66 gross 983
67     def test_DumpAndLoad_Constant_Solution_Rank1(self):
68 gross 1023 if loadIsConfigured():
69     file=os.path.join(self.filebase,"constant_solution_rank1.nc")
70     d=Data(self.arg1,Solution(self.domain))
71     self._diffDataObjects(d,file)
72 gross 983
73     def test_DumpAndLoad_Constant_Solution_Rank2(self):
74 gross 1023 if loadIsConfigured():
75     file=os.path.join(self.filebase,"constant_solution_rank2.nc")
76     d=Data(self.arg2,Solution(self.domain))
77     self._diffDataObjects(d,file)
78 gross 983
79     def test_DumpAndLoad_Constant_Solution_Rank3(self):
80 gross 1023 if loadIsConfigured():
81     file=os.path.join(self.filebase,"constant_solution_rank3.nc")
82     d=Data(self.arg3,Solution(self.domain))
83     self._diffDataObjects(d,file)
84 gross 983
85     def test_DumpAndLoad_Constant_Solution_Rank4(self):
86 gross 1023 if loadIsConfigured():
87     file=os.path.join(self.filebase,"constant_solution_rank4.nc")
88     d=Data(self.arg4,Solution(self.domain))
89     self._diffDataObjects(d,file)
90 gross 983 #===========================================================================
91     def test_DumpAndLoad_Constant_ReducedSolution_Rank0(self):
92 gross 1023 if loadIsConfigured():
93     file=os.path.join(self.filebase,"constant_reduced_solution_rank0.nc")
94     d=Data(self.arg0,ReducedSolution(self.domain))
95     self._diffDataObjects(d,file)
96 gross 983
97     def test_DumpAndLoad_Constant_ReducedSolution_Rank1(self):
98 gross 1023 if loadIsConfigured():
99     file=os.path.join(self.filebase,"constant_reduced_solution_rank1.nc")
100     d=Data(self.arg1,ReducedSolution(self.domain))
101     self._diffDataObjects(d,file)
102 gross 983
103     def test_DumpAndLoad_Constant_ReducedSolution_Rank2(self):
104 gross 1023 if loadIsConfigured():
105     file=os.path.join(self.filebase,"constant_reduced_solution_rank2.nc")
106     d=Data(self.arg2,ReducedSolution(self.domain))
107     self._diffDataObjects(d,file)
108 gross 983
109     def test_DumpAndLoad_Constant_ReducedSolution_Rank3(self):
110 gross 1023 if loadIsConfigured():
111     file=os.path.join(self.filebase,"constant_reduced_solution_rank3.nc")
112     d=Data(self.arg3,ReducedSolution(self.domain))
113     self._diffDataObjects(d,file)
114 gross 983
115     def test_DumpAndLoad_Constant_ReducedSolution_Rank4(self):
116 gross 1023 if loadIsConfigured():
117     file=os.path.join(self.filebase,"constant_reduced_solution_rank4.nc")
118     d=Data(self.arg4,ReducedSolution(self.domain))
119     self._diffDataObjects(d,file)
120 gross 983 #===========================================================================
121     def test_DumpAndLoad_Constant_ContinuousFunction_Rank0(self):
122 gross 1023 if loadIsConfigured():
123     file=os.path.join(self.filebase,"constant_continuous_function_rank0.nc")
124     d=Data(self.arg0,ContinuousFunction(self.domain))
125     self._diffDataObjects(d,file)
126 gross 983
127     def test_DumpAndLoad_Constant_ContinuousFunction_Rank1(self):
128 gross 1023 if loadIsConfigured():
129     file=os.path.join(self.filebase,"constant_continuous_function_rank1.nc")
130     d=Data(self.arg1,ContinuousFunction(self.domain))
131     self._diffDataObjects(d,file)
132 gross 983
133     def test_DumpAndLoad_Constant_ContinuousFunction_Rank2(self):
134 gross 1023 if loadIsConfigured():
135     file=os.path.join(self.filebase,"constant_continuous_function_rank2.nc")
136     d=Data(self.arg2,ContinuousFunction(self.domain))
137     self._diffDataObjects(d,file)
138 gross 983
139     def test_DumpAndLoad_Constant_ContinuousFunction_Rank3(self):
140 gross 1023 if loadIsConfigured():
141     file=os.path.join(self.filebase,"constant_continuous_function_rank3.nc")
142     d=Data(self.arg3,ContinuousFunction(self.domain))
143     self._diffDataObjects(d,file)
144 gross 983
145     def test_DumpAndLoad_Constant_ContinuousFunction_Rank4(self):
146 gross 1023 if loadIsConfigured():
147     file=os.path.join(self.filebase,"constant_continuous_function_rank4.nc")
148     d=Data(self.arg4,ContinuousFunction(self.domain))
149     self._diffDataObjects(d,file)
150 gross 983
151     #===========================================================================
152     def test_DumpAndLoad_Constant_Function_Rank0(self):
153 gross 1023 if loadIsConfigured():
154     file=os.path.join(self.filebase,"constant_function_rank0.nc")
155     d=Data(self.arg0,Function(self.domain))
156     self._diffDataObjects(d,file)
157 gross 983
158     def test_DumpAndLoad_Constant_Function_Rank1(self):
159 gross 1023 if loadIsConfigured():
160     file=os.path.join(self.filebase,"constant_function_rank1.nc")
161     d=Data(self.arg1,Function(self.domain))
162     self._diffDataObjects(d,file)
163 gross 983
164     def test_DumpAndLoad_Constant_Function_Rank2(self):
165 gross 1023 if loadIsConfigured():
166     file=os.path.join(self.filebase,"constant_function_rank2.nc")
167     d=Data(self.arg2,Function(self.domain))
168     self._diffDataObjects(d,file)
169 gross 983
170     def test_DumpAndLoad_Constant_Function_Rank3(self):
171 gross 1023 if loadIsConfigured():
172     file=os.path.join(self.filebase,"constant_function_rank3.nc")
173     d=Data(self.arg3,Function(self.domain))
174     self._diffDataObjects(d,file)
175 gross 983
176     def test_DumpAndLoad_Constant_Function_Rank4(self):
177 gross 1023 if loadIsConfigured():
178     file=os.path.join(self.filebase,"constant_function_rank4.nc")
179     d=Data(self.arg4,Function(self.domain))
180     self._diffDataObjects(d,file)
181 gross 983
182     #===========================================================================
183     def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank0(self):
184 gross 1023 if loadIsConfigured():
185     file=os.path.join(self.filebase,"constant_function_on_boundary_rank0.nc")
186     d=Data(self.arg0,FunctionOnBoundary(self.domain))
187     self._diffDataObjects(d,file)
188 gross 983
189     def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank1(self):
190 gross 1023 if loadIsConfigured():
191     file=os.path.join(self.filebase,"constant_function_on_boundary_rank1.nc")
192     d=Data(self.arg1,FunctionOnBoundary(self.domain))
193     self._diffDataObjects(d,file)
194 gross 983
195     def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank2(self):
196 gross 1023 if loadIsConfigured():
197     file=os.path.join(self.filebase,"constant_function_on_boundary_rank2.nc")
198     d=Data(self.arg2,FunctionOnBoundary(self.domain))
199     self._diffDataObjects(d,file)
200 gross 983
201     def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank3(self):
202 gross 1023 if loadIsConfigured():
203     file=os.path.join(self.filebase,"constant_function_on_boundary_rank3.nc")
204     d=Data(self.arg3,FunctionOnBoundary(self.domain))
205     self._diffDataObjects(d,file)
206 gross 983
207     def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank4(self):
208 gross 1023 if loadIsConfigured():
209     file=os.path.join(self.filebase,"constant_function_on_boundary_rank4.nc")
210     d=Data(self.arg4,FunctionOnBoundary(self.domain))
211     self._diffDataObjects(d,file)
212 gross 983
213     #===========================================================================
214     def test_DumpAndLoad_Expanded_Solution_Rank0(self):
215 gross 1023 if loadIsConfigured():
216     file=os.path.join(self.filebase,"expanded_solution_rank0.nc")
217     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
218     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
219     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
220     d=Data(length(Solution(self.domain).getX())*self.arg0,Solution(self.domain))
221     self._diffDataObjects(d,file)
222 gross 983
223     def test_DumpAndLoad_Expanded_Solution_Rank1(self):
224 gross 1023 if loadIsConfigured():
225     file=os.path.join(self.filebase,"expanded_solution_rank1.nc")
226     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
227     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
228     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
229     d=Data(length(Solution(self.domain).getX())*self.arg1,Solution(self.domain))
230     self._diffDataObjects(d,file)
231 gross 983
232     def test_DumpAndLoad_Expanded_Solution_Rank2(self):
233 gross 1023 if loadIsConfigured():
234     file=os.path.join(self.filebase,"expanded_solution_rank2.nc")
235     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
236     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
237     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
238     d=Data(length(Solution(self.domain).getX())*self.arg2,Solution(self.domain))
239     self._diffDataObjects(d,file)
240 gross 983
241     def test_DumpAndLoad_Expanded_Solution_Rank3(self):
242 gross 1023 if loadIsConfigured():
243     file=os.path.join(self.filebase,"expanded_solution_rank3.nc")
244     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
245     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
246     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
247     d=Data(length(Solution(self.domain).getX())*self.arg3,Solution(self.domain))
248     self._diffDataObjects(d,file)
249 gross 983
250     def test_DumpAndLoad_Expanded_Solution_Rank4(self):
251 gross 1023 if loadIsConfigured():
252     file=os.path.join(self.filebase,"expanded_solution_rank4.nc")
253     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
254     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
255     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
256     d=Data(length(Solution(self.domain).getX())*self.arg4,Solution(self.domain))
257     self._diffDataObjects(d,file)
258 gross 983 #===========================================================================
259     def test_DumpAndLoad_Expanded_ReducedSolution_Rank0(self):
260 gross 1023 if loadIsConfigured():
261     file=os.path.join(self.filebase,"expanded_reduced_solution_rank0.nc")
262     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
263     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
264     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
265     d=Data(length(ReducedSolution(self.domain).getX())*self.arg0,ReducedSolution(self.domain))
266     self._diffDataObjects(d,file)
267 gross 983
268     def test_DumpAndLoad_Expanded_ReducedSolution_Rank1(self):
269 gross 1023 if loadIsConfigured():
270     file=os.path.join(self.filebase,"expanded_reduced_solution_rank1.nc")
271     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
272     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
273     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
274     d=Data(length(ReducedSolution(self.domain).getX())*self.arg1,ReducedSolution(self.domain))
275     self._diffDataObjects(d,file)
276 gross 983
277     def test_DumpAndLoad_Expanded_ReducedSolution_Rank2(self):
278 gross 1023 if loadIsConfigured():
279     file=os.path.join(self.filebase,"expanded_reduced_solution_rank2.nc")
280     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
281     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
282     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
283     d=Data(length(ReducedSolution(self.domain).getX())*self.arg2,ReducedSolution(self.domain))
284     self._diffDataObjects(d,file)
285 gross 983
286     def test_DumpAndLoad_Expanded_ReducedSolution_Rank3(self):
287 gross 1023 if loadIsConfigured():
288     file=os.path.join(self.filebase,"expanded_reduced_solution_rank3.nc")
289     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
290     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
291     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
292     d=Data(length(ReducedSolution(self.domain).getX())*self.arg3,ReducedSolution(self.domain))
293     self._diffDataObjects(d,file)
294 gross 983
295     def test_DumpAndLoad_Expanded_ReducedSolution_Rank4(self):
296 gross 1023 if loadIsConfigured():
297     file=os.path.join(self.filebase,"expanded_reduced_solution_rank4.nc")
298     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
299     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
300     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
301     d=Data(length(ReducedSolution(self.domain).getX())*self.arg4,ReducedSolution(self.domain))
302     self._diffDataObjects(d,file)
303 gross 983 #===========================================================================
304     def test_DumpAndLoad_Expanded_ContinuousFunction_Rank0(self):
305 gross 1023 if loadIsConfigured():
306     file=os.path.join(self.filebase,"expanded_continuous_function_rank0.nc")
307     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
308     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
309     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
310     d=Data(length(ContinuousFunction(self.domain).getX())*self.arg0,ContinuousFunction(self.domain))
311     self._diffDataObjects(d,file)
312 gross 983
313     def test_DumpAndLoad_Expanded_ContinuousFunction_Rank1(self):
314 gross 1023 if loadIsConfigured():
315     file=os.path.join(self.filebase,"expanded_continuous_function_rank1.nc")
316     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
317     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
318     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
319     d=Data(length(ContinuousFunction(self.domain).getX())*self.arg1,ContinuousFunction(self.domain))
320     self._diffDataObjects(d,file)
321 gross 983
322     def test_DumpAndLoad_Expanded_ContinuousFunction_Rank2(self):
323 gross 1023 if loadIsConfigured():
324     file=os.path.join(self.filebase,"expanded_continuous_function_rank2.nc")
325     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
326     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
327     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
328     d=Data(length(ContinuousFunction(self.domain).getX())*self.arg2,ContinuousFunction(self.domain))
329     self._diffDataObjects(d,file)
330 gross 983
331     def test_DumpAndLoad_Expanded_ContinuousFunction_Rank3(self):
332 gross 1023 if loadIsConfigured():
333     file=os.path.join(self.filebase,"expanded_continuous_function_rank3.nc")
334     d=Data(length(ContinuousFunction(self.domain).getX())*self.arg3,ContinuousFunction(self.domain))
335     self._diffDataObjects(d,file)
336 gross 983
337     def test_DumpAndLoad_Expanded_ContinuousFunction_Rank4(self):
338 gross 1023 if loadIsConfigured():
339     file=os.path.join(self.filebase,"expanded_continuous_function_rank4.nc")
340     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
341     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
342     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
343     d=Data(length(ContinuousFunction(self.domain).getX())*self.arg4,ContinuousFunction(self.domain))
344     self._diffDataObjects(d,file)
345 gross 983
346     #===========================================================================
347     def test_DumpAndLoad_Expanded_Function_Rank0(self):
348 gross 1023 if loadIsConfigured():
349     file=os.path.join(self.filebase,"expanded_function_rank0.nc")
350     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
351     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
352     # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
353     d=Data(length(Function(self.domain).getX())*self.arg0,Function(self.domain))
354     self._diffDataObjects(d,file)
355 gross 983
356     def test_DumpAndLoad_Expanded_Function_Rank1(self):
357 gross 1023 if loadIsConfigured():
358     file=os.path.join(self.filebase,"expanded_function_rank1.nc")
359     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
360     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
361     # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
362     d=Data(length(Function(self.domain).getX())*self.arg1,Function(self.domain))
363     self._diffDataObjects(d,file)
364 gross 983
365     def test_DumpAndLoad_Expanded_Function_Rank2(self):
366 gross 1023 if loadIsConfigured():
367     file=os.path.join(self.filebase,"expanded_function_rank2.nc")
368     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
369     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
370     # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
371     d=Data(length(Function(self.domain).getX())*self.arg2,Function(self.domain))
372     self._diffDataObjects(d,file)
373 gross 983
374     def test_DumpAndLoad_Expanded_Function_Rank3(self):
375 gross 1023 if loadIsConfigured():
376     file=os.path.join(self.filebase,"expanded_function_rank3.nc")
377     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
378     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
379     # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
380     d=Data(length(Function(self.domain).getX())*self.arg3,Function(self.domain))
381     self._diffDataObjects(d,file)
382 gross 983
383     def test_DumpAndLoad_Expanded_Function_Rank4(self):
384 gross 1023 if loadIsConfigured():
385     file=os.path.join(self.filebase,"expanded_function_rank4.nc")
386     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
387     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
388     # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
389     d=Data(length(Function(self.domain).getX())*self.arg4,Function(self.domain))
390     self._diffDataObjects(d,file)
391 gross 983
392     #===========================================================================
393     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank0(self):
394 gross 1023 if loadIsConfigured():
395     file=os.path.join(self.filebase,"expanded_function_on_boundary_rank0.nc")
396     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
397     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
398     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
399     d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg0,FunctionOnBoundary(self.domain))
400     self._diffDataObjects(d,file)
401 gross 983
402     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank1(self):
403 gross 1023 if loadIsConfigured():
404     file=os.path.join(self.filebase,"expanded_function_on_boundary_rank1.nc")
405     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
406     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
407     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
408     d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg1,FunctionOnBoundary(self.domain))
409     self._diffDataObjects(d,file)
410 gross 983
411     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank2(self):
412 gross 1023 if loadIsConfigured():
413     file=os.path.join(self.filebase,"expanded_function_on_boundary_rank2.nc")
414     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
415     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
416     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
417     d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg2,FunctionOnBoundary(self.domain))
418     self._diffDataObjects(d,file)
419 gross 983
420     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank3(self):
421 gross 1023 if loadIsConfigured():
422     file=os.path.join(self.filebase,"expanded_function_on_boundary_rank3.nc")
423     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
424     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
425     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
426     d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg3,FunctionOnBoundary(self.domain))
427     self._diffDataObjects(d,file)
428 gross 983
429     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank4(self):
430 gross 1023 if loadIsConfigured():
431     file=os.path.join(self.filebase,"expanded_function_on_boundary_rank4.nc")
432     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
433     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
434     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
435     d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg4,FunctionOnBoundary(self.domain))
436     self._diffDataObjects(d,file)
437 gross 983
438     #===========================================================================
439     def test_DumpAndLoad_Tagged_Solution_Rank0(self):
440 gross 1023 if loadIsConfigured():
441     file=os.path.join(self.filebase,"tagged_solution_rank0.nc")
442     d=Data(self.arg0,Solution(self.domain))
443     d.setTaggedValue(1,self.arg0*2)
444     d.setTaggedValue(10,self.arg0*3)
445     d.setTaggedValue(100,self.arg0*4)
446     self._diffDataObjects(d,file)
447 gross 983
448     def test_DumpAndLoad_Tagged_Solution_Rank1(self):
449 gross 1023 if loadIsConfigured():
450     file=os.path.join(self.filebase,"tagged_solution_rank1.nc")
451     d=Data(self.arg1,Solution(self.domain))
452     d.setTaggedValue(1,self.arg1*2)
453     d.setTaggedValue(10,self.arg1*3)
454     d.setTaggedValue(100,self.arg1*4)
455     self._diffDataObjects(d,file)
456 gross 983
457     def test_DumpAndLoad_Tagged_Solution_Rank2(self):
458 gross 1023 if loadIsConfigured():
459     file=os.path.join(self.filebase,"tagged_solution_rank2.nc")
460     d=Data(self.arg2,Solution(self.domain))
461     d.setTaggedValue(1,self.arg2*2)
462     d.setTaggedValue(10,self.arg2*3)
463     d.setTaggedValue(100,self.arg2*4)
464     self._diffDataObjects(d,file)
465 gross 983
466     def test_DumpAndLoad_Tagged_Solution_Rank3(self):
467 gross 1023 if loadIsConfigured():
468     file=os.path.join(self.filebase,"tagged_solution_rank3.nc")
469     d=Data(self.arg3,Solution(self.domain))
470     d.setTaggedValue(1,self.arg3*2)
471     d.setTaggedValue(10,self.arg3*3)
472     d.setTaggedValue(100,self.arg3*4)
473     self._diffDataObjects(d,file)
474 gross 983
475     def test_DumpAndLoad_Tagged_Solution_Rank4(self):
476 gross 1023 if loadIsConfigured():
477     file=os.path.join(self.filebase,"tagged_solution_rank4.nc")
478     d=Data(self.arg4,Solution(self.domain))
479     d.setTaggedValue(1,self.arg4*2)
480     d.setTaggedValue(10,self.arg4*3)
481     d.setTaggedValue(100,self.arg4*4)
482     self._diffDataObjects(d,file)
483 gross 983 #===========================================================================
484     def test_DumpAndLoad_Tagged_ReducedSolution_Rank0(self):
485 gross 1023 if loadIsConfigured():
486     file=os.path.join(self.filebase,"tagged_reduced_solution_rank0.nc")
487     d=Data(self.arg0,ReducedSolution(self.domain))
488     d.setTaggedValue(1,self.arg0*2)
489     d.setTaggedValue(10,self.arg0*3)
490     d.setTaggedValue(100,self.arg0*4)
491     self._diffDataObjects(d,file)
492 gross 983
493     def test_DumpAndLoad_Tagged_ReducedSolution_Rank1(self):
494 gross 1023 if loadIsConfigured():
495     file=os.path.join(self.filebase,"tagged_reduced_solution_rank1.nc")
496     d=Data(self.arg1,ReducedSolution(self.domain))
497     d.setTaggedValue(1,self.arg1*2)
498     d.setTaggedValue(10,self.arg1*3)
499     d.setTaggedValue(100,self.arg1*4)
500     self._diffDataObjects(d,file)
501 gross 983
502     def test_DumpAndLoad_Tagged_ReducedSolution_Rank2(self):
503 gross 1023 if loadIsConfigured():
504     file=os.path.join(self.filebase,"tagged_reduced_solution_rank2.nc")
505     d=Data(self.arg2,ReducedSolution(self.domain))
506     d.setTaggedValue(1,self.arg2*2)
507     d.setTaggedValue(10,self.arg2*3)
508     d.setTaggedValue(100,self.arg2*4)
509     self._diffDataObjects(d,file)
510 gross 983
511     def test_DumpAndLoad_Tagged_ReducedSolution_Rank3(self):
512 gross 1023 if loadIsConfigured():
513     file=os.path.join(self.filebase,"tagged_reduced_solution_rank3.nc")
514     d=Data(self.arg3,ReducedSolution(self.domain))
515     d.setTaggedValue(1,self.arg3*2)
516     d.setTaggedValue(10,self.arg3*3)
517     d.setTaggedValue(100,self.arg3*4)
518     self._diffDataObjects(d,file)
519 gross 983
520     def test_DumpAndLoad_Tagged_ReducedSolution_Rank4(self):
521 gross 1023 if loadIsConfigured():
522     file=os.path.join(self.filebase,"tagged_reduced_solution_rank4.nc")
523     d=Data(self.arg4,ReducedSolution(self.domain))
524     d.setTaggedValue(1,self.arg4*2)
525     d.setTaggedValue(10,self.arg4*3)
526     d.setTaggedValue(100,self.arg4*4)
527     self._diffDataObjects(d,file)
528 gross 983 #===========================================================================
529     def test_DumpAndLoad_Tagged_ContinuousFunction_Rank0(self):
530 gross 1023 if loadIsConfigured():
531     file=os.path.join(self.filebase,"tagged_continuous_function_rank0.nc")
532     d=Data(self.arg0,ContinuousFunction(self.domain))
533     d.setTaggedValue(1,self.arg0*2)
534     d.setTaggedValue(10,self.arg0*3)
535     d.setTaggedValue(100,self.arg0*4)
536     self._diffDataObjects(d,file)
537 gross 983
538     def test_DumpAndLoad_Tagged_ContinuousFunction_Rank1(self):
539 gross 1023 if loadIsConfigured():
540     file=os.path.join(self.filebase,"tagged_continuous_function_rank1.nc")
541     d=Data(self.arg1,ContinuousFunction(self.domain))
542     d.setTaggedValue(1,self.arg1*2)
543     d.setTaggedValue(10,self.arg1*3)
544     d.setTaggedValue(100,self.arg1*4)
545     self._diffDataObjects(d,file)
546 gross 983
547     def test_DumpAndLoad_Tagged_ContinuousFunction_Rank2(self):
548 gross 1023 if loadIsConfigured():
549     file=os.path.join(self.filebase,"tagged_continuous_function_rank2.nc")
550     d=Data(self.arg2,ContinuousFunction(self.domain))
551     d.setTaggedValue(1,self.arg2*2)
552     d.setTaggedValue(10,self.arg2*3)
553     d.setTaggedValue(100,self.arg2*4)
554     self._diffDataObjects(d,file)
555 gross 983
556     def test_DumpAndLoad_Tagged_ContinuousFunction_Rank3(self):
557 gross 1023 if loadIsConfigured():
558     file=os.path.join(self.filebase,"tagged_continuous_function_rank3.nc")
559     d=Data(self.arg3,ContinuousFunction(self.domain))
560     d.setTaggedValue(1,self.arg3*2)
561     d.setTaggedValue(10,self.arg3*3)
562     d.setTaggedValue(100,self.arg3*4)
563     self._diffDataObjects(d,file)
564 gross 983
565     def test_DumpAndLoad_Tagged_ContinuousFunction_Rank4(self):
566 gross 1023 if loadIsConfigured():
567     file=os.path.join(self.filebase,"tagged_continuous_function_rank4.nc")
568     d=Data(self.arg4,ContinuousFunction(self.domain))
569     d.setTaggedValue(1,self.arg4*2)
570     d.setTaggedValue(10,self.arg4*3)
571     d.setTaggedValue(100,self.arg4*4)
572     self._diffDataObjects(d,file)
573 gross 983
574     #===========================================================================
575     def test_DumpAndLoad_Tagged_Function_Rank0(self):
576 gross 1023 if loadIsConfigured():
577     file=os.path.join(self.filebase,"tagged_function_rank0.nc")
578     d=Data(self.arg0,Function(self.domain))
579     d.setTaggedValue(1,self.arg0*2)
580     d.setTaggedValue(10,self.arg0*3)
581     d.setTaggedValue(100,self.arg0*4)
582     self._diffDataObjects(d,file)
583 gross 983
584     def test_DumpAndLoad_Tagged_Function_Rank1(self):
585 gross 1023 if loadIsConfigured():
586     file=os.path.join(self.filebase,"tagged_function_rank1.nc")
587     d=Data(self.arg1,Function(self.domain))
588     d.setTaggedValue(1,self.arg1*2)
589     d.setTaggedValue(10,self.arg1*3)
590     d.setTaggedValue(100,self.arg1*4)
591     self._diffDataObjects(d,file)
592 gross 983
593     def test_DumpAndLoad_Tagged_Function_Rank2(self):
594 gross 1023 if loadIsConfigured():
595     file=os.path.join(self.filebase,"tagged_function_rank2.nc")
596     d=Data(self.arg2,Function(self.domain))
597     d.setTaggedValue(1,self.arg2*2)
598     d.setTaggedValue(10,self.arg2*3)
599     d.setTaggedValue(100,self.arg2*4)
600     self._diffDataObjects(d,file)
601 gross 983
602     def test_DumpAndLoad_Tagged_Function_Rank3(self):
603 gross 1023 if loadIsConfigured():
604     file=os.path.join(self.filebase,"tagged_function_rank3.nc")
605     d=Data(self.arg3,Function(self.domain))
606     d.setTaggedValue(1,self.arg3*2)
607     d.setTaggedValue(10,self.arg3*3)
608     d.setTaggedValue(100,self.arg3*4)
609     self._diffDataObjects(d,file)
610 gross 983
611     def test_DumpAndLoad_Tagged_Function_Rank4(self):
612 gross 1023 if loadIsConfigured():
613     file=os.path.join(self.filebase,"tagged_function_rank4.nc")
614     d=Data(self.arg4,Function(self.domain))
615     d.setTaggedValue(1,self.arg4*2)
616     d.setTaggedValue(10,self.arg4*3)
617     d.setTaggedValue(100,self.arg4*4)
618     self._diffDataObjects(d,file)
619 gross 983
620     #===========================================================================
621     def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank0(self):
622 gross 1023 if loadIsConfigured():
623     file=os.path.join(self.filebase,"tagged_function_on_boundary_rank0.nc")
624     d=Data(self.arg0,FunctionOnBoundary(self.domain))
625     d.setTaggedValue(1,self.arg0*2)
626     d.setTaggedValue(10,self.arg0*3)
627     d.setTaggedValue(100,self.arg0*4)
628     self._diffDataObjects(d,file)
629 gross 983
630     def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank1(self):
631 gross 1023 if loadIsConfigured():
632     file=os.path.join(self.filebase,"tagged_function_on_boundary_rank1.nc")
633     d=Data(self.arg1,FunctionOnBoundary(self.domain))
634     d.setTaggedValue(1,self.arg1*2)
635     d.setTaggedValue(10,self.arg1*3)
636     d.setTaggedValue(100,self.arg1*4)
637     self._diffDataObjects(d,file)
638 gross 983
639     def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank2(self):
640 gross 1023 if loadIsConfigured():
641     file=os.path.join(self.filebase,"tagged_function_on_boundary_rank2.nc")
642     d=Data(self.arg2,FunctionOnBoundary(self.domain))
643     d.setTaggedValue(1,self.arg2*2)
644     d.setTaggedValue(10,self.arg2*3)
645     d.setTaggedValue(100,self.arg2*4)
646     self._diffDataObjects(d,file)
647 gross 983
648     def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank3(self):
649 gross 1023 if loadIsConfigured():
650     file=os.path.join(self.filebase,"tagged_function_on_boundary_rank3.nc")
651     d=Data(self.arg3,FunctionOnBoundary(self.domain))
652     d.setTaggedValue(1,self.arg3*2)
653     d.setTaggedValue(10,self.arg3*3)
654     d.setTaggedValue(100,self.arg3*4)
655     self._diffDataObjects(d,file)
656 gross 983
657     def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank4(self):
658 gross 1023 if loadIsConfigured():
659     file=os.path.join(self.filebase,"tagged_function_on_boundary_rank4.nc")
660     d=Data(self.arg4,FunctionOnBoundary(self.domain))
661     d.setTaggedValue(1,self.arg4*2)
662     d.setTaggedValue(10,self.arg4*3)
663     d.setTaggedValue(100,self.arg4*4)
664     self._diffDataObjects(d,file)
665 gross 983

  ViewVC Help
Powered by ViewVC 1.1.26