Index: branches/libIGCM_MPI_OpenMP/libIGCM_debug/libIGCM_debug.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_debug/libIGCM_debug.ksh	(revision 489)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_debug/libIGCM_debug.ksh	(revision 571)
@@ -28,10 +28,10 @@
 
 if ( $DEBUG_debug ) ; then
-    if [ -f stack ] ;
-    then
-	echo "Stack of an libIGCM job :" >> stack
-    else
-	echo "Stack of an libIGCM job :" >  stack
-    fi
+  if [ -f stack ] ;
+  then
+    echo "Stack of an libIGCM job :" >> stack
+  else
+    echo "Stack of an libIGCM job :" >  stack
+  fi
 fi
 
@@ -68,26 +68,26 @@
 #D-
 function IGCM_debug_CallStack {
-    echo
-    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!"
-    echo "!! IGCM_debug_CallStack !!"
+  echo
+  echo "!!!!!!!!!!!!!!!!!!!!!!!!!!"
+  echo "!! IGCM_debug_CallStack !!"
+  echo "!------------------------!"
+  echo
+  if ( $DEBUG_debug ) ; then
+    # La pile d'appels est affichée de la plus vieille à la plus récente 
+    # (c'est donc l'inverse de la norme d'affichage).
+    typeset i decal
+    (( i=0 ))
+    until [ $i -eq ${IGCM_debug_LenStack} ]; do
+      decal=0
+      until [ $decal -eq ${i} ]; do
+	printf -- ' '
+	let $(( decal=decal+1 ))
+      done
+      echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}"\
+		"(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})"
+      let $((i=i+1))
+    done
     echo "!------------------------!"
-    echo
-    if ( $DEBUG_debug ) ; then
-       # La pile d'appels est affichée de la plus vieille à la plus récente 
-       # (c'est donc l'inverse de la norme d'affichage).
-	typeset i decal
-	(( i=0 ))
-	until [ $i -eq ${IGCM_debug_LenStack} ]; do
-	    decal=0
-	    until [ $decal -eq ${i} ]; do
-		printf -- ' '
-		let $(( decal=decal+1 ))
-	    done
-	    echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}"\
-		"(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})"
-	    let $((i=i+1))
-	done
-	echo "!------------------------!"
-    fi
+  fi
 }
 
@@ -97,30 +97,30 @@
 #D-
 function IGCM_debug_PushStack {
-    if ( $DEBUG_debug ) ; then
-       typeset decal
-       echo >> stack
-       decal=0
-       while [ $decal -lt ${IGCM_debug_LenStack} ]; do
+  if ( $DEBUG_debug ) ; then
+    typeset decal
+    echo >> stack
+    decal=0
+    while [ $decal -lt ${IGCM_debug_LenStack} ]; do
 #          printf -- ' ' >> stack
-           printf ' ' >> stack
-           let $(( decal=decal+1 ))
-       done
-       echo "> ${IGCM_debug_LenStack} : ${@}" >> stack
-
-       # We add function call name on beginning of the stack
-       set +A IGCM_debug_Stack -- ${1} ${IGCM_debug_Stack[*]}
-
-       # We include the "null" Args in the beginning of the StackArgs
-       set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]} 
-       # Then, we shift StackArgs tabular
-       if [ $# -gt 1 ]; then 
-	   shift; 
-	   IGCM_debug_StackArgs[0]=$(echo ${@} | sed -e "s/\ /,/g") >&2
-       fi
-       (( IGCM_debug_LenStack = IGCM_debug_LenStack + 1 ))
-
-       # If you want to print CallStack each time :
-       # IGCM_debug_CallStack
-    fi
+      printf ' ' >> stack
+      let $(( decal=decal+1 ))
+    done
+    echo "> ${IGCM_debug_LenStack} : ${@}" >> stack
+
+    # We add function call name on beginning of the stack
+    set +A IGCM_debug_Stack -- ${1} ${IGCM_debug_Stack[*]}
+
+    # We include the "null" Args in the beginning of the StackArgs
+    set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]} 
+    # Then, we shift StackArgs tabular
+    if [ $# -gt 1 ]; then 
+      shift; 
+      IGCM_debug_StackArgs[0]=$(echo ${@} | sed -e "s/\ /,/g") >&2
+    fi
+    (( IGCM_debug_LenStack = IGCM_debug_LenStack + 1 ))
+
+    # If you want to print CallStack each time :
+    # IGCM_debug_CallStack
+  fi
 }
 
