Changeset 3931
- Timestamp:
- Nov 7, 2006, 2:47:20 PM (18 years ago)
- Location:
- anuga_core/source/anuga/abstract_2d_finite_volumes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/generic_boundary_conditions.py
r3847 r3931 185 185 # rather than File_boundary 186 186 187 def __init__(self, filename, domain, verbose = False): 187 def __init__(self, filename, domain, time_thinning=1, 188 use_cache=False, verbose=False): 188 189 import time 189 190 from Numeric import array, zeros, Float … … 240 241 self.F = file_function(filename, domain, 241 242 interpolation_points=self.midpoint_coordinates, 242 verbose=verbose) 243 time_thinning=time_thinning, 244 use_cache=use_cache, 245 verbose=verbose) 243 246 self.domain = domain 244 247 -
anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py
r3563 r3931 1159 1159 if __name__ == "__main__": 1160 1160 suite = unittest.makeSuite(Test_Util,'test') 1161 #suite = unittest.makeSuite(Test_Util,'test_ apply')1161 #suite = unittest.makeSuite(Test_Util,'test_get_version_info') 1162 1162 runner = unittest.TextTestRunner() 1163 1163 runner.run(suite) -
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r3910 r3931 6 6 7 7 import anuga.utilities.polygon 8 import sys 9 10 from os import remove, mkdir, access, F_OK, sep 11 from os.path import exists 8 12 from warnings import warn 13 from shutil import copy 9 14 10 15 from anuga.geospatial_data.geospatial_data import ensure_absolute 11 12 13 16 14 17 def file_function(filename, … … 497 500 498 501 ##################### end of obsolete stuff ? ############ 499 ''' 500 this simply catches the screen output and files it to a file 501 ''' 502 from os import sep 503 504 class Screen_Catcher: 505 502 503 def start_screen_catcher(dirname, myid, numprocs): 504 """Used to store screen output and errors to file, if run on multiple 505 processes eachprocessor will have its own output and error file. 506 """ 507 508 dirname = dirname 509 screen_output_name = dirname + "screen_output_%d_%d.txt" %(myid,numprocs) 510 screen_error_name = dirname + "screen_error_%d_%d.txt" %(myid,numprocs) 511 512 #used to catch screen output to file 513 sys.stdout = screen_catcher(screen_output_name) 514 sys.stderr = screen_catcher(screen_error_name) 515 516 class screen_catcher: 517 """this simply catches the screen output and stores it to file defined by 518 start_screen_catcher (above) 519 """ 520 506 521 def __init__(self, filename): 507 # self.data = ''508 522 self.filename = filename 523 if exists(self.filename)is True: 524 remove(self.filename) 525 print'Old existing file "%s" has been deleted' %(self.filename) 509 526 510 527 def write(self, stuff): 511 528 fid = open(self.filename, 'a') 512 # fid = open(self.filename, 'w')513 # self.data = self.data + stuff514 529 fid.write(stuff) 515 fid.close() 516 530 517 531 def get_version_info(): 518 532 """gets the version number of the SVN … … 1149 1163 1150 1164 return texfile2, elev_output 1165 1166 from os.path import basename 1167 1168 def copy_code_files(dir_name, filename1, filename2): 1169 """Copies "filename1" and "filename2" to "dir_name". Very useful for 1170 information management """ 1171 1172 if access(dir_name,F_OK) == 0: 1173 print 'Make directory %s' %dir_name 1174 mkdir (dir_name,0777) 1175 copy(filename1, dir_name + sep + basename(filename1)) 1176 copy(filename2, dir_name + sep + basename(filename2)) 1177 # copy (__file__, project.output_run_time_dir + basename(__file__)) 1178 print 'Files %s and %s copied' %(filename1, filename2) 1179 1180 1181 1182 1183
Note: See TracChangeset
for help on using the changeset viewer.