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

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

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

revision 1062 by gross, Mon Mar 19 07:29:31 2007 UTC revision 1063 by gross, Mon Mar 26 08:29:18 2007 UTC
# Line 76  class Test_Domain(unittest.TestCase): Line 76  class Test_Domain(unittest.TestCase):
76          # insert tag shortcut:          # insert tag shortcut:
77          s2=insertTaggedValues(Scalar(0,Function(self.domain)),**{ tag1 : 1., tag2 : 2.})          s2=insertTaggedValues(Scalar(0,Function(self.domain)),**{ tag1 : 1., tag2 : 2.})
78          self.failUnless(Lsup(s2-r)<=0.)          self.failUnless(Lsup(s2-r)<=0.)
79               def test_functionspace_ContinuousFunction(self):
80            fs=ContinuousFunction(self.domain)
81            self.failUnless(fs.getDomain()==self.domain)
82            self.failUnless(self.domain.getDim() == fs.getDim())
83            x=fs.getX()
84            self.failUnless(x.getFunctionSpace() == fs)
85            self.failUnless(x.getShape() == (fs.getDim(),))
86            self.failUnless(inf(x[0])>=0.)
87            if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
88            if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
89            self.failUnless(sup(x[0])<=1.)
90            if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
91            if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
92    
93       def test_functionspace_Solution(self):
94            fs=Solution(self.domain)
95            self.failUnless(fs.getDomain()==self.domain)
96            self.failUnless(self.domain.getDim() == fs.getDim())
97            x=fs.getX()
98            self.failUnless(x.getFunctionSpace() == fs)
99            self.failUnless(x.getShape() == (fs.getDim(),))
100            self.failUnless(inf(x[0])>=0.)
101            if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
102            if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
103            self.failUnless(sup(x[0])<=1.)
104            if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
105            if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
106    
107       def test_functionspace_ReducedSolution(self):
108            fs=ReducedSolution(self.domain)
109            self.failUnless(fs.getDomain()==self.domain)
110            self.failUnless(self.domain.getDim() == fs.getDim())
111            x=fs.getX()
112            self.failUnless(x.getFunctionSpace() == fs)
113            self.failUnless(x.getShape() == (fs.getDim(),))
114            self.failUnless(inf(x[0])>=0.)
115            if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
116            if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
117            self.failUnless(sup(x[0])<=1.)
118            if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
119            if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
120    
121       def test_functionspace_Function(self):
122            fs=Function(self.domain)
123            self.failUnless(fs.getDomain()==self.domain)
124            self.failUnless(self.domain.getDim() == fs.getDim())
125            x=fs.getX()
126            self.failUnless(x.getFunctionSpace() == fs)
127            self.failUnless(x.getShape() == (fs.getDim(),))
128            self.failUnless(inf(x[0])>=0.)
129            if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
130            if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
131            self.failUnless(sup(x[0])<=1.)
132            if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
133            if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
134    
135       def test_functionspace_ReducedFunction(self):
136            fs=ReducedFunction(self.domain)
137            self.failUnless(fs.getDomain()==self.domain)
138            self.failUnless(self.domain.getDim() == fs.getDim())
139            x=fs.getX()
140            self.failUnless(x.getFunctionSpace() == fs)
141            self.failUnless(x.getShape() == (fs.getDim(),))
142            self.failUnless(inf(x[0])>=0.)
143            if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
144            if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
145            self.failUnless(sup(x[0])<=1.)
146            if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
147            if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
148       def test_functionspace_FunctionOnBoundary(self):
149            fs=FunctionOnBoundary(self.domain)
150            self.failUnless(fs.getDomain()==self.domain)
151            self.failUnless(self.domain.getDim() == fs.getDim())
152            x=fs.getX()
153            self.failUnless(x.getFunctionSpace() == fs)
154            self.failUnless(x.getShape() == (fs.getDim(),))
155            self.failUnless(inf(x[0])>=0.)
156            if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
157            if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
158            self.failUnless(sup(x[0])<=1.)
159            if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
160            if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
161    
162       def test_functionspace_ReducedFunctionOnBoundary(self):
163            fs=ReducedFunctionOnBoundary(self.domain)
164            self.failUnless(fs.getDomain()==self.domain)
165            self.failUnless(self.domain.getDim() == fs.getDim())
166            x=fs.getX()
167            self.failUnless(x.getFunctionSpace() == fs)
168            self.failUnless(x.getShape() == (fs.getDim(),))
169            self.failUnless(inf(x[0])>=0.)
170            if self.domain.getDim()>1: self.failUnless(inf(x[1])>=0.)
171            if self.domain.getDim()>2: self.failUnless(inf(x[2])>=0.)
172            self.failUnless(sup(x[0])<=1.)
173            if self.domain.getDim()>1: self.failUnless(sup(x[1])<=1.)
174            if self.domain.getDim()>2: self.failUnless(sup(x[2])<=1.)
175    
176  class Test_Dump(unittest.TestCase):  class Test_Dump(unittest.TestCase):
177     arg0=9.81     arg0=9.81
# Line 97  class Test_Dump(unittest.TestCase): Line 191  class Test_Dump(unittest.TestCase):
191    
192     #===========================================================================     #===========================================================================
193     def test_DumpAndLoad_Constant_Solution_Rank0(self):     def test_DumpAndLoad_Constant_Solution_Rank0(self):
194           print loadIsConfigured()
195         if loadIsConfigured():         if loadIsConfigured():
196            file=os.path.join(self.filebase,"constant_solution_rank0.nc")            file=os.path.join(self.filebase,"constant_solution_rank0.nc")
197            d=Data(self.arg0,Solution(self.domain))            d=Data(self.arg0,Solution(self.domain))
# Line 211  class Test_Dump(unittest.TestCase): Line 306  class Test_Dump(unittest.TestCase):
306            d=Data(self.arg3,Function(self.domain))            d=Data(self.arg3,Function(self.domain))
307            self._diffDataObjects(d,file)            self._diffDataObjects(d,file)
308    
309     def test_DumpAndLoad_Constant_Function_Rank4(self):     #===========================================================================
310       def test_DumpAndLoad_Constant_ReducedFunction_Rank0(self):
311         if loadIsConfigured():         if loadIsConfigured():
312            file=os.path.join(self.filebase,"constant_function_rank4.nc")            file=os.path.join(self.filebase,"constant_reduced_function_rank0.nc")
313            d=Data(self.arg4,Function(self.domain))            d=Data(self.arg0,ReducedFunction(self.domain))
314              self._diffDataObjects(d,file)
315    
316       def test_DumpAndLoad_Constant_ReducedFunction_Rank1(self):
317           if loadIsConfigured():
318              file=os.path.join(self.filebase,"constant_reduced_function_rank1.nc")
319              d=Data(self.arg1,ReducedFunction(self.domain))
320              self._diffDataObjects(d,file)
321    
322       def test_DumpAndLoad_Constant_ReducedFunction_Rank2(self):
323           if loadIsConfigured():
324              file=os.path.join(self.filebase,"constant_reduced_function_rank2.nc")
325              d=Data(self.arg2,ReducedFunction(self.domain))
326              self._diffDataObjects(d,file)
327    
328       def test_DumpAndLoad_Constant_ReducedFunction_Rank3(self):
329           if loadIsConfigured():
330              file=os.path.join(self.filebase,"constant_reduced_function_rank3.nc")
331              d=Data(self.arg3,ReducedFunction(self.domain))
332              self._diffDataObjects(d,file)
333       def test_DumpAndLoad_Constant_ReducedFunction_Rank4(self):
334           if loadIsConfigured():
335              file=os.path.join(self.filebase,"constant_reduced_function_rank4.nc")
336              d=Data(self.arg4,ReducedFunction(self.domain))
337            self._diffDataObjects(d,file)            self._diffDataObjects(d,file)
338    
339     #===========================================================================     #===========================================================================
# Line 249  class Test_Dump(unittest.TestCase): Line 368  class Test_Dump(unittest.TestCase):
368            self._diffDataObjects(d,file)            self._diffDataObjects(d,file)
369    
370     #===========================================================================     #===========================================================================
371       def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank0(self):
372           if loadIsConfigured():
373              file=os.path.join(self.filebase,"constant_reduced_function_on_boundary_rank0.nc")
374              d=Data(self.arg0,FunctionOnBoundary(self.domain))
375              self._diffDataObjects(d,file)
376    
377       def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank1(self):
378           if loadIsConfigured():
379              file=os.path.join(self.filebase,"constant_reduced_function_on_boundary_rank1.nc")
380              d=Data(self.arg1,ReducedFunctionOnBoundary(self.domain))
381              self._diffDataObjects(d,file)
382    
383       def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank2(self):
384           if loadIsConfigured():
385              file=os.path.join(self.filebase,"constant_reduced_function_on_boundary_rank2.nc")
386              d=Data(self.arg2,ReducedFunctionOnBoundary(self.domain))
387              self._diffDataObjects(d,file)
388    
389       def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank3(self):
390           if loadIsConfigured():
391              file=os.path.join(self.filebase,"constant_reduced_function_on_boundary_rank3.nc")
392              d=Data(self.arg3,ReducedFunctionOnBoundary(self.domain))
393              self._diffDataObjects(d,file)
394    
395       def test_DumpAndLoad_Constant_ReducedFunctionOnBoundary_Rank4(self):
396           if loadIsConfigured():
397              file=os.path.join(self.filebase,"constant_reduced_function_on_boundary_rank4.nc")
398              d=Data(self.arg4,ReducedFunctionOnBoundary(self.domain))
399              self._diffDataObjects(d,file)
400    
401       #===========================================================================
402     def test_DumpAndLoad_Expanded_Solution_Rank0(self):     def test_DumpAndLoad_Expanded_Solution_Rank0(self):
403         if loadIsConfigured():         if loadIsConfigured():
404            file=os.path.join(self.filebase,"expanded_solution_rank0.nc")            file=os.path.join(self.filebase,"expanded_solution_rank0.nc")
# Line 428  class Test_Dump(unittest.TestCase): Line 578  class Test_Dump(unittest.TestCase):
578            self._diffDataObjects(d,file)            self._diffDataObjects(d,file)
579    
580     #===========================================================================     #===========================================================================
581       def test_DumpAndLoad_Expanded_ReducedFunction_Rank0(self):
582           if loadIsConfigured():
583              file=os.path.join(self.filebase,"expanded_reduced_function_rank0.nc")
584              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
585              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
586              # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
587              d=Data(length(ReducedFunction(self.domain).getX())*self.arg0,ReducedFunction(self.domain))
588              self._diffDataObjects(d,file)
589    
590       def test_DumpAndLoad_Expanded_ReducedFunction_Rank1(self):
591           if loadIsConfigured():
592              file=os.path.join(self.filebase,"expanded_reduced_function_rank1.nc")
593              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
594              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
595              # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
596              d=Data(length(ReducedFunction(self.domain).getX())*self.arg1,ReducedFunction(self.domain))
597              self._diffDataObjects(d,file)
598    
599       def test_DumpAndLoad_Expanded_ReducedFunction_Rank2(self):
600           if loadIsConfigured():
601              file=os.path.join(self.filebase,"expanded_reduced_function_rank2.nc")
602              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
603              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
604              # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
605              d=Data(length(ReducedFunction(self.domain).getX())*self.arg2,ReducedFunction(self.domain))
606              self._diffDataObjects(d,file)
607    
608       def test_DumpAndLoad_Expanded_ReducedFunction_Rank3(self):
609           if loadIsConfigured():
610              file=os.path.join(self.filebase,"expanded_reduced_function_rank3.nc")
611              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
612              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
613              # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
614              d=Data(length(ReducedFunction(self.domain).getX())*self.arg3,ReducedFunction(self.domain))
615              self._diffDataObjects(d,file)
616    
617       def test_DumpAndLoad_Expanded_ReducedFunction_Rank4(self):
618           if loadIsConfigured():
619              file=os.path.join(self.filebase,"expanded_reduced_function_rank4.nc")
620              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
621              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
622              # elements are not in different order: self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
623              d=Data(length(ReducedFunction(self.domain).getX())*self.arg4,ReducedFunction(self.domain))
624              self._diffDataObjects(d,file)
625    
626       #===========================================================================
627     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank0(self):     def test_DumpAndLoad_Expanded_FunctionOnBoundary_Rank0(self):
628         if loadIsConfigured():         if loadIsConfigured():
629            file=os.path.join(self.filebase,"expanded_function_on_boundary_rank0.nc")            file=os.path.join(self.filebase,"expanded_function_on_boundary_rank0.nc")
# Line 474  class Test_Dump(unittest.TestCase): Line 670  class Test_Dump(unittest.TestCase):
670            self._diffDataObjects(d,file)            self._diffDataObjects(d,file)
671    
672     #===========================================================================     #===========================================================================
673       def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank0(self):
674           if loadIsConfigured():
675              file=os.path.join(self.filebase,"expanded_reduced_function_on_boundary_rank0.nc")
676              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
677              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
678              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
679              d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg0,ReducedFunctionOnBoundary(self.domain))
680              self._diffDataObjects(d,file)
681    
682       def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank1(self):
683           if loadIsConfigured():
684              file=os.path.join(self.filebase,"expanded_reduced_function_on_boundary_rank1.nc")
685              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
686              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
687              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
688              d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg1,ReducedFunctionOnBoundary(self.domain))
689              self._diffDataObjects(d,file)
690    
691       def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank2(self):
692           if loadIsConfigured():
693              file=os.path.join(self.filebase,"expanded_reduced_function_on_boundary_rank2.nc")
694              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
695              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
696              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
697              d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg2,ReducedFunctionOnBoundary(self.domain))
698              self._diffDataObjects(d,file)
699    
700       def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank3(self):
701           if loadIsConfigured():
702              file=os.path.join(self.filebase,"expanded_reduced_function_on_boundary_rank3.nc")
703              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
704              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
705              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
706              d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg3,ReducedFunctionOnBoundary(self.domain))
707              self._diffDataObjects(d,file)
708    
709       def test_DumpAndLoad_Expanded_ReducedFunctionOnBoundary_Rank4(self):
710           if loadIsConfigured():
711              file=os.path.join(self.filebase,"expanded_reduced_function_on_boundary_rank4.nc")
712              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_samples)
713              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_number_of_data_points_per_sample)
714              self.failUnlessRaises(RuntimeError, load, file, self.domain_with_different_sample_ordering)
715              d=Data(length(ReducedFunctionOnBoundary(self.domain).getX())*self.arg4,ReducedFunctionOnBoundary(self.domain))
716              self._diffDataObjects(d,file)
717    
718       #===========================================================================
719     def test_DumpAndLoad_Tagged_Solution_Rank0(self):     def test_DumpAndLoad_Tagged_Solution_Rank0(self):
720         if loadIsConfigured():         if loadIsConfigured():
721            file=os.path.join(self.filebase,"tagged_solution_rank0.nc")            file=os.path.join(self.filebase,"tagged_solution_rank0.nc")
# Line 701  class Test_Dump(unittest.TestCase): Line 943  class Test_Dump(unittest.TestCase):
943            d.setTaggedValue(100,self.arg4*4)            d.setTaggedValue(100,self.arg4*4)
944            self._diffDataObjects(d,file)            self._diffDataObjects(d,file)
945     #===========================================================================     #===========================================================================
946       def test_DumpAndLoad_Tagged_ReducedFunction_Rank0(self):
947           if loadIsConfigured():
948              file=os.path.join(self.filebase,"tagged_reduced_function_rank0.nc")
949              d=Data(self.arg0,ReducedFunction(self.domain))
950              d.setTaggedValue(1,self.arg0*2)
951              d.setTaggedValue(10,self.arg0*3)
952              d.setTaggedValue(100,self.arg0*4)
953              self._diffDataObjects(d,file)
954    
955       def test_DumpAndLoad_Tagged_ReducedFunction_Rank1(self):
956           if loadIsConfigured():
957              file=os.path.join(self.filebase,"tagged_reduced_function_rank1.nc")
958              d=Data(self.arg1,ReducedFunction(self.domain))
959              d.setTaggedValue(1,self.arg1*2)
960              d.setTaggedValue(10,self.arg1*3)
961              d.setTaggedValue(100,self.arg1*4)
962              self._diffDataObjects(d,file)
963    
964       def test_DumpAndLoad_Tagged_ReducedFunction_Rank2(self):
965           if loadIsConfigured():
966              file=os.path.join(self.filebase,"tagged_reduced_function_rank2.nc")
967              d=Data(self.arg2,ReducedFunction(self.domain))
968              d.setTaggedValue(1,self.arg2*2)
969              d.setTaggedValue(10,self.arg2*3)
970              d.setTaggedValue(100,self.arg2*4)
971              self._diffDataObjects(d,file)
972    
973       def test_DumpAndLoad_Tagged_ReducedFunction_Rank3(self):
974           if loadIsConfigured():
975              file=os.path.join(self.filebase,"tagged_reduced_function_rank3.nc")
976              d=Data(self.arg3,ReducedFunction(self.domain))
977              d.setTaggedValue(1,self.arg3*2)
978              d.setTaggedValue(10,self.arg3*3)
979              d.setTaggedValue(100,self.arg3*4)
980              self._diffDataObjects(d,file)
981    
982       def test_DumpAndLoad_Tagged_ReducedFunction_Rank4(self):
983           if loadIsConfigured():
984              file=os.path.join(self.filebase,"tagged_reduced_function_rank4.nc")
985              d=Data(self.arg4,ReducedFunction(self.domain))
986              d.setTaggedValue(1,self.arg4*2)
987              d.setTaggedValue(10,self.arg4*3)
988              d.setTaggedValue(100,self.arg4*4)
989              self._diffDataObjects(d,file)
990    
991       #===========================================================================
992       def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank0(self):
993           if loadIsConfigured():
994              file=os.path.join(self.filebase,"tagged_reduced_function_on_boundary_rank0.nc")
995              d=Data(self.arg0,ReducedFunctionOnBoundary(self.domain))
996              d.setTaggedValue(1,self.arg0*2)
997              d.setTaggedValue(10,self.arg0*3)
998              d.setTaggedValue(100,self.arg0*4)
999              self._diffDataObjects(d,file)
1000    
1001       def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank1(self):
1002           if loadIsConfigured():
1003              file=os.path.join(self.filebase,"tagged_reduced_function_on_boundary_rank1.nc")
1004              d=Data(self.arg1,ReducedFunctionOnBoundary(self.domain))
1005              d.setTaggedValue(1,self.arg1*2)
1006              d.setTaggedValue(10,self.arg1*3)
1007              d.setTaggedValue(100,self.arg1*4)
1008              self._diffDataObjects(d,file)
1009    
1010       def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank2(self):
1011           if loadIsConfigured():
1012              file=os.path.join(self.filebase,"tagged_reduced_function_on_boundary_rank2.nc")
1013              d=Data(self.arg2,ReducedFunctionOnBoundary(self.domain))
1014              d.setTaggedValue(1,self.arg2*2)
1015              d.setTaggedValue(10,self.arg2*3)
1016              d.setTaggedValue(100,self.arg2*4)
1017              self._diffDataObjects(d,file)
1018    
1019       def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank3(self):
1020           if loadIsConfigured():
1021              file=os.path.join(self.filebase,"tagged_reduced_function_on_boundary_rank3.nc")
1022              d=Data(self.arg3,ReducedFunctionOnBoundary(self.domain))
1023              d.setTaggedValue(1,self.arg3*2)
1024              d.setTaggedValue(10,self.arg3*3)
1025              d.setTaggedValue(100,self.arg3*4)
1026              self._diffDataObjects(d,file)
1027    
1028       def test_DumpAndLoad_Tagged_ReducedFunctionOnBoundary_Rank4(self):
1029           if loadIsConfigured():
1030              file=os.path.join(self.filebase,"tagged_reduced_function_on_boundary_rank4.nc")
1031              d=Data(self.arg4,ReducedFunctionOnBoundary(self.domain))
1032              d.setTaggedValue(1,self.arg4*2)
1033              d.setTaggedValue(10,self.arg4*3)
1034              d.setTaggedValue(100,self.arg4*4)
1035              self._diffDataObjects(d,file)
1036       #===========================================================================
1037     def test_SetDataPointValue_Function_Rank0(self):     def test_SetDataPointValue_Function_Rank0(self):
1038            d=Data(self.arg0,Function(self.domain))            d=Data(self.arg0,Function(self.domain))
1039            d.setValueOfDataPoint(0,self.arg0*2)            d.setValueOfDataPoint(0,self.arg0*2)
# Line 778  class Test_Dump(unittest.TestCase): Line 1111  class Test_Dump(unittest.TestCase):
1111            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
1112            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)            self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
1113            d.setValueOfDataPoint(0,numarray.array2list(self.arg4*2))            d.setValueOfDataPoint(0,numarray.array2list(self.arg4*2))
1114              d_0=d.getValueOfDataPoint(0)
1115              d_1=d.getValueOfDataPoint(1)
1116              self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")
1117              self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
1118       #===========================================================================
1119       def test_SetDataPointValue_ReducedFunction_Rank0(self):
1120              d=Data(self.arg0,ReducedFunction(self.domain))
1121              d.setValueOfDataPoint(0,self.arg0*2)
1122              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
1123              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg0)
1124              d_0=d.getValueOfDataPoint(0)
1125              d_1=d.getValueOfDataPoint(1)
1126              self.failUnless(Lsup(d_0-self.arg0*2)<=Lsup(self.arg0*2), "wrong setting")
1127              self.failUnless(Lsup(d_1-self.arg0)<=Lsup(self.arg0), "wrong setting")
1128       def test_SetDataPointValue_ReducedFunction_Rank1(self):
1129              d=Data(self.arg1,ReducedFunction(self.domain))
1130              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
1131              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
1132              d.setValueOfDataPoint(0,self.arg1*2)
1133              d_0=d.getValueOfDataPoint(0)
1134              d_1=d.getValueOfDataPoint(1)
1135              self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")
1136              self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
1137       def test_SetDataPointValue_ReducedFunction_Rank1_list(self):
1138              d=Data(self.arg1,ReducedFunction(self.domain))
1139              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg2)
1140              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg1)
1141              d.setValueOfDataPoint(0,numarray.array2list(self.arg1*2))
1142              d_0=d.getValueOfDataPoint(0)
1143              d_1=d.getValueOfDataPoint(1)
1144              self.failUnless(Lsup(d_0-self.arg1*2)<=Lsup(self.arg1*2), "wrong setting")
1145              self.failUnless(Lsup(d_1-self.arg1)<=Lsup(self.arg1), "wrong setting")
1146       def test_SetDataPointValue_ReducedFunction_Rank2(self):
1147              d=Data(self.arg2,ReducedFunction(self.domain))
1148              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
1149              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
1150              d.setValueOfDataPoint(0,self.arg2*2)
1151              d_0=d.getValueOfDataPoint(0)
1152              d_1=d.getValueOfDataPoint(1)
1153              self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")
1154              self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
1155       def test_SetDataPointValue_ReducedFunction_Rank2_list(self):
1156              d=Data(self.arg2,ReducedFunction(self.domain))
1157              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
1158              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg2)
1159              d.setValueOfDataPoint(0,numarray.array2list(self.arg2*2))
1160              d_0=d.getValueOfDataPoint(0)
1161              d_1=d.getValueOfDataPoint(1)
1162              self.failUnless(Lsup(d_0-self.arg2*2)<=Lsup(self.arg2*2), "wrong setting")
1163              self.failUnless(Lsup(d_1-self.arg2)<=Lsup(self.arg2), "wrong setting")
1164       def test_SetDataPointValue_ReducedFunction_Rank3(self):
1165              d=Data(self.arg3,ReducedFunction(self.domain))
1166              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
1167              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
1168              d.setValueOfDataPoint(0,self.arg3*2)
1169              d_0=d.getValueOfDataPoint(0)
1170              d_1=d.getValueOfDataPoint(1)
1171              self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")
1172              self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
1173       def test_SetDataPointValue_ReducedFunction_Rank3_list(self):
1174              d=Data(self.arg3,ReducedFunction(self.domain))
1175              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
1176              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg3)
1177              d.setValueOfDataPoint(0,numarray.array2list(self.arg3*2))
1178              d_0=d.getValueOfDataPoint(0)
1179              d_1=d.getValueOfDataPoint(1)
1180              self.failUnless(Lsup(d_0-self.arg3*2)<=Lsup(self.arg3*2), "wrong setting")
1181              self.failUnless(Lsup(d_1-self.arg3)<=Lsup(self.arg3), "wrong setting")
1182       def test_SetDataPointValue_ReducedFunction_Rank4(self):
1183              d=Data(self.arg4,ReducedFunction(self.domain))
1184              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
1185              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
1186              d.setValueOfDataPoint(0,self.arg4*2)
1187              d_0=d.getValueOfDataPoint(0)
1188              d_1=d.getValueOfDataPoint(1)
1189              self.failUnless(Lsup(d_0-self.arg4*2)<=Lsup(self.arg4*2), "wrong setting")
1190              self.failUnless(Lsup(d_1-self.arg4)<=Lsup(self.arg4), "wrong setting")
1191       def test_SetDataPointValue_ReducedFunction_Rank4_list(self):
1192              d=Data(self.arg4,ReducedFunction(self.domain))
1193              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, 0, self.arg1)
1194              self.failUnlessRaises(RuntimeError, d.setValueOfDataPoint, -1, self.arg4)
1195              d.setValueOfDataPoint(0,numarray.array2list(self.arg4*2))
1196            d_0=d.getValueOfDataPoint(0)            d_0=d.getValueOfDataPoint(0)
1197            d_1=d.getValueOfDataPoint(1)            d_1=d.getValueOfDataPoint(1)
1198            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")

Legend:
Removed from v.1062  
changed lines
  Added in v.1063

  ViewVC Help
Powered by ViewVC 1.1.26