Changeset 8227


Ignore:
Timestamp:
Oct 14, 2011, 3:07:01 PM (14 years ago)
Author:
janes
Message:

Added additional comments for parallel fractional operator codes

Location:
trunk/anuga_core/source/anuga_parallel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga_parallel/parallel_inlet.py

    r8224 r8227  
    1515    """
    1616
     17    """
     18    Parallel inlet:
     19   
     20    master_proc - coordinates all processors associated with this inlet
     21    usually the processors with domains which contains parts of this inlet.
     22   
     23    procs - is the list of all processors associated with this inlet.
     24
     25    (We assume that the above arguments are determined correctly by the parallel_operator_factory)
     26    """
     27
    1728    def __init__(self, domain, line, master_proc = 0, procs = None, verbose=False):
    1829
     
    2031        self.line = line
    2132        self.verbose = verbose
    22         self.master_proc = master_proc #Master processor where global data is gathered
     33        self.master_proc = master_proc
    2334
    2435        if procs is None:
     
    3748    def compute_triangle_indices(self):
    3849
    39         # PETE: Note that all of these are fine but keep in mind that they are local to a domain.
    40 
    41         # Get boundary (in absolute coordinates)
     50        # Get boundary of full triangles (in absolute coordinates)
    4251        vertex_coordinates = self.domain.get_full_vertex_coordinates(absolute=True)
    4352
    44         # PETE: Eliminate ghost triangle indices, we can assume that it is in the other inlet
     53        # PETE: we can assume that the ghost triangles in this domain exist in another
     54        # domain, therefore any part of the inlet corresponding to them are accounted for.
    4555
    4656        self.triangle_indices = line_intersect(vertex_coordinates, self.line)
    4757
    48         #print "P%d has %d inlet triangles" %(self.myid, len(self.triangle_indices))
    49 
    50         #print "Triangle Indices:"
    51         #
    5258        for i in self.triangle_indices:
    5359            assert self.domain.tri_full_flag[i] == 1
    54 
    55         # This effectively does the checks already
    56         if len(self.triangle_indices) == 0:
    57             msg = 'Inlet line=%s ' % (self.line)
    58             msg += 'No triangles intersecting line (Only an enquiry point?)'
    59             print "WARNING: " + msg
    60             #raise Exception, msg
    61 
    62 
    6360
    6461    def compute_area(self):
     
    7067            msg = 'No triangles have been identified in region '
    7168            print "WARNING: " + msg
    72             #raise Exception, msg
    7369
    7470        self.area = 0.0
     
    7672            self.area += self.domain.areas[j]
    7773
    78         # PETE: Do a reduction operation to tally up the areas? Must be asynchronous
    79         # Can we assume that this will be called roughly at the same time?
    80         # At this point this calculates the local area
    81 
    8274        msg = 'Inlet exchange area has area = %f' % self.area
    8375        assert self.area >= 0.0
    84         #assert self.area > 0.0
    85 
    8676
    8777    def compute_inlet_length(self):
    88         """ Compute the length of the inlet (as
     78        """ Compute the length of the inlet within this domain (as
    8979        defined by the input line
    9080        """
    9181
    92         # PETE: This is ok, I think this is independent of the domain?
    93 
    9482        point0 = self.line[0]
    9583        point1 = self.line[1]
    96 
    97         #TODO: Go through each point in the line, only count the lenght as the one within the
    98         #bounding polygon
    9984
    10085        self.inlet_length = anuga.geometry.polygon.line_length(self.line)
     
    10893
    10994    def get_line(self):
    110         # LOCAL
    11195        return self.line
    11296
     
    116100
    117101    def get_global_area(self):
    118         # Master processor gathers area from all child processors, and returns value
     102        # GLOBAL: Master processor gathers area from all child processors, and returns value
     103
     104        # WARNING: requires synchronization, must be called by all procs associated
     105        # with this inlet
     106       
    119107        local_area = self.area
    120108        area = local_area
     
    134122
    135123    def get_areas(self):
    136         # LOCAL
    137124        # Must be called after compute_inlet_triangle_indices().
     125        # LOCAL
     126       
    138127        return self.domain.areas.take(self.triangle_indices)
    139128
     
    141130    def get_stages(self):
    142131        # LOCAL
    143         # PETE: Do we provide all the stages, is it ok if we just provide the local stages?
    144         # Are there any dependencies?
     132
    145133        return self.domain.quantities['stage'].centroid_values.take(self.triangle_indices)
    146134
     
    148136    def get_average_stage(self):
    149137        # LOCAL
     138
    150139        return num.sum(self.get_stages()*self.get_areas())/self.area
    151140
    152141    def get_global_average_stage(self):
    153         # LOCAL
     142        # GLOBAL: Master processor gathers stages from all child processors, and returns average
     143
     144        # WARNING: requires synchronization, must be called by all procs associated
     145        # with this inlet
     146
    154147        local_stage = num.sum(self.get_stages()*self.get_areas())
    155148        global_area = self.get_global_area()
     
    187180
    188181    def get_global_average_xmom(self):
     182        # GLOBAL: master proc gathers all xmom values and returns average
     183        # WARNING: requires synchronization, must be called by all procs associated
     184        # with this inlet
     185
    189186        global_area = self.get_global_area()
    190187        local_xmoms = num.sum(self.get_xmoms()*self.get_areas())
     
    213210
    214211    def get_global_average_ymom(self):
     212        # GLOBAL: master proc gathers all ymom values and returns average
     213        # WARNING: requires synchronization, must be called by all procs associated
     214        # with this inlet
     215
    215216        global_area = self.get_global_area()
    216217        local_ymoms = num.sum(self.get_ymoms()*self.get_areas())
     
    239240
    240241    def get_global_total_water_volume(self):
     242        # GLOBAL: master proc gathers total water volumes from each proc and returns average
     243        # WARNING: requires synchronization, must be called by all procs associated
     244        # with this inlet
     245
    241246        local_volume = num.sum(self.get_depths()*self.get_areas())
    242247        volume = local_volume
     
    259264
    260265    def get_global_average_depth(self):
     266        # GLOBAL: master proc gathers all depth values and returns average
     267        # WARNING: requires synchronization, must be called by all procs associated
     268        # with this inlet
     269       
    261270        area = self.get_global_area()
    262271        total_water_volume = self.get_global_total_water_volume()
     
    296305
    297306    def get_average_velocity_head(self):
    298 
     307        #LOCAL
    299308        return 0.5*self.get_average_speed()**2/g
    300309
    301310
    302311    def get_average_total_energy(self):
    303 
     312        #LOCAL
    304313        return self.get_average_velocity_head() + self.get_average_stage()
    305314
    306315
    307316    def get_average_specific_energy(self):
    308 
     317        #LOCAL
    309318        return self.get_average_velocity_head() + self.get_average_depth()
    310319
    311320
    312 # Set routines
     321# Set routines (ALL LOCAL)
    313322
    314323    def set_depths(self,depth):
     
    336345        self.domain.quantities['elevation'].centroid_values.put(self.triangle_indices, elevation)
    337346
    338     def debug_set_stages_evenly(self,volume):
    339         """ Distribute volume of water over
    340         inlet exchange region so that stage is level
    341         """
    342 
    343         areas = self.get_areas()
    344         stages = self.get_stages()
    345 
    346         stages_order = stages.argsort()
    347 
    348         # accumulate areas of cells ordered by stage
    349         summed_areas = num.cumsum(areas[stages_order])
    350 
    351         # accumulate the volume need to fill cells
    352         summed_volume = num.zeros_like(areas)
    353         summed_volume[1:] = num.cumsum(summed_areas[:-1]*num.diff(stages[stages_order]))
    354 
    355         # find the number of cells which will be filled
    356         index = num.nonzero(summed_volume<=volume)[0][-1]
    357 
    358         # calculate stage needed to fill chosen cells with given volume of water
    359         depth = (volume - summed_volume[index])/summed_areas[index]
    360         new_stage = stages[stages_order[index]]+depth
    361 
    362 
    363         #print "Summed Volume = " + str(summed_volume)
    364         #print "Summed Area = " + str(summed_areas)
    365         #print "Ordered Stages = " + str(stages[stages_order[:]])
    366         #print "New Stage = " + str(new_stage) + " Volume = " + str(volume) +  " Summed Volume = " + str(summed_volume[index]) + " Index = " + str(index+1)
    367         #print "NS = " + str(new_stage) + " SAr = " + str(summed_areas[index]) + " Vol = " + str(volume) + " SVol = " + str(summed_volume[index]) + " I = " + str(index)
    368 
    369 
    370         stages[stages_order[0:index+1]] = new_stage
    371         #stages[stages_order[0:index+1]] = stages[stages_order[index]]+depth
    372 
    373        
    374 
    375         self.set_stages(stages)
    376347
    377348    def set_stages_evenly(self,volume):
     
    379350        inlet exchange region so that stage is level
    380351        """
    381         # PETE: THIS must be global and in parallel - this does not appear to set the stage for the part
    382         # above the volume
    383         #
    384 
    385         '''
    386         if pypar.size() == 1:
    387             self.debug_set_stages_evenly(volume)
    388             return
    389         '''
     352        # WARNING: requires synchronization, must be called by all procs associated
     353        # with this inlet
     354
    390355        centroid_coordinates = self.domain.get_full_centroid_coordinates(absolute=True)
    391356        areas = self.get_areas()
     
    400365        s_stages_order = {}
    401366        total_stages = len(stages)
    402 
    403         #for i in stages_order:
    404         #    print "[%d, %f, %s]" %(self.myid, stages[i], centroid_coordinates[self.triangle_indices[i]])
    405367
    406368        if self.myid == self.master_proc:
     
    415377                    s_stages[i] = pypar.receive(i)
    416378                    s_stages_order[i] = pypar.receive(i)
    417                     #print "Recieved from P%d" %(i)
    418                     #print str(s_stages[i])
    419379                    total_stages = total_stages + len(s_stages[i])
    420380
    421381        else:
    422             # Send areas, stages, and stages order to master
     382            # Send areas, stages, and stages order to master proc of inlet
    423383            pypar.send(areas, self.master_proc)
    424384            pypar.send(stages, self.master_proc)
     
    433393            num_stages = 0.
    434394            first = True
    435             #sa_debug = []
    436             #sv_debug = []
    437             #s_debug = []
    438 
     395           
    439396            for i in self.procs:
    440397                pos[i] = 0
     
    452409                    if s_stages[i][s_stages_order[i][pos[i]]] < current_stage:
    453410                        current_stage = s_stages[i][s_stages_order[i][pos[i]]]
    454                         #s_debug.append(current_stage)
    455411                        index = i
    456412
    457                 # If first iteration, then only update summed_areas, and current stage
    458                 #print "(%d, %f, %s)" %(index, current_stage, centroid_coordinates[self.triangle_indices[s_stages_order[index][pos[index]]]])
    459 
     413                # If first iteration, then only update summed_areas, position, and prev|current stage
     414               
    460415                if first:
    461416                    first = False
     
    477432                pos[index] = pos[index] + 1
    478433                summed_volume = tmp_volume
    479                 #sa_debug.append(summed_areas)
    480                 #sv_debug.append(summed_volume)
     434               
    481435                # Update position of index processor and current stage
    482436                prev_stage = current_stage
     
    484438            # Calculate new stage
    485439            new_stage = prev_stage + (volume - summed_volume) / summed_areas
    486 
    487             #print "Ordered Stages = " + str(stages[stages_order[:]])
    488             #print "NS = " + str(new_stage) + " SAr = " + str(summed_areas) + " Vol = " + str(volume) + " SVol = " + str(summed_volume) + " I = " + str(pos[self.myid])
    489440
    490441            # Send postion and new stage to all processors
     
    495446
    496447            # Update own depth
    497             #print "P%d, pos = %d, new_stage = %f" %(self.myid, pos[self.myid], new_stage)
    498448            stages[stages_order[0:pos[self.myid]]] = new_stage
    499449        else:
     
    501451            new_stage = pypar.receive(self.master_proc)
    502452            stages[stages_order[0:pos]] = new_stage
    503             #print "P%d, pos = %d, new_stage = %f" %(self.myid, pos, new_stage)
    504             #print str(stages)
    505453
    506454        self.set_stages(stages)
     
    508456        stages = self.get_stages()
    509457        stages_order = stages.argsort()
    510 
    511         #for i in stages_order:
    512             #print "eeee: [%d, %f, %s]" %(self.myid, stages[i], centroid_coordinates[self.triangle_indices[i]])
    513458
    514459    def set_depths_evenly(self,volume):
     
    516461        cells with equal depth of water
    517462        """
    518         # Is this correct?
    519463        new_depth = self.get_average_depth() + (volume/self.get_area())
    520464        self.set_depths(new_depth)
     
    528472
    529473    def statistics(self):
     474        # WARNING: requires synchronization, must be called by all procs associated
     475        # with this inlet
     476
    530477        message = ''
    531478
  • trunk/anuga_core/source/anuga_parallel/parallel_inlet_enquiry.py

    r8224 r8227  
    1212    """
    1313
     14    """
     15    master_proc - index of the processor which coordinates all processors
     16    associated with this inlet operator.
     17    procs - list of all processors associated with this inlet operator
     18    enquiry_proc - processor containing inlet enquiry point
     19    """
     20
    1421    def __init__(self, domain, polyline, enquiry_pt, master_proc = 0, procs = None, enquiry_proc = -1,
    1522                outward_culvert_vector=None, verbose=False):
    1623
    17         # TODO: Include statement that excludes non-participating process
    18 
     24   
    1925        parallel_inlet.Parallel_Inlet.__init__(self, domain, polyline,
    2026                                                master_proc = master_proc, procs = procs, verbose=verbose)
    21         #print "Inlet line = " + str(polyline)
     27   
    2228        self.enquiry_pt = enquiry_pt
    2329        self.outward_culvert_vector = outward_culvert_vector
     
    5359        if has_enq_point:
    5460            self.enquiry_index = self.domain.get_triangle_containing_point(self.enquiry_pt)
    55             #print "enquiry index = %d" %(self.enquiry_index)
    56 
     61   
    5762            if self.enquiry_index in self.triangle_indices:
    5863                msg = 'Enquiry point %s' % (self.enquiry_pt)
     
    6065                raise Exception, msg
    6166
    62             if self.enquiry_proc >= 0: assert self.enquiry_proc == self.myid, "Specified enquiry proc does not match actual enquiry proc"
     67            if self.enquiry_proc >= 0:
     68                assert self.enquiry_proc == self.myid, "Specified enquiry proc does not match actual enquiry proc"
    6369            self.enquiry_proc = self.myid
    6470            assert self.enquiry_index >= 0, "Enquiry point inside polygon, but no triangle index found"
     
    6874
    6975    def get_enquiry_position(self):
    70         #GLOBAL
     76        # WARNING: Must be called by processor containing inlet enquiry point to have effect
    7177
    7278        if self.enquiry_index >= 0:
     
    7682
    7783    def get_enquiry_stage(self):
     84        # WARNING: Must be called by processor containing inlet enquiry point to have effect
    7885
    7986        if self.enquiry_index >= 0:
     
    8592
    8693    def get_enquiry_xmom(self):
     94        # WARNING: Must be called by processor containing inlet enquiry point to have effect
     95
    8796        if self.enquiry_index >= 0:
    8897            return self.domain.quantities['xmomentum'].centroid_values[self.enquiry_index]
     
    91100
    92101    def get_enquiry_ymom(self):
     102        # WARNING: Must be called by processor containing inlet enquiry point to have effect
     103
    93104        if self.enquiry_index >= 0:
    94105            return self.domain.quantities['ymomentum'].centroid_values[self.enquiry_index]
     
    97108
    98109    def get_enquiry_elevation(self):
     110        # WARNING: Must be called by processor containing inlet enquiry point to have effect
     111
    99112        if self.enquiry_index >= 0:
    100113            return self.domain.quantities['elevation'].centroid_values[self.enquiry_index]
     
    104117
    105118    def get_enquiry_depth(self):
     119        # WARNING: Must be called by processor containing inlet enquiry point to have effect
    106120
    107121        if self.enquiry_index >= 0:
     
    112126
    113127    def get_enquiry_velocity(self):
     128        # WARNING: Must be called by processor containing inlet enquiry point to have effect
    114129
    115130        if self.enquiry_index >= 0:
     
    124139
    125140    def get_enquiry_xvelocity(self):
     141        # WARNING: Must be called by processor containing inlet enquiry point to have effect
    126142
    127143        if self.enquiry_index >= 0:
     
    132148
    133149    def get_enquiry_yvelocity(self):
     150        # WARNING: Must be called by processor containing inlet enquiry point to have effect
    134151
    135152        if self.enquiry_index >= 0:
     
    140157
    141158    def get_enquiry_speed(self):
     159        # WARNING: Must be called by processor containing inlet enquiry point to have effect
    142160
    143161        if self.enquiry_index >= 0:
     
    150168
    151169    def get_enquiry_velocity_head(self):
     170        # WARNING: Must be called by processor containing inlet enquiry point to have effect
    152171
    153172        if self.enquiry_index >= 0:
     
    158177
    159178    def get_enquiry_total_energy(self):
     179        # WARNING: Must be called by processor containing inlet enquiry point to have effect
    160180
    161181        if self.enquiry_index >= 0:
     
    166186
    167187    def get_enquiry_specific_energy(self):
     188        # WARNING: Must be called by processor containing inlet enquiry point to have effect
     189
    168190        if self.enquiry_index >= 0:
    169191            return self.get_enquiry_velocity_head() + self.get_enquiry_depth()
  • trunk/anuga_core/source/anuga_parallel/parallel_inlet_operator.py

    r8224 r8227  
    1313
    1414class Parallel_Inlet_operator(Inlet_operator):
    15     """Inlet Operator - add water to an inlet.
     15    """Parallel Inlet Operator - add water to an inlet potentially
     16    shared between different parallel domains.
     17
    1618    Sets up the geometry of problem
    1719
     
    2224    """
    2325
    24     # PETE: This only counts the number of inlets in processor?
    25     counter = 0
     26    """
     27    master_proc - index of the processor which coordinates all processors
     28    associated with this inlet operator.
     29    procs - list of all processors associated with this inlet operator
     30   
     31    """
    2632
    2733    def __init__(self,
     
    3642                 verbose = False):
    3743
    38         # TODO: Include statement that excludes non-participating process
    39         # PETE: Only set if domain actually contains the line, EXIT otherwise
    4044        self.domain = domain
    4145        self.domain.set_fractional_step_operator(self)
    4246        self.line = numpy.array(line, dtype='d')
    43         self.master_proc = master_proc #PETE: id of the master processor that gathers global data
     47        self.master_proc = master_proc
    4448
    4549        if procs is None:
     
    5357        self.Q = Q
    5458
    55         # PETE: Have description mentioning the name of the processor
    5659        if description == None:
    5760            self.description = ' '
     
    7477            Inlet_operator.counter += 1
    7578
    76         # PETE: Should the line be global or local? What if enquiry point is elsewhere
    77         # TODO: Must determine the location of the enquiry point
    7879        self.enquiry_point = 0.5*(self.line[0] + self.line[1])
    79         # TODO: Check whether the current processor contains enquiry point, tell the other processors
    80         # who owns it
    8180
    8281        self.outward_vector = self.line
    8382        self.inlet = parallel_inlet.Parallel_Inlet(self.domain, self.line, master_proc = master_proc,
    8483                                                    procs = procs, verbose= verbose)
    85 
    86         #TODO: Should the master processor do this?
    8784        self.set_logging(logging)
    8885
     
    9188        volume = 0
    9289
    93         # PETE: The master proc calculates the volume
     90        # Only the master proc calculates the volume
     91
    9492        if self.myid == self.master_proc:
    9593            timestep = self.domain.get_timestep()
     
    105103            #print "Volume to be removed from Inlet = " + str(volume)
    106104
    107         # PETE: this is ok, assume that the master proc for inlet operator is the same as that
    108         # for the the inlet itself, thus the other processes need not know the volume
     105        # Set stages evenly
    109106        self.inlet.set_stages_evenly(volume)
    110107
    111         # Distribute volume evenly over all cells
    112         #self.inlet.set_depths_evenly(volume)
    113108
    114109    def update_Q(self, t):
     
    116111        overriding version in descendant
    117112        """
    118         # Only one processor should call this unless Q is parallelizable
     113        # Only one processor should call this function unless Q is parallelizable
    119114        if callable(self.Q):
    120115            Q = self.Q(t)[0]
     
    125120
    126121    def statistics(self):
     122        # WARNING: requires synchronization, must be called by all procs associated
     123        # with this inlet
    127124
    128125        message = ''
     
    148145
    149146    def print_statistics(self):
    150 
     147        # WARNING: requires synchronization, must be called by all procs associated
     148        # with this inlet
     149       
    151150        print self.statistics()
    152151
    153152
    154153    def print_timestepping_statistics(self):
     154        # WARNING: Must be called by master proc to have any effect
    155155
    156156        if self.myid == self.master_proc:
     
    164164
    165165    def set_logging(self, flag=True):
     166        # WARNING: Must be called by master proc to have any effect
    166167
    167168        stats = self.statistics()
     
    187188
    188189    def log_timestepping_statistics(self):
    189        
     190        # WARNING: Must be called by master proc to have any effect
     191
    190192        if self.myid == self.master_proc:
    191193            if self.logging:
     
    195197
    196198    def set_Q(self, Q):
    197 
     199        # LOCAL
    198200        self.Q = Q
    199201
    200202    def get_Q(self):
    201 
     203        # LOCAL
    202204        return self.Q
    203205
    204206
    205207    def get_inlet(self):
    206 
     208        # LOCAL
    207209        return self.inlet
    208210
    209211    def get_line(self):
    210 
    211212        return self.line
    212213
  • trunk/anuga_core/source/anuga_parallel/parallel_operator_factory.py

    r8224 r8227  
    2727import math
    2828
    29 
     29"""
     30Factory method for Parallel Inlet_operator. All parameters are the same
     31as normal Inlet_Operators master_proc coordinates the allocation process,
     32procs contains the potential list of processors to allocate the inlet to.
     33
     34Returns None for calling processors not associated with inlet. Otherwise
     35return an instance of Parallel_Inlet_Operator
     36"""
    3037
    3138def Inlet_operator(domain, line, Q, master_proc = 0, procs = range(0,pypar.size()), debug = False):
    3239
     40    # If not parallel domain then allocate serial Inlet operator
    3341    if isinstance(domain, Parallel_domain) is False:
    3442        if debug: print "Allocating non parallel inlet operator ....."
     
    3745
    3846    myid = pypar.rank()
     47
    3948
    4049    alloc, inlet_master_proc, inlet_procs, enquiry_proc = allocate_inlet_procs(domain, line,
     
    5665        return None
    5766
     67"""
     68Factory method for Parallel Boyd_box_operator. All parameters are the same
     69as normal Inlet_Operators master_proc coordinates the allocation process,
     70procs contains the potential list of processors to allocate the inlet to.
     71
     72Returns None for calling processors not associated with structure. Otherwise
     73return an instance of Parallel_Inlet_Operator
     74"""
    5875
    5976def Boyd_box_operator(domain,
     
    7895                       debug = False):
    7996
     97    # If not parallel domain then allocate serial Boyd box operator
    8098    if isinstance(domain, Parallel_domain) is False:
    8199        if debug: print "Allocating non parallel boyd box operator ....."
     
    110128        apron = width
    111129
     130    # Calculate location of inlet enquiry points and exchange lines
    112131    if myid == master_proc:
    113132        if exchange_lines is not None:
     
    137156            enquiry_points_tmp = pypar.receive(master_proc)
    138157
    139     line0 = exchange_lines_tmp[0] #self.inlet0_lines[0]
     158    # Determine processors associated with first inlet
     159    line0 = exchange_lines_tmp[0]
    140160    enquiry_point0 = enquiry_points_tmp[0]
    141161
     
    144164                                                                                   procs = procs, debug = debug)
    145165
     166    # Determine processors associated with second inlet
    146167    line1 = exchange_lines_tmp[1]
    147168    enquiry_point1 = enquiry_points_tmp[1]
     
    195216
    196217def __process_non_skew_culvert(end_points, width, enquiry_points, apron, enquiry_gap):
    197     # PETE: This can actually be computed by the master
    198218    """Create lines at the end of a culvert inlet and outlet.
    199219    At either end two lines will be created; one for the actual flow to pass through and one a little further away
     
    272292    numprocs = pypar.size()
    273293
    274     line_procs = []
     294    inlet_procs = []
    275295    max_size = -1
    276     line_master_proc = -1
    277     line_enq_proc = -1
     296    inlet_master_proc = -1
     297    inlet_enq_proc = -1
    278298
    279299    # Calculate the number of points of the line inside full polygon
    280 
    281300
    282301    tri_id = line_intersect(vertex_coordinates, line)
     
    304323    if myid == master_proc:
    305324        # Recieve size of overlap from each processor
    306 
    307325        # Initialize line_master_proc and inlet_procs
     326
    308327        if size > 0:
    309             line_procs = [master_proc]
     328            inlet_procs = [master_proc]
    310329            max_size = size
    311             line_master_proc = master_proc
     330            inlet_master_proc = master_proc
    312331            if has_enq_point:
    313                 line_enq_proc = master_proc
     332                inlet_enq_proc = master_proc
    314333
    315334        # Recieve size of overlap
     
    320339
    321340            if x > 0:
    322                 line_procs.append(i)
    323                 # Choose line_master_proc as the one with the most overlap
     341                inlet_procs.append(i)
     342
     343                # Choose inlet_master_proc as the one with the most overlap
    324344                if x > max_size:
    325345                    max_size = x
    326                     line_master_proc = i
     346                    inlet_master_proc = i
    327347
    328348                if y is True:
    329                     assert line_enq_proc == -1, "Enquiry point correspond to more than one proc"
    330                     line_enq_proc = i
    331 
    332         assert len(line_procs) > 0, "Line does not intersect any domain"
    333         assert line_master_proc >= 0, "No master processor assigned"
    334         if enquiry_point is not None: assert line_enq_proc >= 0, "No enquiry point processor assigned"
    335 
    336         # Send line_master_proc and line_procs to all processors in line_procs
     349                    assert inlet_enq_proc == -1, "Enquiry point correspond to more than one proc"
     350                    inlet_enq_proc = i
     351
     352        assert len(inlet_procs) > 0, "Line does not intersect any domain"
     353        assert inlet_master_proc >= 0, "No master processor assigned"
     354        if enquiry_point is not None: assert inlet_enq_proc >= 0, "No enquiry point processor assigned"
     355
     356        # Send inlet_master_proc and inlet_procs to all processors in inlet_procs
    337357        for i in procs:
    338358            if i != master_proc:
    339                 pypar.send(line_master_proc, i)
    340                 pypar.send(line_procs, i)
    341                 pypar.send(line_enq_proc, i)
     359                pypar.send(inlet_master_proc, i)
     360                pypar.send(inlet_procs, i)
     361                pypar.send(inlet_enq_proc, i)
    342362
    343363    else:
     
    345365        pypar.send(has_enq_point, master_proc)
    346366
    347         line_master_proc = pypar.receive(master_proc)
    348         line_procs = pypar.receive(master_proc)
    349         line_enq_proc = pypar.receive(master_proc)
    350         if has_enq_point: assert line_enq_proc == myid, "Enquiry found in proc, but not declared globally"
     367        inlet_master_proc = pypar.receive(master_proc)
     368        inlet_procs = pypar.receive(master_proc)
     369        inlet_enq_proc = pypar.receive(master_proc)
     370        if has_enq_point: assert inlet_enq_proc == myid, "Enquiry found in proc, but not declared globally"
    351371
    352372    if size > 0:
    353         return True, line_master_proc, line_procs, line_enq_proc
    354     else:
    355         return False, line_master_proc, line_procs, line_enq_proc
     373        return True, inlet_master_proc, inlet_procs, inlet_enq_proc
     374    else:
     375        return False, inlet_master_proc, inlet_procs, inlet_enq_proc
    356376
    357377
Note: See TracChangeset for help on using the changeset viewer.