Ignore:
Timestamp:
Jun 21, 2006, 3:33:49 PM (18 years ago)
Author:
duncan
Message:

bug fixing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pmesh/mesh.py

    r3180 r3193  
    3131from geospatial_data.geospatial_data import Geospatial_data, ensure_geospatial
    3232
     33try: 
     34    import kinds 
     35except ImportError: 
     36    # Hand-built mockup of the things we need from the kinds package, since it 
     37    # was recently removed from the standard Numeric distro.  Some users may 
     38    # not have it by default. 
     39    class _bunch: 
     40        pass 
     41         
     42    class _kinds(_bunch): 
     43        default_float_kind = _bunch() 
     44        default_float_kind.MIN = 2.2250738585072014e-308  #smallest +ve number
     45        default_float_kind.MAX = 1.7976931348623157e+308 
     46     
     47    kinds = _kinds()
     48   
    3349SET_COLOUR='red'
    3450
     
    225241   
    226242    def setMaxArea(self,MaxArea):
    227         if self.isMaxArea():
    228             self.attributes[self.MAXAREA] = float(MaxArea)
    229         else:
    230             self.attributes.append( float(MaxArea) )
     243        if MaxArea is not None:
     244            if self.isMaxArea():
     245                self.attributes[self.MAXAREA] = float(MaxArea)
     246            else:
     247                self.attributes.append( float(MaxArea) )
    231248   
    232249    def deleteMaxArea(self):
     
    940957       
    941958    def generate_mesh(self,
    942                       maximum_triangle_area=None,
     959                      maximum_triangle_area="",
    943960                      minimum_triangle_angle=28.0,
    944                       verbose=False):
     961                      verbose=True):
    945962        if verbose is True:
    946963            silent = ''
     
    9901007        if maxArea != None:
    9911008            self.mode += 'a' + str(maxArea)
    992         #FIXME (DSG-DSG) This isn't explained.  I don't think it works
    993         # well with  maxArea = None as well.
     1009        #FIXME (DSG-DSG) This isn't explained.
    9941010        if isRegionalMaxAreas:
    9951011            self.mode += 'a'
    996        
     1012        #print "mesh#generateMesh# self.mode",self.mode
    9971013        meshDict = self.Mesh2triangList()
    9981014        #print "*************************!@!@ This is going to triangle   !@!@"
     
    17831799        Structure: list of verts
    17841800        """
    1785         # FIXME dsg!!! large is a hack
    1786         #You want the kinds package, part of Numeric:
    1787         #In [2]: import kinds
    1788        
    1789         #In [3]: kinds.default_float_kind.M
    1790         #kinds.default_float_kind.MAX         kinds.default_float_kind.MIN
    1791     #kinds.default_float_kind.MAX_10_EXP  kinds.default_float_kind.MIN_10_EXP
    1792         #kinds.default_float_kind.MAX_EXP     kinds.default_float_kind.MIN_EXP
    1793 
    1794         #In [3]: kinds.default_float_kind.MIN
    1795         #Out[3]: 2.2250738585072014e-308
    1796 
    1797         large = 1e100
     1801       
     1802        large = kinds.default_float_kind.MAX
    17981803        xmin= large
    17991804        xmax=-large
     
    18271832        Structure: [xmin, ymin, xmax, ymax]
    18281833        """
    1829         # FIXME dsg!!! large is a hack
    1830         #You want the kinds package, part of Numeric:
    1831         #In [2]: import kinds
    1832        
    1833         #In [3]: kinds.default_float_kind.M
    1834         #kinds.default_float_kind.MAX         kinds.default_float_kind.MIN
    1835     #kinds.default_float_kind.MAX_10_EXP  kinds.default_fltesting oat_kind.MIN_10_EXP
    1836         #kinds.default_float_kind.MAX_EXP     kinds.default_float_kind.MIN_EXP
    1837 
    1838         #In [3]: kinds.default_float_kind.MIN
    1839         #Out[3]: 2.2250738585072014e-308
    1840 
    1841         large = 1e100
     1834     
     1835        large = kinds.default_float_kind.MAX
    18421836        xmin= large
    18431837        xmax=-large
     
    18621856        Structure: [xmin, ymin, xmax, ymax]
    18631857        """
    1864         # FIXME dsg!!! large is a hacktesting
    1865         #You want the kinds package, part of Numeric:
    1866         #In [2]: import kinds
    1867        
    1868         #In [3]: kinds.default_float_kind.M
    1869         #kinds.default_float_kind.MAX         kinds.default_float_kind.MIN
    1870     #kinds.default_float_kind.MAX_10_EXP  kinds.default_float_kind.MIN_10_EXP
    1871         #kinds.default_float_kind.MAX_EXP     kinds.default_float_kind.MIN_EXP
    1872 
    1873         #In [3]: kinds.default_float_kind.MIN
    1874         #Out[3]: 2.2250738585072014e-308
    1875 
    1876         large = 1e100
     1858       
     1859        large = kinds.default_float_kind.MAX
    18771860        min= large
    18781861        max=-large
Note: See TracChangeset for help on using the changeset viewer.