Changeset 4278
- Timestamp:
- Feb 23, 2007, 3:48:22 PM (18 years ago)
- Location:
- anuga_core/source/anuga/abstract_2d_finite_volumes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py
r4170 r4278 960 960 domain.starttime = start 961 961 F = file_function(filename + '.tms', domain, 962 quantities = ['Attribute0', 'Attribute1', 'Attribute2'] )963 964 965 #print F.T 962 quantities = ['Attribute0', 'Attribute1', 'Attribute2'], 963 use_cache=True) 964 965 966 966 #print F.precomputed_values 967 967 #print 'F(60)', F(60) -
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r4274 r4278 70 70 'interpolation_points': interpolation_points, 71 71 'time_thinning': time_thinning, 72 'verbose': verbose} 73 74 75 # Call underlying engine with or without caching 76 if use_cache is True: 77 try: 78 from caching import cache 79 except: 80 msg = 'Caching was requested, but caching module'+\ 81 'could not be imported' 82 raise msg 83 84 f = cache(_file_function, 85 args, kwargs, 86 dependencies=[filename], 87 compression=False, 88 verbose=verbose) 89 90 else: 91 f = apply(_file_function, 72 'verbose': verbose, 73 'use_cache': use_cache 74 } 75 76 #caching moved to deeper within the function to avoid caching an 77 #instance of an object, which isn't generally good. 78 f = apply(_file_function, 92 79 args, kwargs) 93 80 … … 105 92 quantities=None, 106 93 interpolation_points=None, 107 time_thinning=1, 108 verbose=False): 94 time_thinning=1, 95 verbose=False, 96 use_cache=False): 109 97 """Internal function 110 98 … … 146 134 interpolation_points, 147 135 time_thinning=time_thinning, 148 verbose=verbose) 136 verbose=verbose, 137 use_cache=use_cache) 149 138 else: 150 139 raise 'Must be a NetCDF File' … … 157 146 interpolation_points=None, 158 147 time_thinning=1, 159 verbose=False): 148 verbose=False, 149 use_cache=False): 160 150 """Read time history of spatial data from NetCDF sww file and 161 151 return a callable object f(t,x,y) … … 325 315 vertex_coordinates = triangles = interpolation_points = None 326 316 327 328 return Interpolation_function(time, 329 quantities, 330 quantity_names, 331 vertex_coordinates, 332 triangles, 333 interpolation_points, 334 time_thinning=time_thinning, 335 verbose=verbose) 336 317 318 319 args = (time, quantities, quantity_names, vertex_coordinates, 320 triangles, interpolation_points, ) 321 322 kwargs = {'time_thinning': time_thinning, 323 'verbose': verbose 324 } 325 # print'CACHING FROM UTIL.py for interpolation_function', use_cache 326 from anuga.caching import myhash 327 if use_cache is True: 328 from caching import cache 329 330 interpolation_function = cache(Interpolation_function, 331 args, kwargs, 332 verbose=verbose, 333 compression=False) 334 else: 335 interpolation_function = apply(Interpolation_function, 336 args, kwargs) 337 # print 'myhash', myhash(interpolation_function) 338 return interpolation_function 337 339 338 340
Note: See TracChangeset
for help on using the changeset viewer.