Ignore:
Timestamp:
Sep 14, 2006, 3:59:27 PM (18 years ago)
Author:
ole
Message:

Arranged for domain name to be communicated automatically in the parallel API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga_parallel/parallel_api.py

    r3593 r3595  
    2525
    2626
    27 def distribute(domain):
     27def distribute(domain, verbose=False):
     28    """ Distribute the domain to all processes
     29    """
     30
     31    # For some obscure reason this communication must happen prior to
     32    # the more complex mesh distribution - Oh Well!
     33    if myid == 0:
     34        domain_name = domain.get_name()
     35        for p in range(1, numprocs):
     36            print 'p', p           
     37            pypar.send(domain_name, p)
     38    else:
     39        if verbose: print 'Receiving'
     40
     41        domain_name = pypar.receive(0)
     42
    2843
    2944    if myid == 0:
    30         #-------------------------------------------------------------------
    31         # Distribute the domain
    32         #-------------------------------------------------------------------
     45        # Partition and distribute mesh.
     46        # Structures returned is in the
     47        # correct form for the ANUGA data structure
     48
    3349
    3450        points, vertices, boundary, quantities,\
    3551                ghost_recv_dict, full_send_dict,\
    3652                = distribute_mesh(domain)
    37         print 'Communication done'       
     53
     54        if verbose: print 'Communication done'
    3855       
    3956    else:
    4057        # Read in the mesh partition that belongs to this
    41         # processor (note that the information is in the
    42         # correct form for the GA data structure)
    43 
     58        # processor
    4459        points, vertices, boundary, quantities,\
    4560                ghost_recv_dict, full_send_dict,\
    4661                = rec_submesh(0)
    4762
     63
     64
    4865    #------------------------------------------------------------------------
    49     # Start the computations on each subpartion
     66    # Build the domain for this processor using partion structures
    5067    #------------------------------------------------------------------------
    51 
    52     # Build the domain for this processor
    5368    domain = Parallel_Domain(points, vertices, boundary,
    5469                             full_send_dict  = full_send_dict,
     
    5671
    5772    #------------------------------------------------------------------------
    58     # Setup initial conditions
     73    # Transfer initial conditions to each subdomain
    5974    #------------------------------------------------------------------------
    6075    for q in quantities:
    61         domain.set_quantity(q, quantities[q]) # Distribute all quantities   
     76        domain.set_quantity(q, quantities[q])
    6277
     78
     79    #------------------------------------------------------------------------
     80    # Transfer other attributes to each subdomain
     81    #------------------------------------------------------------------------
     82
     83    # FIXME Do them all
     84    domain.set_name(domain_name)   
    6385
    6486    #------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.