Changeset 2091
- Timestamp:
- Nov 29, 2005, 1:54:52 PM (19 years ago)
- Location:
- inundation/parallel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/parallel/build_local.py
r2090 r2091 13 13 # 14 14 # Authors: Linda Stals and Matthew Hardy, June 2005 15 # Modified: Linda Stals, Nov 2005 (optimise python code) 15 16 # 16 17 # … … 84 85 # *) full_recv dictionary is local id, global id, value 85 86 # 86 # *) The information is ordered by the global id so the87 # local and global id do not need to be compared when the88 # information is sent/received because the order is89 # predetermined.87 # *) The information is ordered by the global id. This 88 # means that the communication order is predetermined and 89 # local and global id do not need to be 90 # compared when the information is sent/received. 90 91 # 91 92 ######################################################### … … 132 133 full_send[neigh][1] = neigh_commun[:,0] 133 134 134 # parallel advection expects numeric arrays135 136 ## for key in full_send:137 ## full_send[key][0] = array(full_send[key][0],Int)138 ## full_send[key][1] = array(full_send[key][1],Int)139 140 ## for key in ghost_recv:141 ## ghost_recv[key][0] = array(ghost_recv[key][0],Int)142 ## ghost_recv[key][1] = array(ghost_recv[key][1],Int)143 144 135 return ghost_recv, full_send 145 136 … … 152 143 # *) Change the nodes global ID's to an integer value, 153 144 # starting from 0. The node numbering in the triangles 154 # must also be updated to take this into accoun d.145 # must also be updated to take this into account. 155 146 # 156 147 # *) The triangle number will also change, which affects -
inundation/parallel/build_submesh.py
r2090 r2091 1 ######################################################### 2 # 3 # Subdivide the GA domain. This module is primarily 4 # responsible for building the ghost layer and 5 # communication pattern 6 # 7 # 8 # Author: Linda Stals, June 2005 9 # Modified: Linda Stals, Nov 2005 (optimise python code) 10 # 11 # 12 ######################################################### 13 1 14 import sys 2 15 from mesh import * … … 56 69 subboundary[k]=boundary[k] 57 70 boundary_list.append(subboundary) 58 59 # 71 60 72 # find nodes in processor p 61 73 … … 281 293 # loop over the ghost triangles in the current processor, 282 294 # find which processor contains the corresponding full copy 283 # and make note that thatprocessor must send updates to this295 # and note that the processor must send updates to this 284 296 # processor 285 297 … … 360 372 return submesh 361 373 374 375 ######################################################### 376 # 377 # Certain quantities may be assigned to the triangles, 378 # these quantities must be subdivided in the same way 379 # as the triangles 380 # 381 # *) The quantities are ordered in the same way as the 382 # triangles 383 # 384 # ------------------------------------------------------- 385 # 386 # *) The quantites attached to the full triangles are 387 # stored in full_quan 388 # 389 # *) The quantities attached to the ghost triangles are 390 # stored in ghost_quan 391 ######################################################### 392 362 393 def submesh_quantities(submesh, quantities, triangles_per_proc): 363 394 … … 366 397 lower = 0 367 398 399 # build an empty dictionary to hold the quantites 400 368 401 submesh["full_quan"] = {} 369 402 submesh["ghost_quan"] = {} 370 371 403 for k in quantities: 372 404 submesh["full_quan"][k] = [] 373 405 submesh["ghost_quan"][k] = [] 374 406 407 # loop trough the subdomains 408 375 409 for p in range(nproc): 376 410 upper = lower+triangles_per_proc[p] 377 411 412 # find the global ID of the ghost triangles 413 378 414 global_id = [] 379 415 M = len(submesh["ghost_triangles"][p]) … … 381 417 global_id.append(submesh["ghost_triangles"][p][j][0]) 382 418 419 # use the global ID to extract the quantites information from 420 # the full domain 421 383 422 for k in quantities: 384 423 submesh["full_quan"][k].append(quantities[k][lower:upper]) … … 421 460 422 461 submeshg = submesh_ghost(submeshf, mesh, triangles_per_proc) 462 463 # order the quantities information to be the same as the triangle 464 # information 423 465 424 466 submesh = submesh_quantities(submeshg, quantities, triangles_per_proc)
Note: See TracChangeset
for help on using the changeset viewer.