@@ -130,50 +130,49 @@
 #D-
 function IGCM_debug_PopStack {
-    if ( $DEBUG_debug ) ; then
-	if ( ${ExitFlag} ) ; then
-	    echo '!!! ExitFlag has been activated !!!' >> stack
-	fi
-	if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then
-	    let $(( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 ))
-
-	    IGCM_debug_Stack[0]="" 
-	    IGCM_debug_StackArgs[0]=""
-	    
-	    set +A tmpStack -- ${IGCM_debug_Stack[*]}
-	    unset IGCM_debug_Stack
-	    set +A IGCM_debug_Stack -- ${tmpStack[*]} 
-
-	    set +A tmpStack -- ${IGCM_debug_StackArgs[*]}
-	    unset IGCM_debug_StackArgs
-	    set +A IGCM_debug_StackArgs -- ${tmpStack[*]}
-	    unset tmpStack
-	else
-	    echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack}
-	    IGCM_debug_Exit $@
-	fi
-	typeset decal=0
-	while [ $decal -lt ${IGCM_debug_LenStack} ]; do
-	  # printf -- ' ' >> stack
-	  printf ' ' >> stack
- 	  (( decal=decal+1 ))
-	done
-      echo "< ${IGCM_debug_LenStack} : ${@}" >> stack
-
-      if [ ${IGCM_debug_LenStack} = 0 ]; then
-	  # Reset array only when necessary
-	  #echo
-	  #IGCM_debug_Print 3 "Clean stack array"
-	  #echo
-	  #set -A IGCM_debug_Stack ${NULL_STR}
-	  #set -A IGCM_debug_StackArgs ${NULL_STR}
-	  unset IGCM_debug_Stack
-	  unset IGCM_debug_StackArgs
-	  IGCM_debug_Stack[0]=${NULL_STR}
-          IGCM_debug_StackArgs[0]=${NULL_STR}
-      fi
-
-    fi
-
-    #IGCM_debug_CallStack
+  if ( $DEBUG_debug ) ; then
+    if ( ${ExitFlag} ) ; then
+      echo '!!! ExitFlag has been activated !!!' >> stack
+    fi
+    if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then
+      let $(( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 ))
+
+      IGCM_debug_Stack[0]="" 
+      IGCM_debug_StackArgs[0]=""
+      
+      set +A tmpStack -- ${IGCM_debug_Stack[*]}
+      unset IGCM_debug_Stack
+      set +A IGCM_debug_Stack -- ${tmpStack[*]} 
+
+      set +A tmpStack -- ${IGCM_debug_StackArgs[*]}
+      unset IGCM_debug_StackArgs
+      set +A IGCM_debug_StackArgs -- ${tmpStack[*]}
+      unset tmpStack
+    else
+      echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack}
+      IGCM_debug_Exit $@
+    fi
+    typeset decal=0
+    while [ $decal -lt ${IGCM_debug_LenStack} ]; do
+      # printf -- ' ' >> stack
+      printf ' ' >> stack
+      (( decal=decal+1 ))
+    done
+    echo "< ${IGCM_debug_LenStack} : ${@}" >> stack
+
+    if [ ${IGCM_debug_LenStack} = 0 ]; then
+      # Reset array only when necessary
+      #echo
+      #IGCM_debug_Print 3 "Clean stack array"
+      #echo
+      #set -A IGCM_debug_Stack ${NULL_STR}
+      #set -A IGCM_debug_StackArgs ${NULL_STR}
+      unset IGCM_debug_Stack
+      unset IGCM_debug_StackArgs
+      IGCM_debug_Stack[0]=${NULL_STR}
+      IGCM_debug_StackArgs[0]=${NULL_STR}
+    fi
+
+  fi
+  #IGCM_debug_CallStack
 }
 
