Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_DYN_optimization/src/OCE/BDY/bdy_oce.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_DYN_optimization/src/OCE/BDY/bdy_oce.F90	(revision 11378)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_DYN_optimization/src/OCE/BDY/bdy_oce.F90	(revision 11380)
@@ -15,4 +15,5 @@
    IMPLICIT NONE
    PUBLIC
+
 
    INTEGER, PUBLIC, PARAMETER ::   jp_bdy  = 10       !: Maximum number of bdy sets
@@ -122,13 +123,32 @@
                                                                           !: =1 => some data to be read in from data files
 !$AGRIF_DO_NOT_TREAT
-   TYPE(OBC_INDEX), DIMENSION(jp_bdy), TARGET      ::   idx_bdy           !: bdy indices (local process)
-   TYPE(OBC_DATA) , DIMENSION(jp_bdy), TARGET      ::   dta_bdy           !: bdy external data (local process)
+   ! regular :  interior domain + global halo || extended : interior domain + global halo + halo extension for time-splitting
+   TYPE(OBC_INDEX), DIMENSION(jp_bdy), TARGET      ::   idx_bdy_reg, idx_bdy_xtd    !: bdy indices (local process)
+   TYPE(OBC_DATA) , DIMENSION(jp_bdy), TARGET      ::   dta_bdy_reg, dta_bdy_xtd    !: bdy external data (local process)
+   ! pointers to switch between regular and extended, _save for the OBC_INDEX not currently used
+   TYPE(OBC_INDEX), DIMENSION(:)     , POINTER     ::   idx_bdy, idx_bdy_save       !: bdy indices (local process)
+   TYPE(OBC_DATA) , DIMENSION(:)     , POINTER     ::   dta_bdy, dta_bdy_save       !: bdy external data (local process)
 !$AGRIF_END_DO_NOT_TREAT
-   LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lsend_bdy      !: mark needed communication for given boundary, grid and neighbour
-   LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lrecv_bdy      !:  when searching in any direction
-   LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lsend_bdyint   !: mark needed communication for given boundary, grid and neighbour
-   LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lrecv_bdyint   !:  when searching towards the interior of the computational domain
-   LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lsend_bdyext   !: mark needed communication for given boundary, grid and neighbour
-   LOGICAL, ALLOCATABLE, DIMENSION(:,:,:,:) ::   lrecv_bdyext   !:  when searching towards the exterior of the computational domain
+   ! regular :  interior domain + global halo
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lsend_bdy_reg      !: mark com for given boundary, grid, neighbour and rim
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lrecv_bdy_reg      !:  when searching in any direction
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lsend_bdyint_reg   !: mark com for given boundary, grid, neighbour and rim
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lrecv_bdyint_reg   !:  when searching towards the interior of the domain
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lsend_bdyext_reg   !: mark com for given boundary, grid, neighbour and rim
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lrecv_bdyext_reg   !:  when searching towards the exterior of the domain
+   ! extended : interior domain + global halo + halo extension for time-splitting
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lsend_bdy_xtd      !: mark com for given boundary, grid, neighbour and rim
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lrecv_bdy_xtd      !:  when searching in any direction
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lsend_bdyint_xtd   !: mark com for given boundary, grid, neighbour and rim
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lrecv_bdyint_xtd   !:  when searching towards the interior of the domain
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lsend_bdyext_xtd   !: mark com for given boundary, grid, neighbour and rim
+   LOGICAL, ALLOCATABLE, TARGET, DIMENSION(:,:,:,:) :: lrecv_bdyext_xtd   !:  when searching towards the exterior of the domain
+   ! pointers to switch between regular and extended, _save for the logical array not currently used
+   LOGICAL,             POINTER, DIMENSION(:,:,:,:) :: lsend_bdy   , lsend_bdy_save
+   LOGICAL,             POINTER, DIMENSION(:,:,:,:) :: lrecv_bdy   , lrecv_bdy_save
+   LOGICAL,             POINTER, DIMENSION(:,:,:,:) :: lsend_bdyint, lsend_bdyint_save
+   LOGICAL,             POINTER, DIMENSION(:,:,:,:) :: lrecv_bdyint, lrecv_bdyint_save
+   LOGICAL,             POINTER, DIMENSION(:,:,:,:) :: lsend_bdyext, lsend_bdyext_save
+   LOGICAL,             POINTER, DIMENSION(:,:,:,:) :: lrecv_bdyext, lrecv_bdyext_save
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -158,4 +178,70 @@
    END FUNCTION bdy_oce_alloc
 
+
+   SUBROUTINE swap_bdyptr
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE  swap_bdyptr  ***
+      !!         
+      !! ** Purpose :   swap all pointers for bdy treatment
+      !!----------------------------------------------------------------------
+      CALL swap_obciptr(idx_bdy     , idx_bdy_save     )
+      CALL swap_obcdptr(dta_bdy     , dta_bdy_save     )
+      CALL swap_lptr   (lsend_bdy   , lsend_bdy_save   )
+      CALL swap_lptr   (lrecv_bdy   , lrecv_bdy_save   )
+      CALL swap_lptr   (lsend_bdyint, lsend_bdyint_save)
+      CALL swap_lptr   (lrecv_bdyint, lrecv_bdyint_save)
+      CALL swap_lptr   (lsend_bdyext, lsend_bdyext_save)
+      CALL swap_lptr   (lrecv_bdyext, lrecv_bdyext_save)
+      !
+   END SUBROUTINE swap_bdyptr
+
+
+   SUBROUTINE swap_lptr( ptr1, ptr2 )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE swap_lptr  ***
+      !!         
+      !! ** Purpose :   swap logical pointers
+      !! ** Method  :   use temporary pointer to save the target
+      !!----------------------------------------------------------------------      
+      LOGICAL, DIMENSION(:,:,:,:), POINTER, INTENT(inout)   :: ptr1, ptr2
+      LOGICAL, DIMENSION(:,:,:,:), POINTER                  :: ptrtmp
+      !!----------------------------------------------------------------------
+      ptrtmp => ptr1
+      ptr1 => ptr2
+      ptr2 => ptrtmp
+   END SUBROUTINE swap_lptr
+
+
+   SUBROUTINE swap_obciptr( ptr1, ptr2 )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE swap_obciptr  ***
+      !!         
+      !! ** Purpose :   swap pointers on OBC_INDEX types
+      !! ** Method  :   use temporary pointer to save the target
+      !!----------------------------------------------------------------------      
+      TYPE(OBC_INDEX), DIMENSION(:), POINTER, INTENT(inout)   :: ptr1, ptr2
+      TYPE(OBC_INDEX), DIMENSION(:), POINTER                  :: ptrtmp
+      !!----------------------------------------------------------------------
+      ptrtmp => ptr1
+      ptr1 => ptr2
+      ptr2 => ptrtmp
+   END SUBROUTINE swap_obciptr
+
+
+   SUBROUTINE swap_obcdptr( ptr1, ptr2 )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE swap_obcdptr  ***
+      !!         
+      !! ** Purpose :   swap pointers on OBC_DATA types
+      !! ** Method  :   use temporary pointer to save the target
+      !!----------------------------------------------------------------------      
+      TYPE(OBC_DATA), DIMENSION(:), POINTER, INTENT(inout)   :: ptr1, ptr2
+      TYPE(OBC_DATA), DIMENSION(:), POINTER                  :: ptrtmp
+      !!----------------------------------------------------------------------
+      ptrtmp => ptr1
+      ptr1 => ptr2
+      ptr2 => ptrtmp
+   END SUBROUTINE swap_obcdptr
+
    !!======================================================================
 END MODULE bdy_oce
