- Timestamp:
- Dec 10, 2009, 12:43:43 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py
r7573 r7590 1142 1142 1143 1143 1144 The returned values will have the leading dimension equal to length of the indices list or1145 N (all values) if indices is None.1144 The returned values will have the leading dimension equal to 1145 length of the indices list or N (all values) if indices is None. 1146 1146 1147 1147 In case of location == 'centroids' the dimension of returned … … 1157 1157 1158 1158 Indices is the set of element ids that the operation applies to. 1159 If indices is None (or omitted) all elements are returned as 1160 a copy of the relevant array. If performance is critical, 1161 use arrays domain.centroid_values, domain.vertex_values and 1162 domain.edge_values directly. 1159 1163 1160 1164 The values will be stored in elements following their … … 1178 1182 # Edges have already been deprecated in set_values, see changeset:5521, 1179 1183 # but *might* be useful in get_values. Any thoughts anyone? 1180 # YES (Ole): Edge values are necessary for volumetric balance check and inflow boundary. Keep them. 1184 # YES (Ole): Edge values are necessary for volumetric balance 1185 # check and inflow boundary. Keep them! 1181 1186 1182 1187 if location not in ['vertices', 'centroids', … … 1185 1190 raise Exception, msg 1186 1191 1187 import types 1188 1189 msg = "'indices' must be a list, array or None" 1192 1193 msg = '\'indices\' must be a list, array or None' 1190 1194 assert isinstance(indices, (NoneType, list, num.ndarray)), msg 1191 1195 1192 1196 if location == 'centroids': 1193 if (indices == None): 1194 indices = range(len(self)) 1195 return num.take(self.centroid_values, indices, axis=0) 1197 if indices is None: 1198 return self.centroid_values.copy() 1199 else: 1200 return num.take(self.centroid_values, indices, axis=0) 1196 1201 elif location == 'edges': 1197 if (indices == None): 1198 indices = range(len(self)) 1199 return num.take(self.edge_values, indices, axis=0) 1202 if indices is None: 1203 return self.edge_values.copy() 1204 else: 1205 return num.take(self.edge_values, indices, axis=0) 1200 1206 elif location == 'unique vertices': 1201 if (indices == None):1207 if indices is None: 1202 1208 indices=range(self.domain.get_number_of_nodes()) 1203 1209 vert_values = [] … … 1221 1227 return num.array(vert_values, num.float) 1222 1228 else: 1223 if (indices is None): 1224 indices = range(len(self)) 1225 return num.take(self.vertex_values, indices, axis=0) 1229 if indices is None: 1230 return self.vertex_values.copy() 1231 else: 1232 return num.take(self.vertex_values, indices, axis=0) 1226 1233 1227 1234 ##
Note: See TracChangeset
for help on using the changeset viewer.