SUBROUTINE DEFINE_POINTERS_MP9

!**** *DEFINE_POINTERS_MP9* - ECMWF PHYSICS

!     Purpose.
!     --------
!           Define local pointers KY[X]_MP9 for the input data used in
!           the EC lagged physics. These pointers are equal either to
!           Y[X]%MP9 or Y[X]%MP according to LTWOTL and NCURRENT_ITER.
!           For example, in a SL2TL scheme, the input data which is
!           not t+dt data is ALWAYS "t" data (predictor and corrector
!           steps if PC scheme). In this case:
!           - predictor step: "t" data match with the pointer Y[X]%MP;
!             so KY[X]_MP9=Y[X]%MP.
!           - corrector step: "t" data match with the pointer Y[X]%MP9;
!             so KY[X]_MP9=Y[X]%MP9.
!           In a leap-frog scheme, the input data which is
!           not t+dt data is ALWAYS "t-dt" data (LPC_FULL is not yet
!           implemented when a leap-frog scheme is used with lagged
!           EC physics). In this case KY[X]_MP9=Y[X]%MP9.

!**   Interface.
!     ----------
!        *CALL* *DEFINE_POINTERS_MP9*

!        Explicit arguments :
!        --------------------

!        Implicit arguments :
!        --------------------

!     Method.
!     -------
!        See documentation

!     Externals.
!     ----------
!        Called by GP_MODEL

!     Reference.
!     ----------

!     Author.
!     -------
!        K. Yessad (CNRM/GMAP) and Deborah Salmond *ECMWF* (FEB 2006).

!     Modifications.
!     --------------
!     ------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK

USE YOMDYN   , ONLY : NCURRENT_ITER
USE YOM_YGFL , ONLY : YGFL, YGFLC

IMPLICIT NONE

INTEGER(KIND=JPIM) :: JGFL
REAL(KIND=JPRB) :: ZHOOK_HANDLE

!     ------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('DEFINE_POINTERS_MP9',0,ZHOOK_HANDLE)

!     ------------------------------------------------------------------

!*       1.    Interface to global arrays.
!              ---------------------------

! * For a SL2TL (resp. leap-frog scheme) scheme,
!   the following pointers must ALWAYS match with
!   quantities at time t (resp t-dt).

DO JGFL=1,YGFL%NUMFLDS
  IF(YGFLC(JGFL)%LT9)THEN
    IF (NCURRENT_ITER == 0) THEN
      YGFLC(JGFL)%MP9_PH=YGFLC(JGFL)%MP
    ELSE
      YGFLC(JGFL)%MP9_PH=YGFLC(JGFL)%MP9
    ENDIF
  ENDIF
ENDDO

IF (LHOOK) CALL DR_HOOK('DEFINE_POINTERS_MP9',1,ZHOOK_HANDLE)
END SUBROUTINE DEFINE_POINTERS_MP9
