Ignore:
Timestamp:
Sep 14, 2006, 2:40:38 PM (17 years ago)
Author:
ole
Message:

Got first version of parallel api going

Still todo: Communicate all attributes of domain such as name and also boundary conditions across to other processes automatically.

File:
1 edited

Legend:

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

    r3588 r3593  
    2121processor_name = pypar.Get_processor_name()
    2222print 'I am processor %d of %d on node %s' %(myid, numprocs, processor_name)
     23
     24
     25
     26
     27def distribute(domain):
     28
     29    if myid == 0:
     30        #-------------------------------------------------------------------
     31        # Distribute the domain
     32        #-------------------------------------------------------------------
     33
     34        points, vertices, boundary, quantities,\
     35                ghost_recv_dict, full_send_dict,\
     36                = distribute_mesh(domain)
     37        print 'Communication done'       
     38       
     39    else:
     40        # 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
     44        points, vertices, boundary, quantities,\
     45                ghost_recv_dict, full_send_dict,\
     46                = rec_submesh(0)
     47
     48    #------------------------------------------------------------------------
     49    # Start the computations on each subpartion
     50    #------------------------------------------------------------------------
     51
     52    # Build the domain for this processor
     53    domain = Parallel_Domain(points, vertices, boundary,
     54                             full_send_dict  = full_send_dict,
     55                             ghost_recv_dict = ghost_recv_dict)
     56
     57    #------------------------------------------------------------------------
     58    # Setup initial conditions
     59    #------------------------------------------------------------------------
     60    for q in quantities:
     61        domain.set_quantity(q, quantities[q]) # Distribute all quantities   
     62
     63
     64    #------------------------------------------------------------------------
     65    # Return parallel domain to all nodes
     66    #------------------------------------------------------------------------
     67    return domain   
     68
     69
     70
    2371
    2472
Note: See TracChangeset for help on using the changeset viewer.