Changeset 4839
- Timestamp:
- Nov 21, 2007, 10:45:34 AM (17 years ago)
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/general_mesh.py
r4836 r4839 301 301 302 302 V = self.vertex_coordinates 303 if absolute is True: 304 if not self.geo_reference.is_absolute(): 305 V = self.geo_reference.get_absolute(V) 306 307 if triangle_id is None: 303 304 if triangle_id is None: 305 if absolute is True: 306 if not self.geo_reference.is_absolute(): 307 V = self.geo_reference.get_absolute(V) 308 308 309 return V 309 310 else: … … 313 314 assert 0 <= i < self.number_of_triangles 314 315 315 i3 = 3*i 316 return array([V[i3,:], V[i3+1,:], V[i3+2,:]]) 317 316 i3 = 3*i 317 if absolute is True and not self.geo_reference.is_absolute(): 318 offset=array([self.geo_reference.get_xllcorner(), 319 self.geo_reference.get_yllcorner()]) 320 return array([V[i3,:]+offset, 321 V[i3+1,:]+offset, 322 V[i3+2,:]+offset]) 323 else: 324 return array([V[i3,:], V[i3+1,:], V[i3+2,:]]) 325 318 326 319 327 -
anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py
r4821 r4839 841 841 raise msg 842 842 843 if False: # FIXME (Ole): True takes less memory,843 if True: # FIXME (Ole): True takes less memory, 844 844 # but appears to be slower. 845 845 vertex_attributes = fit_to_mesh(filename, -
anuga_core/source/anuga/abstract_2d_finite_volumes/test_general_mesh.py
r4808 r4839 43 43 assert allclose(V[3*i+j,:], nodes[k]) 44 44 45 def test_get_vertex_coordinates_with_geo_ref(self): 46 x0 = 314036.58727982 47 y0 = 6224951.2960092 48 geo = Geo_reference(56, x0, y0) 49 50 a = [0.0, 0.0] 51 b = [0.0, 2.0] 52 c = [2.0, 0.0] 53 d = [0.0, 4.0] 54 e = [2.0, 2.0] 55 f = [4.0, 0.0] 56 57 nodes = array([a, b, c, d, e, f]) 58 59 nodes_absolute = geo.get_absolute(nodes) 60 61 #bac, bce, ecf, dbe, daf, dae 62 triangles = array([[1,0,2], [1,2,4], [4,2,5], [3,1,4]]) 63 64 domain = General_mesh(nodes, triangles, 65 geo_reference = geo) 66 verts = domain.get_vertex_coordinates(triangle_id=0) 67 self.assert_(allclose(array([b,a,c]), verts)) 68 verts = domain.get_vertex_coordinates(triangle_id=0) 69 self.assert_(allclose(array([b,a,c]), verts)) 70 verts = domain.get_vertex_coordinates(triangle_id=0, 71 absolute=True) 72 self.assert_(allclose(array([nodes_absolute[1], 73 nodes_absolute[0], 74 nodes_absolute[2]]), verts)) 75 verts = domain.get_vertex_coordinates(triangle_id=0, 76 absolute=True) 77 self.assert_(allclose(array([nodes_absolute[1], 78 nodes_absolute[0], 79 nodes_absolute[2]]), verts)) 80 81 45 82 46 83 def test_get_vertex_coordinates_triangle_id(self): -
anuga_core/source/anuga/coordinate_transforms/geo_reference.py
r4663 r4839 243 243 #if self.is_absolute(): 244 244 # return points 245 246 247 245 is_list = False 248 246 if type(points) == types.ListType: -
anuga_core/source/anuga/fit_interpolate/benchmark_least_squares.py
r4665 r4839 30 30 from anuga.fit_interpolate.fit import Fit, fit_to_mesh 31 31 from anuga.fit_interpolate.interpolate import benchmark_interpolate 32 from anuga.coordinate_transforms.geo_reference import Geo_reference 32 33 33 34 def mem_usage(): … … 83 84 #print "max_points_per_cell", max_points_per_cell 84 85 86 geo = Geo_reference(xllcorner = 2.0, 87 yllcorner = 2.0) 85 88 mesh_dict = self._build_regular_mesh_dict(maxArea=maxArea, 86 89 is_segments=segments_in_mesh, 87 save=save) 88 points_dict = self._build_points_dict(num_of_points=num_of_points) 90 save=save, 91 geo=geo) 92 points_dict = self._build_points_dict(num_of_points=num_of_points, 93 geo=geo) 89 94 90 95 … … 98 103 ".txt" 99 104 105 # Apply the geo_ref to the points, so they are relative 106 # Pass in the geo_ref 100 107 101 108 domain = Domain(mesh_dict['vertices'], mesh_dict['triangles'], 102 use_cache=False, verbose=False) 109 use_cache=False, verbose=False, 110 geo_reference=geo) 103 111 #Initial time and memory 104 112 t0 = time.time() … … 106 114 m0 = mem_usage() 107 115 116 # Apply the geo_ref to the points, so they are relative 117 # Pass in the geo_ref 118 geospatial = Geospatial_data(points_dict['points'], 119 points_dict['point_attributes'], 120 geo_reference=geo) 108 121 if is_fit is True: 109 122 110 print "Fit in Fit" 111 geospatial = Geospatial_data(points_dict['points'], 112 points_dict['point_attributes']) 123 # print "Fit in Fit" 113 124 if use_file_type == None: 114 125 points = geospatial 115 126 filename = None 116 127 else: 117 # check that the type128 #FIXME (DSG) check that the type 118 129 fileName = tempfile.mktemp("." + use_file_type) 119 130 geospatial.export_points_file(fileName, absolute=True) … … 147 158 else: 148 159 # run an interploate problem. 149 print "Interpolate!"160 #print "Interpolate!" 150 161 151 162 if run_profile: 152 s="""benchmark_interpolate(mesh_dict['vertices'],mesh_dict['vertex_attributes'],mesh_dict['triangles'],points_dict['points'],max_points_per_cell=max_points_per_cell)""" 163 # pass in the geospatial points 164 # and the mesh origin 165 166 s="""benchmark_interpolate(mesh_dict['vertices'],mesh_dict['vertex_attributes'],mesh_dict['triangles'],geospatial,max_points_per_cell=max_points_per_cell,mesh_origin=geo)""" 153 167 pobject = profile.Profile() 154 168 presult = pobject.runctx(s, … … 169 183 170 184 else: 185 # pass in the geospatial points 171 186 benchmark_interpolate(mesh_dict['vertices'], 172 187 mesh_dict['vertex_attributes'], 173 188 mesh_dict['triangles'], 174 points_dict['points'], 189 geospatial, 190 mesh_origin=geo, 175 191 max_points_per_cell=max_points_per_cell) 176 192 time_taken_sec = (time.time()-t0) … … 186 202 maxArea=1000, 187 203 is_segments=True, 188 save=False): 204 save=False, 205 geo=None): 189 206 # make a normalised mesh 190 # pretty regular size, with some segments thrown in. 207 # pretty regular size, with some segments thrown in. 208 209 #x_min = 191 210 m = Mesh() 192 211 m.addUserVertex(0,0) … … 235 254 return mesh_dict 236 255 237 def _build_points_dict(self, num_of_points=20000): 256 def _build_points_dict(self, num_of_points=20000, 257 geo=None): 238 258 239 259 points_dict = {} -
anuga_core/source/anuga/fit_interpolate/interpolate.py
r4833 r4839 295 295 triangles, points, 296 296 max_points_per_cell=None, 297 start_blocking_len=500000): 297 start_blocking_len=500000, 298 mesh_origin=None): 298 299 """ 300 points: Interpolate mesh data to these positions. 301 List of coordinate pairs [x, y] of 302 data points or an nx2 Numeric array or a Geospatial_data object 303 299 304 No test for this yet. 300 305 Note, this has no time the input data has no time dimension. Which is … … 306 311 interp = Interpolate(vertices, 307 312 triangles, 308 max_vertices_per_cell=max_points_per_cell) 313 max_vertices_per_cell=max_points_per_cell, 314 mesh_origin=mesh_origin) 309 315 310 316 calc = interp.interpolate(vertex_attributes 311 317 ,points 312 318 ,start_blocking_len=start_blocking_len) 319 #print "calc", calc 320 313 321 def interpolate_sww2csv(sww_file, 314 322 points, -
anuga_core/source/anuga/fit_interpolate/run_long_benchmark.py
r4596 r4839 16 16 17 17 use_least_squares_list = [False] 18 is_fit_list = [True ]19 num_of_points_list = [50, 500] #, 10000, 100000] #, 10000000]20 maxArea_list = [0. 5, 0.055, 0.06] #, 0.00001, 0.0000001]18 is_fit_list = [True, False] 19 num_of_points_list = [50, 1000] #, 500, 10000, 100000] #, 10000000] 20 maxArea_list = [0.01, 0.001, 0.0001] #,0.00001] #, 0.0000001] #, 0.06, 0.00001, 0.0000001] 21 21 max_points_per_cell_list = [8] 22 use_file_type_list = [ None,'txt','pts']22 use_file_type_list = ['pts'] 23 23 24 24 fd = open(ofile,'a') … … 35 35 36 36 37 for maxArea in maxArea_list:38 for use_file_type in use_file_type_list:39 for is_fit in is_fit_list:37 for is_fit in is_fit_list: 38 for maxArea in maxArea_list: 39 for use_file_type in use_file_type_list: 40 40 for num_of_points in num_of_points_list: 41 41 for max_points_per_cell in max_points_per_cell_list: 42 42 43 time, mem, num_tri = ben.trial(num_of_points=num_of_points 44 ,maxArea=maxArea 45 ,max_points_per_cell=max_points_per_cell 46 ,is_fit=is_fit 47 ,segments_in_mesh=False 48 ,use_file_type=use_file_type 49 ,save=True 50 ) 43 time, mem, num_tri = ben.trial( 44 num_of_points=num_of_points 45 ,maxArea=maxArea 46 ,max_points_per_cell=max_points_per_cell 47 ,is_fit=is_fit 48 ,segments_in_mesh=False 49 ,use_file_type=use_file_type 50 ,save=True 51 ) 51 52 print "time",time 52 53 print "mem", mem 54 print "num_tri", num_tri 53 55 fd.write(str(use_file_type) + delimiter + 54 56 str(num_of_points) + delimiter + -
anuga_validation/automated_validation_tests/UQ_runup_2006/validate_uq_runup.py
r4774 r4839 1 """Automatic verification that the ANUGA code validates against the okushiri2 dataset as expected. See anuga_validation/okushiri_2005 for more details1 """Automatic verification that the ANUGA code validates against the UQ runup 2 dataset as expected. 3 3 """ 4 4
Note: See TracChangeset
for help on using the changeset viewer.