Changeset 5868
- Timestamp:
- Oct 27, 2008, 5:55:58 PM (16 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/culvert_flows/Test_Culvert_Flat_Water_Lev.py
r5864 r5868 165 165 166 166 167 import sys; sys.exit()167 #import sys; sys.exit() 168 168 # Profiling code 169 169 import time -
anuga_core/source/anuga/fit_interpolate/interpolate.py
r5864 r5868 109 109 110 110 """ 111 111 112 # FIXME(Ole): Probably obsolete since I is precomputed and interpolate_block caches 113 112 114 from anuga.caching import cache 113 115 … … 175 177 176 178 # Initialise variabels 177 self._A_can_be_reused = False 178 self._point_coordinates = None 179 self._A_can_be_reused = False # FIXME (Ole): Probably obsolete 180 self._point_coordinates = None # FIXME (Ole): Probably obsolete 181 self.interpolation_matrices = {} # Store precomputed matrices 179 182 180 183 FitInterpolate.__init__(self, … … 301 304 # This really should use some kind of caching in cases where 302 305 # interpolation points are reused. 306 # 307 # This has now been addressed through an attempt in interpolate_block 303 308 304 309 #print "point_coordinates interpolate.interpolate", point_coordinates … … 373 378 See interpolate for doc info. 374 379 """ 380 381 # FIXME (Ole): I reckon we should change the interface so that 382 # the user can specify the interpolation matrix instead of the 383 # interpolation points to save time. 384 385 375 386 if isinstance(point_coordinates, Geospatial_data): 376 387 point_coordinates = point_coordinates.get_data_points(\ … … 379 390 # Convert lists to Numeric arrays if necessary 380 391 point_coordinates = ensure_numeric(point_coordinates, Float) 381 f = ensure_numeric(f, Float) 382 383 import sys 384 if use_cache is True and sys.platform != 'win32': 385 # FIXME (Ole): (Why doesn't this work on windoze?) 386 387 X = cache(self._build_interpolation_matrix_A, 388 args=(point_coordinates,), 389 kwargs={'verbose': verbose}, 390 verbose=verbose) 391 else: 392 f = ensure_numeric(f, Float) 393 394 395 # Hash point_coordinates to memory location and reuse if possible 396 from anuga.caching import myhash 397 from Numeric import alltrue 398 399 400 key = myhash(point_coordinates) 401 402 reuse_A = False 403 if self.interpolation_matrices.has_key(key): 404 X, stored_points = self.interpolation_matrices[key] 405 if alltrue(stored_points == point_coordinates): 406 reuse_A = True # Reuse interpolation matrix 407 408 if reuse_A is False: 392 409 X = self._build_interpolation_matrix_A(point_coordinates, 393 verbose=verbose) 410 verbose=verbose) 411 self.interpolation_matrices[key] = (X, point_coordinates) 412 394 413 395 414 # Unpack result … … 412 431 assert self._A.shape[1] == f.shape[0], msg 413 432 433 414 434 # Compute Matrix vector product and return 415 435 return self._get_point_data_z(f)
Note: See TracChangeset
for help on using the changeset viewer.