- Timestamp:
- Apr 24, 2009, 5:22:14 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/numpy/anuga/abstract_2d_finite_volumes/test_domain.py
r6553 r6902 397 397 398 398 def test_setting_timestepping_method(self): 399 """test_set _quanitities_to_be_monitored399 """test_setting_timestepping_method 400 400 """ 401 401 … … 803 803 [ 11.0, 11.0, 11.0]]) 804 804 805 def test_rectangular_periodic_and_ghosts(self): 806 807 from mesh_factory import rectangular_periodic 808 809 810 M=5 811 N=2 812 points, vertices, boundary, full_send_dict, ghost_recv_dict = rectangular_periodic(M, N) 813 814 assert num.allclose(ghost_recv_dict[0][0], [24, 25, 26, 27, 0, 1, 2, 3]) 815 assert num.allclose(full_send_dict[0][0] , [ 4, 5, 6, 7, 20, 21, 22, 23]) 816 817 #print 'HERE' 818 819 conserved_quantities = ['quant1', 'quant2'] 820 domain = Domain(points, vertices, boundary, conserved_quantities, 821 full_send_dict=full_send_dict, 822 ghost_recv_dict=ghost_recv_dict) 823 824 825 826 827 assert num.allclose(ghost_recv_dict[0][0], [24, 25, 26, 27, 0, 1, 2, 3]) 828 assert num.allclose(full_send_dict[0][0] , [ 4, 5, 6, 7, 20, 21, 22, 23]) 829 830 def xylocation(x,y): 831 return 15*x + 9*y 832 833 834 domain.set_quantity('quant1',xylocation,location='centroids') 835 domain.set_quantity('quant2',xylocation,location='centroids') 836 837 838 assert num.allclose(domain.quantities['quant1'].centroid_values, 839 [ 0.5, 1., 5., 5.5, 3.5, 4., 8., 8.5, 6.5, 7., 11., 11.5, 9.5, 840 10., 14., 14.5, 12.5, 13., 17., 17.5, 15.5, 16., 20., 20.5, 841 18.5, 19., 23., 23.5]) 842 843 844 845 assert num.allclose(domain.quantities['quant2'].centroid_values, 846 [ 0.5, 1., 5., 5.5, 3.5, 4., 8., 8.5, 6.5, 7., 11., 11.5, 9.5, 847 10., 14., 14.5, 12.5, 13., 17., 17.5, 15.5, 16., 20., 20.5, 848 18.5, 19., 23., 23.5]) 849 850 domain.update_ghosts() 851 852 853 assert num.allclose(domain.quantities['quant1'].centroid_values, 854 [ 15.5, 16., 20., 20.5, 3.5, 4., 8., 8.5, 6.5, 7., 11., 11.5, 9.5, 855 10., 14., 14.5, 12.5, 13., 17., 17.5, 15.5, 16., 20., 20.5, 856 3.5, 4., 8., 8.5]) 857 858 859 860 assert num.allclose(domain.quantities['quant2'].centroid_values, 861 [ 15.5, 16., 20., 20.5, 3.5, 4., 8., 8.5, 6.5, 7., 11., 11.5, 9.5, 862 10., 14., 14.5, 12.5, 13., 17., 17.5, 15.5, 16., 20., 20.5, 863 3.5, 4., 8., 8.5]) 864 865 866 assert num.allclose(domain.tri_full_flag, [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 867 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0]) 868 869 #Test that points are arranged in a counter clock wise order 870 domain.check_integrity() 871 872 805 873 def test_that_mesh_methods_exist(self): 806 874 """test_that_mesh_methods_exist … … 828 896 domain.get_number_of_nodes() 829 897 domain.get_normal(0,0) 898 domain.get_triangle_containing_point([0.4,0.5]) 830 899 domain.get_intersecting_segments([[0.0, 0.0], [0.0, 1.0]]) 831 900 domain.get_disconnected_triangles()
Note: See TracChangeset
for help on using the changeset viewer.