!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer,
! version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer
!version 3 or (at your option) any later version that should be found at:
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html
!
!This software 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 above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software;
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec),
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------
!
!***************************************************************
! Name : init_mpi
! Author: Bin He *ARMA/MSC
! Date : Nov. 2005
! Purpose: conduct RPN_COMM Initialization .
!
!***************************************************************
SUBROUTINE init_mpi() 1,1
USE procs_topo
IMPLICIT NONE
INTEGER :: ierr
INTEGER get_ptopo
external get_ptopo
! 1. Initilize MPI .
npex=0
npey=0
CALL rpn_comm_init(get_ptopo,myid,nprocs,npex,npey)
END SUBROUTINE init_mpi
SUBROUTINE get_ptopo(pex,pey),1
IMPLICIT NONE
INTEGER,INTENT(OUT) :: pex,pey
!
INTEGER :: ierr
INTEGER :: npex,npey
NAMELIST /ptopo/npex,npey
INTEGER :: unnmlist,fnom
CHARACTER(len=10) :: fnptopo
unnmlist=555
npex=1
npey=1
fnptopo='ptopo_nml'
! OPEN(UNIT=nmlist,FILE='./ptopo_nml',STATUS='OLD',ACTION='READ',IOSTAT=ierr)
ierr=FNOM(unnmlist,fnptopo,'FTN+SEQ',0)
IF(ierr /= 0) CALL mpiabort
('Can not Open file ptopo_nml! Abort!')
READ(unnmlist,NML=ptopo)
CLOSE(unnmlist)
pex=npex
pey=npey
END SUBROUTINE get_ptopo