Changeset 1158
- Timestamp:
- Mar 29, 2005, 4:19:37 PM (19 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/least_squares.py
r1154 r1158 305 305 self.mesh = Mesh(vertex_coordinates, triangles, 306 306 origin = mesh_origin) 307 #FIXME, remove if mesh checks it. 308 self.mesh.check_integrity() 307 309 self.data_origin = data_origin 308 310 -
inundation/ga/storm_surge/pyvolution/mesh.py
r1011 r1158 133 133 #self.build_boundary_structure() 134 134 135 #FIXME check integrity? 135 136 136 137 def __repr__(self): … … 161 162 a = self.triangles[i, 0] 162 163 b = self.triangles[i, 1] 163 c = self.triangles[i, 2] 164 c = self.triangles[i, 2] 165 if neighbourdict.has_key((a,b)): 166 msg = "Edge 2 of triangle %d is duplicating edge %d of triangle %d.\n" %(i,neighbourdict[a,b][1],neighbourdict[a,b][0]) 167 raise msg 168 if neighbourdict.has_key((b,c)): 169 msg = "Edge 0 of triangle %d is duplicating edge %d of triangle %d.\n" %(i,neighbourdict[b,c][1],neighbourdict[b,c][0]) 170 raise msg 171 if neighbourdict.has_key((c,a)): 172 msg = "Edge 1 of triangle %d is duplicating edge %d of triangle %d.\n" %(i,neighbourdict[c,a][1],neighbourdict[c,a][0]) 173 raise msg 174 164 175 neighbourdict[a,b] = (i, 2) #(id, edge) 165 176 neighbourdict[b,c] = (i, 0) #(id, edge) … … 472 483 msg = 'Some points do not belong to an element.\n' 473 484 msg += 'Make sure all points appear as element vertices!' 474 if v is None: 475 print 'WARNING (mesh.py): %s' %msg 476 break 477 478 479 485 assert v is not None, msg 486 480 487 #Check integrity of neighbour structure 481 488 for i in range(N): … … 498 505 if neighbour_id >= 0: 499 506 edge = self.neighbour_edges[i, k] 500 assert self.neighbours[neighbour_id, edge] == i 507 msg = 'Triangle %d has neighbour %d but it does not point back. \n' %(i,neighbour_id) 508 msg += 'Only points to (%s)' %(self.neighbours[neighbour_id,:]) 509 assert self.neighbours[neighbour_id, edge] == i ,msg 501 510 502 511 -
inundation/ga/storm_surge/pyvolution/test_advection.py
r1150 r1158 26 26 points = [a, b, c, d, e, f] 27 27 #bac, bce, ecf, dbe, daf, dae 28 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4] , [3,0,5], [3,0,4]]28 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]] 29 29 30 30 domain = Domain(points, vertices) -
inundation/ga/storm_surge/pyvolution/test_domain.py
r1018 r1158 51 51 points = [a, b, c, d, e, f] 52 52 #bac, bce, ecf, dbe, daf, dae 53 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4] , [3,0,5], [3,0,4]]53 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]] 54 54 55 55 conserved_quantities = ['stage', 'xmomentum', 'ymomentum'] … … 78 78 points = [a, b, c, d, e, f] 79 79 #bac, bce, ecf, dbe, daf, dae 80 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4] , [3,0,5], [3,0,4]]80 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]] 81 81 82 82 domain = Domain(points, vertices, boundary=None, … … 86 86 87 87 domain.set_quantity('stage', [[1,2,3], [5,5,5], 88 [0,0,9], [-6, 3, 3], 89 [0,0,0], [0,0,0]]) 88 [0,0,9], [-6, 3, 3]]) 90 89 91 90 domain.set_quantity('xmomentum', [[1,2,3], [5,5,5], 92 [0,0,9], [-6, 3, 3], 93 [0,0,0], [0,0,0]]) 91 [0,0,9], [-6, 3, 3]]) 94 92 95 93 domain.check_integrity() -
inundation/ga/storm_surge/pyvolution/test_least_squares.py
r1097 r1158 201 201 [3, 2, 1], 202 202 [0, 2, 4], 203 [0, 2, 4],204 203 [4, 2, 5], 205 204 [5, 2, 3]] … … 534 533 535 534 vertices = [a, b, c, d] 536 triangles = [ [1,0,2], [2,3, 0] ] #bac, cdb535 triangles = [ [1,0,2], [2,3,1] ] #bac, cdb 537 536 538 537 #Points within triangle 1 -
inundation/ga/storm_surge/pyvolution/test_mesh.py
r1018 r1158 241 241 points = [a, b, c, d, e, f] 242 242 #bac, bce, ecf, dbe, daf, dae 243 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4] , [3,0,5], [3,0,4]]243 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]] 244 244 mesh = Mesh(points, vertices) 245 245 … … 251 251 assert mesh.areas[2] == 2.0 252 252 assert mesh.areas[3] == 2.0 253 assert mesh.areas[4] == 8.0254 assert mesh.areas[5] == 4.0255 253 256 254 assert mesh.edgelengths[1,0] == 2.0 … … 262 260 assert allclose(mesh.centroid_coordinates[2], [8.0/3, 2.0/3]) 263 261 assert allclose(mesh.centroid_coordinates[3], [2.0/3, 8.0/3]) 264 265 262 266 263 def test_mesh_and_neighbours(self): … … 329 326 330 327 328 def test_build_neighbour_structure_duplicates(self): 329 p0 = [-66.0, 14.0] 330 p1 = [14.0, -66.0] 331 p2 = [14.0, 14.0] 332 p3 = [60.0, 20.0] 333 p4 = [10.0, 60.0] 334 p5 = [60.0, 60.0] 335 336 points = [p0, p1, p2, p3, p4, p5] 337 triangles = [ [0, 1, 2], 338 [3, 2, 1], 339 [0, 2, 4], 340 [0, 2, 4], 341 [4, 2, 5], 342 [5, 2, 3]] 343 try: 344 mesh = Mesh(points, triangles) 345 except: 346 pass 347 else: 348 raise "triangle edge duplicates not caught" 349 331 350 def test_rectangular_mesh_basic(self): 332 351 M=1 -
inundation/ga/storm_surge/pyvolution/test_shallow_water.py
r1027 r1158 197 197 points = [a, b, c, d, e, f] 198 198 #bac, bce, ecf, dbe, daf, dae 199 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4] , [3,0,5], [3,0,4]]199 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]] 200 200 201 201 domain = Domain(points, vertices)
Note: See TracChangeset
for help on using the changeset viewer.