!===============================================================================
!
! global_mpi.F90 - global operations in MPI
!
!-------------------------------------------------------------------------------
!
! Copyright (C) Yoshifumi Nakamura 
!
! This file is part of BQCD -- Berlin Quantum ChromoDynamics program
!
! BQCD is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! BQCD is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with BQCD.  If not, see <http://www.gnu.org/licenses/>.
!
!-------------------------------------------------------------------------------
# include "defs.h"

!-------------------------------------------------------------------------------
logical function global_land(local)
  implicit none
  include 'mpif.h'
  logical, intent(in) :: local
  integer  ierror

  call mpi_allreduce(local, global_land, 1, MPI_LOGICAL, &
                     MPI_LAND, MPI_COMM_WORLD, ierror)
end

!-------------------------------------------------------------------------------
logical function global_lor(local)
  implicit none
  include 'mpif.h'
  logical, intent(in) :: local
  integer  ierror

  call mpi_allreduce(local, global_lor, 1, MPI_LOGICAL, &
                     MPI_LOR, MPI_COMM_WORLD, ierror)
end

!===============================================================================
