# gate operator lives on a number of processors
    #
    # Need to run parallel gate operations on all
    # processors where gate lives.
    # But true result only on master processor.
    #================================================
    if gate is not None:
        [s0, s1] = gate.get_enquiry_stages()
        [d0, d1] = gate.get_enquiry_depths()
        [e0, e1] = gate.get_enquiry_elevations()
        [i0, i1] = gate.get_enquiry_invert_elevations()
        [w0, w1] = gate.get_enquiry_water_depths()

        output = gate.discharge_routine()

        if myid == gate.get_master_proc():
            print('myid ', myid, s0, s1)
            print('myid ', myid, d0, d1)
            print('myid ', myid, e0, e1)
            print('myid ', myid, i0, i1)
            print('myid ', myid, w0, w1)

            print('myid ', myid, output)

            if d0 > 0.2: gate.set_culvert_height(10.0)

barrier()

domain.sww_merge(delete_old=True)

barrier()
    # gate operator lives on a number of processors
    #
    # Need to run parallel gate operations on all
    # processors where gate lives.
    # But true result only on master processor.
    #================================================
    if gate is not None:
        [s0, s1] = gate.get_enquiry_stages()
        [d0, d1] = gate.get_enquiry_depths()
        [e0, e1] = gate.get_enquiry_elevations()
        [i0, i1] = gate.get_enquiry_invert_elevations()
        [w0, w1] = gate.get_enquiry_water_depths()

        output = gate.discharge_routine()

        if myid == gate.get_master_proc():
            print 'myid ', myid, s0,s1
            print 'myid ', myid, d0,d1
            print 'myid ', myid, e0,e1
            print 'myid ', myid, i0,i1
            print 'myid ', myid, w0,w1

            print 'myid ',myid, output


            if d0 > 0.2: gate.set_culvert_height(10.0)

            
    

barrier()