@@ -183,9 +182,9 @@
 #D-
 function IGCM_debug_Exit {
-    IGCM_debug_PushStack "IGCM_debug_Exit"
-    echo "IGCM_debug_Exit : " "${@}"
-    IGCM_debug_CallStack
-    ExitFlag=true
-    IGCM_debug_PopStack "IGCM_debug_Exit"
+  IGCM_debug_PushStack "IGCM_debug_Exit"
+  echo "IGCM_debug_Exit : " "${@}"
+  IGCM_debug_CallStack
+  ExitFlag=true
+  IGCM_debug_PopStack "IGCM_debug_Exit"
 }
 
@@ -195,22 +194,22 @@
 #D-
 function IGCM_debug_Verif_Exit {
-    if ( ${ExitFlag} ) ; then
-	# Plan to send an email here with IGCM_sys_SendMail
-	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Fatal"
-	echo "IGCM_debug_Verif_Exit : Something wrong append."
-	echo "                        EXIT THE JOB."
-	echo
-	if ( $DEBUG_debug ) ; then
-	    IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error
-	    echo "Your files on ${R_OUT} :"
-	    IGCM_sys_Tree ${R_SAVE}
-	    echo
-	fi
-	# Mail notification
-	IGCM_sys_SendMail
-	# And Good Bye
-	date
-	exit 1
-    fi
+  if ( ${ExitFlag} ) ; then
+    # Plan to send an email here with IGCM_sys_SendMail
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Fatal"
+    echo "IGCM_debug_Verif_Exit : Something wrong append."
+    echo "                        EXIT THE JOB."
+    echo
+    if ( $DEBUG_debug ) ; then
+      IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error
+      echo "Your files on ${R_OUT} :"
+      IGCM_sys_Tree ${R_SAVE}
+      echo
+    fi
+    # Mail notification
+    IGCM_sys_SendMail
+    # And Good Bye
+    date
+    exit 1
+  fi
 }
 
@@ -220,28 +219,28 @@
 #D-
 function IGCM_debug_Verif_Exit_Post {
-    if ( ${ExitFlag} ) ; then
-	echo "IGCM_debug_Verif_Exit_Post : Something wrong append."
-	# If SpaceName is PROD then we stop if post_processing fails
-	# Plan to send an email here with IGCM_sys_SendMail
-	if ( [ X${config_UserChoices_SpaceName} = XPROD ] && [ X${JobType} = XRUN ] ) ; then
-	    echo "                        EXIT THE JOB."
-	    echo
-	    if ( $DEBUG_debug ) ; then
-		IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error
-		echo
-	    fi
-	    # Mail notification
-	    #IGCM_sys_SendMailPost
-	    # And Good Bye
-	    date
-	    exit 1
-	else
-	    echo "Either inside config.card the variable SpaceName is not in PROD"
-	    echo "or insinde the main Job the variable JobType is not in RUN mode"
-	    echo "              SO WE DO NOT EXIT THE JOB."
-	    echo
-	    date
-	fi
-    fi
+  if ( ${ExitFlag} ) ; then
+    echo "IGCM_debug_Verif_Exit_Post : Something wrong append."
+    # If SpaceName is PROD then we stop if post_processing fails
+    # Plan to send an email here with IGCM_sys_SendMail
+    if ( [ X${config_UserChoices_SpaceName} = XPROD ] && [ X${JobType} = XRUN ] ) ; then
+      echo "                        EXIT THE JOB."
+      echo
+      if ( $DEBUG_debug ) ; then
+	IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error
+	echo
+      fi
+      # Mail notification
+      #IGCM_sys_SendMailPost
+      # And Good Bye
+      date
+      exit 1
+    else
+      echo "Either inside config.card the variable SpaceName is not in PROD"
+      echo "or insinde the main Job the variable JobType is not in RUN mode"
+      echo "              SO WE DO NOT EXIT THE JOB."
+      echo
+      date
+    fi
+  fi
 }
 
