Changeset 2091


Ignore:
Timestamp:
Nov 29, 2005, 1:54:52 PM (19 years ago)
Author:
linda
Message:

nomsg

Location:
inundation/parallel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/parallel/build_local.py

    r2090 r2091  
    1313#
    1414#  Authors: Linda Stals and Matthew Hardy, June 2005
     15#  Modified: Linda Stals, Nov 2005 (optimise python code)
    1516#
    1617#
     
    8485# *) full_recv dictionary is local id, global id, value
    8586#
    86 # *) The information is ordered by the global id so the
    87 # local and global id do not need to be compared when the
    88 # information is sent/received because the order is
    89 # 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.
    9091#
    9192#########################################################
     
    132133        full_send[neigh][1] = neigh_commun[:,0]
    133134
    134     # parallel advection expects numeric arrays
    135 
    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 
    144135    return ghost_recv, full_send
    145136
     
    152143# *) Change the nodes global ID's to an integer value,
    153144# starting from 0. The node numbering in the triangles
    154 # must also be updated to take this into accound.
     145# must also be updated to take this into account.
    155146#
    156147# *) 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
    114import sys
    215from mesh import *
     
    5669                subboundary[k]=boundary[k]
    5770        boundary_list.append(subboundary)
    58 
    59         #
     71       
    6072        # find nodes in processor p
    6173
     
    281293        # loop over the ghost triangles in the current processor,
    282294        # find which processor contains the corresponding full copy
    283         # and make note that that processor must send updates to this
     295        # and note that the processor must send updates to this
    284296        # processor
    285297
     
    360372    return submesh
    361373
     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
    362393def submesh_quantities(submesh, quantities, triangles_per_proc):
    363394   
     
    366397    lower = 0
    367398
     399    # build an empty dictionary to hold the quantites
     400   
    368401    submesh["full_quan"] = {}
    369402    submesh["ghost_quan"] = {}
    370 
    371403    for k in quantities:
    372404        submesh["full_quan"][k] = []
    373405        submesh["ghost_quan"][k] = []
    374                    
     406
     407    # loop trough the subdomains
     408   
    375409    for p in range(nproc):
    376410        upper =   lower+triangles_per_proc[p]
    377411
     412        # find the global ID of the ghost triangles
     413       
    378414        global_id = []
    379415        M = len(submesh["ghost_triangles"][p])
     
    381417            global_id.append(submesh["ghost_triangles"][p][j][0])
    382418
     419        # use the global ID to extract the quantites information from
     420        # the full domain
     421       
    383422        for k in quantities:
    384423            submesh["full_quan"][k].append(quantities[k][lower:upper])
     
    421460
    422461    submeshg = submesh_ghost(submeshf, mesh, triangles_per_proc)
     462
     463    # order the quantities information to be the same as the triangle
     464    # information
    423465   
    424466    submesh = submesh_quantities(submeshg, quantities, triangles_per_proc)
Note: See TracChangeset for help on using the changeset viewer.