New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 6225 for branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/TOOLS/SIREN/src/boundary.f90 – NEMO

Ignore:
Timestamp:
2016-01-08T10:35:19+01:00 (8 years ago)
Author:
jamesharle
Message:

Update MPP_BDY_UPDATE branch to be consistent with head of trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/TOOLS/SIREN/src/boundary.f90

    r4213 r6225  
    88!> @brief 
    99!> This module manage boundary. 
    10 ! 
     10!> 
    1111!> @details 
     12!>    define type TBDY:<br/> 
     13!> @code 
     14!>    TYPE(TBDY) :: tl_bdy<br/> 
     15!> @endcode 
    1216!> 
     17!>    to initialise boundary structure:<br/> 
     18!> @code 
     19!>    tl_bdy=boundary_init(td_var, [ld_north,] [ld_south,] [ld_east,] [ld_west,] 
     20!>    [cd_north,] [cd_south,] [cd_east,] [cd_west,] [ld_oneseg]) 
     21!> @endcode 
     22!>       - td_var is variable structure 
     23!>       - ld_north is logical to force used of north boundary [optional] 
     24!>       - ld_south is logical to force used of north boundary [optional] 
     25!>       - ld_east  is logical to force used of north boundary [optional] 
     26!>       - ld_west  is logical to force used of north boundary [optional] 
     27!>       - cd_north is string character description of north boundary [optional] 
     28!>       - cd_south is string character description of south boundary [optional] 
     29!>       - cd_east  is string character description of east  boundary [optional] 
     30!>       - cd_west  is string character description of west  boundary [optional] 
     31!>       - ld_oneseg is logical to force to use only one segment for each boundary [optional] 
    1332!> 
     33!>    to get boundary cardinal:<br/> 
     34!>    - tl_bdy\%c_card 
    1435!> 
     36!>    to know if boundary is use:<br/> 
     37!>    - tl_bdy\%l_use 
    1538!> 
     39!>    to know if boundary come from namelist (cn_north,..):<br/> 
     40!>    - tl_bdy\%l_nam 
    1641!> 
    17 !> @author 
    18 !> J.Paul 
     42!>    to get the number of segment in boundary:<br/> 
     43!>    - tl_bdy\%i_nseg 
     44!> 
     45!>    to get array of segment in boundary:<br/> 
     46!>    - tl_bdy\%t_seg(:) 
     47!> 
     48!>    to get orthogonal segment index of north boundary:<br/> 
     49!>    - tl_bdy\%t_seg(jp_north)%\i_index 
     50!> 
     51!>    to get segment width of south boundary:<br/> 
     52!>    - tl_bdy\%t_seg(jp_south)%\i_width 
     53!> 
     54!>    to get segment first indice of east boundary:<br/> 
     55!>    - tl_bdy\%t_seg(jp_east)%\i_first 
     56!> 
     57!>    to get segment last indice of west boundary:<br/> 
     58!>    - tl_bdy\%t_seg(jp_west)%\i_last 
     59!> 
     60!>    to print information about boundary:<br/> 
     61!> @code 
     62!>    CALL boundary_print(td_bdy) 
     63!> @endcode 
     64!>       - td_bdy is boundary structure or a array of boundary structure 
     65!> 
     66!>    to clean boundary structure:<br/> 
     67!> @code 
     68!>    CALL boundary_clean(td_bdy) 
     69!> @endcode 
     70!> 
     71!>    to get indices of each semgent for each boundary:<br/> 
     72!> @code 
     73!>    CALL boundary_get_indices( td_bdy, td_var, ld_oneseg) 
     74!> @endcode 
     75!>       - td_bdy is boundary structure 
     76!>       - td_var is variable structure 
     77!>       - ld_oneseg is logical to force to use only one segment for each boundary [optional] 
     78!> 
     79!>    to check boundary indices and corner:<br/> 
     80!> @code 
     81!>    CALL boundary_check(td_bdy, td_var) 
     82!> @endcode 
     83!>       - td_bdy is boundary structure 
     84!>       - td_var is variable structure 
     85!> 
     86!>    to check boundary corner:<br/> 
     87!> @code 
     88!>    CALL boundary_check_corner(td_bdy, td_var) 
     89!> @endcode 
     90!>       - td_bdy is boundary structure 
     91!>       - td_var is variable structure 
     92!> 
     93!>    to create filename with cardinal name inside:<br/> 
     94!> @code 
     95!>    cl_filename=boundary_set_filename(cd_file, cd_card) 
     96!> @endcode 
     97!>       - cd_file = original file name 
     98!>       - cd_card = cardinal name 
     99!> 
     100!>    to swap array for east and north boundary:<br/> 
     101!> @code 
     102!>    CALL boundary_swap( td_var, td_bdy ) 
     103!> @endcode 
     104!>       - td_var is variable strucutre 
     105!>       - td_bdy is boundary strucutre 
     106!> 
     107!> @author J.Paul 
    19108! REVISION HISTORY: 
    20 !> @date Nov, 2013 - Initial Version 
    21 !> @todo 
    22 !> - add description generique de l'objet boundary 
     109!> @date November, 2013 - Initial Version 
     110!> @date September, 2014  
     111!> - add boundary description 
     112!> @date November, 2014  
     113!> - Fix memory leaks bug 
     114!> @date February, 2015  
     115!> - Do not change indices read from namelist 
     116!> - Change string character format of boundary read from namelist,  
     117!>  see boundary__get_info 
     118!>  
     119!> @todo add schematic to boundary structure description 
    23120!>  
    24121!> @note Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    29126   USE phycst                          ! physical constant 
    30127   USE kind                            ! F90 kind parameter 
    31    USE logger                             ! log file manager 
     128   USE logger                          ! log file manager 
    32129   USE fct                             ! basic useful function 
    33 !   USE date                            ! date manager 
    34 !   USE att                             ! attribute manager 
    35 !   USE dim                             ! dimension manager 
    36130   USE var                             ! variable manager 
    37 !   USE file                            ! file manager 
    38 !   USE iom                             ! I/O manager 
    39 !   USE dom                             ! domain  manager 
    40 !   USE grid                            ! grid manager 
    41 !   USE extrap                          ! extrapolation manager 
    42 !   USE interp                          ! interpolation manager 
    43 !   USE filter                          ! filter manager 
    44 !   USE mpp                             ! MPP manager 
    45 !   USE iom_mpp                         ! MPP I/O manager 
    46131 
    47132   IMPLICIT NONE 
    48    PRIVATE 
    49133   ! NOTE_avoid_public_variables_if_possible 
    50134 
    51135   ! type and variable 
    52    PUBLIC :: ip_ncard !< number of cardinal point 
    53    PUBLIC :: ip_card  !< table of cardinal point 
    54136   PUBLIC :: TBDY     !< boundary structure 
    55137   PUBLIC :: TSEG     !< segment structure 
    56138 
     139   PRIVATE :: im_width !< boundary width 
     140 
    57141   ! function and subroutine 
     142   PUBLIC :: boundary_copy         !< copy boundary structure 
    58143   PUBLIC :: boundary_init         !< initialise boundary structure 
    59144   PUBLIC :: boundary_print        !< print information about boundary 
     
    63148   PUBLIC :: boundary_check_corner !< check boundary corner 
    64149   PUBLIC :: boundary_set_filename !< set boundary filename 
    65    PUBLIC :: boundary_clean_interp !< clean interpolated boundary 
    66150   PUBLIC :: boundary_swap         !< swap array for north and east boundary 
    67151 
    68    PRIVATE :: boundary__init_wrapper    !< initialise a boundary structure 
    69    PRIVATE :: boundary__init            !< initialise basically a boundary structure 
    70 !   PRIVATE :: boundary__copy            !< copy boundary structure in another 
    71    PRIVATE :: boundary__copy_unit       !< copy boundary structure in another 
    72    PRIVATE :: boundary__copy_tab        !< copy boundary structure in another 
    73    PRIVATE :: boundary__add_seg         !< add one segment structure to a boundary  
    74    PRIVATE :: boundary__del_seg         !< remove all segments of a boundary 
    75    PRIVATE :: boundary__get_info        !< get boundary information from boundary description string character. 
    76    PRIVATE :: boundary__get_seg_number  !< compute the number of sea segment for one boundary 
    77    PRIVATE :: boundary__get_seg_indices !< get segment indices for one boundary  
    78    PRIVATE :: boundary__print_unit      !< print information about one boundary 
    79    PRIVATE :: boundary__print_tab       !< print information about a table of boundary 
     152   PRIVATE :: boundary__clean_unit      ! clean boundary structure  
     153   PRIVATE :: boundary__clean_arr       ! clean array of boundary structure  
     154   PRIVATE :: boundary__init_wrapper    ! initialise a boundary structure 
     155   PRIVATE :: boundary__init            ! initialise basically a boundary structure 
     156   PRIVATE :: boundary__copy_unit       ! copy boundary structure in another 
     157   PRIVATE :: boundary__copy_arr        ! copy boundary structure in another 
     158   PRIVATE :: boundary__add_seg         ! add one segment structure to a boundary  
     159   PRIVATE :: boundary__del_seg         ! remove all segments of a boundary 
     160   PRIVATE :: boundary__get_info        ! get boundary information from boundary description string character. 
     161   PRIVATE :: boundary__get_seg_number  ! compute the number of sea segment for one boundary 
     162   PRIVATE :: boundary__get_seg_indices ! get segment indices for one boundary  
     163   PRIVATE :: boundary__print_unit      ! print information about one boundary 
     164   PRIVATE :: boundary__print_arr       ! print information about a array of boundary 
    80165    
    81    PRIVATE :: seg__init    !< initialise segment structure 
    82    PRIVATE :: seg__clean   !< clean segment structure 
    83    PRIVATE :: seg__copy    !< copy segment structure in another 
    84  
    85    !> @struct 
    86    TYPE TSEG    
     166   PRIVATE :: seg__init       ! initialise segment structure 
     167   PRIVATE :: seg__clean      ! clean segment structure 
     168   PRIVATE :: seg__clean_unit ! clean one segment structure 
     169   PRIVATE :: seg__clean_arr  ! clean array of segment structure 
     170   PRIVATE :: seg__copy       ! copy segment structure in another 
     171   PRIVATE :: seg__copy_unit  ! copy segment structure in another 
     172   PRIVATE :: seg__copy_arr   ! copy array of segment structure in another 
     173 
     174   TYPE TSEG   !< segment structure 
    87175      INTEGER(i4) :: i_index = 0 !< segment index 
    88176      INTEGER(i4) :: i_width = 0 !< segment width 
     
    91179   END TYPE TSEG 
    92180 
    93    !> @struct 
    94    TYPE TBDY 
    95       CHARACTER(LEN=lc) :: c_card = '' 
    96       LOGICAL           :: l_use  = .FALSE. 
    97       INTEGER(i4)       :: i_nseg = 0 
    98       TYPE(TSEG), DIMENSION(:), POINTER :: t_seg => NULL() 
     181   TYPE TBDY !< boundary structure 
     182      CHARACTER(LEN=lc) :: c_card = ''          !< boundary cardinal 
     183      LOGICAL           :: l_use  = .FALSE.     !< boundary use or not  
     184      LOGICAL           :: l_nam  = .FALSE.     !< boundary get from namelist 
     185      INTEGER(i4)       :: i_nseg = 0           !< number of segment in boundary 
     186      TYPE(TSEG), DIMENSION(:), POINTER :: t_seg => NULL() !<  array of segment structure 
    99187   END TYPE TBDY 
    100188 
    101    INTEGER(i4), PARAMETER :: ip_ncard=4 
    102    CHARACTER(LEN=lc), DIMENSION(ip_ncard), PARAMETER :: ip_card = & 
    103    &  (/ 'north', & 
    104    &     'south', & 
    105    &     'east ', & 
    106    &     'west ' /) 
    107  
    108    INTEGER(i4), PARAMETER :: jp_north=1 
    109    INTEGER(i4), PARAMETER :: jp_south=2 
    110    INTEGER(i4), PARAMETER :: jp_east =3 
    111    INTEGER(i4), PARAMETER :: jp_west =4 
    112  
     189   ! module variable 
    113190   INTEGER(i4), PARAMETER :: im_width=10 
    114191 
     
    119196   INTERFACE boundary_print 
    120197      MODULE PROCEDURE boundary__print_unit  
    121       MODULE PROCEDURE boundary__print_tab  
     198      MODULE PROCEDURE boundary__print_arr  
    122199   END INTERFACE boundary_print 
    123200 
    124    INTERFACE ASSIGNMENT(=) 
     201   INTERFACE boundary_clean 
     202      MODULE PROCEDURE boundary__clean_unit    
     203      MODULE PROCEDURE boundary__clean_arr     
     204   END INTERFACE 
     205 
     206   INTERFACE seg__clean 
     207      MODULE PROCEDURE seg__clean_unit    
     208      MODULE PROCEDURE seg__clean_arr     
     209   END INTERFACE 
     210 
     211   INTERFACE boundary_copy 
    125212      MODULE PROCEDURE boundary__copy_unit  
    126       MODULE PROCEDURE boundary__copy_tab  
    127       MODULE PROCEDURE seg__copy   ! copy segment structure 
     213      MODULE PROCEDURE boundary__copy_arr  
     214   END INTERFACE    
     215 
     216   INTERFACE seg__copy 
     217      MODULE PROCEDURE seg__copy_unit   ! copy segment structure 
     218      MODULE PROCEDURE seg__copy_arr    ! copy array of segment structure 
    128219   END INTERFACE    
    129220 
     
    131222   !------------------------------------------------------------------- 
    132223   !> @brief 
    133    !> This subroutine copy boundary structure in another boundary 
    134    !> structure 
     224   !> This subroutine copy a array of boundary structure in another one 
    135225   !> @details  
    136226   !> 
     227   !> @warning do not use on the output of a function who create or read an 
     228   !> attribute (ex: tl_bdy=boundary_copy(boundary_init()) is forbidden). 
     229   !> This will create memory leaks. 
    137230   !> @warning to avoid infinite loop, do not use any function inside  
    138231   !> this subroutine 
    139232   !> 
    140233   !> @author J.Paul 
    141    !> - Nov, 2013- Initial Version 
     234   !> @date November, 2013 - Initial Version 
     235   !> @date November, 2014 
     236   !> - use function instead of overload assignment operator  
     237   !> (to avoid memory leak) 
    142238   ! 
    143    !> @param[out] td_bdy1  : boundary structure 
    144    !> @param[in] td_bdy2  : boundary structure 
     239   !> @param[in] td_bdy   array of boundary structure 
     240   !> @return copy of input array of boundary structure  
    145241   !------------------------------------------------------------------- 
    146    !> @code 
    147    SUBROUTINE boundary__copy_tab( td_bdy1, td_bdy2 ) 
     242   FUNCTION boundary__copy_arr( td_bdy ) 
    148243      IMPLICIT NONE 
    149244      ! Argument 
    150       TYPE(TBDY), DIMENSION(:), INTENT(OUT) :: td_bdy1 
    151       TYPE(TBDY), DIMENSION(:), INTENT(IN)  :: td_bdy2 
     245      TYPE(TBDY), DIMENSION(:), INTENT(IN)  :: td_bdy 
     246      ! function 
     247      TYPE(TBDY), DIMENSION(SIZE(td_bdy(:))) :: boundary__copy_arr 
    152248 
    153249      ! local variable 
     
    156252      !---------------------------------------------------------------- 
    157253 
    158       IF( SIZE(td_bdy1(:)) /= SIZE(td_bdy2(:)) )THEN 
    159          CALL logger_error("BOUNDARY COPY: dimension of table of boundary differ") 
    160       ELSE 
    161          DO jk=1,SIZE(td_bdy1(:)) 
    162             td_bdy1(jk)=td_bdy2(jk) 
    163          ENDDO 
    164       ENDIF 
    165    END SUBROUTINE boundary__copy_tab 
    166    !> @endcode 
     254      DO jk=1,SIZE(td_bdy(:)) 
     255         boundary__copy_arr(jk)=boundary_copy(td_bdy(jk)) 
     256      ENDDO 
     257 
     258   END FUNCTION boundary__copy_arr 
    167259   !------------------------------------------------------------------- 
    168260   !> @brief 
    169    !> This subroutine copy boundary structure in another boundary 
    170    !> structure 
     261   !> This subroutine copy boundary structure in another one 
    171262   !> @details  
    172263   !> 
     264   !> @warning do not use on the output of a function who create or read an 
     265   !> attribute (ex: tl_bdy=boundary_copy(boundary_init()) is forbidden). 
     266   !> This will create memory leaks. 
    173267   !> @warning to avoid infinite loop, do not use any function inside  
    174268   !> this subroutine 
    175269   !> 
    176270   !> @author J.Paul 
    177    !> - Nov, 2013- Initial Version 
     271   !> @date November, 2013 - Initial Version 
     272   !> @date November, 2014 
     273   !> - use function instead of overload assignment operator  
     274   !> (to avoid memory leak) 
    178275   ! 
    179    !> @param[out] td_bdy1  : boundary structure 
    180    !> @param[in] td_bdy2  : boundary structure 
     276   !> @param[in] td_bdy  boundary structure 
     277   !> @return copy of input boundary structure 
    181278   !------------------------------------------------------------------- 
    182    !> @code 
    183    SUBROUTINE boundary__copy_unit( td_bdy1, td_bdy2 ) 
     279   FUNCTION boundary__copy_unit( td_bdy ) 
    184280      IMPLICIT NONE 
    185281      ! Argument 
    186       TYPE(TBDY), INTENT(OUT) :: td_bdy1 
    187       TYPE(TBDY), INTENT(IN)  :: td_bdy2 
     282      TYPE(TBDY), INTENT(IN)  :: td_bdy 
     283      ! function 
     284      TYPE(TBDY) :: boundary__copy_unit 
    188285 
    189286      ! local variable 
     
    193290 
    194291      ! copy variable name, id, .. 
    195       td_bdy1%c_card     = TRIM(td_bdy2%c_card) 
    196       td_bdy1%i_nseg     = td_bdy2%i_nseg 
    197       td_bdy1%l_use      = td_bdy2%l_use 
     292      boundary__copy_unit%c_card     = TRIM(td_bdy%c_card) 
     293      boundary__copy_unit%i_nseg     = td_bdy%i_nseg 
     294      boundary__copy_unit%l_use      = td_bdy%l_use 
    198295 
    199296      ! copy segment 
    200       IF( ASSOCIATED(td_bdy1%t_seg) ) DEALLOCATE(td_bdy1%t_seg) 
    201       IF( ASSOCIATED(td_bdy2%t_seg) .AND. td_bdy1%i_nseg > 0 )THEN 
    202          ALLOCATE( td_bdy1%t_seg(td_bdy1%i_nseg) ) 
    203          DO ji=1,td_bdy1%i_nseg 
    204             td_bdy1%t_seg(ji)=td_bdy2%t_seg(ji) 
     297      IF( ASSOCIATED(boundary__copy_unit%t_seg) )THEN 
     298         CALL seg__clean(boundary__copy_unit%t_seg(:)) 
     299         DEALLOCATE(boundary__copy_unit%t_seg) 
     300      ENDIF 
     301      IF( ASSOCIATED(td_bdy%t_seg) .AND. boundary__copy_unit%i_nseg > 0 )THEN 
     302         ALLOCATE( boundary__copy_unit%t_seg(boundary__copy_unit%i_nseg) ) 
     303         DO ji=1,boundary__copy_unit%i_nseg 
     304            boundary__copy_unit%t_seg(ji)=td_bdy%t_seg(ji) 
    205305         ENDDO 
    206306      ENDIF 
    207307 
    208    END SUBROUTINE boundary__copy_unit 
    209    !> @endcode 
     308   END FUNCTION boundary__copy_unit 
    210309   !------------------------------------------------------------------- 
    211310   !> @brief This subroutine clean boundary structure 
    212311   ! 
    213312   !> @author J.Paul 
    214    !> - Nov, 2013- Initial Version 
     313   !> @date November, 2013 - Initial Version 
    215314   ! 
    216    !> @param[inout] td_bdy : boundary strucutre 
     315   !> @param[inout] td_bdy boundary strucutre 
    217316   !------------------------------------------------------------------- 
    218    !> @code 
    219    SUBROUTINE boundary_clean( td_bdy ) 
     317   SUBROUTINE boundary__clean_unit( td_bdy ) 
    220318      IMPLICIT NONE 
    221319      ! Argument 
     
    226324 
    227325      ! loop indices 
     326      !---------------------------------------------------------------- 
     327 
     328      CALL logger_info( & 
     329      &  " CLEAN: reset boundary "//TRIM(td_bdy%c_card) ) 
     330 
     331      ! del segment 
     332      IF( ASSOCIATED(td_bdy%t_seg) )THEN 
     333         ! clean each segment 
     334         CALL seg__clean(td_bdy%t_seg(:) ) 
     335         DEALLOCATE( td_bdy%t_seg ) 
     336      ENDIF 
     337 
     338      ! replace by empty structure 
     339      td_bdy=boundary_copy(tl_bdy) 
     340 
     341   END SUBROUTINE boundary__clean_unit 
     342   !------------------------------------------------------------------- 
     343   !> @brief This subroutine clean array of boundary structure 
     344   ! 
     345   !> @author J.Paul 
     346   !> @date September, 2014 - Initial Version 
     347   ! 
     348   !> @param[inout] td_bdy boundary strucutre 
     349   !------------------------------------------------------------------- 
     350   SUBROUTINE boundary__clean_arr( td_bdy ) 
     351      IMPLICIT NONE 
     352      ! Argument 
     353      TYPE(TBDY), DIMENSION(:), INTENT(INOUT) :: td_bdy 
     354 
     355      ! local variable 
     356      ! loop indices 
    228357      INTEGER(i4) :: ji 
    229358      !---------------------------------------------------------------- 
    230359 
    231       CALL logger_info( & 
    232       &  " CLEAN: reset boundary "//TRIM(td_bdy%c_card) ) 
    233  
    234       ! del segment 
    235       IF( ASSOCIATED(td_bdy%t_seg) )THEN 
    236          ! clean each attribute 
    237          DO ji=td_bdy%i_nseg,1,-1 
    238             CALL seg__clean(td_bdy%t_seg(ji) ) 
    239          ENDDO 
    240          DEALLOCATE( td_bdy%t_seg ) 
    241       ENDIF 
    242  
    243       ! replace by empty structure 
    244       td_bdy=tl_bdy 
    245  
    246    END SUBROUTINE boundary_clean 
    247    !> @endcode 
    248    !-------------------------------------------------------------------  
    249    !> @brief This function put cardinal name inside file name   
     360      DO ji=SIZE(td_bdy(:)),1,-1 
     361         CALL boundary_clean( td_bdy(ji) ) 
     362      ENDDO 
     363 
     364   END SUBROUTINE boundary__clean_arr 
     365   !-------------------------------------------------------------------  
     366   !> @brief This function put cardinal name and date inside file name. 
    250367   !  
    251368   !> @details  
    252    !  
     369   !>    Examples : 
     370   !>       cd_file="boundary.nc" 
     371   !>       cd_card="west"  
     372   !>       id_seg =2 
     373   !>       cd_date=y2015m07d16 
     374   !>  
     375   !>       function return "boundary_west_2_y2015m07d16.nc" 
     376   !>  
     377   !>       cd_file="boundary.nc" 
     378   !>       cd_card="west"  
     379   !>  
     380   !>       function return "boundary_west.nc" 
     381   !>  
    253382   !> @author J.Paul  
    254    !> - Nov, 2013- Initial Version  
    255    !  
    256    !> @param[in] cd_file : file name  
    257    !> @param[in] cd_card : cardinal name  
     383   !> @date November, 2013 - Initial Version  
     384   !  
     385   !> @param[in] cd_file   file name  
     386   !> @param[in] cd_card   cardinal name  
     387   !> @param[in] id_seg    segment number  
     388   !> @param[in] cd_date   file date (format: y????m??d??)  
    258389   !> @return file name with cardinal name inside 
    259390   !-------------------------------------------------------------------  
    260    !> @code  
    261    FUNCTION boundary_set_filename(cd_file, cd_card)  
     391   FUNCTION boundary_set_filename(cd_file, cd_card, id_seg, cd_date)  
    262392      IMPLICIT NONE  
    263393      ! Argument 
    264394      CHARACTER(LEN=*), INTENT(IN) :: cd_file 
    265395      CHARACTER(LEN=*), INTENT(IN) :: cd_card 
     396      INTEGER(i4)     , INTENT(IN), OPTIONAL :: id_seg 
     397      CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_date 
    266398 
    267399      ! function  
     
    273405      CHARACTER(LEN=lc) :: cl_base 
    274406      CHARACTER(LEN=lc) :: cl_suffix 
     407      CHARACTER(LEN=lc) :: cl_segnum 
     408      CHARACTER(LEN=lc) :: cl_date 
    275409      CHARACTER(LEN=lc) :: cl_name 
     410 
     411      INTEGER(i4)       :: il_ind 
     412      INTEGER(i4)       :: il_indend 
     413 
    276414      ! loop indices  
    277415      !----------------------------------------------------------------  
     
    288426         cl_base  =fct_split(TRIM(cl_basename),1,'.') 
    289427         cl_suffix=fct_split(TRIM(cl_basename),2,'.') 
    290  
    291          cl_name=TRIM(cl_base)//"_"//TRIM(cd_card)//"."//TRIM(cl_suffix) 
     428          
     429         ! add segment number 
     430         IF( PRESENT(id_seg) )THEN 
     431            cl_segnum="_"//TRIM(fct_str(id_seg)) 
     432         ELSE 
     433            cl_segnum="" 
     434         ENDIF 
     435 
     436         ! add date 
     437         IF( PRESENT(cd_date) )THEN 
     438            cl_date="_"//TRIM(ADJUSTL(cd_date)) 
     439         ELSE 
     440            cl_date="" 
     441         ENDIF 
     442 
     443         ! special case for obcdta 
     444         il_ind=INDEX(cl_base,'_obcdta_') 
     445         IF( il_ind/=0 )THEN 
     446            il_ind=il_ind-1+8 
     447            il_indend=LEN_TRIM(cl_base) 
     448 
     449            cl_name=TRIM(cl_base(1:il_ind))//TRIM(cd_card)//& 
     450               &     TRIM(cl_segnum)//"_"//TRIM(cl_base(il_ind+1:il_indend))//& 
     451               &     TRIM(cl_date)//"."//TRIM(cl_suffix) 
     452         ELSE 
     453            cl_name=TRIM(cl_base)//"_"//TRIM(cd_card)//TRIM(cl_segnum)//& 
     454               &     TRIM(cl_date)//"."//TRIM(cl_suffix) 
     455         ENDIF 
    292456 
    293457         boundary_set_filename=TRIM(cl_dirname)//"/"//TRIM(cl_name) 
     
    298462  
    299463   END FUNCTION boundary_set_filename  
    300    !> @endcode 
    301    !-------------------------------------------------------------------  
    302    !> @brief This function initialise a boundary structure  
     464   !-------------------------------------------------------------------  
     465   !> @brief This function initialise a boundary structure. 
    303466   !  
    304467   !> @details  
     
    318481   !> specify it for each segment. 
    319482   !> ex : cn_north='index1,first1,last1(width)|index2,first2,last2' 
    320    !  
     483   !> 
     484   !> @note Boundaries are compute on T point, but expressed on U,V point. 
     485   !> change will be done to get data on other point when need be.  
     486   !> 
    321487   !> @author J.Paul  
    322    !> - Nov, 2013- Initial Version  
    323    !  
    324    !> @param[in] td_var : variable structure  
    325    !> @param[in] ld_north : use north boundary or not  
    326    !> @param[in] ld_south : use south boundary or not  
    327    !> @param[in] ld_east  : use east  boundary or not  
    328    !> @param[in] ld_west  : use west  boundary or not  
    329    !> @param[in] cd_north : north boundary description  
    330    !> @param[in] cd_south : south boundary description  
    331    !> @param[in] cd_east  : east  boundary description  
    332    !> @param[in] cd_west  : west  boundary description  
     488   !> @date November, 2013 - Initial Version  
     489   !> @date September, 2014 
     490   !> - add boolean to use only one segment for each boundary 
     491   !> - check boundary width 
     492   !  
     493   !> @param[in] td_var    variable structure  
     494   !> @param[in] ld_north  use north boundary or not  
     495   !> @param[in] ld_south  use south boundary or not  
     496   !> @param[in] ld_east   use east  boundary or not  
     497   !> @param[in] ld_west   use west  boundary or not  
     498   !> @param[in] cd_north  north boundary description  
     499   !> @param[in] cd_south  south boundary description  
     500   !> @param[in] cd_east   east  boundary description  
     501   !> @param[in] cd_west   west  boundary description  
     502   !> @param[in] ld_oneseg force to use only one segment for each boundary  
    333503   !> @return boundary structure 
    334    !> @todo use bondary_get_indices !!!! 
    335    !-------------------------------------------------------------------  
    336    !> @code  
     504   !-------------------------------------------------------------------  
    337505   FUNCTION boundary__init_wrapper(td_var, & 
    338506   &                               ld_north, ld_south, ld_east, ld_west, & 
     
    356524 
    357525      ! local variable  
     526      INTEGER(i4)                            :: il_width 
     527      INTEGER(i4)      , DIMENSION(ip_ncard) :: il_max_width 
    358528      INTEGER(i4)      , DIMENSION(ip_ncard) :: il_index 
    359529      INTEGER(i4)      , DIMENSION(ip_ncard) :: il_min 
     
    390560         tl_bdy(jp_west )=boundary__init('west ',ld_west ) 
    391561 
    392          ! if EW cyclic no east west boundary 
     562         ! if EW cyclic no east west boundary and force to use one segment 
    393563         IF( td_var%i_ew >= 0 )THEN 
    394             CALL logger_debug("BOUNDARY INIT: cyclic no East West boundary") 
     564            CALL logger_info("BOUNDARY INIT: cyclic domain, "//& 
     565            &  "no East West boundary") 
    395566            tl_bdy(jp_east )%l_use=.FALSE. 
    396567            tl_bdy(jp_west )%l_use=.FALSE. 
     568 
     569            CALL logger_info("BOUNDARY INIT: force to use one segment due"//& 
     570            &  " to EW cyclic domain") 
     571            ll_oneseg=.TRUE. 
    397572         ENDIF 
    398573 
    399          ! attention cas U /= T ??? 
    400          il_index(jp_north)=td_var%t_dim(2)%i_len-ig_ghost 
    401          il_index(jp_south)=1+ig_ghost 
    402          il_index(jp_east )=td_var%t_dim(1)%i_len-ig_ghost 
    403          il_index(jp_west )=1+ig_ghost 
     574         il_index(jp_north)=td_var%t_dim(2)%i_len-ip_ghost 
     575         il_index(jp_south)=1+ip_ghost 
     576         il_index(jp_east )=td_var%t_dim(1)%i_len-ip_ghost 
     577         il_index(jp_west )=1+ip_ghost 
    404578 
    405579         il_min(jp_north)=1 
     
    419593         IF( PRESENT(cd_west ) ) cl_card(jp_west )=TRIM(cd_west ) 
    420594 
     595         il_max_width(jp_north)=INT(0.5*(td_var%t_dim(2)%i_len-2*ip_ghost)) 
     596         il_max_width(jp_south)=INT(0.5*(td_var%t_dim(2)%i_len-2*ip_ghost)) 
     597         il_max_width(jp_east )=INT(0.5*(td_var%t_dim(1)%i_len-2*ip_ghost)) 
     598         il_max_width(jp_west )=INT(0.5*(td_var%t_dim(1)%i_len-2*ip_ghost)) 
     599 
    421600         DO jk=1,ip_ncard 
    422601 
     602            ! check boundary width 
     603            IF( il_max_width(jk) <= im_width )THEN 
     604               IF( il_max_width(jk) <= 0 )THEN 
     605                  CALL logger_fatal("BOUNDARY INIT: domain too small to define"//& 
     606                  &                " boundaries.") 
     607               ELSE 
     608                  CALL logger_warn("BOUNDARY INIT: default boundary width too "//& 
     609                  &                "large for boundaries. force to use boundary"//& 
     610                  &                " on one point") 
     611                  il_width=1 
     612               ENDIF 
     613            ELSE 
     614               il_width=im_width 
     615            ENDIF 
     616 
    423617            ! define default segment 
    424             tl_seg=seg__init(il_index(jk),im_width,il_min(jk),il_max(jk)) 
     618            tl_seg=seg__init(il_index(jk),il_width,il_min(jk),il_max(jk)) 
    425619 
    426620            IF( tl_bdy(jk)%l_use )THEN 
    427621 
    428622               ! get namelist information 
    429                tl_tmp=boundary__get_info(cl_card(jk)) 
     623               tl_tmp=boundary__get_info(cl_card(jk),jk) 
     624 
     625               ! get segments indices 
    430626               DO ji=1,tl_tmp%i_nseg 
    431627                  CALL boundary__add_seg(tl_bdy(jk),tl_tmp%t_seg(ji)) 
    432628               ENDDO 
     629               ! indices from namelist or not 
     630               tl_bdy(jk)%l_nam=tl_tmp%l_nam 
     631 
    433632               CALL boundary_clean(tl_tmp) 
    434633 
     
    453652 
    454653            ENDIF 
     654            ! clean 
     655            CALL seg__clean(tl_seg) 
    455656 
    456657         ENDDO 
     
    460661         CALL boundary_check(tl_bdy, td_var) 
    461662 
    462          boundary__init_wrapper(:)=tl_bdy(:) 
     663         boundary__init_wrapper(:)=boundary_copy(tl_bdy(:)) 
    463664 
    464665         ! clean 
     
    470671  
    471672   END FUNCTION boundary__init_wrapper  
    472    !> @endcode  
    473673   !-------------------------------------------------------------------  
    474674   !> @brief This function initialise basically a boundary structure with 
     
    480680   !  
    481681   !> @author J.Paul  
    482    !> - Nov, 2013- Initial Version  
    483    !  
    484    !> @param[in]  cd_card : cardinal name 
    485    !> @param[in]  ld_use  : boundary use or not 
    486    !> @param[in]  td_seg  : segment structure 
     682   !> @date November, 2013 - Initial Version  
     683   !  
     684   !> @param[in]  cd_card cardinal name 
     685   !> @param[in]  ld_use  boundary use or not 
     686   !> @param[in]  td_seg  segment structure 
    487687   !> @return boundary structure 
    488688   !-------------------------------------------------------------------  
    489    !> @code  
    490    FUNCTION boundary__init( cd_card, ld_use, td_seg )  
     689   FUNCTION boundary__init( cd_card, ld_use, ld_nam, td_seg )  
    491690      IMPLICIT NONE  
    492691      ! Argument 
    493692      CHARACTER(LEN=*), INTENT(IN) :: cd_card 
    494693      LOGICAL         , INTENT(IN), OPTIONAL :: ld_use  
     694      LOGICAL         , INTENT(IN), OPTIONAL :: ld_nam  
    495695      TYPE(TSEG)      , INTENT(IN), OPTIONAL :: td_seg 
    496696 
     
    511711            IF( PRESENT(ld_use) ) boundary__init%l_use=ld_use 
    512712 
     713            boundary__init%l_nam=.FALSE. 
     714            IF( PRESENT(ld_nam) ) boundary__init%l_nam=ld_nam 
     715 
    513716            IF( PRESENT(td_seg) )THEN 
    514717               CALL boundary__add_seg(boundary__init, td_seg) 
     
    520723 
    521724   END FUNCTION boundary__init 
    522    !> @endcode 
    523725   !-------------------------------------------------------------------  
    524726   !> @brief This subroutine add one segment structure to a boundary structure  
     
    527729   !  
    528730   !> @author J.Paul  
    529    !> - Nov, 2013- Initial Version  
    530    !  
    531    !> @param[inout] td_bdy : boundary structure   
    532    !> @param[in] td_seg : segment structure   
    533    !-------------------------------------------------------------------  
    534    !> @code  
     731   !> @date November, 2013 - Initial Version  
     732   !  
     733   !> @param[inout] td_bdy boundary structure   
     734   !> @param[in] td_seg    segment structure   
     735   !-------------------------------------------------------------------  
    535736   SUBROUTINE boundary__add_seg(td_bdy, td_seg)  
    536737      IMPLICIT NONE  
     
    554755         ELSE 
    555756            ! save temporary segment 
    556             tl_seg(:)=td_bdy%t_seg(:) 
    557  
     757            tl_seg(:)=seg__copy(td_bdy%t_seg(:)) 
     758 
     759            CALL seg__clean(td_bdy%t_seg(:)) 
    558760            DEALLOCATE( td_bdy%t_seg ) 
    559761            ALLOCATE( td_bdy%t_seg(td_bdy%i_nseg+1), stat=il_status ) 
     
    564766 
    565767            ! copy segment in boundary before 
    566             td_bdy%t_seg(1:td_bdy%i_nseg)=tl_seg(:) 
    567  
     768            td_bdy%t_seg(1:td_bdy%i_nseg)=seg__copy(tl_seg(:)) 
     769 
     770            ! clean 
     771            CALL seg__clean(tl_seg(:)) 
    568772            DEALLOCATE(tl_seg)             
    569773             
     
    572776         ! no segment in boundary structure 
    573777         IF( ASSOCIATED(td_bdy%t_seg) )THEN 
     778            CALL seg__clean(td_bdy%t_seg(:)) 
    574779            DEALLOCATE(td_bdy%t_seg) 
    575780         ENDIF 
     
    585790 
    586791      ! add new segment 
    587       td_bdy%t_seg(td_bdy%i_nseg)=td_seg 
     792      td_bdy%t_seg(td_bdy%i_nseg)=seg__copy(td_seg) 
    588793 
    589794   END SUBROUTINE boundary__add_seg  
    590    !> @endcode 
    591795   !-------------------------------------------------------------------  
    592796   !> @brief This subroutine remove all segments of a boundary structure  
     
    595799   !  
    596800   !> @author J.Paul  
    597    !> - Nov, 2013- Initial Version  
    598    !  
    599    !> @param[inout]  td_bdy : boundary structure 
    600    !-------------------------------------------------------------------  
    601    !> @code  
     801   !> @date November, 2013 - Initial Version  
     802   !  
     803   !> @param[inout]  td_bdy   boundary structure 
     804   !-------------------------------------------------------------------  
    602805   SUBROUTINE boundary__del_seg(td_bdy)  
    603806      IMPLICIT NONE  
     
    610813 
    611814      IF( ASSOCIATED(td_bdy%t_seg) )THEN 
     815         CALL seg__clean(td_bdy%t_seg(:)) 
    612816         DEALLOCATE(td_bdy%t_seg) 
    613817      ENDIF 
     
    616820 
    617821   END SUBROUTINE boundary__del_seg  
    618    !> @endcode 
    619822   !-------------------------------------------------------------------  
    620823   !> @brief This function get information about boundary from string character.  
     
    624827   !> orthogonal index, first and last indices, of each segment.  
    625828   !> And also the width of all segments of this boundary. 
    626    !>   cn_north='index1,first1,last1(width)|index2,first2,last2' 
     829   !>   cn_north='index1,first1:last1(width)|index2,first2:last2' 
    627830   !>  
    628831   !> @author J.Paul  
    629    !> - Nov, 2013- Initial Version  
    630    !  
    631    !> @param[in] cd_card : boundary description 
     832   !> @date November, 2013 - Initial Version  
     833   !> @date february, 2015  
     834   !> - do not change indices read from namelist 
     835   !> - change format cn_north 
     836   !  
     837   !> @param[in] cd_card   boundary description 
     838   !> @param[in] id_jcard  boundary index 
    632839   !> @return boundary structure 
    633840   !-------------------------------------------------------------------  
    634    !> @code  
    635    FUNCTION boundary__get_info(cd_card)  
     841   FUNCTION boundary__get_info(cd_card, id_jcard)  
    636842      IMPLICIT NONE  
    637843      ! Argument  
    638844      CHARACTER(LEN=lc), INTENT(IN) :: cd_card 
     845      INTEGER(i4)      , INTENT(IN) :: id_jcard 
    639846 
    640847      ! function  
     
    649856      CHARACTER(LEN=lc) :: cl_index 
    650857      CHARACTER(LEN=lc) :: cl_width 
     858      CHARACTER(LEN=lc) :: cl_tmp 
    651859      CHARACTER(LEN=lc) :: cl_first 
    652860      CHARACTER(LEN=lc) :: cl_last  
     
    665873      ! width should be the same for all segment of one boundary 
    666874      IF( TRIM(cl_seg)   /= '' )THEN 
     875 
     876         ! initialise boundary 
     877         ! temporaty boundary, so it doesn't matter which caridnal is used 
     878         boundary__get_info=boundary__init('north',ld_nam=.TRUE.) 
     879 
    667880         il_ind1=SCAN(fct_lower(cl_seg),'(') 
    668881         IF( il_ind1 /=0 )THEN 
     
    678891            ENDIF 
    679892         ENDIF 
     893 
    680894      ENDIF  
    681895 
     
    686900         il_ind1=SCAN(fct_lower(cl_index),'(') 
    687901         IF( il_ind1 /=0 )THEN 
    688             il_ind2=SCAN(fct_lower(cl_index),'(') 
     902            il_ind2=SCAN(fct_lower(cl_index),')') 
    689903            IF( il_ind2 /=0 )THEN 
    690904               cl_index=TRIM(cl_index(:il_ind1-1))//TRIM(cl_index(il_ind2+1:)) 
     
    695909         ENDIF 
    696910       
    697          cl_first=fct_split(cl_seg,2,',') 
     911          
     912         cl_tmp=fct_split(cl_seg,2,',') 
     913 
     914 
     915         cl_first=fct_split(cl_tmp,1,':') 
    698916         ! remove potential width information 
    699917         il_ind1=SCAN(fct_lower(cl_first),'(') 
    700918         IF( il_ind1 /=0 )THEN 
    701             il_ind2=SCAN(fct_lower(cl_first),'(') 
     919            il_ind2=SCAN(fct_lower(cl_first),')') 
    702920            IF( il_ind2 /=0 )THEN 
    703921               cl_first=TRIM(cl_first(:il_ind1-1))//TRIM(cl_first(il_ind2+1:)) 
     
    708926         ENDIF          
    709927          
    710          cl_last =fct_split(cl_seg,3,',') 
     928         cl_last =fct_split(cl_tmp,2,':') 
    711929         ! remove potential width information 
    712930         il_ind1=SCAN(fct_lower(cl_last),'(') 
    713931         IF( il_ind1 /=0 )THEN 
    714             il_ind2=SCAN(fct_lower(cl_last),'(') 
     932            il_ind2=SCAN(fct_lower(cl_last),')') 
    715933            IF( il_ind2 /=0 )THEN 
    716934               cl_last=TRIM(cl_last(:il_ind1-1))//TRIM(cl_last(il_ind2+1:)) 
     
    726944         IF( TRIM(cl_first) /= '' ) READ(cl_first,*) tl_seg%i_first 
    727945         IF( TRIM(cl_last)  /= '' ) READ(cl_last ,*) tl_seg%i_last 
     946 
     947         ! index expressed on U,V point, move on T point. 
     948         SELECT CASE(id_jcard) 
     949            CASE(jp_north, jp_east) 
     950               tl_seg%i_index=tl_seg%i_index+1 
     951         END SELECT 
    728952 
    729953         IF( (tl_seg%i_first == 0 .AND.  tl_seg%i_last == 0) .OR. & 
     
    737961         ji=ji+1 
    738962         cl_seg=fct_split(cd_card,ji) 
     963 
     964         ! clean 
     965         CALL seg__clean(tl_seg) 
    739966      ENDDO  
    740967 
    741968   END FUNCTION boundary__get_info  
    742    !> @endcode 
    743969   !-------------------------------------------------------------------  
    744970   !> @brief This subroutine get indices of each semgent for each boundary. 
     
    757983   !  
    758984   !> @author J.Paul  
    759    !> - Nov, 2013- Initial Version  
    760    !  
    761    !> @param[inout] td_bdy : boundary structure   
    762    !> @param[in] td_var : variable structure  
    763    !> @param[in] ld_onseg : use only one sgment for each boundary  
    764    !-------------------------------------------------------------------  
    765    !> @code  
     985   !> @date November, 2013 - Initial Version  
     986   !  
     987   !> @param[inout] td_bdy boundary structure   
     988   !> @param[in] td_var    variable structure  
     989   !> @param[in] ld_onseg  use only one sgment for each boundary  
     990   !-------------------------------------------------------------------  
    766991   SUBROUTINE boundary_get_indices( td_bdy, td_var, ld_oneseg)  
    767992      IMPLICIT NONE  
     
    7891014 
    7901015      DO jk=1,ip_ncard 
    791          IF( .NOT. td_bdy(jk)%l_use .OR. td_bdy(jk)%i_nseg > 1 )THEN 
     1016         IF( .NOT. td_bdy(jk)%l_use .OR. td_bdy(jk)%l_nam )THEN 
    7921017            ! nothing to be done 
    7931018         ELSE 
     
    8111036 
    8121037               IF( ll_oneseg .AND. td_bdy(jk)%l_use )THEN 
    813                   tl_seg=td_bdy(jk)%t_seg(1) 
     1038                  tl_seg=seg__copy(td_bdy(jk)%t_seg(1)) 
    8141039                  ! use last indice of last segment 
    8151040                  tl_seg%i_last=td_bdy(jk)%t_seg(td_bdy(jk)%i_nseg)%i_last 
     
    8201045                  ! add one segment 
    8211046                  CALL boundary__add_seg(td_bdy(jk),tl_seg) 
     1047 
     1048                  ! clean 
     1049                  CALL seg__clean(tl_seg) 
    8221050               ENDIF 
    8231051 
     
    8291057 
    8301058   END SUBROUTINE boundary_get_indices  
    831    !> @endcode 
    8321059   !-------------------------------------------------------------------  
    8331060   !> @brief This subroutine compute the number of sea segment.  
     
    8411068   !  
    8421069   !> @author J.Paul  
    843    !> - Nov, 2013- Initial Version  
    844    !  
    845    !> @param[inout] td_bdy : boundary structure  
    846    !> @param[in] td_var : variable structure  
    847    !-------------------------------------------------------------------  
    848    !> @code  
     1070   !> @date November, 2013 - Initial Version  
     1071   !  
     1072   !> @param[inout] td_bdy boundary structure  
     1073   !> @param[in] td_var    variable structure  
     1074   !-------------------------------------------------------------------  
    8491075   SUBROUTINE boundary__get_seg_number( td_bdy, td_var)  
    8501076      IMPLICIT NONE  
     
    9271153         END SELECT 
    9281154      ENDIF 
    929  
    930        
     1155  
    9311156   END SUBROUTINE boundary__get_seg_number  
    932    !> @endcode 
    9331157   !-------------------------------------------------------------------  
    9341158   !> @brief This subroutine get segment indices for one boundary. 
     
    9371161   !  
    9381162   !> @author J.Paul  
    939    !> - Nov, 2013- Initial Version  
    940    !  
    941    !> @param[inout] td_bdy : boundary structure   
    942    !> @param[in] td_var : variable structure   
    943    !> @param[in] id_index : boundary orthogonal index   
    944    !> @param[in] id_width : bounary width  
    945    !> @param[in] id_first : boundary first indice 
    946    !> @param[in] id_last  : boundary last  indice 
    947    !-------------------------------------------------------------------  
    948    !> @code  
     1163   !> @date November, 2013 - Initial Version  
     1164   !  
     1165   !> @param[inout] td_bdy boundary structure   
     1166   !> @param[in] td_var    variable structure   
     1167   !> @param[in] id_index  boundary orthogonal index   
     1168   !> @param[in] id_width  bounary width  
     1169   !> @param[in] id_first  boundary first indice 
     1170   !> @param[in] id_last   boundary last  indice 
     1171   !-------------------------------------------------------------------  
    9491172   SUBROUTINE boundary__get_seg_indices( td_bdy, td_var, & 
    9501173   &                                     id_index, id_width, id_first, id_last)  
     
    10041227      END SELECT 
    10051228 
    1006       il_max(jp_north)=td_var%t_dim(1)%i_len-ig_ghost 
    1007       il_max(jp_south)=td_var%t_dim(1)%i_len-ig_ghost 
    1008       il_max(jp_east )=td_var%t_dim(2)%i_len-ig_ghost 
    1009       il_max(jp_west )=td_var%t_dim(2)%i_len-ig_ghost 
    1010  
    1011       il_min(jp_north)=1+ig_ghost 
    1012       il_min(jp_south)=1+ig_ghost 
    1013       il_min(jp_east )=1+ig_ghost 
    1014       il_min(jp_west )=1+ig_ghost 
     1229      il_max(jp_north)=td_var%t_dim(1)%i_len-ip_ghost 
     1230      il_max(jp_south)=td_var%t_dim(1)%i_len-ip_ghost 
     1231      il_max(jp_east )=td_var%t_dim(2)%i_len-ip_ghost 
     1232      il_max(jp_west )=td_var%t_dim(2)%i_len-ip_ghost 
     1233 
     1234      il_min(jp_north)=1+ip_ghost 
     1235      il_min(jp_south)=1+ip_ghost 
     1236      il_min(jp_east )=1+ip_ghost 
     1237      il_min(jp_west )=1+ip_ghost 
    10151238          
    10161239      ! special case for EW cyclic  
     
    10741297         CALL boundary__add_seg(td_bdy,tl_seg) 
    10751298 
     1299         ! clean 
    10761300         CALL seg__clean(tl_seg) 
    10771301          
     
    10811305       
    10821306   END SUBROUTINE boundary__get_seg_indices  
    1083    !> @endcode 
    10841307   !-------------------------------------------------------------------  
    10851308   !> @brief This subroutine check if there is boundary at corner, and  
     
    10941317   !  
    10951318   !> @author J.Paul  
    1096    !> - Nov, 2013- Initial Version  
    1097    !  
    1098    !> @param[inout] td_bdy : boundary structure 
    1099    !> @param[in] td_var : variable structure 
    1100    !>  
    1101    !> @todo add schematic to description 
    1102    !-------------------------------------------------------------------  
    1103    !> @code  
     1319   !> @date November, 2013 - Initial Version  
     1320   !  
     1321   !> @param[inout] td_bdy boundary structure 
     1322   !> @param[in] td_var    variable structure 
     1323   !-------------------------------------------------------------------  
    11041324   SUBROUTINE boundary_check_corner( td_bdy, td_var ) 
    11051325      IMPLICIT NONE  
     
    11261346      ! check north west corner 
    11271347      IF( td_bdy(jp_north)%l_use .AND. td_bdy(jp_west)%l_use )THEN 
    1128          tl_west =td_bdy(jp_west )%t_seg(td_bdy(jp_west)%i_nseg) 
    1129          tl_north=td_bdy(jp_north)%t_seg(1) 
     1348         tl_west =seg__copy(td_bdy(jp_west )%t_seg(td_bdy(jp_west)%i_nseg)) 
     1349         tl_north=seg__copy(td_bdy(jp_north)%t_seg(1)) 
    11301350 
    11311351         IF( tl_west%i_last  >= tl_north%i_index .AND. & 
     
    11481368            ENDIF 
    11491369 
    1150             td_bdy(jp_west )%t_seg(td_bdy(jp_west)%i_nseg)=tl_west 
    1151             td_bdy(jp_north)%t_seg(1)                     =tl_north 
     1370            td_bdy(jp_west )%t_seg(td_bdy(jp_west)%i_nseg)=seg__copy(tl_west) 
     1371            td_bdy(jp_north)%t_seg(1)                     =seg__copy(tl_north) 
    11521372 
    11531373         ELSE 
     
    11691389      ! check north east corner 
    11701390      IF( td_bdy(jp_north)%l_use .AND. td_bdy(jp_east)%l_use )THEN 
    1171          tl_east =td_bdy(jp_east )%t_seg(td_bdy(jp_east )%i_nseg) 
    1172          tl_north=td_bdy(jp_north)%t_seg(td_bdy(jp_north)%i_nseg) 
     1391         tl_east =seg__copy(td_bdy(jp_east )%t_seg(td_bdy(jp_east )%i_nseg)) 
     1392         tl_north=seg__copy(td_bdy(jp_north)%t_seg(td_bdy(jp_north)%i_nseg)) 
    11731393 
    11741394         IF( tl_east%i_last  >= tl_north%i_index .AND. & 
     
    11911411            ENDIF 
    11921412 
    1193             td_bdy(jp_east )%t_seg(td_bdy(jp_east )%i_nseg)=tl_east 
    1194             td_bdy(jp_north)%t_seg(td_bdy(jp_north)%i_nseg)=tl_north 
     1413            td_bdy(jp_east )%t_seg(td_bdy(jp_east )%i_nseg)=seg__copy(tl_east) 
     1414            td_bdy(jp_north)%t_seg(td_bdy(jp_north)%i_nseg)=seg__copy(tl_north) 
    11951415         ELSE 
    11961416 
     
    12111431      ! check south east corner 
    12121432      IF( td_bdy(jp_south)%l_use .AND. td_bdy(jp_east)%l_use )THEN 
    1213          tl_east =td_bdy(jp_east )%t_seg(1) 
    1214          tl_south=td_bdy(jp_south)%t_seg(td_bdy(jp_south)%i_nseg) 
     1433         tl_east =seg__copy(td_bdy(jp_east )%t_seg(1)) 
     1434         tl_south=seg__copy(td_bdy(jp_south)%t_seg(td_bdy(jp_south)%i_nseg)) 
    12151435 
    12161436         IF( tl_east%i_first <= tl_south%i_index .AND. & 
     
    12331453            ENDIF 
    12341454 
    1235             td_bdy(jp_east )%t_seg(1)                      =tl_east 
    1236             td_bdy(jp_south)%t_seg(td_bdy(jp_south)%i_nseg)=tl_south 
     1455            td_bdy(jp_east )%t_seg(1)                      =seg__copy(tl_east) 
     1456            td_bdy(jp_south)%t_seg(td_bdy(jp_south)%i_nseg)=seg__copy(tl_south) 
    12371457         ELSE 
    12381458 
     
    12531473      ! check south west corner 
    12541474      IF( td_bdy(jp_south)%l_use .AND. td_bdy(jp_west)%l_use )THEN 
    1255          tl_west =td_bdy(jp_west )%t_seg(1) 
    1256          tl_south=td_bdy(jp_south)%t_seg(1) 
     1475         tl_west =seg__copy(td_bdy(jp_west )%t_seg(1)) 
     1476         tl_south=seg__copy(td_bdy(jp_south)%t_seg(1)) 
    12571477 
    12581478         IF( tl_west%i_first <= tl_south%i_index .AND. & 
     
    12751495            ENDIF 
    12761496 
    1277             td_bdy(jp_west )%t_seg(1) = tl_west 
    1278             td_bdy(jp_south)%t_seg(1) = tl_south 
     1497            td_bdy(jp_west )%t_seg(1) = seg__copy(tl_west) 
     1498            td_bdy(jp_south)%t_seg(1) = seg__copy(tl_south) 
    12791499         ELSE 
    12801500 
     
    12931513      ENDIF 
    12941514 
     1515      ! clean 
     1516      CALL seg__clean(tl_north) 
     1517      CALL seg__clean(tl_south) 
     1518      CALL seg__clean(tl_east ) 
     1519      CALL seg__clean(tl_west ) 
     1520 
    12951521   END SUBROUTINE boundary_check_corner  
    1296    !> @endcode 
    12971522   !-------------------------------------------------------------------  
    12981523   !> @brief This subroutine check boundary. 
     
    13031528   !  
    13041529   !> @author J.Paul  
    1305    !> - Nov, 2013- Initial Version  
    1306    !  
    1307    !> @param[inout] td_bdy : boundary structure  
    1308    !> @param[in] td_var : variable structure  
    1309    !-------------------------------------------------------------------  
    1310    !> @code  
     1530   !> @date November, 2013 - Initial Version  
     1531   !  
     1532   !> @param[inout] td_bdy boundary structure  
     1533   !> @param[in] td_var    variable structure  
     1534   !-------------------------------------------------------------------  
    13111535   SUBROUTINE boundary_check(td_bdy, td_var)  
    13121536      IMPLICIT NONE  
     
    13271551      il_max(jp_east )=td_var%t_dim(2)%i_len 
    13281552      il_max(jp_west )=td_var%t_dim(2)%i_len 
    1329        
    1330       il_maxindex(jp_north)=td_var%t_dim(2)%i_len-ig_ghost 
    1331       il_maxindex(jp_south)=td_var%t_dim(2)%i_len-ig_ghost 
    1332       il_maxindex(jp_east )=td_var%t_dim(1)%i_len-ig_ghost 
    1333       il_maxindex(jp_west )=td_var%t_dim(1)%i_len-ig_ghost 
     1553  
     1554      il_maxindex(jp_north)=td_var%t_dim(2)%i_len-ip_ghost 
     1555      il_maxindex(jp_south)=td_var%t_dim(2)%i_len-ip_ghost 
     1556      il_maxindex(jp_east )=td_var%t_dim(1)%i_len-ip_ghost 
     1557      il_maxindex(jp_west )=td_var%t_dim(1)%i_len-ip_ghost 
    13341558 
    13351559      DO jk=1,ip_ncard 
     
    13621586         ENDIF 
    13631587      ENDDO 
    1364        
     1588  
    13651589      CALL boundary_check_corner(td_bdy, td_var) 
    13661590 
    13671591   END SUBROUTINE boundary_check 
    1368    !> @endcode 
    1369    !------------------------------------------------------------------- 
    1370    !> @brief This subroutine clean interpolated boundary in variable structure. 
    1371    ! 
    1372    !> @detail 
    1373    !> interpolation could create more point than needed for boundary (depending 
    1374    !> on refinement factor). This subroutine keep only useful point on variable 
    1375    !>  
    1376    !> @note we use width define in first segment, cause every segment of a 
    1377    !> boundary should have the same width  
    1378    !> 
    1379    !> @author J.Paul 
    1380    !> - Nov, 2013- Initial Version 
    1381    ! 
    1382    !> @param[inout] td_var : variable strucutre 
    1383    !> @param[in   ] td_bdy : boundary strucutre 
    1384    !------------------------------------------------------------------- 
    1385    !> @code 
    1386    SUBROUTINE boundary_clean_interp( td_var, td_bdy ) 
    1387       IMPLICIT NONE 
    1388       ! Argument 
    1389       TYPE(TVAR), INTENT(INOUT) :: td_var 
    1390       TYPE(TBDY), INTENT(IN   ) :: td_bdy 
    1391  
    1392       ! local variable 
    1393       TYPE(TVAR)  :: tl_var 
    1394  
    1395       INTEGER(i4) :: il_imin 
    1396       INTEGER(i4) :: il_imax 
    1397       INTEGER(i4) :: il_jmin 
    1398       INTEGER(i4) :: il_jmax 
    1399  
    1400       ! loop indices 
    1401       !---------------------------------------------------------------- 
    1402  
    1403       ! copy input variable 
    1404       tl_var=td_var 
    1405  
    1406       DEALLOCATE(td_var%d_value) 
    1407  
    1408       SELECT CASE(TRIM(td_bdy%c_card)) 
    1409       CASE('north') 
    1410  
    1411          il_imin=1 
    1412          il_imax=tl_var%t_dim(1)%i_len 
    1413          SELECT CASE(td_var%c_point) 
    1414          CASE('V','F') 
    1415             il_jmin=td_bdy%t_seg(1)%i_width+1 
    1416             il_jmax=2 
    1417          CASE DEFAULT ! 'T','U' 
    1418             il_jmin=td_bdy%t_seg(1)%i_width 
    1419             il_jmax=1 
    1420          END SELECT 
    1421  
    1422          ! use width as dimension length 
    1423          td_var%t_dim(2)%i_len=td_bdy%t_seg(1)%i_width 
    1424  
    1425       CASE('south') 
    1426  
    1427          il_imin=1 
    1428          il_imax=tl_var%t_dim(1)%i_len 
    1429  
    1430          il_jmin=1 
    1431          il_jmax=td_bdy%t_seg(1)%i_width 
    1432           
    1433          ! use width as dimension length 
    1434          td_var%t_dim(2)%i_len=td_bdy%t_seg(1)%i_width 
    1435  
    1436       CASE('east') 
    1437  
    1438          SELECT CASE(td_var%c_point) 
    1439          CASE('U','F') 
    1440             il_imin=td_bdy%t_seg(1)%i_width+1 
    1441             il_imax=2 
    1442          CASE DEFAULT ! 'T','V' 
    1443             il_imin=td_bdy%t_seg(1)%i_width 
    1444             il_imax=1 
    1445          END SELECT 
    1446  
    1447          il_jmin=1 
    1448          il_jmax=tl_var%t_dim(2)%i_len 
    1449  
    1450          ! use width as dimension length 
    1451          td_var%t_dim(1)%i_len=td_bdy%t_seg(1)%i_width 
    1452  
    1453       CASE('west') 
    1454  
    1455          il_imin=1 
    1456          il_imax=td_bdy%t_seg(1)%i_width 
    1457  
    1458          il_jmin=1 
    1459          il_jmax=tl_var%t_dim(2)%i_len 
    1460  
    1461          ! use width as dimension length 
    1462          td_var%t_dim(1)%i_len=td_bdy%t_seg(1)%i_width 
    1463  
    1464       END SELECT 
    1465  
    1466  
    1467       ALLOCATE( td_var%d_value(td_var%t_dim(1)%i_len, & 
    1468       &                        td_var%t_dim(2)%i_len, & 
    1469       &                        td_var%t_dim(3)%i_len, & 
    1470       &                        td_var%t_dim(4)%i_len) ) 
    1471  
    1472       IF( il_imin > il_imax )THEN 
    1473          il_imin=tl_var%t_dim(1)%i_len-il_imin+1 
    1474          il_imax=tl_var%t_dim(1)%i_len-il_imax+1 
    1475       ENDIF 
    1476  
    1477       IF( il_jmin > il_jmax )THEN 
    1478          il_jmin=tl_var%t_dim(2)%i_len-il_jmin+1 
    1479          il_jmax=tl_var%t_dim(2)%i_len-il_jmax+1 
    1480       ENDIF       
    1481  
    1482       td_var%d_value(:,:,:,:)=tl_var%d_value( il_imin:il_imax, & 
    1483       &                                       il_jmin:il_jmax, & 
    1484       &                                       :,: ) 
    1485  
    1486       CALL var_clean(tl_var) 
    1487  
    1488  
    1489    END SUBROUTINE boundary_clean_interp 
    1490    !> @endcode 
    14911592   !------------------------------------------------------------------- 
    14921593   !> @brief This subroutine swap array for east and north boundary. 
     
    14951596   !>  
    14961597   !> @author J.Paul 
    1497    !> - Nov, 2013- Initial Version 
     1598   !> @date November, 2013 - Initial Version 
    14981599   ! 
    1499    !> @param[inout] td_var : variable strucutre 
    1500    !> @param[in   ] td_bdy : boundary strucutre 
     1600   !> @param[inout] td_var variable strucutre 
     1601   !> @param[in   ] td_bdy boundary strucutre 
    15011602   !------------------------------------------------------------------- 
    1502    !> @code 
    15031603   SUBROUTINE boundary_swap( td_var, td_bdy ) 
    15041604      IMPLICIT NONE 
     
    15161616 
    15171617      IF( .NOT. ASSOCIATED(td_var%d_value) )THEN 
    1518          CALL logger_error("BOUNDARY SWAP: no table of value "//& 
     1618         CALL logger_error("BOUNDARY SWAP: no array of value "//& 
    15191619         &  "associted to variable "//TRIM(td_var%c_name) ) 
    15201620      ELSE       
     
    15551655      ENDIF 
    15561656   END SUBROUTINE boundary_swap 
    1557    !> @endcode 
    1558    !-------------------------------------------------------------------  
    1559    !> @brief This subroutine print information about one boundary  
    1560    !  
    1561    !> @details  
     1657   !-------------------------------------------------------------------  
     1658   !> @brief This subroutine print information about one boundary.  
    15621659   !  
    15631660   !> @author J.Paul  
    1564    !> - Nov, 2013- Initial Version  
    1565    !  
    1566    !> @param[in] td_bdy : boundary structure  
    1567    !-------------------------------------------------------------------  
    1568    !> @code  
     1661   !> @date November, 2013 - Initial Version  
     1662   !  
     1663   !> @param[in] td_bdy boundary structure  
     1664   !-------------------------------------------------------------------  
    15691665   SUBROUTINE boundary__print_unit( td_bdy )  
    15701666      IMPLICIT NONE  
     
    15881684  
    15891685   END SUBROUTINE boundary__print_unit 
    1590    !> @endcode 
    1591    !-------------------------------------------------------------------  
    1592    !> @brief This subroutine print information about a table of boundary  
     1686   !-------------------------------------------------------------------  
     1687   !> @brief This subroutine print information about a array of boundary  
    15931688   !  
    15941689   !> @details  
    15951690   !  
    15961691   !> @author J.Paul  
    1597    !> - Nov, 2013- Initial Version  
    1598    !  
    1599    !> @param[in] td_bdy : boundary structure  
    1600    !-------------------------------------------------------------------  
    1601    !> @code  
    1602    SUBROUTINE boundary__print_tab( td_bdy )  
     1692   !> @date November, 2013 - Initial Version  
     1693   !  
     1694   !> @param[in] td_bdy boundary structure  
     1695   !-------------------------------------------------------------------  
     1696   SUBROUTINE boundary__print_arr( td_bdy )  
    16031697      IMPLICIT NONE  
    16041698      ! Argument 
     
    16131707      ENDDO 
    16141708  
    1615    END SUBROUTINE boundary__print_tab 
    1616    !> @endcode 
     1709   END SUBROUTINE boundary__print_arr 
    16171710   !------------------------------------------------------------------- 
    16181711   !> @brief 
    1619    !> This subroutine copy segment structure in another segment 
    1620    !> structure 
    1621    !> @details  
     1712   !> This subroutine copy segment structure in another one. 
    16221713   !> 
     1714   !> @warning do not use on the output of a function who create or read a 
     1715   !> structure (ex: tl_seg=seg__copy(seg__init()) is forbidden). 
     1716   !> This will create memory leaks. 
    16231717   !> @warning to avoid infinite loop, do not use any function inside  
    16241718   !> this subroutine 
    16251719   !> 
    16261720   !> @author J.Paul 
    1627    !> - Nov, 2013- Initial Version 
     1721   !> @date November, 2013 - Initial Version 
     1722   !> @date November, 2014 
     1723   !> - use function instead of overload assignment operator  
     1724   !> (to avoid memory leak) 
    16281725   ! 
    1629    !> @param[out] td_seg1  : segment structure 
    1630    !> @param[in] td_seg2  : segment structure 
     1726   !> @param[in] td_seg  segment structure 
     1727   !> @return copy of input segment structure 
    16311728   !------------------------------------------------------------------- 
    1632    !> @code 
    1633    SUBROUTINE seg__copy( td_seg1, td_seg2 ) 
     1729   FUNCTION seg__copy_unit( td_seg ) 
    16341730      IMPLICIT NONE 
    16351731      ! Argument 
    1636       TYPE(TSEG), INTENT(OUT) :: td_seg1 
    1637       TYPE(TSEG), INTENT(IN)  :: td_seg2 
     1732      TYPE(TSEG), INTENT(IN)  :: td_seg 
     1733      ! function 
     1734      TYPE(TSEG) :: seg__copy_unit 
    16381735 
    16391736      ! local variable 
     
    16421739 
    16431740      ! copy segment index, width, .. 
    1644       td_seg1%i_index    = td_seg2%i_index 
    1645       td_seg1%i_width    = td_seg2%i_width 
    1646       td_seg1%i_first    = td_seg2%i_first 
    1647       td_seg1%i_last     = td_seg2%i_last  
    1648  
    1649    END SUBROUTINE seg__copy 
    1650    !> @endcode 
     1741      seg__copy_unit%i_index    = td_seg%i_index 
     1742      seg__copy_unit%i_width    = td_seg%i_width 
     1743      seg__copy_unit%i_first    = td_seg%i_first 
     1744      seg__copy_unit%i_last     = td_seg%i_last  
     1745 
     1746   END FUNCTION seg__copy_unit 
     1747   !------------------------------------------------------------------- 
     1748   !> @brief 
     1749   !> This subroutine copy segment structure in another one. 
     1750   !> 
     1751   !> @warning do not use on the output of a function who create or read a 
     1752   !> structure (ex: tl_seg=seg__copy(seg__init()) is forbidden). 
     1753   !> This will create memory leaks.    
     1754   !> @warning to avoid infinite loop, do not use any function inside  
     1755   !> this subroutine 
     1756   !> 
     1757   !> @author J.Paul 
     1758   !> @date November, 2013 - Initial Version 
     1759   !> @date November, 2014 
     1760   !> - use function instead of overload assignment operator  
     1761   !> (to avoid memory leak) 
     1762   ! 
     1763   !> @param[in] td_seg   segment structure 
     1764   !> @return copy of input array of segment structure 
     1765   !------------------------------------------------------------------- 
     1766   FUNCTION seg__copy_arr( td_seg ) 
     1767      IMPLICIT NONE 
     1768      ! Argument 
     1769      TYPE(TSEG), DIMENSION(:), INTENT(IN)  :: td_seg 
     1770      ! function 
     1771      TYPE(TSEG), DIMENSION(SIZE(td_seg(:))) :: seg__copy_arr 
     1772 
     1773      ! local variable 
     1774      ! loop indices 
     1775      INTEGER(i4) :: ji 
     1776      !---------------------------------------------------------------- 
     1777 
     1778      DO ji=1,SIZE(td_seg(:)) 
     1779         seg__copy_arr(ji)=seg__copy(td_seg(ji)) 
     1780      ENDDO 
     1781 
     1782   END FUNCTION seg__copy_arr 
    16511783   !-------------------------------------------------------------------  
    16521784   !> @brief This function  initialise segment structure. 
     
    16571789   !  
    16581790   !> @author J.Paul  
    1659    !> - Nov, 2013- Initial Version  
    1660    !  
    1661    !> @param[in] id_index : orthogonal index 
    1662    !> @param[in] id_width : width of the segment  
    1663    !> @param[in] id_first : first indices  
    1664    !> @param[in] id_last  : last  indices 
     1791   !> @date November, 2013 - Initial Version  
     1792   !  
     1793   !> @param[in] id_index orthogonal index 
     1794   !> @param[in] id_width width of the segment  
     1795   !> @param[in] id_first first indices  
     1796   !> @param[in] id_last  last  indices 
    16651797   !> @return segment structure 
    16661798   !-------------------------------------------------------------------  
    1667    !> @code  
    16681799   FUNCTION seg__init( id_index, id_width, id_first, id_last )  
    16691800      IMPLICIT NONE  
     
    16891820 
    16901821   END FUNCTION seg__init  
    1691    !> @endcode 
    16921822   !-------------------------------------------------------------------  
    16931823   !> @brief This subroutine clean segment structure.  
    16941824   !  
    1695    !> @details  
    1696    !  
    16971825   !> @author J.Paul  
    1698    !> - Nov, 2013- Initial Version  
    1699    !  
    1700    !> @param[inout] td_seg : segment structure 
    1701    !-------------------------------------------------------------------  
    1702    !> @code  
    1703    SUBROUTINE seg__clean(td_seg)  
     1826   !> @date November, 2013 - Initial Version  
     1827   !  
     1828   !> @param[inout] td_seg segment structure 
     1829   !-------------------------------------------------------------------  
     1830   SUBROUTINE seg__clean_unit(td_seg)  
    17041831      IMPLICIT NONE  
    17051832      ! Argument        
     
    17101837      !----------------------------------------------------------------  
    17111838 
    1712       td_seg=tl_seg 
     1839      td_seg=seg__copy(tl_seg) 
    17131840  
    1714    END SUBROUTINE seg__clean  
    1715    !> @endcode 
    1716 !   !-------------------------------------------------------------------  
    1717 !   !> @brief This function   
    1718 !   !  
    1719 !   !> @details  
    1720 !   !  
    1721 !   !> @author J.Paul  
    1722 !   !> - Nov, 2013- Initial Version  
    1723 !   !  
    1724 !   !> @param[in]   
    1725 !   !-------------------------------------------------------------------  
    1726 !   !> @code  
    1727 !   FUNCTION boundary_()  
    1728 !      IMPLICIT NONE  
    1729 !      ! Argument        
    1730 !      ! function  
    1731 !      ! local variable  
    1732 !      ! loop indices  
    1733 !      !----------------------------------------------------------------  
    1734 !  
    1735 !   END FUNCTION boundary_  
    1736 !   !> @endcode  
    1737 !   !-------------------------------------------------------------------  
    1738 !   !> @brief This subroutine   
    1739 !   !  
    1740 !   !> @details  
    1741 !   !  
    1742 !   !> @author J.Paul  
    1743 !   !> - Nov, 2013- Initial Version  
    1744 !   !  
    1745 !   !> @param[in]   
    1746 !   !-------------------------------------------------------------------  
    1747 !   !> @code  
    1748 !   SUBROUTINE boundary_()  
    1749 !      IMPLICIT NONE  
    1750 !      ! Argument        
    1751 !      ! local variable  
    1752 !      ! loop indices  
    1753 !      !----------------------------------------------------------------  
    1754 !  
    1755 !   END SUBROUTINE boundary_  
    1756 !   !> @endcode 
     1841   END SUBROUTINE seg__clean_unit 
     1842   !-------------------------------------------------------------------  
     1843   !> @brief This subroutine clean segment structure.  
     1844   !  
     1845   !> @author J.Paul  
     1846   !> @date November, 2013 - Initial Version  
     1847   !  
     1848   !> @param[inout] td_seg array of segment structure 
     1849   !-------------------------------------------------------------------  
     1850   SUBROUTINE seg__clean_arr(td_seg)  
     1851      IMPLICIT NONE  
     1852      ! Argument        
     1853      TYPE(TSEG), DIMENSION(:), INTENT(INOUT) :: td_seg 
     1854      ! local variable  
     1855      ! loop indices  
     1856      INTEGER(i4) :: ji 
     1857      !----------------------------------------------------------------  
     1858 
     1859      DO ji=SIZE(td_seg(:)),1,-1 
     1860         CALL seg__clean(td_seg(ji)) 
     1861      ENDDO 
     1862  
     1863   END SUBROUTINE seg__clean_arr  
    17571864END MODULE boundary 
Note: See TracChangeset for help on using the changeset viewer.