#!/bin/bash


# Emplacement de la copie de travail NEMO
#----------------------------------------
NEMO_DIRE=$HOME/Workspace/NEMO


# Configuration centre de calcul (IDRIS/TGCC)
#--------------------------------------------
if   [ "$USER" == "${ID_IDRIS}" ]; then
    ID=${ID_IDRIS}
	# $HOME $WORKDIR $COMMONDIR $TMPDIR
    DIR_SCRATCH=$TMPDIR;    #DIR_STORE=$STOREDIR
    CMD_QUOTA_DISK_ID='quota_u && quota_u -w' #CMD_QUOTA_TIME='not existing'
        # Commandes LoadLeveler
    CMD_JOB_SUB=llsubmit                        CMD_JOB_VIEW='llq -u '$ID     CMD_JOB_DEL=llcancel
elif [ "$USER" == "${ID_TGCC}"  ]; then
    ID=${ID_TGCC}
        # $HOME $WORKDIR            $SCRATCHDIR $STOREDIR
    DIR_SCRATCH=$SCRATCHDIR; DIR_STORE=$STOREDIR
    CMD_QUOTA_DISK_ID=ccc_quota                CMD_QUOTA_TIME=ccc_myproject
    CMD_JOB_SUB='ccc_msub' CMD_JOB_VIEW='ccc_mpp -u '$ID CMD_JOB_DEL=ccc_mdel
else
    # A voir config local
fi

export DIR_WORK=$WORKDIR DIR_SCRATCH
export CMD_QUOTA_DISK_ID CMD_QUOTA_TIME CMD_JOB_SUB CMD_JOB_VIEW CMD_JOB_DEL


# Configuration NEMO/XIOS/OASIS (par défaut)
#-------------------------------------------
NEMO_BRAN=trunk
NEMO_HOME=$HOME/Workspace/NEMO/${NEMO_BRAN}/NEMOGCM
NEMO_FORC=${DIR_WORK}/NEMO/FORC 
export NEMO_BRAN NEMO_HOME NEMO_FORC && . $HOME/Workspace/NEMO/nemo_cfg.env

XIOS_BRAN=xios-1.0
XIOS_HOME=${DIR_WORK}/XIOS/branchs/${XIOS_BRAN}
export XIOS_BRAN XIOS_HOME 

OASI_HOME=${DIR_WORK}/OASIS
export OASI_BRAN OASI_HOME 
#env | grep 'NEMO\|XIOS\|OASI' | sort


# Test si nouvelle version d'un des codes
#----------------------------------------
for dir in ( ${NEMO_HOME}/NEMO ${XIOS_HOME}/src ${OASI_HOME}/lib ); do
    svn status 
    export NEMO_REVI=`svn info ${NEMO_HOME}/NEMO | awk '(NR == 9) {print $NF}'`
done