source: trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/test_ghost.py @ 8050

Last change on this file since 8050 was 7737, checked in by hudson, 14 years ago

Various refactorings, all unit tests pass.
Domain renamed to generic domain.

File size: 1.2 KB
Line 
1#!/usr/bin/env python
2
3import unittest
4from math import sqrt
5
6from anuga.abstract_2d_finite_volumes.generic_domain import Generic_Domain
7from anuga.config import epsilon
8
9import numpy as num
10
11
12class 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 = Generic_Domain(points, vertices, None,
37                        conserved_quantities, None, 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
49if __name__ == "__main__":
50    suite = unittest.makeSuite(Test_Domain,'test')
51    runner = unittest.TextTestRunner()
52    runner.run(suite)
Note: See TracBrowser for help on using the repository browser.