Index: XIOS/dev/branch_yushan/arch/arch-local.env
===================================================================
--- XIOS/dev/branch_yushan/arch/arch-local.env	(revision 1087)
+++ XIOS/dev/branch_yushan/arch/arch-local.env	(revision 1087)
@@ -0,0 +1,7 @@
+
+export HDF5_INC_DIR=$HOME/LIB/hdf5-1.8.16/hdf5/include
+export HDF5_LIB_DIR=$HOME/LIB/hdf5-1.8.16/hdf5/lib
+
+export NETCDF_INC_DIR=/usr/local/include
+export NETCDF_LIB_DIR=/usr/local/lib
+
Index: XIOS/dev/branch_yushan/arch/arch-local.fcm
===================================================================
--- XIOS/dev/branch_yushan/arch/arch-local.fcm	(revision 1087)
+++ XIOS/dev/branch_yushan/arch/arch-local.fcm	(revision 1087)
@@ -0,0 +1,24 @@
+################################################################################
+###################                Projet XIOS               ###################
+################################################################################
+
+%CCOMPILER      mpicc -fopenmp -D_openmpi -D_usingEP 
+%FCOMPILER      mpif90 -fopenmp
+%LINKER         mpif90 -fopenmp -D_openmpi -D_usingEP 
+
+%BASE_CFLAGS    -ansi -w -D_GLIBCXX_USE_CXX11_ABI=0
+%PROD_CFLAGS    -O3 -DBOOST_DISABLE_ASSERTS
+%DEV_CFLAGS     -g -O2 
+%DEBUG_CFLAGS   -g 
+
+%BASE_FFLAGS    -D__NONE__ 
+%PROD_FFLAGS    -O3
+%DEV_FFLAGS     -g -O2
+%DEBUG_FFLAGS   -g 
+
+%BASE_INC       -D__NONE__
+%BASE_LD        -lstdc++
+
+%CPP            cpp
+%FPP            cpp -P
+%MAKE           make
Index: XIOS/dev/branch_yushan/arch/arch-local.path
===================================================================
--- XIOS/dev/branch_yushan/arch/arch-local.path	(revision 1087)
+++ XIOS/dev/branch_yushan/arch/arch-local.path	(revision 1087)
@@ -0,0 +1,15 @@
+NETCDF_INCDIR="-I $NETCDF_INC_DIR"
+NETCDF_LIBDIR="-L $NETCDF_LIB_DIR"
+NETCDF_LIB=" -lnetcdf"
+
+MPI_INCDIR=""
+MPI_LIBDIR=""
+MPI_LIB=""
+
+HDF5_INCDIR="-I $HDF5_INC_DIR"
+HDF5_LIBDIR="-L $HDF5_LIB_DIR"
+HDF5_LIB="-lhdf5_hl -lhdf5 -lhdf5 -lz -ldl "
+
+OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1"
+OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib"
+OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu"
Index: XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp
===================================================================
--- XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp	(revision 1086)
+++ XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp	(revision 1087)
@@ -25,9 +25,12 @@
     std::map<std::pair<int, int>, MPI_Comm > ::iterator it;
     
-    it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num()));
-    if(it == fc_comm_map.end())
+    #pragma omp critical (fc_comm_map)
     {
-      fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm));
-      printf("EP_Comm_c2f : MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), comm.ep_comm_ptr);
+      it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num()));
+      if(it == fc_comm_map.end())
+      {
+        fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm));
+        printf("EP_Comm_c2f : MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), comm.ep_comm_ptr);
+      }
     }
     
@@ -44,5 +47,7 @@
     std::map<std::pair<int, int>, MPI_Comm > ::iterator it;
     
+    #pragma omp critical (fc_comm_map)
     it = fc_comm_map.find(std::make_pair(comm, omp_get_thread_num()));
+    
     if(it != fc_comm_map.end())
     {
@@ -52,129 +57,31 @@
       return  comm_ptr;
     }
