Parent Directory | Revision Log | Patch
trunk/esys2/escript/py_src/test_util.py revision 153 by jgs, Tue Oct 25 01:51:20 2005 UTC | trunk/escript/py_src/test_util.py revision 341 by gross, Mon Dec 12 05:26:10 2005 UTC | |
---|---|---|
# | Line 1 | Line 1 |
1 | # $Id$ | # $Id$ |
2 | """ | """ |
3 | Test suite for the util.py module | Test suite for the util.py module. |
4 | ||
5 | The tests must be linked with a function space class object in the setUp method: | The tests must be linked with a function space class object in the setUp method: |
6 | ||
7 | from esys.finley import Rectangle | The test are grouped as |
8 | class Test_UtilOnFinley(Test_Util): | |
9 | Test_util_basic: some basic tests | |
10 | ||
11 | Test_util_unary_no_tagged_data: test for unary operations with no | |
12 | Test_util_unary_tagged_data: test for unary operations | |
13 | Test_util_unary: test for unary operations | |
14 | ||
15 | Test_util_reduction_no_tagged_data: test for unary operations with no | |
16 | Test_util_reduction_tagged_data: test for unary operations | |
17 | Test_util_reduction: test for unary operations | |
18 | ||
19 | Test_util_binary_no_tagged_data: test for unary operations with no | |
20 | Test_util_binary_tagged_data: test for unary operations | |
21 | Test_util_binary: test for unary operations | |
22 | ||
23 | Test_util_overloaded_operations_no_tagged_data: test for unary operations with no | |
24 | Test_util_overloaded_operations_tagged_data: test for unary operations | |
25 | Test_util_overloaded_operations test for unary operations | |
26 | ||
27 | Test_util_no_tagged_data: all test withour tagged data | |
28 | Test_util_tagged_data: all test with tagged data only | |
29 | Test_util: all test | |
30 | ||
31 | ||
32 | to run the use: | |
33 | ||
34 | from esys.bruce import Brick | |
35 | class Test_utilOnBruce(Test_util_no_tagged_data): | |
36 | def setUp(self): | def setUp(self): |
37 | self.functionspace = FunctionOnBoundary(Rectangle(10,10,2)) | self.domain = Brick(10,10,13) |
38 | self.functionspace = ContinuousFunction(self.domain) | |
39 | suite = unittest.TestSuite() | suite = unittest.TestSuite() |
40 | suite.addTest(unittest.makeSuite(Test_UtilOnFinley)) | suite.addTest(unittest.makeSuite(Test_utilOnBruce)) |
41 | unittest.TextTestRunner(verbosity=2).run(suite) | unittest.TextTestRunner(verbosity=2).run(suite) |
42 | ||
43 | The test assumes that that the functionspace has samples with tags equal to an different from 1. | For function spaces which support tagging there is the extended test case Test_util_with_tagged_data available. |
44 | This test assumes that the functionspace has samples with tags equal to 1 and different from 1. | |
45 | ||
46 | @note: at this stage thsi test will not pass as it tests for functionlity that has not been implemented yet. It also does not test the full functionalitu of util.py yet. | |
47 | ||
48 | @var __author__: name of author | |
49 | @var __licence__: licence agreement | |
50 | @var __url__: url entry point on documentation | |
51 | @var __version__: version | |
52 | @var __date__: date of the version | |
53 | """ | """ |
54 | ||
55 | __author__="Lutz Gross, l.gross@uq.edu.au" | __author__="Lutz Gross, l.gross@uq.edu.au" |
56 | __licence__="contact: esys@access.uq.edu.au" | __licence__="contact: esys@access.uq.edu.au" |
57 | __url__="http://www.iservo.edu.au/esys/escript" | __url__="http://www.iservo.edu.au/esys/escript" |
58 | __version__="$Revision" | __version__="$Revision: 313 $" |
59 | __date__="$Date$" | __date__="$Date$" |
60 | ||
61 | import unittest | import unittest |
62 | import numarray | import numarray |
63 | from esys.escript import * | from esys.escript import * |
64 | ||
65 | class Test_Util(unittest.TestCase): | class Test_util_base(unittest.TestCase): |
66 | tol=1.e-7 | """ |
67 | basic tests on util.py | |
68 | """ | |
69 | RES_TOL=1.e-7 # RES_TOLerance to compare results | |
70 | DIFF_TOL=1.e-7 # RES_TOLerance to derivatices | |
71 | #========================================================= | #========================================================= |
72 | # constants | # constants |
73 | #========================================================= | #========================================================= |
# | Line 239 class Test_Util(unittest.TestCase): | Line 279 class Test_Util(unittest.TestCase): |
279 | val=unitVector(i=0,d=self.functionspace) | val=unitVector(i=0,d=self.functionspace) |
280 | self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.") | self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.") |
281 | self.failUnlessEqual(val.shape,(self.functionspace.getDim(),),"wrong shape.") | self.failUnlessEqual(val.shape,(self.functionspace.getDim(),),"wrong shape.") |
282 | #========================================================================= | #========================================================= |
283 | # global reduction operations (these functions have no symbolic version) | # Symbols |
284 | #========================================================================= | #========================================================= |
285 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
286 | def test_Symbol_rank0_dNone_nargs0(self): | |
287 | s2=Symbol(shape=()) | |
288 | s=Symbol(shape=(),dim=None,args=[]) | |
289 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
290 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
291 | self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.") | |
292 | self.failUnlessEqual(s.getArgument(),[],"wrong arguments.") | |
293 | ||
294 | ss=s.substitute({s:numarray.zeros(())}) | |
295 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
296 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
297 | try: | |
298 | s.substitute({s:numarray.zeros((5,))}) | |
299 | fail("illegal substition was successful") | |
300 | except TypeError: | |
301 | pass | |
302 | ||
303 | dsdarg=s.diff(Symbol(shape=())) | |
304 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
305 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
306 | dsdarg=s.diff(Symbol(shape=(2,))) | |
307 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
308 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
309 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
310 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
311 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
312 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
313 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
314 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
315 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
316 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
317 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
318 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
319 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
320 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
321 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
322 | ||
323 | dsds=s.diff(s) | |
324 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
325 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
326 | ||
327 | sa=s.getSubstitutedArguments({s2:-10}) | |
328 | self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments") | |
329 | ||
330 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
331 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
332 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute") | |
333 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
334 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
335 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
336 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
337 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
338 | def test_Symbol_rank0_dNone_nargs1(self): | |
339 | s2=Symbol(shape=()) | |
340 | s=Symbol(shape=(),dim=None,args=[s2]) | |
341 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
342 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
343 | self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.") | |
344 | self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.") | |
345 | ||
346 | ss=s.substitute({s:numarray.zeros(())}) | |
347 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
348 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
349 | try: | |
350 | s.substitute({s:numarray.zeros((5,))}) | |
351 | fail("illegal substition was successful") | |
352 | except TypeError: | |
353 | pass | |
354 | ||
355 | dsdarg=s.diff(Symbol(shape=())) | |
356 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
357 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
358 | dsdarg=s.diff(Symbol(shape=(2,))) | |
359 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
360 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
361 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
362 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
363 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
364 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
365 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
366 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
367 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
368 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
369 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
370 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
371 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
372 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
373 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
374 | ||
375 | dsds=s.diff(s) | |
376 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
377 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
378 | ||
379 | self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.") | |
380 | sa=s.getSubstitutedArguments({s2:-10}) | |
381 | self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments") | |
382 | self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.") | |
383 | ||
384 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
385 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
386 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute") | |
387 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
388 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
389 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
390 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
391 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
392 | def test_Symbol_rank0_dNone_nargs2(self): | |
393 | s2=Symbol(shape=()) | |
394 | s=Symbol(shape=(),dim=None,args=[1, -1.0]) | |
395 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
396 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
397 | self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.") | |
398 | self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.") | |
399 | ||
400 | ss=s.substitute({s:numarray.zeros(())}) | |
401 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
402 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
403 | try: | |
404 | s.substitute({s:numarray.zeros((5,))}) | |
405 | fail("illegal substition was successful") | |
406 | except TypeError: | |
407 | pass | |
408 | ||
409 | dsdarg=s.diff(Symbol(shape=())) | |
410 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
411 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
412 | dsdarg=s.diff(Symbol(shape=(2,))) | |
413 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
414 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
415 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
416 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
417 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
418 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
419 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
420 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
421 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
422 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
423 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
424 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
425 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
426 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
427 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
428 | ||
429 | dsds=s.diff(s) | |
430 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
431 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
432 | ||
433 | self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.") | |
434 | self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.") | |
435 | sa=s.getSubstitutedArguments({s2:-10}) | |
436 | self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments") | |
437 | self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.") | |
438 | self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.") | |
439 | ||
440 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
441 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
442 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute") | |
443 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
444 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
445 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
446 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
447 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
448 | def test_Symbol_rank0_dd_nargs0(self): | |
449 | s2=Symbol(shape=()) | |
450 | s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[]) | |
451 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
452 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
453 | self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.") | |
454 | self.failUnlessEqual(s.getArgument(),[],"wrong arguments.") | |
455 | ||
456 | ss=s.substitute({s:numarray.zeros(())}) | |
457 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
458 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
459 | try: | |
460 | s.substitute({s:numarray.zeros((5,))}) | |
461 | fail("illegal substition was successful") | |
462 | except TypeError: | |
463 | pass | |
464 | ||
465 | dsdarg=s.diff(Symbol(shape=())) | |
466 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
467 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
468 | dsdarg=s.diff(Symbol(shape=(2,))) | |
469 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
470 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
471 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
472 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
473 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
474 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
475 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
476 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
477 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
478 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
479 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
480 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
481 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
482 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
483 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
484 | ||
485 | dsds=s.diff(s) | |
486 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
487 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
488 | ||
489 | sa=s.getSubstitutedArguments({s2:-10}) | |
490 | self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments") | |
491 | ||
492 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
493 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
494 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute") | |
495 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
496 | self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute") | |
497 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
498 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
499 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
500 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
501 | def test_Symbol_rank0_dd_nargs1(self): | |
502 | s2=Symbol(shape=()) | |
503 | s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[s2]) | |
504 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
505 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
506 | self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.") | |
507 | self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.") | |
508 | ||
509 | ss=s.substitute({s:numarray.zeros(())}) | |
510 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
511 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
512 | try: | |
513 | s.substitute({s:numarray.zeros((5,))}) | |
514 | fail("illegal substition was successful") | |
515 | except TypeError: | |
516 | pass | |
517 | ||
518 | dsdarg=s.diff(Symbol(shape=())) | |
519 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
520 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
521 | dsdarg=s.diff(Symbol(shape=(2,))) | |
522 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
523 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
524 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
525 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
526 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
527 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
528 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
529 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
530 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
531 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
532 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
533 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
534 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
535 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
536 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
537 | ||
538 | dsds=s.diff(s) | |
539 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
540 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
541 | ||
542 | self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.") | |
543 | sa=s.getSubstitutedArguments({s2:-10}) | |
544 | self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments") | |
545 | self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.") | |
546 | ||
547 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
548 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
549 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute") | |
550 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
551 | self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute") | |
552 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
553 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
554 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
555 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
556 | def test_Symbol_rank0_dd_nargs2(self): | |
557 | s2=Symbol(shape=()) | |
558 | s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[1, -1.0]) | |
559 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
560 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
561 | self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.") | |
562 | self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.") | |
563 | ||
564 | ss=s.substitute({s:numarray.zeros(())}) | |
565 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
566 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
567 | try: | |
568 | s.substitute({s:numarray.zeros((5,))}) | |
569 | fail("illegal substition was successful") | |
570 | except TypeError: | |
571 | pass | |
572 | ||
573 | dsdarg=s.diff(Symbol(shape=())) | |
574 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
575 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
576 | dsdarg=s.diff(Symbol(shape=(2,))) | |
577 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
578 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
579 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
580 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
581 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
582 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
583 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
584 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
585 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
586 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
587 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
588 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
589 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
590 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
591 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
592 | ||
593 | dsds=s.diff(s) | |
594 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
595 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
596 | ||
597 | self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.") | |
598 | self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.") | |
599 | sa=s.getSubstitutedArguments({s2:-10}) | |
600 | self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments") | |
601 | self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.") | |
602 | self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.") | |
603 | ||
604 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
605 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
606 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute") | |
607 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
608 | self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute") | |
609 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
610 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
611 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
612 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
613 | def test_Symbol_rank0_d1_nargs0(self): | |
614 | s2=Symbol(shape=()) | |
615 | s=Symbol(shape=(),dim=1,args=[]) | |
616 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
617 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
618 | self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.") | |
619 | self.failUnlessEqual(s.getArgument(),[],"wrong arguments.") | |
620 | ||
621 | ss=s.substitute({s:numarray.zeros(())}) | |
622 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
623 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
624 | try: | |
625 | s.substitute({s:numarray.zeros((5,))}) | |
626 | fail("illegal substition was successful") | |
627 | except TypeError: | |
628 | pass | |
629 | ||
630 | dsdarg=s.diff(Symbol(shape=())) | |
631 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
632 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
633 | dsdarg=s.diff(Symbol(shape=(2,))) | |
634 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
635 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
636 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
637 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
638 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
639 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
640 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
641 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
642 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
643 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
644 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
645 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
646 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
647 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
648 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
649 | ||
650 | dsds=s.diff(s) | |
651 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
652 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
653 | ||
654 | sa=s.getSubstitutedArguments({s2:-10}) | |
655 | self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments") | |
656 | ||
657 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
658 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
659 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute") | |
660 | self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)") | |
661 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
662 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
663 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
664 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
665 | def test_Symbol_rank0_d1_nargs1(self): | |
666 | s2=Symbol(shape=()) | |
667 | s=Symbol(shape=(),dim=1,args=[s2]) | |
668 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
669 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
670 | self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.") | |
671 | self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.") | |
672 | ||
673 | ss=s.substitute({s:numarray.zeros(())}) | |
674 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
675 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
676 | try: | |
677 | s.substitute({s:numarray.zeros((5,))}) | |
678 | fail("illegal substition was successful") | |
679 | except TypeError: | |
680 | pass | |
681 | ||
682 | dsdarg=s.diff(Symbol(shape=())) | |
683 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
684 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
685 | dsdarg=s.diff(Symbol(shape=(2,))) | |
686 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
687 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
688 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
689 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
690 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
691 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
692 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
693 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
694 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
695 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
696 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
697 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
698 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
699 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
700 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
701 | ||
702 | dsds=s.diff(s) | |
703 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
704 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
705 | ||
706 | self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.") | |
707 | sa=s.getSubstitutedArguments({s2:-10}) | |
708 | self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments") | |
709 | self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.") | |
710 | ||
711 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
712 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
713 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute") | |
714 | self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)") | |
715 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
716 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
717 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
718 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
719 | def test_Symbol_rank0_d1_nargs2(self): | |
720 | s2=Symbol(shape=()) | |
721 | s=Symbol(shape=(),dim=1,args=[1, -1.0]) | |
722 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
723 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
724 | self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.") | |
725 | self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.") | |
726 | ||
727 | ss=s.substitute({s:numarray.zeros(())}) | |
728 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
729 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
730 | try: | |
731 | s.substitute({s:numarray.zeros((5,))}) | |
732 | fail("illegal substition was successful") | |
733 | except TypeError: | |
734 | pass | |
735 | ||
736 | dsdarg=s.diff(Symbol(shape=())) | |
737 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
738 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
739 | dsdarg=s.diff(Symbol(shape=(2,))) | |
740 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
741 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
742 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
743 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
744 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
745 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
746 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
747 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
748 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
749 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
750 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
751 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
752 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
753 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
754 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
755 | ||
756 | dsds=s.diff(s) | |
757 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
758 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
759 | ||
760 | self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.") | |
761 | self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.") | |
762 | sa=s.getSubstitutedArguments({s2:-10}) | |
763 | self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments") | |
764 | self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.") | |
765 | self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.") | |
766 | ||
767 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
768 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
769 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute") | |
770 | self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)") | |
771 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
772 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
773 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
774 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
775 | def test_Symbol_rank0_d2_nargs0(self): | |
776 | s2=Symbol(shape=()) | |
777 | s=Symbol(shape=(),dim=2,args=[]) | |
778 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
779 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
780 | self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.") | |
781 | self.failUnlessEqual(s.getArgument(),[],"wrong arguments.") | |
782 | ||
783 | ss=s.substitute({s:numarray.zeros(())}) | |
784 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
785 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
786 | try: | |
787 | s.substitute({s:numarray.zeros((5,))}) | |
788 | fail("illegal substition was successful") | |
789 | except TypeError: | |
790 | pass | |
791 | ||
792 | dsdarg=s.diff(Symbol(shape=())) | |
793 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
794 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
795 | dsdarg=s.diff(Symbol(shape=(2,))) | |
796 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
797 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
798 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
799 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
800 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
801 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
802 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
803 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
804 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
805 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
806 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
807 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
808 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
809 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
810 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
811 | ||
812 | dsds=s.diff(s) | |
813 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
814 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
815 | ||
816 | sa=s.getSubstitutedArguments({s2:-10}) | |
817 | self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments") | |
818 | ||
819 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
820 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
821 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute") | |
822 | self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)") | |
823 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
824 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
825 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
826 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
827 | def test_Symbol_rank0_d2_nargs1(self): | |
828 | s2=Symbol(shape=()) | |
829 | s=Symbol(shape=(),dim=2,args=[s2]) | |
830 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
831 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
832 | self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.") | |
833 | self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.") | |
834 | ||
835 | ss=s.substitute({s:numarray.zeros(())}) | |
836 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
837 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
838 | try: | |
839 | s.substitute({s:numarray.zeros((5,))}) | |
840 | fail("illegal substition was successful") | |
841 | except TypeError: | |
842 | pass | |
843 | ||
844 | dsdarg=s.diff(Symbol(shape=())) | |
845 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
846 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
847 | dsdarg=s.diff(Symbol(shape=(2,))) | |
848 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
849 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
850 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
851 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
852 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
853 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
854 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
855 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
856 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
857 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
858 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
859 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
860 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
861 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
862 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
863 | ||
864 | dsds=s.diff(s) | |
865 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
866 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
867 | ||
868 | self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.") | |
869 | sa=s.getSubstitutedArguments({s2:-10}) | |
870 | self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments") | |
871 | self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.") | |
872 | ||
873 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
874 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
875 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute") | |
876 | self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)") | |
877 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
878 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
879 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
880 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
881 | def test_Symbol_rank0_d2_nargs2(self): | |
882 | s2=Symbol(shape=()) | |
883 | s=Symbol(shape=(),dim=2,args=[1, -1.0]) | |
884 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
885 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
886 | self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.") | |
887 | self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.") | |
888 | ||
889 | ss=s.substitute({s:numarray.zeros(())}) | |
890 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
891 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
892 | try: | |
893 | s.substitute({s:numarray.zeros((5,))}) | |
894 | fail("illegal substition was successful") | |
895 | except TypeError: | |
896 | pass | |
897 | ||
898 | dsdarg=s.diff(Symbol(shape=())) | |
899 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
900 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
901 | dsdarg=s.diff(Symbol(shape=(2,))) | |
902 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
903 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
904 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
905 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
906 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
907 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
908 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
909 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
910 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
911 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
912 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
913 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
914 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
915 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
916 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
917 | ||
918 | dsds=s.diff(s) | |
919 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
920 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
921 | ||
922 | self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.") | |
923 | self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.") | |
924 | sa=s.getSubstitutedArguments({s2:-10}) | |
925 | self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments") | |
926 | self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.") | |
927 | self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.") | |
928 | ||
929 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
930 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
931 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute") | |
932 | self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)") | |
933 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
934 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
935 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
936 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
937 | def test_Symbol_rank0_d3_nargs0(self): | |
938 | s2=Symbol(shape=()) | |
939 | s=Symbol(shape=(),dim=3,args=[]) | |
940 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
941 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
942 | self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.") | |
943 | self.failUnlessEqual(s.getArgument(),[],"wrong arguments.") | |
944 | ||
945 | ss=s.substitute({s:numarray.zeros(())}) | |
946 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
947 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
948 | try: | |
949 | s.substitute({s:numarray.zeros((5,))}) | |
950 | fail("illegal substition was successful") | |
951 | except TypeError: | |
952 | pass | |
953 | ||
954 | dsdarg=s.diff(Symbol(shape=())) | |
955 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
956 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
957 | dsdarg=s.diff(Symbol(shape=(2,))) | |
958 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
959 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
960 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
961 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
962 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
963 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
964 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
965 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
966 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
967 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
968 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
969 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
970 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
971 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
972 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
973 | ||
974 | dsds=s.diff(s) | |
975 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
976 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
977 | ||
978 | sa=s.getSubstitutedArguments({s2:-10}) | |
979 | self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments") | |
980 | ||
981 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
982 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
983 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute") | |
984 | self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)") | |
985 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
986 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
987 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
988 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
989 | def test_Symbol_rank0_d3_nargs1(self): | |
990 | s2=Symbol(shape=()) | |
991 | s=Symbol(shape=(),dim=3,args=[s2]) | |
992 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
993 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
994 | self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.") | |
995 | self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.") | |
996 | ||
997 | ss=s.substitute({s:numarray.zeros(())}) | |
998 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
999 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
1000 | try: | |
1001 | s.substitute({s:numarray.zeros((5,))}) | |
1002 | fail("illegal substition was successful") | |
1003 | except TypeError: | |
1004 | pass | |
1005 | ||
1006 | dsdarg=s.diff(Symbol(shape=())) | |
1007 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
1008 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1009 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1010 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1011 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
1012 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1013 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1014 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1015 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
1016 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1017 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1018 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1019 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1020 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1021 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
1022 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
1023 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
1024 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
1025 | ||
1026 | dsds=s.diff(s) | |
1027 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
1028 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
1029 | ||
1030 | self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.") | |
1031 | sa=s.getSubstitutedArguments({s2:-10}) | |
1032 | self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments") | |
1033 | self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.") | |
1034 | ||
1035 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
1036 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
1037 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute") | |
1038 | self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)") | |
1039 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1040 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
1041 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1042 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1043 | def test_Symbol_rank0_d3_nargs2(self): | |
1044 | s2=Symbol(shape=()) | |
1045 | s=Symbol(shape=(),dim=3,args=[1, -1.0]) | |
1046 | self.failUnlessEqual(s.getRank(),0,"wrong rank.") | |
1047 | self.failUnlessEqual(s.getShape(),(),"wrong shape.") | |
1048 | self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.") | |
1049 | self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.") | |
1050 | ||
1051 | ss=s.substitute({s:numarray.zeros(())}) | |
1052 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1053 | self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape") | |
1054 | try: | |
1055 | s.substitute({s:numarray.zeros((5,))}) | |
1056 | fail("illegal substition was successful") | |
1057 | except TypeError: | |
1058 | pass | |
1059 | ||
1060 | dsdarg=s.diff(Symbol(shape=())) | |
1061 | self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.") | |
1062 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1063 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1064 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1065 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.") | |
1066 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1067 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1068 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1069 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.") | |
1070 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1071 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1072 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1073 | self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1074 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1075 | dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4))) | |
1076 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.") | |
1077 | self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.") | |
1078 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.") | |
1079 | ||
1080 | dsds=s.diff(s) | |
1081 | self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.") | |
1082 | self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.") | |
1083 | ||
1084 | self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.") | |
1085 | self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.") | |
1086 | sa=s.getSubstitutedArguments({s2:-10}) | |
1087 | self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments") | |
1088 | self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.") | |
1089 | self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.") | |
1090 | ||
1091 | self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute") | |
1092 | self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute") | |
1093 | self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute") | |
1094 | self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)") | |
1095 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1096 | self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute") | |
1097 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1098 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1099 | def test_Symbol_rank1_dNone_nargs0(self): | |
1100 | s2=Symbol(shape=()) | |
1101 | s=Symbol(shape=(2,),dim=None,args=[]) | |
1102 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1103 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1104 | self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.") | |
1105 | self.failUnlessEqual(s.getArgument(),[],"wrong arguments.") | |
1106 | ||
1107 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1108 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1109 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1110 | try: | |
1111 | s.substitute({s:numarray.zeros((5,))}) | |
1112 | fail("illegal substition was successful") | |
1113 | except TypeError: | |
1114 | pass | |
1115 | ||
1116 | dsdarg=s.diff(Symbol(shape=())) | |
1117 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1118 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1119 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1120 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1121 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1122 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1123 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1124 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1125 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1126 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1127 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1128 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1129 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1130 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1131 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1132 | ||
1133 | dsds=s.diff(s) | |
1134 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1135 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1136 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1137 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1138 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1139 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1140 | ||
1141 | sa=s.getSubstitutedArguments({s2:-10}) | |
1142 | self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments") | |
1143 | ||
1144 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1145 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1146 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute") | |
1147 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
1148 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1149 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1150 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1151 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1152 | def test_Symbol_rank1_dNone_nargs1(self): | |
1153 | s2=Symbol(shape=()) | |
1154 | s=Symbol(shape=(2,),dim=None,args=[s2]) | |
1155 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1156 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1157 | self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.") | |
1158 | self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.") | |
1159 | ||
1160 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1161 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1162 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1163 | try: | |
1164 | s.substitute({s:numarray.zeros((5,))}) | |
1165 | fail("illegal substition was successful") | |
1166 | except TypeError: | |
1167 | pass | |
1168 | ||
1169 | dsdarg=s.diff(Symbol(shape=())) | |
1170 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1171 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1172 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1173 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1174 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1175 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1176 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1177 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1178 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1179 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1180 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1181 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1182 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1183 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1184 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1185 | ||
1186 | dsds=s.diff(s) | |
1187 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1188 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1189 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1190 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1191 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1192 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1193 | ||
1194 | self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.") | |
1195 | sa=s.getSubstitutedArguments({s2:-10}) | |
1196 | self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments") | |
1197 | self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.") | |
1198 | ||
1199 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1200 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1201 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute") | |
1202 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
1203 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1204 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1205 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1206 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1207 | def test_Symbol_rank1_dNone_nargs2(self): | |
1208 | s2=Symbol(shape=()) | |
1209 | s=Symbol(shape=(2,),dim=None,args=[1, -1.0]) | |
1210 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1211 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1212 | self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.") | |
1213 | self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.") | |
1214 | ||
1215 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1216 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1217 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1218 | try: | |
1219 | s.substitute({s:numarray.zeros((5,))}) | |
1220 | fail("illegal substition was successful") | |
1221 | except TypeError: | |
1222 | pass | |
1223 | ||
1224 | dsdarg=s.diff(Symbol(shape=())) | |
1225 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1226 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1227 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1228 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1229 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1230 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1231 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1232 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1233 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1234 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1235 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1236 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1237 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1238 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1239 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1240 | ||
1241 | dsds=s.diff(s) | |
1242 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1243 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1244 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1245 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1246 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1247 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1248 | ||
1249 | self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.") | |
1250 | self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.") | |
1251 | sa=s.getSubstitutedArguments({s2:-10}) | |
1252 | self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments") | |
1253 | self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.") | |
1254 | self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.") | |
1255 | ||
1256 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1257 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1258 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute") | |
1259 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
1260 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1261 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1262 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1263 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1264 | def test_Symbol_rank1_dd_nargs0(self): | |
1265 | s2=Symbol(shape=()) | |
1266 | s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[]) | |
1267 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1268 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1269 | self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.") | |
1270 | self.failUnlessEqual(s.getArgument(),[],"wrong arguments.") | |
1271 | ||
1272 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1273 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1274 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1275 | try: | |
1276 | s.substitute({s:numarray.zeros((5,))}) | |
1277 | fail("illegal substition was successful") | |
1278 | except TypeError: | |
1279 | pass | |
1280 | ||
1281 | dsdarg=s.diff(Symbol(shape=())) | |
1282 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1283 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1284 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1285 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1286 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1287 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1288 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1289 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1290 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1291 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1292 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1293 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1294 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1295 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1296 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1297 | ||
1298 | dsds=s.diff(s) | |
1299 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1300 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1301 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1302 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1303 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1304 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1305 | ||
1306 | sa=s.getSubstitutedArguments({s2:-10}) | |
1307 | self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments") | |
1308 | ||
1309 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1310 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1311 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute") | |
1312 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
1313 | self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute") | |
1314 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1315 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1316 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1317 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1318 | def test_Symbol_rank1_dd_nargs1(self): | |
1319 | s2=Symbol(shape=()) | |
1320 | s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[s2]) | |
1321 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1322 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1323 | self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.") | |
1324 | self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.") | |
1325 | ||
1326 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1327 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1328 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1329 | try: | |
1330 | s.substitute({s:numarray.zeros((5,))}) | |
1331 | fail("illegal substition was successful") | |
1332 | except TypeError: | |
1333 | pass | |
1334 | ||
1335 | dsdarg=s.diff(Symbol(shape=())) | |
1336 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1337 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1338 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1339 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1340 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1341 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1342 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1343 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1344 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1345 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1346 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1347 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1348 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1349 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1350 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1351 | ||
1352 | dsds=s.diff(s) | |
1353 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1354 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1355 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1356 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1357 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1358 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1359 | ||
1360 | self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.") | |
1361 | sa=s.getSubstitutedArguments({s2:-10}) | |
1362 | self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments") | |
1363 | self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.") | |
1364 | ||
1365 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1366 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1367 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute") | |
1368 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
1369 | self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute") | |
1370 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1371 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1372 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1373 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1374 | def test_Symbol_rank1_dd_nargs2(self): | |
1375 | s2=Symbol(shape=()) | |
1376 | s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[1, -1.0]) | |
1377 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1378 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1379 | self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.") | |
1380 | self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.") | |
1381 | ||
1382 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1383 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1384 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1385 | try: | |
1386 | s.substitute({s:numarray.zeros((5,))}) | |
1387 | fail("illegal substition was successful") | |
1388 | except TypeError: | |
1389 | pass | |
1390 | ||
1391 | dsdarg=s.diff(Symbol(shape=())) | |
1392 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1393 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1394 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1395 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1396 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1397 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1398 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1399 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1400 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1401 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1402 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1403 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1404 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1405 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1406 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1407 | ||
1408 | dsds=s.diff(s) | |
1409 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1410 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1411 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1412 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1413 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1414 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1415 | ||
1416 | self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.") | |
1417 | self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.") | |
1418 | sa=s.getSubstitutedArguments({s2:-10}) | |
1419 | self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments") | |
1420 | self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.") | |
1421 | self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.") | |
1422 | ||
1423 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1424 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1425 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute") | |
1426 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
1427 | self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute") | |
1428 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1429 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1430 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1431 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1432 | def test_Symbol_rank1_d1_nargs0(self): | |
1433 | s2=Symbol(shape=()) | |
1434 | s=Symbol(shape=(2,),dim=1,args=[]) | |
1435 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1436 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1437 | self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.") | |
1438 | self.failUnlessEqual(s.getArgument(),[],"wrong arguments.") | |
1439 | ||
1440 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1441 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1442 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1443 | try: | |
1444 | s.substitute({s:numarray.zeros((5,))}) | |
1445 | fail("illegal substition was successful") | |
1446 | except TypeError: | |
1447 | pass | |
1448 | ||
1449 | dsdarg=s.diff(Symbol(shape=())) | |
1450 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1451 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1452 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1453 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1454 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1455 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1456 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1457 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1458 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1459 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1460 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1461 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1462 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1463 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1464 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1465 | ||
1466 | dsds=s.diff(s) | |
1467 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1468 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1469 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1470 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1471 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1472 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1473 | ||
1474 | sa=s.getSubstitutedArguments({s2:-10}) | |
1475 | self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments") | |
1476 | ||
1477 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1478 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1479 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=1)),"Symbol is appropriate substitute") | |
1480 | self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is not appropriate substitute (dim)") | |
1481 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1482 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1483 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1484 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1485 | def test_Symbol_rank1_d1_nargs1(self): | |
1486 | s2=Symbol(shape=()) | |
1487 | s=Symbol(shape=(2,),dim=1,args=[s2]) | |
1488 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1489 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1490 | self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.") | |
1491 | self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.") | |
1492 | ||
1493 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1494 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1495 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1496 | try: | |
1497 | s.substitute({s:numarray.zeros((5,))}) | |
1498 | fail("illegal substition was successful") | |
1499 | except TypeError: | |
1500 | pass | |
1501 | ||
1502 | dsdarg=s.diff(Symbol(shape=())) | |
1503 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1504 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1505 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1506 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1507 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1508 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1509 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1510 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1511 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1512 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1513 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1514 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1515 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1516 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1517 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1518 | ||
1519 | dsds=s.diff(s) | |
1520 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1521 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1522 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1523 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1524 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1525 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1526 | ||
1527 | self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.") | |
1528 | sa=s.getSubstitutedArguments({s2:-10}) | |
1529 | self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments") | |
1530 | self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.") | |
1531 | ||
1532 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1533 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1534 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=1)),"Symbol is appropriate substitute") | |
1535 | self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is not appropriate substitute (dim)") | |
1536 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1537 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1538 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1539 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1540 | def test_Symbol_rank1_d1_nargs2(self): | |
1541 | s2=Symbol(shape=()) | |
1542 | s=Symbol(shape=(2,),dim=1,args=[1, -1.0]) | |
1543 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1544 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1545 | self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.") | |
1546 | self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.") | |
1547 | ||
1548 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1549 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1550 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1551 | try: | |
1552 | s.substitute({s:numarray.zeros((5,))}) | |
1553 | fail("illegal substition was successful") | |
1554 | except TypeError: | |
1555 | pass | |
1556 | ||
1557 | dsdarg=s.diff(Symbol(shape=())) | |
1558 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1559 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1560 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1561 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1562 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1563 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1564 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1565 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1566 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1567 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1568 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1569 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1570 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1571 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1572 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1573 | ||
1574 | dsds=s.diff(s) | |
1575 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1576 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1577 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1578 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1579 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1580 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1581 | ||
1582 | self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.") | |
1583 | self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.") | |
1584 | sa=s.getSubstitutedArguments({s2:-10}) | |
1585 | self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments") | |
1586 | self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.") | |
1587 | self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.") | |
1588 | ||
1589 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1590 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1591 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=1)),"Symbol is appropriate substitute") | |
1592 | self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is not appropriate substitute (dim)") | |
1593 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1594 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1595 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1596 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1597 | def test_Symbol_rank1_d2_nargs0(self): | |
1598 | s2=Symbol(shape=()) | |
1599 | s=Symbol(shape=(2,),dim=2,args=[]) | |
1600 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1601 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1602 | self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.") | |
1603 | self.failUnlessEqual(s.getArgument(),[],"wrong arguments.") | |
1604 | ||
1605 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1606 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1607 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1608 | try: | |
1609 | s.substitute({s:numarray.zeros((5,))}) | |
1610 | fail("illegal substition was successful") | |
1611 | except TypeError: | |
1612 | pass | |
1613 | ||
1614 | dsdarg=s.diff(Symbol(shape=())) | |
1615 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1616 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1617 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1618 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1619 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1620 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1621 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1622 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1623 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1624 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1625 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1626 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1627 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1628 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1629 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1630 | ||
1631 | dsds=s.diff(s) | |
1632 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1633 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1634 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1635 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1636 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1637 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1638 | ||
1639 | sa=s.getSubstitutedArguments({s2:-10}) | |
1640 | self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments") | |
1641 | ||
1642 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1643 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1644 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is appropriate substitute") | |
1645 | self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is not appropriate substitute (dim)") | |
1646 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1647 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1648 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1649 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1650 | def test_Symbol_rank1_d2_nargs1(self): | |
1651 | s2=Symbol(shape=()) | |
1652 | s=Symbol(shape=(2,),dim=2,args=[s2]) | |
1653 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1654 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1655 | self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.") | |
1656 | self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.") | |
1657 | ||
1658 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1659 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1660 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1661 | try: | |
1662 | s.substitute({s:numarray.zeros((5,))}) | |
1663 | fail("illegal substition was successful") | |
1664 | except TypeError: | |
1665 | pass | |
1666 | ||
1667 | dsdarg=s.diff(Symbol(shape=())) | |
1668 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1669 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1670 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1671 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1672 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1673 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1674 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1675 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1676 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1677 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1678 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1679 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1680 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1681 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1682 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1683 | ||
1684 | dsds=s.diff(s) | |
1685 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1686 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1687 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1688 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1689 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1690 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1691 | ||
1692 | self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.") | |
1693 | sa=s.getSubstitutedArguments({s2:-10}) | |
1694 | self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments") | |
1695 | self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.") | |
1696 | ||
1697 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1698 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1699 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is appropriate substitute") | |
1700 | self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is not appropriate substitute (dim)") | |
1701 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1702 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1703 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1704 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1705 | def test_Symbol_rank1_d2_nargs2(self): | |
1706 | s2=Symbol(shape=()) | |
1707 | s=Symbol(shape=(2,),dim=2,args=[1, -1.0]) | |
1708 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1709 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1710 | self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.") | |
1711 | self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.") | |
1712 | ||
1713 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1714 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1715 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1716 | try: | |
1717 | s.substitute({s:numarray.zeros((5,))}) | |
1718 | fail("illegal substition was successful") | |
1719 | except TypeError: | |
1720 | pass | |
1721 | ||
1722 | dsdarg=s.diff(Symbol(shape=())) | |
1723 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1724 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1725 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1726 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1727 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1728 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1729 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1730 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1731 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1732 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1733 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1734 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1735 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1736 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1737 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1738 | ||
1739 | dsds=s.diff(s) | |
1740 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1741 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1742 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1743 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1744 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1745 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1746 | ||
1747 | self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.") | |
1748 | self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.") | |
1749 | sa=s.getSubstitutedArguments({s2:-10}) | |
1750 | self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments") | |
1751 | self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.") | |
1752 | self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.") | |
1753 | ||
1754 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1755 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1756 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is appropriate substitute") | |
1757 | self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is not appropriate substitute (dim)") | |
1758 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1759 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1760 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1761 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1762 | def test_Symbol_rank1_d3_nargs0(self): | |
1763 | s2=Symbol(shape=()) | |
1764 | s=Symbol(shape=(2,),dim=3,args=[]) | |
1765 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1766 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1767 | self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.") | |
1768 | self.failUnlessEqual(s.getArgument(),[],"wrong arguments.") | |
1769 | ||
1770 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1771 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1772 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1773 | try: | |
1774 | s.substitute({s:numarray.zeros((5,))}) | |
1775 | fail("illegal substition was successful") | |
1776 | except TypeError: | |
1777 | pass | |
1778 | ||
1779 | dsdarg=s.diff(Symbol(shape=())) | |
1780 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1781 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1782 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1783 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1784 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1785 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1786 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1787 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1788 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1789 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1790 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1791 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1792 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1793 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1794 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1795 | ||
1796 | dsds=s.diff(s) | |
1797 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1798 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1799 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1800 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1801 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1802 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1803 | ||
1804 | sa=s.getSubstitutedArguments({s2:-10}) | |
1805 | self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments") | |
1806 | ||
1807 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1808 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1809 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is appropriate substitute") | |
1810 | self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=4)),"Symbol is not appropriate substitute (dim)") | |
1811 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1812 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1813 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1814 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1815 | def test_Symbol_rank1_d3_nargs1(self): | |
1816 | s2=Symbol(shape=()) | |
1817 | s=Symbol(shape=(2,),dim=3,args=[s2]) | |
1818 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1819 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1820 | self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.") | |
1821 | self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.") | |
1822 | ||
1823 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1824 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1825 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1826 | try: | |
1827 | s.substitute({s:numarray.zeros((5,))}) | |
1828 | fail("illegal substition was successful") | |
1829 | except TypeError: | |
1830 | pass | |
1831 | ||
1832 | dsdarg=s.diff(Symbol(shape=())) | |
1833 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1834 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1835 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1836 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1837 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1838 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1839 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1840 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1841 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1842 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1843 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1844 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1845 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1846 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1847 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1848 | ||
1849 | dsds=s.diff(s) | |
1850 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1851 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1852 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1853 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1854 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1855 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1856 | ||
1857 | self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.") | |
1858 | sa=s.getSubstitutedArguments({s2:-10}) | |
1859 | self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments") | |
1860 | self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.") | |
1861 | ||
1862 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1863 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1864 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is appropriate substitute") | |
1865 | self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=4)),"Symbol is not appropriate substitute (dim)") | |
1866 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1867 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1868 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1869 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1870 | def test_Symbol_rank1_d3_nargs2(self): | |
1871 | s2=Symbol(shape=()) | |
1872 | s=Symbol(shape=(2,),dim=3,args=[1, -1.0]) | |
1873 | self.failUnlessEqual(s.getRank(),1,"wrong rank.") | |
1874 | self.failUnlessEqual(s.getShape(),(2,),"wrong shape.") | |
1875 | self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.") | |
1876 | self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.") | |
1877 | ||
1878 | ss=s.substitute({s:numarray.zeros((2,))}) | |
1879 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1880 | self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape") | |
1881 | try: | |
1882 | s.substitute({s:numarray.zeros((5,))}) | |
1883 | fail("illegal substition was successful") | |
1884 | except TypeError: | |
1885 | pass | |
1886 | ||
1887 | dsdarg=s.diff(Symbol(shape=())) | |
1888 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1889 | self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.") | |
1890 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1891 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1892 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1893 | self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.") | |
1894 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1895 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1896 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1897 | self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1898 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1899 | dsdarg=s.diff(Symbol(shape=(6, 2, 2))) | |
1900 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.") | |
1901 | self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.") | |
1902 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.") | |
1903 | ||
1904 | dsds=s.diff(s) | |
1905 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1906 | self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.") | |
1907 | self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).") | |
1908 | self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).") | |
1909 | self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).") | |
1910 | self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).") | |
1911 | ||
1912 | self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.") | |
1913 | self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.") | |
1914 | sa=s.getSubstitutedArguments({s2:-10}) | |
1915 | self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments") | |
1916 | self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.") | |
1917 | self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.") | |
1918 | ||
1919 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
1920 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
1921 | self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is appropriate substitute") | |
1922 | self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=4)),"Symbol is not appropriate substitute (dim)") | |
1923 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
1924 | self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute") | |
1925 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
1926 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1927 | def test_Symbol_rank2_dNone_nargs0(self): | |
1928 | s2=Symbol(shape=()) | |
1929 | s=Symbol(shape=(4, 5),dim=None,args=[]) | |
1930 | self.failUnlessEqual(s.getRank(),2,"wrong rank.") | |
1931 | self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.") | |
1932 | self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.") | |
1933 | self.failUnlessEqual(s.getArgument(),[],"wrong arguments.") | |
1934 | ||
1935 | ss=s.substitute({s:numarray.zeros((4, 5))}) | |
1936 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
1937 | self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape") | |
1938 | try: | |
1939 | s.substitute({s:numarray.zeros((5,))}) | |
1940 | fail("illegal substition was successful") | |
1941 | except TypeError: | |
1942 | pass | |
1943 | ||
1944 | dsdarg=s.diff(Symbol(shape=())) | |
1945 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
1946 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.") | |
1947 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
1948 | dsdarg=s.diff(Symbol(shape=(2,))) | |
1949 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
1950 | self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.") | |
1951 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
1952 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
1953 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
1954 | self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
1955 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
1956 | ||
1957 | dsds=s.diff(s) | |
1958 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
1959 | self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.") | |
1960 | self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).") | |
1961 | self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).") | |
1962 | self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).") | |
1963 | self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).") | |
1964 | self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).") | |
1965 | self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).") | |
1966 | self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).") | |
1967 | self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).") | |
1968 | self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).") | |
1969 | self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).") | |
1970 | self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).") | |
1971 | self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).") | |
1972 | self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).") | |
1973 | self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).") | |
1974 | self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).") | |
1975 | self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).") | |
1976 | self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).") | |
1977 | self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).") | |
1978 | self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).") | |
1979 | self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).") | |
1980 | self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).") | |
1981 | self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).") | |
1982 | self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (0,1,0,2).") | |
1983 | self.failUnlessEqual(dsds[0,1,0,3],0.0,"ds/ds has wrong value at (0,1,0,3).") | |
1984 | self.failUnlessEqual(dsds[0,1,0,4],0.0,"ds/ds has wrong value at (0,1,0,4).") | |
1985 | self.failUnlessEqual(dsds[0,1,1,0],0.0,"ds/ds has wrong value at (0,1,1,0).") | |
1986 | self.failUnlessEqual(dsds[0,1,1,1],0.0,"ds/ds has wrong value at (0,1,1,1).") | |
1987 | self.failUnlessEqual(dsds[0,1,1,2],0.0,"ds/ds has wrong value at (0,1,1,2).") | |
1988 | self.failUnlessEqual(dsds[0,1,1,3],0.0,"ds/ds has wrong value at (0,1,1,3).") | |
1989 | self.failUnlessEqual(dsds[0,1,1,4],0.0,"ds/ds has wrong value at (0,1,1,4).") | |
1990 | self.failUnlessEqual(dsds[0,1,2,0],0.0,"ds/ds has wrong value at (0,1,2,0).") | |
1991 | self.failUnlessEqual(dsds[0,1,2,1],0.0,"ds/ds has wrong value at (0,1,2,1).") | |
1992 | self.failUnlessEqual(dsds[0,1,2,2],0.0,"ds/ds has wrong value at (0,1,2,2).") | |
1993 | self.failUnlessEqual(dsds[0,1,2,3],0.0,"ds/ds has wrong value at (0,1,2,3).") | |
1994 | self.failUnlessEqual(dsds[0,1,2,4],0.0,"ds/ds has wrong value at (0,1,2,4).") | |
1995 | self.failUnlessEqual(dsds[0,1,3,0],0.0,"ds/ds has wrong value at (0,1,3,0).") | |
1996 | self.failUnlessEqual(dsds[0,1,3,1],0.0,"ds/ds has wrong value at (0,1,3,1).") | |
1997 | self.failUnlessEqual(dsds[0,1,3,2],0.0,"ds/ds has wrong value at (0,1,3,2).") | |
1998 | self.failUnlessEqual(dsds[0,1,3,3],0.0,"ds/ds has wrong value at (0,1,3,3).") | |
1999 | self.failUnlessEqual(dsds[0,1,3,4],0.0,"ds/ds has wrong value at (0,1,3,4).") | |
2000 | self.failUnlessEqual(dsds[0,2,0,0],0.0,"ds/ds has wrong value at (0,2,0,0).") | |
2001 | self.failUnlessEqual(dsds[0,2,0,1],0.0,"ds/ds has wrong value at (0,2,0,1).") | |
2002 | self.failUnlessEqual(dsds[0,2,0,2],1.0,"ds/ds has wrong value at (0,2,0,2).") | |
2003 | self.failUnlessEqual(dsds[0,2,0,3],0.0,"ds/ds has wrong value at (0,2,0,3).") | |
2004 | self.failUnlessEqual(dsds[0,2,0,4],0.0,"ds/ds has wrong value at (0,2,0,4).") | |
2005 | self.failUnlessEqual(dsds[0,2,1,0],0.0,"ds/ds has wrong value at (0,2,1,0).") | |
2006 | self.failUnlessEqual(dsds[0,2,1,1],0.0,"ds/ds has wrong value at (0,2,1,1).") | |
2007 | self.failUnlessEqual(dsds[0,2,1,2],0.0,"ds/ds has wrong value at (0,2,1,2).") | |
2008 | self.failUnlessEqual(dsds[0,2,1,3],0.0,"ds/ds has wrong value at (0,2,1,3).") | |
2009 | self.failUnlessEqual(dsds[0,2,1,4],0.0,"ds/ds has wrong value at (0,2,1,4).") | |
2010 | self.failUnlessEqual(dsds[0,2,2,0],0.0,"ds/ds has wrong value at (0,2,2,0).") | |
2011 | self.failUnlessEqual(dsds[0,2,2,1],0.0,"ds/ds has wrong value at (0,2,2,1).") | |
2012 | self.failUnlessEqual(dsds[0,2,2,2],0.0,"ds/ds has wrong value at (0,2,2,2).") | |
2013 | self.failUnlessEqual(dsds[0,2,2,3],0.0,"ds/ds has wrong value at (0,2,2,3).") | |
2014 | self.failUnlessEqual(dsds[0,2,2,4],0.0,"ds/ds has wrong value at (0,2,2,4).") | |
2015 | self.failUnlessEqual(dsds[0,2,3,0],0.0,"ds/ds has wrong value at (0,2,3,0).") | |
2016 | self.failUnlessEqual(dsds[0,2,3,1],0.0,"ds/ds has wrong value at (0,2,3,1).") | |
2017 | self.failUnlessEqual(dsds[0,2,3,2],0.0,"ds/ds has wrong value at (0,2,3,2).") | |
2018 | self.failUnlessEqual(dsds[0,2,3,3],0.0,"ds/ds has wrong value at (0,2,3,3).") | |
2019 | self.failUnlessEqual(dsds[0,2,3,4],0.0,"ds/ds has wrong value at (0,2,3,4).") | |
2020 | self.failUnlessEqual(dsds[0,3,0,0],0.0,"ds/ds has wrong value at (0,3,0,0).") | |
2021 | self.failUnlessEqual(dsds[0,3,0,1],0.0,"ds/ds has wrong value at (0,3,0,1).") | |
2022 | self.failUnlessEqual(dsds[0,3,0,2],0.0,"ds/ds has wrong value at (0,3,0,2).") | |
2023 | self.failUnlessEqual(dsds[0,3,0,3],1.0,"ds/ds has wrong value at (0,3,0,3).") | |
2024 | self.failUnlessEqual(dsds[0,3,0,4],0.0,"ds/ds has wrong value at (0,3,0,4).") | |
2025 | self.failUnlessEqual(dsds[0,3,1,0],0.0,"ds/ds has wrong value at (0,3,1,0).") | |
2026 | self.failUnlessEqual(dsds[0,3,1,1],0.0,"ds/ds has wrong value at (0,3,1,1).") | |
2027 | self.failUnlessEqual(dsds[0,3,1,2],0.0,"ds/ds has wrong value at (0,3,1,2).") | |
2028 | self.failUnlessEqual(dsds[0,3,1,3],0.0,"ds/ds has wrong value at (0,3,1,3).") | |
2029 | self.failUnlessEqual(dsds[0,3,1,4],0.0,"ds/ds has wrong value at (0,3,1,4).") | |
2030 | self.failUnlessEqual(dsds[0,3,2,0],0.0,"ds/ds has wrong value at (0,3,2,0).") | |
2031 | self.failUnlessEqual(dsds[0,3,2,1],0.0,"ds/ds has wrong value at (0,3,2,1).") | |
2032 | self.failUnlessEqual(dsds[0,3,2,2],0.0,"ds/ds has wrong value at (0,3,2,2).") | |
2033 | self.failUnlessEqual(dsds[0,3,2,3],0.0,"ds/ds has wrong value at (0,3,2,3).") | |
2034 | self.failUnlessEqual(dsds[0,3,2,4],0.0,"ds/ds has wrong value at (0,3,2,4).") | |
2035 | self.failUnlessEqual(dsds[0,3,3,0],0.0,"ds/ds has wrong value at (0,3,3,0).") | |
2036 | self.failUnlessEqual(dsds[0,3,3,1],0.0,"ds/ds has wrong value at (0,3,3,1).") | |
2037 | self.failUnlessEqual(dsds[0,3,3,2],0.0,"ds/ds has wrong value at (0,3,3,2).") | |
2038 | self.failUnlessEqual(dsds[0,3,3,3],0.0,"ds/ds has wrong value at (0,3,3,3).") | |
2039 | self.failUnlessEqual(dsds[0,3,3,4],0.0,"ds/ds has wrong value at (0,3,3,4).") | |
2040 | self.failUnlessEqual(dsds[0,4,0,0],0.0,"ds/ds has wrong value at (0,4,0,0).") | |
2041 | self.failUnlessEqual(dsds[0,4,0,1],0.0,"ds/ds has wrong value at (0,4,0,1).") | |
2042 | self.failUnlessEqual(dsds[0,4,0,2],0.0,"ds/ds has wrong value at (0,4,0,2).") | |
2043 | self.failUnlessEqual(dsds[0,4,0,3],0.0,"ds/ds has wrong value at (0,4,0,3).") | |
2044 | self.failUnlessEqual(dsds[0,4,0,4],1.0,"ds/ds has wrong value at (0,4,0,4).") | |
2045 | self.failUnlessEqual(dsds[0,4,1,0],0.0,"ds/ds has wrong value at (0,4,1,0).") | |
2046 | self.failUnlessEqual(dsds[0,4,1,1],0.0,"ds/ds has wrong value at (0,4,1,1).") | |
2047 | self.failUnlessEqual(dsds[0,4,1,2],0.0,"ds/ds has wrong value at (0,4,1,2).") | |
2048 | self.failUnlessEqual(dsds[0,4,1,3],0.0,"ds/ds has wrong value at (0,4,1,3).") | |
2049 | self.failUnlessEqual(dsds[0,4,1,4],0.0,"ds/ds has wrong value at (0,4,1,4).") | |
2050 | self.failUnlessEqual(dsds[0,4,2,0],0.0,"ds/ds has wrong value at (0,4,2,0).") | |
2051 | self.failUnlessEqual(dsds[0,4,2,1],0.0,"ds/ds has wrong value at (0,4,2,1).") | |
2052 | self.failUnlessEqual(dsds[0,4,2,2],0.0,"ds/ds has wrong value at (0,4,2,2).") | |
2053 | self.failUnlessEqual(dsds[0,4,2,3],0.0,"ds/ds has wrong value at (0,4,2,3).") | |
2054 | self.failUnlessEqual(dsds[0,4,2,4],0.0,"ds/ds has wrong value at (0,4,2,4).") | |
2055 | self.failUnlessEqual(dsds[0,4,3,0],0.0,"ds/ds has wrong value at (0,4,3,0).") | |
2056 | self.failUnlessEqual(dsds[0,4,3,1],0.0,"ds/ds has wrong value at (0,4,3,1).") | |
2057 | self.failUnlessEqual(dsds[0,4,3,2],0.0,"ds/ds has wrong value at (0,4,3,2).") | |
2058 | self.failUnlessEqual(dsds[0,4,3,3],0.0,"ds/ds has wrong value at (0,4,3,3).") | |
2059 | self.failUnlessEqual(dsds[0,4,3,4],0.0,"ds/ds has wrong value at (0,4,3,4).") | |
2060 | self.failUnlessEqual(dsds[1,0,0,0],0.0,"ds/ds has wrong value at (1,0,0,0).") | |
2061 | self.failUnlessEqual(dsds[1,0,0,1],0.0,"ds/ds has wrong value at (1,0,0,1).") | |
2062 | self.failUnlessEqual(dsds[1,0,0,2],0.0,"ds/ds has wrong value at (1,0,0,2).") | |
2063 | self.failUnlessEqual(dsds[1,0,0,3],0.0,"ds/ds has wrong value at (1,0,0,3).") | |
2064 | self.failUnlessEqual(dsds[1,0,0,4],0.0,"ds/ds has wrong value at (1,0,0,4).") | |
2065 | self.failUnlessEqual(dsds[1,0,1,0],1.0,"ds/ds has wrong value at (1,0,1,0).") | |
2066 | self.failUnlessEqual(dsds[1,0,1,1],0.0,"ds/ds has wrong value at (1,0,1,1).") | |
2067 | self.failUnlessEqual(dsds[1,0,1,2],0.0,"ds/ds has wrong value at (1,0,1,2).") | |
2068 | self.failUnlessEqual(dsds[1,0,1,3],0.0,"ds/ds has wrong value at (1,0,1,3).") | |
2069 | self.failUnlessEqual(dsds[1,0,1,4],0.0,"ds/ds has wrong value at (1,0,1,4).") | |
2070 | self.failUnlessEqual(dsds[1,0,2,0],0.0,"ds/ds has wrong value at (1,0,2,0).") | |
2071 | self.failUnlessEqual(dsds[1,0,2,1],0.0,"ds/ds has wrong value at (1,0,2,1).") | |
2072 | self.failUnlessEqual(dsds[1,0,2,2],0.0,"ds/ds has wrong value at (1,0,2,2).") | |
2073 | self.failUnlessEqual(dsds[1,0,2,3],0.0,"ds/ds has wrong value at (1,0,2,3).") | |
2074 | self.failUnlessEqual(dsds[1,0,2,4],0.0,"ds/ds has wrong value at (1,0,2,4).") | |
2075 | self.failUnlessEqual(dsds[1,0,3,0],0.0,"ds/ds has wrong value at (1,0,3,0).") | |
2076 | self.failUnlessEqual(dsds[1,0,3,1],0.0,"ds/ds has wrong value at (1,0,3,1).") | |
2077 | self.failUnlessEqual(dsds[1,0,3,2],0.0,"ds/ds has wrong value at (1,0,3,2).") | |
2078 | self.failUnlessEqual(dsds[1,0,3,3],0.0,"ds/ds has wrong value at (1,0,3,3).") | |
2079 | self.failUnlessEqual(dsds[1,0,3,4],0.0,"ds/ds has wrong value at (1,0,3,4).") | |
2080 | self.failUnlessEqual(dsds[1,1,0,0],0.0,"ds/ds has wrong value at (1,1,0,0).") | |
2081 | self.failUnlessEqual(dsds[1,1,0,1],0.0,"ds/ds has wrong value at (1,1,0,1).") | |
2082 | self.failUnlessEqual(dsds[1,1,0,2],0.0,"ds/ds has wrong value at (1,1,0,2).") | |
2083 | self.failUnlessEqual(dsds[1,1,0,3],0.0,"ds/ds has wrong value at (1,1,0,3).") | |
2084 | self.failUnlessEqual(dsds[1,1,0,4],0.0,"ds/ds has wrong value at (1,1,0,4).") | |
2085 | self.failUnlessEqual(dsds[1,1,1,0],0.0,"ds/ds has wrong value at (1,1,1,0).") | |
2086 | self.failUnlessEqual(dsds[1,1,1,1],1.0,"ds/ds has wrong value at (1,1,1,1).") | |
2087 | self.failUnlessEqual(dsds[1,1,1,2],0.0,"ds/ds has wrong value at (1,1,1,2).") | |
2088 | self.failUnlessEqual(dsds[1,1,1,3],0.0,"ds/ds has wrong value at (1,1,1,3).") | |
2089 | self.failUnlessEqual(dsds[1,1,1,4],0.0,"ds/ds has wrong value at (1,1,1,4).") | |
2090 | self.failUnlessEqual(dsds[1,1,2,0],0.0,"ds/ds has wrong value at (1,1,2,0).") | |
2091 | self.failUnlessEqual(dsds[1,1,2,1],0.0,"ds/ds has wrong value at (1,1,2,1).") | |
2092 | self.failUnlessEqual(dsds[1,1,2,2],0.0,"ds/ds has wrong value at (1,1,2,2).") | |
2093 | self.failUnlessEqual(dsds[1,1,2,3],0.0,"ds/ds has wrong value at (1,1,2,3).") | |
2094 | self.failUnlessEqual(dsds[1,1,2,4],0.0,"ds/ds has wrong value at (1,1,2,4).") | |
2095 | self.failUnlessEqual(dsds[1,1,3,0],0.0,"ds/ds has wrong value at (1,1,3,0).") | |
2096 | self.failUnlessEqual(dsds[1,1,3,1],0.0,"ds/ds has wrong value at (1,1,3,1).") | |
2097 | self.failUnlessEqual(dsds[1,1,3,2],0.0,"ds/ds has wrong value at (1,1,3,2).") | |
2098 | self.failUnlessEqual(dsds[1,1,3,3],0.0,"ds/ds has wrong value at (1,1,3,3).") | |
2099 | self.failUnlessEqual(dsds[1,1,3,4],0.0,"ds/ds has wrong value at (1,1,3,4).") | |
2100 | self.failUnlessEqual(dsds[1,2,0,0],0.0,"ds/ds has wrong value at (1,2,0,0).") | |
2101 | self.failUnlessEqual(dsds[1,2,0,1],0.0,"ds/ds has wrong value at (1,2,0,1).") | |
2102 | self.failUnlessEqual(dsds[1,2,0,2],0.0,"ds/ds has wrong value at (1,2,0,2).") | |
2103 | self.failUnlessEqual(dsds[1,2,0,3],0.0,"ds/ds has wrong value at (1,2,0,3).") | |
2104 | self.failUnlessEqual(dsds[1,2,0,4],0.0,"ds/ds has wrong value at (1,2,0,4).") | |
2105 | self.failUnlessEqual(dsds[1,2,1,0],0.0,"ds/ds has wrong value at (1,2,1,0).") | |
2106 | self.failUnlessEqual(dsds[1,2,1,1],0.0,"ds/ds has wrong value at (1,2,1,1).") | |
2107 | self.failUnlessEqual(dsds[1,2,1,2],1.0,"ds/ds has wrong value at (1,2,1,2).") | |
2108 | self.failUnlessEqual(dsds[1,2,1,3],0.0,"ds/ds has wrong value at (1,2,1,3).") | |
2109 | self.failUnlessEqual(dsds[1,2,1,4],0.0,"ds/ds has wrong value at (1,2,1,4).") | |
2110 | self.failUnlessEqual(dsds[1,2,2,0],0.0,"ds/ds has wrong value at (1,2,2,0).") | |
2111 | self.failUnlessEqual(dsds[1,2,2,1],0.0,"ds/ds has wrong value at (1,2,2,1).") | |
2112 | self.failUnlessEqual(dsds[1,2,2,2],0.0,"ds/ds has wrong value at (1,2,2,2).") | |
2113 | self.failUnlessEqual(dsds[1,2,2,3],0.0,"ds/ds has wrong value at (1,2,2,3).") | |
2114 | self.failUnlessEqual(dsds[1,2,2,4],0.0,"ds/ds has wrong value at (1,2,2,4).") | |
2115 | self.failUnlessEqual(dsds[1,2,3,0],0.0,"ds/ds has wrong value at (1,2,3,0).") | |
2116 | self.failUnlessEqual(dsds[1,2,3,1],0.0,"ds/ds has wrong value at (1,2,3,1).") | |
2117 | self.failUnlessEqual(dsds[1,2,3,2],0.0,"ds/ds has wrong value at (1,2,3,2).") | |
2118 | self.failUnlessEqual(dsds[1,2,3,3],0.0,"ds/ds has wrong value at (1,2,3,3).") | |
2119 | self.failUnlessEqual(dsds[1,2,3,4],0.0,"ds/ds has wrong value at (1,2,3,4).") | |
2120 | self.failUnlessEqual(dsds[1,3,0,0],0.0,"ds/ds has wrong value at (1,3,0,0).") | |
2121 | self.failUnlessEqual(dsds[1,3,0,1],0.0,"ds/ds has wrong value at (1,3,0,1).") | |
2122 | self.failUnlessEqual(dsds[1,3,0,2],0.0,"ds/ds has wrong value at (1,3,0,2).") | |
2123 | self.failUnlessEqual(dsds[1,3,0,3],0.0,"ds/ds has wrong value at (1,3,0,3).") | |
2124 | self.failUnlessEqual(dsds[1,3,0,4],0.0,"ds/ds has wrong value at (1,3,0,4).") | |
2125 | self.failUnlessEqual(dsds[1,3,1,0],0.0,"ds/ds has wrong value at (1,3,1,0).") | |
2126 | self.failUnlessEqual(dsds[1,3,1,1],0.0,"ds/ds has wrong value at (1,3,1,1).") | |
2127 | self.failUnlessEqual(dsds[1,3,1,2],0.0,"ds/ds has wrong value at (1,3,1,2).") | |
2128 | self.failUnlessEqual(dsds[1,3,1,3],1.0,"ds/ds has wrong value at (1,3,1,3).") | |
2129 | self.failUnlessEqual(dsds[1,3,1,4],0.0,"ds/ds has wrong value at (1,3,1,4).") | |
2130 | self.failUnlessEqual(dsds[1,3,2,0],0.0,"ds/ds has wrong value at (1,3,2,0).") | |
2131 | self.failUnlessEqual(dsds[1,3,2,1],0.0,"ds/ds has wrong value at (1,3,2,1).") | |
2132 | self.failUnlessEqual(dsds[1,3,2,2],0.0,"ds/ds has wrong value at (1,3,2,2).") | |
2133 | self.failUnlessEqual(dsds[1,3,2,3],0.0,"ds/ds has wrong value at (1,3,2,3).") | |
2134 | self.failUnlessEqual(dsds[1,3,2,4],0.0,"ds/ds has wrong value at (1,3,2,4).") | |
2135 | self.failUnlessEqual(dsds[1,3,3,0],0.0,"ds/ds has wrong value at (1,3,3,0).") | |
2136 | self.failUnlessEqual(dsds[1,3,3,1],0.0,"ds/ds has wrong value at (1,3,3,1).") | |
2137 | self.failUnlessEqual(dsds[1,3,3,2],0.0,"ds/ds has wrong value at (1,3,3,2).") | |
2138 | self.failUnlessEqual(dsds[1,3,3,3],0.0,"ds/ds has wrong value at (1,3,3,3).") | |
2139 | self.failUnlessEqual(dsds[1,3,3,4],0.0,"ds/ds has wrong value at (1,3,3,4).") | |
2140 | self.failUnlessEqual(dsds[1,4,0,0],0.0,"ds/ds has wrong value at (1,4,0,0).") | |
2141 | self.failUnlessEqual(dsds[1,4,0,1],0.0,"ds/ds has wrong value at (1,4,0,1).") | |
2142 | self.failUnlessEqual(dsds[1,4,0,2],0.0,"ds/ds has wrong value at (1,4,0,2).") | |
2143 | self.failUnlessEqual(dsds[1,4,0,3],0.0,"ds/ds has wrong value at (1,4,0,3).") | |
2144 | self.failUnlessEqual(dsds[1,4,0,4],0.0,"ds/ds has wrong value at (1,4,0,4).") | |
2145 | self.failUnlessEqual(dsds[1,4,1,0],0.0,"ds/ds has wrong value at (1,4,1,0).") | |
2146 | self.failUnlessEqual(dsds[1,4,1,1],0.0,"ds/ds has wrong value at (1,4,1,1).") | |
2147 | self.failUnlessEqual(dsds[1,4,1,2],0.0,"ds/ds has wrong value at (1,4,1,2).") | |
2148 | self.failUnlessEqual(dsds[1,4,1,3],0.0,"ds/ds has wrong value at (1,4,1,3).") | |
2149 | self.failUnlessEqual(dsds[1,4,1,4],1.0,"ds/ds has wrong value at (1,4,1,4).") | |
2150 | self.failUnlessEqual(dsds[1,4,2,0],0.0,"ds/ds has wrong value at (1,4,2,0).") | |
2151 | self.failUnlessEqual(dsds[1,4,2,1],0.0,"ds/ds has wrong value at (1,4,2,1).") | |
2152 | self.failUnlessEqual(dsds[1,4,2,2],0.0,"ds/ds has wrong value at (1,4,2,2).") | |
2153 | self.failUnlessEqual(dsds[1,4,2,3],0.0,"ds/ds has wrong value at (1,4,2,3).") | |
2154 | self.failUnlessEqual(dsds[1,4,2,4],0.0,"ds/ds has wrong value at (1,4,2,4).") | |
2155 | self.failUnlessEqual(dsds[1,4,3,0],0.0,"ds/ds has wrong value at (1,4,3,0).") | |
2156 | self.failUnlessEqual(dsds[1,4,3,1],0.0,"ds/ds has wrong value at (1,4,3,1).") | |
2157 | self.failUnlessEqual(dsds[1,4,3,2],0.0,"ds/ds has wrong value at (1,4,3,2).") | |
2158 | self.failUnlessEqual(dsds[1,4,3,3],0.0,"ds/ds has wrong value at (1,4,3,3).") | |
2159 | self.failUnlessEqual(dsds[1,4,3,4],0.0,"ds/ds has wrong value at (1,4,3,4).") | |
2160 | self.failUnlessEqual(dsds[2,0,0,0],0.0,"ds/ds has wrong value at (2,0,0,0).") | |
2161 | self.failUnlessEqual(dsds[2,0,0,1],0.0,"ds/ds has wrong value at (2,0,0,1).") | |
2162 | self.failUnlessEqual(dsds[2,0,0,2],0.0,"ds/ds has wrong value at (2,0,0,2).") | |
2163 | self.failUnlessEqual(dsds[2,0,0,3],0.0,"ds/ds has wrong value at (2,0,0,3).") | |
2164 | self.failUnlessEqual(dsds[2,0,0,4],0.0,"ds/ds has wrong value at (2,0,0,4).") | |
2165 | self.failUnlessEqual(dsds[2,0,1,0],0.0,"ds/ds has wrong value at (2,0,1,0).") | |
2166 | self.failUnlessEqual(dsds[2,0,1,1],0.0,"ds/ds has wrong value at (2,0,1,1).") | |
2167 | self.failUnlessEqual(dsds[2,0,1,2],0.0,"ds/ds has wrong value at (2,0,1,2).") | |
2168 | self.failUnlessEqual(dsds[2,0,1,3],0.0,"ds/ds has wrong value at (2,0,1,3).") | |
2169 | self.failUnlessEqual(dsds[2,0,1,4],0.0,"ds/ds has wrong value at (2,0,1,4).") | |
2170 | self.failUnlessEqual(dsds[2,0,2,0],1.0,"ds/ds has wrong value at (2,0,2,0).") | |
2171 | self.failUnlessEqual(dsds[2,0,2,1],0.0,"ds/ds has wrong value at (2,0,2,1).") | |
2172 | self.failUnlessEqual(dsds[2,0,2,2],0.0,"ds/ds has wrong value at (2,0,2,2).") | |
2173 | self.failUnlessEqual(dsds[2,0,2,3],0.0,"ds/ds has wrong value at (2,0,2,3).") | |
2174 | self.failUnlessEqual(dsds[2,0,2,4],0.0,"ds/ds has wrong value at (2,0,2,4).") | |
2175 | self.failUnlessEqual(dsds[2,0,3,0],0.0,"ds/ds has wrong value at (2,0,3,0).") | |
2176 | self.failUnlessEqual(dsds[2,0,3,1],0.0,"ds/ds has wrong value at (2,0,3,1).") | |
2177 | self.failUnlessEqual(dsds[2,0,3,2],0.0,"ds/ds has wrong value at (2,0,3,2).") | |
2178 | self.failUnlessEqual(dsds[2,0,3,3],0.0,"ds/ds has wrong value at (2,0,3,3).") | |
2179 | self.failUnlessEqual(dsds[2,0,3,4],0.0,"ds/ds has wrong value at (2,0,3,4).") | |
2180 | self.failUnlessEqual(dsds[2,1,0,0],0.0,"ds/ds has wrong value at (2,1,0,0).") | |
2181 | self.failUnlessEqual(dsds[2,1,0,1],0.0,"ds/ds has wrong value at (2,1,0,1).") | |
2182 | self.failUnlessEqual(dsds[2,1,0,2],0.0,"ds/ds has wrong value at (2,1,0,2).") | |
2183 | self.failUnlessEqual(dsds[2,1,0,3],0.0,"ds/ds has wrong value at (2,1,0,3).") | |
2184 | self.failUnlessEqual(dsds[2,1,0,4],0.0,"ds/ds has wrong value at (2,1,0,4).") | |
2185 | self.failUnlessEqual(dsds[2,1,1,0],0.0,"ds/ds has wrong value at (2,1,1,0).") | |
2186 | self.failUnlessEqual(dsds[2,1,1,1],0.0,"ds/ds has wrong value at (2,1,1,1).") | |
2187 | self.failUnlessEqual(dsds[2,1,1,2],0.0,"ds/ds has wrong value at (2,1,1,2).") | |
2188 | self.failUnlessEqual(dsds[2,1,1,3],0.0,"ds/ds has wrong value at (2,1,1,3).") | |
2189 | self.failUnlessEqual(dsds[2,1,1,4],0.0,"ds/ds has wrong value at (2,1,1,4).") | |
2190 | self.failUnlessEqual(dsds[2,1,2,0],0.0,"ds/ds has wrong value at (2,1,2,0).") | |
2191 | self.failUnlessEqual(dsds[2,1,2,1],1.0,"ds/ds has wrong value at (2,1,2,1).") | |
2192 | self.failUnlessEqual(dsds[2,1,2,2],0.0,"ds/ds has wrong value at (2,1,2,2).") | |
2193 | self.failUnlessEqual(dsds[2,1,2,3],0.0,"ds/ds has wrong value at (2,1,2,3).") | |
2194 | self.failUnlessEqual(dsds[2,1,2,4],0.0,"ds/ds has wrong value at (2,1,2,4).") | |
2195 | self.failUnlessEqual(dsds[2,1,3,0],0.0,"ds/ds has wrong value at (2,1,3,0).") | |
2196 | self.failUnlessEqual(dsds[2,1,3,1],0.0,"ds/ds has wrong value at (2,1,3,1).") | |
2197 | self.failUnlessEqual(dsds[2,1,3,2],0.0,"ds/ds has wrong value at (2,1,3,2).") | |
2198 | self.failUnlessEqual(dsds[2,1,3,3],0.0,"ds/ds has wrong value at (2,1,3,3).") | |
2199 | self.failUnlessEqual(dsds[2,1,3,4],0.0,"ds/ds has wrong value at (2,1,3,4).") | |
2200 | self.failUnlessEqual(dsds[2,2,0,0],0.0,"ds/ds has wrong value at (2,2,0,0).") | |
2201 | self.failUnlessEqual(dsds[2,2,0,1],0.0,"ds/ds has wrong value at (2,2,0,1).") | |
2202 | self.failUnlessEqual(dsds[2,2,0,2],0.0,"ds/ds has wrong value at (2,2,0,2).") | |
2203 | self.failUnlessEqual(dsds[2,2,0,3],0.0,"ds/ds has wrong value at (2,2,0,3).") | |
2204 | self.failUnlessEqual(dsds[2,2,0,4],0.0,"ds/ds has wrong value at (2,2,0,4).") | |
2205 | self.failUnlessEqual(dsds[2,2,1,0],0.0,"ds/ds has wrong value at (2,2,1,0).") | |
2206 | self.failUnlessEqual(dsds[2,2,1,1],0.0,"ds/ds has wrong value at (2,2,1,1).") | |
2207 | self.failUnlessEqual(dsds[2,2,1,2],0.0,"ds/ds has wrong value at (2,2,1,2).") | |
2208 | self.failUnlessEqual(dsds[2,2,1,3],0.0,"ds/ds has wrong value at (2,2,1,3).") | |
2209 | self.failUnlessEqual(dsds[2,2,1,4],0.0,"ds/ds has wrong value at (2,2,1,4).") | |
2210 | self.failUnlessEqual(dsds[2,2,2,0],0.0,"ds/ds has wrong value at (2,2,2,0).") | |
2211 | self.failUnlessEqual(dsds[2,2,2,1],0.0,"ds/ds has wrong value at (2,2,2,1).") | |
2212 | self.failUnlessEqual(dsds[2,2,2,2],1.0,"ds/ds has wrong value at (2,2,2,2).") | |
2213 | self.failUnlessEqual(dsds[2,2,2,3],0.0,"ds/ds has wrong value at (2,2,2,3).") | |
2214 | self.failUnlessEqual(dsds[2,2,2,4],0.0,"ds/ds has wrong value at (2,2,2,4).") | |
2215 | self.failUnlessEqual(dsds[2,2,3,0],0.0,"ds/ds has wrong value at (2,2,3,0).") | |
2216 | self.failUnlessEqual(dsds[2,2,3,1],0.0,"ds/ds has wrong value at (2,2,3,1).") | |
2217 | self.failUnlessEqual(dsds[2,2,3,2],0.0,"ds/ds has wrong value at (2,2,3,2).") | |
2218 | self.failUnlessEqual(dsds[2,2,3,3],0.0,"ds/ds has wrong value at (2,2,3,3).") | |
2219 | self.failUnlessEqual(dsds[2,2,3,4],0.0,"ds/ds has wrong value at (2,2,3,4).") | |
2220 | self.failUnlessEqual(dsds[2,3,0,0],0.0,"ds/ds has wrong value at (2,3,0,0).") | |
2221 | self.failUnlessEqual(dsds[2,3,0,1],0.0,"ds/ds has wrong value at (2,3,0,1).") | |
2222 | self.failUnlessEqual(dsds[2,3,0,2],0.0,"ds/ds has wrong value at (2,3,0,2).") | |
2223 | self.failUnlessEqual(dsds[2,3,0,3],0.0,"ds/ds has wrong value at (2,3,0,3).") | |
2224 | self.failUnlessEqual(dsds[2,3,0,4],0.0,"ds/ds has wrong value at (2,3,0,4).") | |
2225 | self.failUnlessEqual(dsds[2,3,1,0],0.0,"ds/ds has wrong value at (2,3,1,0).") | |
2226 | self.failUnlessEqual(dsds[2,3,1,1],0.0,"ds/ds has wrong value at (2,3,1,1).") | |
2227 | self.failUnlessEqual(dsds[2,3,1,2],0.0,"ds/ds has wrong value at (2,3,1,2).") | |
2228 | self.failUnlessEqual(dsds[2,3,1,3],0.0,"ds/ds has wrong value at (2,3,1,3).") | |
2229 | self.failUnlessEqual(dsds[2,3,1,4],0.0,"ds/ds has wrong value at (2,3,1,4).") | |
2230 | self.failUnlessEqual(dsds[2,3,2,0],0.0,"ds/ds has wrong value at (2,3,2,0).") | |
2231 | self.failUnlessEqual(dsds[2,3,2,1],0.0,"ds/ds has wrong value at (2,3,2,1).") | |
2232 | self.failUnlessEqual(dsds[2,3,2,2],0.0,"ds/ds has wrong value at (2,3,2,2).") | |
2233 | self.failUnlessEqual(dsds[2,3,2,3],1.0,"ds/ds has wrong value at (2,3,2,3).") | |
2234 | self.failUnlessEqual(dsds[2,3,2,4],0.0,"ds/ds has wrong value at (2,3,2,4).") | |
2235 | self.failUnlessEqual(dsds[2,3,3,0],0.0,"ds/ds has wrong value at (2,3,3,0).") | |
2236 | self.failUnlessEqual(dsds[2,3,3,1],0.0,"ds/ds has wrong value at (2,3,3,1).") | |
2237 | self.failUnlessEqual(dsds[2,3,3,2],0.0,"ds/ds has wrong value at (2,3,3,2).") | |
2238 | self.failUnlessEqual(dsds[2,3,3,3],0.0,"ds/ds has wrong value at (2,3,3,3).") | |
2239 | self.failUnlessEqual(dsds[2,3,3,4],0.0,"ds/ds has wrong value at (2,3,3,4).") | |
2240 | self.failUnlessEqual(dsds[2,4,0,0],0.0,"ds/ds has wrong value at (2,4,0,0).") | |
2241 | self.failUnlessEqual(dsds[2,4,0,1],0.0,"ds/ds has wrong value at (2,4,0,1).") | |
2242 | self.failUnlessEqual(dsds[2,4,0,2],0.0,"ds/ds has wrong value at (2,4,0,2).") | |
2243 | self.failUnlessEqual(dsds[2,4,0,3],0.0,"ds/ds has wrong value at (2,4,0,3).") | |
2244 | self.failUnlessEqual(dsds[2,4,0,4],0.0,"ds/ds has wrong value at (2,4,0,4).") | |
2245 | self.failUnlessEqual(dsds[2,4,1,0],0.0,"ds/ds has wrong value at (2,4,1,0).") | |
2246 | self.failUnlessEqual(dsds[2,4,1,1],0.0,"ds/ds has wrong value at (2,4,1,1).") | |
2247 | self.failUnlessEqual(dsds[2,4,1,2],0.0,"ds/ds has wrong value at (2,4,1,2).") | |
2248 | self.failUnlessEqual(dsds[2,4,1,3],0.0,"ds/ds has wrong value at (2,4,1,3).") | |
2249 | self.failUnlessEqual(dsds[2,4,1,4],0.0,"ds/ds has wrong value at (2,4,1,4).") | |
2250 | self.failUnlessEqual(dsds[2,4,2,0],0.0,"ds/ds has wrong value at (2,4,2,0).") | |
2251 | self.failUnlessEqual(dsds[2,4,2,1],0.0,"ds/ds has wrong value at (2,4,2,1).") | |
2252 | self.failUnlessEqual(dsds[2,4,2,2],0.0,"ds/ds has wrong value at (2,4,2,2).") | |
2253 | self.failUnlessEqual(dsds[2,4,2,3],0.0,"ds/ds has wrong value at (2,4,2,3).") | |
2254 | self.failUnlessEqual(dsds[2,4,2,4],1.0,"ds/ds has wrong value at (2,4,2,4).") | |
2255 | self.failUnlessEqual(dsds[2,4,3,0],0.0,"ds/ds has wrong value at (2,4,3,0).") | |
2256 | self.failUnlessEqual(dsds[2,4,3,1],0.0,"ds/ds has wrong value at (2,4,3,1).") | |
2257 | self.failUnlessEqual(dsds[2,4,3,2],0.0,"ds/ds has wrong value at (2,4,3,2).") | |
2258 | self.failUnlessEqual(dsds[2,4,3,3],0.0,"ds/ds has wrong value at (2,4,3,3).") | |
2259 | self.failUnlessEqual(dsds[2,4,3,4],0.0,"ds/ds has wrong value at (2,4,3,4).") | |
2260 | self.failUnlessEqual(dsds[3,0,0,0],0.0,"ds/ds has wrong value at (3,0,0,0).") | |
2261 | self.failUnlessEqual(dsds[3,0,0,1],0.0,"ds/ds has wrong value at (3,0,0,1).") | |
2262 | self.failUnlessEqual(dsds[3,0,0,2],0.0,"ds/ds has wrong value at (3,0,0,2).") | |
2263 | self.failUnlessEqual(dsds[3,0,0,3],0.0,"ds/ds has wrong value at (3,0,0,3).") | |
2264 | self.failUnlessEqual(dsds[3,0,0,4],0.0,"ds/ds has wrong value at (3,0,0,4).") | |
2265 | self.failUnlessEqual(dsds[3,0,1,0],0.0,"ds/ds has wrong value at (3,0,1,0).") | |
2266 | self.failUnlessEqual(dsds[3,0,1,1],0.0,"ds/ds has wrong value at (3,0,1,1).") | |
2267 | self.failUnlessEqual(dsds[3,0,1,2],0.0,"ds/ds has wrong value at (3,0,1,2).") | |
2268 | self.failUnlessEqual(dsds[3,0,1,3],0.0,"ds/ds has wrong value at (3,0,1,3).") | |
2269 | self.failUnlessEqual(dsds[3,0,1,4],0.0,"ds/ds has wrong value at (3,0,1,4).") | |
2270 | self.failUnlessEqual(dsds[3,0,2,0],0.0,"ds/ds has wrong value at (3,0,2,0).") | |
2271 | self.failUnlessEqual(dsds[3,0,2,1],0.0,"ds/ds has wrong value at (3,0,2,1).") | |
2272 | self.failUnlessEqual(dsds[3,0,2,2],0.0,"ds/ds has wrong value at (3,0,2,2).") | |
2273 | self.failUnlessEqual(dsds[3,0,2,3],0.0,"ds/ds has wrong value at (3,0,2,3).") | |
2274 | self.failUnlessEqual(dsds[3,0,2,4],0.0,"ds/ds has wrong value at (3,0,2,4).") | |
2275 | self.failUnlessEqual(dsds[3,0,3,0],1.0,"ds/ds has wrong value at (3,0,3,0).") | |
2276 | self.failUnlessEqual(dsds[3,0,3,1],0.0,"ds/ds has wrong value at (3,0,3,1).") | |
2277 | self.failUnlessEqual(dsds[3,0,3,2],0.0,"ds/ds has wrong value at (3,0,3,2).") | |
2278 | self.failUnlessEqual(dsds[3,0,3,3],0.0,"ds/ds has wrong value at (3,0,3,3).") | |
2279 | self.failUnlessEqual(dsds[3,0,3,4],0.0,"ds/ds has wrong value at (3,0,3,4).") | |
2280 | self.failUnlessEqual(dsds[3,1,0,0],0.0,"ds/ds has wrong value at (3,1,0,0).") | |
2281 | self.failUnlessEqual(dsds[3,1,0,1],0.0,"ds/ds has wrong value at (3,1,0,1).") | |
2282 | self.failUnlessEqual(dsds[3,1,0,2],0.0,"ds/ds has wrong value at (3,1,0,2).") | |
2283 | self.failUnlessEqual(dsds[3,1,0,3],0.0,"ds/ds has wrong value at (3,1,0,3).") | |
2284 | self.failUnlessEqual(dsds[3,1,0,4],0.0,"ds/ds has wrong value at (3,1,0,4).") | |
2285 | self.failUnlessEqual(dsds[3,1,1,0],0.0,"ds/ds has wrong value at (3,1,1,0).") | |
2286 | self.failUnlessEqual(dsds[3,1,1,1],0.0,"ds/ds has wrong value at (3,1,1,1).") | |
2287 | self.failUnlessEqual(dsds[3,1,1,2],0.0,"ds/ds has wrong value at (3,1,1,2).") | |
2288 | self.failUnlessEqual(dsds[3,1,1,3],0.0,"ds/ds has wrong value at (3,1,1,3).") | |
2289 | self.failUnlessEqual(dsds[3,1,1,4],0.0,"ds/ds has wrong value at (3,1,1,4).") | |
2290 | self.failUnlessEqual(dsds[3,1,2,0],0.0,"ds/ds has wrong value at (3,1,2,0).") | |
2291 | self.failUnlessEqual(dsds[3,1,2,1],0.0,"ds/ds has wrong value at (3,1,2,1).") | |
2292 | self.failUnlessEqual(dsds[3,1,2,2],0.0,"ds/ds has wrong value at (3,1,2,2).") | |
2293 | self.failUnlessEqual(dsds[3,1,2,3],0.0,"ds/ds has wrong value at (3,1,2,3).") | |
2294 | self.failUnlessEqual(dsds[3,1,2,4],0.0,"ds/ds has wrong value at (3,1,2,4).") | |
2295 | self.failUnlessEqual(dsds[3,1,3,0],0.0,"ds/ds has wrong value at (3,1,3,0).") | |
2296 | self.failUnlessEqual(dsds[3,1,3,1],1.0,"ds/ds has wrong value at (3,1,3,1).") | |
2297 | self.failUnlessEqual(dsds[3,1,3,2],0.0,"ds/ds has wrong value at (3,1,3,2).") | |
2298 | self.failUnlessEqual(dsds[3,1,3,3],0.0,"ds/ds has wrong value at (3,1,3,3).") | |
2299 | self.failUnlessEqual(dsds[3,1,3,4],0.0,"ds/ds has wrong value at (3,1,3,4).") | |
2300 | self.failUnlessEqual(dsds[3,2,0,0],0.0,"ds/ds has wrong value at (3,2,0,0).") | |
2301 | self.failUnlessEqual(dsds[3,2,0,1],0.0,"ds/ds has wrong value at (3,2,0,1).") | |
2302 | self.failUnlessEqual(dsds[3,2,0,2],0.0,"ds/ds has wrong value at (3,2,0,2).") | |
2303 | self.failUnlessEqual(dsds[3,2,0,3],0.0,"ds/ds has wrong value at (3,2,0,3).") | |
2304 | self.failUnlessEqual(dsds[3,2,0,4],0.0,"ds/ds has wrong value at (3,2,0,4).") | |
2305 | self.failUnlessEqual(dsds[3,2,1,0],0.0,"ds/ds has wrong value at (3,2,1,0).") | |
2306 | self.failUnlessEqual(dsds[3,2,1,1],0.0,"ds/ds has wrong value at (3,2,1,1).") | |
2307 | self.failUnlessEqual(dsds[3,2,1,2],0.0,"ds/ds has wrong value at (3,2,1,2).") | |
2308 | self.failUnlessEqual(dsds[3,2,1,3],0.0,"ds/ds has wrong value at (3,2,1,3).") | |
2309 | self.failUnlessEqual(dsds[3,2,1,4],0.0,"ds/ds has wrong value at (3,2,1,4).") | |
2310 | self.failUnlessEqual(dsds[3,2,2,0],0.0,"ds/ds has wrong value at (3,2,2,0).") | |
2311 | self.failUnlessEqual(dsds[3,2,2,1],0.0,"ds/ds has wrong value at (3,2,2,1).") | |
2312 | self.failUnlessEqual(dsds[3,2,2,2],0.0,"ds/ds has wrong value at (3,2,2,2).") | |
2313 | self.failUnlessEqual(dsds[3,2,2,3],0.0,"ds/ds has wrong value at (3,2,2,3).") | |
2314 | self.failUnlessEqual(dsds[3,2,2,4],0.0,"ds/ds has wrong value at (3,2,2,4).") | |
2315 | self.failUnlessEqual(dsds[3,2,3,0],0.0,"ds/ds has wrong value at (3,2,3,0).") | |
2316 | self.failUnlessEqual(dsds[3,2,3,1],0.0,"ds/ds has wrong value at (3,2,3,1).") | |
2317 | self.failUnlessEqual(dsds[3,2,3,2],1.0,"ds/ds has wrong value at (3,2,3,2).") | |
2318 | self.failUnlessEqual(dsds[3,2,3,3],0.0,"ds/ds has wrong value at (3,2,3,3).") | |
2319 | self.failUnlessEqual(dsds[3,2,3,4],0.0,"ds/ds has wrong value at (3,2,3,4).") | |
2320 | self.failUnlessEqual(dsds[3,3,0,0],0.0,"ds/ds has wrong value at (3,3,0,0).") | |
2321 | self.failUnlessEqual(dsds[3,3,0,1],0.0,"ds/ds has wrong value at (3,3,0,1).") | |
2322 | self.failUnlessEqual(dsds[3,3,0,2],0.0,"ds/ds has wrong value at (3,3,0,2).") | |
2323 | self.failUnlessEqual(dsds[3,3,0,3],0.0,"ds/ds has wrong value at (3,3,0,3).") | |
2324 | self.failUnlessEqual(dsds[3,3,0,4],0.0,"ds/ds has wrong value at (3,3,0,4).") | |
2325 | self.failUnlessEqual(dsds[3,3,1,0],0.0,"ds/ds has wrong value at (3,3,1,0).") | |
2326 | self.failUnlessEqual(dsds[3,3,1,1],0.0,"ds/ds has wrong value at (3,3,1,1).") | |
2327 | self.failUnlessEqual(dsds[3,3,1,2],0.0,"ds/ds has wrong value at (3,3,1,2).") | |
2328 | self.failUnlessEqual(dsds[3,3,1,3],0.0,"ds/ds has wrong value at (3,3,1,3).") | |
2329 | self.failUnlessEqual(dsds[3,3,1,4],0.0,"ds/ds has wrong value at (3,3,1,4).") | |
2330 | self.failUnlessEqual(dsds[3,3,2,0],0.0,"ds/ds has wrong value at (3,3,2,0).") | |
2331 | self.failUnlessEqual(dsds[3,3,2,1],0.0,"ds/ds has wrong value at (3,3,2,1).") | |
2332 | self.failUnlessEqual(dsds[3,3,2,2],0.0,"ds/ds has wrong value at (3,3,2,2).") | |
2333 | self.failUnlessEqual(dsds[3,3,2,3],0.0,"ds/ds has wrong value at (3,3,2,3).") | |
2334 | self.failUnlessEqual(dsds[3,3,2,4],0.0,"ds/ds has wrong value at (3,3,2,4).") | |
2335 | self.failUnlessEqual(dsds[3,3,3,0],0.0,"ds/ds has wrong value at (3,3,3,0).") | |
2336 | self.failUnlessEqual(dsds[3,3,3,1],0.0,"ds/ds has wrong value at (3,3,3,1).") | |
2337 | self.failUnlessEqual(dsds[3,3,3,2],0.0,"ds/ds has wrong value at (3,3,3,2).") | |
2338 | self.failUnlessEqual(dsds[3,3,3,3],1.0,"ds/ds has wrong value at (3,3,3,3).") | |
2339 | self.failUnlessEqual(dsds[3,3,3,4],0.0,"ds/ds has wrong value at (3,3,3,4).") | |
2340 | self.failUnlessEqual(dsds[3,4,0,0],0.0,"ds/ds has wrong value at (3,4,0,0).") | |
2341 | self.failUnlessEqual(dsds[3,4,0,1],0.0,"ds/ds has wrong value at (3,4,0,1).") | |
2342 | self.failUnlessEqual(dsds[3,4,0,2],0.0,"ds/ds has wrong value at (3,4,0,2).") | |
2343 | self.failUnlessEqual(dsds[3,4,0,3],0.0,"ds/ds has wrong value at (3,4,0,3).") | |
2344 | self.failUnlessEqual(dsds[3,4,0,4],0.0,"ds/ds has wrong value at (3,4,0,4).") | |
2345 | self.failUnlessEqual(dsds[3,4,1,0],0.0,"ds/ds has wrong value at (3,4,1,0).") | |
2346 | self.failUnlessEqual(dsds[3,4,1,1],0.0,"ds/ds has wrong value at (3,4,1,1).") | |
2347 | self.failUnlessEqual(dsds[3,4,1,2],0.0,"ds/ds has wrong value at (3,4,1,2).") | |
2348 | self.failUnlessEqual(dsds[3,4,1,3],0.0,"ds/ds has wrong value at (3,4,1,3).") | |
2349 | self.failUnlessEqual(dsds[3,4,1,4],0.0,"ds/ds has wrong value at (3,4,1,4).") | |
2350 | self.failUnlessEqual(dsds[3,4,2,0],0.0,"ds/ds has wrong value at (3,4,2,0).") | |
2351 | self.failUnlessEqual(dsds[3,4,2,1],0.0,"ds/ds has wrong value at (3,4,2,1).") | |
2352 | self.failUnlessEqual(dsds[3,4,2,2],0.0,"ds/ds has wrong value at (3,4,2,2).") | |
2353 | self.failUnlessEqual(dsds[3,4,2,3],0.0,"ds/ds has wrong value at (3,4,2,3).") | |
2354 | self.failUnlessEqual(dsds[3,4,2,4],0.0,"ds/ds has wrong value at (3,4,2,4).") | |
2355 | self.failUnlessEqual(dsds[3,4,3,0],0.0,"ds/ds has wrong value at (3,4,3,0).") | |
2356 | self.failUnlessEqual(dsds[3,4,3,1],0.0,"ds/ds has wrong value at (3,4,3,1).") | |
2357 | self.failUnlessEqual(dsds[3,4,3,2],0.0,"ds/ds has wrong value at (3,4,3,2).") | |
2358 | self.failUnlessEqual(dsds[3,4,3,3],0.0,"ds/ds has wrong value at (3,4,3,3).") | |
2359 | self.failUnlessEqual(dsds[3,4,3,4],1.0,"ds/ds has wrong value at (3,4,3,4).") | |
2360 | ||
2361 | sa=s.getSubstitutedArguments({s2:-10}) | |
2362 | self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments") | |
2363 | ||
2364 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
2365 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
2366 | self.failUnless(s.isAppropriateValue(Symbol(shape=(4, 5),dim=None)),"Symbol is appropriate substitute") | |
2367 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
2368 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
2369 | self.failUnless(s.isAppropriateValue(numarray.zeros((4, 5))),"NumArray is appropriate substitute") | |
2370 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
2371 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
2372 | def test_Symbol_rank2_dNone_nargs1(self): | |
2373 | s2=Symbol(shape=()) | |
2374 | s=Symbol(shape=(4, 5),dim=None,args=[s2]) | |
2375 | self.failUnlessEqual(s.getRank(),2,"wrong rank.") | |
2376 | self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.") | |
2377 | self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.") | |
2378 | self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.") | |
2379 | ||
2380 | ss=s.substitute({s:numarray.zeros((4, 5))}) | |
2381 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
2382 | self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape") | |
2383 | try: | |
2384 | s.substitute({s:numarray.zeros((5,))}) | |
2385 | fail("illegal substition was successful") | |
2386 | except TypeError: | |
2387 | pass | |
2388 | ||
2389 | dsdarg=s.diff(Symbol(shape=())) | |
2390 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
2391 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.") | |
2392 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
2393 | dsdarg=s.diff(Symbol(shape=(2,))) | |
2394 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
2395 | self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.") | |
2396 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
2397 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
2398 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
2399 | self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
2400 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
2401 | ||
2402 | dsds=s.diff(s) | |
2403 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
2404 | self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.") | |
2405 | self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).") | |
2406 | self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).") | |
2407 | self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).") | |
2408 | self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).") | |
2409 | self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).") | |
2410 | self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).") | |
2411 | self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).") | |
2412 | self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).") | |
2413 | self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).") | |
2414 | self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).") | |
2415 | self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).") | |
2416 | self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).") | |
2417 | self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).") | |
2418 | self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).") | |
2419 | self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).") | |
2420 | self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).") | |
2421 | self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).") | |
2422 | self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).") | |
2423 | self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).") | |
2424 | self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).") | |
2425 | self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).") | |
2426 | self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).") | |
2427 | self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (0,1,0,2).") | |
2428 | self.failUnlessEqual(dsds[0,1,0,3],0.0,"ds/ds has wrong value at (0,1,0,3).") | |
2429 | self.failUnlessEqual(dsds[0,1,0,4],0.0,"ds/ds has wrong value at (0,1,0,4).") | |
2430 | self.failUnlessEqual(dsds[0,1,1,0],0.0,"ds/ds has wrong value at (0,1,1,0).") | |
2431 | self.failUnlessEqual(dsds[0,1,1,1],0.0,"ds/ds has wrong value at (0,1,1,1).") | |
2432 | self.failUnlessEqual(dsds[0,1,1,2],0.0,"ds/ds has wrong value at (0,1,1,2).") | |
2433 | self.failUnlessEqual(dsds[0,1,1,3],0.0,"ds/ds has wrong value at (0,1,1,3).") | |
2434 | self.failUnlessEqual(dsds[0,1,1,4],0.0,"ds/ds has wrong value at (0,1,1,4).") | |
2435 | self.failUnlessEqual(dsds[0,1,2,0],0.0,"ds/ds has wrong value at (0,1,2,0).") | |
2436 | self.failUnlessEqual(dsds[0,1,2,1],0.0,"ds/ds has wrong value at (0,1,2,1).") | |
2437 | self.failUnlessEqual(dsds[0,1,2,2],0.0,"ds/ds has wrong value at (0,1,2,2).") | |
2438 | self.failUnlessEqual(dsds[0,1,2,3],0.0,"ds/ds has wrong value at (0,1,2,3).") | |
2439 | self.failUnlessEqual(dsds[0,1,2,4],0.0,"ds/ds has wrong value at (0,1,2,4).") | |
2440 | self.failUnlessEqual(dsds[0,1,3,0],0.0,"ds/ds has wrong value at (0,1,3,0).") | |
2441 | self.failUnlessEqual(dsds[0,1,3,1],0.0,"ds/ds has wrong value at (0,1,3,1).") | |
2442 | self.failUnlessEqual(dsds[0,1,3,2],0.0,"ds/ds has wrong value at (0,1,3,2).") | |
2443 | self.failUnlessEqual(dsds[0,1,3,3],0.0,"ds/ds has wrong value at (0,1,3,3).") | |
2444 | self.failUnlessEqual(dsds[0,1,3,4],0.0,"ds/ds has wrong value at (0,1,3,4).") | |
2445 | self.failUnlessEqual(dsds[0,2,0,0],0.0,"ds/ds has wrong value at (0,2,0,0).") | |
2446 | self.failUnlessEqual(dsds[0,2,0,1],0.0,"ds/ds has wrong value at (0,2,0,1).") | |
2447 | self.failUnlessEqual(dsds[0,2,0,2],1.0,"ds/ds has wrong value at (0,2,0,2).") | |
2448 | self.failUnlessEqual(dsds[0,2,0,3],0.0,"ds/ds has wrong value at (0,2,0,3).") | |
2449 | self.failUnlessEqual(dsds[0,2,0,4],0.0,"ds/ds has wrong value at (0,2,0,4).") | |
2450 | self.failUnlessEqual(dsds[0,2,1,0],0.0,"ds/ds has wrong value at (0,2,1,0).") | |
2451 | self.failUnlessEqual(dsds[0,2,1,1],0.0,"ds/ds has wrong value at (0,2,1,1).") | |
2452 | self.failUnlessEqual(dsds[0,2,1,2],0.0,"ds/ds has wrong value at (0,2,1,2).") | |
2453 | self.failUnlessEqual(dsds[0,2,1,3],0.0,"ds/ds has wrong value at (0,2,1,3).") | |
2454 | self.failUnlessEqual(dsds[0,2,1,4],0.0,"ds/ds has wrong value at (0,2,1,4).") | |
2455 | self.failUnlessEqual(dsds[0,2,2,0],0.0,"ds/ds has wrong value at (0,2,2,0).") | |
2456 | self.failUnlessEqual(dsds[0,2,2,1],0.0,"ds/ds has wrong value at (0,2,2,1).") | |
2457 | self.failUnlessEqual(dsds[0,2,2,2],0.0,"ds/ds has wrong value at (0,2,2,2).") | |
2458 | self.failUnlessEqual(dsds[0,2,2,3],0.0,"ds/ds has wrong value at (0,2,2,3).") | |
2459 | self.failUnlessEqual(dsds[0,2,2,4],0.0,"ds/ds has wrong value at (0,2,2,4).") | |
2460 | self.failUnlessEqual(dsds[0,2,3,0],0.0,"ds/ds has wrong value at (0,2,3,0).") | |
2461 | self.failUnlessEqual(dsds[0,2,3,1],0.0,"ds/ds has wrong value at (0,2,3,1).") | |
2462 | self.failUnlessEqual(dsds[0,2,3,2],0.0,"ds/ds has wrong value at (0,2,3,2).") | |
2463 | self.failUnlessEqual(dsds[0,2,3,3],0.0,"ds/ds has wrong value at (0,2,3,3).") | |
2464 | self.failUnlessEqual(dsds[0,2,3,4],0.0,"ds/ds has wrong value at (0,2,3,4).") | |
2465 | self.failUnlessEqual(dsds[0,3,0,0],0.0,"ds/ds has wrong value at (0,3,0,0).") | |
2466 | self.failUnlessEqual(dsds[0,3,0,1],0.0,"ds/ds has wrong value at (0,3,0,1).") | |
2467 | self.failUnlessEqual(dsds[0,3,0,2],0.0,"ds/ds has wrong value at (0,3,0,2).") | |
2468 | self.failUnlessEqual(dsds[0,3,0,3],1.0,"ds/ds has wrong value at (0,3,0,3).") | |
2469 | self.failUnlessEqual(dsds[0,3,0,4],0.0,"ds/ds has wrong value at (0,3,0,4).") | |
2470 | self.failUnlessEqual(dsds[0,3,1,0],0.0,"ds/ds has wrong value at (0,3,1,0).") | |
2471 | self.failUnlessEqual(dsds[0,3,1,1],0.0,"ds/ds has wrong value at (0,3,1,1).") | |
2472 | self.failUnlessEqual(dsds[0,3,1,2],0.0,"ds/ds has wrong value at (0,3,1,2).") | |
2473 | self.failUnlessEqual(dsds[0,3,1,3],0.0,"ds/ds has wrong value at (0,3,1,3).") | |
2474 | self.failUnlessEqual(dsds[0,3,1,4],0.0,"ds/ds has wrong value at (0,3,1,4).") | |
2475 | self.failUnlessEqual(dsds[0,3,2,0],0.0,"ds/ds has wrong value at (0,3,2,0).") | |
2476 | self.failUnlessEqual(dsds[0,3,2,1],0.0,"ds/ds has wrong value at (0,3,2,1).") | |
2477 | self.failUnlessEqual(dsds[0,3,2,2],0.0,"ds/ds has wrong value at (0,3,2,2).") | |
2478 | self.failUnlessEqual(dsds[0,3,2,3],0.0,"ds/ds has wrong value at (0,3,2,3).") | |
2479 | self.failUnlessEqual(dsds[0,3,2,4],0.0,"ds/ds has wrong value at (0,3,2,4).") | |
2480 | self.failUnlessEqual(dsds[0,3,3,0],0.0,"ds/ds has wrong value at (0,3,3,0).") | |
2481 | self.failUnlessEqual(dsds[0,3,3,1],0.0,"ds/ds has wrong value at (0,3,3,1).") | |
2482 | self.failUnlessEqual(dsds[0,3,3,2],0.0,"ds/ds has wrong value at (0,3,3,2).") | |
2483 | self.failUnlessEqual(dsds[0,3,3,3],0.0,"ds/ds has wrong value at (0,3,3,3).") | |
2484 | self.failUnlessEqual(dsds[0,3,3,4],0.0,"ds/ds has wrong value at (0,3,3,4).") | |
2485 | self.failUnlessEqual(dsds[0,4,0,0],0.0,"ds/ds has wrong value at (0,4,0,0).") | |
2486 | self.failUnlessEqual(dsds[0,4,0,1],0.0,"ds/ds has wrong value at (0,4,0,1).") | |
2487 | self.failUnlessEqual(dsds[0,4,0,2],0.0,"ds/ds has wrong value at (0,4,0,2).") | |
2488 | self.failUnlessEqual(dsds[0,4,0,3],0.0,"ds/ds has wrong value at (0,4,0,3).") | |
2489 | self.failUnlessEqual(dsds[0,4,0,4],1.0,"ds/ds has wrong value at (0,4,0,4).") | |
2490 | self.failUnlessEqual(dsds[0,4,1,0],0.0,"ds/ds has wrong value at (0,4,1,0).") | |
2491 | self.failUnlessEqual(dsds[0,4,1,1],0.0,"ds/ds has wrong value at (0,4,1,1).") | |
2492 | self.failUnlessEqual(dsds[0,4,1,2],0.0,"ds/ds has wrong value at (0,4,1,2).") | |
2493 | self.failUnlessEqual(dsds[0,4,1,3],0.0,"ds/ds has wrong value at (0,4,1,3).") | |
2494 | self.failUnlessEqual(dsds[0,4,1,4],0.0,"ds/ds has wrong value at (0,4,1,4).") | |
2495 | self.failUnlessEqual(dsds[0,4,2,0],0.0,"ds/ds has wrong value at (0,4,2,0).") | |
2496 | self.failUnlessEqual(dsds[0,4,2,1],0.0,"ds/ds has wrong value at (0,4,2,1).") | |
2497 | self.failUnlessEqual(dsds[0,4,2,2],0.0,"ds/ds has wrong value at (0,4,2,2).") | |
2498 | self.failUnlessEqual(dsds[0,4,2,3],0.0,"ds/ds has wrong value at (0,4,2,3).") | |
2499 | self.failUnlessEqual(dsds[0,4,2,4],0.0,"ds/ds has wrong value at (0,4,2,4).") | |
2500 | self.failUnlessEqual(dsds[0,4,3,0],0.0,"ds/ds has wrong value at (0,4,3,0).") | |
2501 | self.failUnlessEqual(dsds[0,4,3,1],0.0,"ds/ds has wrong value at (0,4,3,1).") | |
2502 | self.failUnlessEqual(dsds[0,4,3,2],0.0,"ds/ds has wrong value at (0,4,3,2).") | |
2503 | self.failUnlessEqual(dsds[0,4,3,3],0.0,"ds/ds has wrong value at (0,4,3,3).") | |
2504 | self.failUnlessEqual(dsds[0,4,3,4],0.0,"ds/ds has wrong value at (0,4,3,4).") | |
2505 | self.failUnlessEqual(dsds[1,0,0,0],0.0,"ds/ds has wrong value at (1,0,0,0).") | |
2506 | self.failUnlessEqual(dsds[1,0,0,1],0.0,"ds/ds has wrong value at (1,0,0,1).") | |
2507 | self.failUnlessEqual(dsds[1,0,0,2],0.0,"ds/ds has wrong value at (1,0,0,2).") | |
2508 | self.failUnlessEqual(dsds[1,0,0,3],0.0,"ds/ds has wrong value at (1,0,0,3).") | |
2509 | self.failUnlessEqual(dsds[1,0,0,4],0.0,"ds/ds has wrong value at (1,0,0,4).") | |
2510 | self.failUnlessEqual(dsds[1,0,1,0],1.0,"ds/ds has wrong value at (1,0,1,0).") | |
2511 | self.failUnlessEqual(dsds[1,0,1,1],0.0,"ds/ds has wrong value at (1,0,1,1).") | |
2512 | self.failUnlessEqual(dsds[1,0,1,2],0.0,"ds/ds has wrong value at (1,0,1,2).") | |
2513 | self.failUnlessEqual(dsds[1,0,1,3],0.0,"ds/ds has wrong value at (1,0,1,3).") | |
2514 | self.failUnlessEqual(dsds[1,0,1,4],0.0,"ds/ds has wrong value at (1,0,1,4).") | |
2515 | self.failUnlessEqual(dsds[1,0,2,0],0.0,"ds/ds has wrong value at (1,0,2,0).") | |
2516 | self.failUnlessEqual(dsds[1,0,2,1],0.0,"ds/ds has wrong value at (1,0,2,1).") | |
2517 | self.failUnlessEqual(dsds[1,0,2,2],0.0,"ds/ds has wrong value at (1,0,2,2).") | |
2518 | self.failUnlessEqual(dsds[1,0,2,3],0.0,"ds/ds has wrong value at (1,0,2,3).") | |
2519 | self.failUnlessEqual(dsds[1,0,2,4],0.0,"ds/ds has wrong value at (1,0,2,4).") | |
2520 | self.failUnlessEqual(dsds[1,0,3,0],0.0,"ds/ds has wrong value at (1,0,3,0).") | |
2521 | self.failUnlessEqual(dsds[1,0,3,1],0.0,"ds/ds has wrong value at (1,0,3,1).") | |
2522 | self.failUnlessEqual(dsds[1,0,3,2],0.0,"ds/ds has wrong value at (1,0,3,2).") | |
2523 | self.failUnlessEqual(dsds[1,0,3,3],0.0,"ds/ds has wrong value at (1,0,3,3).") | |
2524 | self.failUnlessEqual(dsds[1,0,3,4],0.0,"ds/ds has wrong value at (1,0,3,4).") | |
2525 | self.failUnlessEqual(dsds[1,1,0,0],0.0,"ds/ds has wrong value at (1,1,0,0).") | |
2526 | self.failUnlessEqual(dsds[1,1,0,1],0.0,"ds/ds has wrong value at (1,1,0,1).") | |
2527 | self.failUnlessEqual(dsds[1,1,0,2],0.0,"ds/ds has wrong value at (1,1,0,2).") | |
2528 | self.failUnlessEqual(dsds[1,1,0,3],0.0,"ds/ds has wrong value at (1,1,0,3).") | |
2529 | self.failUnlessEqual(dsds[1,1,0,4],0.0,"ds/ds has wrong value at (1,1,0,4).") | |
2530 | self.failUnlessEqual(dsds[1,1,1,0],0.0,"ds/ds has wrong value at (1,1,1,0).") | |
2531 | self.failUnlessEqual(dsds[1,1,1,1],1.0,"ds/ds has wrong value at (1,1,1,1).") | |
2532 | self.failUnlessEqual(dsds[1,1,1,2],0.0,"ds/ds has wrong value at (1,1,1,2).") | |
2533 | self.failUnlessEqual(dsds[1,1,1,3],0.0,"ds/ds has wrong value at (1,1,1,3).") | |
2534 | self.failUnlessEqual(dsds[1,1,1,4],0.0,"ds/ds has wrong value at (1,1,1,4).") | |
2535 | self.failUnlessEqual(dsds[1,1,2,0],0.0,"ds/ds has wrong value at (1,1,2,0).") | |
2536 | self.failUnlessEqual(dsds[1,1,2,1],0.0,"ds/ds has wrong value at (1,1,2,1).") | |
2537 | self.failUnlessEqual(dsds[1,1,2,2],0.0,"ds/ds has wrong value at (1,1,2,2).") | |
2538 | self.failUnlessEqual(dsds[1,1,2,3],0.0,"ds/ds has wrong value at (1,1,2,3).") | |
2539 | self.failUnlessEqual(dsds[1,1,2,4],0.0,"ds/ds has wrong value at (1,1,2,4).") | |
2540 | self.failUnlessEqual(dsds[1,1,3,0],0.0,"ds/ds has wrong value at (1,1,3,0).") | |
2541 | self.failUnlessEqual(dsds[1,1,3,1],0.0,"ds/ds has wrong value at (1,1,3,1).") | |
2542 | self.failUnlessEqual(dsds[1,1,3,2],0.0,"ds/ds has wrong value at (1,1,3,2).") | |
2543 | self.failUnlessEqual(dsds[1,1,3,3],0.0,"ds/ds has wrong value at (1,1,3,3).") | |
2544 | self.failUnlessEqual(dsds[1,1,3,4],0.0,"ds/ds has wrong value at (1,1,3,4).") | |
2545 | self.failUnlessEqual(dsds[1,2,0,0],0.0,"ds/ds has wrong value at (1,2,0,0).") | |
2546 | self.failUnlessEqual(dsds[1,2,0,1],0.0,"ds/ds has wrong value at (1,2,0,1).") | |
2547 | self.failUnlessEqual(dsds[1,2,0,2],0.0,"ds/ds has wrong value at (1,2,0,2).") | |
2548 | self.failUnlessEqual(dsds[1,2,0,3],0.0,"ds/ds has wrong value at (1,2,0,3).") | |
2549 | self.failUnlessEqual(dsds[1,2,0,4],0.0,"ds/ds has wrong value at (1,2,0,4).") | |
2550 | self.failUnlessEqual(dsds[1,2,1,0],0.0,"ds/ds has wrong value at (1,2,1,0).") | |
2551 | self.failUnlessEqual(dsds[1,2,1,1],0.0,"ds/ds has wrong value at (1,2,1,1).") | |
2552 | self.failUnlessEqual(dsds[1,2,1,2],1.0,"ds/ds has wrong value at (1,2,1,2).") | |
2553 | self.failUnlessEqual(dsds[1,2,1,3],0.0,"ds/ds has wrong value at (1,2,1,3).") | |
2554 | self.failUnlessEqual(dsds[1,2,1,4],0.0,"ds/ds has wrong value at (1,2,1,4).") | |
2555 | self.failUnlessEqual(dsds[1,2,2,0],0.0,"ds/ds has wrong value at (1,2,2,0).") | |
2556 | self.failUnlessEqual(dsds[1,2,2,1],0.0,"ds/ds has wrong value at (1,2,2,1).") | |
2557 | self.failUnlessEqual(dsds[1,2,2,2],0.0,"ds/ds has wrong value at (1,2,2,2).") | |
2558 | self.failUnlessEqual(dsds[1,2,2,3],0.0,"ds/ds has wrong value at (1,2,2,3).") | |
2559 | self.failUnlessEqual(dsds[1,2,2,4],0.0,"ds/ds has wrong value at (1,2,2,4).") | |
2560 | self.failUnlessEqual(dsds[1,2,3,0],0.0,"ds/ds has wrong value at (1,2,3,0).") | |
2561 | self.failUnlessEqual(dsds[1,2,3,1],0.0,"ds/ds has wrong value at (1,2,3,1).") | |
2562 | self.failUnlessEqual(dsds[1,2,3,2],0.0,"ds/ds has wrong value at (1,2,3,2).") | |
2563 | self.failUnlessEqual(dsds[1,2,3,3],0.0,"ds/ds has wrong value at (1,2,3,3).") | |
2564 | self.failUnlessEqual(dsds[1,2,3,4],0.0,"ds/ds has wrong value at (1,2,3,4).") | |
2565 | self.failUnlessEqual(dsds[1,3,0,0],0.0,"ds/ds has wrong value at (1,3,0,0).") | |
2566 | self.failUnlessEqual(dsds[1,3,0,1],0.0,"ds/ds has wrong value at (1,3,0,1).") | |
2567 | self.failUnlessEqual(dsds[1,3,0,2],0.0,"ds/ds has wrong value at (1,3,0,2).") | |
2568 | self.failUnlessEqual(dsds[1,3,0,3],0.0,"ds/ds has wrong value at (1,3,0,3).") | |
2569 | self.failUnlessEqual(dsds[1,3,0,4],0.0,"ds/ds has wrong value at (1,3,0,4).") | |
2570 | self.failUnlessEqual(dsds[1,3,1,0],0.0,"ds/ds has wrong value at (1,3,1,0).") | |
2571 | self.failUnlessEqual(dsds[1,3,1,1],0.0,"ds/ds has wrong value at (1,3,1,1).") | |
2572 | self.failUnlessEqual(dsds[1,3,1,2],0.0,"ds/ds has wrong value at (1,3,1,2).") | |
2573 | self.failUnlessEqual(dsds[1,3,1,3],1.0,"ds/ds has wrong value at (1,3,1,3).") | |
2574 | self.failUnlessEqual(dsds[1,3,1,4],0.0,"ds/ds has wrong value at (1,3,1,4).") | |
2575 | self.failUnlessEqual(dsds[1,3,2,0],0.0,"ds/ds has wrong value at (1,3,2,0).") | |
2576 | self.failUnlessEqual(dsds[1,3,2,1],0.0,"ds/ds has wrong value at (1,3,2,1).") | |
2577 | self.failUnlessEqual(dsds[1,3,2,2],0.0,"ds/ds has wrong value at (1,3,2,2).") | |
2578 | self.failUnlessEqual(dsds[1,3,2,3],0.0,"ds/ds has wrong value at (1,3,2,3).") | |
2579 | self.failUnlessEqual(dsds[1,3,2,4],0.0,"ds/ds has wrong value at (1,3,2,4).") | |
2580 | self.failUnlessEqual(dsds[1,3,3,0],0.0,"ds/ds has wrong value at (1,3,3,0).") | |
2581 | self.failUnlessEqual(dsds[1,3,3,1],0.0,"ds/ds has wrong value at (1,3,3,1).") | |
2582 | self.failUnlessEqual(dsds[1,3,3,2],0.0,"ds/ds has wrong value at (1,3,3,2).") | |
2583 | self.failUnlessEqual(dsds[1,3,3,3],0.0,"ds/ds has wrong value at (1,3,3,3).") | |
2584 | self.failUnlessEqual(dsds[1,3,3,4],0.0,"ds/ds has wrong value at (1,3,3,4).") | |
2585 | self.failUnlessEqual(dsds[1,4,0,0],0.0,"ds/ds has wrong value at (1,4,0,0).") | |
2586 | self.failUnlessEqual(dsds[1,4,0,1],0.0,"ds/ds has wrong value at (1,4,0,1).") | |
2587 | self.failUnlessEqual(dsds[1,4,0,2],0.0,"ds/ds has wrong value at (1,4,0,2).") | |
2588 | self.failUnlessEqual(dsds[1,4,0,3],0.0,"ds/ds has wrong value at (1,4,0,3).") | |
2589 | self.failUnlessEqual(dsds[1,4,0,4],0.0,"ds/ds has wrong value at (1,4,0,4).") | |
2590 | self.failUnlessEqual(dsds[1,4,1,0],0.0,"ds/ds has wrong value at (1,4,1,0).") | |
2591 | self.failUnlessEqual(dsds[1,4,1,1],0.0,"ds/ds has wrong value at (1,4,1,1).") | |
2592 | self.failUnlessEqual(dsds[1,4,1,2],0.0,"ds/ds has wrong value at (1,4,1,2).") | |
2593 | self.failUnlessEqual(dsds[1,4,1,3],0.0,"ds/ds has wrong value at (1,4,1,3).") | |
2594 | self.failUnlessEqual(dsds[1,4,1,4],1.0,"ds/ds has wrong value at (1,4,1,4).") | |
2595 | self.failUnlessEqual(dsds[1,4,2,0],0.0,"ds/ds has wrong value at (1,4,2,0).") | |
2596 | self.failUnlessEqual(dsds[1,4,2,1],0.0,"ds/ds has wrong value at (1,4,2,1).") | |
2597 | self.failUnlessEqual(dsds[1,4,2,2],0.0,"ds/ds has wrong value at (1,4,2,2).") | |
2598 | self.failUnlessEqual(dsds[1,4,2,3],0.0,"ds/ds has wrong value at (1,4,2,3).") | |
2599 | self.failUnlessEqual(dsds[1,4,2,4],0.0,"ds/ds has wrong value at (1,4,2,4).") | |
2600 | self.failUnlessEqual(dsds[1,4,3,0],0.0,"ds/ds has wrong value at (1,4,3,0).") | |
2601 | self.failUnlessEqual(dsds[1,4,3,1],0.0,"ds/ds has wrong value at (1,4,3,1).") | |
2602 | self.failUnlessEqual(dsds[1,4,3,2],0.0,"ds/ds has wrong value at (1,4,3,2).") | |
2603 | self.failUnlessEqual(dsds[1,4,3,3],0.0,"ds/ds has wrong value at (1,4,3,3).") | |
2604 | self.failUnlessEqual(dsds[1,4,3,4],0.0,"ds/ds has wrong value at (1,4,3,4).") | |
2605 | self.failUnlessEqual(dsds[2,0,0,0],0.0,"ds/ds has wrong value at (2,0,0,0).") | |
2606 | self.failUnlessEqual(dsds[2,0,0,1],0.0,"ds/ds has wrong value at (2,0,0,1).") | |
2607 | self.failUnlessEqual(dsds[2,0,0,2],0.0,"ds/ds has wrong value at (2,0,0,2).") | |
2608 | self.failUnlessEqual(dsds[2,0,0,3],0.0,"ds/ds has wrong value at (2,0,0,3).") | |
2609 | self.failUnlessEqual(dsds[2,0,0,4],0.0,"ds/ds has wrong value at (2,0,0,4).") | |
2610 | self.failUnlessEqual(dsds[2,0,1,0],0.0,"ds/ds has wrong value at (2,0,1,0).") | |
2611 | self.failUnlessEqual(dsds[2,0,1,1],0.0,"ds/ds has wrong value at (2,0,1,1).") | |
2612 | self.failUnlessEqual(dsds[2,0,1,2],0.0,"ds/ds has wrong value at (2,0,1,2).") | |
2613 | self.failUnlessEqual(dsds[2,0,1,3],0.0,"ds/ds has wrong value at (2,0,1,3).") | |
2614 | self.failUnlessEqual(dsds[2,0,1,4],0.0,"ds/ds has wrong value at (2,0,1,4).") | |
2615 | self.failUnlessEqual(dsds[2,0,2,0],1.0,"ds/ds has wrong value at (2,0,2,0).") | |
2616 | self.failUnlessEqual(dsds[2,0,2,1],0.0,"ds/ds has wrong value at (2,0,2,1).") | |
2617 | self.failUnlessEqual(dsds[2,0,2,2],0.0,"ds/ds has wrong value at (2,0,2,2).") | |
2618 | self.failUnlessEqual(dsds[2,0,2,3],0.0,"ds/ds has wrong value at (2,0,2,3).") | |
2619 | self.failUnlessEqual(dsds[2,0,2,4],0.0,"ds/ds has wrong value at (2,0,2,4).") | |
2620 | self.failUnlessEqual(dsds[2,0,3,0],0.0,"ds/ds has wrong value at (2,0,3,0).") | |
2621 | self.failUnlessEqual(dsds[2,0,3,1],0.0,"ds/ds has wrong value at (2,0,3,1).") | |
2622 | self.failUnlessEqual(dsds[2,0,3,2],0.0,"ds/ds has wrong value at (2,0,3,2).") | |
2623 | self.failUnlessEqual(dsds[2,0,3,3],0.0,"ds/ds has wrong value at (2,0,3,3).") | |
2624 | self.failUnlessEqual(dsds[2,0,3,4],0.0,"ds/ds has wrong value at (2,0,3,4).") | |
2625 | self.failUnlessEqual(dsds[2,1,0,0],0.0,"ds/ds has wrong value at (2,1,0,0).") | |
2626 | self.failUnlessEqual(dsds[2,1,0,1],0.0,"ds/ds has wrong value at (2,1,0,1).") | |
2627 | self.failUnlessEqual(dsds[2,1,0,2],0.0,"ds/ds has wrong value at (2,1,0,2).") | |
2628 | self.failUnlessEqual(dsds[2,1,0,3],0.0,"ds/ds has wrong value at (2,1,0,3).") | |
2629 | self.failUnlessEqual(dsds[2,1,0,4],0.0,"ds/ds has wrong value at (2,1,0,4).") | |
2630 | self.failUnlessEqual(dsds[2,1,1,0],0.0,"ds/ds has wrong value at (2,1,1,0).") | |
2631 | self.failUnlessEqual(dsds[2,1,1,1],0.0,"ds/ds has wrong value at (2,1,1,1).") | |
2632 | self.failUnlessEqual(dsds[2,1,1,2],0.0,"ds/ds has wrong value at (2,1,1,2).") | |
2633 | self.failUnlessEqual(dsds[2,1,1,3],0.0,"ds/ds has wrong value at (2,1,1,3).") | |
2634 | self.failUnlessEqual(dsds[2,1,1,4],0.0,"ds/ds has wrong value at (2,1,1,4).") | |
2635 | self.failUnlessEqual(dsds[2,1,2,0],0.0,"ds/ds has wrong value at (2,1,2,0).") | |
2636 | self.failUnlessEqual(dsds[2,1,2,1],1.0,"ds/ds has wrong value at (2,1,2,1).") | |
2637 | self.failUnlessEqual(dsds[2,1,2,2],0.0,"ds/ds has wrong value at (2,1,2,2).") | |
2638 | self.failUnlessEqual(dsds[2,1,2,3],0.0,"ds/ds has wrong value at (2,1,2,3).") | |
2639 | self.failUnlessEqual(dsds[2,1,2,4],0.0,"ds/ds has wrong value at (2,1,2,4).") | |
2640 | self.failUnlessEqual(dsds[2,1,3,0],0.0,"ds/ds has wrong value at (2,1,3,0).") | |
2641 | self.failUnlessEqual(dsds[2,1,3,1],0.0,"ds/ds has wrong value at (2,1,3,1).") | |
2642 | self.failUnlessEqual(dsds[2,1,3,2],0.0,"ds/ds has wrong value at (2,1,3,2).") | |
2643 | self.failUnlessEqual(dsds[2,1,3,3],0.0,"ds/ds has wrong value at (2,1,3,3).") | |
2644 | self.failUnlessEqual(dsds[2,1,3,4],0.0,"ds/ds has wrong value at (2,1,3,4).") | |
2645 | self.failUnlessEqual(dsds[2,2,0,0],0.0,"ds/ds has wrong value at (2,2,0,0).") | |
2646 | self.failUnlessEqual(dsds[2,2,0,1],0.0,"ds/ds has wrong value at (2,2,0,1).") | |
2647 | self.failUnlessEqual(dsds[2,2,0,2],0.0,"ds/ds has wrong value at (2,2,0,2).") | |
2648 | self.failUnlessEqual(dsds[2,2,0,3],0.0,"ds/ds has wrong value at (2,2,0,3).") | |
2649 | self.failUnlessEqual(dsds[2,2,0,4],0.0,"ds/ds has wrong value at (2,2,0,4).") | |
2650 | self.failUnlessEqual(dsds[2,2,1,0],0.0,"ds/ds has wrong value at (2,2,1,0).") | |
2651 | self.failUnlessEqual(dsds[2,2,1,1],0.0,"ds/ds has wrong value at (2,2,1,1).") | |
2652 | self.failUnlessEqual(dsds[2,2,1,2],0.0,"ds/ds has wrong value at (2,2,1,2).") | |
2653 | self.failUnlessEqual(dsds[2,2,1,3],0.0,"ds/ds has wrong value at (2,2,1,3).") | |
2654 | self.failUnlessEqual(dsds[2,2,1,4],0.0,"ds/ds has wrong value at (2,2,1,4).") | |
2655 | self.failUnlessEqual(dsds[2,2,2,0],0.0,"ds/ds has wrong value at (2,2,2,0).") | |
2656 | self.failUnlessEqual(dsds[2,2,2,1],0.0,"ds/ds has wrong value at (2,2,2,1).") | |
2657 | self.failUnlessEqual(dsds[2,2,2,2],1.0,"ds/ds has wrong value at (2,2,2,2).") | |
2658 | self.failUnlessEqual(dsds[2,2,2,3],0.0,"ds/ds has wrong value at (2,2,2,3).") | |
2659 | self.failUnlessEqual(dsds[2,2,2,4],0.0,"ds/ds has wrong value at (2,2,2,4).") | |
2660 | self.failUnlessEqual(dsds[2,2,3,0],0.0,"ds/ds has wrong value at (2,2,3,0).") | |
2661 | self.failUnlessEqual(dsds[2,2,3,1],0.0,"ds/ds has wrong value at (2,2,3,1).") | |
2662 | self.failUnlessEqual(dsds[2,2,3,2],0.0,"ds/ds has wrong value at (2,2,3,2).") | |
2663 | self.failUnlessEqual(dsds[2,2,3,3],0.0,"ds/ds has wrong value at (2,2,3,3).") | |
2664 | self.failUnlessEqual(dsds[2,2,3,4],0.0,"ds/ds has wrong value at (2,2,3,4).") | |
2665 | self.failUnlessEqual(dsds[2,3,0,0],0.0,"ds/ds has wrong value at (2,3,0,0).") | |
2666 | self.failUnlessEqual(dsds[2,3,0,1],0.0,"ds/ds has wrong value at (2,3,0,1).") | |
2667 | self.failUnlessEqual(dsds[2,3,0,2],0.0,"ds/ds has wrong value at (2,3,0,2).") | |
2668 | self.failUnlessEqual(dsds[2,3,0,3],0.0,"ds/ds has wrong value at (2,3,0,3).") | |
2669 | self.failUnlessEqual(dsds[2,3,0,4],0.0,"ds/ds has wrong value at (2,3,0,4).") | |
2670 | self.failUnlessEqual(dsds[2,3,1,0],0.0,"ds/ds has wrong value at (2,3,1,0).") | |
2671 | self.failUnlessEqual(dsds[2,3,1,1],0.0,"ds/ds has wrong value at (2,3,1,1).") | |
2672 | self.failUnlessEqual(dsds[2,3,1,2],0.0,"ds/ds has wrong value at (2,3,1,2).") | |
2673 | self.failUnlessEqual(dsds[2,3,1,3],0.0,"ds/ds has wrong value at (2,3,1,3).") | |
2674 | self.failUnlessEqual(dsds[2,3,1,4],0.0,"ds/ds has wrong value at (2,3,1,4).") | |
2675 | self.failUnlessEqual(dsds[2,3,2,0],0.0,"ds/ds has wrong value at (2,3,2,0).") | |
2676 | self.failUnlessEqual(dsds[2,3,2,1],0.0,"ds/ds has wrong value at (2,3,2,1).") | |
2677 | self.failUnlessEqual(dsds[2,3,2,2],0.0,"ds/ds has wrong value at (2,3,2,2).") | |
2678 | self.failUnlessEqual(dsds[2,3,2,3],1.0,"ds/ds has wrong value at (2,3,2,3).") | |
2679 | self.failUnlessEqual(dsds[2,3,2,4],0.0,"ds/ds has wrong value at (2,3,2,4).") | |
2680 | self.failUnlessEqual(dsds[2,3,3,0],0.0,"ds/ds has wrong value at (2,3,3,0).") | |
2681 | self.failUnlessEqual(dsds[2,3,3,1],0.0,"ds/ds has wrong value at (2,3,3,1).") | |
2682 | self.failUnlessEqual(dsds[2,3,3,2],0.0,"ds/ds has wrong value at (2,3,3,2).") | |
2683 | self.failUnlessEqual(dsds[2,3,3,3],0.0,"ds/ds has wrong value at (2,3,3,3).") | |
2684 | self.failUnlessEqual(dsds[2,3,3,4],0.0,"ds/ds has wrong value at (2,3,3,4).") | |
2685 | self.failUnlessEqual(dsds[2,4,0,0],0.0,"ds/ds has wrong value at (2,4,0,0).") | |
2686 | self.failUnlessEqual(dsds[2,4,0,1],0.0,"ds/ds has wrong value at (2,4,0,1).") | |
2687 | self.failUnlessEqual(dsds[2,4,0,2],0.0,"ds/ds has wrong value at (2,4,0,2).") | |
2688 | self.failUnlessEqual(dsds[2,4,0,3],0.0,"ds/ds has wrong value at (2,4,0,3).") | |
2689 | self.failUnlessEqual(dsds[2,4,0,4],0.0,"ds/ds has wrong value at (2,4,0,4).") | |
2690 | self.failUnlessEqual(dsds[2,4,1,0],0.0,"ds/ds has wrong value at (2,4,1,0).") | |
2691 | self.failUnlessEqual(dsds[2,4,1,1],0.0,"ds/ds has wrong value at (2,4,1,1).") | |
2692 | self.failUnlessEqual(dsds[2,4,1,2],0.0,"ds/ds has wrong value at (2,4,1,2).") | |
2693 | self.failUnlessEqual(dsds[2,4,1,3],0.0,"ds/ds has wrong value at (2,4,1,3).") | |
2694 | self.failUnlessEqual(dsds[2,4,1,4],0.0,"ds/ds has wrong value at (2,4,1,4).") | |
2695 | self.failUnlessEqual(dsds[2,4,2,0],0.0,"ds/ds has wrong value at (2,4,2,0).") | |
2696 | self.failUnlessEqual(dsds[2,4,2,1],0.0,"ds/ds has wrong value at (2,4,2,1).") | |
2697 | self.failUnlessEqual(dsds[2,4,2,2],0.0,"ds/ds has wrong value at (2,4,2,2).") | |
2698 | self.failUnlessEqual(dsds[2,4,2,3],0.0,"ds/ds has wrong value at (2,4,2,3).") | |
2699 | self.failUnlessEqual(dsds[2,4,2,4],1.0,"ds/ds has wrong value at (2,4,2,4).") | |
2700 | self.failUnlessEqual(dsds[2,4,3,0],0.0,"ds/ds has wrong value at (2,4,3,0).") | |
2701 | self.failUnlessEqual(dsds[2,4,3,1],0.0,"ds/ds has wrong value at (2,4,3,1).") | |
2702 | self.failUnlessEqual(dsds[2,4,3,2],0.0,"ds/ds has wrong value at (2,4,3,2).") | |
2703 | self.failUnlessEqual(dsds[2,4,3,3],0.0,"ds/ds has wrong value at (2,4,3,3).") | |
2704 | self.failUnlessEqual(dsds[2,4,3,4],0.0,"ds/ds has wrong value at (2,4,3,4).") | |
2705 | self.failUnlessEqual(dsds[3,0,0,0],0.0,"ds/ds has wrong value at (3,0,0,0).") | |
2706 | self.failUnlessEqual(dsds[3,0,0,1],0.0,"ds/ds has wrong value at (3,0,0,1).") | |
2707 | self.failUnlessEqual(dsds[3,0,0,2],0.0,"ds/ds has wrong value at (3,0,0,2).") | |
2708 | self.failUnlessEqual(dsds[3,0,0,3],0.0,"ds/ds has wrong value at (3,0,0,3).") | |
2709 | self.failUnlessEqual(dsds[3,0,0,4],0.0,"ds/ds has wrong value at (3,0,0,4).") | |
2710 | self.failUnlessEqual(dsds[3,0,1,0],0.0,"ds/ds has wrong value at (3,0,1,0).") | |
2711 | self.failUnlessEqual(dsds[3,0,1,1],0.0,"ds/ds has wrong value at (3,0,1,1).") | |
2712 | self.failUnlessEqual(dsds[3,0,1,2],0.0,"ds/ds has wrong value at (3,0,1,2).") | |
2713 | self.failUnlessEqual(dsds[3,0,1,3],0.0,"ds/ds has wrong value at (3,0,1,3).") | |
2714 | self.failUnlessEqual(dsds[3,0,1,4],0.0,"ds/ds has wrong value at (3,0,1,4).") | |
2715 | self.failUnlessEqual(dsds[3,0,2,0],0.0,"ds/ds has wrong value at (3,0,2,0).") | |
2716 | self.failUnlessEqual(dsds[3,0,2,1],0.0,"ds/ds has wrong value at (3,0,2,1).") | |
2717 | self.failUnlessEqual(dsds[3,0,2,2],0.0,"ds/ds has wrong value at (3,0,2,2).") | |
2718 | self.failUnlessEqual(dsds[3,0,2,3],0.0,"ds/ds has wrong value at (3,0,2,3).") | |
2719 | self.failUnlessEqual(dsds[3,0,2,4],0.0,"ds/ds has wrong value at (3,0,2,4).") | |
2720 | self.failUnlessEqual(dsds[3,0,3,0],1.0,"ds/ds has wrong value at (3,0,3,0).") | |
2721 | self.failUnlessEqual(dsds[3,0,3,1],0.0,"ds/ds has wrong value at (3,0,3,1).") | |
2722 | self.failUnlessEqual(dsds[3,0,3,2],0.0,"ds/ds has wrong value at (3,0,3,2).") | |
2723 | self.failUnlessEqual(dsds[3,0,3,3],0.0,"ds/ds has wrong value at (3,0,3,3).") | |
2724 | self.failUnlessEqual(dsds[3,0,3,4],0.0,"ds/ds has wrong value at (3,0,3,4).") | |
2725 | self.failUnlessEqual(dsds[3,1,0,0],0.0,"ds/ds has wrong value at (3,1,0,0).") | |
2726 | self.failUnlessEqual(dsds[3,1,0,1],0.0,"ds/ds has wrong value at (3,1,0,1).") | |
2727 | self.failUnlessEqual(dsds[3,1,0,2],0.0,"ds/ds has wrong value at (3,1,0,2).") | |
2728 | self.failUnlessEqual(dsds[3,1,0,3],0.0,"ds/ds has wrong value at (3,1,0,3).") | |
2729 | self.failUnlessEqual(dsds[3,1,0,4],0.0,"ds/ds has wrong value at (3,1,0,4).") | |
2730 | self.failUnlessEqual(dsds[3,1,1,0],0.0,"ds/ds has wrong value at (3,1,1,0).") | |
2731 | self.failUnlessEqual(dsds[3,1,1,1],0.0,"ds/ds has wrong value at (3,1,1,1).") | |
2732 | self.failUnlessEqual(dsds[3,1,1,2],0.0,"ds/ds has wrong value at (3,1,1,2).") | |
2733 | self.failUnlessEqual(dsds[3,1,1,3],0.0,"ds/ds has wrong value at (3,1,1,3).") | |
2734 | self.failUnlessEqual(dsds[3,1,1,4],0.0,"ds/ds has wrong value at (3,1,1,4).") | |
2735 | self.failUnlessEqual(dsds[3,1,2,0],0.0,"ds/ds has wrong value at (3,1,2,0).") | |
2736 | self.failUnlessEqual(dsds[3,1,2,1],0.0,"ds/ds has wrong value at (3,1,2,1).") | |
2737 | self.failUnlessEqual(dsds[3,1,2,2],0.0,"ds/ds has wrong value at (3,1,2,2).") | |
2738 | self.failUnlessEqual(dsds[3,1,2,3],0.0,"ds/ds has wrong value at (3,1,2,3).") | |
2739 | self.failUnlessEqual(dsds[3,1,2,4],0.0,"ds/ds has wrong value at (3,1,2,4).") | |
2740 | self.failUnlessEqual(dsds[3,1,3,0],0.0,"ds/ds has wrong value at (3,1,3,0).") | |
2741 | self.failUnlessEqual(dsds[3,1,3,1],1.0,"ds/ds has wrong value at (3,1,3,1).") | |
2742 | self.failUnlessEqual(dsds[3,1,3,2],0.0,"ds/ds has wrong value at (3,1,3,2).") | |
2743 | self.failUnlessEqual(dsds[3,1,3,3],0.0,"ds/ds has wrong value at (3,1,3,3).") | |
2744 | self.failUnlessEqual(dsds[3,1,3,4],0.0,"ds/ds has wrong value at (3,1,3,4).") | |
2745 | self.failUnlessEqual(dsds[3,2,0,0],0.0,"ds/ds has wrong value at (3,2,0,0).") | |
2746 | self.failUnlessEqual(dsds[3,2,0,1],0.0,"ds/ds has wrong value at (3,2,0,1).") | |
2747 | self.failUnlessEqual(dsds[3,2,0,2],0.0,"ds/ds has wrong value at (3,2,0,2).") | |
2748 | self.failUnlessEqual(dsds[3,2,0,3],0.0,"ds/ds has wrong value at (3,2,0,3).") | |
2749 | self.failUnlessEqual(dsds[3,2,0,4],0.0,"ds/ds has wrong value at (3,2,0,4).") | |
2750 | self.failUnlessEqual(dsds[3,2,1,0],0.0,"ds/ds has wrong value at (3,2,1,0).") | |
2751 | self.failUnlessEqual(dsds[3,2,1,1],0.0,"ds/ds has wrong value at (3,2,1,1).") | |
2752 | self.failUnlessEqual(dsds[3,2,1,2],0.0,"ds/ds has wrong value at (3,2,1,2).") | |
2753 | self.failUnlessEqual(dsds[3,2,1,3],0.0,"ds/ds has wrong value at (3,2,1,3).") | |
2754 | self.failUnlessEqual(dsds[3,2,1,4],0.0,"ds/ds has wrong value at (3,2,1,4).") | |
2755 | self.failUnlessEqual(dsds[3,2,2,0],0.0,"ds/ds has wrong value at (3,2,2,0).") | |
2756 | self.failUnlessEqual(dsds[3,2,2,1],0.0,"ds/ds has wrong value at (3,2,2,1).") | |
2757 | self.failUnlessEqual(dsds[3,2,2,2],0.0,"ds/ds has wrong value at (3,2,2,2).") | |
2758 | self.failUnlessEqual(dsds[3,2,2,3],0.0,"ds/ds has wrong value at (3,2,2,3).") | |
2759 | self.failUnlessEqual(dsds[3,2,2,4],0.0,"ds/ds has wrong value at (3,2,2,4).") | |
2760 | self.failUnlessEqual(dsds[3,2,3,0],0.0,"ds/ds has wrong value at (3,2,3,0).") | |
2761 | self.failUnlessEqual(dsds[3,2,3,1],0.0,"ds/ds has wrong value at (3,2,3,1).") | |
2762 | self.failUnlessEqual(dsds[3,2,3,2],1.0,"ds/ds has wrong value at (3,2,3,2).") | |
2763 | self.failUnlessEqual(dsds[3,2,3,3],0.0,"ds/ds has wrong value at (3,2,3,3).") | |
2764 | self.failUnlessEqual(dsds[3,2,3,4],0.0,"ds/ds has wrong value at (3,2,3,4).") | |
2765 | self.failUnlessEqual(dsds[3,3,0,0],0.0,"ds/ds has wrong value at (3,3,0,0).") | |
2766 | self.failUnlessEqual(dsds[3,3,0,1],0.0,"ds/ds has wrong value at (3,3,0,1).") | |
2767 | self.failUnlessEqual(dsds[3,3,0,2],0.0,"ds/ds has wrong value at (3,3,0,2).") | |
2768 | self.failUnlessEqual(dsds[3,3,0,3],0.0,"ds/ds has wrong value at (3,3,0,3).") | |
2769 | self.failUnlessEqual(dsds[3,3,0,4],0.0,"ds/ds has wrong value at (3,3,0,4).") | |
2770 | self.failUnlessEqual(dsds[3,3,1,0],0.0,"ds/ds has wrong value at (3,3,1,0).") | |
2771 | self.failUnlessEqual(dsds[3,3,1,1],0.0,"ds/ds has wrong value at (3,3,1,1).") | |
2772 | self.failUnlessEqual(dsds[3,3,1,2],0.0,"ds/ds has wrong value at (3,3,1,2).") | |
2773 | self.failUnlessEqual(dsds[3,3,1,3],0.0,"ds/ds has wrong value at (3,3,1,3).") | |
2774 | self.failUnlessEqual(dsds[3,3,1,4],0.0,"ds/ds has wrong value at (3,3,1,4).") | |
2775 | self.failUnlessEqual(dsds[3,3,2,0],0.0,"ds/ds has wrong value at (3,3,2,0).") | |
2776 | self.failUnlessEqual(dsds[3,3,2,1],0.0,"ds/ds has wrong value at (3,3,2,1).") | |
2777 | self.failUnlessEqual(dsds[3,3,2,2],0.0,"ds/ds has wrong value at (3,3,2,2).") | |
2778 | self.failUnlessEqual(dsds[3,3,2,3],0.0,"ds/ds has wrong value at (3,3,2,3).") | |
2779 | self.failUnlessEqual(dsds[3,3,2,4],0.0,"ds/ds has wrong value at (3,3,2,4).") | |
2780 | self.failUnlessEqual(dsds[3,3,3,0],0.0,"ds/ds has wrong value at (3,3,3,0).") | |
2781 | self.failUnlessEqual(dsds[3,3,3,1],0.0,"ds/ds has wrong value at (3,3,3,1).") | |
2782 | self.failUnlessEqual(dsds[3,3,3,2],0.0,"ds/ds has wrong value at (3,3,3,2).") | |
2783 | self.failUnlessEqual(dsds[3,3,3,3],1.0,"ds/ds has wrong value at (3,3,3,3).") | |
2784 | self.failUnlessEqual(dsds[3,3,3,4],0.0,"ds/ds has wrong value at (3,3,3,4).") | |
2785 | self.failUnlessEqual(dsds[3,4,0,0],0.0,"ds/ds has wrong value at (3,4,0,0).") | |
2786 | self.failUnlessEqual(dsds[3,4,0,1],0.0,"ds/ds has wrong value at (3,4,0,1).") | |
2787 | self.failUnlessEqual(dsds[3,4,0,2],0.0,"ds/ds has wrong value at (3,4,0,2).") | |
2788 | self.failUnlessEqual(dsds[3,4,0,3],0.0,"ds/ds has wrong value at (3,4,0,3).") | |
2789 | self.failUnlessEqual(dsds[3,4,0,4],0.0,"ds/ds has wrong value at (3,4,0,4).") | |
2790 | self.failUnlessEqual(dsds[3,4,1,0],0.0,"ds/ds has wrong value at (3,4,1,0).") | |
2791 | self.failUnlessEqual(dsds[3,4,1,1],0.0,"ds/ds has wrong value at (3,4,1,1).") | |
2792 | self.failUnlessEqual(dsds[3,4,1,2],0.0,"ds/ds has wrong value at (3,4,1,2).") | |
2793 | self.failUnlessEqual(dsds[3,4,1,3],0.0,"ds/ds has wrong value at (3,4,1,3).") | |
2794 | self.failUnlessEqual(dsds[3,4,1,4],0.0,"ds/ds has wrong value at (3,4,1,4).") | |
2795 | self.failUnlessEqual(dsds[3,4,2,0],0.0,"ds/ds has wrong value at (3,4,2,0).") | |
2796 | self.failUnlessEqual(dsds[3,4,2,1],0.0,"ds/ds has wrong value at (3,4,2,1).") | |
2797 | self.failUnlessEqual(dsds[3,4,2,2],0.0,"ds/ds has wrong value at (3,4,2,2).") | |
2798 | self.failUnlessEqual(dsds[3,4,2,3],0.0,"ds/ds has wrong value at (3,4,2,3).") | |
2799 | self.failUnlessEqual(dsds[3,4,2,4],0.0,"ds/ds has wrong value at (3,4,2,4).") | |
2800 | self.failUnlessEqual(dsds[3,4,3,0],0.0,"ds/ds has wrong value at (3,4,3,0).") | |
2801 | self.failUnlessEqual(dsds[3,4,3,1],0.0,"ds/ds has wrong value at (3,4,3,1).") | |
2802 | self.failUnlessEqual(dsds[3,4,3,2],0.0,"ds/ds has wrong value at (3,4,3,2).") | |
2803 | self.failUnlessEqual(dsds[3,4,3,3],0.0,"ds/ds has wrong value at (3,4,3,3).") | |
2804 | self.failUnlessEqual(dsds[3,4,3,4],1.0,"ds/ds has wrong value at (3,4,3,4).") | |
2805 | ||
2806 | self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.") | |
2807 | sa=s.getSubstitutedArguments({s2:-10}) | |
2808 | self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments") | |
2809 | self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.") | |
2810 | ||
2811 | self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute") | |
2812 | self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute") | |
2813 | self.failUnless(s.isAppropriateValue(Symbol(shape=(4, 5),dim=None)),"Symbol is appropriate substitute") | |
2814 | self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)") | |
2815 | self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)") | |
2816 | self.failUnless(s.isAppropriateValue(numarray.zeros((4, 5))),"NumArray is appropriate substitute") | |
2817 | self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)") | |
2818 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
2819 | def test_Symbol_rank2_dNone_nargs2(self): | |
2820 | s2=Symbol(shape=()) | |
2821 | s=Symbol(shape=(4, 5),dim=None,args=[1, -1.0]) | |
2822 | self.failUnlessEqual(s.getRank(),2,"wrong rank.") | |
2823 | self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.") | |
2824 | self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.") | |
2825 | self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.") | |
2826 | ||
2827 | ss=s.substitute({s:numarray.zeros((4, 5))}) | |
2828 | self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.") | |
2829 | self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape") | |
2830 | try: | |
2831 | s.substitute({s:numarray.zeros((5,))}) | |
2832 | fail("illegal substition was successful") | |
2833 | except TypeError: | |
2834 | pass | |
2835 | ||
2836 | dsdarg=s.diff(Symbol(shape=())) | |
2837 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.") | |
2838 | self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.") | |
2839 | self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.") | |
2840 | dsdarg=s.diff(Symbol(shape=(2,))) | |
2841 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.") | |
2842 | self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.") | |
2843 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.") | |
2844 | dsdarg=s.diff(Symbol(shape=(4, 5))) | |
2845 | self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.") | |
2846 | self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.") | |
2847 | self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.") | |
2848 | ||
2849 | dsds=s.diff(s) | |
2850 | self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.") | |
2851 | self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.") | |
2852 | self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).") | |
2853 | self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).") | |
2854 | self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).") | |
2855 | self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).") | |
2856 | self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).") | |
2857 | self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).") | |
2858 | self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).") | |
2859 | self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).") | |
2860 | self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).") | |
2861 | self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).") | |
2862 | self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).") | |
2863 | self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).") | |
2864 | self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).") | |
2865 | self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).") | |
2866 | self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).") | |
2867 | self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).") | |
2868 | self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).") | |
2869 | self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).") | |
2870 | self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).") | |
2871 | self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).") | |
2872 | self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).") | |
2873 | self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).") | |
2874 | self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (0,1,0,2).") | |
2875 | self.failUnlessEqual(dsds[0,1,0,3],0.0,"ds/ds has wrong value at (0,1,0,3).") | |
2876 | self.failUnlessEqual(dsds[0,1,0,4],0.0,"ds/ds has wrong value at (0,1,0,4).") | |
2877 | self.failUnlessEqual(dsds[0,1,1,0],0.0,"ds/ds has wrong value at (0,1,1,0).") | |
2878 | self.failUnlessEqual(dsds[0,1,1,1],0.0,"ds/ds has wrong value at (0,1,1,1).") | |
2879 | self.failUnlessEqual(dsds[0,1,1,2],0.0,"ds/ds has wrong value at (0,1,1,2).") | |
2880 | self.failUnlessEqual(dsds[0,1,1,3],0.0,"ds/ds has wrong value at (0,1,1,3).") | |
2881 | self.failUnlessEqual(dsds[0,1,1,4],0.0,"ds/ds has wrong value at (0,1,1,4).") | |
2882 | self.failUnlessEqual(dsds[0,1,2,0],0.0,"ds/ds has wrong value at (0,1,2,0).") | |
2883 | self.failUnlessEqual(dsds[0,1,2,1],0.0,"ds/ds has wrong value at (0,1,2,1).") | |
2884 | self.failUnlessEqual(dsds[0,1,2,2],0.0,"ds/ds has wrong value at (0,1,2,2).") | |
2885 | self.failUnlessEqual(dsds[0,1,2,3],0.0,"ds/ds has wrong value at (0,1,2,3).") | |
2886 | self.failUnlessEqual(dsds[0,1,2,4],0.0,"ds/ds has wrong value at (0,1,2,4).") | |
2887 | self.failUnlessEqual(dsds[0,1,3,0],0.0,"ds/ds has wrong value at (0,1,3,0).") | |
2888 | self.failUnlessEqual(dsds[0,1,3,1],0.0,"ds/ds has wrong value at (0,1,3,1).") | |
2889 | self.failUnlessEqual(dsds[0,1,3,2],0.0,"ds/ds has wrong value at (0,1,3,2).") | |
2890 | self.failUnlessEqual(dsds[0,1,3,3],0.0,"ds/ds has wrong value at (0,1,3,3).") | |
2891 | self.failUnlessEqual(dsds[0,1,3,4],0.0,"ds/ds has wrong value at (0,1,3,4).") | |
2892 | self.failUnlessEqual(dsds[0,2,0,0],0.0,"ds/ds has wrong value at (0,2,0,0).") | |
2893 | self.failUnlessEqual(dsds[0,2,0,1],0.0,"ds/ds has wrong value at (0,2,0,1).") | |
2894 | self.failUnlessEqual(dsds[0,2,0,2],1.0,"ds/ds has wrong value at (0,2,0,2).") | |
2895 | self.failUnlessEqual(dsds[0,2,0,3],0.0,"ds/ds has wrong value at (0,2,0,3).") | |
2896 | self.failUnlessEqual(dsds[0,2,0,4],0.0,"ds/ds has wrong value at (0,2,0,4).") | |
2897 | self.failUnlessEqual(dsds[0,2,1,0],0.0,"ds/ds has wrong value at (0,2,1,0).") | |
2898 | self.failUnlessEqual(dsds[0,2,1,1],0.0,"ds/ds has wrong value at (0,2,1,1).") | |
2899 | self.failUnlessEqual(dsds[0,2,1,2],0.0,"ds/ds has wrong value at (0,2,1,2).") | |
2900 | self.failUnlessEqual(dsds[0,2,1,3],0.0,"ds/ds has wrong value at (0,2,1,3).") | |
2901 | self.failUnlessEqual(dsds[0,2,1,4],0.0,"ds/ds has wrong value at (0,2,1,4).") | |
2902 | self.failUnlessEqual(dsds[0,2,2,0],0.0,"ds/ds has wrong value at (0,2,2,0).") | |
2903 | self.failUnlessEqual(dsds[0,2,2,1],0.0,"ds/ds has wrong value at (0,2,2,1).") | |
2904 | self.failUnlessEqual(dsds[0,2,2,2],0.0,"ds/ds has wrong value at (0,2,2,2).") | |
2905 | self.failUnlessEqual(dsds[0,2,2,3],0.0,"ds/ds has wrong value at (0,2,2,3).") | |
2906 | self.failUnlessEqual(dsds[0,2,2,4],0.0,"ds/ds has wrong value at (0,2,2,4).") | |
2907 | self.failUnlessEqual(dsds[0,2,3,0],0.0,"ds/ds has wrong value at (0,2,3,0).") | |
2908 | self.failUnlessEqual(dsds[0,2,3,1],0.0,"ds/ds has wrong value at (0,2,3,1).") | |
2909 | self.failUnlessEqual(dsds[0,2,3,2],0.0,"ds/ds has wrong value at (0,2,3,2).") | |
2910 | self.failUnlessEqual(dsds[0,2,3,3],0.0,"ds/ds has wrong value at (0,2,3,3).") | |
2911 | self.failUnlessEqual(dsds[0,2,3,4],0.0,"ds/ds has wrong value at (0,2,3,4).") | |
2912 | self.failUnlessEqual(dsds[0,3,0,0],0.0,"ds/ds has wrong value at (0,3,0,0).") | |
2913 | self.failUnlessEqual(dsds[0,3,0,1],0.0,"ds/ds has wrong value at (0,3,0,1).") | |
2914 | self.failUnlessEqual(dsds[0,3,0,2],0.0,"ds/ds has wrong value at (0,3,0,2).") | |
2915 | self.failUnlessEqual(dsds[0,3,0,3],1.0,"ds/ds has wrong value at (0,3,0,3).") | |
2916 | self.failUnlessEqual(dsds[0,3,0,4],0.0,"ds/ds has wrong value at (0,3,0,4).") | |
2917 | self.failUnlessEqual(dsds[0,3,1,0],0.0,"ds/ds has wrong value at (0,3,1,0).") | |
2918 | self.failUnlessEqual(dsds[0,3,1,1],0.0,"ds/ds has wrong value at (0,3,1,1).") | |
2919 | self.failUnlessEqual(dsds[0,3,1,2],0.0,"ds/ds has wrong value at (0,3,1,2).") | |
2920 | self.failUnlessEqual(dsds[0,3,1,3],0.0,"ds/ds has wrong value at (0,3,1,3).") | |
2921 | self.failUnlessEqual(dsds[0,3,1,4],0.0,"ds/ds has wrong value at (0,3,1,4).") | |
2922 | self.failUnlessEqual(dsds[0,3,2,0],0.0,"ds/ds has wrong value at (0,3,2,0).") | |
2923 | self.failUnlessEqual(dsds[0,3,2,1],0.0,"ds/ds has wrong value at (0,3,2,1).") | |
2924 | self.failUnlessEqual(dsds[0,3,2,2],0.0,"ds/ds has wrong value at (0,3,2,2).") | |
2925 | self.failUnlessEqual(dsds[0,3,2,3],0.0,"ds/ds has wrong value at (0,3,2,3).") | |
2926 | self.failUnlessEqual(dsds[0,3,2,4],0.0,"ds/ds has wrong value at (0,3,2,4).") | |
2927 | self.failUnlessEqual(dsds[0,3,3,0],0.0,"ds/ds has wrong value at (0,3,3,0).") | |
2928 | self.failUnlessEqual(dsds[0,3,3,1],0.0,"ds/ds has wrong value at (0,3,3,1).") | |
2929 | self.failUnlessEqual(dsds[0,3,3,2],0.0,"ds/ds has wrong value at (0,3,3,2).") | |
2930 | self.failUnlessEqual(dsds[0,3,3,3],0.0,"ds/ds has wrong value at (0,3,3,3).") | |
2931 | self.failUnlessEqual(dsds[0,3,3,4],0.0,"ds/ds has wrong value at (0,3,3,4).") | |
2932 | self.failUnlessEqual(dsds[0,4,0,0],0.0,"ds/ds has wrong value at (0,4,0,0).") | |
2933 | self.failUnlessEqual(dsds[0,4,0,1],0.0,"ds/ds has wrong value at (0,4,0,1).") | |
2934 | self.failUnlessEqual(dsds[0,4,0,2],0.0,"ds/ds has wrong value at (0,4,0,2).") | |
2935 | self.failUnlessEqual(dsds[0,4,0,3],0.0,"ds/ds has wrong value at (0,4,0,3).") | |
2936 | self.failUnlessEqual(dsds[0,4,0,4],1.0,"ds/ds has wrong value at (0,4,0,4).") | |
2937 | self.failUnlessEqual(dsds[0,4,1,0],0.0,"ds/ds has wrong value at (0,4,1,0).") | |
2938 | self.failUnlessEqual(dsds[0,4,1,1],0.0,"ds/ds has wrong value at (0,4,1,1).") | |
2939 | self.failUnlessEqual(dsds[0,4,1,2],0.0,"ds/ds has wrong value at (0,4,1,2).") | |
2940 | self.failUnlessEqual(dsds[0,4,1,3],0.0,"ds/ds has wrong value at (0,4,1,3).") | |
2941 | self.failUnlessEqual(dsds[0,4,1,4],0.0,"ds/ds has wrong value at (0,4,1,4).") | |
2942 | self.failUnlessEqual(dsds[0,4,2,0],0.0,"ds/ds has wrong value at (0,4,2,0).") | |
2943 | self.failUnlessEqual(dsds[0,4,2,1],0.0,"ds/ds has wrong value at (0,4,2,1).") | |
2944 | self.failUnlessEqual(dsds[0,4,2,2],0.0,"ds/ds has wrong value at (0,4,2,2).") | |
2945 | self.failUnlessEqual(dsds[0,4,2,3],0.0,"ds/ds has wrong value at (0,4,2,3).") | |
2946 | self.failUnlessEqual(dsds[0,4,2,4],0.0,"ds/ds has wrong value at (0,4,2,4).") | |
2947 | self.failUnlessEqual(dsds[0,4,3,0],0.0,"ds/ds has wrong value at (0,4,3,0).") | |
2948 | self.failUnlessEqual(dsds[0,4,3,1],0.0,"ds/ds has wrong value at (0,4,3,1).") | |
2949 | self.failUnlessEqual(dsds[0,4,3,2],0.0,"ds/ds has wrong value at (0,4,3,2).") | |
2950 | self.failUnlessEqual(dsds[0,4,3,3],0.0,"ds/ds has wrong value at (0,4,3,3).") | |
2951 | self.failUnlessEqual(dsds[0,4,3,4],0.0,"ds/ds has wrong value at (0,4,3,4).") | |
2952 | self.failUnlessEqual(dsds[1,0,0,0],0.0,"ds/ds has wrong value at (1,0,0,0).") | |
2953 | self.failUnlessEqual(dsds[1,0,0,1],0.0,"ds/ds has wrong value at (1,0,0,1).") | |
2954 | self.failUnlessEqual(dsds[1,0,0,2],0.0,"ds/ds has wrong value at (1,0,0,2).") | |
2955 | self.failUnlessEqual(dsds[1,0,0,3],0.0,"ds/ds has wrong value at (1,0,0,3).") | |
2956 | self.failUnlessEqual(dsds[1,0,0,4],0.0,"ds/ds has wrong value at (1,0,0,4).") | |
2957 | self.failUnlessEqual(dsds[1,0,1,0],1.0,"ds/ds has wrong value at (1,0,1,0).") | |
2958 | self.failUnlessEqual(dsds[1,0,1,1],0.0,"ds/ds has wrong value at (1,0,1,1).") | |
2959 | self.failUnlessEqual(dsds[1,0,1,2],0.0,"ds/ds has wrong value at (1,0,1,2).") | |
2960 | self.failUnlessEqual(dsds[1,0,1,3],0.0,"ds/ds has wrong value at (1,0,1,3).") | |
2961 | self.failUnlessEqual(dsds[1,0,1,4],0.0,"ds/ds has wrong value at (1,0,1,4).") | |
2962 | self.failUnlessEqual(dsds[1,0,2,0],0.0,"ds/ds has wrong value at (1,0,2,0).") | |
2963 | self.failUnlessEqual(dsds[1,0,2,1],0.0,"ds/ds has wrong value at (1,0,2,1).") | |
2964 | self.failUnlessEqual(dsds[1,0,2,2],0.0,"ds/ds has wrong value at (1,0,2,2).") | |
2965 | self.failUnlessEqual(dsds[1,0,2,3],0.0,"ds/ds has wrong value at (1,0,2,3).") | |
2966 | self.failUnlessEqual(dsds[1,0,2,4],0.0,"ds/ds has wrong value at (1,0,2,4).") | |
2967 | self.failUnlessEqual(dsds[1,0,3,0],0.0,"ds/ds has wrong value at (1,0,3,0).") | |
2968 | self.failUnlessEqual(dsds[1,0,3,1],0.0,"ds/ds has wrong value at (1,0,3,1).") | |
2969 | self.failUnlessEqual(dsds[1,0,3,2],0.0,"ds/ds has wrong value at (1,0,3,2).") | |
2970 | self.failUnlessEqual(dsds[1,0,3,3],0.0,"ds/ds has wrong value at (1,0,3,3).") | |
2971 | self.failUnlessEqual(dsds[1,0,3,4],0.0,"ds/ds has wrong value at (1,0,3,4).") | |
2972 | self.failUnlessEqual(dsds[1,1,0,0],0.0,"ds/ds has wrong value at (1,1,0,0).") | |
2973 | self.failUnlessEqual(dsds[1,1,0,1],0.0,"ds/ds has wrong value at (1,1,0,1).") | |
2974 | self.failUnlessEqual(dsds[1,1,0,2],0.0,"ds/ds has wrong value at (1,1,0,2).") | |
2975 | self.failUnlessEqual(dsds[1,1,0,3],0.0,"ds/ds has wrong value at (1,1,0,3).") | |
2976 | self.failUnlessEqual(dsds[1,1,0,4],0.0,"ds/ds has wrong value at (1,1,0,4).") | |
2977 | self.failUnlessEqual(dsds[1,1,1,0],0.0,"ds/ds has wrong value at (1,1,1,0).") | |
2978 | self.failUnlessEqual(dsds[1,1,1,1],1.0,"ds/ds has wrong value at (1,1,1,1).") | |
2979 | self.failUnlessEqual(dsds[1,1,1,2],0.0,"ds/ds has wrong value at (1,1,1,2).") | |
2980 | self.failUnlessEqual(dsds[1,1,1,3],0.0,"ds/ds has wrong value at (1,1,1,3).") | |
2981 | self.failUnlessEqual(dsds[1,1,1,4],0.0,"ds/ds has wrong value at (1,1,1,4).") | |
2982 | self.failUnlessEqual(dsds[1,1,2,0],0.0,"ds/ds has wrong value at (1,1,2,0).") | |
2983 | self.failUnlessEqual(dsds[1,1,2,1],0.0,"ds/ds has wrong value at (1,1,2,1).") | |
2984 | self.failUnlessEqual(dsds[1,1,2,2],0.0,"ds/ds has wrong value at (1,1,2,2).") | |
2985 | self.failUnlessEqual(dsds[1,1,2,3],0.0,"ds/ds has wrong value at (1,1,2,3).") | |
2986 | self.failUnlessEqual(dsds[1,1,2,4],0.0,"ds/ds has wrong value at (1,1,2,4).") | |
2987 | self.failUnlessEqual(dsds[1,1,3,0],0.0,"ds/ds has wrong value at (1,1,3,0).") | |
2988 | self.failUnlessEqual(dsds[1,1,3,1],0.0,"ds/ds has wrong value at (1,1,3,1).") | |
2989 | self.failUnlessEqual(dsds[1,1,3,2],0.0,"ds/ds has wrong value at (1,1,3,2).") | |
2990 | self.failUnlessEqual(dsds[1,1,3,3],0.0,"ds/ds has wrong value at (1,1,3,3).") | |