Changeset 2204
- Timestamp:
- Jan 13, 2006, 12:25:30 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/domain.py
r1928 r2204 126 126 return q 127 127 128 def set_time(self, time=0.0): 129 """Set the time""" 130 131 self.time = time 128 132 129 133 def set_quantity_vertices_dict(self, quantity_dict): … … 167 171 if kwargs.has_key('expression'): 168 172 expression = kwargs['expression'] 169 del kwargs['expression'] 173 del kwargs['expression'] 170 174 171 175 Q = self.create_quantity_from_expression(expression) … … 173 177 174 178 175 #Assign values 179 #Assign values 176 180 self.quantities[name].set_values(*args, **kwargs) 177 181 … … 206 210 207 211 Example: 208 209 212 213 210 214 """ 211 215 212 216 from util import apply_expression_to_dictionary 213 217 return apply_expression_to_dictionary(expression, self.quantities) 214 218 215 219 216 220 … … 332 336 # %(self.time, self.min_timestep, 333 337 # self.max_timestep, self.number_of_steps, 334 # self.number_of_first_order_steps) 335 338 # self.number_of_first_order_steps) 339 336 340 def timestepping_statistics(self): 337 341 """Return string with time stepping statistics for printing or logging … … 352 356 self.max_timestep, self.number_of_steps, 353 357 self.number_of_first_order_steps) 354 355 return msg 356 357 358 359 return msg 360 361 358 362 def write_boundary_statistics(self, quantities = None, tags = None): 359 363 print self.boundary_statistics(quantities, tags) 360 364 361 365 def boundary_statistics(self, quantities = None, tags = None): 362 366 """Output statistics about boundary forcing at each timestep … … 378 382 #Input checks 379 383 import types, string 380 384 381 385 if quantities is None: 382 386 quantities = self.conserved_quantities … … 385 389 386 390 msg = 'Keyword argument quantities must be either None, ' 387 msg += 'string or list. I got %s' %str(quantities) 391 msg += 'string or list. I got %s' %str(quantities) 388 392 assert type(quantities) == types.ListType, msg 389 393 390 394 391 395 if tags is None: … … 395 399 396 400 msg = 'Keyword argument tags must be either None, ' 397 msg += 'string or list. I got %s' %str(tags) 398 assert type(tags) == types.ListType, msg 401 msg += 'string or list. I got %s' %str(tags) 402 assert type(tags) == types.ListType, msg 399 403 400 404 #Determine width of longest quantity name (for cosmetic purposes) 401 405 maxwidth = 0 402 406 for name in quantities: 403 w = len(name) 407 w = len(name) 404 408 if w > maxwidth: 405 409 maxwidth = w 406 410 407 411 #Output stats 408 412 msg = 'Boundary values at time %.4f:\n' %self.time 409 413 for tag in tags: 410 414 msg += ' %s:\n' %tag 411 415 412 416 for name in quantities: 413 417 q = self.quantities[name] 414 415 #Find range of boundary values for tag and q 418 419 #Find range of boundary values for tag and q 416 420 maxval = minval = None 417 421 for i, ((vol_id, edge_id), B) in\ … … 421 425 if minval is None or v < minval: minval = v 422 426 if maxval is None or v > maxval: maxval = v 423 427 424 428 if minval is None or maxval is None: 425 429 msg += ' Sorry no information available about' +\ … … 432 436 return msg 433 437 434 438 435 439 def get_name(self): 436 440 return self.filename … … 513 517 self.goto_latest_checkpoint() 514 518 515 if skip_initial_step is False: 519 if skip_initial_step is False: 516 520 yield(self.time) #Yield initial values 517 521
Note: See TracChangeset
for help on using the changeset viewer.