The OASIS Coupler Forum

  HOME

MCT namespace conflicts

Up to Installation and compilation

Posted by Anonymous at September 12 2014

Dear Laure, Sophie,

We are trying to couple an external model with CESM 1.2, where MCT is already included. I noticed that in PSMILE the MCT routines from OASIS-MCT are renamed by including an oas_ prefix (e.g., mct_avect_init -> oas_mct_avect_init). Is it sufficient to simply rename the libmct.a and libmpeu.a in OASIS3-MCT, to, for example, libmct_oas.a and libmpeu_oas.a to avoid the namespace conflict?

Many thanks! Kind regards, Guowei HE

Posted by Anonymous at September 15 2014

Hello Guowei,

as you said, MCT routines have to be renamed. But their call, on MCT and PSMILE libraries have to take into account this name change. See the script below.

Best regards, Eric

------------------------------------------#!/bin/bash
#
# Modify MCT libraries
#
echo
echo Modify MCT libraries 
echo
cd lib/mct
for direc in mct mpeu
do
  if [ ! -d ${direc}_release ]; then
    mkdir ${direc}_release
    cp -f ${direc}/* ${direc}_release
  else
    cp -f ${direc}_release/* ${direc}
  fi
  cd ${direc}
  for file in *90
  do
    chmod u+w $file
    echo $file
    sed -e s/'use *m_[A-Za-z0-9 _\t]*$/&egard'/ -e s/'use *m_[A-Za-z0-9 _\t]*\,/&eperdu'/ -e s/'use *m_[A-Za-z0-9 _\t]*\!/&voltige'/ -e s/'[ \t]*\,eperdu/_oasis\,'/ -e s/'[ \t]*'egard/_oasis/ -e s/'[ \t]*\!voltige/_oasis \!'/ $file > toto
    sed -e s/' *module *m[A-Za-z0-9_\t]*/&_oasis'/ toto > $file
  done
  rm -f toto
  cd ..
done
#
# Modify psmile library
#
echo
echo Modify psmile library
echo
cd ../psmile
if [ ! -d src_release ]; then
  mkdir src_release
  cp -f src/* src_release
else
  cp -f src_release/* src
fi
cd src
for file in *90
do
  echo $file
  sed s/mct_mod/mct_mod_oasis/ $file > toto
  mv toto $file
done

Posted by Anonymous at January 7 2015

Thank you Eric and Laure!
Reply to this