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 4245 for branches/2013/dev_LOCEAN_CMCC_INGV_MERC_UKMO_2013/NEMOGCM/SETTE/all_functions.sh – NEMO

Ignore:
Timestamp:
2013-11-19T12:19:21+01:00 (11 years ago)
Author:
cetlod
Message:

dev_locean_cmcc_ingv_ukmo_merc : merge in the MERC_UKMO dev branch with trunk rev 4119

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2013/dev_LOCEAN_CMCC_INGV_MERC_UKMO_2013/NEMOGCM/SETTE/all_functions.sh

    r4147 r4245  
    9696   if [ ${#} -lt ${minargcount} ] 
    9797   then 
    98       echo "not enought arguments for set_namelist" 
     98      echo "not enough arguments for set_namelist" 
    9999      echo "${usage}" 
    100100      exit 1 
     
    153153} 
    154154 
     155 
    155156# function to tidy up after each test and populate the NEMO_VALIDATION store 
    156157post_test_tidyup () { 
     
    249250    fi 
    250251} 
     252 
     253############################################################# 
     254# extra functions to manipulate settings in the iodef.xml file 
     255# 
     256# Examples: 
     257#   set_xio_file_type    iodef.xml one_file 
     258#   set_xio_using_server iodef.xml true 
     259#   set_xio_buffer_size  iodef.xml 50000000 
     260# 
     261############################################################# 
     262 
     263usage2=" Usage : set_xio_file_type input_iodef.xml one_file||multiple_file" 
     264usage3=" Usage : set_xio_using_server input_iodef.xml true||false" 
     265usage4=" Usage : set_xio_buffer_size input_iodef.xml int_buffer_size" 
     266 
     267set_xio_file_type () { 
     268        minargcount=2 
     269        if [ ${#} -lt ${minargcount} ] 
     270        then 
     271                echo "not enough arguments for set_xio_file_type" 
     272                echo "${usage2}" 
     273                exit 1 
     274        fi 
     275        if [ $2 != "one_file" ] && [ $2 != "multiple_file" ] 
     276        then 
     277                echo "unrecognised argument for set_xio_file_type" 
     278                echo "${usage2}" 
     279                echo $2 
     280                exit 1 
     281        fi 
     282        unset minargcount 
     283        if [  ! -f ${SETTE_DIR}/output.sette ] ; then 
     284                touch ${SETTE_DIR}/output.sette 
     285        fi 
     286 
     287        echo "executing script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette 
     288        echo "################" >> ${SETTE_DIR}/output.sette 
     289 
     290        VAR_NAME=$( grep "^.*<.*file_definition.*type.*=" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" ) 
     291        if [ ${#VAR_NAME} -eq 0 ] 
     292        then 
     293                echo "doing \"set_xio_file_type $@\". " 
     294                echo "xml_tag: file_definition with variable: type is empty" 
     295                echo "confirm that an appropriate file_definition is in \"${EXE_DIR}/$1\" " 
     296                echo "exit" 
     297                echo "error in executing script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette 
     298                echo "....." >> ${SETTE_DIR}/output.sette 
     299                exit 1 
     300        fi 
     301        if [ $2 == "one_file" ]  
     302        then 
     303           sed -e "s:multiple_file:one_file:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp 
     304        else 
     305           sed -e "s:one_file:multiple_file:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp 
     306        fi 
     307        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1 
     308 
     309        echo "finished script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette 
     310        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette 
     311        echo "                " >> ${SETTE_DIR}/output.sette 
     312} 
     313 
     314set_xio_using_server () { 
     315        minargcount=2 
     316        if [ ${#} -lt ${minargcount} ] 
     317        then 
     318                echo "not enough arguments for set_xio_using_server" 
     319                echo "${usage2}" 
     320                exit 1 
     321        fi 
     322        if [ $2 != "true" ] && [ $2 != "false" ] 
     323        then 
     324                echo "unrecognised argument for set_xio_using_server" 
     325                echo "${usage2}" 
     326                echo $2 
     327                exit 1 
     328        fi 
     329        unset minargcount 
     330        if [  ! -f ${SETTE_DIR}/output.sette ] ; then 
     331                touch ${SETTE_DIR}/output.sette 
     332        fi 
     333 
     334        echo "executing script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette 
     335        echo "################" >> ${SETTE_DIR}/output.sette 
     336 
     337        VAR_NAME=$( grep "^.*<.*variable id.*=.*using_server.*=.*boolean" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" ) 
     338        if [ ${#VAR_NAME} -eq 0 ] 
     339        then 
     340                echo "doing \"set_xio_using_server $@\". " 
     341                echo "xml_tag: "variable id=using_server" with variable: boolean is empty" 
     342                echo "confirm that an appropriate variable id is in \"${EXE_DIR}/$1\" " 
     343                echo "exit" 
     344                echo "error in executing script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette 
     345                echo "....." >> ${SETTE_DIR}/output.sette 
     346                exit 1 
     347        fi 
     348        if [ $2 == "false" ] 
     349        then 
     350           sed -e "/using_server/s:true:false:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp 
     351           export USING_MPMD=no 
     352        else 
     353           sed -e "/using_server/s:false:true:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp 
     354           export USING_MPMD=yes 
     355        fi 
     356        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1 
     357 
     358        echo "finished script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette 
     359        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette 
     360        echo "                " >> ${SETTE_DIR}/output.sette 
     361} 
     362 
     363set_xio_buffer_size () { 
     364        minargcount=2 
     365        if [ ${#} -lt ${minargcount} ] 
     366        then 
     367                echo "not enough arguments for set_xio_buffer_size" 
     368                echo "${usage4}" 
     369                exit 1 
     370        fi 
     371        unset minargcount 
     372        if [  ! -f ${SETTE_DIR}/output.sette ] ; then 
     373                touch ${SETTE_DIR}/output.sette 
     374        fi 
     375 
     376        echo "executing script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette 
     377        echo "################" >> ${SETTE_DIR}/output.sette 
     378 
     379        VAR_NAME=$( grep "^.*<.*variable id.*=.*buffer_size.*=.*integer" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" ) 
     380        if [ ${#VAR_NAME} -eq 0 ] 
     381        then 
     382                echo "doing \"set_xio_buffer_size $@\". " 
     383                echo "xml_tag: "variable id=buffer_size" with variable: integer is empty" 
     384                echo "confirm that an appropriate variable id is in \"${EXE_DIR}/$1\" " 
     385                echo "exit" 
     386                echo "error in executing script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette 
     387                echo "....." >> ${SETTE_DIR}/output.sette 
     388                exit 1 
     389        fi 
     390        sed -e "/buffer_size/s:>.*<:>$2<:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp 
     391        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1 
     392 
     393        echo "finished script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette 
     394        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette 
     395        echo "                " >> ${SETTE_DIR}/output.sette 
     396} 
     397 
Note: See TracChangeset for help on using the changeset viewer.