Skip to content

Commit

Permalink
Merge pull request #182 from stoiver/master
Browse files Browse the repository at this point in the history
set default to 0 in parallel inlet_operator
  • Loading branch information
stoiver committed Apr 2, 2019
2 parents dd7fd12 + ee3ca55 commit fb29199
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions anuga/parallel/parallel_operator_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@
import math

"""
Factory method for Parallel Inlet_operator. All parameters are the same
as normal Inlet_Operators master_proc coordinates the allocation process,
Factory method for Parallel Inlet_operator. All parameters are the same
as normal Inlet_Operators master_proc coordinates the allocation process,
procs contains the potential list of processors to allocate the inlet to.
Returns None for calling processors not associated with inlet. Otherwise
return an instance of Parallel_Inlet_Operator
"""

def Inlet_operator(domain,
def Inlet_operator(domain,
poly,
Q,
velocity = None,
default = None,
default = 0.0,
description = None,
label = None,
logging = False,
Expand All @@ -67,7 +67,7 @@ def Inlet_operator(domain,
label = label,
logging = logging,
verbose = verbose)

import pypar
if procs is None:
procs = range(0,pypar.size())
Expand Down Expand Up @@ -107,7 +107,7 @@ def Inlet_operator(domain,
return None

"""
Factory method for Parallel Boyd_box_operator. All parameters are the same
Factory method for Parallel Boyd_box_operator. All parameters are the same
as normal Boyd_box_operator master_proc coordinates the allocation process,
procs contains the potential list of processors to allocate the inlet to.
Expand All @@ -117,8 +117,8 @@ def Inlet_operator(domain,

def Boyd_box_operator(domain,
losses,
width,
height=None,
width,
height=None,
blockage=0.0,
barrels=1.0,
z1=0.0,
Expand Down Expand Up @@ -202,15 +202,15 @@ def Boyd_box_operator(domain,
pypar.send(enquiry_points_tmp, i)

elif end_points is not None:
exchange_lines_tmp, enquiry_points_tmp = __process_non_skew_culvert(end_points, width,
exchange_lines_tmp, enquiry_points_tmp = __process_non_skew_culvert(end_points, width,
enquiry_points, apron, enquiry_gap)
for i in procs:
if i == master_proc: continue
pypar.send(exchange_lines_tmp, i)
pypar.send(enquiry_points_tmp, i)
else:
raise Exception, 'Define either exchange_lines or end_points'

else:
if exchange_lines is not None:
exchange_lines_tmp = exchange_lines
Expand All @@ -220,7 +220,7 @@ def Boyd_box_operator(domain,
enquiry_points_tmp = pypar.receive(master_proc)

# Determine processors associated with first inlet
line0 = exchange_lines_tmp[0]
line0 = exchange_lines_tmp[0]
enquiry_point0 = enquiry_points_tmp[0]

alloc0, inlet0_master_proc, inlet0_procs, enquiry0_proc = allocate_inlet_procs(domain, line0, enquiry_point = enquiry_point0,
Expand Down Expand Up @@ -342,7 +342,7 @@ def Boyd_pipe_operator(domain,
import pypar
if procs is None:
procs = range(0,pypar.size())

myid = pypar.rank()

end_points = ensure_numeric(end_points)
Expand Down Expand Up @@ -449,7 +449,7 @@ def Boyd_pipe_operator(domain,


"""
Factory method for Parallel Weir_orifice_trapezoid_operator. All parameters are the same
Factory method for Parallel Weir_orifice_trapezoid_operator. All parameters are the same
as normal Weir_orifice_trapezoid_operator master_proc coordinates the allocation process,
procs contains the potential list of processors to allocate the inlet to.
Expand Down Expand Up @@ -548,15 +548,15 @@ def Weir_orifice_trapezoid_operator(domain,
pypar.send(enquiry_points_tmp, i)

elif end_points is not None:
exchange_lines_tmp, enquiry_points_tmp = __process_non_skew_culvert(end_points, width,
exchange_lines_tmp, enquiry_points_tmp = __process_non_skew_culvert(end_points, width,
enquiry_points, apron, enquiry_gap)
for i in procs:
if i == master_proc: continue
pypar.send(exchange_lines_tmp, i)
pypar.send(enquiry_points_tmp, i)
else:
raise Exception, 'Define either exchange_lines or end_points'

else:
if exchange_lines is not None:
exchange_lines_tmp = exchange_lines
Expand All @@ -566,7 +566,7 @@ def Weir_orifice_trapezoid_operator(domain,
enquiry_points_tmp = pypar.receive(master_proc)

# Determine processors associated with first inlet
line0 = exchange_lines_tmp[0]
line0 = exchange_lines_tmp[0]
enquiry_point0 = enquiry_points_tmp[0]

alloc0, inlet0_master_proc, inlet0_procs, enquiry0_proc = allocate_inlet_procs(domain, line0, enquiry_point = enquiry_point0,
Expand Down Expand Up @@ -632,7 +632,7 @@ def Weir_orifice_trapezoid_operator(domain,


"""
Factory method for Parallel Internal_boundary_operator. All parameters are the same
Factory method for Parallel Internal_boundary_operator. All parameters are the same
as normal Internal_boundary_operator. master_proc coordinates the allocation process,
procs contains the potential list of processors to allocate the inlet to.
Expand Down Expand Up @@ -720,15 +720,15 @@ def Internal_boundary_operator(domain,
pypar.send(enquiry_points_tmp, i)

elif end_points is not None:
exchange_lines_tmp, enquiry_points_tmp = __process_non_skew_culvert(end_points, width,
exchange_lines_tmp, enquiry_points_tmp = __process_non_skew_culvert(end_points, width,
enquiry_points, apron, enquiry_gap)
for i in procs:
if i == master_proc: continue
pypar.send(exchange_lines_tmp, i)
pypar.send(enquiry_points_tmp, i)
else:
raise Exception, 'Define either exchange_lines or end_points'

else:
if exchange_lines is not None:
exchange_lines_tmp = exchange_lines
Expand All @@ -738,7 +738,7 @@ def Internal_boundary_operator(domain,
enquiry_points_tmp = pypar.receive(master_proc)

# Determine processors associated with first inlet
line0 = exchange_lines_tmp[0]
line0 = exchange_lines_tmp[0]
enquiry_point0 = enquiry_points_tmp[0]

alloc0, inlet0_master_proc, inlet0_procs, enquiry0_proc = allocate_inlet_procs(domain, line0, enquiry_point = enquiry_point0,
Expand Down Expand Up @@ -868,15 +868,15 @@ def __process_skew_culvert(exchange_lines, end_points, enquiry_points, apron, en
enquiry_points.append(centre_point1 + gap)

return enquiry_points


def allocate_inlet_procs(domain, poly, enquiry_point = None, master_proc = 0, procs = None, verbose = False):


import pypar
if procs is None:
procs = range(0, pypar.size())

myid = pypar.rank()
vertex_coordinates = domain.get_full_vertex_coordinates(absolute=True)
domain_centroids = domain.centroid_coordinates
Expand All @@ -901,7 +901,7 @@ def allocate_inlet_procs(domain, poly, enquiry_point = None, master_proc = 0, pr
tris_0 = line_intersect(vertex_coordinates, [poly[0],poly[1]])
tris_1 = inside_polygon(domain_centroids, poly)
tri_id = num.union1d(tris_0, tris_1)


if verbose:
print "P%d has %d triangles in poly %s" %(myid, len(tri_id), poly)
Expand Down

0 comments on commit fb29199

Please sign in to comment.