Changeset 2300


Ignore:
Timestamp:
Jan 30, 2006, 9:47:34 AM (18 years ago)
Author:
ole
Message:

Implemented set_quantities_to_be_stored and used it in bedslope.py

Location:
inundation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/examples/bedslope.py

    r2288 r2300  
    1818domain = Domain(points, vertices, boundary)
    1919domain.set_name('bedslope')
     20domain.set_quantities_to_be_stored('stage')
    2021
    2122
  • inundation/pyvolution/shallow_water.py

    r2206 r2300  
    8989
    9090        #Stored output
    91         self.store = False
     91        self.store = True
    9292        self.format = 'sww'
    9393        self.smooth = True
     
    101101
    102102
     103    def set_quantities_to_be_stored(self, q):
     104        """Specify which quantities will be stored in the sww file.
     105
     106        q must be either:
     107          - the name of a quantity
     108          - a list of quantity names
     109          - None
     110
     111        In the two first cases, the named quantities will be stored at each yieldstep
     112        (This is in addition to the quantities elevation and friction) 
     113        If q is None, storage will be switche off altogether.
     114        """
     115
     116
     117        if q is None:
     118            self.quantities_to_be_stored = []           
     119            self.store = False
     120            return
     121
     122        if isinstance(q, basestring):
     123            q = [q] # Turn argument into a list
     124
     125        #Check correcness   
     126        for quantity_name in q:
     127            msg = 'Quantity %s is not a valid conserved quantity' %quantity_name
     128            assert quantity_name in self.conserved_quantities, msg
     129       
     130        self.quantities_to_be_stored = q
     131       
    103132
    104133    def initialise_visualiser(self,scale_z=1.0,rect=None):
Note: See TracChangeset for help on using the changeset viewer.