Ignore:
Timestamp:
Dec 1, 2005, 6:04:45 PM (19 years ago)
Author:
steve
Message:

Updating merimbula code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/parallel/build_submesh.py

    r2102 r2105  
    5151    submesh = {}
    5252    tsubnodes = concatenate((reshape(arrayrange(nnodes),(nnodes,1)), nodes), 1)
    53    
     53
    5454    # loop over processors
    5555
     
    6363
    6464        # find the boundary edges on processor p
    65        
     65
    6666        subboundary = {}
    6767        for k in boundary:
     
    6969                subboundary[k]=boundary[k]
    7070        boundary_list.append(subboundary)
    71        
     71
    7272        # find nodes in processor p
    7373
     
    7777            nodemap[t[1]]=1
    7878            nodemap[t[2]]=1
    79                    
     79
    8080        node_list.append(take(tsubnodes,nonzero(nodemap)))
    8181
     
    127127    ncoord = len(mesh.coordinates)
    128128    ntriangles = len(mesh.triangles)
    129    
     129
    130130    # find the first layer of boundary triangles
    131131
     
    166166    nodemap = zeros(ncoord, 'i')
    167167    fullnodes = submesh["full_nodes"][p]
    168    
     168
    169169    subtriangles = []
    170170    for i in range(len(trianglemap)):
     
    178178    tsubtriangles = concatenate((trilist, mesh.triangles), 1)
    179179    subtriangles = take(tsubtriangles, nonzero(trianglemap))
    180    
     180
    181181    # keep a record of the triangle vertices, if they are not already there
    182182
     
    188188    tsubnodes = concatenate((nodelist, mesh.coordinates), 1)
    189189    subnodes = take(tsubnodes, nonzero(nodemap))
    190      
     190
    191191    # clean up before exiting
    192192
     
    223223
    224224    ghost_commun = zeros((len(subtri), 2), Int)
    225    
     225
    226226    for i in range(len(subtri)):
    227227        global_no = subtri[i][0]
     
    241241
    242242        ghost_commun[i] = [global_no, neigh]
    243    
     243
    244244    return ghost_commun
    245245
     
    343343
    344344        # build the ghost boundary layer
    345        
     345
    346346        [subnodes, subtri] = ghost_layer(submesh, mesh, p, tupper, tlower)
    347347        ghost_triangles.append(subtri)
    348348        ghost_nodes.append(subnodes)
    349    
     349
    350350        # build the communication pattern for the ghost nodes
    351351
     
    392392
    393393def submesh_quantities(submesh, quantities, triangles_per_proc):
    394    
     394
    395395    nproc = len(triangles_per_proc)
    396396
     
    398398
    399399    # build an empty dictionary to hold the quantites
    400    
     400
    401401    submesh["full_quan"] = {}
    402402    submesh["ghost_quan"] = {}
     
    406406
    407407    # loop trough the subdomains
    408    
     408
    409409    for p in range(nproc):
    410410        upper =   lower+triangles_per_proc[p]
    411411
    412412        # find the global ID of the ghost triangles
    413        
     413
    414414        global_id = []
    415415        M = len(submesh["ghost_triangles"][p])
     
    419419        # use the global ID to extract the quantites information from
    420420        # the full domain
    421        
     421
    422422        for k in quantities:
    423423            submesh["full_quan"][k].append(quantities[k][lower:upper])
     
    456456
    457457    submeshf = submesh_full(nodes, triangles, edges, triangles_per_proc)
    458        
     458
    459459    # add any extra ghost boundary layer information
    460460
     
    463463    # order the quantities information to be the same as the triangle
    464464    # information
    465    
     465
    466466    submesh = submesh_quantities(submeshg, quantities, triangles_per_proc)
    467    
     467
    468468    return submesh
    469469
     
    498498        submesh_cell["full_quan"][k] = submesh["full_quan"][k][0]
    499499        submesh_cell["ghost_quan"][k] = submesh["ghost_quan"][k][0]
    500        
     500
    501501    return submesh_cell
    502502
    503 
Note: See TracChangeset for help on using the changeset viewer.