/[escript]/trunk/escript/py_src/test_util_base.py
ViewVC logotype

Diff of /trunk/escript/py_src/test_util_base.py

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

revision 441 by gross, Wed Dec 21 02:41:59 2005 UTC revision 442 by gross, Fri Jan 20 04:39:43 2006 UTC
# Line 57  class Test_util_base(unittest.TestCase): Line 57  class Test_util_base(unittest.TestCase):
57        self.failUnlessEqual(val[2,2],1.0,"wrong value for (2,2)")        self.failUnlessEqual(val[2,2],1.0,"wrong value for (2,2)")
58     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
59     def test_kronecker_domain(self):     def test_kronecker_domain(self):
60        val=kronecker(d=self.functionspace)        val=kronecker(d=self.domain)
61        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")
62        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")        self.failUnlessEqual(val.shape,(self.domain.getDim(),self.domain.getDim()),"wrong shape.")
63       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
64       def test_kronecker_functionspace(self):
65          val=kronecker(d=self.functionspace)
66          self.failUnless(isinstance(val,escript.Data),"wrong type of result.")
67          self.failUnlessEqual(val.getShape(),(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")
68     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
69     def test_identityTensor_1(self):     def test_identityTensor_1(self):
70        val=identityTensor(d=1)        val=identityTensor(d=1)
# Line 88  class Test_util_base(unittest.TestCase): Line 93  class Test_util_base(unittest.TestCase):
93        self.failUnlessEqual(val[2,2],1.0,"wrong value for (2,2)")        self.failUnlessEqual(val[2,2],1.0,"wrong value for (2,2)")
94     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
95     def test_identityTensor_domain(self):     def test_identityTensor_domain(self):
96        val=identityTensor(d=self.functionspace)        val=identityTensor(d=self.domain)
97        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")
98        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")        self.failUnlessEqual(val.shape,(self.domain.getDim(),self.domain.getDim()),"wrong shape.")
99          if self.domain.getDim()==2:
100             self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")
101             self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")
102             self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")
103             self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")
104          if self.domain.getDim()==3:
105             self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")
106             self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")
107             self.failUnlessEqual(val[0,2],0.0,"wrong value for (0,2)")
108             self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")
109             self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")
110             self.failUnlessEqual(val[1,2],0.0,"wrong value for (1,2)")
111             self.failUnlessEqual(val[2,0],0.0,"wrong value for (2,0)")
112             self.failUnlessEqual(val[2,1],0.0,"wrong value for (2,1)")
113             self.failUnlessEqual(val[2,2],1.0,"wrong value for (2,2)")
114       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
115       def test_identityTensor_functionspace(self):
116          val=identityTensor(d=self.functionspace)
117          self.failUnless(isinstance(val,escript.Data),"wrong type of result.")
118          self.failUnlessEqual(val.getShape(),(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")
119          if self.domain.getDim()==2:
120             self.failUnless(Lsup(val[0,0]-1.0)<=self.RES_TOL,"wrong value for (0,0)")
121             self.failUnless(Lsup(val[0,1]-0.0)<=self.RES_TOL,"wrong value for (0,1)")
122             self.failUnless(Lsup(val[1,0]-0.0)<=self.RES_TOL,"wrong value for (1,0)")
123             self.failUnless(Lsup(val[1,1]-1.0)<=self.RES_TOL,"wrong value for (1,1)")
124          if self.domain.getDim()==3:
125             self.failUnless(Lsup(val[0,0]-1.0)<=self.RES_TOL,"wrong value for (0,0)")
126             self.failUnless(Lsup(val[0,1]-0.0)<=self.RES_TOL,"wrong value for (0,1)")
127             self.failUnless(Lsup(val[0,2]-0.0)<=self.RES_TOL,"wrong value for (0,2)")
128             self.failUnless(Lsup(val[1,0]-0.0)<=self.RES_TOL,"wrong value for (1,0)")
129             self.failUnless(Lsup(val[1,1]-1.0)<=self.RES_TOL,"wrong value for (1,1)")
130             self.failUnless(Lsup(val[1,2]-0.0)<=self.RES_TOL,"wrong value for (1,2)")
131             self.failUnless(Lsup(val[2,0]-0.0)<=self.RES_TOL,"wrong value for (2,0)")
132             self.failUnless(Lsup(val[2,1]-0.0)<=self.RES_TOL,"wrong value for (2,1)")
133             self.failUnless(Lsup(val[2,2]-1.0)<=self.RES_TOL,"wrong value for (2,2)")
134     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
135     def test_identityTensor4_1(self):     def test_identityTensor4_1(self):
136        val=identityTensor4(d=1)        val=identityTensor4(d=1)
# Line 203  class Test_util_base(unittest.TestCase): Line 243  class Test_util_base(unittest.TestCase):
243        self.failUnlessEqual(val[2,2,2,2],1.0,"wrong value for (2,2,2,2)")        self.failUnlessEqual(val[2,2,2,2],1.0,"wrong value for (2,2,2,2)")
244     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
245     def test_identityTensor4_domain(self):     def test_identityTensor4_domain(self):
246        val=identityTensor4(d=self.functionspace)        val=identityTensor4(d=self.domain)
247        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")
248        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")        self.failUnlessEqual(val.shape,(self.domain.getDim(),self.domain.getDim(),self.domain.getDim(),self.domain.getDim()),"wrong shape.")
249          if self.domain.getDim()==2:
250             self.failUnlessEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")
251             self.failUnlessEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")
252             self.failUnlessEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")
253             self.failUnlessEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")
254             self.failUnlessEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")
255             self.failUnlessEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")
256             self.failUnlessEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")
257             self.failUnlessEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")
258             self.failUnlessEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")
259             self.failUnlessEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")
260             self.failUnlessEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")
261             self.failUnlessEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")
262             self.failUnlessEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")
263             self.failUnlessEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")
264             self.failUnlessEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")
265             self.failUnlessEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")
266          if self.domain.getDim()==3:
267             self.failUnlessEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")
268             self.failUnlessEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")
269             self.failUnlessEqual(val[0,0,0,2],0.0,"wrong value for (0,0,0,2)")
270             self.failUnlessEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")
271             self.failUnlessEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")
272             self.failUnlessEqual(val[0,0,1,2],0.0,"wrong value for (0,0,1,2)")
273             self.failUnlessEqual(val[0,0,2,0],0.0,"wrong value for (0,0,2,0)")
274             self.failUnlessEqual(val[0,0,2,1],0.0,"wrong value for (0,0,2,1)")
275             self.failUnlessEqual(val[0,0,2,2],0.0,"wrong value for (0,0,2,2)")
276             self.failUnlessEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")
277             self.failUnlessEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")
278             self.failUnlessEqual(val[0,1,0,2],0.0,"wrong value for (0,1,0,2)")
279             self.failUnlessEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")
280             self.failUnlessEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")
281             self.failUnlessEqual(val[0,1,1,2],0.0,"wrong value for (0,1,1,2)")
282             self.failUnlessEqual(val[0,1,2,0],0.0,"wrong value for (0,1,2,0)")
283             self.failUnlessEqual(val[0,1,2,1],0.0,"wrong value for (0,1,2,1)")
284             self.failUnlessEqual(val[0,1,2,2],0.0,"wrong value for (0,1,2,2)")
285             self.failUnlessEqual(val[0,2,0,0],0.0,"wrong value for (0,2,0,0)")
286             self.failUnlessEqual(val[0,2,0,1],0.0,"wrong value for (0,2,0,1)")
287             self.failUnlessEqual(val[0,2,0,2],1.0,"wrong value for (0,2,0,2)")
288             self.failUnlessEqual(val[0,2,1,0],0.0,"wrong value for (0,2,1,0)")
289             self.failUnlessEqual(val[0,2,1,1],0.0,"wrong value for (0,2,1,1)")
290             self.failUnlessEqual(val[0,2,1,2],0.0,"wrong value for (0,2,1,2)")
291             self.failUnlessEqual(val[0,2,2,0],0.0,"wrong value for (0,2,2,0)")
292             self.failUnlessEqual(val[0,2,2,1],0.0,"wrong value for (0,2,2,1)")
293             self.failUnlessEqual(val[0,2,2,2],0.0,"wrong value for (0,2,2,2)")
294             self.failUnlessEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")
295             self.failUnlessEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")
296             self.failUnlessEqual(val[1,0,0,2],0.0,"wrong value for (1,0,0,2)")
297             self.failUnlessEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")
298             self.failUnlessEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")
299             self.failUnlessEqual(val[1,0,1,2],0.0,"wrong value for (1,0,1,2)")
300             self.failUnlessEqual(val[1,0,2,0],0.0,"wrong value for (1,0,2,0)")
301             self.failUnlessEqual(val[1,0,2,1],0.0,"wrong value for (1,0,2,1)")
302             self.failUnlessEqual(val[1,0,2,2],0.0,"wrong value for (1,0,2,2)")
303             self.failUnlessEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")
304             self.failUnlessEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")
305             self.failUnlessEqual(val[1,1,0,2],0.0,"wrong value for (1,1,0,2)")
306             self.failUnlessEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")
307             self.failUnlessEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")
308             self.failUnlessEqual(val[1,1,1,2],0.0,"wrong value for (1,1,1,2)")
309             self.failUnlessEqual(val[1,1,2,0],0.0,"wrong value for (1,1,2,0)")
310             self.failUnlessEqual(val[1,1,2,1],0.0,"wrong value for (1,1,2,1)")
311             self.failUnlessEqual(val[1,1,2,2],0.0,"wrong value for (1,1,2,2)")
312             self.failUnlessEqual(val[1,2,0,0],0.0,"wrong value for (1,2,0,0)")
313             self.failUnlessEqual(val[1,2,0,1],0.0,"wrong value for (1,2,0,1)")
314             self.failUnlessEqual(val[1,2,0,2],0.0,"wrong value for (1,2,0,2)")
315             self.failUnlessEqual(val[1,2,1,0],0.0,"wrong value for (1,2,1,0)")
316             self.failUnlessEqual(val[1,2,1,1],0.0,"wrong value for (1,2,1,1)")
317             self.failUnlessEqual(val[1,2,1,2],1.0,"wrong value for (1,2,1,2)")
318             self.failUnlessEqual(val[1,2,2,0],0.0,"wrong value for (1,2,2,0)")
319             self.failUnlessEqual(val[1,2,2,1],0.0,"wrong value for (1,2,2,1)")
320             self.failUnlessEqual(val[1,2,2,2],0.0,"wrong value for (1,2,2,2)")
321             self.failUnlessEqual(val[2,0,0,0],0.0,"wrong value for (2,0,0,0)")
322             self.failUnlessEqual(val[2,0,0,1],0.0,"wrong value for (2,0,0,1)")
323             self.failUnlessEqual(val[2,0,0,2],0.0,"wrong value for (2,0,0,2)")
324             self.failUnlessEqual(val[2,0,1,0],0.0,"wrong value for (2,0,1,0)")
325             self.failUnlessEqual(val[2,0,1,1],0.0,"wrong value for (2,0,1,1)")
326             self.failUnlessEqual(val[2,0,1,2],0.0,"wrong value for (2,0,1,2)")
327             self.failUnlessEqual(val[2,0,2,0],1.0,"wrong value for (2,0,2,0)")
328             self.failUnlessEqual(val[2,0,2,1],0.0,"wrong value for (2,0,2,1)")
329             self.failUnlessEqual(val[2,0,2,2],0.0,"wrong value for (2,0,2,2)")
330             self.failUnlessEqual(val[2,1,0,0],0.0,"wrong value for (2,1,0,0)")
331             self.failUnlessEqual(val[2,1,0,1],0.0,"wrong value for (2,1,0,1)")
332             self.failUnlessEqual(val[2,1,0,2],0.0,"wrong value for (2,1,0,2)")
333             self.failUnlessEqual(val[2,1,1,0],0.0,"wrong value for (2,1,1,0)")
334             self.failUnlessEqual(val[2,1,1,1],0.0,"wrong value for (2,1,1,1)")
335             self.failUnlessEqual(val[2,1,1,2],0.0,"wrong value for (2,1,1,2)")
336             self.failUnlessEqual(val[2,1,2,0],0.0,"wrong value for (2,1,2,0)")
337             self.failUnlessEqual(val[2,1,2,1],1.0,"wrong value for (2,1,2,1)")
338             self.failUnlessEqual(val[2,1,2,2],0.0,"wrong value for (2,1,2,2)")
339             self.failUnlessEqual(val[2,2,0,0],0.0,"wrong value for (2,2,0,0)")
340             self.failUnlessEqual(val[2,2,0,1],0.0,"wrong value for (2,2,0,1)")
341             self.failUnlessEqual(val[2,2,0,2],0.0,"wrong value for (2,2,0,2)")
342             self.failUnlessEqual(val[2,2,1,0],0.0,"wrong value for (2,2,1,0)")
343             self.failUnlessEqual(val[2,2,1,1],0.0,"wrong value for (2,2,1,1)")
344             self.failUnlessEqual(val[2,2,1,2],0.0,"wrong value for (2,2,1,2)")
345             self.failUnlessEqual(val[2,2,2,0],0.0,"wrong value for (2,2,2,0)")
346             self.failUnlessEqual(val[2,2,2,1],0.0,"wrong value for (2,2,2,1)")
347             self.failUnlessEqual(val[2,2,2,2],1.0,"wrong value for (2,2,2,2)")
348       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
349       def test_identityTensor4_functionspace(self):
350          val=identityTensor4(d=self.functionspace)
351          self.failUnless(isinstance(val,escript.Data),"wrong type of result.")
352          self.failUnlessEqual(val.getShape(),(self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")
353          if self.domain.getDim()==2:
354             self.failUnless(Lsup(val[0,0,0,0]-1.0)<=self.RES_TOL,"wrong value for (0,0,0,0)")
355             self.failUnless(Lsup(val[0,0,0,1]-0.0)<=self.RES_TOL,"wrong value for (0,0,0,1)")
356             self.failUnless(Lsup(val[0,0,1,0]-0.0)<=self.RES_TOL,"wrong value for (0,0,1,0)")
357             self.failUnless(Lsup(val[0,0,1,1]-0.0)<=self.RES_TOL,"wrong value for (0,0,1,1)")
358             self.failUnless(Lsup(val[0,1,0,0]-0.0)<=self.RES_TOL,"wrong value for (0,1,0,0)")
359             self.failUnless(Lsup(val[0,1,0,1]-1.0)<=self.RES_TOL,"wrong value for (0,1,0,1)")
360             self.failUnless(Lsup(val[0,1,1,0]-0.0)<=self.RES_TOL,"wrong value for (0,1,1,0)")
361             self.failUnless(Lsup(val[0,1,1,1]-0.0)<=self.RES_TOL,"wrong value for (0,1,1,1)")
362             self.failUnless(Lsup(val[1,0,0,0]-0.0)<=self.RES_TOL,"wrong value for (1,0,0,0)")
363             self.failUnless(Lsup(val[1,0,0,1]-0.0)<=self.RES_TOL,"wrong value for (1,0,0,1)")
364             self.failUnless(Lsup(val[1,0,1,0]-1.0)<=self.RES_TOL,"wrong value for (1,0,1,0)")
365             self.failUnless(Lsup(val[1,0,1,1]-0.0)<=self.RES_TOL,"wrong value for (1,0,1,1)")
366             self.failUnless(Lsup(val[1,1,0,0]-0.0)<=self.RES_TOL,"wrong value for (1,1,0,0)")
367             self.failUnless(Lsup(val[1,1,0,1]-0.0)<=self.RES_TOL,"wrong value for (1,1,0,1)")
368             self.failUnless(Lsup(val[1,1,1,0]-0.0)<=self.RES_TOL,"wrong value for (1,1,1,0)")
369             self.failUnless(Lsup(val[1,1,1,1]-1.0)<=self.RES_TOL,"wrong value for (1,1,1,1)")
370          if self.domain.getDim()==3:
371             self.failUnless(Lsup(val[0,0,0,0]-1.0)<=self.RES_TOL,"wrong value for (0,0,0,0)")
372             self.failUnless(Lsup(val[0,0,0,1]-0.0)<=self.RES_TOL,"wrong value for (0,0,0,1)")
373             self.failUnless(Lsup(val[0,0,0,2]-0.0)<=self.RES_TOL,"wrong value for (0,0,0,2)")
374             self.failUnless(Lsup(val[0,0,1,0]-0.0)<=self.RES_TOL,"wrong value for (0,0,1,0)")
375             self.failUnless(Lsup(val[0,0,1,1]-0.0)<=self.RES_TOL,"wrong value for (0,0,1,1)")
376             self.failUnless(Lsup(val[0,0,1,2]-0.0)<=self.RES_TOL,"wrong value for (0,0,1,2)")
377             self.failUnless(Lsup(val[0,0,2,0]-0.0)<=self.RES_TOL,"wrong value for (0,0,2,0)")
378             self.failUnless(Lsup(val[0,0,2,1]-0.0)<=self.RES_TOL,"wrong value for (0,0,2,1)")
379             self.failUnless(Lsup(val[0,0,2,2]-0.0)<=self.RES_TOL,"wrong value for (0,0,2,2)")
380             self.failUnless(Lsup(val[0,1,0,0]-0.0)<=self.RES_TOL,"wrong value for (0,1,0,0)")
381             self.failUnless(Lsup(val[0,1,0,1]-1.0)<=self.RES_TOL,"wrong value for (0,1,0,1)")
382             self.failUnless(Lsup(val[0,1,0,2]-0.0)<=self.RES_TOL,"wrong value for (0,1,0,2)")
383             self.failUnless(Lsup(val[0,1,1,0]-0.0)<=self.RES_TOL,"wrong value for (0,1,1,0)")
384             self.failUnless(Lsup(val[0,1,1,1]-0.0)<=self.RES_TOL,"wrong value for (0,1,1,1)")
385             self.failUnless(Lsup(val[0,1,1,2]-0.0)<=self.RES_TOL,"wrong value for (0,1,1,2)")
386             self.failUnless(Lsup(val[0,1,2,0]-0.0)<=self.RES_TOL,"wrong value for (0,1,2,0)")
387             self.failUnless(Lsup(val[0,1,2,1]-0.0)<=self.RES_TOL,"wrong value for (0,1,2,1)")
388             self.failUnless(Lsup(val[0,1,2,2]-0.0)<=self.RES_TOL,"wrong value for (0,1,2,2)")
389             self.failUnless(Lsup(val[0,2,0,0]-0.0)<=self.RES_TOL,"wrong value for (0,2,0,0)")
390             self.failUnless(Lsup(val[0,2,0,1]-0.0)<=self.RES_TOL,"wrong value for (0,2,0,1)")
391             self.failUnless(Lsup(val[0,2,0,2]-1.0)<=self.RES_TOL,"wrong value for (0,2,0,2)")
392             self.failUnless(Lsup(val[0,2,1,0]-0.0)<=self.RES_TOL,"wrong value for (0,2,1,0)")
393             self.failUnless(Lsup(val[0,2,1,1]-0.0)<=self.RES_TOL,"wrong value for (0,2,1,1)")
394             self.failUnless(Lsup(val[0,2,1,2]-0.0)<=self.RES_TOL,"wrong value for (0,2,1,2)")
395             self.failUnless(Lsup(val[0,2,2,0]-0.0)<=self.RES_TOL,"wrong value for (0,2,2,0)")
396             self.failUnless(Lsup(val[0,2,2,1]-0.0)<=self.RES_TOL,"wrong value for (0,2,2,1)")
397             self.failUnless(Lsup(val[0,2,2,2]-0.0)<=self.RES_TOL,"wrong value for (0,2,2,2)")
398             self.failUnless(Lsup(val[1,0,0,0]-0.0)<=self.RES_TOL,"wrong value for (1,0,0,0)")
399             self.failUnless(Lsup(val[1,0,0,1]-0.0)<=self.RES_TOL,"wrong value for (1,0,0,1)")
400             self.failUnless(Lsup(val[1,0,0,2]-0.0)<=self.RES_TOL,"wrong value for (1,0,0,2)")
401             self.failUnless(Lsup(val[1,0,1,0]-1.0)<=self.RES_TOL,"wrong value for (1,0,1,0)")
402             self.failUnless(Lsup(val[1,0,1,1]-0.0)<=self.RES_TOL,"wrong value for (1,0,1,1)")
403             self.failUnless(Lsup(val[1,0,1,2]-0.0)<=self.RES_TOL,"wrong value for (1,0,1,2)")
404             self.failUnless(Lsup(val[1,0,2,0]-0.0)<=self.RES_TOL,"wrong value for (1,0,2,0)")
405             self.failUnless(Lsup(val[1,0,2,1]-0.0)<=self.RES_TOL,"wrong value for (1,0,2,1)")
406             self.failUnless(Lsup(val[1,0,2,2]-0.0)<=self.RES_TOL,"wrong value for (1,0,2,2)")
407             self.failUnless(Lsup(val[1,1,0,0]-0.0)<=self.RES_TOL,"wrong value for (1,1,0,0)")
408             self.failUnless(Lsup(val[1,1,0,1]-0.0)<=self.RES_TOL,"wrong value for (1,1,0,1)")
409             self.failUnless(Lsup(val[1,1,0,2]-0.0)<=self.RES_TOL,"wrong value for (1,1,0,2)")
410             self.failUnless(Lsup(val[1,1,1,0]-0.0)<=self.RES_TOL,"wrong value for (1,1,1,0)")
411             self.failUnless(Lsup(val[1,1,1,1]-1.0)<=self.RES_TOL,"wrong value for (1,1,1,1)")
412             self.failUnless(Lsup(val[1,1,1,2]-0.0)<=self.RES_TOL,"wrong value for (1,1,1,2)")
413             self.failUnless(Lsup(val[1,1,2,0]-0.0)<=self.RES_TOL,"wrong value for (1,1,2,0)")
414             self.failUnless(Lsup(val[1,1,2,1]-0.0)<=self.RES_TOL,"wrong value for (1,1,2,1)")
415             self.failUnless(Lsup(val[1,1,2,2]-0.0)<=self.RES_TOL,"wrong value for (1,1,2,2)")
416             self.failUnless(Lsup(val[1,2,0,0]-0.0)<=self.RES_TOL,"wrong value for (1,2,0,0)")
417             self.failUnless(Lsup(val[1,2,0,1]-0.0)<=self.RES_TOL,"wrong value for (1,2,0,1)")
418             self.failUnless(Lsup(val[1,2,0,2]-0.0)<=self.RES_TOL,"wrong value for (1,2,0,2)")
419             self.failUnless(Lsup(val[1,2,1,0]-0.0)<=self.RES_TOL,"wrong value for (1,2,1,0)")
420             self.failUnless(Lsup(val[1,2,1,1]-0.0)<=self.RES_TOL,"wrong value for (1,2,1,1)")
421             self.failUnless(Lsup(val[1,2,1,2]-1.0)<=self.RES_TOL,"wrong value for (1,2,1,2)")
422             self.failUnless(Lsup(val[1,2,2,0]-0.0)<=self.RES_TOL,"wrong value for (1,2,2,0)")
423             self.failUnless(Lsup(val[1,2,2,1]-0.0)<=self.RES_TOL,"wrong value for (1,2,2,1)")
424             self.failUnless(Lsup(val[1,2,2,2]-0.0)<=self.RES_TOL,"wrong value for (1,2,2,2)")
425             self.failUnless(Lsup(val[2,0,0,0]-0.0)<=self.RES_TOL,"wrong value for (2,0,0,0)")
426             self.failUnless(Lsup(val[2,0,0,1]-0.0)<=self.RES_TOL,"wrong value for (2,0,0,1)")
427             self.failUnless(Lsup(val[2,0,0,2]-0.0)<=self.RES_TOL,"wrong value for (2,0,0,2)")
428             self.failUnless(Lsup(val[2,0,1,0]-0.0)<=self.RES_TOL,"wrong value for (2,0,1,0)")
429             self.failUnless(Lsup(val[2,0,1,1]-0.0)<=self.RES_TOL,"wrong value for (2,0,1,1)")
430             self.failUnless(Lsup(val[2,0,1,2]-0.0)<=self.RES_TOL,"wrong value for (2,0,1,2)")
431             self.failUnless(Lsup(val[2,0,2,0]-1.0)<=self.RES_TOL,"wrong value for (2,0,2,0)")
432             self.failUnless(Lsup(val[2,0,2,1]-0.0)<=self.RES_TOL,"wrong value for (2,0,2,1)")
433             self.failUnless(Lsup(val[2,0,2,2]-0.0)<=self.RES_TOL,"wrong value for (2,0,2,2)")
434             self.failUnless(Lsup(val[2,1,0,0]-0.0)<=self.RES_TOL,"wrong value for (2,1,0,0)")
435             self.failUnless(Lsup(val[2,1,0,1]-0.0)<=self.RES_TOL,"wrong value for (2,1,0,1)")
436             self.failUnless(Lsup(val[2,1,0,2]-0.0)<=self.RES_TOL,"wrong value for (2,1,0,2)")
437             self.failUnless(Lsup(val[2,1,1,0]-0.0)<=self.RES_TOL,"wrong value for (2,1,1,0)")
438             self.failUnless(Lsup(val[2,1,1,1]-0.0)<=self.RES_TOL,"wrong value for (2,1,1,1)")
439             self.failUnless(Lsup(val[2,1,1,2]-0.0)<=self.RES_TOL,"wrong value for (2,1,1,2)")
440             self.failUnless(Lsup(val[2,1,2,0]-0.0)<=self.RES_TOL,"wrong value for (2,1,2,0)")
441             self.failUnless(Lsup(val[2,1,2,1]-1.0)<=self.RES_TOL,"wrong value for (2,1,2,1)")
442             self.failUnless(Lsup(val[2,1,2,2]-0.0)<=self.RES_TOL,"wrong value for (2,1,2,2)")
443             self.failUnless(Lsup(val[2,2,0,0]-0.0)<=self.RES_TOL,"wrong value for (2,2,0,0)")
444             self.failUnless(Lsup(val[2,2,0,1]-0.0)<=self.RES_TOL,"wrong value for (2,2,0,1)")
445             self.failUnless(Lsup(val[2,2,0,2]-0.0)<=self.RES_TOL,"wrong value for (2,2,0,2)")
446             self.failUnless(Lsup(val[2,2,1,0]-0.0)<=self.RES_TOL,"wrong value for (2,2,1,0)")
447             self.failUnless(Lsup(val[2,2,1,1]-0.0)<=self.RES_TOL,"wrong value for (2,2,1,1)")
448             self.failUnless(Lsup(val[2,2,1,2]-0.0)<=self.RES_TOL,"wrong value for (2,2,1,2)")
449             self.failUnless(Lsup(val[2,2,2,0]-0.0)<=self.RES_TOL,"wrong value for (2,2,2,0)")
450             self.failUnless(Lsup(val[2,2,2,1]-0.0)<=self.RES_TOL,"wrong value for (2,2,2,1)")
451             self.failUnless(Lsup(val[2,2,2,2]-1.0)<=self.RES_TOL,"wrong value for (2,2,2,2)")
452     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
453     def test_unitVector_1(self):     def test_unitVector_1(self):
454        val=unitVector(i=0,d=1)        val=unitVector(i=0,d=1)
# Line 234  class Test_util_base(unittest.TestCase): Line 477  class Test_util_base(unittest.TestCase):
477        self.failUnlessEqual(val[2],1.0,"wrong value for 2 in the 2 vector")        self.failUnlessEqual(val[2],1.0,"wrong value for 2 in the 2 vector")
478     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
479     def test_unitVector_domain(self):     def test_unitVector_domain(self):
480        val=unitVector(i=0,d=self.functionspace)        val=unitVector(i=0,d=self.domain)
481        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")
482        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),),"wrong shape.")        self.failUnlessEqual(val.shape,(self.domain.getDim(),),"wrong shape.")
483          if self.domain.getDim()==2:
484             self.failUnlessEqual(val[0],1.0,"wrong value for 0 in the 0 vector")
485             self.failUnlessEqual(val[1],0.0,"wrong value for 1 in the 0 vector")
486          if self.domain.getDim()==3:
487             self.failUnlessEqual(val[0],1.0,"wrong value for 0 in the 0 vector")
488             self.failUnlessEqual(val[1],0.0,"wrong value for 1 in the 0 vector")
489             self.failUnlessEqual(val[2],0.0,"wrong value for 2 in the 0 vector")
490       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
491       def test_unitVector_functionspace(self):
492          val=unitVector(i=0,d=self.functionspace)
493          self.failUnless(isinstance(val,escript.Data),"wrong type of result.")
494          self.failUnlessEqual(val.getShape(),(self.functionspace.getDim(),),"wrong shape.")
495          if self.domain.getDim()==2:
496             self.failUnless(Lsup(val[0]-1.0)<=self.RES_TOL,"wrong value for 0 in the 0 vector")
497             self.failUnless(Lsup(val[1]-0.0)<=self.RES_TOL,"wrong value for 1 in the 0 vector")
498          if self.domain.getDim()==3:
499             self.failUnless(Lsup(val[0]-1.0)<=self.RES_TOL,"wrong value for 0 in the 0 vector")
500             self.failUnless(Lsup(val[1]-0.0)<=self.RES_TOL,"wrong value for 1 in the 0 vector")
501             self.failUnless(Lsup(val[2]-0.0)<=self.RES_TOL,"wrong value for 2 in the 0 vector")
502  #=========================================================  #=========================================================
503  #  Symbols  #  Symbols
504  #=========================================================  #=========================================================

Legend:
Removed from v.441  
changed lines
  Added in v.442

  ViewVC Help
Powered by ViewVC 1.1.26