source: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/LBC/lbc_lnk_multi_generic.h90 @ 9090

Last change on this file since 9090 was 9090, checked in by flavoni, 3 years ago

change lbc_lnk in lbc_lnk_multi

File size: 4.4 KB
Line 
1#endif
2#if defined DIM_3d
3#   define ARRAY_TYPE(i,j,k,l)   REAL(wp), DIMENSION(i,j,k)
4#   define PTR_TYPE              TYPE(PTR_3D)
5#   define PTR_ptab              pt3d
6#endif
7#if defined DIM_4d
8#   define ARRAY_TYPE(i,j,k,l)   REAL(wp), DIMENSION(i,j,k,l)
9#   define PTR_TYPE              TYPE(PTR_4D)
10#   define PTR_ptab              pt4d
11#endif
12   SUBROUTINE ROUTINE_MULTI( pt1, cdna1, psgn1, pt2, cdna2, psgn2, pt3, cdna3, psgn3   &
13      &                    , pt4, cdna4, psgn4, pt5, cdna5, psgn5, pt6, cdna6, psgn6   &
14      &                    , pt7, cdna7, psgn7, pt8, cdna8, psgn8, pt9, cdna9, psgn9, cd_mpp, pval)
15      !!---------------------------------------------------------------------
16      ARRAY_TYPE(:,:,:,:)          , TARGET, INTENT(inout) ::   pt1     ! arrays on which the lbc is applied
17      ARRAY_TYPE(:,:,:,:), OPTIONAL, TARGET, INTENT(inout) ::   pt2  ,  pt3  , pt4  , pt5  , pt6  , pt7  , pt8  , pt9
18      CHARACTER(len=1)                     , INTENT(in   ) ::   cdna1   ! nature of pt2D. array grid-points
19      CHARACTER(len=1)   , OPTIONAL        , INTENT(in   ) ::   cdna2,  cdna3, cdna4, cdna5, cdna6, cdna7, cdna8, cdna9
20      REAL(wp)                             , INTENT(in   ) ::   psgn1   ! sign used across the north fold
21      REAL(wp)           , OPTIONAL        , INTENT(in   ) ::   psgn2,  psgn3, psgn4, psgn5, psgn6, psgn7, psgn8, psgn9   
22      CHARACTER(len=3)   , OPTIONAL        , INTENT(in   ) ::   cd_mpp  ! fill the overlap area only
23      REAL(wp)           , OPTIONAL        , INTENT(in   ) ::   pval    ! background value (used at closed boundaries)
24      !!
25      INTEGER                         ::   kfld        ! number of elements that will be attributed
26      PTR_TYPE         , DIMENSION(9) ::   ptab_ptr    ! pointer array
27      CHARACTER(len=1) , DIMENSION(9) ::   cdna_ptr    ! nature of ptab_ptr grid-points
28      REAL(wp)         , DIMENSION(9) ::   psgn_ptr    ! sign used across the north fold boundary
29      !!---------------------------------------------------------------------
30      !
31      kfld = 0          ! initial array of pointer size
32      !
33      !                 ! Load the first array
34      CALL ROUTINE_LOAD( pt1, cdna1, psgn1, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
35      !
36      !                 ! Look if more arrays are added
37      IF( PRESENT(psgn2) )   CALL ROUTINE_LOAD( pt2, cdna2, psgn2, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
38      IF( PRESENT(psgn3) )   CALL ROUTINE_LOAD( pt3, cdna3, psgn3, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
39      IF( PRESENT(psgn4) )   CALL ROUTINE_LOAD( pt4, cdna4, psgn4, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
40      IF( PRESENT(psgn5) )   CALL ROUTINE_LOAD( pt5, cdna5, psgn5, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
41      IF( PRESENT(psgn6) )   CALL ROUTINE_LOAD( pt6, cdna6, psgn6, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
42      IF( PRESENT(psgn7) )   CALL ROUTINE_LOAD( pt7, cdna7, psgn7, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
43      IF( PRESENT(psgn8) )   CALL ROUTINE_LOAD( pt8, cdna8, psgn8, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
44      IF( PRESENT(psgn9) )   CALL ROUTINE_LOAD( pt9, cdna9, psgn9, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
45      !
46      CALL lbc_lnk_ptr( ptab_ptr, cdna_ptr, psgn_ptr, kfld, cd_mpp, pval )
47      !
48   END SUBROUTINE ROUTINE_MULTI
49
50
51   SUBROUTINE ROUTINE_LOAD( ptab, cdna, psgn, ptab_ptr, cdna_ptr, psgn_ptr, kfld )
52      !!---------------------------------------------------------------------
53      ARRAY_TYPE(:,:,:,:)   , TARGET, INTENT(inout) ::   ptab       ! arrays on which the lbc is applied
54      CHARACTER(len=1)              , INTENT(in   ) ::   cdna       ! nature of pt2d array grid-points
55      REAL(wp)                      , INTENT(in   ) ::   psgn       ! sign used across the north fold boundary
56      PTR_TYPE        , DIMENSION(:), INTENT(inout) ::   ptab_ptr   ! array of pointers
57      CHARACTER(len=1), DIMENSION(:), INTENT(inout) ::   cdna_ptr   ! nature of pt2d_array array grid-points
58      REAL(wp)        , DIMENSION(:), INTENT(inout) ::   psgn_ptr   ! sign used across the north fold boundary
59      INTEGER                       , INTENT(inout) ::   kfld       ! number of elements that has been attributed
60      !!---------------------------------------------------------------------
61      !
62      kfld                    =  kfld + 1
63      ptab_ptr(kfld)%PTR_ptab => ptab
64      cdna_ptr(kfld)          =  cdna
65      psgn_ptr(kfld)          =  psgn
66      !
67   END SUBROUTINE ROUTINE_LOAD
68#undef ARRAY_TYPE
69#undef PTR_TYPE
70#undef PTR_ptab
Note: See TracBrowser for help on using the repository browser.