-    else
-    {      
+       
       
-      #ifdef _openmpi
-      ::MPI_Comm base_comm = ::MPI_Comm_f2c(comm);
-      #elif _intelmpi
-      ::MPI_Comm base_comm = (::MPI_Comm)(comm);
-      #endif
+    #ifdef _openmpi
+    ::MPI_Comm base_comm = ::MPI_Comm_f2c(comm);
+    #elif _intelmpi
+    ::MPI_Comm base_comm = (::MPI_Comm)(comm);
+    #endif
 
-      if(base_comm != MPI_COMM_NULL_STD)
+    if(base_comm != MPI_COMM_NULL_STD)
+    {
+      if(omp_get_thread_num() == 0)
       {
-        if(omp_get_thread_num() == 0)
-        {
-          int num_ep = omp_get_num_threads();
-          MPI_Comm *new_comm;
-          MPI_Info info;
-          MPI_Comm_create_endpoints(base_comm, num_ep, info, new_comm);
-          passage = new_comm;
-        }
-        #pragma omp barrier
+        int num_ep = omp_get_num_threads();
+        MPI_Comm *new_comm;
+        MPI_Info info;
+        MPI_Comm_create_endpoints(base_comm, num_ep, info, new_comm);
+        passage = new_comm;
+      }
+      #pragma omp barrier
 
-        MPI_Comm return_comm = passage[omp_get_thread_num()];
-        return return_comm;
+      MPI_Comm return_comm = passage[omp_get_thread_num()];
+      return return_comm;
         
-      }
-      return MPI_COMM_NULL;
-      
     }
+    return MPI_COMM_NULL;
+
   }
-
-  // #ifdef _intelmpi
-
-  // MPI_Fint MPI_Comm_c2f(MPI_Comm comm)
-  // {
-  //   Debug("MPI_Comm_c2f");
-  //   int fint;
-  //   fint = (::MPI_Fint)(comm.mpi_comm);
-    
-  //   std::map<std::pair<int, int>, MPI_Comm  > ::iterator it;
-    
-  //   it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num()));
-  //   if(it == fc_comm_map.end())
-  //   {
-  //     fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm));
-  //     printf("MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), &comm);
-  //   }
-    
-  //   MPI_Fint Fint;
-  //   Fint.mpi_fint = fint;
-  //   return Fint;
-    
-  // }
-
-  
-
-
-  // MPI_Comm MPI_Comm_f2c(MPI_Fint comm)
-  // {
-  //   Debug("MPI_Comm_f2c");
-    
-    
-  //   std::map<std::pair<int, int>, MPI_Comm  > ::iterator it;
-    
-  //   it = fc_comm_map.find(std::make_pair(comm.mpi_fint, omp_get_thread_num()));
-  //   if(it != fc_comm_map.end())
-  //   {
-  //     MPI_Comm comm_ptr;
-  //     comm_ptr =  it->second;
-  //     printf("MAP find: %d, %d, %p\n", it->first.first, it->first.second, &comm_ptr);
-  //     return  comm_ptr;
-  //   }
-  //   else
-  //   {      
-  //     MPI_Comm return_comm;
-  //     return_comm.mpi_comm = (::MPI_Comm)(comm.mpi_fint);
-  //     return return_comm;
-  //   }
-  // }
-
-  
-
-  // #elif _openmpi
-  
-  // int MPI_Comm_c2f(MPI_Comm comm)
-  // {
-  //   Debug("MPI_Comm_c2f");
-  //   int fint;
-  //   fint = ::MPI_Comm_c2f(static_cast< ::MPI_Comm>(comm.mpi_comm));
-    
-  //   std::map<std::pair<int, int>, MPI_Comm > ::iterator it;
-    
-  //   it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num()));
-  //   if(it == fc_comm_map.end())
-  //   {
-  //     fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm));
-  //     printf("MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), &comm);
-  //   }
-    
-  //   return fint;
-    
-  // }
-
-  // ep_lib::MPI_Comm MPI_Comm_f2c(MPI_Fint comm)
-  // {
-  //   Debug("MPI_Comm_f2c");
-    
-    
-  //   std::map<std::pair<int, int>, MPI_Comm > ::iterator it;
-    
-  //   it = fc_comm_map.find(std::make_pair(comm, omp_get_thread_num()));
-  //   if(it != fc_comm_map.end())
-  //   {
-  //     MPI_Comm comm_ptr;
-  //     comm_ptr =  it->second;
-  //     printf("MAP find: %d, %d, %p\n", it->first.first, it->first.second, &comm_ptr);
-  //     return  comm_ptr;
-  //   }
-  //   else
-  //   {      
-  //     MPI_Comm return_comm;
-  //     return_comm.mpi_comm = (::MPI_Comm)(comm);
-  //     return return_comm;
-  //   }
-  // }
-  // #endif
 
 }
