Ignore:
Timestamp:
Aug 24, 2005, 1:49:47 PM (19 years ago)
Author:
ole
Message:

Embedded caching functionality within quantity.set_values and modified validation example lwru2.py to illustrate the advantages that can be gained from supervised caching.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/validation/LWRU2/lwru2.py

    r1747 r1753  
    1111
    1212
    13 read_mesh = True  #Use large unstructured mesh generated from create_mesh.py
    14 #read_mesh = False  #Use small structured mesh
     13#read_mesh = True  #Use large unstructured mesh generated from create_mesh.py
     14read_mesh = False  #Use small structured mesh
    1515
    1616import sys
     
    128128domain.filename, _ = os.path.splitext(base)
    129129
    130 #LS code to be included in set_quantity
    131 print 'Reading points'
    132 from pyvolution import util, least_squares
    133 #points, attributes = util.read_xya(filenames.bathymetry_filename[:-4] + '.pts')
    134 points, attributes = cache(util.read_xya,
    135                            filenames.bathymetry_filename[:-4] + '.pts')
     130print 'Initial values'
    136131
    137 elevation = attributes['elevation']
    138 
    139 #Fit attributes to mesh
    140 #vertex_attributes = least_squares.fit_to_mesh(domain.coordinates,
    141 #                                              domain.triangles,
    142 #                                              points,
    143 #                                              attributes['elevation'],
    144 #                                              alpha = 0.0001,
    145 #                                              verbose=True)
    146 
    147 vertex_attributes = cache(least_squares.fit_to_mesh,
    148                           (domain.coordinates, domain.triangles,
    149                            points, elevation) ,
    150                           {'alpha': 0.0001, 'verbose': True})
    151 
    152 print 'Initial values'
    153 domain.set_quantity('elevation', vertex_attributes)
    154 #domain.set_quantity('elevation', points=points, attributes=attributes['elevation'], alpha=0.0001)
     132domain.set_quantity('elevation',
     133                    filename=filenames.bathymetry_filename[:-4] + '.pts',
     134                    alpha = 0.0001,
     135                    verbose = True,
     136                    use_cache = True)
     137                   
    155138domain.set_quantity('friction', 0.0)
    156139domain.set_quantity('stage', 0.0)
Note: See TracChangeset for help on using the changeset viewer.