Changeset 5961


Ignore:
Timestamp:
Nov 17, 2008, 1:10:48 PM (16 years ago)
Author:
ole
Message:

Added single_precision option

Location:
anuga_core/source/anuga
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py

    r5957 r5961  
    909909
    910910        # Define a tolerance for extremum computations
    911         epsilon = 1.0e-6 # Import 'single_precision' from config
     911        from anuga.config import single_precision as epsilon
    912912       
    913913        if self.quantities_to_be_monitored is None:
  • anuga_core/source/anuga/config.py

    r5957 r5961  
    99default_smoothing_parameter = 0.001 # Default alpha for penalised
    1010                                    # least squares fitting
    11 
     11                                   
     12single_precision = 1.0e-6           # Smallest single precision number
    1213velocity_protection = 1.0e-6                                     
    1314
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r5960 r5961  
    30263026
    30273027        from anuga.coordinate_transforms.redfearn import redfearn
    3028 
    30293028        #fid = NetCDFFile('small_ha.nc')
    30303029        fid = NetCDFFile(self.test_MOST_file + '_ha.nc')
     
    64226421       
    64236422       
    6424     def Xtest_read_mux_platform_problem2(self):
     6423    def test_read_mux_platform_problem2(self):
    64256424        """test_read_mux_platform_problem2
    64266425       
     
    64336432        from Numeric import sin, cos
    64346433        from urs_ext import read_mux2
     6434       
     6435        from anuga.config import single_precision as epsilon       
    64356436       
    64366437        verbose = False
     
    65906591                assert abs(az-unpack('f',f.read(4))[0])<epsilon
    65916592                assert abs(baz-unpack('f',f.read(4))[0])<epsilon
    6592                 assert abs(time_step-unpack('f',f.read(4))[0])<epsilon#*1e5
     6593               
     6594                x = unpack('f', f.read(4))[0]
     6595                #print time_step
     6596                #print x
     6597                assert abs(time_step-x)<epsilon
    65936598                assert abs(time_step_count-unpack('i',f.read(4))[0])<epsilon
    65946599                for j in range(4): # identifier
     
    66096614            #for time in  range(time_step_count):
    66106615            for time in range(min_tstep-1,max_tstep):
    6611                 assert abs(time*time_step-unpack('f',f.read(4))[0])<epsilon#*1.e5
     6616                assert abs(time*time_step-unpack('f',f.read(4))[0])<epsilon
    66126617                for point_i in range(points_num):
    66136618                    if time+1>=first_tstep[point_i] and time+1<=last_tstep[point_i]:
    6614                         assert abs(q_time[time, point_i]-unpack('f',f.read(4))[0])<epsilon#*2.e5
     6619                        assert abs(q_time[time, point_i]-unpack('f',f.read(4))[0])<epsilon
    66156620
    66166621            f.close()
     
    1103611041if __name__ == "__main__":
    1103711042
    11038     suite = unittest.makeSuite(Test_Data_Manager,'test')
     11043    #suite = unittest.makeSuite(Test_Data_Manager,'test')
    1103911044    #suite = unittest.makeSuite(Test_Data_Manager,'test_file_boundary_stsI_beyond_model_time')
    1104011045    #suite = unittest.makeSuite(Test_Data_Manager,'test_file_boundary_stsIV_sinewave_ordering')
     
    1104511050
    1104611051    # FIXME (Ole): This is the test that fails under Windows
    11047     #suite = unittest.makeSuite(Test_Data_Manager,'test_read_mux_platform_problem2')
     11052    suite = unittest.makeSuite(Test_Data_Manager,'test_read_mux_platform_problem2')
    1104811053    #suite = unittest.makeSuite(Test_Data_Manager,'test_file_boundary_stsIV')
    1104911054
Note: See TracChangeset for help on using the changeset viewer.