Index: NEMO/branches/2021/dev_r14312_MPI_Interface/src/OCE/LBC/lbc_nfd_generic.h90
===================================================================
--- NEMO/branches/2021/dev_r14312_MPI_Interface/src/OCE/LBC/lbc_nfd_generic.h90	(revision 14338)
+++ NEMO/branches/2021/dev_r14312_MPI_Interface/src/OCE/LBC/lbc_nfd_generic.h90	(revision 14349)
@@ -1,27 +1,5 @@
-#if defined DIM_2d
-#   define XD                       2d
-#   define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt2d(i,j)
-#   define J_SIZE(ptab)             SIZE(ptab(1)%pt2d,2)
-#   define K_SIZE(ptab)             1
-#   define L_SIZE(ptab)             1
-#endif
-#if defined DIM_3d
-#   define XD                       3d
-#   define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt3d(i,j,k)
-#   define J_SIZE(ptab)             SIZE(ptab(1)%pt3d,2)
-#   define K_SIZE(ptab)             SIZE(ptab(1)%pt3d,3)
-#   define L_SIZE(ptab)             1
-#endif
-#if defined DIM_4d
-#   define XD                       4d
-#   define ARRAY_IN(i,j,k,l,f)      ptab(f)%pt4d(i,j,k,l)
-#   define J_SIZE(ptab)             SIZE(ptab(1)%pt4d,2)
-#   define K_SIZE(ptab)             SIZE(ptab(1)%pt4d,3)
-#   define L_SIZE(ptab)             SIZE(ptab(1)%pt4d,4)
-#endif
-#define    F_SIZE(ptab)             kfld
 
-   SUBROUTINE lbc_nfd_/**/XD/**/_/**/PRECISION( ptab, cd_nat, psgn, kfld )
-      TYPE(PTR_/**/XD/**/_/**/PRECISION),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c.
+   SUBROUTINE lbc_nfd_/**/PRECISION( ptab, cd_nat, psgn, kfld )
+      TYPE(PTR_4d_/**/PRECISION),  DIMENSION(:), INTENT(inout) ::   ptab        ! pointer of arrays on which apply the b.c.
       CHARACTER(len=1), DIMENSION(:), INTENT(in   ) ::   cd_nat      ! nature of array grid-points
       REAL(PRECISION),  DIMENSION(:), INTENT(in   ) ::   psgn        ! sign used across the north fold boundary
@@ -33,8 +11,8 @@
       !!----------------------------------------------------------------------
       !
-      ipj = J_SIZE(ptab)   ! 2nd dimension
-      ipk = K_SIZE(ptab)   ! 3rd    -
-      ipl = L_SIZE(ptab)   ! 4th    -
-      ipf = F_SIZE(ptab)   ! 5th    -      use in "multi" case (array of pointers)
+      ipj = SIZE(ptab(1)%pt4d,2)
+      ipk = SIZE(ptab(1)%pt4d,3)
+      ipl = SIZE(ptab(1)%pt4d,4)
+      ipf = kfld
       !
       DO jf = 1, ipf                      ! Loop on the number of arrays to be treated
@@ -54,25 +32,25 @@
                         ii1 =                ji          ! ends at: nn_hls
                         ii2 = 2*nn_hls + 2 - ji          ! ends at: 2*nn_hls + 2 - nn_hls = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, 1                 ! point nn_hls+1
                         ii1 = nn_hls + ji
                         ii2 = ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, Ni0glo - 1        ! points from nn_hls+2 to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
                         ii1 = 2 + nn_hls      + ji - 1   ! ends at: 2 + nn_hls + jpiglo - 2*nn_hls - 1 - 1 = jpiglo - nn_hls
                         ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls - 1 ) + 1 = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, 1                 ! point jpiglo - nn_hls + 1
                         ii1 = jpiglo - nn_hls + ji
                         ii2 =          nn_hls + ji
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls-1          ! last nn_hls-1 points
                         ii1 = jpiglo - nn_hls + 1 + ji   ! ends at: jpiglo - nn_hls + 1 + nn_hls - 1 = jpiglo
                         ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls + 1 = jpiglo - 2*nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                   END DO
@@ -86,5 +64,5 @@
                         ii1 = jpiglo/2 + ji + 1          ! ends at: jpiglo/2 + (jpiglo/2 - nn_hls - 1) + 1 = jpiglo - nn_hls
                         ii2 = jpiglo/2 - ji + 1          ! ends at: jpiglo/2 - (jpiglo/2 - nn_hls - 1) + 1 = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls            ! first nn_hls points: redo them just in case (if e-w periodocity already done)
@@ -92,5 +70,5 @@
                         ii1 =                ji          ! ends at: nn_hls
                         ii2 = 2*nn_hls + 2 - ji          ! ends at: 2*nn_hls + 2 - nn_hls = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      !                            ! last nn_hls-1 points: have been / will done by e-w periodicity 
