Index: trunk/LMDZ.TITAN/libf/muphytitan/asciiread.f90
===================================================================
--- trunk/LMDZ.TITAN/libf/muphytitan/asciiread.f90	(revision 1897)
+++ trunk/LMDZ.TITAN/libf/muphytitan/asciiread.f90	(revision 3083)
@@ -1,39 +1,27 @@
-! Copyright Jérémie Burgalat (2010-2015,2017)
-! 
-! jeremie.burgalat@univ-reims.fr
-! 
-! This software is a computer program whose purpose is to provide configuration 
-! file and command line arguments parsing features to Fortran programs.
-! 
-! This software is governed by the CeCILL-B license under French law and
-! abiding by the rules of distribution of free software.  You can  use, 
-! modify and/ or redistribute the software under the terms of the CeCILL-B
-! license as circulated by CEA, CNRS and INRIA at the following URL
-! "http://www.cecill.info". 
-! 
-! As a counterpart to the access to the source code and  rights to copy,
-! modify and redistribute granted by the license, users are provided only
-! with a limited warranty  and the software's author,  the holder of the
-! economic rights,  and the successive licensors  have only  limited
-! liability. 
-! 
-! In this respect, the user's attention is drawn to the risks associated
-! with loading,  using,  modifying and/or developing or reproducing the
-! software by the user in light of its specific status of free software,
-! that may mean  that it is complicated to manipulate,  and  that  also
-! therefore means  that it is reserved for developers  and  experienced
-! professionals having in-depth computer knowledge. Users are therefore
-! encouraged to load and test the software's suitability as regards their
-! requirements in conditions enabling the security of their systems and/or 
-! data to be ensured and,  more generally, to use and operate it in the 
-! same conditions as regards security. 
-! 
-! The fact that you are presently reading this means that you have had
-! knowledge of the CeCILL-B license and that you accept its terms.
+! Copyright (c) (2013-2015,2017) Jeremie Burgalat (jeremie.burgalat@univ-reims.fr).
+!
+! This file is part of SWIFT
+!
+! Permission is hereby granted, free of charge, to any person obtaining a copy of
+! this software and associated documentation files (the "Software"), to deal in
+! the Software without restriction, including without limitation the rights to
+! use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+! the Software, and to permit persons to whom the Software is furnished to do so,
+! subject to the following conditions:
+!
+! The above copyright notice and this permission notice shall be included in all
+! copies or substantial portions of the Software.
+!
+! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+! FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+! COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+! IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+! CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 !! file: asciiread.f90
 !! summary: ASCII data file reader source file
 !! author: burgalat
-!! date: 2013-2015,2017
+!! date: 2013-2015,2017,2022
 MODULE ASCIIREAD
   !! ASCII data file reader module
@@ -42,5 +30,5 @@
   !! data array from ASCII file.
   !!
