Changeset 3926


Ignore:
Timestamp:
Nov 7, 2006, 10:57:58 AM (16 years ago)
Author:
ole
Message:

First step towards keeping track of full nodes and triangles in
parallel domains.

Location:
anuga_core/source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py

    r3850 r3926  
    4646                 ghost_recv_dict=None,
    4747                 processor=0,
    48                  numproc=1):
     48                 numproc=1,
     49                 number_of_full_nodes=0,
     50                 number_of_full_triangles=0):
    4951
    5052
     
    126128
    127129        # List of other quantity names
    128         if ghost_recv_dict  is None:
    129             self.ghost_recv_dict  = {}
     130        if ghost_recv_dict is None:
     131            self.ghost_recv_dict = {}
    130132        else:
    131             self.ghost_recv_dict  = ghost_recv_dict
     133            self.ghost_recv_dict = ghost_recv_dict
    132134
    133135        self.processor = processor
    134         self.numproc   = numproc
     136        self.numproc = numproc
     137
     138        self.number_of_full_nodes=number_of_full_nodes
     139        self.number_of_full_triangles=number_of_full_triangles
     140       
    135141
    136142        # Setup Communication Buffers
    137 
    138143        if verbose: print 'Domain: Set up communication buffers (parallel)'
    139144        self.nsys = len(self.conserved_quantities)
  • anuga_core/source/anuga/shallow_water/data_manager.py

    r3846 r3926  
    356356        Q = domain.quantities['elevation']
    357357        X,Y,Z,V = Q.get_vertex_values(xy=True,
    358                       precision = self.precision)
     358                                      precision=self.precision)
    359359
    360360
  • anuga_core/source/anuga/shallow_water/shallow_water_domain.py

    r3876 r3926  
    111111                 ghost_recv_dict=None,
    112112                 processor=0,
    113                  numproc=1):
     113                 numproc=1,
     114                 number_of_full_nodes=0,
     115                 number_of_full_triangles=0):
    114116
    115117
     
    131133                                ghost_recv_dict,
    132134                                processor,
    133                                 numproc)
    134 
     135                                numproc,
     136                                number_of_full_nodes=number_of_full_nodes,
     137                                number_of_full_triangles=number_of_full_triangles)
    135138
    136139        self.minimum_allowed_height = minimum_allowed_height
  • anuga_core/source/anuga_parallel/build_commun.py

    r3460 r3926  
    270270        submesh_cell["ghost_quan"][qkeys[i]][:] = tmp[:]
    271271   
    272     return submesh_cell, triangles_per_proc
     272    return submesh_cell, triangles_per_proc,\
     273           no_full_nodes, no_full_triangles
    273274
    274275
     
    296297    myid = pypar.rank()
    297298
    298     [submesh_cell, triangles_per_proc] = rec_submesh_flat(p)
     299    [submesh_cell, triangles_per_proc,\
     300     number_of_full_nodes, number_of_full_triangles] = rec_submesh_flat(p)
    299301   
    300302    # find the full triangles assigned to this processor
     
    312314                               numproc)
    313315   
    314     return GAnodes, GAtriangles, boundary, quantities, ghost_rec, full_send
     316    return GAnodes, GAtriangles, boundary, quantities,\
     317           ghost_rec, full_send,\
     318           number_of_full_nodes, number_of_full_triangles
     319
    315320
    316321#########################################################
  • anuga_core/source/anuga_parallel/parallel_api.py

    r3904 r3926  
    44"""
    55
    6 # Parallelism
     6from Numeric import zeros
    77
    88# The abstract Python-MPI interface
     
    2121    # Mesh partitioning using Metis
    2222    from anuga_parallel.build_submesh import build_submesh
    23     from anuga_parallel.build_local   import build_local_mesh
    2423    from anuga_parallel.pmesh_divide  import pmesh_divide_metis
    2524
     
    9796        points, vertices, boundary, quantities,\
    9897                ghost_recv_dict, full_send_dict,\
    99                 = distribute_mesh(domain)
     98                number_of_full_nodes, number_of_full_triangles =\
     99                distribute_mesh(domain)
     100
    100101
    101102        if verbose: print 'Communication done'
     
    107108        points, vertices, boundary, quantities,\
    108109                ghost_recv_dict, full_send_dict,\
    109                 = rec_submesh(0)
     110                number_of_full_nodes, number_of_full_triangles =\
     111                rec_submesh(0)
    110112
    111113
     
    113115    # Build the domain for this processor using partion structures
    114116    #------------------------------------------------------------------------
     117
    115118    domain = Parallel_Domain(points, vertices, boundary,
    116                              full_send_dict  = full_send_dict,
    117                              ghost_recv_dict = ghost_recv_dict)
     119                             full_send_dict=full_send_dict,
     120                             ghost_recv_dict=ghost_recv_dict,
     121                             number_of_full_nodes=number_of_full_nodes,
     122                             number_of_full_triangles=number_of_full_triangles)
    118123
    119124    #------------------------------------------------------------------------
     
    142147    #------------------------------------------------------------------------
    143148    return domain   
    144 
    145149
    146150
     
    166170                            quantities, triangles_per_proc)
    167171
     172    for p in range(numprocs):
     173        M = len(submesh['ghost_triangles'][p])
     174        print 'There are %d ghost triangles on proc %d' %(M, p)
     175        N = len(submesh['ghost_nodes'][p])
     176        print 'There are %d ghost nodes on proc %d' %(N, p)
     177
     178
    168179    # Send the mesh partition to the appropriate processor
    169180    print 'Distribute submeshes'       
     
    172183
    173184    # Build the local mesh for processor 0
    174     points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict = \
     185    points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict =\
    175186              extract_hostmesh(submesh, triangles_per_proc)
    176187
     188    # Keep track of the number full nodes and triangles.
     189    # This is useful later if one needs access to a ghost-free domain
     190    # Here, we do it for process 0. The others are done in rec_submesh.
     191    number_of_full_nodes = len(submesh['full_nodes'][0])
     192    number_of_full_triangles = len(submesh['full_triangles'][0])
     193       
     194    #print
     195    #for p in range(numprocs):
     196    #    print 'Process %d:' %(p)
     197    #
     198    #    print 'full_triangles:'
     199    #    print submesh['full_triangles'][p]
     200    #
     201    #    print 'full_nodes:'
     202    #    print submesh['full_nodes'][p]
     203    #
     204    #    print 'ghost_triangles:'
     205    #    print submesh['ghost_triangles'][p]#
     206    #
     207    #    print 'ghost_nodes:'
     208    #   print submesh['ghost_nodes'][p]                               
     209    #    print
     210    #
     211    #print 'Receive dict'
     212    #print ghost_recv_dict
     213    #
     214    #print 'Send dict'
     215    #print full_send_dict       
     216
     217
    177218    # Return structures necessary for building the parallel domain
    178     return points, vertices, boundary, quantities, \
    179            ghost_recv_dict, full_send_dict
    180    
    181 
    182 
    183 
     219    return points, vertices, boundary, quantities,\
     220           ghost_recv_dict, full_send_dict,\
     221           number_of_full_nodes, number_of_full_triangles
     222   
     223
     224
     225
  • anuga_core/source/anuga_parallel/parallel_shallow_water.py

    r3893 r3926  
    3030class Parallel_Domain(Domain):
    3131
    32     def __init__(self, coordinates, vertices, boundary = None,
    33                  full_send_dict = None, ghost_recv_dict = None):
     32    def __init__(self, coordinates, vertices,
     33                 boundary=None,
     34                 full_send_dict=None,
     35                 ghost_recv_dict=None,
     36                 number_of_full_nodes=0,
     37                 number_of_full_triangles=0):
    3438
    3539        Domain.__init__(self,
     
    4044                        ghost_recv_dict=ghost_recv_dict,
    4145                        processor=pypar.rank(),
    42                         numproc=pypar.size())
     46                        numproc=pypar.size(),
     47                        number_of_full_nodes=number_of_full_nodes,
     48                        number_of_full_triangles=number_of_full_triangles)
    4349
    4450        N = self.number_of_elements
  • anuga_core/source/anuga_parallel/test_parallel_sw_runup.py

    r3829 r3926  
    3535#--------------------------------------------------------------------------
    3636points, vertices, boundary = rectangular_cross(10, 10) # Basic mesh
     37
     38#if myid == 0:
     39#    print 'points', points
     40#    print 'vertices', vertices
     41   
    3742domain = Domain(points, vertices, boundary) # Create domain
    3843
Note: See TracChangeset for help on using the changeset viewer.