Index: XIOS/dev/branch_yushan/extern/src_ep_dev/ep_type.hpp
===================================================================
--- XIOS/dev/branch_yushan/extern/src_ep_dev/ep_type.hpp	(revision 1086)
+++ XIOS/dev/branch_yushan/extern/src_ep_dev/ep_type.hpp	(revision 1087)
@@ -485,4 +485,7 @@
 
   static std::map<std::pair<int, int>, MPI_Comm >  fc_comm_map;
+
+  static std::map<std::pair<int, int>, MPI_Comm >  *fc_comm_map_ptr;
+  #pragma omp threadprivate(fc_comm_map_ptr)
             //    <MPI_Fint,thread_num>   EP_Comm
 
Index: XIOS/dev/branch_yushan/src/client.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.cpp	(revision 1086)
+++ XIOS/dev/branch_yushan/src/client.cpp	(revision 1087)
@@ -17,5 +17,5 @@
     MPI_Comm CClient::intraComm ;
     MPI_Comm CClient::interComm ;
-    std::list<MPI_Comm> *CClient::contextInterComms_ptr;
+    std::list<MPI_Comm> *CClient::contextInterComms_ptr = 0;
     int CClient::serverLeader ;
     bool CClient::is_MPI_Initialized ;
@@ -177,5 +177,5 @@
       
       #pragma omp critical (_output)
-      printf("Client %d : Client::registerContext context add = %p\n", tmp_rank, &(*context));
+      printf("Client %d : client.cpp Client::registerContext context add = %p\n", tmp_rank, &(*context));
       
       
@@ -222,6 +222,4 @@
         MPI_Barrier(inter) ;
 
-        #pragma omp critical (_output)
-        printf("Client %d context=CContext::create(%s) OK, context.identifier = %d\n", getRank(), id, context->get_identifier());
         
         context->initClient(contextComm,contextInterComm) ;
@@ -230,6 +228,8 @@
         printf("Client %d : context->initClient(contextComm,contextInterComm) OK \n", getRank()) ;
         
-
+        //contextInterComms->push_back(contextInterComm);
+        if(contextInterComms_ptr == NULL) contextInterComms_ptr = new std::list<MPI_Comm>;
         contextInterComms_ptr->push_back(contextInterComm);
+        
         MPI_Comm_free(&inter);
       }
@@ -248,6 +248,8 @@
         // Finally, we should return current context to context client
         CContext::setCurrent(id);
-
+        
+        if(contextInterComms_ptr == NULL) contextInterComms_ptr = new std::list<MPI_Comm>;
         contextInterComms_ptr->push_back(contextInterComm);
+        //contextInterComms->push_back(contextInterComm);
       }
     }
Index: XIOS/dev/branch_yushan/src/client.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.hpp	(revision 1086)
+++ XIOS/dev/branch_yushan/src/client.hpp	(revision 1087)
@@ -22,5 +22,5 @@
 
         //static std::list<MPI_Comm> contextInterComms;
