Changeset 2105 for inundation/parallel/build_submesh.py
- Timestamp:
- Dec 1, 2005, 6:04:45 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/parallel/build_submesh.py
r2102 r2105 51 51 submesh = {} 52 52 tsubnodes = concatenate((reshape(arrayrange(nnodes),(nnodes,1)), nodes), 1) 53 53 54 54 # loop over processors 55 55 … … 63 63 64 64 # find the boundary edges on processor p 65 65 66 66 subboundary = {} 67 67 for k in boundary: … … 69 69 subboundary[k]=boundary[k] 70 70 boundary_list.append(subboundary) 71 71 72 72 # find nodes in processor p 73 73 … … 77 77 nodemap[t[1]]=1 78 78 nodemap[t[2]]=1 79 79 80 80 node_list.append(take(tsubnodes,nonzero(nodemap))) 81 81 … … 127 127 ncoord = len(mesh.coordinates) 128 128 ntriangles = len(mesh.triangles) 129 129 130 130 # find the first layer of boundary triangles 131 131 … … 166 166 nodemap = zeros(ncoord, 'i') 167 167 fullnodes = submesh["full_nodes"][p] 168 168 169 169 subtriangles = [] 170 170 for i in range(len(trianglemap)): … … 178 178 tsubtriangles = concatenate((trilist, mesh.triangles), 1) 179 179 subtriangles = take(tsubtriangles, nonzero(trianglemap)) 180 180 181 181 # keep a record of the triangle vertices, if they are not already there 182 182 … … 188 188 tsubnodes = concatenate((nodelist, mesh.coordinates), 1) 189 189 subnodes = take(tsubnodes, nonzero(nodemap)) 190 190 191 191 # clean up before exiting 192 192 … … 223 223 224 224 ghost_commun = zeros((len(subtri), 2), Int) 225 225 226 226 for i in range(len(subtri)): 227 227 global_no = subtri[i][0] … … 241 241 242 242 ghost_commun[i] = [global_no, neigh] 243 243 244 244 return ghost_commun 245 245 … … 343 343 344 344 # build the ghost boundary layer 345 345 346 346 [subnodes, subtri] = ghost_layer(submesh, mesh, p, tupper, tlower) 347 347 ghost_triangles.append(subtri) 348 348 ghost_nodes.append(subnodes) 349 349 350 350 # build the communication pattern for the ghost nodes 351 351 … … 392 392 393 393 def submesh_quantities(submesh, quantities, triangles_per_proc): 394 394 395 395 nproc = len(triangles_per_proc) 396 396 … … 398 398 399 399 # build an empty dictionary to hold the quantites 400 400 401 401 submesh["full_quan"] = {} 402 402 submesh["ghost_quan"] = {} … … 406 406 407 407 # loop trough the subdomains 408 408 409 409 for p in range(nproc): 410 410 upper = lower+triangles_per_proc[p] 411 411 412 412 # find the global ID of the ghost triangles 413 413 414 414 global_id = [] 415 415 M = len(submesh["ghost_triangles"][p]) … … 419 419 # use the global ID to extract the quantites information from 420 420 # the full domain 421 421 422 422 for k in quantities: 423 423 submesh["full_quan"][k].append(quantities[k][lower:upper]) … … 456 456 457 457 submeshf = submesh_full(nodes, triangles, edges, triangles_per_proc) 458 458 459 459 # add any extra ghost boundary layer information 460 460 … … 463 463 # order the quantities information to be the same as the triangle 464 464 # information 465 465 466 466 submesh = submesh_quantities(submeshg, quantities, triangles_per_proc) 467 467 468 468 return submesh 469 469 … … 498 498 submesh_cell["full_quan"][k] = submesh["full_quan"][k][0] 499 499 submesh_cell["ghost_quan"][k] = submesh["ghost_quan"][k][0] 500 500 501 501 return submesh_cell 502 502 503
Note: See TracChangeset
for help on using the changeset viewer.