Index: branches/2016/dev_r6999_CONFIGMAN_1/NEMOGCM/TOOLS/SIREN/src/dimension.f90
===================================================================
--- branches/2016/dev_r6999_CONFIGMAN_1/NEMOGCM/TOOLS/SIREN/src/dimension.f90	(revision 7001)
+++ branches/2016/dev_r6999_CONFIGMAN_1/NEMOGCM/TOOLS/SIREN/src/dimension.f90	(revision 7153)
@@ -156,4 +156,6 @@
 !> @date Spetember, 2015
 !> - manage useless (dummy) dimension
+!> @date October, 2016
+!> - dimension allowed read in configuration file
 !>
 !> @note Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -171,4 +173,8 @@
 
    PRIVATE :: cm_dumdim        !< dummy dimension array
+   PRIVATE :: cm_dimX          !< x dimension array
+   PRIVATE :: cm_dimY          !< y dimension array
+   PRIVATE :: cm_dimZ          !< z dimension array
+   PRIVATE :: cm_dimT          !< t dimension array
 
    ! function and subroutine
@@ -188,4 +194,5 @@
    PUBLIC :: dim_get_dummy     !< fill dummy dimension array
    PUBLIC :: dim_is_dummy      !< check if dimension is defined as dummy dimension
+   PUBLIC :: dim_def_extra     !< read dimension configuration file, and save dimension allowed.
 
    PRIVATE :: dim__reshape_2xyzt_dp ! reshape real(8) 4D array to ('x','y','z','t')
@@ -203,4 +210,5 @@
    PRIVATE :: dim__copy_unit        ! copy dimension structure
    PRIVATE :: dim__copy_arr         ! copy array of dimension structure
+   PRIVATE :: dim__is_allowed
 
    TYPE TDIM !< dimension structure
@@ -215,5 +223,9 @@
    END TYPE
 
-   CHARACTER(LEN=lc), DIMENSION(ip_maxdum), SAVE :: cm_dumdim !< dummy dimension
+   CHARACTER(LEN=lc), DIMENSION(ip_maxdumcfg), SAVE :: cm_dumdim !< dummy dimension
+   CHARACTER(LEN=lc), DIMENSION(ip_maxdimcfg), SAVE :: cm_dimX   !< x dimension
+   CHARACTER(LEN=lc), DIMENSION(ip_maxdimcfg), SAVE :: cm_dimY   !< y dimension
+   CHARACTER(LEN=lc), DIMENSION(ip_maxdimcfg), SAVE :: cm_dimZ   !< z dimension
+   CHARACTER(LEN=lc), DIMENSION(ip_maxdimcfg), SAVE :: cm_dimT   !< t dimension
 
    INTERFACE dim_print
@@ -587,15 +599,16 @@
          cl_name=fct_lower(cd_name)
 
-         IF( TRIM(cl_name) == 'x' )THEN
+         IF(     dim__is_allowed(TRIM(cl_name), cm_dimX(:)) )THEN
             dim_init%c_sname='x'
-         ELSEIF( TRIM(cl_name) == 'y' )THEN
+         ELSEIF( dim__is_allowed(TRIM(cl_name), cm_dimY(:)) )THEN
             dim_init%c_sname='y'
-         ELSEIF( TRIM(cl_name)== 'z' .OR. &
-         &       INDEX(cl_name,'depth')/=0 )THEN
+         ELSEIF( dim__is_allowed(TRIM(cl_name), cm_dimZ(:)) )THEN
             dim_init%c_sname='z'
-         ELSEIF( TRIM(cl_name)== 't' .OR. &
-         &       INDEX(cl_name,'time')/=0 )THEN
+         ELSEIF( dim__is_allowed(TRIM(cl_name), cm_dimT(:)) )THEN
             dim_init%c_sname='t'
-         ENDIF      
+         ELSE
+            CALL logger_warn("DIM INIT: "//TRIM(cd_name)//&
+            " not allowed.")
+         ENDIF
 
       ENDIF
@@ -1430,7 +1443,7 @@
       ! loop indices
       ! namelist
-      CHARACTER(LEN=lc), DIMENSION(ip_maxdum) :: cn_dumvar
-      CHARACTER(LEN=lc), DIMENSION(ip_maxdum) :: cn_dumdim
-      CHARACTER(LEN=lc), DIMENSION(ip_maxdum) :: cn_dumatt
+      CHARACTER(LEN=lc), DIMENSION(ip_maxdumcfg) :: cn_dumvar
+      CHARACTER(LEN=lc), DIMENSION(ip_maxdumcfg) :: cn_dumdim
+      CHARACTER(LEN=lc), DIMENSION(ip_maxdumcfg) :: cn_dumatt
 
       !----------------------------------------------------------------
@@ -1493,5 +1506,5 @@
 
       dim_is_dummy=.FALSE.