-        std::list<MPI_Comm> contextInterComms;
+        
         static std::list<MPI_Comm> * contextInterComms_ptr;
         #pragma omp threadprivate(contextInterComms_ptr)
Index: XIOS/dev/branch_yushan/src/group_factory.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/group_factory.hpp	(revision 1086)
+++ XIOS/dev/branch_yushan/src/group_factory.hpp	(revision 1087)
@@ -70,5 +70,5 @@
          /// PropriÃ©tÃ©s statiques ///
          static StdString CurrContext;
-         //#pragma omp threadprivate(CurrContext)
+         #pragma omp threadprivate(CurrContext)
 
    }; // class CGroupFactory
Index: XIOS/dev/branch_yushan/src/node/context.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/context.cpp	(revision 1086)
+++ XIOS/dev/branch_yushan/src/node/context.cpp	(revision 1087)
@@ -18,5 +18,6 @@
 namespace xios {
 
-  shared_ptr<CContextGroup> CContext::root;
+  //shared_ptr<CContextGroup> CContext::root;
+  shared_ptr<CContextGroup> * CContext::root_ptr = 0;
 
    /// ////////////////////// Dfinitions ////////////////////// ///
@@ -54,6 +55,12 @@
    CContextGroup* CContext::getRoot(void)
    {
-      if (root.get()==NULL) root=shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName()));
-      return root.get();
+      //if (root.get()==NULL) root=shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName()));
+      //return root.get();
+
+      //static shared_ptr<CContextGroup> *root_ptr;
+      if(root_ptr == 0) //root_ptr = new shared_ptr<CContextGroup>;
+      // if (root_ptr->get()==NULL) 
+      root_ptr = new shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName()));
+      return root_ptr->get();
    }
 
@@ -243,8 +250,10 @@
      client = new CContextClient(this, intraComm, interComm, cxtServer);
 
-
      int tmp_rank;
      MPI_Comm_rank(intraComm, &tmp_rank);
      MPI_Barrier(intraComm);
+
+     #pragma omp critical (_output)
+     printf("Client %d : context.cpp client = new CContextClient, client add = %p, clientRank = %d\n", tmp_rank, &(*client), client->clientRank) ;
      
      #pragma omp critical
@@ -255,6 +264,5 @@
      
      #pragma omp critical (_output)
-     printf("Client %d : registryIn->setPath(getId()=%s), clientRank = %d (%p) \n", tmp_rank, getId(), client->clientRank, &(client->clientRank)) ;
-     printf("Client %d : context.identifier = %d\n", tmp_rank, this->get_identifier());
+     printf("Client %d : context.cpp registryIn->setPath, client add = %p, clientRank = %d\n", tmp_rank, &(*client), client->clientRank) ;
 
      if (client->clientRank==0) registryIn->fromFile("xios_registry.bin") ;
@@ -264,6 +272,4 @@
      registryOut->setPath(getId()) ;
      
-     #pragma omp critical (_output)
-     printf("Client %d : registryOut->setPath(getId()=%s) \n", tmp_rank, getId()) ;
 
      ep_lib::MPI_Comm intraCommServer, interCommServer;
@@ -1203,5 +1209,6 @@
     CContext* context = CObjectFactory::CreateObject<CContext>(id).get();
     getRoot();
-    if (!hasctxt) CGroupFactory::AddChild(root, context->getShared());
+    //if (!hasctxt) CGroupFactory::AddChild(root, context->getShared());
+    if (!hasctxt) CGroupFactory::AddChild(*root_ptr, context->getShared());
 
 #define DECLARE_NODE(Name_, name_) \
@@ -1213,8 +1220,4 @@
   }
 
-  int CContext::get_identifier()
-  {
-    return this->identifier;
-  }
 
 
Index: XIOS/dev/branch_yushan/src/node/context.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/context.hpp	(revision 1086)
+++ XIOS/dev/branch_yushan/src/node/context.hpp	(revision 1087)
@@ -208,6 +208,8 @@
 
          // Context root