@@ -252,28 +251,28 @@
 function IGCM_debug_Print
 {
-    typeset level=$1
+  typeset level=$1
+  shift
+
+  if [ X"${1}" = X"-e" ]; then
+    typeset cmd_echo="echo -e"
     shift
-
-    if [ X"${1}" = X"-e" ]; then
-	typeset cmd_echo="echo -e"
-	shift
-    else
-	typeset cmd_echo="echo"
-    fi
-
-    if [ ${level} -le ${Verbosity} ] ; then
-	typeset i
-	case "${level}" in
-	    1) for i in "$@" ; do
-		    ${cmd_echo} "--Debug1-->" ${i}
-	      done ;; 
-	    2) for i in "$@" ; do
-		    ${cmd_echo} "--------Debug2-->" ${i}
-	      done ;; 
-	    3) for i in "$@" ; do
-		    ${cmd_echo} "--------------Debug3-->" ${i}
-	      done ;; 
-	esac
-    fi
+  else
+    typeset cmd_echo="echo"
+  fi
+
+  if [ ${level} -le ${Verbosity} ] ; then
+    typeset i
+    case "${level}" in
+    1) for i in "$@" ; do
+      ${cmd_echo} "--Debug1-->" ${i}
+      done ;; 
+    2) for i in "$@" ; do
+      ${cmd_echo} "--------Debug2-->" ${i}
+      done ;; 
+    3) for i in "$@" ; do
+      ${cmd_echo} "--------------Debug3-->" ${i}
+      done ;; 
+    esac
+  fi
 }
 
@@ -284,12 +283,12 @@
 function IGCM_debug_PrintVariables
 {
-    typeset level=$1
-    shift
-
-    list=$( set | grep $1 | sed -e "s/'//g" )
-
-    if [ "X${list}" != X ]  ; then
-        IGCM_debug_Print ${level} ${list}
-    fi
+  typeset level=$1
+  shift
+
+  list=$( set | grep $1 | sed -e "s/'//g" )
+
+  if [ "X${list}" != X ]  ; then
+    IGCM_debug_Print ${level} ${list}
+  fi
 }
 
@@ -299,34 +298,34 @@
 function IGCM_debug_Check
 {
-    #---------------------
-    if [ ! -n "${libIGCM}" ] ; then
-        echo "Check libIGCM_debug ..........................................[ FAILED ]"
-        echo "--Error--> libIGCM variable is not defined"
-        exit 2
-    fi
-
-    #---------------------
-    if [ ! -n "${Verbosity}" ] ; then
-        echo "Check libIGCM_debug ..........................................[ FAILED ]"
-        echo "--Error--> Verbosity variable is not defined"
-        exit 3
-    fi
-
-    #---------------------
-    ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh > IGCM_debug_Test.ref.failed 2>&1
-    sleep 2
-
-    if diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref > /dev/null 2>&1 ; then
-        echo "Check libIGCM_debug ..............................................[ OK ]"
-        rm -f IGCM_debug_Test.ref.failed
-    else
-        echo "Check libIGCM_debug ..........................................[ FAILED ]"
-        echo "--Error--> Execution of ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh"
-        echo "           has produced the file IGCM_debug_Test.ref.failed"
-        echo "           Please analyse differences with the reference file by typing:"
-	echo "           diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref"
-	echo "           Report errors to the author: Patrick.Brockmann@cea.fr"
-        exit 4
-    fi
-    #---------------------
-}
+  #---------------------
+  if [ ! -n "${libIGCM}" ] ; then
+    echo "Check libIGCM_debug ..........................................[ FAILED ]"
+    echo "--Error--> libIGCM variable is not defined"
+    exit 2
+  fi
+
+  #---------------------
+  if [ ! -n "${Verbosity}" ] ; then
+    echo "Check libIGCM_debug ..........................................[ FAILED ]"
+    echo "--Error--> Verbosity variable is not defined"
+    exit 3
+  fi
+
+  #---------------------
+  ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh > IGCM_debug_Test.ref.failed 2>&1
+  sleep 2
+
+  if diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref > /dev/null 2>&1 ; then
+    echo "Check libIGCM_debug ..............................................[ OK ]"
+    rm -f IGCM_debug_Test.ref.failed
+  else
+    echo "Check libIGCM_debug ..........................................[ FAILED ]"
+    echo "--Error--> Execution of ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh"
+    echo "           has produced the file IGCM_debug_Test.ref.failed"
+    echo "           Please analyse differences with the reference file by typing:"
+    echo "           diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref"
+    echo "           Report errors to the author: Patrick.Brockmann@cea.fr"
+    exit 4
+  fi
+  #---------------------
+}