-      DO ji=1,ip_maxdum
+      DO ji=1,ip_maxdumcfg
          IF( fct_lower(td_dim%c_name) == fct_lower(cm_dumdim(ji)) )THEN
             dim_is_dummy=.TRUE.
@@ -1501,4 +1514,117 @@
 
    END FUNCTION dim_is_dummy
+   !-------------------------------------------------------------------
+   !> @brief This subroutine read dimension configuration file, 
+   !> and fill array of dimension allowed.
+   !>
+   !> @author J.Paul
+   !> @date Ocotber, 2016 - Initial Version
+   !
+   !> @param[in] cd_file input file (dimension configuration file)
+   !-------------------------------------------------------------------
+   SUBROUTINE dim_def_extra( cd_file )
+      IMPLICIT NONE
+
+      ! Argument      
+      CHARACTER(LEN=*), INTENT(IN) :: cd_file
+
+      ! local variable
+      INTEGER(i4)   :: il_fileid
+      INTEGER(i4)   :: il_status
+
+      LOGICAL       :: ll_exist
+      
+      ! loop indices
+      ! namelist
+      CHARACTER(LEN=lc), DIMENSION(ip_maxdimcfg) :: cn_dimX = '' 
+      CHARACTER(LEN=lc), DIMENSION(ip_maxdimcfg) :: cn_dimY = ''
+      CHARACTER(LEN=lc), DIMENSION(ip_maxdimcfg) :: cn_dimZ = ''
+      CHARACTER(LEN=lc), DIMENSION(ip_maxdimcfg) :: cn_dimT = ''
+
+      !----------------------------------------------------------------
+      NAMELIST /namdim/ &   !< dimension namelist
+      &  cn_dimX, &       !< x dimension name allowed
+      &  cn_dimY, &       !< y dimension name allowed
+      &  cn_dimZ, &       !< z dimension name allowed
+      &  cn_dimT          !< t dimension name allowed
+
+      !----------------------------------------------------------------
+
+      ! init
+      cm_dimX(:)=''
+      cm_dimY(:)=''
+      cm_dimZ(:)=''
+      cm_dimT(:)=''
+
+      ! read config variable file
+      INQUIRE(FILE=TRIM(cd_file), EXIST=ll_exist)
+      IF( ll_exist )THEN
+
+         il_fileid=fct_getunit()
+   
+         OPEN( il_fileid, FILE=TRIM(cd_file), &
+         &                FORM='FORMATTED',       &
+         &                ACCESS='SEQUENTIAL',    &
+         &                STATUS='OLD',           &
+         &                ACTION='READ',          &
+         &                IOSTAT=il_status)
+         CALL fct_err(il_status)
+         IF( il_status /= 0 )THEN
+            CALL logger_fatal("DIM GET DUMMY: opening "//TRIM(cd_file))
+         ENDIF
+   
+         READ( il_fileid, NML = namdim )
+         cm_dimX(:)=cn_dimX(:)
+         cm_dimY(:)=cn_dimY(:)
+         cm_dimZ(:)=cn_dimZ(:)
+         cm_dimT(:)=cn_dimT(:)
+
+         CLOSE( il_fileid )
+
+      ELSE
+
+         CALL logger_fatal("DIM DEF EXTRA: can't find configuration"//&
+            &              " file "//TRIM(cd_file))
+
+      ENDIF         
+
+   END SUBROUTINE dim_def_extra
+   !-------------------------------------------------------------------
+   !> @brief This function check if dimension is allowed, i.e defined 
+   !> in dimension configuraton file
+   !>
+   !> @author J.Paul
+   !> @date OCTOber, 2016 - Initial Version
+   !
+   !> @param[in] cd_name dimension name
+   !> @param[in] cd_dim  array dimension name allowed
+   !> @return true if dimension is allowed 
+   !-------------------------------------------------------------------
+   FUNCTION dim__is_allowed(cd_name, cd_dim)
+      IMPLICIT NONE
+
+      ! Argument
+      CHARACTER(LEN=*),               INTENT(IN) :: cd_name
+      CHARACTER(LEN=*), DIMENSION(:), INTENT(IN) :: cd_dim
+      
+      ! function
+      LOGICAL :: dim__is_allowed
+      
+      ! loop indices
+      INTEGER(i4) :: ji
+      !----------------------------------------------------------------
+
+      dim__is_allowed=.FALSE.
+      ji=1
+      DO WHILE( TRIM(cd_dim(ji)) /= '' )
+         IF( TRIM(fct_lower(cd_name)) == TRIM(fct_lower(cd_dim(ji))) )THEN
+            dim__is_allowed=.TRUE.
+            EXIT
+         ENDIF
+         ji=ji+1
+      ENDDO
+
+   END FUNCTION dim__is_allowed
+
 END MODULE dim
 
