Changeset 461


Ignore:
Timestamp:
Oct 28, 2004, 4:38:42 PM (20 years ago)
Author:
duncan
Message:

quantity.set_values update

Location:
inundation/ga/storm_surge/pyvolution
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/quantity.py

    r460 r461  
    7979           
    8080           
    81     def set_values(self, X, location='vertices'):
     81    def set_values(self, X, location='vertices', indexes = None):
    8282        """Set values for quantity
    8383
     
    125125        else:
    126126            #Use array specific method
    127             self.set_array_values(X, location)
     127            self.set_array_values(X, location, indexes = indexes)
    128128
    129129        if location == 'vertices':
     
    161161                  Permissible options are: vertices, edges, centroid
    162162                  Default is "vertices"
    163 
     163       
     164        indexes - if this action is carried out on a subset of elements
     165        The element indexes are specified here.
     166       
    164167        In case of location == 'centroid' the dimension values must
    165168        be a list of a Numerical array of length N, N being the number
  • inundation/ga/storm_surge/pyvolution/test_quantity.py

    r459 r461  
    656656        value = [7]
    657657        indexes = [1]
    658         quantity.set_array_values(value,
     658        quantity.set_values(value,
    659659                                  location = 'centroids',
    660660                                  indexes = indexes)
     
    663663       
    664664        value = [[15,20,25]]
    665         quantity.set_array_values(value, indexes = indexes)
     665        quantity.set_values(value, indexes = indexes)
    666666        #print "1 quantity.vertex_values",quantity.vertex_values
    667667        assert allclose(quantity.vertex_values[1], value[0])
    668668
    669669        values = [10,100,50]
    670         quantity.set_array_values(values, indexes = [0,1,5])
     670        quantity.set_values(values, indexes = [0,1,5])
    671671        #print "2 quantity.vertex_values",quantity.vertex_values
    672672        assert allclose(quantity.vertex_values[0], [10,10,10])
     
    677677       
    678678        values = [[31,30,29],[400,400,400],[1000,999,998]]
    679         quantity.set_array_values(values, indexes = [3,3,5])
     679        quantity.set_values(values, indexes = [3,3,5])
    680680        quantity.interpolate()
    681681        assert allclose(quantity.centroid_values, [10,100,3,400,5,999])
Note: See TracChangeset for help on using the changeset viewer.