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 13369 for utils/tools/SIREN/src/boundary.f90 – NEMO

Ignore:
Timestamp:
2020-07-31T10:50:52+02:00 (4 years ago)
Author:
jpaul
Message:

update: cf changelog inside documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • utils/tools/SIREN/src/boundary.f90

    r12080 r13369  
    106106!> 
    107107!> @date November, 2013 - Initial Version 
    108 !> @date September, 2014  
     108!> @date September, 2014 
    109109!> - add boundary description 
    110 !> @date November, 2014  
     110!> @date November, 2014 
    111111!> - Fix memory leaks bug 
    112 !> @date February, 2015  
     112!> @date February, 2015 
    113113!> - Do not change indices read from namelist 
    114 !> - Change string character format of boundary read from namelist,  
     114!> - Change string character format of boundary read from namelist, 
    115115!>  see boundary__get_info 
    116 !>  
     116!> 
    117117!> @todo add schematic to boundary structure description 
    118 !>  
     118!> 
    119119!> @note Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    120120!---------------------------------------------------------------------- 
    121121MODULE boundary 
    122122 
    123    USE netcdf                          ! nf90 library                            
     123   USE netcdf                          ! nf90 library 
    124124   USE global                          ! global parameter 
    125125   USE phycst                          ! physical constant 
     
    143143   PUBLIC :: boundary_init         !< initialise boundary structure 
    144144   PUBLIC :: boundary_print        !< print information about boundary 
    145    PUBLIC :: boundary_clean        !< clean boundary structure  
     145   PUBLIC :: boundary_clean        !< clean boundary structure 
    146146   PUBLIC :: boundary_get_indices  !< get indices of each semgent for each boundary. 
    147147   PUBLIC :: boundary_check        !< check boundary indices and corner. 
     
    150150   PUBLIC :: boundary_swap         !< swap array for north and east boundary 
    151151 
    152    PRIVATE :: boundary__clean_unit      ! clean boundary structure  
    153    PRIVATE :: boundary__clean_arr       ! clean array of boundary structure  
     152   PRIVATE :: boundary__clean_unit      ! clean boundary structure 
     153   PRIVATE :: boundary__clean_arr       ! clean array of boundary structure 
    154154   PRIVATE :: boundary__init_wrapper    ! initialise a boundary structure 
    155155   PRIVATE :: boundary__init            ! initialise basically a boundary structure 
    156156   PRIVATE :: boundary__copy_unit       ! copy boundary structure in another 
    157157   PRIVATE :: boundary__copy_arr        ! copy boundary structure in another 
    158    PRIVATE :: boundary__add_seg         ! add one segment structure to a boundary  
     158   PRIVATE :: boundary__add_seg         ! add one segment structure to a boundary 
    159159   PRIVATE :: boundary__del_seg         ! remove all segments of a boundary 
    160160   PRIVATE :: boundary__get_info        ! get boundary information from boundary description string character. 
    161161   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  
     162   PRIVATE :: boundary__get_seg_indices ! get segment indices for one boundary 
    163163   PRIVATE :: boundary__print_unit      ! print information about one boundary 
    164164   PRIVATE :: boundary__print_arr       ! print information about a array of boundary 
    165     
     165 
    166166   PRIVATE :: seg__init       ! initialise segment structure 
    167167   PRIVATE :: seg__clean      ! clean segment structure 
     
    175175      INTEGER(i4) :: i_index = 0 !< segment index 
    176176      INTEGER(i4) :: i_width = 0 !< segment width 
    177       INTEGER(i4) :: i_first = 0 !< segment first indice  
     177      INTEGER(i4) :: i_first = 0 !< segment first indice 
    178178      INTEGER(i4) :: i_last  = 0 !< segment last indices 
    179179   END TYPE TSEG 
     
    181181   TYPE TBDY !< boundary structure 
    182182      CHARACTER(LEN=lc) :: c_card = ''          !< boundary cardinal 
    183       LOGICAL           :: l_use  = .FALSE.     !< boundary use or not  
     183      LOGICAL           :: l_use  = .FALSE.     !< boundary use or not 
    184184      LOGICAL           :: l_nam  = .FALSE.     !< boundary get from namelist 
    185185      INTEGER(i4)       :: i_nseg = 0           !< number of segment in boundary 
     
    191191 
    192192   INTERFACE boundary_init 
    193       MODULE PROCEDURE boundary__init_wrapper  
     193      MODULE PROCEDURE boundary__init_wrapper 
    194194   END INTERFACE boundary_init 
    195195 
    196196   INTERFACE boundary_print 
    197       MODULE PROCEDURE boundary__print_unit  
    198       MODULE PROCEDURE boundary__print_arr  
     197      MODULE PROCEDURE boundary__print_unit 
     198      MODULE PROCEDURE boundary__print_arr 
    199199   END INTERFACE boundary_print 
    200200 
    201201   INTERFACE boundary_clean 
    202       MODULE PROCEDURE boundary__clean_unit    
    203       MODULE PROCEDURE boundary__clean_arr     
     202      MODULE PROCEDURE boundary__clean_unit 
     203      MODULE PROCEDURE boundary__clean_arr 
    204204   END INTERFACE 
    205205 
    206206   INTERFACE seg__clean 
    207       MODULE PROCEDURE seg__clean_unit    
    208       MODULE PROCEDURE seg__clean_arr     
     207      MODULE PROCEDURE seg__clean_unit 
     208      MODULE PROCEDURE seg__clean_arr 
    209209   END INTERFACE 
    210210 
    211211   INTERFACE boundary_copy 
    212       MODULE PROCEDURE boundary__copy_unit  
    213       MODULE PROCEDURE boundary__copy_arr  
    214    END INTERFACE    
     212      MODULE PROCEDURE boundary__copy_unit 
     213      MODULE PROCEDURE boundary__copy_arr 
     214   END INTERFACE 
    215215 
    216216   INTERFACE seg__copy 
    217217      MODULE PROCEDURE seg__copy_unit   ! copy segment structure 
    218218      MODULE PROCEDURE seg__copy_arr    ! copy array of segment structure 
    219    END INTERFACE    
     219   END INTERFACE 
    220220 
    221221CONTAINS 
     
    226226   !> @brief 
    227227   !> This subroutine copy a array of boundary structure in another one 
    228    !> @details  
     228   !> @details 
    229229   !> 
    230230   !> @warning do not use on the output of a function who create or read an 
    231231   !> attribute (ex: tl_bdy=boundary_copy(boundary_init()) is forbidden). 
    232232   !> This will create memory leaks. 
    233    !> @warning to avoid infinite loop, do not use any function inside  
     233   !> @warning to avoid infinite loop, do not use any function inside 
    234234   !> this subroutine 
    235235   !> 
     
    237237   !> @date November, 2013 - Initial Version 
    238238   !> @date November, 2014 
    239    !> - use function instead of overload assignment operator  
     239   !> - use function instead of overload assignment operator 
    240240   !> (to avoid memory leak) 
    241241   ! 
    242242   !> @param[in] td_bdy   array of boundary structure 
    243    !> @return copy of input array of boundary structure  
     243   !> @return copy of input array of boundary structure 
    244244   !------------------------------------------------------------------- 
    245245 
     
    268268   !> @brief 
    269269   !> This subroutine copy boundary structure in another one 
    270    !> @details  
     270   !> @details 
    271271   !> 
    272272   !> @warning do not use on the output of a function who create or read an 
    273273   !> attribute (ex: tl_bdy=boundary_copy(boundary_init()) is forbidden). 
    274274   !> This will create memory leaks. 
    275    !> @warning to avoid infinite loop, do not use any function inside  
     275   !> @warning to avoid infinite loop, do not use any function inside 
    276276   !> this subroutine 
    277277   !> 
     
    279279   !> @date November, 2013 - Initial Version 
    280280   !> @date November, 2014 
    281    !> - use function instead of overload assignment operator  
     281   !> - use function instead of overload assignment operator 
    282282   !> (to avoid memory leak) 
    283283   ! 
     
    325325   !> @date November, 2013 - Initial Version 
    326326   !> @date January, 2019 
    327    !> - nullify segment structure inside boundary structure  
     327   !> - nullify segment structure inside boundary structure 
    328328   ! 
    329329   !> @param[inout] td_bdy boundary strucutre 
     
    385385   FUNCTION boundary_set_filename(cd_file, cd_card, id_seg, cd_date) & 
    386386         &  RESULT (cf_file) 
    387    !-------------------------------------------------------------------  
     387   !------------------------------------------------------------------- 
    388388   !> @brief This function put cardinal name and date inside file name. 
    389    !  
    390    !> @details  
     389   ! 
     390   !> @details 
    391391   !>    Examples : 
    392392   !>       cd_file="boundary.nc" 
    393    !>       cd_card="west"  
     393   !>       cd_card="west" 
    394394   !>       id_seg =2 
    395395   !>       cd_date=y2015m07d16 
    396    !>  
     396   !> 
    397397   !>       function return "boundary_west_2_y2015m07d16.nc" 
    398    !>  
     398   !> 
    399399   !>       cd_file="boundary.nc" 
    400    !>       cd_card="west"  
    401    !>  
     400   !>       cd_card="west" 
     401   !> 
    402402   !>       function return "boundary_west.nc" 
    403    !>  
    404    !> @author J.Paul  
    405    !> @date November, 2013 - Initial Version  
    406    !  
    407    !> @param[in] cd_file   file name  
    408    !> @param[in] cd_card   cardinal name  
    409    !> @param[in] id_seg    segment number  
    410    !> @param[in] cd_date   file date (format: y????m??d??)  
     403   !> 
     404   !> @author J.Paul 
     405   !> @date November, 2013 - Initial Version 
     406   ! 
     407   !> @param[in] cd_file   file name 
     408   !> @param[in] cd_card   cardinal name 
     409   !> @param[in] id_seg    segment number 
     410   !> @param[in] cd_date   file date (format: y????m??d??) 
    411411   !> @return file name with cardinal name inside 
    412    !-------------------------------------------------------------------  
    413  
    414       IMPLICIT NONE  
     412   !------------------------------------------------------------------- 
     413 
     414      IMPLICIT NONE 
    415415 
    416416      ! Argument 
     
    420420      CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_date 
    421421 
    422       ! function  
     422      ! function 
    423423      CHARACTER(LEN=lc)            :: cf_file 
    424424 
    425       ! local variable  
     425      ! local variable 
    426426      CHARACTER(LEN=lc) :: cl_dirname 
    427427      CHARACTER(LEN=lc) :: cl_basename 
     
    435435      INTEGER(i4)       :: il_indend 
    436436 
    437       ! loop indices  
    438       !----------------------------------------------------------------  
     437      ! loop indices 
     438      !---------------------------------------------------------------- 
    439439      ! init 
    440440      cf_file='' 
     
    449449         cl_base  =fct_split(TRIM(cl_basename),1,'.') 
    450450         cl_suffix=fct_split(TRIM(cl_basename),2,'.') 
    451           
     451 
    452452         ! add segment number 
    453453         IF( PRESENT(id_seg) )THEN 
     
    483483         &  " are empty") 
    484484      ENDIF 
    485   
    486    END FUNCTION boundary_set_filename  
     485 
     486   END FUNCTION boundary_set_filename 
    487487   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    488488   FUNCTION boundary__init_wrapper(td_var,                               & 
     
    491491         &                         ld_oneseg) & 
    492492         &  RESULT (tf_bdy) 
    493    !-------------------------------------------------------------------  
     493   !------------------------------------------------------------------- 
    494494   !> @brief This function initialise a boundary structure. 
    495    !  
    496    !> @details  
     495   ! 
     496   !> @details 
    497497   !>  Boundaries for each cardinal will be compute with variable structure. 
    498    !>  It means that orthogonal index, first and last indices of each  
     498   !>  It means that orthogonal index, first and last indices of each 
    499499   !>  sea segment will be compute automatically. 
    500500   !>  However you could specify which boundary to use or not with 
     
    502502   !>  And boundary description could be specify with argument 
    503503   !>  cn_north, cn_south, cn_east, cn_west. 
    504    !>  For each cardinal you could specify orthogonal index,  
     504   !>  For each cardinal you could specify orthogonal index, 
    505505   !>  first and last indices (in this order) and boundary width (between 
    506506   !>  parentheses). 
    507507   !> ex : cn_north='index,first,last(width)' 
    508    !> You could specify more than one segment for each boundary.  
     508   !> You could specify more than one segment for each boundary. 
    509509   !> However each segment will have the same width. So you do not need to 
    510510   !> specify it for each segment. 
     
    512512   !> 
    513513   !> @warn Boundaries are compute on T point, but expressed on U,V point. 
    514    !> change will be done to get data on other point when need be.  
     514   !> change will be done to get data on other point when need be. 
    515515   !> 
    516    !> @author J.Paul  
    517    !> @date November, 2013 - Initial Version  
     516   !> @author J.Paul 
     517   !> @date November, 2013 - Initial Version 
    518518   !> @date September, 2014 
    519519   !> - add boolean to use only one segment for each boundary 
    520520   !> - check boundary width 
    521    !  
    522    !> @param[in] td_var    variable structure  
    523    !> @param[in] ld_north  use north boundary or not  
    524    !> @param[in] ld_south  use south boundary or not  
    525    !> @param[in] ld_east   use east  boundary or not  
    526    !> @param[in] ld_west   use west  boundary or not  
    527    !> @param[in] cd_north  north boundary description  
    528    !> @param[in] cd_south  south boundary description  
    529    !> @param[in] cd_east   east  boundary description  
    530    !> @param[in] cd_west   west  boundary description  
    531    !> @param[in] ld_oneseg force to use only one segment for each boundary  
     521   ! 
     522   !> @param[in] td_var    variable structure 
     523   !> @param[in] ld_north  use north boundary or not 
     524   !> @param[in] ld_south  use south boundary or not 
     525   !> @param[in] ld_east   use east  boundary or not 
     526   !> @param[in] ld_west   use west  boundary or not 
     527   !> @param[in] cd_north  north boundary description 
     528   !> @param[in] cd_south  south boundary description 
     529   !> @param[in] cd_east   east  boundary description 
     530   !> @param[in] cd_west   west  boundary description 
     531   !> @param[in] ld_oneseg force to use only one segment for each boundary 
    532532   !> @return boundary structure 
    533    !-------------------------------------------------------------------  
    534  
    535       IMPLICIT NONE  
     533   !------------------------------------------------------------------- 
     534 
     535      IMPLICIT NONE 
    536536 
    537537      ! Argument 
     
    539539      LOGICAL          , INTENT(IN), OPTIONAL :: ld_north 
    540540      LOGICAL          , INTENT(IN), OPTIONAL :: ld_south 
    541       LOGICAL          , INTENT(IN), OPTIONAL :: ld_east  
    542       LOGICAL          , INTENT(IN), OPTIONAL :: ld_west  
     541      LOGICAL          , INTENT(IN), OPTIONAL :: ld_east 
     542      LOGICAL          , INTENT(IN), OPTIONAL :: ld_west 
    543543      CHARACTER(LEN=lc), INTENT(IN), OPTIONAL :: cd_north 
    544544      CHARACTER(LEN=lc), INTENT(IN), OPTIONAL :: cd_south 
    545       CHARACTER(LEN=lc), INTENT(IN), OPTIONAL :: cd_east  
     545      CHARACTER(LEN=lc), INTENT(IN), OPTIONAL :: cd_east 
    546546      CHARACTER(LEN=lc), INTENT(IN), OPTIONAL :: cd_west 
    547       LOGICAL          , INTENT(IN), OPTIONAL :: ld_oneseg  
    548  
    549       ! function  
     547      LOGICAL          , INTENT(IN), OPTIONAL :: ld_oneseg 
     548 
     549      ! function 
    550550      TYPE(TBDY)       , DIMENSION(ip_ncard)  :: tf_bdy 
    551551 
    552       ! local variable  
     552      ! local variable 
    553553      INTEGER(i4)                            :: il_width 
    554554      INTEGER(i4)      , DIMENSION(ip_ncard) :: il_max_width 
     
    565565      LOGICAL                                :: ll_oneseg 
    566566 
    567       ! loop indices  
     567      ! loop indices 
    568568      INTEGER(i4) :: ji 
    569569      INTEGER(i4) :: jk 
    570       !----------------------------------------------------------------  
     570      !---------------------------------------------------------------- 
    571571      IF( .NOT. ASSOCIATED(td_var%d_value) )THEN 
    572572         CALL logger_error("BOUNDARY INIT: no value associated to variable "//& 
     
    612612         il_max(jp_east )=td_var%t_dim(2)%i_len 
    613613         il_max(jp_west )=td_var%t_dim(2)%i_len 
    614   
     614 
    615615         cl_card=(/'','','',''/) 
    616616         IF( PRESENT(cd_north) ) cl_card(jp_north)=TRIM(cd_north) 
     
    663663               ELSE 
    664664                  ! fill undefined value 
    665                   WHERE( tf_bdy(jk)%t_seg(:)%i_index == 0 )  
     665                  WHERE( tf_bdy(jk)%t_seg(:)%i_index == 0 ) 
    666666                     tf_bdy(jk)%t_seg(:)%i_index = tl_seg%i_index 
    667                   END WHERE                
    668                   WHERE( tf_bdy(jk)%t_seg(:)%i_width == 0 )  
     667                  END WHERE 
     668                  WHERE( tf_bdy(jk)%t_seg(:)%i_width == 0 ) 
    669669                     tf_bdy(jk)%t_seg(:)%i_width = tl_seg%i_width 
    670670                  END WHERE 
    671                   WHERE( tf_bdy(jk)%t_seg(:)%i_first == 0 )  
     671                  WHERE( tf_bdy(jk)%t_seg(:)%i_first == 0 ) 
    672672                     tf_bdy(jk)%t_seg(:)%i_first = tl_seg%i_first 
    673673                  END WHERE 
    674                   WHERE( tf_bdy(jk)%t_seg(:)%i_last == 0 )  
     674                  WHERE( tf_bdy(jk)%t_seg(:)%i_last == 0 ) 
    675675                     tf_bdy(jk)%t_seg(:)%i_last = tl_seg%i_last 
    676676                  END WHERE 
     
    688688 
    689689      ENDIF 
    690   
    691    END FUNCTION boundary__init_wrapper  
     690 
     691   END FUNCTION boundary__init_wrapper 
    692692   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    693693   FUNCTION boundary__init(cd_card, ld_use, ld_nam, td_seg) & 
    694694         &  RESULT (tf_bdy) 
    695    !-------------------------------------------------------------------  
     695   !------------------------------------------------------------------- 
    696696   !> @brief This function initialise basically a boundary structure with 
    697697   !> cardinal name. 
    698    !  
    699    !> @details  
    700    !> optionnaly you could specify if this boundary is used or not,  
     698   ! 
     699   !> @details 
     700   !> optionnaly you could specify if this boundary is used or not, 
    701701   !> and add one segment structure. 
    702    !  
    703    !> @author J.Paul  
    704    !> @date November, 2013 - Initial Version  
    705    !  
     702   ! 
     703   !> @author J.Paul 
     704   !> @date November, 2013 - Initial Version 
     705   ! 
    706706   !> @param[in]  cd_card  cardinal name 
    707707   !> @param[in]  ld_use   boundary use or not 
    708708   !> @param[in]  td_seg   segment structure 
    709709   !> @return boundary structure 
    710    !-------------------------------------------------------------------  
    711  
    712       IMPLICIT NONE  
     710   !------------------------------------------------------------------- 
     711 
     712      IMPLICIT NONE 
    713713 
    714714      ! Argument 
    715715      CHARACTER(LEN=*), INTENT(IN) :: cd_card 
    716       LOGICAL         , INTENT(IN), OPTIONAL :: ld_use  
    717       LOGICAL         , INTENT(IN), OPTIONAL :: ld_nam  
     716      LOGICAL         , INTENT(IN), OPTIONAL :: ld_use 
     717      LOGICAL         , INTENT(IN), OPTIONAL :: ld_nam 
    718718      TYPE(TSEG)      , INTENT(IN), OPTIONAL :: td_seg 
    719719 
    720       ! function  
     720      ! function 
    721721      TYPE(TBDY)                   :: tf_bdy 
    722722 
    723       ! local variable  
    724       ! loop indices  
    725       !----------------------------------------------------------------  
     723      ! local variable 
     724      ! loop indices 
     725      !---------------------------------------------------------------- 
    726726 
    727727      SELECT CASE(TRIM(cd_card)) 
    728728         CASE ('north','south','east','west') 
    729           
     729 
    730730            tf_bdy%c_card=TRIM(cd_card) 
    731731 
     
    746746   END FUNCTION boundary__init 
    747747   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    748    SUBROUTINE boundary__add_seg(td_bdy, td_seg)  
    749    !-------------------------------------------------------------------  
    750    !> @brief This subroutine add one segment structure to a boundary structure  
    751    !  
    752    !> @details  
    753    !  
    754    !> @author J.Paul  
    755    !> @date November, 2013 - Initial Version  
    756    !  
    757    !> @param[inout] td_bdy boundary structure   
    758    !> @param[in] td_seg    segment structure   
    759    !-------------------------------------------------------------------  
    760  
    761       IMPLICIT NONE  
    762  
    763       ! Argument  
     748   SUBROUTINE boundary__add_seg(td_bdy, td_seg) 
     749   !------------------------------------------------------------------- 
     750   !> @brief This subroutine add one segment structure to a boundary structure 
     751   ! 
     752   !> @details 
     753   ! 
     754   !> @author J.Paul 
     755   !> @date November, 2013 - Initial Version 
     756   ! 
     757   !> @param[inout] td_bdy boundary structure 
     758   !> @param[in] td_seg    segment structure 
     759   !------------------------------------------------------------------- 
     760 
     761      IMPLICIT NONE 
     762 
     763      ! Argument 
    764764      TYPE(TBDY), INTENT(INOUT) :: td_bdy 
    765765      TYPE(TSEG), INTENT(IN   ) :: td_seg 
    766766 
    767       ! local variable  
     767      ! local variable 
    768768      INTEGER(i4)                            :: il_status 
    769769      TYPE(TSEG) , DIMENSION(:), ALLOCATABLE :: tl_seg 
    770770 
    771       ! loop indices  
    772       !----------------------------------------------------------------  
     771      ! loop indices 
     772      !---------------------------------------------------------------- 
    773773 
    774774      IF( td_bdy%i_nseg > 0 )THEN 
     
    795795            ! clean 
    796796            CALL seg__clean(tl_seg(:)) 
    797             DEALLOCATE(tl_seg)             
    798              
     797            DEALLOCATE(tl_seg) 
     798 
    799799         ENDIF 
    800800      ELSE 
     
    808808            CALL logger_error( & 
    809809            &  " BOUNDARY ADD SEG: not enough space to put segments ") 
    810          ENDIF          
     810         ENDIF 
    811811      ENDIF 
    812   
     812 
    813813      ! update number of segment 
    814814      td_bdy%i_nseg=td_bdy%i_nseg+1 
     
    817817      td_bdy%t_seg(td_bdy%i_nseg)=seg__copy(td_seg) 
    818818 
    819    END SUBROUTINE boundary__add_seg  
    820    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    821    SUBROUTINE boundary__del_seg(td_bdy)  
    822    !-------------------------------------------------------------------  
    823    !> @brief This subroutine remove all segments of a boundary structure  
    824    !  
    825    !> @details  
    826    !  
    827    !> @author J.Paul  
    828    !> @date November, 2013 - Initial Version  
    829    !  
     819   END SUBROUTINE boundary__add_seg 
     820   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     821   SUBROUTINE boundary__del_seg(td_bdy) 
     822   !------------------------------------------------------------------- 
     823   !> @brief This subroutine remove all segments of a boundary structure 
     824   ! 
     825   !> @details 
     826   ! 
     827   !> @author J.Paul 
     828   !> @date November, 2013 - Initial Version 
     829   ! 
    830830   !> @param[inout]  td_bdy   boundary structure 
    831    !-------------------------------------------------------------------  
    832  
    833       IMPLICIT NONE  
    834  
    835       ! Argument  
     831   !------------------------------------------------------------------- 
     832 
     833      IMPLICIT NONE 
     834 
     835      ! Argument 
    836836      TYPE(TBDY), INTENT(INOUT) :: td_bdy 
    837837 
    838       ! local variable  
    839       ! loop indices  
    840       !----------------------------------------------------------------  
     838      ! local variable 
     839      ! loop indices 
     840      !---------------------------------------------------------------- 
    841841 
    842842      IF( ASSOCIATED(td_bdy%t_seg) )THEN 
     
    847847      td_bdy%i_nseg=0 
    848848 
    849    END SUBROUTINE boundary__del_seg  
     849   END SUBROUTINE boundary__del_seg 
    850850   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    851851   FUNCTION boundary__get_info(cd_card, id_jcard) & 
    852852         & RESULT (tf_bdy) 
    853    !-------------------------------------------------------------------  
    854    !> @brief This function get information about boundary from string character.  
    855    !  
     853   !------------------------------------------------------------------- 
     854   !> @brief This function get information about boundary from string character. 
     855   ! 
    856856   !> @details 
    857857   !> This string character that will be passed through namelist could contains 
    858    !> orthogonal index, first and last indices, of each segment.  
     858   !> orthogonal index, first and last indices, of each segment. 
    859859   !> And also the width of all segments of this boundary. 
    860860   !>   cn_north='index1,first1:last1(width)|index2,first2:last2' 
    861    !>  
    862    !> @author J.Paul  
    863    !> @date November, 2013 - Initial Version  
    864    !> @date february, 2015  
     861   !> 
     862   !> @author J.Paul 
     863   !> @date November, 2013 - Initial Version 
     864   !> @date february, 2015 
    865865   !> - do not change indices read from namelist 
    866866   !> - change format cn_north 
    867    !  
     867   ! 
    868868   !> @param[in] cd_card   boundary description 
    869869   !> @param[in] id_jcard  boundary index 
    870870   !> @return boundary structure 
    871    !-------------------------------------------------------------------  
    872  
    873       IMPLICIT NONE  
    874  
    875       ! Argument  
     871   !------------------------------------------------------------------- 
     872 
     873      IMPLICIT NONE 
     874 
     875      ! Argument 
    876876      CHARACTER(LEN=lc), INTENT(IN) :: cd_card 
    877877      INTEGER(i4)      , INTENT(IN) :: id_jcard 
    878878 
    879       ! function  
     879      ! function 
    880880      TYPE(TBDY)                    :: tf_bdy 
    881881 
    882       ! local variable  
     882      ! local variable 
    883883      INTEGER(i4)       :: il_width 
    884884      INTEGER(i4)       :: il_ind1 
     
    890890      CHARACTER(LEN=lc) :: cl_tmp 
    891891      CHARACTER(LEN=lc) :: cl_first 
    892       CHARACTER(LEN=lc) :: cl_last  
     892      CHARACTER(LEN=lc) :: cl_last 
    893893 
    894894      TYPE(TSEG)        :: tl_seg 
    895895 
    896       ! loop indices  
     896      ! loop indices 
    897897      INTEGER(i4) :: ji 
    898       !----------------------------------------------------------------  
    899   
     898      !---------------------------------------------------------------- 
     899 
    900900      ji=1 
    901901      cl_seg=fct_split(cd_card,ji) 
    902902 
    903903      il_width=0 
    904       ! look for segment width  
     904      ! look for segment width 
    905905      ! width should be the same for all segment of one boundary 
    906906      IF( TRIM(cl_seg)   /= '' )THEN 
     
    924924         ENDIF 
    925925 
    926       ENDIF  
     926      ENDIF 
    927927 
    928928      DO WHILE( TRIM(cl_seg) /= '' ) 
     
    940940            ENDIF 
    941941         ENDIF 
    942        
    943           
     942 
     943 
    944944         cl_tmp=fct_split(cl_seg,2,',') 
    945945 
     
    956956               &  " check namelist. ") 
    957957            ENDIF 
    958          ENDIF          
    959           
     958         ENDIF 
     959 
    960960         cl_last =fct_split(cl_tmp,2,':') 
    961961         ! remove potential width information 
     
    996996         ! clean 
    997997         CALL seg__clean(tl_seg) 
    998       ENDDO  
    999  
    1000    END FUNCTION boundary__get_info  
    1001    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    1002    SUBROUTINE boundary_get_indices(td_bdy, td_var, ld_oneseg)  
    1003    !-------------------------------------------------------------------  
     998      ENDDO 
     999 
     1000   END FUNCTION boundary__get_info 
     1001   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     1002   SUBROUTINE boundary_get_indices(td_bdy, td_var, ld_oneseg) 
     1003   !------------------------------------------------------------------- 
    10041004   !> @brief This subroutine get indices of each semgent for each boundary. 
    1005    !  
    1006    !> @details  
     1005   ! 
     1006   !> @details 
    10071007   !> indices are compute from variable value, actually variable fill value, 
    1008    !> which is assume to be land mask.  
    1009    !> Boundary structure should have been initialized before running  
     1008   !> which is assume to be land mask. 
     1009   !> Boundary structure should have been initialized before running 
    10101010   !> this subroutine. Segment indices will be search between first and last 
    10111011   !> indies, at this orthogonal index. 
    1012    !>  
     1012   !> 
    10131013   !> Optionnally you could forced to use only one segment for each boundary. 
    1014    !>  
    1015    !> @warning number of segment (i_nseg) will be change, before the number  
     1014   !> 
     1015   !> @warning number of segment (i_nseg) will be change, before the number 
    10161016   !> of segment structure 
    1017    !  
    1018    !> @author J.Paul  
    1019    !> @date November, 2013 - Initial Version  
    1020    !  
    1021    !> @param[inout] td_bdy boundary structure   
    1022    !> @param[in] td_var    variable structure  
    1023    !> @param[in] ld_onseg  use only one sgment for each boundary  
    1024    !-------------------------------------------------------------------  
    1025  
    1026       IMPLICIT NONE  
     1017   ! 
     1018   !> @author J.Paul 
     1019   !> @date November, 2013 - Initial Version 
     1020   ! 
     1021   !> @param[inout] td_bdy boundary structure 
     1022   !> @param[in] td_var    variable structure 
     1023   !> @param[in] ld_onseg  use only one sgment for each boundary 
     1024   !------------------------------------------------------------------- 
     1025 
     1026      IMPLICIT NONE 
    10271027 
    10281028      ! Argument 
     
    10311031      LOGICAL                         , INTENT(IN   ), OPTIONAL :: ld_oneseg 
    10321032 
    1033       ! local variable  
     1033      ! local variable 
    10341034      INTEGER(i4) :: il_index 
    10351035      INTEGER(i4) :: il_width 
    10361036      INTEGER(i4) :: il_first 
    1037       INTEGER(i4) :: il_last  
     1037      INTEGER(i4) :: il_last 
    10381038 
    10391039      LOGICAL     :: ll_oneseg 
     
    10431043      ! loop indices 
    10441044      INTEGER(i4) :: jk 
    1045       !----------------------------------------------------------------  
    1046   
     1045      !---------------------------------------------------------------- 
     1046 
    10471047      ll_oneseg=.TRUE. 
    10481048      IF( PRESENT(ld_oneseg) ) ll_oneseg=ld_oneseg 
     
    10631063               il_first=td_bdy(jk)%t_seg(1)%i_first 
    10641064               il_last =td_bdy(jk)%t_seg(1)%i_last 
    1065   
     1065 
    10661066               CALL boundary__get_seg_number( td_bdy(jk), td_var) 
    10671067 
     
    10911091      ENDDO 
    10921092 
    1093    END SUBROUTINE boundary_get_indices  
    1094    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    1095    SUBROUTINE boundary__get_seg_number(td_bdy, td_var)  
    1096    !-------------------------------------------------------------------  
    1097    !> @brief This subroutine compute the number of sea segment.  
    1098    !  
    1099    !> @details  
     1093   END SUBROUTINE boundary_get_indices 
     1094   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     1095   SUBROUTINE boundary__get_seg_number(td_bdy, td_var) 
     1096   !------------------------------------------------------------------- 
     1097   !> @brief This subroutine compute the number of sea segment. 
     1098   ! 
     1099   !> @details 
    11001100   !> It use variable value, actually variable fill value 
    11011101   !> (which is assume to be land mask), to compute the number of segment between 
    11021102   !> first and last indices at boundary orthogonal index. 
    1103    !> @warning number of segment (i_nseg) will be change, before the number  
     1103   !> @warning number of segment (i_nseg) will be change, before the number 
    11041104   !> of segment structure 
    1105    !  
    1106    !> @author J.Paul  
    1107    !> @date November, 2013 - Initial Version  
    1108    !  
    1109    !> @param[inout] td_bdy boundary structure  
    1110    !> @param[in] td_var    variable structure  
    1111    !-------------------------------------------------------------------  
    1112  
    1113       IMPLICIT NONE  
     1105   ! 
     1106   !> @author J.Paul 
     1107   !> @date November, 2013 - Initial Version 
     1108   ! 
     1109   !> @param[inout] td_bdy boundary structure 
     1110   !> @param[in] td_var    variable structure 
     1111   !------------------------------------------------------------------- 
     1112 
     1113      IMPLICIT NONE 
    11141114 
    11151115      ! Argument 
     
    11171117      TYPE(TVAR) , INTENT(IN   ) :: td_var 
    11181118 
    1119       ! local variable  
     1119      ! local variable 
    11201120      REAL(dp)   , DIMENSION(:)        , ALLOCATABLE :: dl_value 
    11211121      LOGICAL                                        :: ll_sea 
     
    11241124      ! loop indices 
    11251125      INTEGER(i4) :: ji 
    1126       !----------------------------------------------------------------  
    1127   
     1126      !---------------------------------------------------------------- 
     1127 
    11281128      IF( td_bdy%l_use .AND. td_bdy%i_nseg == 1 )THEN 
    11291129 
     
    11371137 
    11381138               IF( ANY(dl_value(:) /= td_var%d_fill) )THEN 
    1139                    
     1139 
    11401140                  td_bdy%l_use=.TRUE. 
    11411141                  td_bdy%i_nseg=0 
     
    11661166 
    11671167               IF( ANY(dl_value(:) /= td_var%d_fill) )THEN 
    1168                    
     1168 
    11691169                  td_bdy%l_use=.TRUE. 
    11701170                  td_bdy%i_nseg=0 
     
    11911191         END SELECT 
    11921192      ENDIF 
    1193   
    1194    END SUBROUTINE boundary__get_seg_number  
     1193 
     1194   END SUBROUTINE boundary__get_seg_number 
    11951195   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    11961196   SUBROUTINE boundary__get_seg_indices(td_bdy, td_var, & 
    1197          &                              id_index, id_width, id_first, id_last)  
    1198    !-------------------------------------------------------------------  
     1197         &                              id_index, id_width, id_first, id_last) 
     1198   !------------------------------------------------------------------- 
    11991199   !> @brief This subroutine get segment indices for one boundary. 
    1200    !  
    1201    !> @details  
    1202    !  
    1203    !> @author J.Paul  
    1204    !> @date November, 2013 - Initial Version  
    1205    !  
    1206    !> @param[inout] td_bdy boundary structure   
    1207    !> @param[in] td_var    variable structure   
    1208    !> @param[in] id_index  boundary orthogonal index   
    1209    !> @param[in] id_width  bounary width  
     1200   ! 
     1201   !> @details 
     1202   ! 
     1203   !> @author J.Paul 
     1204   !> @date November, 2013 - Initial Version 
     1205   ! 
     1206   !> @param[inout] td_bdy boundary structure 
     1207   !> @param[in] td_var    variable structure 
     1208   !> @param[in] id_index  boundary orthogonal index 
     1209   !> @param[in] id_width  bounary width 
    12101210   !> @param[in] id_first  boundary first indice 
    12111211   !> @param[in] id_last   boundary last  indice 
    1212    !-------------------------------------------------------------------  
    1213  
    1214       IMPLICIT NONE  
     1212   !------------------------------------------------------------------- 
     1213 
     1214      IMPLICIT NONE 
    12151215 
    12161216      ! Argument 
     
    12221222      INTEGER(i4), INTENT(IN   ) :: id_last 
    12231223 
    1224       ! local variable  
     1224      ! local variable 
    12251225      INTEGER(i4)                                    :: il_nseg 
    12261226      INTEGER(i4), DIMENSION(ip_ncard)               :: il_max 
     
    12391239      INTEGER(i4) :: jk 
    12401240      INTEGER(i4) :: jl 
    1241       !----------------------------------------------------------------  
    1242   
     1241      !---------------------------------------------------------------- 
     1242 
    12431243      SELECT CASE(TRIM(td_bdy%c_card)) 
    12441244         CASE('north') 
    12451245            jk=jp_north 
    1246              
     1246 
    12471247            ALLOCATE( dl_value(td_var%t_dim(1)%i_len) ) 
    12481248            dl_value(:)=td_var%d_value(:,id_index,1,1) 
     
    12551255 
    12561256         CASE('east ') 
    1257             jk=jp_east  
     1257            jk=jp_east 
    12581258 
    12591259            ALLOCATE( dl_value(td_var%t_dim(2)%i_len) ) 
     
    12611261 
    12621262         CASE('west ') 
    1263             jk=jp_west  
     1263            jk=jp_west 
    12641264 
    12651265            ALLOCATE( dl_value(td_var%t_dim(2)%i_len) ) 
     
    12771277      il_min(jp_east )=1+ip_ghost 
    12781278      il_min(jp_west )=1+ip_ghost 
    1279           
    1280       ! special case for EW cyclic  
     1279 
     1280      ! special case for EW cyclic 
    12811281      IF( td_var%i_ew >= 0 )THEN 
    12821282         il_min(jp_north)=1 
     
    12861286         il_max(jp_south)=td_var%t_dim(1)%i_len 
    12871287      ENDIF 
    1288        
     1288 
    12891289      il_nseg=td_bdy%i_nseg 
    12901290      ! remove all segment from boundary 
     
    13331333               ll_sea=.FALSE. 
    13341334            ENDIF 
    1335              
     1335 
    13361336         ENDDO 
    13371337 
     
    13401340         ! clean 
    13411341         CALL seg__clean(tl_seg) 
    1342           
     1342 
    13431343      ENDDO 
    13441344 
    13451345      DEALLOCATE(dl_value) 
    1346        
    1347    END SUBROUTINE boundary__get_seg_indices  
     1346 
     1347   END SUBROUTINE boundary__get_seg_indices 
    13481348   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    13491349   SUBROUTINE boundary_check_corner(td_bdy, td_var) 
    1350    !-------------------------------------------------------------------  
    1351    !> @brief This subroutine check if there is boundary at corner, and  
    1352    !> adjust boundary indices if necessary.  
    1353    !  
    1354    !> @details  
     1350   !------------------------------------------------------------------- 
     1351   !> @brief This subroutine check if there is boundary at corner, and 
     1352   !> adjust boundary indices if necessary. 
     1353   ! 
     1354   !> @details 
    13551355   !> If there is a north west corner, first indices of north boundary 
    1356    !> should be the same as the west boundary indices.  
     1356   !> should be the same as the west boundary indices. 
    13571357   !> And the last indices of the west boundary should be the same as 
    13581358   !> the north indices. 
    13591359   !> More over the width of west and north boundary should be the same. 
    1360    !  
    1361    !> @author J.Paul  
    1362    !> @date November, 2013 - Initial Version  
    1363    !  
     1360   ! 
     1361   !> @author J.Paul 
     1362   !> @date November, 2013 - Initial Version 
     1363   ! 
    13641364   !> @param[inout] td_bdy boundary structure 
    13651365   !> @param[in] td_var    variable structure 
    1366    !-------------------------------------------------------------------  
    1367  
    1368       IMPLICIT NONE  
     1366   !------------------------------------------------------------------- 
     1367 
     1368      IMPLICIT NONE 
    13691369 
    13701370      ! Argument 
     
    13721372      TYPE(TVAR)                      , INTENT(IN   ) :: td_var 
    13731373 
    1374       ! local variable  
     1374      ! local variable 
    13751375      TYPE(TSEG)  :: tl_north 
    13761376      TYPE(TSEG)  :: tl_south 
    1377       TYPE(TSEG)  :: tl_east  
     1377      TYPE(TSEG)  :: tl_east 
    13781378      TYPE(TSEG)  :: tl_west 
    13791379 
     
    13811381 
    13821382      ! loop indices 
    1383       !----------------------------------------------------------------  
    1384   
     1383      !---------------------------------------------------------------- 
     1384 
    13851385      IF( .NOT. ASSOCIATED(td_var%d_value) )THEN 
    13861386         CALL logger_error("BOUNDARY CHEKC CORNER: no value associated "//& 
     
    14061406 
    14071407               il_width=MIN(tl_west%i_width,tl_north%i_width) 
    1408                 
     1408 
    14091409               tl_west%i_width =il_width 
    14101410               tl_north%i_width=il_width 
     
    14491449 
    14501450               il_width=MIN(tl_east%i_width,tl_north%i_width) 
    1451                 
     1451 
    14521452               tl_east%i_width =il_width 
    14531453               tl_north%i_width=il_width 
     
    14911491 
    14921492               il_width=MIN(tl_east%i_width,tl_south%i_width) 
    1493                 
     1493 
    14941494               tl_east%i_width =il_width 
    14951495               tl_south%i_width=il_width 
     
    15331533 
    15341534               il_width=MIN(tl_west%i_width,tl_south%i_width) 
    1535                 
     1535 
    15361536               tl_west%i_width =il_width 
    15371537               tl_south%i_width=il_width 
     
    15631563      CALL seg__clean(tl_west ) 
    15641564 
    1565    END SUBROUTINE boundary_check_corner  
    1566    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    1567    SUBROUTINE boundary_check(td_bdy, td_var)  
    1568    !-------------------------------------------------------------------  
     1565   END SUBROUTINE boundary_check_corner 
     1566   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     1567   SUBROUTINE boundary_check(td_bdy, td_var) 
     1568   !------------------------------------------------------------------- 
    15691569   !> @brief This subroutine check boundary. 
    1570    !  
    1571    !> @details  
     1570   ! 
     1571   !> @details 
    15721572   !> It checks that first and last indices as well as orthogonal index are 
    15731573   !> inside domain, and check corner (see boundary_check_corner). 
    1574    !  
    1575    !> @author J.Paul  
    1576    !> @date November, 2013 - Initial Version  
     1574   ! 
     1575   !> @author J.Paul 
     1576   !> @date November, 2013 - Initial Version 
    15771577   !> @date June, 2016 
    15781578   !> - Bug fix: take into account that boundaries are compute on T point, 
    15791579   !>   but expressed on U,V point 
    15801580   !> 
    1581    !> @param[inout] td_bdy boundary structure  
    1582    !> @param[in] td_var    variable structure  
    1583    !-------------------------------------------------------------------  
    1584  
    1585       IMPLICIT NONE  
     1581   !> @param[inout] td_bdy boundary structure 
     1582   !> @param[in] td_var    variable structure 
     1583   !------------------------------------------------------------------- 
     1584 
     1585      IMPLICIT NONE 
    15861586 
    15871587      ! Argument 
     
    15891589      TYPE(TVAR)                      , INTENT(IN   ) :: td_var 
    15901590 
    1591       ! local variable  
     1591      ! local variable 
    15921592      INTEGER(i4)      , DIMENSION(ip_ncard) :: il_max 
    15931593      INTEGER(i4)      , DIMENSION(ip_ncard) :: il_maxindex 
    15941594 
    1595       ! loop indices  
     1595      ! loop indices 
    15961596      INTEGER(i4) :: jk 
    1597       !----------------------------------------------------------------  
    1598   
     1597      !---------------------------------------------------------------- 
     1598 
    15991599      il_max(jp_north)=td_var%t_dim(1)%i_len 
    16001600      il_max(jp_south)=td_var%t_dim(1)%i_len 
    16011601      il_max(jp_east )=td_var%t_dim(2)%i_len 
    16021602      il_max(jp_west )=td_var%t_dim(2)%i_len 
    1603   
     1603 
    16041604      ! index expressed on U,V point, move on T point. 
    16051605      il_maxindex(jp_north)=td_var%t_dim(2)%i_len-ip_ghost+1 
     
    16371637         ENDIF 
    16381638      ENDDO 
    1639   
     1639 
    16401640      CALL boundary_check_corner(td_bdy, td_var) 
    16411641 
     
    16471647   ! 
    16481648   !> @detail 
    1649    !>  
     1649   !> 
    16501650   !> @author J.Paul 
    16511651   !> @date November, 2013 - Initial Version 
     
    16721672         CALL logger_error("BOUNDARY SWAP: no array of value "//& 
    16731673         &  "associted to variable "//TRIM(td_var%c_name) ) 
    1674       ELSE       
     1674      ELSE 
    16751675 
    16761676         SELECT CASE(TRIM(td_bdy%c_card)) 
     
    16881688            ENDDO 
    16891689 
    1690             DEALLOCATE( dl_value )          
     1690            DEALLOCATE( dl_value ) 
    16911691         CASE('east') 
    16921692            ALLOCATE( dl_value(td_var%t_dim(1)%i_len, & 
     
    17101710   END SUBROUTINE boundary_swap 
    17111711   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    1712    SUBROUTINE boundary__print_unit(td_bdy)  
    1713    !-------------------------------------------------------------------  
    1714    !> @brief This subroutine print information about one boundary.  
    1715    !  
    1716    !> @author J.Paul  
    1717    !> @date November, 2013 - Initial Version  
    1718    !  
    1719    !> @param[in] td_bdy boundary structure  
    1720    !-------------------------------------------------------------------  
    1721  
    1722       IMPLICIT NONE  
     1712   SUBROUTINE boundary__print_unit(td_bdy) 
     1713   !------------------------------------------------------------------- 
     1714   !> @brief This subroutine print information about one boundary. 
     1715   ! 
     1716   !> @author J.Paul 
     1717   !> @date November, 2013 - Initial Version 
     1718   ! 
     1719   !> @param[in] td_bdy boundary structure 
     1720   !------------------------------------------------------------------- 
     1721 
     1722      IMPLICIT NONE 
    17231723 
    17241724      ! Argument 
    17251725      TYPE(TBDY), INTENT(IN) :: td_bdy 
    17261726 
    1727       ! local variable  
    1728       ! loop indices  
     1727      ! local variable 
     1728      ! loop indices 
    17291729      INTEGER(i4) :: ji 
    1730       !----------------------------------------------------------------  
     1730      !---------------------------------------------------------------- 
    17311731 
    17321732      WRITE(*,'(a,/1x,a,/1x,a)') "Boundary "//TRIM(td_bdy%c_card), & 
     
    17401740         &  " last  "//TRIM(fct_str(td_bdy%t_seg(ji)%i_last)) 
    17411741      ENDDO 
    1742   
     1742 
    17431743   END SUBROUTINE boundary__print_unit 
    17441744   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    1745    SUBROUTINE boundary__print_arr(td_bdy)  
    1746    !-------------------------------------------------------------------  
    1747    !> @brief This subroutine print information about a array of boundary  
    1748    !  
    1749    !> @details  
    1750    !  
    1751    !> @author J.Paul  
    1752    !> @date November, 2013 - Initial Version  
    1753    !  
    1754    !> @param[in] td_bdy boundary structure  
    1755    !-------------------------------------------------------------------  
    1756  
    1757       IMPLICIT NONE  
     1745   SUBROUTINE boundary__print_arr(td_bdy) 
     1746   !------------------------------------------------------------------- 
     1747   !> @brief This subroutine print information about a array of boundary 
     1748   ! 
     1749   !> @details 
     1750   ! 
     1751   !> @author J.Paul 
     1752   !> @date November, 2013 - Initial Version 
     1753   ! 
     1754   !> @param[in] td_bdy boundary structure 
     1755   !------------------------------------------------------------------- 
     1756 
     1757      IMPLICIT NONE 
    17581758 
    17591759      ! Argument 
    17601760      TYPE(TBDY), DIMENSION(:), INTENT(IN) :: td_bdy 
    17611761 
    1762       ! local variable  
    1763       ! loop indices  
     1762      ! local variable 
     1763      ! loop indices 
    17641764      INTEGER(i4) :: ji 
    1765       !----------------------------------------------------------------  
     1765      !---------------------------------------------------------------- 
    17661766 
    17671767      DO ji=1,SIZE(td_bdy(:)) 
    17681768         CALL boundary_print(td_bdy(ji)) 
    17691769      ENDDO 
    1770   
     1770 
    17711771   END SUBROUTINE boundary__print_arr 
    17721772   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     
    17801780   !> structure (ex: tl_seg=seg__copy(seg__init()) is forbidden). 
    17811781   !> This will create memory leaks. 
    1782    !> @warning to avoid infinite loop, do not use any function inside  
     1782   !> @warning to avoid infinite loop, do not use any function inside 
    17831783   !> this subroutine 
    17841784   !> 
     
    17861786   !> @date November, 2013 - Initial Version 
    17871787   !> @date November, 2014 
    1788    !> - use function instead of overload assignment operator  
     1788   !> - use function instead of overload assignment operator 
    17891789   !> (to avoid memory leak) 
    17901790   ! 
     
    18091809      tf_seg%i_width    = td_seg%i_width 
    18101810      tf_seg%i_first    = td_seg%i_first 
    1811       tf_seg%i_last     = td_seg%i_last  
     1811      tf_seg%i_last     = td_seg%i_last 
    18121812 
    18131813   END FUNCTION seg__copy_unit 
     
    18211821   !> @warning do not use on the output of a function who create or read a 
    18221822   !> structure (ex: tl_seg=seg__copy(seg__init()) is forbidden). 
    1823    !> This will create memory leaks.    
    1824    !> @warning to avoid infinite loop, do not use any function inside  
     1823   !> This will create memory leaks. 
     1824   !> @warning to avoid infinite loop, do not use any function inside 
    18251825   !> this subroutine 
    18261826   !> 
     
    18281828   !> @date November, 2013 - Initial Version 
    18291829   !> @date November, 2014 
    1830    !> - use function instead of overload assignment operator  
     1830   !> - use function instead of overload assignment operator 
    18311831   !> (to avoid memory leak) 
    18321832   ! 
     
    18561856   FUNCTION seg__init(id_index, id_width, id_first, id_last) & 
    18571857         &  RESULT(tf_seg) 
    1858    !-------------------------------------------------------------------  
     1858   !------------------------------------------------------------------- 
    18591859   !> @brief This function  initialise segment structure. 
    1860    !  
    1861    !> @details  
     1860   ! 
     1861   !> @details 
    18621862   !> It simply add orthogonal index, and optionnaly width, first 
    1863    !> and last indices of the segment.  
    1864    !  
    1865    !> @author J.Paul  
    1866    !> @date November, 2013 - Initial Version  
    1867    !  
     1863   !> and last indices of the segment. 
     1864   ! 
     1865   !> @author J.Paul 
     1866   !> @date November, 2013 - Initial Version 
     1867   ! 
    18681868   !> @param[in] id_index  orthogonal index 
    1869    !> @param[in] id_width  width of the segment  
    1870    !> @param[in] id_first  first indices  
     1869   !> @param[in] id_width  width of the segment 
     1870   !> @param[in] id_first  first indices 
    18711871   !> @param[in] id_last   last  indices 
    18721872   !> @return segment structure 
    1873    !-------------------------------------------------------------------  
    1874  
    1875       IMPLICIT NONE  
     1873   !------------------------------------------------------------------- 
     1874 
     1875      IMPLICIT NONE 
    18761876 
    18771877      ! Argument 
     
    18791879      INTEGER(i4), INTENT(IN), OPTIONAL :: id_width 
    18801880      INTEGER(i4), INTENT(IN), OPTIONAL :: id_first 
    1881       INTEGER(i4), INTENT(IN), OPTIONAL :: id_last  
    1882  
    1883       ! function  
     1881      INTEGER(i4), INTENT(IN), OPTIONAL :: id_last 
     1882 
     1883      ! function 
    18841884      TYPE(TSEG)              :: tf_seg 
    18851885 
    1886       ! local variable  
    1887        
    1888       ! loop indices  
    1889       !----------------------------------------------------------------  
     1886      ! local variable 
     1887 
     1888      ! loop indices 
     1889      !---------------------------------------------------------------- 
    18901890 
    18911891      tf_seg%i_index=id_index 
     
    18951895      IF( PRESENT(id_last ) ) tf_seg%i_last =id_last 
    18961896 
    1897    END FUNCTION seg__init  
    1898    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    1899    SUBROUTINE seg__clean_unit(td_seg)  
    1900    !-------------------------------------------------------------------  
    1901    !> @brief This subroutine clean segment structure.  
    1902    !  
    1903    !> @author J.Paul  
    1904    !> @date November, 2013 - Initial Version  
    1905    !  
     1897   END FUNCTION seg__init 
     1898   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     1899   SUBROUTINE seg__clean_unit(td_seg) 
     1900   !------------------------------------------------------------------- 
     1901   !> @brief This subroutine clean segment structure. 
     1902   ! 
     1903   !> @author J.Paul 
     1904   !> @date November, 2013 - Initial Version 
     1905   ! 
    19061906   !> @param[inout] td_seg segment structure 
    1907    !-------------------------------------------------------------------  
    1908  
    1909       IMPLICIT NONE  
    1910  
    1911       ! Argument        
     1907   !------------------------------------------------------------------- 
     1908 
     1909      IMPLICIT NONE 
     1910 
     1911      ! Argument 
    19121912      TYPE(TSEG), INTENT(INOUT) :: td_seg 
    19131913 
    1914       ! local variable  
     1914      ! local variable 
    19151915      TYPE(TSEG) :: tl_seg 
    1916       ! loop indices  
    1917       !----------------------------------------------------------------  
     1916      ! loop indices 
     1917      !---------------------------------------------------------------- 
    19181918 
    19191919      td_seg=seg__copy(tl_seg) 
    1920   
     1920 
    19211921   END SUBROUTINE seg__clean_unit 
    19221922   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    1923    SUBROUTINE seg__clean_arr(td_seg)  
    1924    !-------------------------------------------------------------------  
    1925    !> @brief This subroutine clean segment structure.  
    1926    !  
    1927    !> @author J.Paul  
    1928    !> @date November, 2013 - Initial Version  
    1929    !  
     1923   SUBROUTINE seg__clean_arr(td_seg) 
     1924   !------------------------------------------------------------------- 
     1925   !> @brief This subroutine clean segment structure. 
     1926   ! 
     1927   !> @author J.Paul 
     1928   !> @date November, 2013 - Initial Version 
     1929   ! 
    19301930   !> @param[inout] td_seg array of segment structure 
    1931    !-------------------------------------------------------------------  
    1932  
    1933       IMPLICIT NONE  
    1934  
    1935       ! Argument        
     1931   !------------------------------------------------------------------- 
     1932 
     1933      IMPLICIT NONE 
     1934 
     1935      ! Argument 
    19361936      TYPE(TSEG), DIMENSION(:), INTENT(INOUT) :: td_seg 
    19371937 
    1938       ! local variable  
    1939       ! loop indices  
     1938      ! local variable 
     1939      ! loop indices 
    19401940      INTEGER(i4) :: ji 
    1941       !----------------------------------------------------------------  
     1941      !---------------------------------------------------------------- 
    19421942 
    19431943      DO ji=SIZE(td_seg(:)),1,-1 
    19441944         CALL seg__clean(td_seg(ji)) 
    19451945      ENDDO 
    1946   
    1947    END SUBROUTINE seg__clean_arr  
     1946 
     1947   END SUBROUTINE seg__clean_arr 
    19481948   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    19491949END MODULE boundary 
Note: See TracChangeset for help on using the changeset viewer.