Changeset 2204


Ignore:
Timestamp:
Jan 13, 2006, 12:25:30 PM (18 years ago)
Author:
steve
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/domain.py

    r1928 r2204  
    126126        return q
    127127
     128    def set_time(self, time=0.0):
     129        """Set the time"""
     130
     131        self.time = time
    128132
    129133    def set_quantity_vertices_dict(self, quantity_dict):
     
    167171        if kwargs.has_key('expression'):
    168172            expression = kwargs['expression']
    169             del kwargs['expression']           
     173            del kwargs['expression']
    170174
    171175            Q = self.create_quantity_from_expression(expression)
     
    173177
    174178
    175         #Assign values   
     179        #Assign values
    176180        self.quantities[name].set_values(*args, **kwargs)
    177181
     
    206210
    207211        Example:
    208      
    209    
     212
     213
    210214        """
    211215
    212216        from util import apply_expression_to_dictionary
    213217        return apply_expression_to_dictionary(expression, self.quantities)
    214    
     218
    215219
    216220
     
    332336        #          %(self.time, self.min_timestep,
    333337        #            self.max_timestep, self.number_of_steps,
    334         #            self.number_of_first_order_steps)       
    335        
     338        #            self.number_of_first_order_steps)
     339
    336340    def timestepping_statistics(self):
    337341        """Return string with time stepping statistics for printing or logging
     
    352356                     self.max_timestep, self.number_of_steps,
    353357                     self.number_of_first_order_steps)
    354            
    355         return msg   
    356 
    357            
     358
     359        return msg
     360
     361
    358362    def write_boundary_statistics(self, quantities = None, tags = None):
    359363        print self.boundary_statistics(quantities, tags)
    360        
     364
    361365    def boundary_statistics(self, quantities = None, tags = None):
    362366        """Output statistics about boundary forcing at each timestep
     
    378382        #Input checks
    379383        import types, string
    380        
     384
    381385        if quantities is None:
    382386            quantities = self.conserved_quantities
     
    385389
    386390        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)
    388392        assert type(quantities) == types.ListType, msg
    389            
     393
    390394
    391395        if tags is None:
     
    395399
    396400        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
    399403
    400404        #Determine width of longest quantity name (for cosmetic purposes)
    401405        maxwidth = 0
    402406        for name in quantities:
    403             w = len(name) 
     407            w = len(name)
    404408            if w > maxwidth:
    405409                maxwidth = w
    406            
     410
    407411        #Output stats
    408412        msg = 'Boundary values at time %.4f:\n' %self.time
    409413        for tag in tags:
    410414            msg += '    %s:\n' %tag
    411          
     415
    412416            for name in quantities:
    413417                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
    416420                maxval = minval = None
    417421                for i, ((vol_id, edge_id), B) in\
     
    421425                        if minval is None or v < minval: minval = v
    422426                        if maxval is None or v > maxval: maxval = v
    423          
     427
    424428                if minval is None or maxval is None:
    425429                    msg += '        Sorry no information available about' +\
     
    432436        return msg
    433437
    434    
     438
    435439    def get_name(self):
    436440        return self.filename
     
    513517            self.goto_latest_checkpoint()
    514518
    515         if skip_initial_step is False:   
     519        if skip_initial_step is False:
    516520            yield(self.time)  #Yield initial values
    517521
Note: See TracChangeset for help on using the changeset viewer.