-         static shared_ptr<CContextGroup> root;
-         // #pragma omp threadprivate(root)
+         //static shared_ptr<CContextGroup> root;
+
+         static shared_ptr<CContextGroup> *root_ptr;
+         #pragma omp threadprivate(root_ptr)
 
          // Determine context on client or not
@@ -235,8 +237,5 @@
          std::list<ep_lib::MPI_Comm> comms; //!< Communicators allocated internally
 
-         int identifier;
-
       public: // Some function maybe removed in the near future
-         int get_identifier();
         // virtual void toBinary  (StdOStream & os) const;
         // virtual void fromBinary(StdIStream & is);
Index: XIOS/dev/branch_yushan/src/object_factory.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/object_factory.hpp	(revision 1086)
+++ XIOS/dev/branch_yushan/src/object_factory.hpp	(revision 1087)
@@ -60,5 +60,5 @@
          /// PropriÃ©tÃ©s statiques ///
          static StdString CurrContext;
-         //#pragma omp threadprivate(CurrContext)
+         #pragma omp threadprivate(CurrContext)
 
    }; // class CObjectFactory
Index: XIOS/dev/branch_yushan/src/object_factory_impl.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/object_factory_impl.hpp	(revision 1086)
+++ XIOS/dev/branch_yushan/src/object_factory_impl.hpp	(revision 1087)
@@ -13,5 +13,9 @@
          ERROR("CObjectFactory::GetObjectNum(void)",
                << "please define current context id !");
-      return (U::AllVectObj[CObjectFactory::CurrContext].size());
+
+      if(U::AllVectObj == NULL) return 0;
+      
+      
+      return (*U::AllVectObj)[CObjectFactory::CurrContext].size();
    }
 
@@ -22,5 +26,9 @@
          ERROR("CObjectFactory::GetObjectIdNum(void)",
                << "please define current context id !");
-      return (U::AllMapObj[CObjectFactory::CurrContext].size());
+      if(U::AllMapObj  == NULL) return 0;
+
+      
+
+      return (* U::AllMapObj) [CObjectFactory::CurrContext].size();
    }
 
@@ -31,6 +39,11 @@
          ERROR("CObjectFactory::HasObject(const StdString & id)",
                << "[ id = " << id << " ] please define current context id !");
-      return (U::AllMapObj[CObjectFactory::CurrContext].find(id) !=
-              U::AllMapObj[CObjectFactory::CurrContext].end());
+      
+      if(U::AllMapObj  == NULL)  return false;
+
+      
+
+      return ((*U::AllMapObj)[CObjectFactory::CurrContext].find(id) !=
+              (*U::AllMapObj)[CObjectFactory::CurrContext].end());
    }
 
@@ -38,6 +51,13 @@
       bool CObjectFactory::HasObject(const StdString & context, const StdString & id)
    {
-      if (U::AllMapObj.find(context) == U::AllMapObj.end()) return false ;
-      else return (U::AllMapObj[context].find(id) !=  U::AllMapObj[context].end());
+      if(U::AllMapObj  == NULL) return false;
+
+      if (U::AllMapObj->find(context) == U::AllMapObj->end()) return false ;
+
+      else
+      {
+         return ((*U::AllMapObj)[context].find(id) !=  (*U::AllMapObj)[context].end());
+      } 
+         
    }
 
