Changeset 4831


Ignore:
Timestamp:
Nov 20, 2007, 10:56:13 AM (16 years ago)
Author:
duncan
Message:

working on ticket#220

Location:
anuga_core/source/anuga/pmesh
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/pmesh/mesh.py

    r4830 r4831  
    11061106        mode is a string that sets conditions on the mesh generations
    11071107        see triangle_instructions.txt for a definition of the commands
    1108         PreCondition: maxArea is a double
     1108       
     1109        PreCondition: maxArea is a double between 1e-20 and 1e30 or is a
     1110        string.
    11091111        """
    11101112        #print "mode ",mode
     
    11371139        if maxArea != None:
    11381140            self.mode += 'a' + str(maxArea)
     1141            try:
     1142                self.mode += 'a' + '%20.20f' %maxArea
     1143            except TypeError:
     1144                self.mode += 'a' + str(maxArea)
     1145            #print "self.mode", self.mode
    11391146        #FIXME (DSG-DSG) This isn't explained.
    11401147        if isRegionalMaxAreas:
  • anuga_core/source/anuga/pmesh/test_mesh.py

    r4663 r4831  
    23242324        self.failUnless(points_ab==points_new,
    23252325                        'FAILED!')
     2326
     2327    def mode_string_float_problems(self):
     2328        numbers = [0.0000000001,1000000000000.0, 1e-19,1e19, 1e-25,1e30,1e40,
     2329                   1e41,'0.00001','0.000000000000000000000000000000000001']
     2330        numbers = [1e-21,1e-20,1e30,1e35,1e40]
     2331        for num in numbers:
     2332            mode = 'a' + str(num)
     2333            #print " mode += 'a' + str(num)", mode
     2334            print "====================="
     2335           
     2336            try:
     2337                mode = 'a' + '%20.20f' %num
     2338            except TypeError:
     2339                mode = 'a' + str(num)
     2340            print "mode += 'a' + '%20.20f' %num", mode
     2341        #print "", mode
    23262342       
    23272343       
     
    23322348            yes = False
    23332349    return yes
    2334 
    2335 
    23362350           
    23372351#-------------------------------------------------------------
    23382352if __name__ == "__main__":
    23392353    suite = unittest.makeSuite(meshTestCase,'test')
    2340     #suite = unittest.makeSuite(meshTestCase,'test_exportoutlinefile')
     2354    #suite = unittest.makeSuite(meshTestCase,'mode_string_float_problems')
    23412355    #suite = unittest.makeSuite(meshTestCase,'test_exportPointsFile')
    23422356    runner = unittest.TextTestRunner() # verbosity=2)
Note: See TracChangeset for help on using the changeset viewer.