Changeset 1555


Ignore:
Timestamp:
Jun 29, 2005, 1:16:23 PM (19 years ago)
Author:
linda
Message:

subdivide pmesh and cleanup tagmap

Location:
inundation/ga/storm_surge/parallel
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/parallel/build_commun.py

    r1520 r1555  
    4646#########################################################
    4747
    48 def send_submesh(submesh, triangles_per_proc, tagmap, p):
     48def send_submesh(submesh, triangles_per_proc, p):
     49
     50    print "pypar sending submesh to processor ",p
     51
     52    # build and send the tagmap for the boundary conditions
     53   
     54    tagmap = {}
     55    counter = 1
     56    for b in submesh["full_boundary"][p]:
     57         bkey = submesh["full_boundary"][p][b]
     58         if not tagmap.has_key(bkey):
     59             tagmap[bkey] = counter
     60             counter = counter+1
     61
     62    pypar.send(tagmap, p)
    4963
    5064    # send the number of triangles per processor
    5165
    52     print "pypar send triangles per proc",p
    5366    pypar.send(triangles_per_proc, p, use_buffer=True)
    5467
     
    7285    setup_array[5] = len(submesh["ghost_commun"][p])
    7386    setup_array[6] = len(flat_full_commun)
    74     print "pypar send setup_array", p
     87
    7588    pypar.send(setup_array, p)
    7689
    7790    # send the nodes
    7891
    79     print "pypar send full_nodes", p
    8092    pypar.send(submesh["full_nodes"][p], p, use_buffer=True)
    81 
    82     print "pypar send ghost_nodes", p
    8393    pypar.send(submesh["ghost_nodes"][p], p, use_buffer=True)
    8494
    8595    # send the triangles
    8696
    87     print "pypar send full_triangles", p
     97
    8898    pypar.send(submesh["full_triangles"][p], p, use_buffer=True)
    89 
    90     print "pypar send ghost_triangles", p
    9199    pypar.send(submesh["ghost_triangles"][p], p, use_buffer=True)
    92100
    93101    # send the boundary (is it quicker to send as an array?)
    94102
    95     print "pypar send full_boundary", p
    96103    bc = []
    97104    for b in submesh["full_boundary"][p]:
     
    101108    # send the communication pattern
    102109
    103     print "pypar send ghost_commun", p, len(submesh["ghost_commun"][p])
    104110    pypar.send(submesh["ghost_commun"][p], p, use_buffer=True)
    105 
    106     print "pypar send full_commun", p, len(flat_full_commun)
    107111    pypar.send(flat_full_commun, p, use_buffer=True)
    108112
     
    126130#########################################################
    127131
    128 def rec_submesh(tagmap, p):
     132def rec_submesh(p):
    129133
    130134    from Numeric import zeros, Float, Int
     
    134138
    135139    submesh_cell = {}
     140   
     141    print "pypar receiving submesh from processor ",p
     142
     143    # receive the tagmap for the boundary conditions
     144   
     145    tagmap = pypar.receive(p)
    136146
    137147    # receive the number of triangles per processor
     
    141151        triangles_per_proc.append([0])
    142152
    143     print "pypar rec triangles_per_proc", p
    144153    triangles_per_proc = pypar.receive(p, triangles_per_proc)
    145154
     
    147156
    148157    setup_array = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
    149     print "pypar rec setup_array", p
    150158    setup_array = pypar.receive(p, setup_array)
    151159
     
    156164    for i in range(no_full_nodes):
    157165        full_nodes.append([0.0, 0.0, 0.0])
    158     print "pypar rec full_nodes ", p
    159166    submesh_cell["full_nodes"] = pypar.receive(p, full_nodes)
    160167
     
    165172    for i in range(no_ghost_nodes):
    166173        ghost_nodes.append([0, 0.0, 0.0])
    167     print "pypar rec ghost_nodes ", p
    168174    submesh_cell["ghost_nodes"] = pypar.receive(p, ghost_nodes)
    169175
     
    174180    for i in range(no_full_triangles):
    175181        full_triangles.append([0.0, 0.0, 0.0])
    176     print "pypar rec full_triangles", p
    177182    submesh_cell["full_triangles"] = pypar.receive(p, full_triangles)
    178183
     
    183188    for i in range(no_ghost_triangles):
    184189        ghost_triangles.append([0, [0.0, 0.0, 0.0]])
    185     print "pypar rec ghost_triangles", p
    186190    submesh_cell["ghost_triangles"] = pypar.receive(p, ghost_triangles)
    187191
    188192    # receive the full boundary
    189193
    190     print "pypar rec full_boundary", p
    191194    no_full_boundary = setup_array[4]
    192195    bc = []
     
    209212    for i in range(no_ghost_commun):
    210213        ghost_commun.append([0.0, 0.0])
    211     print "pypar rec ghost_commun", p, len(ghost_commun)
     214
    212215    submesh_cell["ghost_commun"] = pypar.receive(p, ghost_commun)
    213 
    214216
    215217    # receive the full communication pattern
     
    219221    for i in range(no_full_commun):
    220222        full_commun.append([0.0, 0.0])
    221     print "pypar rec full_commun", p
     223
    222224    full_commun = pypar.receive(p, full_commun)
    223225
  • inundation/ga/storm_surge/parallel/run_parallel_mesh.py

    r1550 r1555  
    2525#
    2626# *) Things still to do:
    27 #    +) Fix tagmap: this is a hack used to communicate
    28 # the boundary tag information, it should be removed
    2927#    +) Fix host commun: The host processor (processor 0)
    3028# currently uses MPI to communicate the submesh to itself.
     
    8987print "PROCESSOR ", myid, " HAS STARTED"
    9088
    91 # hack to allow communication of the boundary tag
    92 # information (will be removed)
    93 
    94 tagmap={}
    95 tagmap['37']=1
    96 
    9789# if this is the host processor
    9890
     
    108100    f=open('test_3l_2c.out', 'r')
    109101    [nodes, triangles, boundary, triangles_per_proc] = mg2ga(f)
    110 
     102   
    111103    # subdivide the mesh
    112104   
     
    116108   
    117109    for p in range(numprocs):
    118       send_submesh(submesh, triangles_per_proc, tagmap, p)
     110      send_submesh(submesh, triangles_per_proc, p)
    119111
    120112# read in the mesh partition that belongs to this
     
    122114# correct form for the GA data structure
    123115
    124 [points, vertices, boundary, ghost_recv_dict, full_send_dict] = rec_submesh(tagmap, 0)
     116[points, vertices, boundary, ghost_recv_dict, full_send_dict] = rec_submesh(0)
    125117
    126118# define the computation domain
     
    170162
    171163 
    172 print "`````````````````````````````"
    173164pypar.finalize()
    174 print "@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
Note: See TracChangeset for help on using the changeset viewer.