1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | import unittest |
---|
4 | from math import sqrt |
---|
5 | |
---|
6 | from anuga.abstract_2d_finite_volumes.domain import * |
---|
7 | from anuga.config import epsilon |
---|
8 | |
---|
9 | import numpy as num |
---|
10 | |
---|
11 | |
---|
12 | class Test_Domain(unittest.TestCase): |
---|
13 | def setUp(self): |
---|
14 | pass |
---|
15 | |
---|
16 | |
---|
17 | def tearDown(self): |
---|
18 | pass |
---|
19 | |
---|
20 | |
---|
21 | def test_simple(self): |
---|
22 | a = [0.0, 0.0] |
---|
23 | b = [0.0, 2.0] |
---|
24 | c = [2.0,0.0] |
---|
25 | d = [0.0, 4.0] |
---|
26 | e = [2.0, 2.0] |
---|
27 | f = [4.0,0.0] |
---|
28 | |
---|
29 | points = [a, b, c, d, e, f] |
---|
30 | #bac, bce, ecf, dbe, daf, dae |
---|
31 | vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]] |
---|
32 | |
---|
33 | conserved_quantities = ['stage', 'xmomentum', 'ymomentum'] |
---|
34 | other_quantities = ['elevation', 'friction'] |
---|
35 | |
---|
36 | domain = Domain(points, vertices, None, |
---|
37 | conserved_quantities, other_quantities) |
---|
38 | domain.check_integrity() |
---|
39 | |
---|
40 | for name in conserved_quantities + other_quantities: |
---|
41 | assert domain.quantities.has_key(name) |
---|
42 | |
---|
43 | |
---|
44 | assert num.alltrue(domain.get_conserved_quantities(0, edge=1) == 0.) |
---|
45 | |
---|
46 | |
---|
47 | #------------------------------------------------------------- |
---|
48 | |
---|
49 | if __name__ == "__main__": |
---|
50 | suite = unittest.makeSuite(Test_Domain,'test') |
---|
51 | runner = unittest.TextTestRunner() |
---|
52 | runner.run(suite) |
---|