Ignore:
Timestamp:
Apr 6, 2010, 8:23:54 PM (15 years ago)
Author:
James Hudson
Message:

Ticket 113 is complete, and all tests pass.
A centroid list is built by Interpolation_function as it calculates the interpolation matrix, and this is passed out as extra quantities which are output into the gauge.csv file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/fit_interpolate/interpolate.py

    r7673 r7675  
    218218
    219219
    220 
    221220    ##
    222221    # @brief Interpolate mesh data f to determine values, z, at points.
     
    383382
    384383        # Unpack result
    385         self._A, self.inside_poly_indices, self.outside_poly_indices = X
     384        self._A, self.inside_poly_indices, self.outside_poly_indices, self.centroids = X
    386385
    387386        # Check that input dimensions are compatible
     
    436435        #                         point.
    437436    # @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.
    439439    def _build_interpolation_matrix_A(self,
    440440                                      point_coordinates,
     
    487487        n = len(inside_poly_indices)
    488488
     489        centroids = []
     490               
    489491        # Compute matrix elements for points inside the mesh
    490492        if verbose: log.critical('Building interpolation matrix from %d points'
     
    516518                                    # If centroids are needed, weight all 3 vertices equally
    517519                    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])                                         
    519522            else:
    520523                msg = 'Could not find triangle for point', x
    521524                raise Exception(msg)
    522         return A, inside_poly_indices, outside_poly_indices
     525        return A, inside_poly_indices, outside_poly_indices, centroids
    523526
    524527
     
    841844        self.index = 0    # Initial time index
    842845        self.precomputed_values = {}
     846        self.centroids = []
    843847
    844848        # Precomputed spatial interpolation if requested
     
    994998                                                      self.interpolation_points,
    995999                                                      verbose=False,
    996                                                                                                           output_centroids=output_centroids)
     1000                                                      output_centroids=output_centroids)
     1001                        self.centroids = interpol.centroids                                                                                                               
    9971002                    elif triangles is None and vertex_coordinates is not None:
    9981003                        result = interpolate_polyline(Q,
     
    10031008
    10041009                    #assert len(result), len(interpolation_points)
    1005                     self.precomputed_values[name][i, :] = result
    1006 
     1010                    self.precomputed_values[name][i, :] = result                                                                       
     1011                                       
    10071012            # Report
    10081013            if verbose:
    1009                 log.critical(self.statistics())
     1014                log.critical(self.statistics())                 
    10101015        else:
    10111016            # Store quantitites as is
Note: See TracChangeset for help on using the changeset viewer.