Ignore:
Timestamp:
Aug 2, 2006, 5:14:16 PM (19 years ago)
Author:
duncan
Message:

Making set_region easier to use.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/domain.py

    r3085 r3447  
    1515from pyvolution.generic_boundary_conditions import Transmissive_boundary
    1616from pyvolution.pmesh2domain import pmesh_to_domain
     17from pyvolution.region import Set_region as region_set_region
    1718
    1819import types
     
    424425
    425426
    426     def set_region(self, functions):
     427    def set_region(self, *args, **kwargs):
     428        """
     429        This method is used to set quantities based on a regional tag.
     430       
     431        It is most often called with the following parameters;
     432        (self, tag, quantity, X, location='vertices')
     433        tag: the name of the regional tag used to specify the region
     434        quantity: Name of quantity to change
     435        X: const or function - how the quantity is changed
     436        location: Where values are to be stored.
     437            Permissible options are: vertices, centroid and unique vertices
     438
     439        A callable region class or a list of callable region classes
     440        can also be passed into this function.
     441        """
     442        #print "*args", args
     443        #print "**kwargs", kwargs
     444        if len(args) == 1:
     445            self._set_region(*args, **kwargs)
     446        else:
     447            #Assume it is arguments for the region.set_region function
     448            func = region_set_region(*args, **kwargs)
     449            self._set_region(func)
     450           
     451       
     452    def _set_region(self, functions):
    427453        # The order of functions in the list is used.
    428454        if type(functions) not in [types.ListType,types.TupleType]:
     
    432458                function(tag, self.tagged_elements[tag], self)
    433459
    434                 #Do we need to do this sort of thing?
    435                 #self = function(tag, self.tagged_elements[tag], self)
    436460
    437461    #MISC
Note: See TracChangeset for help on using the changeset viewer.