Changeset 2184
- Timestamp:
- Jan 4, 2006, 3:29:14 PM (18 years ago)
- Location:
- inundation/fit_interpolate
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/fit_interpolate/benchmark_least_squares.py
r2004 r2184 11 11 test results. 12 12 13 Ole Nielsen, Stephen Roberts, Duncan Gray, Christopher Zoppou13 Duncan Gray 14 14 Geoscience Australia, 2004. 15 15 """ … … 56 56 maxArea=1000, 57 57 max_points_per_cell=4, 58 is_fit=True, 58 59 save=False): 60 ''' 61 num_of_points 62 ''' 63 59 64 #print "num_of_points",num_of_points 60 65 #print "maxArea",maxArea … … 65 70 m = Mesh() 66 71 m.addUserVertex(0,0) 67 m.addUserVertex(1 00,0)68 m.addUserVertex(0,1 00)69 m.addUserVertex(1 00,100)72 m.addUserVertex(1.0,0) 73 m.addUserVertex(0,1.0) 74 m.addUserVertex(1.0,1.0) 70 75 71 76 m.autoSegment(alpha = 100 ) 72 77 73 78 dict = {} 74 dict['points'] = [[ 10,10],[90,20]]79 dict['points'] = [[.10,.10],[.90,.20]] 75 80 dict['segments'] = [[0,1]] 76 81 dict['segment_tags'] = ['wall1'] … … 78 83 79 84 dict = {} 80 dict['points'] = [[ 10,90],[40,20]]85 dict['points'] = [[.10,.90],[.40,.20]] 81 86 dict['segments'] = [[0,1]] 82 87 dict['segment_tags'] = ['wall2'] … … 84 89 85 90 dict = {} 86 dict['points'] = [[ 20,90],[60,60]]91 dict['points'] = [[.20,.90],[.60,.60]] 87 92 dict['segments'] = [[0,1]] 88 93 dict['segment_tags'] = ['wall3'] … … 90 95 91 96 dict = {} 92 dict['points'] = [[ 60,20],[90,90]]97 dict['points'] = [[.60,.20],[.90,.90]] 93 98 dict['segments'] = [[0,1]] 94 99 dict['segment_tags'] = ['wall4'] … … 99 104 m.export_mesh_file("aaaa.tsh") 100 105 mesh_dict = m.Mesh2IOTriangulationDict() 101 106 #print "mesh_dict",mesh_dict 102 107 points = [] 103 108 point_atts = [] 109 vertex_atts = [] 110 111 112 104 113 for point in range(num_of_points): 105 114 points.append([random()*100, random()*100]) 106 115 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) 107 120 108 121 #Initial time and memory … … 116 129 verbose = False, 117 130 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 121 139 time_taken_sec = (time.time()-t0) 122 140 m1 = mem_usage() … … 126 144 memory_used = (m1 - m0) 127 145 #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.