-  !! ``` 
+  !! ```
   !! FUNCTION read_data(path,data) RESULT(err)
   !! ```
@@ -56,9 +44,9 @@
   !!   - must use blank space(s) as value delimiter.
   !!   - must have a regular number of columns, that is each data line must
-  !!     have the same number of columns. 
+  !!     have the same number of columns.
   !!   - can contains any number of empty lines and/or comment line (i.e. line
   !!     where first non-blank character is "#"). All other lines are assumed
   !!     to be data.
-  !! Moreover, in the case of 3D data, it must use a SINGLE empty line for "depth" block separator.  
+  !! Moreover, in the case of 3D data, it must use a SINGLE empty line for "depth" block separator.
   !!
   !! Error occured when:
@@ -76,5 +64,5 @@
   !! of _R_ lines with _C_ columns. Each block must be separated by a single empty line
   !! and each columns must separated by one or more blank spaces (no tabulation ALLOWED).
-  !!  
+  !!
   !! On success, the shape of the 3D output array will be _data(R,C,D)_.
   USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY: IOSTAT_END, IOSTAT_EOR
@@ -93,5 +81,5 @@
   END INTERFACE
 
-  CONTAINS 
+  CONTAINS
 
 
@@ -100,13 +88,13 @@
     !!
     !! The function reads an ASCII file and saves its values in a real(kind=8) 3D-array.
-    !! 
+    !!
     !! The input file:
     !!
     !! - must have a regular number of columns, that is each data line must have the same number
-    !!   of columns (according to the delimiter used).  
+    !!   of columns (according to the delimiter used).
     !! - must use a SINGLE empty line for "depth" block separator.
     !! - can contains any number of comment lines (i.e. line where first non-blank character is "#").
     !!   All other lines (except empty lines) are assumed to be data.
-    !! 
+    !!
     !! Error occured when:
     !!    - Path does not refer to a existing file (-11)
@@ -118,8 +106,8 @@
     !! with _C_ columns. Each block must be separated by a single empty line and
     !! each columns must separated by one or more blank spaces (no tabulation ALLOWED).
-    !! 
+    !!
     !! On success, the shape of the 3D output array will be _output(R,C,D)_.
     !! On error, the 3D output array is __not allocated__.
-    CHARACTER(len=*), INTENT(in)                             :: path      !! Path of the input data file 
+    CHARACTER(len=*), INTENT(in)                             :: path      !! Path of the input data file
     REAL(kind=8), INTENT(out), DIMENSION(:,:,:), ALLOCATABLE :: data3d    !! 3D-array with the output values (double precision)
     CHARACTER(len=*), INTENT(in), OPTIONAL                   :: delimiter !! Optional column delimiter(s)
@@ -142,17 +130,17 @@
       err = error(trim(path)//": no such file",-1) ; RETURN
     ENDIF
-    lu = free_lun() 
+    lu = free_lun()
     IF (lu == -1) THEN ; err = error("Cannot find available logical unit...",-1) ; RETURN ; ENDIF
     ! Open file
     OPEN(lu,FILE=TRIM(path),STATUS='OLD',ACTION='READ')
 
-    ! First pass : 
+    ! First pass :
     ! ------------
-    !   - get size (rows, columns, depth) 
+    !   - get size (rows, columns, depth)
     !   - check size consistendcy
     !   - check value type
-    lc = 0 ; tlc = 0 
-    ndr = -1 ; ndc = -1 ; ndd = 1 
-    DO WHILE(readline(lu,line)) 
+    lc = 0 ; tlc = 0
+    ndr = -1 ; ndc = -1 ; ndd = 1
+    DO WHILE(readline(lu,line))
       lm1 = line
       ! Read the line
@@ -160,5 +148,5 @@
       ! skip comment line
       IF (INDEX(TRIM(ADJUSTL(line)),"#") == 1) CYCLE
-      ! An empty line: new 2D block 
+      ! An empty line: new 2D block
       IF (LEN_TRIM(line) == 0) THEN
         ndd = ndd + 1
@@ -175,5 +163,5 @@
       tlc = tlc + 1
       ! Splits line in words
-      IF (.NOT.tokenize(line,wrds,zdelim,.true.)) THEN 
+      IF (.NOT.tokenize(line,wrds,zdelim,.true.)) THEN
         ! cannot tokenize
         err = error(trim(path)//": Cannot parse line "//TRIM(slc),-5)
@@ -183,5 +171,5 @@
         err = error(trim(path)//": Cannot cast values at line "//TRIM(slc),-5)
         RETURN
-      ELSEIF (ndc > 0 .AND. ndc /= SIZE(wrds)) THEN 
+      ELSEIF (ndc > 0 .AND. ndc /= SIZE(wrds)) THEN
         ! current number of columns not equal to last one
         err = error(trim(path)//": Invalid number of columns (line "//TRIM(slc)//")",-5)
@@ -204,9 +192,9 @@
     ! Allocate memory
     ALLOCATE(data3d(ndr,ndc,ndd))
-    ir = 0 ; kd = 1 ; 
-    DO WHILE(readline(lu,line)) 
+    ir = 0 ; kd = 1 ;
+    DO WHILE(readline(lu,line))
       IF (INDEX(TRIM(ADJUSTL(line)),"#") == 1) CYCLE
       ir = ir + 1
-      ! empty line update block subscripts 
+      ! empty line update block subscripts
       IF (LEN_TRIM(line) == 0) THEN
         kd = kd + 1 ; ir = 0 ; CYCLE
@@ -223,13 +211,13 @@
     !!
     !! The function reads an ASCII file and saves its values in a real(kind=8) 2D-array.
-    !! 
+    !!
     !! The input file:
     !!
-    !! - can contains any number of empty lines and/or comment line (i.e. line where first 
+    !! - can contains any number of empty lines and/or comment line (i.e. line where first
     !!   non-blank character is "#"). All other lines are assumed to be data.
-    !! - must have a regular number of columns, that is each data line must have the same 
-    !!   number of columns. 
+    !! - must have a regular number of columns, that is each data line must have the same
+    !!   number of columns.
     !! - must use blank space(s) as value delimiter.
-    !! 
+    !!
     !! Error occured when:
     !!
@@ -241,5 +229,5 @@
     !! On error, the 2D output array is __not allocated__.
     USE FSYSTEM
-    CHARACTER(len=*), INTENT(in)                           :: path      !! Path of the input data file 
+    CHARACTER(len=*), INTENT(in)                           :: path      !! Path of the input data file
     REAL(kind=8), INTENT(out), DIMENSION(:,:), ALLOCATABLE :: data2d    !! 2D-array with the output values (double precision)
     CHARACTER(len=*), INTENT(in), OPTIONAL                 :: delimiter !! Optional column delimiter(s)
@@ -258,5 +246,5 @@
       err = error(trim(path)//": no such file",-1) ; RETURN
     ENDIF
-    lu = free_lun() 
+    lu = free_lun()
     IF (lu == -1) THEN ; err = error("Cannot find available logical unit...",-1) ; RETURN ; ENDIF
     OPEN(lu,FILE=TRIM(path),STATUS='OLD',ACTION='READ')
@@ -265,5 +253,5 @@
     lc=0 ; vc = 0 ; nc=-1
     ! First pass : get number of row values and checks everything !
-    DO 
+    DO
       ! Read the line
       IF (.NOT.readline(lu,line)) EXIT
@@ -273,5 +261,5 @@
       ! update row counter
       vc = vc + 1
-      IF (.NOT.tokenize(line,wrds,zdelim,.true.)) THEN 
+      IF (.NOT.tokenize(line,wrds,zdelim,.true.)) THEN
         ! cannot tokenize
         err = error(trim(path)//": Cannot parse line "//TRIM(slc),-5)
@@ -281,5 +269,5 @@
         err = error(trim(path)//": Cannot cast values at line "//TRIM(slc),-5)
         RETURN
-      ELSEIF (nc > 0 .AND. nc /= SIZE(tmp)) THEN 
+      ELSEIF (nc > 0 .AND. nc /= SIZE(tmp)) THEN
         ! current number of columns not equal to last one
         err = error(trim(path)//": Invalid number of columns (line "//TRIM(slc)//")",-5)
@@ -296,5 +284,5 @@
     ALLOCATE(data2d(nl,nc))
     ! Second pass : saves values :)
-    vc = 0 
+    vc = 0
     DO WHILE(vc <= nl)
       ! Reads the line
@@ -315,6 +303,6 @@
   FUNCTION readline(lun,line) RESULT(not_eof)
     !! Read a complete line
-    !! 
-    !! Each time, it is called, the function reads a complete of the file opened in __lun__ 
+    !!
+    !! Each time, it is called, the function reads a complete of the file opened in __lun__
     !! logical unit and returns .false. if EOF has been reached, .true. otherwise.
     !!
@@ -331,6 +319,6 @@
     !! CLOSE(1)
     !! ```
-    INTEGER, INTENT(in)                        :: lun  !! Logical unit with the opened file to read. 
-    CHARACTER(len=:), ALLOCATABLE, INTENT(out) :: line !! Processed line 
+    INTEGER, INTENT(in)                        :: lun  !! Logical unit with the opened file to read.
+    CHARACTER(len=:), ALLOCATABLE, INTENT(out) :: line !! Processed line
     LOGICAL  :: not_eof                                !! .true. if EOF has NOT been reached yet, .false. otherwise
     CHARACTER(len=50) :: buf
