source: anuga_core/source_numpy_conversion/anuga/abstract_2d_finite_volumes/test_ghost.py @ 5899

Last change on this file since 5899 was 5899, checked in by rwilson, 15 years ago

Initial NumPy? changes (again!).

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