!**** PRISM_DUMMY_MOD.F90
!
!     Purpose.
!     --------
!     Define interface and dummy routines needed to compile and link ifsMASTER 
!     with OASIS4 interfaces (ifs/prism/couplo4*) without linking 
!     to original prism libraries   
!
!     
!     Contains   
!     ----------
!     
!      MODULE PRISM_CONSTANTS 
!
!      MODULE PRISM_DUMMY 
!         INTERFACES for prism routines called in ifs/prism/couplo4* 
!
!      SUBROUTINES
!          prism_dummy_* referenced in PRISM_DUMMY    
!
!      Method
!      -------            
!      Provide interfaces with original prism rouinte names and refers to 
!        dummy subroutines named  prism_dummy_*  if original name is prism_*  
!
!      To run coupled runs with OASIS4 USE PRISM in ifs/prism/couplo4* instead !      of USE PRISM_DUMMY    
!          
!     Reference:
!     ---------
!       S. Valcke, 2006: OASIS4 User Guide  
!       PRISM Support Initiative Report No 3,
!       CERFACS, Toulouse, France, 64 pp.
!
!     Author:
!     -------
!       Johannes Flemming 
!
!     Modifications.
!     --------------




!**************************************************************************

MODULE PRISM_DUMMY_MOD

USE PARKIND1 , ONLY : JPIM , JPRB  
USE YOMPRISM 
USE MPL_ABORT_MOD
IMPLICIT NONE
SAVE

INTERFACE prism_set_points
MODULE PROCEDURE prism_dummy_set_points_gridless,prism_dummy_set_points_3d_dble
END INTERFACE

INTERFACE prism_put
MODULE PROCEDURE prism_dummy_put
END INTERFACE 


INTERFACE prism_get
MODULE PROCEDURE prism_dummy_get
END INTERFACE 


INTERFACE prism_initialized
MODULE PROCEDURE prism_dummy_initialized
END INTERFACE

 
INTERFACE  prism_init 
MODULE PROCEDURE prism_dummy_init
END INTERFACE

INTERFACE prism_init_comp 
MODULE PROCEDURE prism_dummy_init_comp
END INTERFACE

INTERFACE   prism_enddef
MODULE PROCEDURE prism_dummy_enddef
END INTERFACE

INTERFACE prism_terminate
MODULE PROCEDURE prism_dummy_terminate
END INTERFACE

INTERFACE prism_get_localcomm
MODULE PROCEDURE prism_dummy_get_localcomm
END INTERFACE

INTERFACE  prism_def_var
MODULE PROCEDURE prism_dummy_def_var
END INTERFACE

INTERFACE prism_def_grid
MODULE PROCEDURE prism_dummy_def_grid
END INTERFACE


INTERFACE prism_def_partition
MODULE PROCEDURE prism_dummy_def_partition
END INTERFACE


INTERFACE prism_reducedgrid_map
MODULE PROCEDURE prism_dummy_reducedgrid_map
END INTERFACE

INTERFACE prism_set_corners
MODULE PROCEDURE prism_dummy_set_corners
END INTERFACE


INTERFACE prism_calc_newdate
MODULE PROCEDURE prism_dummy_calc_newdate
END INTERFACE




!**************************************************************************
CONTAINS

SUBROUTINE prism_dummy_set_points_gridless (method_id, point_name, grid_id, &
                                 &          new_points, ierror)
       CHARACTER (len=*), INTENT(In)                   :: point_name
       INTEGER(KIND=JPIM),           INTENT(In)                   :: grid_id
       LOGICAL,           INTENT(In)                   :: new_points
       INTEGER(KIND=JPIM),           INTENT(InOut)                :: method_id
       INTEGER(KIND=JPIM),           INTENT(Out)                  :: ierror

       CALL MPL_ABORT('ABORT PRISM_DUMMY')


END SUBROUTINE prism_dummy_set_points_gridless

!**************************************************************************

SUBROUTINE  prism_dummy_set_points_3d_dble(method_id, point_name, grid_id, & 
                  &        points_actual_shape, points_1st_array, points_2nd_array, & 
                  &        points_3rd_array, new_points, ierror)
       CHARACTER (len=*), INTENT(In)                   :: point_name
       INTEGER(KIND=JPIM),           INTENT(In)                   :: grid_id
       INTEGER(KIND=JPIM),           INTENT(InOut)                :: method_id
       REAL(KIND=JPRB),  INTENT(In), DIMENSION (:)    :: points_1st_array, points_2nd_array, points_3rd_array
       INTEGER(KIND=JPIM),           INTENT(In)                   :: points_actual_shape (2, *)
       LOGICAL,           INTENT(In)                   :: new_points
       INTEGER(KIND=JPIM),           INTENT(Out)                  :: ierror

       CALL MPL_ABORT('ABORT PRISM_DUMMY')

