/[escript]/branches/arrexp_trunk2098/escript/test/python/test_objects.py
ViewVC logotype

Diff of /branches/arrexp_trunk2098/escript/test/python/test_objects.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2144 by jfenwick, Wed Dec 3 03:33:34 2008 UTC revision 2145 by jfenwick, Wed Dec 10 00:48:53 2008 UTC
# Line 50  __author__="Lutz Gross, l.gross@uq.edu.a Line 50  __author__="Lutz Gross, l.gross@uq.edu.a
50    
51  import unittest  import unittest
52  import os  import os
53  import numarray  import numpy
54  from esys.escript import *  from esys.escript import *
55    
56  class Test_Domain(unittest.TestCase):  class Test_Domain(unittest.TestCase):
# Line 187  class Test_Domain(unittest.TestCase): Line 187  class Test_Domain(unittest.TestCase):
187     #===========================================================================     #===========================================================================
188  class Test_SetDataPointValue(unittest.TestCase):  class Test_SetDataPointValue(unittest.TestCase):
189     arg0=9.81     arg0=9.81
190     arg1=numarray.array([3.098, -3.111])     arg1=numpy.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]])     arg2=numpy.array([[3.82, -3.81, -0.957, 0.892, -1.367], [-4.589, -1.835, -2.679, -1.517, -4.2515], [-4.909, 1.634, -2.883, -2.135, 1.187], [0.6431, 4.638, -4.616, -0.196, -4.370]])
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]]])     arg3=numpy.array([[[-2.3667, -0.040], [-4.7398, -3.2412]], [[-2.125, -2.240], [2.237, -4.279]], [[0.68720, 2.4059], [-2.4964, 3.17453]], [[-4.907, -4.9431], [-0.3604, 0.4269]], [[1.4179, 3.326], [1.356, -0.4610]], [[3.378, 2.0902], [-2.6857, 1.3585]]])
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]]]])     arg4=numpy.array([[[[-3.810, -1.3597, -1.5307, 1.099], [-1.828, 0.2526, -1.4429, 2.326], [4.9732, -2.063, 1.3153, -3.809]], [[-4.8902, -4.714, 1.520, -1.931], [-3.8847, 4.3867, 1.894030, 2.432], [-1.2082, -0.8304, 2.2612, 4.6399]]], [[[-4.5922, -3.309, -0.8171, -0.7210], [2.8051, -4.93047, 0.08450, 4.3824], [0.43204, 2.1908, 4.512633, -1.8218]], [[2.2493, -4.190, -2.3893, -4.147], [-2.104, -4.635, -4.2767, -3.53151], [-2.351, -1.6614, 2.9385, 4.099]]], [[[1.710, 0.2235, -3.4917, 0.8713], [-0.2881, 4.6278, 3.603, -2.1211], [-0.565, 4.294, -2.210827, -0.37651]], [[0.6578, -2.869, -2.490, -4.789], [3.232, 2.483, 0.9531, 2.260], [-1.785, 0.42156, -1.8379, 4.212]]]])
194     def test_SetDataPointValue_Function_Rank0(self):     def test_SetDataPointValue_Function_Rank0(self):
195            d=Data(self.arg0,Function(self.domain))            d=Data(self.arg0,Function(self.domain))
196            d.setValueOfDataPoint(0,self.arg0*2)            d.setValueOfDataPoint(0,self.arg0*2)
197            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
198            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg0)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg0)
199            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
200            d_1=numarray.array(numarray.array(d.getValueOfDataPoint(1)))            d_1=numpy.array(numpy.array(d.getTupleForDataPoint(1)))
201            self.failUnless(Lsup(d_0-self.arg0*2)<=Lsup(self.arg0*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg0)<=Lsup(self.arg0), "wrong setting")
203     def test_SetDataPointValue_Function_Rank1(self):     def test_SetDataPointValue_Function_Rank1(self):
# Line 205  class Test_SetDataPointValue(unittest.Te Line 205  class Test_SetDataPointValue(unittest.Te
205            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
206            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
207            d.setValueOfDataPoint(0,self.arg1*2)            d.setValueOfDataPoint(0,self.arg1*2)
208            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
209            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
210            self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
212     def test_SetDataPointValue_Function_Rank1_list(self):     def test_SetDataPointValue_Function_Rank1_list(self):
213            d=Data(self.arg1,Function(self.domain))            d=Data(self.arg1,Function(self.domain))
214            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
215            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
216            d.setValueOfDataPoint(0,numarray.array2list(self.arg1*2))            d.setValueOfDataPoint(0,(self.arg1*2).tolist())
217            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
218            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
219            self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
221     def test_SetDataPointValue_Function_Rank2(self):     def test_SetDataPointValue_Function_Rank2(self):
# Line 223  class Test_SetDataPointValue(unittest.Te Line 223  class Test_SetDataPointValue(unittest.Te
223            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
224            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
225            d.setValueOfDataPoint(0,self.arg2*2)            d.setValueOfDataPoint(0,self.arg2*2)
226            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
227            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
228            self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
230     def test_SetDataPointValue_Function_Rank2_list(self):     def test_SetDataPointValue_Function_Rank2_list(self):
231            d=Data(self.arg2,Function(self.domain))            d=Data(self.arg2,Function(self.domain))
232            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
233            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
234            d.setValueOfDataPoint(0,numarray.array2list(self.arg2*2))            d.setValueOfDataPoint(0,(self.arg2*2).tolist())
235            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
236            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
237            self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
239     def test_SetDataPointValue_Function_Rank3(self):     def test_SetDataPointValue_Function_Rank3(self):
# Line 241  class Test_SetDataPointValue(unittest.Te Line 241  class Test_SetDataPointValue(unittest.Te
241            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
242            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
243            d.setValueOfDataPoint(0,self.arg3*2)            d.setValueOfDataPoint(0,self.arg3*2)
244            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
245            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
246            self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
248     def test_SetDataPointValue_Function_Rank3_list(self):     def test_SetDataPointValue_Function_Rank3_list(self):
249            d=Data(self.arg3,Function(self.domain))            d=Data(self.arg3,Function(self.domain))
250            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
251            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
252            d.setValueOfDataPoint(0,numarray.array2list(self.arg3*2))            d.setValueOfDataPoint(0,(self.arg3*2).tolist())
253            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
254            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
255            self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
257     def test_SetDataPointValue_Function_Rank4(self):     def test_SetDataPointValue_Function_Rank4(self):
# Line 259  class Test_SetDataPointValue(unittest.Te Line 259  class Test_SetDataPointValue(unittest.Te
259            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
260            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
261            d.setValueOfDataPoint(0,self.arg4*2)            d.setValueOfDataPoint(0,self.arg4*2)
262            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
263            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
264            self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
266     def test_SetDataPointValue_Function_Rank4_list(self):     def test_SetDataPointValue_Function_Rank4_list(self):
267            d=Data(self.arg4,Function(self.domain))            d=Data(self.arg4,Function(self.domain))
268            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
269            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
270            d.setValueOfDataPoint(0,numarray.array2list(self.arg4*2))            d.setValueOfDataPoint(0,(self.arg4*2).tolist())
271            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
272            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
273            self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
275     #===========================================================================     #===========================================================================
# Line 278  class Test_SetDataPointValue(unittest.Te Line 278  class Test_SetDataPointValue(unittest.Te
278            d.setValueOfDataPoint(0,self.arg0*2)            d.setValueOfDataPoint(0,self.arg0*2)
279            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
280            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg0)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg0)
281            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
282            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
283            self.failUnless(Lsup(d_0-self.arg0*2)<=Lsup(self.arg0*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg0)<=Lsup(self.arg0), "wrong setting")
285     def test_SetDataPointValue_ReducedFunction_Rank1(self):     def test_SetDataPointValue_ReducedFunction_Rank1(self):
# Line 287  class Test_SetDataPointValue(unittest.Te Line 287  class Test_SetDataPointValue(unittest.Te
287            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
288            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
289            d.setValueOfDataPoint(0,self.arg1*2)            d.setValueOfDataPoint(0,self.arg1*2)
290            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
291            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
292            self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
294     def test_SetDataPointValue_ReducedFunction_Rank1_list(self):     def test_SetDataPointValue_ReducedFunction_Rank1_list(self):
295            d=Data(self.arg1,ReducedFunction(self.domain))            d=Data(self.arg1,ReducedFunction(self.domain))
296            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
297            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
298            d.setValueOfDataPoint(0,numarray.array2list(self.arg1*2))            d.setValueOfDataPoint(0,(self.arg1*2).tolist())
299            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
300            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
301            self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
303     def test_SetDataPointValue_ReducedFunction_Rank2(self):     def test_SetDataPointValue_ReducedFunction_Rank2(self):
# Line 305  class Test_SetDataPointValue(unittest.Te Line 305  class Test_SetDataPointValue(unittest.Te
305            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
306            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
307            d.setValueOfDataPoint(0,self.arg2*2)            d.setValueOfDataPoint(0,self.arg2*2)
308            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
309            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
310            self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
312     def test_SetDataPointValue_ReducedFunction_Rank2_list(self):     def test_SetDataPointValue_ReducedFunction_Rank2_list(self):
313            d=Data(self.arg2,ReducedFunction(self.domain))            d=Data(self.arg2,ReducedFunction(self.domain))
314            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
315            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
316            d.setValueOfDataPoint(0,numarray.array2list(self.arg2*2))            d.setValueOfDataPoint(0,(self.arg2*2).tolist())
317            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
318            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
319            self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
321     def test_SetDataPointValue_ReducedFunction_Rank3(self):     def test_SetDataPointValue_ReducedFunction_Rank3(self):
# Line 323  class Test_SetDataPointValue(unittest.Te Line 323  class Test_SetDataPointValue(unittest.Te
323            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
324            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
325            d.setValueOfDataPoint(0,self.arg3*2)            d.setValueOfDataPoint(0,self.arg3*2)
326            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
327            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
328            self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
330     def test_SetDataPointValue_ReducedFunction_Rank3_list(self):     def test_SetDataPointValue_ReducedFunction_Rank3_list(self):
331            d=Data(self.arg3,ReducedFunction(self.domain))            d=Data(self.arg3,ReducedFunction(self.domain))
332            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
333            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
334            d.setValueOfDataPoint(0,numarray.array2list(self.arg3*2))            d.setValueOfDataPoint(0,(self.arg3*2).tolist())
335            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
336            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
337            self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
339     def test_SetDataPointValue_ReducedFunction_Rank4(self):     def test_SetDataPointValue_ReducedFunction_Rank4(self):
# Line 341  class Test_SetDataPointValue(unittest.Te Line 341  class Test_SetDataPointValue(unittest.Te
341            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
342            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
343            d.setValueOfDataPoint(0,self.arg4*2)            d.setValueOfDataPoint(0,self.arg4*2)
344            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
345            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
346            self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
348     def test_SetDataPointValue_ReducedFunction_Rank4_list(self):     def test_SetDataPointValue_ReducedFunction_Rank4_list(self):
349            d=Data(self.arg4,ReducedFunction(self.domain))            d=Data(self.arg4,ReducedFunction(self.domain))
350            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
351            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
352            d.setValueOfDataPoint(0,numarray.array2list(self.arg4*2))            d.setValueOfDataPoint(0,(self.arg4*2).tolist())
353            d_0=numarray.array(d.getValueOfDataPoint(0))            d_0=numpy.array(d.getTupleForDataPoint(0))
354            d_1=numarray.array(d.getValueOfDataPoint(1))            d_1=numpy.array(d.getTupleForDataPoint(1))
355            self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")            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")            self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
357    
358  class Test_Dump(unittest.TestCase):  class Test_Dump(unittest.TestCase):
359     arg0=9.81     arg0=9.81
360     arg1=numarray.array([3.098, -3.111])     arg1=numpy.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]])     arg2=numpy.array([[3.82, -3.81, -0.957, 0.892, -1.367], [-4.589, -1.835, -2.679, -1.517, -4.2515], [-4.909, 1.634, -2.883, -2.135, 1.187], [0.6431, 4.638, -4.616, -0.196, -4.370]])
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]]])     arg3=numpy.array([[[-2.3667, -0.040], [-4.7398, -3.2412]], [[-2.125, -2.240], [2.237, -4.279]], [[0.68720, 2.4059], [-2.4964, 3.17453]], [[-4.907, -4.9431], [-0.3604, 0.4269]], [[1.4179, 3.326], [1.356, -0.4610]], [[3.378, 2.0902], [-2.6857, 1.3585]]])
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]]]])     arg4=numpy.array([[[[-3.810, -1.3597, -1.5307, 1.099], [-1.828, 0.2526, -1.4429, 2.326], [4.9732, -2.063, 1.3153, -3.809]], [[-4.8902, -4.714, 1.520, -1.931], [-3.8847, 4.3867, 1.894030, 2.432], [-1.2082, -0.8304, 2.2612, 4.6399]]], [[[-4.5922, -3.309, -0.8171, -0.7210], [2.8051, -4.93047, 0.08450, 4.3824], [0.43204, 2.1908, 4.512633, -1.8218]], [[2.2493, -4.190, -2.3893, -4.147], [-2.104, -4.635, -4.2767, -3.53151], [-2.351, -1.6614, 2.9385, 4.099]]], [[[1.710, 0.2235, -3.4917, 0.8713], [-0.2881, 4.6278, 3.603, -2.1211], [-0.565, 4.294, -2.210827, -0.37651]], [[0.6578, -2.869, -2.490, -4.789], [3.232, 2.483, 0.9531, 2.260], [-1.785, 0.42156, -1.8379, 4.212]]]])
364    
365     def _diffDataObjects(self,d_ref,filemame, use_old_file=False):     def _diffDataObjects(self,d_ref,filemame, use_old_file=False):
366         if not use_old_file: d_ref.dump(filemame)         if not use_old_file: d_ref.dump(filemame)

Legend:
Removed from v.2144  
changed lines
  Added in v.2145

  ViewVC Help
Powered by ViewVC 1.1.26