 Timestamp:
 Sep 5, 2007, 4:42:58 PM (16 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py
r4679 r4704 16 16 17 17 from Numeric import array, zeros, Float, less, concatenate, NewAxis,\ 18 argmax, a llclose, take, reshape18 argmax, argmin, allclose, take, reshape 19 19 20 20 from anuga.utilities.numerical_tools import ensure_numeric, is_scalar … … 799 799 800 800 801 def get_maximum_index(self, indices=None): 802 """Return index for maximum value of quantity (on centroids) 803 804 Optional argument: 801 def get_extremum_index(self, mode=None, indices=None): 802 """Return index for maximum or minimum value of quantity (on centroids) 803 804 Optional arguments: 805 mode is either 'max'(default) or 'min'. 805 806 indices is the set of element ids that the operation applies to. 806 807 807 808 Usage: 808 i = get_ maximum_index()809 i = get_extreme_index() 809 810 810 811 Notes: 811 We do not seek the maximum at vertices as each vertex can812 We do not seek the extremum at vertices as each vertex can 812 813 have multiple values  one for each triangle sharing it. 813 814 … … 819 820 820 821 # Always return absolute indices 821 i = argmax(V) 822 822 if mode is None or mode == 'max': 823 i = argmax(V) 824 elif mode == 'min': 825 i = argmin(V) 826 827 823 828 if indices is None: 824 829 return i … … 826 831 return indices[i] 827 832 833 834 def get_maximum_index(self, indices=None): 835 """See get extreme index for details 836 """ 837 838 return self.get_extremum_index(mode='max', 839 indices=indices) 840 841 828 842 829 843 def get_maximum_value(self, indices=None): … … 866 880 867 881 i = self.get_maximum_index(indices) 882 x, y = self.domain.get_centroid_coordinates()[i] 883 884 return x, y 885 886 887 def get_minimum_index(self, indices=None): 888 """See get extreme index for details 889 """ 890 891 return self.get_extremum_index(mode='min', 892 indices=indices) 893 894 895 def get_minimum_value(self, indices=None): 896 """Return minimum value of quantity (on centroids) 897 898 Optional argument: 899 indices is the set of element ids that the operation applies to. 900 901 Usage: 902 v = get_minimum_value() 903 904 See get_maximum_value for more details. 905 """ 906 907 908 i = self.get_minimum_index(indices) 909 V = self.get_values(location='centroids') 910 911 return V[i] 912 913 914 def get_minimum_location(self, indices=None): 915 """Return location of minimum value of quantity (on centroids) 916 917 Optional argument: 918 indices is the set of element ids that the operation applies to. 919 920 Usage: 921 x, y = get_minimum_location() 922 923 924 Notes: 925 We do not seek the maximum at vertices as each vertex can 926 have multiple values  one for each triangle sharing it. 927 928 If there are multiple cells with same maximum value, the 929 first cell encountered in the triangle array is returned. 930 """ 931 932 i = self.get_minimum_index(indices) 868 933 x, y = self.domain.get_centroid_coordinates()[i] 869 934
Note: See TracChangeset
for help on using the changeset viewer.