Changeset 4160
- Timestamp:
- Jan 10, 2007, 2:23:45 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
r4159 r4160 114 114 import time 115 115 116 117 118 116 #Create sww file of simple propagation from left to right 117 #through rectangular domain 118 from shallow_water import Domain, Dirichlet_boundary 119 119 from mesh_factory import rectangular 120 120 from Numeric import take, concatenate, reshape … … 130 130 131 131 domain1.default_order = 2 132 132 domain1.store = True 133 133 domain1.set_datadir('.') 134 134 domain1.set_name('spatio_temporal_boundary_source_%d' %(id(self))) … … 148 148 finaltime = 8 149 149 #Evolution 150 150 t0 = -1 151 151 for t in domain1.evolve(yieldstep = 0.1, finaltime = finaltime): 152 152 #print 'Timesteps: %.16f, %.16f' %(t0, t) 153 153 #if t == t0: 154 154 # msg = 'Duplicate timestep found: %f, %f' %(t0, t) 155 #raise msg156 157 155 # raise msg 156 t0 = t 157 158 158 #domain1.write_time() 159 159 … … 201 201 msg = 'duplicate timesteps: %.16f and %.16f' %(T[-1], T[-2]) 202 202 assert not T[-1] == T[-2], msg 203 203 t = time[last_time_index] 204 204 q = f(t, point_id=0); assert allclose(r0, q) 205 205 q = f(t, point_id=1); assert allclose(r1, q) … … 315 315 import time 316 316 317 318 319 317 #Create sww file of simple propagation from left to right 318 #through rectangular domain 319 from shallow_water import Domain, Dirichlet_boundary 320 320 from mesh_factory import rectangular 321 321 from Numeric import take, concatenate, reshape … … 334 334 335 335 336 from anuga.utilities.numerical_tools import mean 336 from anuga.utilities.numerical_tools import mean 337 337 domain1.reduction = mean 338 338 domain1.smooth = True #NOTE: Mimic sww output where each vertex has … … 340 340 341 341 domain1.default_order = 2 342 342 domain1.store = True 343 343 domain1.set_datadir('.') 344 344 domain1.set_name('spatio_temporal_boundary_source_%d' %(id(self))) … … 378 378 #Diagonal is identified by vertices: 0, 5, 10, 15 379 379 380 last_time_index = len(time)-1 #Last last_time_index 380 last_time_index = len(time)-1 #Last last_time_index 381 381 d_stage = reshape(take(stage[last_time_index, :], [0,5,10,15]), (4,1)) 382 382 d_uh = reshape(take(xmomentum[last_time_index, :], [0,5,10,15]), (4,1)) … … 407 407 interpolation_points = d_midpoints) 408 408 409 t = time[last_time_index]409 t = time[last_time_index] 410 410 q = f(t, point_id=0); assert allclose(r0, q) 411 411 q = f(t, point_id=1); assert allclose(r1, q) … … 658 658 #Check that domain.starttime isn't updated if later than file starttime but earlier 659 659 #than file end time 660 660 delta = 23 661 661 domain.starttime = start + delta 662 662 F = file_function(filename + '.sww', domain, … … 875 875 #Check that domain.starttime isn't updated if later than file starttime but earlier 876 876 #than file end time 877 877 delta = 23 878 878 domain.starttime = start + delta 879 879 F = file_function(filename + '.sww', domain, … … 1034 1034 #Check that domain.starttime isn't updated if later than file starttime but earlier 1035 1035 #than file end time 1036 1036 delta = 23 1037 1037 domain.starttime = start + delta 1038 1038 F = file_function(filename + '.tms', domain, … … 1139 1139 """Test that obsolete call issues appropriate warning""" 1140 1140 1141 1141 #Turn warning into an exception 1142 1142 import warnings 1143 1143 warnings.filterwarnings('error') 1144 1144 1145 1145 try: 1146 1147 1148 1149 1150 1151 1152 1153 1146 assert point_on_line( 0, 0.5, 0,1, 0,0 ) 1147 except DeprecationWarning: 1148 pass 1149 else: 1150 msg = 'point_on_line should have issued a DeprecationWarning' 1151 raise Exception(msg) 1152 1153 warnings.resetwarnings() 1154 1154 1155 1155 def test_get_version_info(self): … … 1162 1162 int(fields[1]) 1163 1163 except: 1164 1164 msg = 'Revision number must be an integer. I got %s' %fields[1] 1165 1165 msg += 'Chech that the command svn is on the system path' 1166 1167 1166 raise Exception(msg) 1167 1168 1168 def test_add_directories(self): 1169 1169 … … 1193 1193 try: 1194 1194 kens_dir = add_directories(root_dir, directories) 1195 1196 1197 1198 1199 1195 except OSError: 1196 pass 1197 else: 1198 msg = 'bad dir name should give OSError' 1199 raise Exception(msg) 1200 1200 1201 1201 #clean up! -
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r4159 r4160 544 544 # Create dummy info 545 545 info = 'Revision: Version info could not be obtained.' 546 info += 'A command line version of svn and access to the ' 546 info += 'A command line version of svn must be availbable ' 547 info += 'on the system PATH, access to the subversion ' 547 548 info += 'repository is necessary and the output must ' 548 549 info += 'contain a line starting with "Revision:"' … … 551 552 fid = os.popen('svn info') 552 553 except: 553 msg = 'svn is not recognised '554 msg = 'svn is not recognised on the system PATH' 554 555 warn(msg, UserWarning) 555 556 else:
Note: See TracChangeset
for help on using the changeset viewer.