END SUBROUTINE prism_dummy_set_points_3d_dble

!**************************************************************************

SUBROUTINE prism_dummy_init ( appl_name, ierror )
       CHARACTER (len=*), INTENT(In) :: appl_name
       INTEGER(KIND=JPIM), INTENT (Out)         :: ierror

        STOP 'ABORT PRISM_DUMMY'

END SUBROUTINE prism_dummy_init

!**************************************************************************

SUBROUTINE prism_dummy_init_comp ( comp_id, comp_name, ierror )  
       CHARACTER (len=*), INTENT(In) :: comp_name
       INTEGER(KIND=JPIM), INTENT (Out) :: comp_id, ierror

       CALL MPL_ABORT('ABORT PRISM_DUMMY')

END SUBROUTINE prism_dummy_init_comp

!**************************************************************************

SUBROUTINE prism_dummy_enddef ( ierror )
       INTEGER(KIND=JPIM), INTENT (Out) :: ierror

       CALL MPL_ABORT('ABORT PRISM_DUMMY')

END SUBROUTINE prism_dummy_enddef

!**************************************************************************

SUBROUTINE prism_dummy_terminate ( ierror )
      INTEGER(KIND=JPIM), INTENT (Out) :: ierror

      CALL MPL_ABORT('ABORT PRISM_DUMMY')

END SUBROUTINE prism_dummy_terminate

!**************************************************************************

SUBROUTINE prism_dummy_get_localcomm ( comp_id, local_comm, ierror )
       INTEGER(KIND=JPIM), INTENT (In)  :: comp_id
       INTEGER(KIND=JPIM), INTENT (Out) :: local_comm, ierror

       CALL MPL_ABORT('ABORT PRISM_DUMMY')

END SUBROUTINE prism_dummy_get_localcomm

!**************************************************************************

SUBROUTINE prism_dummy_def_var (var_id, name, grid_id, method_id, mask_id, &
                     &      var_nodims, var_actual_shape, var_type, ierror )
       INTEGER(KIND=JPIM), INTENT(Out)         :: var_id
       CHARACTER (len=*), INTENT(In) :: name
       INTEGER(KIND=JPIM), INTENT(In)          :: grid_id
       INTEGER(KIND=JPIM), INTENT(In)          :: method_id
       INTEGER(KIND=JPIM), INTENT(In)          :: mask_id
       INTEGER(KIND=JPIM), INTENT(In)          :: var_nodims(2)
       INTEGER(KIND=JPIM), INTENT(In)          :: var_actual_shape(1:2, 1:var_nodims(1)+var_nodims(2))
       INTEGER(KIND=JPIM), INTENT(In)          :: var_type
       INTEGER(KIND=JPIM), INTENT(Out)         :: ierror 

       CALL MPL_ABORT('ABORT PRISM_DUMMY')
     END SUBROUTINE prism_dummy_def_var

!**************************************************************************  

SUBROUTINE prism_dummy_def_grid ( grid_id, grid_name, comp_id, grid_valid_shape, &
                              &     grid_type, ierror)
       CHARACTER(len=*), INTENT(In) :: grid_name
       INTEGER(KIND=JPIM), INTENT(In)          :: comp_id
       INTEGER(KIND=JPIM), INTENT(In)          :: grid_valid_shape (2, *)
       INTEGER(KIND=JPIM), INTENT(In)          :: grid_type
       INTEGER(KIND=JPIM), INTENT(Out)         :: grid_id, ierror

       CALL MPL_ABORT('ABORT PRISM_DUMMY')

END SUBROUTINE prism_dummy_def_grid

!**************************************************************************

