Changeset 7675 for anuga_core/source/anuga/fit_interpolate/interpolate.py
- Timestamp:
- Apr 6, 2010, 8:23:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/fit_interpolate/interpolate.py
r7673 r7675 218 218 219 219 220 221 220 ## 222 221 # @brief Interpolate mesh data f to determine values, z, at points. … … 383 382 384 383 # Unpack result 385 self._A, self.inside_poly_indices, self.outside_poly_indices = X384 self._A, self.inside_poly_indices, self.outside_poly_indices, self.centroids = X 386 385 387 386 # Check that input dimensions are compatible … … 436 435 # point. 437 436 # @param verbose True if this function is to be verbose. 438 # @return Interpolation matrix A, plus lists of the points inside and outside the mesh. 437 # @return Interpolation matrix A, plus lists of the points inside and outside the mesh 438 # and the list of centroids, if requested. 439 439 def _build_interpolation_matrix_A(self, 440 440 point_coordinates, … … 487 487 n = len(inside_poly_indices) 488 488 489 centroids = [] 490 489 491 # Compute matrix elements for points inside the mesh 490 492 if verbose: log.critical('Building interpolation matrix from %d points' … … 516 518 # If centroids are needed, weight all 3 vertices equally 517 519 for j in js: 518 A[i, j] = 1.0/3.0 520 A[i, j] = 1.0/3.0 521 centroids.append(self.mesh.centroid_coordinates[k]) 519 522 else: 520 523 msg = 'Could not find triangle for point', x 521 524 raise Exception(msg) 522 return A, inside_poly_indices, outside_poly_indices 525 return A, inside_poly_indices, outside_poly_indices, centroids 523 526 524 527 … … 841 844 self.index = 0 # Initial time index 842 845 self.precomputed_values = {} 846 self.centroids = [] 843 847 844 848 # Precomputed spatial interpolation if requested … … 994 998 self.interpolation_points, 995 999 verbose=False, 996 output_centroids=output_centroids) 1000 output_centroids=output_centroids) 1001 self.centroids = interpol.centroids 997 1002 elif triangles is None and vertex_coordinates is not None: 998 1003 result = interpolate_polyline(Q, … … 1003 1008 1004 1009 #assert len(result), len(interpolation_points) 1005 self.precomputed_values[name][i, :] = result 1006 1010 self.precomputed_values[name][i, :] = result 1011 1007 1012 # Report 1008 1013 if verbose: 1009 log.critical(self.statistics()) 1014 log.critical(self.statistics()) 1010 1015 else: 1011 1016 # Store quantitites as is
Note: See TracChangeset
for help on using the changeset viewer.