@@ -109,15 +87,15 @@
                         ii1 =                ji          ! ends at: nn_hls
                         ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, Ni0glo            ! points from nn_hls to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
                         ii1 = nn_hls          + ji       ! ends at: nn_hls + jpiglo - 2*nn_hls = jpiglo - nn_hls
                         ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls ) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls            ! last nn_hls points
                         ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
                         ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls = jpiglo - 2*nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                   END DO
@@ -131,5 +109,5 @@
                         ii1 = jpiglo/2 + ji              ! ends at: jpiglo/2 + (jpiglo/2 - nn_hls) = jpiglo - nn_hls
                         ii2 = jpiglo/2 - ji + 1          ! ends at: jpiglo/2 - (jpiglo/2 - nn_hls) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls            ! first nn_hls points: redo them just in case (if e-w periodocity already done)
@@ -137,5 +115,5 @@
                         ii1 =                ji          ! ends at: nn_hls
                         ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      !                            ! last nn_hls-1 points: have been / will done by e-w periodicity 
@@ -154,25 +132,25 @@
                         ii1 =                ji          ! ends at: nn_hls
                         ii2 = 2*nn_hls + 2 - ji          ! ends at: 2*nn_hls + 2 - nn_hls = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, 1                 ! point nn_hls+1
                         ii1 = nn_hls + ji
                         ii2 = ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, Ni0glo - 1        ! points from nn_hls+2 to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
                         ii1 = 2 + nn_hls      + ji - 1   ! ends at: 2 + nn_hls + jpiglo - 2*nn_hls - 1 - 1 = jpiglo - nn_hls
                         ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls - 1 ) + 1 = nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, 1                 ! point jpiglo - nn_hls + 1
                         ii1 = jpiglo - nn_hls + ji
                         ii2 =          nn_hls + ji
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls-1          ! last nn_hls-1 points
                         ii1 = jpiglo - nn_hls + 1 + ji   ! ends at: jpiglo - nn_hls + 1 + nn_hls - 1 = jpiglo
                         ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls + 1 = jpiglo - 2*nn_hls + 2
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                   END DO
@@ -190,15 +168,15 @@
                         ii1 =                ji          ! ends at: nn_hls
                         ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, Ni0glo            ! points from nn_hls to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
                         ii1 = nn_hls          + ji       ! ends at: nn_hls + jpiglo - 2*nn_hls = jpiglo - nn_hls
                         ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls ) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls            ! last nn_hls points
                         ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
                         ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls = jpiglo - 2*nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                   END DO
@@ -223,10 +201,10 @@
                         ii1 = jpiglo/2 + ji
                         ii2 = jpiglo/2 - ji + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) =              ARRAY_IN(ii2,ij2,jk,jl,jf)   ! Warning: pb with sign...
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) =              ptab(jf)%pt4d(ii2,ij2,jk,jl)   ! Warning: pb with sign...
                      END DO
                      DO ji = 1, 1            ! points jpiglo - nn_hls
                         ii1 = jpiglo - nn_hls + ji - 1
                         ii2 =          nn_hls + ji
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) =              ARRAY_IN(ii2,ij2,jk,jl,jf)   ! Warning: pb with sign...
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) =              ptab(jf)%pt4d(ii2,ij2,jk,jl)   ! Warning: pb with sign...
                      END DO
                      DO ji = 1, 1            ! point nn_hls: redo it just in case (if e-w periodocity already done)
@@ -234,5 +212,5 @@
                         ii1 = nn_hls + ji - 1
                         ii2 = nn_hls + ji
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) =              ARRAY_IN(ii2,ij2,jk,jl,jf)   ! Warning: pb with sign...
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) =              ptab(jf)%pt4d(ii2,ij2,jk,jl)   ! Warning: pb with sign...
                      END DO
                   END DO
@@ -246,15 +224,15 @@
                         ii1 =                ji          ! ends at: nn_hls
                         ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, Ni0glo            ! points from nn_hls to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
                         ii1 = nn_hls          + ji       ! ends at: nn_hls + jpiglo - 2*nn_hls = jpiglo - nn_hls
                         ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls ) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls            ! last nn_hls points
                         ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
                         ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls = jpiglo - 2*nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                   END DO
