Changeset 3945
- Timestamp:
- Nov 8, 2006, 5:35:23 PM (18 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/general_mesh.py
r3928 r3945 6 6 7 7 class General_mesh: 8 """Collection of triangular elements (purely geometric)8 """Collection of 2D triangular elements 9 9 10 10 A triangular element is defined in terms of three vertex ids, 11 ordered counter clock-wise, 12 each corresponding to a given coordinate set. 13 Vertices from different elements can point to the same 14 coordinate set. 15 16 Coordinate sets are implemented as an N x 2 Numeric array containing 11 ordered counter clock-wise, each corresponding to a given node 12 which is represented as a coordinate set (x,y). 13 Vertices from different triangles can point to the same node. 14 The nodes are implemented as an Nx2 Numeric array containing the 17 15 x and y coordinates. 18 16 19 17 20 18 To instantiate: 21 Mesh( coordinates, triangles)19 Mesh(nodes, triangles) 22 20 23 21 where 24 22 25 coordinates is either a list of 2-tuples or an Mx2 Numeric array of23 nodes is either a list of 2-tuples or an Nx2 Numeric array of 26 24 floats representing all x, y coordinates in the mesh. 27 25 28 triangles is either a list of 3-tuples or an Nx3 Numeric array of26 triangles is either a list of 3-tuples or an Mx3 Numeric array of 29 27 integers representing indices of all vertices in the mesh. 30 Each vertex is identified by its index i in [0, M-1].28 Each vertex is identified by its index i in [0, N-1]. 31 29 32 30 33 31 Example: 32 34 33 a = [0.0, 0.0] 35 34 b = [0.0, 2.0] … … 37 36 e = [2.0, 2.0] 38 37 39 points = [a, b, c, e] 40 triangles = [ [1,0,2], [1,2,3] ] #bac, bce 41 mesh = Mesh(points, triangles) 42 43 #creates two triangles: bac and bce 38 nodes = [a, b, c, e] 39 triangles = [ [1,0,2], [1,2,3] ] # bac, bce 40 41 # Create mesh with two triangles: bac and bce 42 mesh = Mesh(nodes, triangles) 43 44 44 45 45 46 Other: 46 47 47 In addition mesh computes an Nx6 array called vertex_coordinates.48 In addition mesh computes an Mx6 array called vertex_coordinates. 48 49 This structure is derived from coordinates and contains for each 49 50 triangle the three x,y coordinates at the vertices. 50 51 51 52 This is a cut down version of mesh from mesh.py 52 See neighbourmesh.py for a specialisation of the general mesh class 53 which includes information about neighbours and the mesh boundary. 54 55 The mesh object is purely geometrical and contains no information 56 about quantities defined on the mesh. 57 53 58 """ 54 59 55 60 #FIXME: It would be a good idea to use geospatial data as an alternative 56 61 #input 57 def __init__(self, coordinates, triangles, 62 def __init__(self, nodes, triangles, 63 geo_reference=None, 58 64 number_of_full_nodes=None, 59 65 number_of_full_triangles=None, 60 geo_reference=None,61 66 verbose=False): 62 """ 63 Build triangles from x,y coordinates (sequence of 2-tuples or 64 Mx2 Numeric array of floats) and triangles (sequence of 3-tuples 65 or Nx3 Numeric array of non-negative integers). 66 67 origin is a 3-tuple consisting of UTM zone, easting and northing. 68 If specified coordinates are assumed to be relative to this origin. 67 """Build triangular 2d mesh from nodes and triangle information 68 69 Input: 70 71 nodes: x,y coordinates represented as a sequence of 2-tuples or 72 a Nx2 Numeric array of floats. 73 74 triangles: sequence of 3-tuples or Mx3 Numeric array of 75 non-negative integers representing indices into 76 the nodes array. 77 78 georeference (optional): If specified coordinates are 79 assumed to be relative to this origin. 69 80 70 81 … … 74 85 In this case it is usefull to specify the number of real (called full) 75 86 nodes and triangles. If omitted they will default to all. 87 76 88 """ 77 89 78 90 if verbose: print 'General_mesh: Building basic mesh structure' 79 91 80 self.triangles = array(triangles,Int) 81 self.coordinates = array(coordinates,Float) 92 self.triangles = array(triangles, Int) 93 self.nodes = array(nodes, Float) 94 82 95 83 96 # Register number of elements and nodes 84 97 self.number_of_triangles = N = self.triangles.shape[0] 85 self.number_of_nodes = self. coordinates.shape[0]98 self.number_of_nodes = self.nodes.shape[0] 86 99 87 100 88 101 89 102 if number_of_full_nodes is None: 90 self.number_of_full_nodes =self.number_of_nodes103 self.number_of_full_nodes = self.number_of_nodes 91 104 else: 92 105 assert int(number_of_full_nodes) 93 self.number_of_full_nodes =number_of_full_nodes106 self.number_of_full_nodes = number_of_full_nodes 94 107 95 108 96 109 if number_of_full_triangles is None: 97 self.number_of_full_triangles =self.number_of_triangles110 self.number_of_full_triangles = self.number_of_triangles 98 111 else: 99 112 assert int(number_of_full_triangles) 100 self.number_of_full_triangles =number_of_full_triangles113 self.number_of_full_triangles = number_of_full_triangles 101 114 102 115 … … 114 127 115 128 # Input checks 116 msg = 'Triangles must an Nx3 Numeric array or a sequence of 3-tuples. '129 msg = 'Triangles must an Mx3 Numeric array or a sequence of 3-tuples. ' 117 130 msg += 'The supplied array has the shape: %s'\ 118 131 %str(self.triangles.shape) 119 132 assert len(self.triangles.shape) == 2, msg 120 133 121 msg = ' Coordinates must an Mx2 Numeric array or a sequence of 2-tuples'134 msg = 'Nodes must an Nx2 Numeric array or a sequence of 2-tuples' 122 135 msg += 'The supplied array has the shape: %s'\ 123 %str(self. coordinates.shape)124 assert len(self. coordinates.shape) == 2, msg136 %str(self.nodes.shape) 137 assert len(self.nodes.shape) == 2, msg 125 138 126 139 msg = 'Vertex indices reference non-existing coordinate sets' 127 assert max(max(self.triangles)) <= self. coordinates.shape[0], msg140 assert max(max(self.triangles)) <= self.nodes.shape[0], msg 128 141 129 142 130 143 # FIXME: Maybe move to statistics? 131 144 # Or use with get_extent 132 xy_extent = [ min(self. coordinates[:,0]), min(self.coordinates[:,1]) ,133 max(self. coordinates[:,0]), max(self.coordinates[:,1]) ]145 xy_extent = [ min(self.nodes[:,0]), min(self.nodes[:,1]) , 146 max(self.nodes[:,0]), max(self.nodes[:,1]) ] 134 147 135 148 self.xy_extent = array(xy_extent, Float) … … 152 165 if verbose and i % ((N+10)/10) == 0: print '(%d/%d)' %(i, N) 153 166 154 155 x0 = V[i, 0]; y0 = V[i, 1] 156 x1 = V[i, 2]; y1 = V[i, 3] 157 x2 = V[i, 4]; y2 = V[i, 5] 167 x0, y0 = V[3*i, :] 168 x1, y1 = V[3*i+1, :] 169 x2, y2 = V[3*i+2, :] 158 170 159 171 # Area … … 210 222 def __repr__(self): 211 223 return 'Mesh: %d vertices, %d triangles'\ 212 %(self. coordinates.shape[0], len(self))224 %(self.nodes.shape[0], len(self)) 213 225 214 226 def get_normals(self): … … 227 239 228 240 229 230 def get_vertex_coordinates(self, unique=False, obj=False, absolute=False): 231 """Return all vertex coordinates. 232 Return all vertex coordinates for all triangles as an Nx6 array 233 (ordered as x0, y0, x1, y1, x2, y2 for each triangle) 234 235 if obj is True, the x/y pairs are returned in a 3*N x 2 array. 236 FIXME, we might make that the default. 237 FIXME Maybe use keyword: continuous = False for this condition? 238 FIXME - Maybe use something referring to unique vertices? 241 def get_nodes(self, absolute=False): 242 """Return all node coordinates ordered in an Nx2 array. 243 This is the same format they were provided in the constructor 244 i.e. without any duplication. 239 245 240 246 Boolean keyword argument absolute determines whether coordinates 241 247 are to be made absolute by taking georeference into account 242 248 Default is False as many parts of ANUGA expects relative coordinates. 243 (To see which, switch to default absolute=True and run tests). 249 (To see which, switch to default absolute=True and run tests). 244 250 """ 245 251 246 252 N = self.number_of_full_nodes 247 248 if unique is True: 249 V = self.coordinates[:N,:] 250 if absolute is True: 251 if not self.geo_reference.is_absolute(): 252 V = self.geo_reference.get_absolute(V) 253 254 return V 255 253 V = self.nodes[:N,:] 254 if absolute is True: 255 if not self.geo_reference.is_absolute(): 256 V = self.geo_reference.get_absolute(V) 256 257 257 258 return V 259 260 261 262 def get_vertex_coordinates(self, unique=False, absolute=False): 263 """Return all vertex coordinates. 264 Return all vertex coordinates for all triangles as a 3*N x 2 array 265 where the jth vertex of the ith triangle is located in row 3*i+j. 266 267 Boolean keyword unique will cause the points to be returned as 268 they were provided in the constructor i.e. without any duplication 269 in an N x 2 array. 270 271 """ 272 273 if unique is True: 274 return self.get_nodes(absolute) 275 276 258 277 V = self.vertex_coordinates 259 278 if absolute is True: 260 279 if not self.geo_reference.is_absolute(): 280 V = self.geo_reference.get_absolute(V) 261 281 262 V0 = self.geo_reference.get_absolute(V[:N,0:2]) 263 V1 = self.geo_reference.get_absolute(V[:N,2:4]) 264 V2 = self.geo_reference.get_absolute(V[:N,4:6]) 265 266 # This does double the memory need 267 V = concatenate( (V0, V1, V2), axis=1 ) 268 269 270 if obj is True: 271 N = V.shape[0] 272 return reshape(V, (3*N, 2)) 273 else: 274 return V 282 return V 283 275 284 276 285 … … 281 290 282 291 V = self.get_vertex_coordinates(absolute=absolute) 283 return V[i, 2*j:2*j+2] 284 285 ##return self.vertex_coordinates[i, 2*j:2*j+2] 292 return V[3*i+j, :] 286 293 287 294 288 295 def compute_vertex_coordinates(self): 289 """Return vertex coordinates for all triangles as an Nx6 array 290 (ordered as x0, y0, x1, y1, x2, y2 for each triangle) 291 """ 292 293 #FIXME (Ole): Perhaps they should be ordered as in obj files?? 294 #See quantity.get_vertex_values 295 #FIXME (Ole) - oh yes they should 296 """Return all vertex coordinates for all triangles as a 3*N x 2 array 297 where the jth vertex of the ith triangle is located in row 3*i+j. 298 299 This function is used to precompute this important structure. Use 300 get_vertex coordinates to retrieve the points. 301 """ 296 302 297 303 N = self.number_of_triangles 298 vertex_coordinates = zeros(( N, 6), Float)304 vertex_coordinates = zeros((3*N, 2), Float) 299 305 300 306 for i in range(N): 301 307 for j in range(3): 302 308 k = self.triangles[i,j] #Index of vertex 0 303 v_k = self.coordinates[k] 304 vertex_coordinates[i, 2*j+0] = v_k[0] 305 vertex_coordinates[i, 2*j+1] = v_k[1] 309 v_k = self.nodes[k] 310 311 vertex_coordinates[3*i+j,:] = v_k 312 306 313 307 314 return vertex_coordinates 315 308 316 309 317 def get_vertices(self, indices=None): … … 358 366 359 367 Preconditions: 360 self. coordinates and self.triangles are defined368 self.nodes and self.triangles are defined 361 369 362 370 Postcondition: … … 364 372 """ 365 373 366 vertexlist = [None]*len(self. coordinates)374 vertexlist = [None]*len(self.nodes) 367 375 for i in range(self.number_of_triangles): 368 376 -
anuga_core/source/anuga/abstract_2d_finite_volumes/generic_boundary_conditions.py
r3931 r3945 220 220 for i, (vol_id, edge_id) in enumerate(boundary_keys): 221 221 222 x0 = V[vol_id, 0]; y0 = V[vol_id, 1] 223 x1 = V[vol_id, 2]; y1 = V[vol_id, 3] 224 x2 = V[vol_id, 4]; y2 = V[vol_id, 5] 225 222 base_index = 3*vol_id 223 x0, y0 = V[base_index, :] 224 x1, y1 = V[base_index+1, :] 225 x2, y2 = V[base_index+2, :] 226 226 227 #Compute midpoints 227 228 if edge_id == 0: m = array([(x1 + x2)/2, (y1 + y2)/2]) -
anuga_core/source/anuga/abstract_2d_finite_volumes/neighbour_mesh.py
r3928 r3945 113 113 if verbose and i % ((N+10)/10) == 0: print '(%d/%d)' %(i, N) 114 114 115 x0 = V[i, 0]; y0 = V[i, 1] 116 x1 = V[i, 2]; y1 = V[i, 3] 117 x2 = V[i, 4]; y2 = V[i, 5] 115 x0, y0 = V[3*i, :] 116 x1, y1 = V[3*i+1, :] 117 x2, y2 = V[3*i+2, :] 118 119 #x0 = V[i, 0]; y0 = V[i, 1] 120 #x1 = V[i, 2]; y1 = V[i, 3] 121 #x2 = V[i, 4]; y2 = V[i, 5] 118 122 119 123 #Compute centroid … … 596 600 #Check each triangle 597 601 for i in range(N): 602 603 x0, y0 = V[3*i, :] 604 x1, y1 = V[3*i+1, :] 605 x2, y2 = V[3*i+2, :] 598 606 599 x0 = V[i, 0]; y0 = V[i, 1]600 x1 = V[i, 2]; y1 = V[i, 3]601 x2 = V[i, 4]; y2 = V[i, 5]602 603 607 #Check that area hasn't been compromised 604 608 area = self.areas[i] -
anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py
r3928 r3945 16 16 17 17 from Numeric import array, zeros, Float, less, concatenate, NewAxis, argmax, allclose 18 from anuga.utilities.numerical_tools import ensure_numeric 18 from anuga.utilities.numerical_tools import ensure_numeric, is_scalar 19 19 20 20 class Quantity: … … 558 558 is_subset = True 559 559 560 561 # FIXME (Ole): Now we can compute the arrays once and for all 562 # for both centroids and vertices and the use set_values_from_array 563 560 564 if location == 'centroids': 561 P= take(self.domain.centroid_coordinates, indices)565 V = take(self.domain.centroid_coordinates, indices) 562 566 if is_subset: 563 self.set_values(f( P[:,0], P[:,1]),567 self.set_values(f(V[:,0], V[:,1]), 564 568 location = location, 565 569 indices = indices) 566 570 else: 567 self.set_values(f( P[:,0], P[:,1]), location = location)571 self.set_values(f(V[:,0], V[:,1]), location = location) 568 572 elif location == 'vertices': 569 P = self.domain.vertex_coordinates 573 V = self.domain.get_vertex_coordinates() 574 575 x = V[:,0]; y = V[:,1]; 576 values = f(x, y) 577 578 if is_scalar(values): 579 # Function returned a constant value 580 self.set_values_from_constant(values, 581 location, indices, verbose) 582 return 583 584 570 585 if is_subset: 571 586 #Brute force 572 for ein indices:573 for iin range(3):574 self.vertex_values[ e,i] = f(P[e,2*i], P[e,2*i+1])587 for i in indices: 588 for j in range(3): 589 self.vertex_values[i,j] = values[3*i+j] 575 590 else: 576 for iin range(3):577 self.vertex_values[:, i] = f(P[:,2*i], P[:,2*i+1])591 for j in range(3): 592 self.vertex_values[:,j] = values[j::3] 578 593 else: 579 594 raise 'Not implemented: %s' %location … … 625 640 raise ms 626 641 627 coordinates = self.domain. coordinates628 triangles = self.domain.triangles 642 coordinates = self.domain.get_nodes() 643 triangles = self.domain.triangles #FIXME 629 644 630 645 … … 910 925 elif location == 'unique vertices': 911 926 if (indices == None): 912 indices=range(self.domain. coordinates.shape[0])927 indices=range(self.domain.number_of_nodes) 913 928 vert_values = [] 914 929 #Go through list of unique vertices … … 958 973 959 974 if indices == None: 960 assert A.shape[0] == self.domain. coordinates.shape[0]975 assert A.shape[0] == self.domain.get_nodes().shape[0] 961 976 vertex_list = range(A.shape[0]) 962 977 else: … … 1085 1100 1086 1101 if xy is True: 1087 X = self.domain. coordinates[:,0].astype(precision)1088 Y = self.domain. coordinates[:,1].astype(precision)1102 X = self.domain.get_nodes()[:,0].astype(precision) 1103 Y = self.domain.get_nodes()[:,1].astype(precision) 1089 1104 1090 1105 return X, Y, A, V … … 1389 1404 from Numeric import zeros, Float 1390 1405 1391 N = len(quantity.domain)1406 N = quantity.domain.number_of_nodes 1392 1407 1393 1408 beta_w = quantity.domain.beta_w -
anuga_core/source/anuga/abstract_2d_finite_volumes/test_general_mesh.py
r3928 r3945 29 29 30 30 31 assert allclose(domain.get_vertex_coordinates(unique=True), domain.coordinates) 31 assert allclose(domain.get_vertex_coordinates(unique=True), 32 domain.nodes) 32 33 33 34 #assert allclose(domain.get_vertex_coordinates(), ...TODO … … 51 52 assert domain.get_vertices([0,4]) == [domain.triangles[0], 52 53 domain.triangles[4]] 54 53 55 def test_areas(self): 54 56 from mesh_factory import rectangular -
anuga_core/source/anuga/abstract_2d_finite_volumes/test_neighbour_mesh.py
r3688 r3945 76 76 77 77 #Vertex coordinates 78 #V = mesh.get_vertex_coordinates() 79 #assert allclose(V[0], [0.0, 0.0, 4.0, 0.0, 0.0, 3.0]) 80 81 78 82 V = mesh.get_vertex_coordinates() 79 assert allclose(V[0], [0.0, 0.0, 4.0, 0.0, 0.0, 3.0])80 81 V = mesh.get_vertex_coordinates(obj=True)82 83 assert allclose(V, [ [0.0, 0.0], 83 84 [4.0, 0.0], … … 104 105 105 106 V = mesh.get_vertex_coordinates() 106 107 x0 = V[0,0] 108 y0 = V[0,1] 109 x1 = V[0,2] 110 y1 = V[0,3] 111 x2 = V[0,4] 112 y2 = V[0,5] 107 x0 = V[0, 0]; y0 = V[0, 1] 108 x1 = V[1, 0]; y1 = V[1, 1] 109 x2 = V[2, 0]; y2 = V[2, 1] 110 #x0 = V[0,0] 111 #y0 = V[0,1] 112 #x1 = V[0,2] 113 #y1 = V[0,3] 114 #x2 = V[0,4] 115 #y2 = V[0,5] 113 116 114 117 m0 = [(x1 + x2)/2, (y1 + y2)/2] … … 172 175 173 176 V = mesh.get_vertex_coordinates() 174 175 x0 = V[0,0] 176 y0 = V[0,1] 177 x1 = V[0,2] 178 y1 = V[0,3] 179 x2 = V[0,4] 180 y2 = V[0,5] 177 x0 = V[0, 0]; y0 = V[0, 1] 178 x1 = V[1, 0]; y1 = V[1, 1] 179 x2 = V[2, 0]; y2 = V[2, 1] 180 181 #x0 = V[0,0] 182 #y0 = V[0,1] 183 #x1 = V[0,2] 184 #y1 = V[0,3] 185 #x2 = V[0,4] 186 #y2 = V[0,5] 181 187 182 188 m0 = [(x1 + x2)/2, (y1 + y2)/2] -
anuga_core/source/anuga/abstract_2d_finite_volumes/test_quantity.py
r3704 r3945 395 395 396 396 397 answer = linear_function(quantity.domain.get_vertex_coordinates( obj = True))397 answer = linear_function(quantity.domain.get_vertex_coordinates()) 398 398 #print quantity.vertex_values, answer 399 399 assert allclose(quantity.vertex_values.flat, answer) … … 401 401 402 402 #Now try by setting the same values directly 403 vertex_attributes = fit_to_mesh(quantity.domain. coordinates,404 quantity.domain.triangles, 403 vertex_attributes = fit_to_mesh(quantity.domain.get_nodes(), 404 quantity.domain.triangles, #FIXME 405 405 data_points, 406 406 z, … … 514 514 quantity.set_values(filename = ptsfile, 515 515 attribute_name = att, alpha = 0) 516 answer = linear_function(quantity.domain.get_vertex_coordinates( obj = True))516 answer = linear_function(quantity.domain.get_vertex_coordinates()) 517 517 518 518 #print quantity.vertex_values.flat … … 592 592 quantity.set_values(filename = ptsfile, 593 593 attribute_name = att, alpha = 0) 594 answer = linear_function(quantity.domain.get_vertex_coordinates( obj = True) - [x0, y0])594 answer = linear_function(quantity.domain.get_vertex_coordinates() - [x0, y0]) 595 595 596 596 assert allclose(quantity.vertex_values.flat, answer) … … 666 666 quantity.set_values(filename = ptsfile, 667 667 attribute_name = att, alpha = 0) 668 answer = linear_function(quantity.domain.get_vertex_coordinates( obj = True) + [x0, y0])668 answer = linear_function(quantity.domain.get_vertex_coordinates() + [x0, y0]) 669 669 670 670 -
anuga_core/source/anuga/fit_interpolate/fit.py
r3633 r3945 93 93 max_vertices_per_cell) 94 94 95 m = self.mesh. coordinates.shape[0] #Nbr of basis functions (vertices)95 m = self.mesh.number_of_nodes # Nbr of basis functions (vertices) 96 96 97 97 self.AtA = None … … 152 152 #"element stiffness matrices: 153 153 154 m = self.mesh. coordinates.shape[0] #Nbr of basis functions (1/vertex)154 m = self.mesh.number_of_nodes # Nbr of basis functions (1/vertex) 155 155 156 156 self.D = Sparse(m,m) … … 233 233 if self.AtA == None: 234 234 # AtA and Atz need ot be initialised. 235 m = self.mesh. coordinates.shape[0] #Nbr of vertices235 m = self.mesh.number_of_nodes 236 236 if len(z.shape) > 1: 237 237 att_num = z.shape[1] … … 316 316 317 317 #Check sanity 318 m = self.mesh. coordinates.shape[0] #Nbr of basis functions (1/vertex)318 m = self.mesh.number_of_nodes # Nbr of basis functions (1/vertex) 319 319 n = self.point_count 320 320 if n<m and self.alpha == 0.0: -
anuga_core/source/anuga/fit_interpolate/interpolate.py
r3941 r3945 257 257 print '\n WARNING: No points within the mesh! \n' 258 258 259 m = self.mesh. coordinates.shape[0] #Nbr of basis functions (1/vertex)260 n = point_coordinates.shape[0] #Nbr of data points259 m = self.mesh.number_of_nodes # Nbr of basis functions (1/vertex) 260 n = point_coordinates.shape[0] # Nbr of data points 261 261 262 262 if verbose: print 'Number of datapoints: %d' %n -
anuga_core/source/anuga/utilities/numerical_tools.py
r3850 r3945 61 61 if x < 0: return -1 62 62 if x == 0: return 0 63 63 64 65 def is_scalar(x): 66 """True if x is a scalar (constant numeric value) 67 """ 68 69 from types import IntType, FloatType 70 if type(x) in [IntType, FloatType]: 71 return True 72 else: 73 return False 64 74 65 75 def angle(v1, v2=None): -
anuga_core/source/anuga/utilities/quad.py
r3566 r3945 139 139 if len(args) == 2: 140 140 point_id = int(args[1]) 141 x = self.__class__.mesh.coordinates[point_id][0] 142 y = self.__class__.mesh.coordinates[point_id][1] 141 x, y = self.__class__.mesh.get_nodes()[point_id] 143 142 144 143 #print point_id, x, y … … 394 393 #Make root cell 395 394 #print mesh.coordinates 396 397 xmin = min(mesh.coordinates[:,0]) 398 xmax = max(mesh.coordinates[:,0]) 399 ymin = min(mesh.coordinates[:,1]) 400 ymax = max(mesh.coordinates[:,1]) 395 396 nodes = mesh.get_nodes() 397 xmin = min(nodes[:,0]) 398 xmax = max(nodes[:,0]) 399 ymin = min(nodes[:,1]) 400 ymax = max(nodes[:,1]) 401 401 402 402 … … 425 425 426 426 #Insert indices of all vertices 427 root.insert( range( len(mesh.coordinates)) )427 root.insert( range(mesh.number_of_nodes) ) 428 428 429 429 #Build quad tree and return -
anuga_core/source/anuga/utilities/test_quad.py
r3566 r3945 120 120 121 121 Q = build_quadtree(self.mesh) 122 #Q.show() 123 #print Q.count() 122 124 assert Q.count() == 8 123 125 124 #Q.show() 126 125 127 126 128 result = Q.search(3, 105)
Note: See TracChangeset
for help on using the changeset viewer.