SUBROUTINE prism_dummy_def_partition ( grid_id, nbr_blocks, &
                      &           partition_array, extent_array, ierror )
       INTEGER(KIND=JPIM), INTENT (In)                :: grid_id
       INTEGER(KIND=JPIM), INTENT (In)                :: nbr_blocks
       INTEGER(KIND=JPIM), INTENT (In)                :: partition_array(1:nbr_blocks,*)
       INTEGER(KIND=JPIM), INTENT (In)                :: extent_array(1:nbr_blocks,*)
       INTEGER(KIND=JPIM), INTENT (Out)               :: ierror

       CALL MPL_ABORT('ABORT PRISM_DUMMY')

END SUBROUTINE prism_dummy_def_partition

!**************************************************************************

SUBROUTINE prism_dummy_reducedgrid_map( grid_id,  nbr_latitudes, &
             &    nbr_points_per_lat, ierror )
       INTEGER(KIND=JPIM), INTENT (In)                :: grid_id
       INTEGER(KIND=JPIM), INTENT (In)                :: nbr_latitudes
       INTEGER(KIND=JPIM), INTENT (In)                :: nbr_points_per_lat(nbr_latitudes)
       INTEGER(KIND=JPIM), INTENT (Out)               :: ierror

       CALL MPL_ABORT('ABORT PRISM_DUMMY')

END SUBROUTINE prism_dummy_reducedgrid_map

!**************************************************************************

SUBROUTINE prism_dummy_set_corners(grid_id, nbr_corners, corners_actual_shape, &
        &    corners_1st_array, corners_2nd_array, corners_3rd_array, ierror)
       INTEGER(KIND=JPIM), INTENT (In)                :: grid_id
       INTEGER(KIND=JPIM), INTENT (In)                :: nbr_corners
       REAL(KIND=JPRB), INTENT (In)       :: corners_1st_array (:,:)
       REAL(KIND=JPRB), INTENT (In)       :: corners_2nd_array (:,:)
       REAL(KIND=JPRB), INTENT (In)       :: corners_3rd_array (:,:)
       INTEGER(KIND=JPIM), INTENT (In)                :: corners_actual_shape (1:2, *)
       INTEGER(KIND=JPIM), INTENT(Out)                :: ierror

       CALL MPL_ABORT('ABORT PRISM_DUMMY')
END SUBROUTINE prism_dummy_set_corners

!**************************************************************************

SUBROUTINE prism_dummy_calc_newdate ( date, date_incr, ierror )
       REAL(KIND=JPRB), INTENT(In)                     :: date_incr
       TYPE (PRISM_Time_struct), INTENT(InOut) :: date
       INTEGER(KIND=JPIM), INTENT(Out)                    :: ierror

       CALL MPL_ABORT('ABORT PRISM_DUMMY')
END SUBROUTINE prism_dummy_calc_newdate

!**************************************************************************

SUBROUTINE prism_dummy_put ( field_id, date, date_bounds, data_array, info, ierror )
      INTEGER(KIND=JPIM), INTENT (In)                 :: field_id
      TYPE(PRISM_Time_Struct), INTENT (In) :: date
      TYPE(PRISM_Time_Struct), INTENT (In) :: date_bounds(2)
      REAL(KIND=JPRB),         INTENT (In) :: data_array(:,:)
      INTEGER(KIND=JPIM), INTENT (Out)               :: info
      INTEGER(KIND=JPIM), INTENT (Out)               :: ierror

      CALL MPL_ABORT('ABORT PRISM_DUMMY')

END   SUBROUTINE prism_dummy_put

!**************************************************************************

SUBROUTINE prism_dummy_get ( field_id, date, date_bounds, data_array, info, ierror )
      INTEGER(KIND=JPIM), INTENT (In)                 :: field_id
      TYPE(PRISM_Time_Struct), INTENT (In) :: date
      TYPE(PRISM_Time_Struct), INTENT (In) :: date_bounds(2)
      REAL(KIND=JPRB),    INTENT (Out)     :: data_array(:,:)
      INTEGER(KIND=JPIM), INTENT (Out)               :: info
      INTEGER(KIND=JPIM), INTENT (Out)               :: ierror

       CALL MPL_ABORT('ABORT PRISM_DUMMY')
END   SUBROUTINE prism_dummy_get

!**************************************************************************

SUBROUTINE prism_dummy_initialized ( flag, ierror )
       LOGICAL, INTENT (Out) :: flag
       INTEGER(KIND=JPIM), INTENT (Out) :: ierror
      
        CALL MPL_ABORT('ABORT PRISM_DUMMY')
END SUBROUTINE prism_dummy_initialized
END MODULE PRISM_DUMMY_MOD