@@ -272,25 +250,25 @@
                         ii1 =            ji              ! ends at: nn_hls-1
                         ii2 = 2*nn_hls - ji              ! ends at: 2*nn_hls - ( nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, 1                 ! point nn_hls
                         ii1 = nn_hls + ji - 1
                         ii2 = jpiglo - ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, Ni0glo - 1        ! points from nn_hls+1 to jpiglo - nn_hls - 1  (note: Ni0glo = jpiglo - 2*nn_hls)
                         ii1 =          nn_hls + ji       ! ends at: nn_hls + ( jpiglo - 2*nn_hls - 1 ) = jpiglo - nn_hls - 1
                         ii2 = jpiglo - nn_hls - ji       ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, 1                 ! point jpiglo - nn_hls
                         ii1 = jpiglo - nn_hls + ji - 1
                         ii2 = ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls            ! last nn_hls points
                         ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
                         ii2 = jpiglo - nn_hls - ji       ! ends at: jpiglo - nn_hls - nn_hls = jpiglo - 2*nn_hls
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                   END DO
@@ -308,15 +286,15 @@
                         ii1 =                ji          ! ends at: nn_hls
                         ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, Ni0glo            ! points from nn_hls to jpiglo - nn_hls   (note: Ni0glo = jpiglo - 2*nn_hls)
                         ii1 = nn_hls          + ji       ! ends at: nn_hls + jpiglo - 2*nn_hls = jpiglo - nn_hls
                         ii2 = jpiglo - nn_hls - ji + 1   ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls ) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls            ! last nn_hls points
                         ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
                         ii2 = jpiglo - nn_hls + 1 - ji   ! ends at: jpiglo - nn_hls + 1 - nn_hls = jpiglo - 2*nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                   END DO   
@@ -330,5 +308,5 @@
                         ii1 = jpiglo/2 + ji              ! ends at: jpiglo/2 + (jpiglo/2 - nn_hls) = jpiglo - nn_hls
                         ii2 = jpiglo/2 - ji + 1          ! ends at: jpiglo/2 - (jpiglo/2 - nn_hls) + 1 = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls            ! first nn_hls points: redo them just in case (if e-w periodocity already done)
@@ -336,5 +314,5 @@
                         ii1 =                ji          ! ends at: nn_hls
                         ii2 = 2*nn_hls + 1 - ji          ! ends at: 2*nn_hls + 1 - nn_hls = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      !                            ! last nn_hls points: have been / will done by e-w periodicity 
@@ -353,25 +331,25 @@
                         ii1 =            ji              ! ends at: nn_hls-1
                         ii2 = 2*nn_hls - ji              ! ends at: 2*nn_hls - ( nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, 1                 ! point nn_hls
                         ii1 = nn_hls + ji - 1
                         ii2 = jpiglo - ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, Ni0glo - 1        ! points from nn_hls+1 to jpiglo - nn_hls - 1  (note: Ni0glo = jpiglo - 2*nn_hls)
                         ii1 =          nn_hls + ji       ! ends at: nn_hls + ( jpiglo - 2*nn_hls - 1 ) = jpiglo - nn_hls - 1
                         ii2 = jpiglo - nn_hls - ji       ! ends at: jpiglo - nn_hls - ( jpiglo - 2*nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, 1                 ! point jpiglo - nn_hls
                         ii1 = jpiglo - nn_hls + ji - 1
                         ii2 = ii1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls            ! last nn_hls points
                         ii1 = jpiglo - nn_hls + ji       ! ends at: jpiglo - nn_hls + nn_hls = jpiglo
                         ii2 = jpiglo - nn_hls - ji       ! ends at: jpiglo - nn_hls - nn_hls = jpiglo - 2*nn_hls
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                   END DO   
@@ -385,5 +363,5 @@
                         ii1 = jpiglo/2 + ji              ! ends at: jpiglo/2 + (jpiglo/2 - nn_hls) = jpiglo - nn_hls
                         ii2 = jpiglo/2 - ji              ! ends at: jpiglo/2 - (jpiglo/2 - nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      DO ji = 1, nn_hls-1          ! first nn_hls-1 points: redo them just in case (if e-w periodocity already done)
@@ -391,5 +369,5 @@
                         ii1 =            ji              ! ends at: nn_hls
                         ii2 = 2*nn_hls - ji              ! ends at: 2*nn_hls - ( nn_hls - 1 ) = nn_hls + 1
-                        ARRAY_IN(ii1,ij1,jk,jl,jf) = psgn(jf) * ARRAY_IN(ii2,ij2,jk,jl,jf)
+                        ptab(jf)%pt4d(ii1,ij1,jk,jl) = psgn(jf) * ptab(jf)%pt4d(ii2,ij2,jk,jl)
                      END DO
                      !                            ! last nn_hls points: have been / will done by e-w periodicity 
@@ -403,10 +381,4 @@
       END DO   ! ipf
       !
-   END SUBROUTINE lbc_nfd_/**/XD/**/_/**/PRECISION
+   END SUBROUTINE lbc_nfd_/**/PRECISION
 
-#undef XD
-#undef ARRAY_IN
-#undef J_SIZE
-#undef K_SIZE
-#undef L_SIZE
-#undef F_SIZE
