Changeset 4425
- Timestamp:
- May 3, 2007, 6:23:44 PM (18 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/caching/caching.py
r4333 r4425 282 282 # Force singletons into a tuple. 283 283 # 284 284 285 if dependencies and type(dependencies) != types.TupleType \ 285 286 and type(dependencies) != types.ListType: … … 817 818 (argsfile,compressed1) = myopen(CD+FN+'_'+file_types[1],"rb",compression) 818 819 (admfile,compressed2) = myopen(CD+FN+'_'+file_types[2],"rb",compression) 820 821 if verbose is True and deps is not None: 822 print 'Caching: Dependencies are', deps.keys() 819 823 820 824 if not (argsfile and datafile and admfile) or \ … … 1504 1508 import types 1505 1509 1510 #print 'Caching DEBUG: Dependencies are', dependencies 1506 1511 d = {} 1507 1512 if dependencies: … … 1512 1517 for FN in dependencies: 1513 1518 expanded_FN = glob.glob(FN) 1514 1519 1520 if expanded_FN == []: 1521 errmsg = 'ERROR (caching.py): Dependency '+FN+' does not exist.' 1522 raise Exception, errmsg 1523 1515 1524 expanded_dependencies += expanded_FN 1516 1525 … … 1519 1528 if not type(FN) == types.StringType: 1520 1529 errmsg = 'ERROR (caching.py): Dependency must be a string.\n' 1521 errmsg += ' 1530 errmsg += ' Dependency given: %s' %FN 1522 1531 raise Exception, errmsg 1523 1532 if not os.access(FN,os.F_OK): -
anuga_core/source/anuga/fit_interpolate/fit.py
r4269 r4425 433 433 attribute_name=None, 434 434 use_cache = False): 435 """Wrapper around internal function _fit_to_mesh for use with caching. 436 437 """ 438 435 439 args = (vertex_coordinates, triangles, point_coordinates, ) 436 440 kwargs = {'point_attributes': point_attributes, … … 444 448 'use_cache':use_cache 445 449 } 450 446 451 if use_cache is True: 452 if isinstance(point_coordinates, basestring): 453 # We assume that point_coordinates is the name of a .csv/.txt 454 # file which must be passed onto caching as a dependency (in case it 455 # has changed on disk) 456 dep = [point_coordinates] 457 else: 458 dep = None 459 447 460 return cache(_fit_to_mesh, 448 461 args, kwargs, 449 462 verbose=verbose, 450 compression=False) 463 compression=False, 464 dependencies=dep) 451 465 else: 452 466 return apply(_fit_to_mesh,
Note: See TracChangeset
for help on using the changeset viewer.