/[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 983 - (hide annotations)
Tue Feb 20 02:49:08 2007 UTC (15 years, 5 months ago) by gross
File MIME type: text/x-python
File size: 33497 byte(s)
full Data object dump and load now available. Tests added.
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     file=os.path.join(self.filebase,"constant_solution_rank0.nc")
63     d=Data(self.arg0,Solution(self.domain))
64     self._diffDataObjects(d,file)
65    
66     def test_DumpAndLoad_Constant_Solution_Rank1(self):
67     file=os.path.join(self.filebase,"constant_solution_rank1.nc")
68     d=Data(self.arg1,Solution(self.domain))
69     self._diffDataObjects(d,file)
70    
71     def test_DumpAndLoad_Constant_Solution_Rank2(self):
72     file=os.path.join(self.filebase,"constant_solution_rank2.nc")
73     d=Data(self.arg2,Solution(self.domain))
74     self._diffDataObjects(d,file)
75    
76     def test_DumpAndLoad_Constant_Solution_Rank3(self):
77     file=os.path.join(self.filebase,"constant_solution_rank3.nc")
78     d=Data(self.arg3,Solution(self.domain))
79     self._diffDataObjects(d,file)
80    
81     def test_DumpAndLoad_Constant_Solution_Rank4(self):
82     file=os.path.join(self.filebase,"constant_solution_rank4.nc")
83     d=Data(self.arg4,Solution(self.domain))
84     self._diffDataObjects(d,file)
85     #===========================================================================
86     def test_DumpAndLoad_Constant_ReducedSolution_Rank0(self):
87     file=os.path.join(self.filebase,"constant_reduced_solution_rank0.nc")
88     d=Data(self.arg0,ReducedSolution(self.domain))
89     self._diffDataObjects(d,file)
90    
91     def test_DumpAndLoad_Constant_ReducedSolution_Rank1(self):
92     file=os.path.join(self.filebase,"constant_reduced_solution_rank1.nc")
93     d=Data(self.arg1,ReducedSolution(self.domain))
94     self._diffDataObjects(d,file)
95    
96     def test_DumpAndLoad_Constant_ReducedSolution_Rank2(self):
97     file=os.path.join(self.filebase,"constant_reduced_solution_rank2.nc")
98     d=Data(self.arg2,ReducedSolution(self.domain))
99     self._diffDataObjects(d,file)
100    
101     def test_DumpAndLoad_Constant_ReducedSolution_Rank3(self):
102     file=os.path.join(self.filebase,"constant_reduced_solution_rank3.nc")
103     d=Data(self.arg3,ReducedSolution(self.domain))
104     self._diffDataObjects(d,file)
105    
106     def test_DumpAndLoad_Constant_ReducedSolution_Rank4(self):
107     file=os.path.join(self.filebase,"constant_reduced_solution_rank4.nc")
108     d=Data(self.arg4,ReducedSolution(self.domain))
109     self._diffDataObjects(d,file)
110     #===========================================================================
111     def test_DumpAndLoad_Constant_ContinuousFunction_Rank0(self):
112     file=os.path.join(self.filebase,"constant_continuous_function_rank0.nc")
113     d=Data(self.arg0,ContinuousFunction(self.domain))
114     self._diffDataObjects(d,file)
115    
116     def test_DumpAndLoad_Constant_ContinuousFunction_Rank1(self):
117     file=os.path.join(self.filebase,"constant_continuous_function_rank1.nc")
118     d=Data(self.arg1,ContinuousFunction(self.domain))
119     self._diffDataObjects(d,file)
120    
121     def test_DumpAndLoad_Constant_ContinuousFunction_Rank2(self):
122     file=os.path.join(self.filebase,"constant_continuous_function_rank2.nc")
123     d=Data(self.arg2,ContinuousFunction(self.domain))
124     self._diffDataObjects(d,file)
125    
126     def test_DumpAndLoad_Constant_ContinuousFunction_Rank3(self):
127     file=os.path.join(self.filebase,"constant_continuous_function_rank3.nc")
128     d=Data(self.arg3,ContinuousFunction(self.domain))
129     self._diffDataObjects(d,file)
130    
131     def test_DumpAndLoad_Constant_ContinuousFunction_Rank4(self):
132     file=os.path.join(self.filebase,"constant_continuous_function_rank4.nc")
133     d=Data(self.arg4,ContinuousFunction(self.domain))
134     self._diffDataObjects(d,file)
135    
136     #===========================================================================
137     def test_DumpAndLoad_Constant_Function_Rank0(self):
138     file=os.path.join(self.filebase,"constant_function_rank0.nc")
139     d=Data(self.arg0,Function(self.domain))
140     self._diffDataObjects(d,file)
141    
142     def test_DumpAndLoad_Constant_Function_Rank1(self):
143     file=os.path.join(self.filebase,"constant_function_rank1.nc")
144     d=Data(self.arg1,Function(self.domain))
145     self._diffDataObjects(d,file)
146    
147     def test_DumpAndLoad_Constant_Function_Rank2(self):
148     file=os.path.join(self.filebase,"constant_function_rank2.nc")
149     d=Data(self.arg2,Function(self.domain))
150     self._diffDataObjects(d,file)
151    
152     def test_DumpAndLoad_Constant_Function_Rank3(self):
153     file=os.path.join(self.filebase,"constant_function_rank3.nc")
154     d=Data(self.arg3,Function(self.domain))
155     self._diffDataObjects(d,file)
156    
157     def test_DumpAndLoad_Constant_Function_Rank4(self):
158     file=os.path.join(self.filebase,"constant_function_rank4.nc")
159     d=Data(self.arg4,Function(self.domain))
160     self._diffDataObjects(d,file)
161    
162     #===========================================================================
163     def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank0(self):
164     file=os.path.join(self.filebase,"constant_function_on_boundary_rank0.nc")
165     d=Data(self.arg0,FunctionOnBoundary(self.domain))
166     self._diffDataObjects(d,file)
167    
168     def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank1(self):
169     file=os.path.join(self.filebase,"constant_function_on_boundary_rank1.nc")
170     d=Data(self.arg1,FunctionOnBoundary(self.domain))
171     self._diffDataObjects(d,file)
172    
173     def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank2(self):
174     file=os.path.join(self.filebase,"constant_function_on_boundary_rank2.nc")
175     d=Data(self.arg2,FunctionOnBoundary(self.domain))
176     self._diffDataObjects(d,file)
177    
178     def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank3(self):
179     file=os.path.join(self.filebase,"constant_function_on_boundary_rank3.nc")
180     d=Data(self.arg3,FunctionOnBoundary(self.domain))
181     self._diffDataObjects(d,file)
182    
183     def test_DumpAndLoad_Constant_FunctionOnBoundary_Rank4(self):
184     file=os.path.join(self.filebase,"constant_function_on_boundary_rank4.nc")
185     d=Data(self.arg4,FunctionOnBoundary(self.domain))
186     self._diffDataObjects(d,file)
187    
188     #===========================================================================
189     def test_DumpAndLoad_Expanded_Solution_Rank0(self):
190     file=os.path.join(self.filebase,"expanded_solution_rank0.nc")
191     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
192     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
193     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
194     d=Data(length(Solution(self.domain).getX())*self.arg0,Solution(self.domain))
195     self._diffDataObjects(d,file)
196    
197     def test_DumpAndLoad_Expanded_Solution_Rank1(self):
198     file=os.path.join(self.filebase,"expanded_solution_rank1.nc")
199     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
200     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
201     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
202     d=Data(length(Solution(self.domain).getX())*self.arg1,Solution(self.domain))
203     self._diffDataObjects(d,file)
204    
205     def test_DumpAndLoad_Expanded_Solution_Rank2(self):
206     file=os.path.join(self.filebase,"expanded_solution_rank2.nc")
207     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
208     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
209     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
210     d=Data(length(Solution(self.domain).getX())*self.arg2,Solution(self.domain))
211     self._diffDataObjects(d,file)
212    
213     def test_DumpAndLoad_Expanded_Solution_Rank3(self):
214     file=os.path.join(self.filebase,"expanded_solution_rank3.nc")
215     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
216     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
217     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
218     d=Data(length(Solution(self.domain).getX())*self.arg3,Solution(self.domain))
219     self._diffDataObjects(d,file)
220    
221     def test_DumpAndLoad_Expanded_Solution_Rank4(self):
222     file=os.path.join(self.filebase,"expanded_solution_rank4.nc")
223     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
224     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
225     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
226     d=Data(length(Solution(self.domain).getX())*self.arg4,Solution(self.domain))
227     self._diffDataObjects(d,file)
228     #===========================================================================
229     def test_DumpAndLoad_Expanded_ReducedSolution_Rank0(self):
230     file=os.path.join(self.filebase,"expanded_reduced_solution_rank0.nc")
231     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
232     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
233     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
234     d=Data(length(ReducedSolution(self.domain).getX())*self.arg0,ReducedSolution(self.domain))
235     self._diffDataObjects(d,file)
236    
237     def test_DumpAndLoad_Expanded_ReducedSolution_Rank1(self):
238     file=os.path.join(self.filebase,"expanded_reduced_solution_rank1.nc")
239     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
240     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
241     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
242     d=Data(length(ReducedSolution(self.domain).getX())*self.arg1,ReducedSolution(self.domain))
243     self._diffDataObjects(d,file)
244    
245     def test_DumpAndLoad_Expanded_ReducedSolution_Rank2(self):
246     file=os.path.join(self.filebase,"expanded_reduced_solution_rank2.nc")
247     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
248     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
249     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
250     d=Data(length(ReducedSolution(self.domain).getX())*self.arg2,ReducedSolution(self.domain))
251     self._diffDataObjects(d,file)
252    
253     def test_DumpAndLoad_Expanded_ReducedSolution_Rank3(self):
254     file=os.path.join(self.filebase,"expanded_reduced_solution_rank3.nc")
255     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
256     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
257     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
258     d=Data(length(ReducedSolution(self.domain).getX())*self.arg3,ReducedSolution(self.domain))
259     self._diffDataObjects(d,file)
260    
261     def test_DumpAndLoad_Expanded_ReducedSolution_Rank4(self):
262     file=os.path.join(self.filebase,"expanded_reduced_solution_rank4.nc")
263     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
264     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
265     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
266     d=Data(length(ReducedSolution(self.domain).getX())*self.arg4,ReducedSolution(self.domain))
267     self._diffDataObjects(d,file)
268     #===========================================================================
269     def test_DumpAndLoad_Expanded_ContinuousFunction_Rank0(self):
270     file=os.path.join(self.filebase,"expanded_continuous_function_rank0.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(ContinuousFunction(self.domain).getX())*self.arg0,ContinuousFunction(self.domain))
275     self._diffDataObjects(d,file)
276    
277     def test_DumpAndLoad_Expanded_ContinuousFunction_Rank1(self):
278     file=os.path.join(self.filebase,"expanded_continuous_function_rank1.nc")
279     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
280     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
281     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
282     d=Data(length(ContinuousFunction(self.domain).getX())*self.arg1,ContinuousFunction(self.domain))
283     self._diffDataObjects(d,file)
284    
285     def test_DumpAndLoad_Expanded_ContinuousFunction_Rank2(self):
286     file=os.path.join(self.filebase,"expanded_continuous_function_rank2.nc")
287     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
288     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
289     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
290     d=Data(length(ContinuousFunction(self.domain).getX())*self.arg2,ContinuousFunction(self.domain))
291     self._diffDataObjects(d,file)
292    
293     def test_DumpAndLoad_Expanded_ContinuousFunction_Rank3(self):
294     file=os.path.join(self.filebase,"expanded_continuous_function_rank3.nc")
295     d=Data(length(ContinuousFunction(self.domain).getX())*self.arg3,ContinuousFunction(self.domain))
296     self._diffDataObjects(d,file)
297    
298     def test_DumpAndLoad_Expanded_ContinuousFunction_Rank4(self):
299     file=os.path.join(self.filebase,"expanded_continuous_function_rank4.nc")
300     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
301     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
302     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
303     d=Data(length(ContinuousFunction(self.domain).getX())*self.arg4,ContinuousFunction(self.domain))
304     self._diffDataObjects(d,file)
305    
306     #===========================================================================
307     def test_DumpAndLoad_Expanded_Function_Rank0(self):
308     file=os.path.join(self.filebase,"expanded_function_rank0.nc")
309     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
310     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
311     # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
312     d=Data(length(Function(self.domain).getX())*self.arg0,Function(self.domain))
313     self._diffDataObjects(d,file)
314    
315     def test_DumpAndLoad_Expanded_Function_Rank1(self):
316     file=os.path.join(self.filebase,"expanded_function_rank1.nc")
317     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
318     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
319     # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
320     d=Data(length(Function(self.domain).getX())*self.arg1,Function(self.domain))
321     self._diffDataObjects(d,file)
322    
323     def test_DumpAndLoad_Expanded_Function_Rank2(self):
324     file=os.path.join(self.filebase,"expanded_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     # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
328     d=Data(length(Function(self.domain).getX())*self.arg2,Function(self.domain))
329     self._diffDataObjects(d,file)
330    
331     def test_DumpAndLoad_Expanded_Function_Rank3(self):
332     file=os.path.join(self.filebase,"expanded_function_rank3.nc")
333     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
334     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
335     # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
336     d=Data(length(Function(self.domain).getX())*self.arg3,Function(self.domain))
337     self._diffDataObjects(d,file)
338    
339     def test_DumpAndLoad_Expanded_Function_Rank4(self):
340     file=os.path.join(self.filebase,"expanded_function_rank4.nc")
341     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
342     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
343     # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
344     d=Data(length(Function(self.domain).getX())*self.arg4,Function(self.domain))
345     self._diffDataObjects(d,file)
346    
347     #===========================================================================
348     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank0(self):
349     file=os.path.join(self.filebase,"expanded_function_on_boundary_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     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
353     d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg0,FunctionOnBoundary(self.domain))
354     self._diffDataObjects(d,file)
355    
356     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank1(self):
357     file=os.path.join(self.filebase,"expanded_function_on_boundary_rank1.nc")
358     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
359     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
360     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
361     d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg1,FunctionOnBoundary(self.domain))
362     self._diffDataObjects(d,file)
363    
364     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank2(self):
365     file=os.path.join(self.filebase,"expanded_function_on_boundary_rank2.nc")
366     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
367     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
368     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
369     d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg2,FunctionOnBoundary(self.domain))
370     self._diffDataObjects(d,file)
371    
372     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank3(self):
373     file=os.path.join(self.filebase,"expanded_function_on_boundary_rank3.nc")
374     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
375     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
376     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
377     d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg3,FunctionOnBoundary(self.domain))
378     self._diffDataObjects(d,file)
379    
380     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank4(self):
381     file=os.path.join(self.filebase,"expanded_function_on_boundary_rank4.nc")
382     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
383     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
384     self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
385     d=Data(length(FunctionOnBoundary(self.domain).getX())*self.arg4,FunctionOnBoundary(self.domain))
386     self._diffDataObjects(d,file)
387    
388     #===========================================================================
389     def test_DumpAndLoad_Tagged_Solution_Rank0(self):
390     file=os.path.join(self.filebase,"tagged_solution_rank0.nc")
391     d=Data(self.arg0,Solution(self.domain))
392     d.setTaggedValue(1,self.arg0*2)
393     d.setTaggedValue(10,self.arg0*3)
394     d.setTaggedValue(100,self.arg0*4)
395     self._diffDataObjects(d,file)
396    
397     #===========================================================================
398     def test_DumpAndLoad_Tagged_Solution_Rank0(self):
399     file=os.path.join(self.filebase,"tagged_solution_rank0.nc")
400     d=Data(self.arg0,Solution(self.domain))
401     d.setTaggedValue(1,self.arg0*2)
402     d.setTaggedValue(10,self.arg0*3)
403     d.setTaggedValue(100,self.arg0*4)
404     self._diffDataObjects(d,file)
405    
406     def test_DumpAndLoad_Tagged_Solution_Rank1(self):
407     file=os.path.join(self.filebase,"tagged_solution_rank1.nc")
408     d=Data(self.arg1,Solution(self.domain))
409     d.setTaggedValue(1,self.arg1*2)
410     d.setTaggedValue(10,self.arg1*3)
411     d.setTaggedValue(100,self.arg1*4)
412     self._diffDataObjects(d,file)
413    
414     def test_DumpAndLoad_Tagged_Solution_Rank2(self):
415     file=os.path.join(self.filebase,"tagged_solution_rank2.nc")
416     d=Data(self.arg2,Solution(self.domain))
417     d.setTaggedValue(1,self.arg2*2)
418     d.setTaggedValue(10,self.arg2*3)
419     d.setTaggedValue(100,self.arg2*4)
420     self._diffDataObjects(d,file)
421    
422     def test_DumpAndLoad_Tagged_Solution_Rank3(self):
423     file=os.path.join(self.filebase,"tagged_solution_rank3.nc")
424     d=Data(self.arg3,Solution(self.domain))
425     d.setTaggedValue(1,self.arg3*2)
426     d.setTaggedValue(10,self.arg3*3)
427     d.setTaggedValue(100,self.arg3*4)
428     self._diffDataObjects(d,file)
429    
430     def test_DumpAndLoad_Tagged_Solution_Rank4(self):
431     file=os.path.join(self.filebase,"tagged_solution_rank4.nc")
432     d=Data(self.arg4,Solution(self.domain))
433     d.setTaggedValue(1,self.arg4*2)
434     d.setTaggedValue(10,self.arg4*3)
435     d.setTaggedValue(100,self.arg4*4)
436     self._diffDataObjects(d,file)
437     #===========================================================================
438     def test_DumpAndLoad_Tagged_ReducedSolution_Rank0(self):
439     file=os.path.join(self.filebase,"tagged_reduced_solution_rank0.nc")
440     d=Data(self.arg0,ReducedSolution(self.domain))
441     d.setTaggedValue(1,self.arg0*2)
442     d.setTaggedValue(10,self.arg0*3)
443     d.setTaggedValue(100,self.arg0*4)
444     self._diffDataObjects(d,file)
445    
446     def test_DumpAndLoad_Tagged_ReducedSolution_Rank1(self):
447     file=os.path.join(self.filebase,"tagged_reduced_solution_rank1.nc")
448     d=Data(self.arg1,ReducedSolution(self.domain))
449     d.setTaggedValue(1,self.arg1*2)
450     d.setTaggedValue(10,self.arg1*3)
451     d.setTaggedValue(100,self.arg1*4)
452     self._diffDataObjects(d,file)
453    
454     def test_DumpAndLoad_Tagged_ReducedSolution_Rank2(self):
455     file=os.path.join(self.filebase,"tagged_reduced_solution_rank2.nc")
456     d=Data(self.arg2,ReducedSolution(self.domain))
457     d.setTaggedValue(1,self.arg2*2)
458     d.setTaggedValue(10,self.arg2*3)
459     d.setTaggedValue(100,self.arg2*4)
460     self._diffDataObjects(d,file)
461    
462     def test_DumpAndLoad_Tagged_ReducedSolution_Rank3(self):
463     file=os.path.join(self.filebase,"tagged_reduced_solution_rank3.nc")
464     d=Data(self.arg3,ReducedSolution(self.domain))
465     d.setTaggedValue(1,self.arg3*2)
466     d.setTaggedValue(10,self.arg3*3)
467     d.setTaggedValue(100,self.arg3*4)
468     self._diffDataObjects(d,file)
469    
470     def test_DumpAndLoad_Tagged_ReducedSolution_Rank4(self):
471     file=os.path.join(self.filebase,"tagged_reduced_solution_rank4.nc")
472     d=Data(self.arg4,ReducedSolution(self.domain))
473     d.setTaggedValue(1,self.arg4*2)
474     d.setTaggedValue(10,self.arg4*3)
475     d.setTaggedValue(100,self.arg4*4)
476     self._diffDataObjects(d,file)
477     #===========================================================================
478     def test_DumpAndLoad_Tagged_ContinuousFunction_Rank0(self):
479     file=os.path.join(self.filebase,"tagged_continuous_function_rank0.nc")
480     d=Data(self.arg0,ContinuousFunction(self.domain))
481     d.setTaggedValue(1,self.arg0*2)
482     d.setTaggedValue(10,self.arg0*3)
483     d.setTaggedValue(100,self.arg0*4)
484     self._diffDataObjects(d,file)
485    
486     def test_DumpAndLoad_Tagged_ContinuousFunction_Rank1(self):
487     file=os.path.join(self.filebase,"tagged_continuous_function_rank1.nc")
488     d=Data(self.arg1,ContinuousFunction(self.domain))
489     d.setTaggedValue(1,self.arg1*2)
490     d.setTaggedValue(10,self.arg1*3)
491     d.setTaggedValue(100,self.arg1*4)
492     self._diffDataObjects(d,file)
493    
494     def test_DumpAndLoad_Tagged_ContinuousFunction_Rank2(self):
495     file=os.path.join(self.filebase,"tagged_continuous_function_rank2.nc")
496     d=Data(self.arg2,ContinuousFunction(self.domain))
497     d.setTaggedValue(1,self.arg2*2)
498     d.setTaggedValue(10,self.arg2*3)
499     d.setTaggedValue(100,self.arg2*4)
500     self._diffDataObjects(d,file)
501    
502     def test_DumpAndLoad_Tagged_ContinuousFunction_Rank3(self):
503     file=os.path.join(self.filebase,"tagged_continuous_function_rank3.nc")
504     d=Data(self.arg3,ContinuousFunction(self.domain))
505     d.setTaggedValue(1,self.arg3*2)
506     d.setTaggedValue(10,self.arg3*3)
507     d.setTaggedValue(100,self.arg3*4)
508     self._diffDataObjects(d,file)
509    
510     def test_DumpAndLoad_Tagged_ContinuousFunction_Rank4(self):
511     file=os.path.join(self.filebase,"tagged_continuous_function_rank4.nc")
512     d=Data(self.arg4,ContinuousFunction(self.domain))
513     d.setTaggedValue(1,self.arg4*2)
514     d.setTaggedValue(10,self.arg4*3)
515     d.setTaggedValue(100,self.arg4*4)
516     self._diffDataObjects(d,file)
517    
518     #===========================================================================
519     def test_DumpAndLoad_Tagged_Function_Rank0(self):
520     file=os.path.join(self.filebase,"tagged_function_rank0.nc")
521     d=Data(self.arg0,Function(self.domain))
522     d.setTaggedValue(1,self.arg0*2)
523     d.setTaggedValue(10,self.arg0*3)
524     d.setTaggedValue(100,self.arg0*4)
525     self._diffDataObjects(d,file)
526    
527     def test_DumpAndLoad_Tagged_Function_Rank1(self):
528     file=os.path.join(self.filebase,"tagged_function_rank1.nc")
529     d=Data(self.arg1,Function(self.domain))
530     d.setTaggedValue(1,self.arg1*2)
531     d.setTaggedValue(10,self.arg1*3)
532     d.setTaggedValue(100,self.arg1*4)
533     self._diffDataObjects(d,file)
534    
535     def test_DumpAndLoad_Tagged_Function_Rank2(self):
536     file=os.path.join(self.filebase,"tagged_function_rank2.nc")
537     d=Data(self.arg2,Function(self.domain))
538     d.setTaggedValue(1,self.arg2*2)
539     d.setTaggedValue(10,self.arg2*3)
540     d.setTaggedValue(100,self.arg2*4)
541     self._diffDataObjects(d,file)
542    
543     def test_DumpAndLoad_Tagged_Function_Rank3(self):
544     file=os.path.join(self.filebase,"tagged_function_rank3.nc")
545     d=Data(self.arg3,Function(self.domain))
546     d.setTaggedValue(1,self.arg3*2)
547     d.setTaggedValue(10,self.arg3*3)
548     d.setTaggedValue(100,self.arg3*4)
549     self._diffDataObjects(d,file)
550    
551     def test_DumpAndLoad_Tagged_Function_Rank4(self):
552     file=os.path.join(self.filebase,"tagged_function_rank4.nc")
553     d=Data(self.arg4,Function(self.domain))
554     d.setTaggedValue(1,self.arg4*2)
555     d.setTaggedValue(10,self.arg4*3)
556     d.setTaggedValue(100,self.arg4*4)
557     self._diffDataObjects(d,file)
558    
559     #===========================================================================
560     def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank0(self):
561     file=os.path.join(self.filebase,"tagged_function_on_boundary_rank0.nc")
562     d=Data(self.arg0,FunctionOnBoundary(self.domain))
563     d.setTaggedValue(1,self.arg0*2)
564     d.setTaggedValue(10,self.arg0*3)
565     d.setTaggedValue(100,self.arg0*4)
566     self._diffDataObjects(d,file)
567    
568     def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank1(self):
569     file=os.path.join(self.filebase,"tagged_function_on_boundary_rank1.nc")
570     d=Data(self.arg1,FunctionOnBoundary(self.domain))
571     d.setTaggedValue(1,self.arg1*2)
572     d.setTaggedValue(10,self.arg1*3)
573     d.setTaggedValue(100,self.arg1*4)
574     self._diffDataObjects(d,file)
575    
576     def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank2(self):
577     file=os.path.join(self.filebase,"tagged_function_on_boundary_rank2.nc")
578     d=Data(self.arg2,FunctionOnBoundary(self.domain))
579     d.setTaggedValue(1,self.arg2*2)
580     d.setTaggedValue(10,self.arg2*3)
581     d.setTaggedValue(100,self.arg2*4)
582     self._diffDataObjects(d,file)
583    
584     def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank3(self):
585     file=os.path.join(self.filebase,"tagged_function_on_boundary_rank3.nc")
586     d=Data(self.arg3,FunctionOnBoundary(self.domain))
587     d.setTaggedValue(1,self.arg3*2)
588     d.setTaggedValue(10,self.arg3*3)
589     d.setTaggedValue(100,self.arg3*4)
590     self._diffDataObjects(d,file)
591    
592     def test_DumpAndLoad_Tagged_FunctionOnBoundary_Rank4(self):
593     file=os.path.join(self.filebase,"tagged_function_on_boundary_rank4.nc")
594     d=Data(self.arg4,FunctionOnBoundary(self.domain))
595     d.setTaggedValue(1,self.arg4*2)
596     d.setTaggedValue(10,self.arg4*3)
597     d.setTaggedValue(100,self.arg4*4)
598     self._diffDataObjects(d,file)
599    

  ViewVC Help
Powered by ViewVC 1.1.26