@@ -45,9 +65,11 @@
       boost::shared_ptr<U> CObjectFactory::GetObject(const U * const object)
    {
+      if(U::AllVectObj == NULL) return (boost::shared_ptr<U>());
+   
       if (CurrContext.size() == 0)
          ERROR("CObjectFactory::GetObject(const U * const object)",
                << "please define current context id !");
       std::vector<boost::shared_ptr<U> > & vect =
-                     U::AllVectObj[CObjectFactory::CurrContext];
+                     (*U::AllVectObj)[CObjectFactory::CurrContext];
 
       typename std::vector<boost::shared_ptr<U> >::const_iterator
@@ -70,4 +92,6 @@
       boost::shared_ptr<U> CObjectFactory::GetObject(const StdString & id)
    {
+      if(U::AllMapObj  == NULL) return (boost::shared_ptr<U>());
+
       if (CurrContext.size() == 0)
          ERROR("CObjectFactory::GetObject(const StdString & id)",
@@ -77,5 +101,5 @@
                << "[ id = " << id << ", U = " << U::GetName() << " ] "
                << "object was not found.");
-      return (U::AllMapObj[CObjectFactory::CurrContext][id]);
+      return (*U::AllMapObj)[CObjectFactory::CurrContext][id];
    }
 
@@ -83,9 +107,12 @@
       boost::shared_ptr<U> CObjectFactory::GetObject(const StdString & context, const StdString & id)
    {
+      if(U::AllMapObj  == NULL) return (boost::shared_ptr<U>());
+
       if (!CObjectFactory::HasObject<U>(context,id))
          ERROR("CObjectFactory::GetObject(const StdString & id)",
                << "[ id = " << id << ", U = " << U::GetName() <<", context = "<<context<< " ] "
                << "object was not found.");
-      return (U::AllMapObj[context][id]);
+
+      return (*U::AllMapObj)[context][id];
    }
 
@@ -93,4 +120,7 @@
    boost::shared_ptr<U> CObjectFactory::CreateObject(const StdString& id)
    {
+      if(U::AllVectObj == NULL) U::AllVectObj = new xios_map<StdString, std::vector<boost::shared_ptr<U> > >;
+      if(U::AllMapObj  == NULL) U::AllMapObj  = new xios_map<StdString, xios_map<StdString, boost::shared_ptr<U> > >;
+      
       if (CurrContext.empty())
          ERROR("CObjectFactory::CreateObject(const StdString& id)",
@@ -105,6 +135,6 @@
          boost::shared_ptr<U> value(new U(id.empty() ? CObjectFactory::GenUId<U>() : id));
 
-         U::AllVectObj[CObjectFactory::CurrContext].insert(U::AllVectObj[CObjectFactory::CurrContext].end(), value);
-         U::AllMapObj[CObjectFactory::CurrContext].insert(std::make_pair(value->getId(), value));
+         (* U::AllVectObj)[CObjectFactory::CurrContext].insert((*U::AllVectObj)[CObjectFactory::CurrContext].end(), value);
+         (* U::AllMapObj) [CObjectFactory::CurrContext].insert(std::make_pair(value->getId(), value));
 
          return value;
@@ -116,5 +146,8 @@
          CObjectFactory::GetObjectVector(const StdString & context)
    {
-      return (U::AllVectObj[context]);
+      if(U::AllVectObj != NULL) 
+      
+
+      return (*U::AllVectObj)[context];
    }
 
@@ -130,5 +163,6 @@
    {
       StdOStringStream oss;
-      oss << GetUIdBase<U>() << U::GenId[CObjectFactory::CurrContext]++;
+      if(U::GenId == NULL) U::GenId = new xios_map< StdString, long int >;
+      oss << GetUIdBase<U>() << (*U::GenId)[CObjectFactory::CurrContext]++;
       return oss.str();
    }
Index: XIOS/dev/branch_yushan/src/object_template.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/object_template.hpp	(revision 1086)
+++ XIOS/dev/branch_yushan/src/object_template.hpp	(revision 1087)
@@ -98,11 +98,11 @@
          /// PropriÃ©tÃ©s statiques ///
          // bkp
-         static xios_map<StdString,
-                xios_map<StdString,
-                boost::shared_ptr<DerivedType> > > AllMapObj;
-         static xios_map<StdString,
-                std::vector<boost::shared_ptr<DerivedType> > > AllVectObj;
+         // static xios_map<StdString,
+         //        xios_map<StdString,
+         //        boost::shared_ptr<DerivedType> > > AllMapObj;
+         // static xios_map<StdString,
+         //        std::vector<boost::shared_ptr<DerivedType> > > AllVectObj;
 
-         static xios_map< StdString, long int > GenId ;
+         // static xios_map< StdString, long int > GenId ;
 
          // xios_map<StdString, xios_map<StdString, boost::shared_ptr<DerivedType> > > AllMapObj;
@@ -110,10 +110,9 @@
          // xios_map< StdString, long int > GenId ;
 
-         // static xios_map<StdString, xios_map<StdString, boost::shared_ptr<DerivedType> > > *AllMapObj_ptr;
-         // static xios_map<StdString, std::vector<boost::shared_ptr<DerivedType> > > *AllVectObj_ptr;
-         // static xios_map< StdString, long int > *GenId_ptr ;
+         static xios_map<StdString, xios_map<StdString, boost::shared_ptr<DerivedType> > > *AllMapObj;
+         static xios_map<StdString, std::vector<boost::shared_ptr<DerivedType> > > *AllVectObj;
+         static xios_map< StdString, long int > *GenId;
 
-         // #pragma omp threadprivate(AllMapObj_ptr, AllVectObj_ptr, GenId_ptr)
-
+         #pragma omp threadprivate(AllMapObj, AllVectObj, GenId)
 
    }; // class CObjectTemplate
Index: XIOS/dev/branch_yushan/src/object_template_impl.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/object_template_impl.hpp	(revision 1086)
+++ XIOS/dev/branch_yushan/src/object_template_impl.hpp	(revision 1087)
@@ -24,12 +24,12 @@
       xios_map<StdString,
       xios_map<StdString,
-      boost::shared_ptr<T> > > CObjectTemplate<T>::AllMapObj;
+      boost::shared_ptr<T> > > *CObjectTemplate<T>::AllMapObj = 0;
 
    template <class T>
       xios_map<StdString,
-      std::vector<boost::shared_ptr<T> > > CObjectTemplate<T>::AllVectObj;
-
-   template <class T>
-      xios_map<StdString,long int> CObjectTemplate<T>::GenId;
+      std::vector<boost::shared_ptr<T> > > *CObjectTemplate<T>::AllVectObj = 0;
+
+   template <class T>
+      xios_map<StdString,long int> *CObjectTemplate<T>::GenId = 0;
 
    template <class T>
@@ -66,5 +66,5 @@
          CObjectTemplate<T>::GetAllVectobject(const StdString & contextId)
    {
-      return (CObjectTemplate<T>::AllVectObj[contextId]);
+      return (CObjectTemplate<T>::AllVectObj->at(contextId));
    }
 
Index: XIOS/dev/branch_yushan/src/test/test_omp.f90
===================================================================
--- XIOS/dev/branch_yushan/src/test/test_omp.f90	(revision 1086)
+++ XIOS/dev/branch_yushan/src/test/test_omp.f90	(revision 1087)
@@ -88,11 +88,25 @@
     print*, "xios_context_initialize OK", rank, size
 
+!     CALL xios_get_handle("test",ctx_hdl)
+!     CALL xios_set_current_context(ctx_hdl)
+  
+  
+!     CALL xios_get_calendar_type(calendar_type)
+!     print*, "xios_get_calendar_type OK", rank, size
+
+!     CALL xios_set_axis_attr("axis_A",n_glo=llm ,value=lval) ;
+!     CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj,type='curvilinear')
+!     CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4)
+!     CALL xios_set_domain_attr("domain_A",lonvalue_2D=lon,latvalue_2D=lat)
+!     CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.)
+!     print*, "test block OK", rank, size
+
     CALL xios_context_finalize()
     print*, "xios_context_finalize OK", rank, size
 
-     !$omp master
-     call MPI_Barrier(comm)
-     CALL MPI_COMM_FREE(comm, ierr)
-     !$omp end master
+    !$omp master
+    call MPI_Barrier(comm)
+    CALL MPI_COMM_FREE(comm, ierr)
+    !$omp end master
 
      !$omp barrier
