Ignore:
Timestamp:
Jan 4, 2006, 3:29:14 PM (18 years ago)
Author:
duncan
Message:

writing results to file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/fit_interpolate/benchmark_least_squares.py

    r2004 r2184  
    1111   test results.
    1212   
    13    Ole Nielsen, Stephen Roberts, Duncan Gray, Christopher Zoppou
     13   Duncan Gray
    1414   Geoscience Australia, 2004.
    1515"""
     
    5656              maxArea=1000,
    5757              max_points_per_cell=4,
     58              is_fit=True,
    5859              save=False):
     60        '''
     61        num_of_points
     62        '''
     63       
    5964        #print "num_of_points",num_of_points
    6065        #print "maxArea",maxArea
     
    6570        m = Mesh()
    6671        m.addUserVertex(0,0)
    67         m.addUserVertex(100,0)
    68         m.addUserVertex(0,100)
    69         m.addUserVertex(100,100)
     72        m.addUserVertex(1.0,0)
     73        m.addUserVertex(0,1.0)
     74        m.addUserVertex(1.0,1.0)
    7075       
    7176        m.autoSegment(alpha = 100 )
    7277       
    7378        dict = {}
    74         dict['points'] = [[10,10],[90,20]]
     79        dict['points'] = [[.10,.10],[.90,.20]]
    7580        dict['segments'] = [[0,1]]
    7681        dict['segment_tags'] = ['wall1']   
     
    7883   
    7984        dict = {}
    80         dict['points'] = [[10,90],[40,20]]
     85        dict['points'] = [[.10,.90],[.40,.20]]
    8186        dict['segments'] = [[0,1]]
    8287        dict['segment_tags'] = ['wall2']   
     
    8489       
    8590        dict = {}
    86         dict['points'] = [[20,90],[60,60]]
     91        dict['points'] = [[.20,.90],[.60,.60]]
    8792        dict['segments'] = [[0,1]]
    8893        dict['segment_tags'] = ['wall3']
     
    9095       
    9196        dict = {}
    92         dict['points'] = [[60,20],[90,90]]
     97        dict['points'] = [[.60,.20],[.90,.90]]
    9398        dict['segments'] = [[0,1]]
    9499        dict['segment_tags'] = ['wall4']   
     
    99104            m.export_mesh_file("aaaa.tsh")
    100105        mesh_dict =  m.Mesh2IOTriangulationDict()
    101 
     106        #print "mesh_dict",mesh_dict
    102107        points = []
    103108        point_atts = []
     109        vertex_atts = []
     110
     111             
     112           
    104113        for point in range(num_of_points):
    105114            points.append([random()*100, random()*100])
    106115            point_atts.append(10.0)
     116
     117        # There has to be a better way of doing this..
     118        for vertex in mesh_dict['vertices']:
     119            vertex_atts.append(10.0)
    107120           
    108121        #Initial time and memory
     
    116129                               verbose = False,
    117130                               max_points_per_cell = 4)
    118         calc = interp.fit_points(point_atts )
    119         #print "interp.expanded_quad_searches", interp.expanded_quad_searches
    120         #print "calc", calc
     131        if is_fit is True:
     132            calc = interp.fit_points(point_atts)
     133
     134        else:
     135            # run an interploate problem.
     136            print "Interpolate!"
     137            calc = interp.interpolate(vertex_atts)
     138           
    121139        time_taken_sec = (time.time()-t0)
    122140        m1 = mem_usage()
     
    126144            memory_used = (m1 - m0)
    127145        #print 'That took %.2f seconds' %time_taken_sec
    128         return time_taken_sec, memory_used
     146        return time_taken_sec, memory_used, len(mesh_dict['triangles'])
Note: See TracChangeset for help on using the changeset viewer.