Index: XIOS3/trunk/src/node/context.hpp
===================================================================
--- XIOS3/trunk/src/node/context.hpp	(revision 2407)
+++ XIOS3/trunk/src/node/context.hpp	(revision 2458)
@@ -103,11 +103,5 @@
          
          void initServer(MPI_Comm intraComm, int serviceType );
-         void createClientInterComm(MPI_Comm interCommClient, MPI_Comm interCommServer)  ;
- 
-         void createServerInterComm(void)  ;
-         void createServerInterComm_old(void)  ;
-         void createServerInterComm(const string& poolId, const string& serverId, vector<pair<string, pair<CContextClient*,CContextServer*>>>& clientServers ) ;
- 
-
+         
          bool isInitialized(void);
 
@@ -123,5 +117,4 @@
 
          bool isFinalized(void);
-
          void closeDefinition(void);
 
@@ -159,8 +152,9 @@
 
          // Distribute files (in write mode) among secondary-server pools according to the estimated data flux
-         void distributeFiles(const std::vector<CFile*>& files);
-         void distributeFileOverOne(const vector<CFile*>& files) ; //!< Distribute files over one single server (no distribution)
-         void distributeFileOverBandwith(const std::vector<CFile*>& files) ; //!< Distribute files overs servers to balance the I/O bandwith
-         void distributeFileOverMemoryBandwith(const std::vector<CFile*>& files) ; //!< Distribute files overs servers to minimize the memory consumption
+         void distributeFiles(const vector<CFile*>& files) ;
+         void distributeFilesOnSameService(const vector<CFile*>& files, const string& poolId, const string& serviceId) ;
+         void distributeFileOverOne(const vector<CFile*>& files, const string& poolId, const string& serviceId) ; //!< Distribute files over one single server (no distribution)
+         void distributeFileOverBandwith(const std::vector<CFile*>& files, const string& poolId, const string& serviceId) ; //!< Distribute files overs servers to balance the I/O bandwith
+         void distributeFileOverMemoryBandwith(const std::vector<CFile*>& files, const string& poolId, const string& serviceId) ; //!< Distribute files overs servers to minimize the memory consumption
          
        public:
@@ -271,8 +265,5 @@
          bool setProcessingEvent(void) {isProcessingEvent_=true ;}
          bool unsetProcessingEvent(void) {isProcessingEvent_=false ;}
-         MPI_Comm getIntraComm(void) {return intraComm_ ;}
-         int getIntraCommRank(void) {return intraCommRank_;}
-         int getIntraCommSize(void) {return intraCommSize_;}
-
+         
          void addCouplingChanel(const std::string& contextId, bool out) ;
 
@@ -310,7 +301,15 @@
 
       private:
-        std::string defaultReaderId ;
-        std::string defaultWriterId ;
-        std::string defaultGathererId ;
+        std::string defaultPoolWriterId_ ;
+        std::string defaultPoolReaderId_ ;
+        std::string defaultPoolGathererId_ ;
+        std::string defaultWriterId_ ;
+        std::string defaultReaderId_ ;
+        std::string defaultGathererId_ ;
+        bool defaultUsingServer2_ ;
+        void setDefaultServices(void) ;
+
+
+        std::map<std::pair<string,string>,std::vector<pair<CContextClient*,CContextServer*>>> serversMap_ ;
 
         std::vector<CContextClient*> writerClientOut_ ;
@@ -342,11 +341,19 @@
         std::map<std::string, CContextServer*> couplerInServer_ ;
       public:
+         void createClientInterComm(MPI_Comm interCommClient, MPI_Comm interCommServer)  ;
+         void createServerInterComm(void)  ; // obsolete
+         void createServerInterComm_old(void)  ;
+         void createServerInterComm(const string& poolId, const string& serverId, vector<pair<string, pair<CContextClient*,CContextServer*>>>& clientServers ) ;
+         void getServerInterComm(const string& poolId, const string& serviceId,  vector<pair<CContextClient*,CContextServer*>>& clientServers) ;
+         vector<CContextClient*> getContextClient(const string& poolId, const string& serviceId) ;
          CContextClient* getCouplerInClient(const string& contextId) { return couplerInClient_[contextId] ;}
          CContextServer* getCouplerInServer(const string& contextId) { return couplerInServer_[contextId] ;}
          CContextClient* getCouplerOutClient(const string& contextId) { return couplerOutClient_[contextId] ;}
          CContextServer* getCouplerOutServer(const string& contextId) { return couplerOutServer_[contextId] ;}
-
-         CRegistry* registryIn=nullptr ;    //!< input registry which is read from file
-         CRegistry* registryOut=nullptr ;   //!< output registry which will be written into file at the finalize
+       
+       public: // must be privatize using accessors
+        
+        CRegistry* registryIn=nullptr ;    //!< input registry which is read from file
+        CRegistry* registryOut=nullptr ;   //!< output registry which will be written into file at the finalize
 
 
@@ -354,5 +361,8 @@
         int intraCommRank_ ; //! context intra communicator rank
         int intraCommSize_ ; //! context intra communicator size
-        
+       public: 
+        MPI_Comm getIntraComm(void) {return intraComm_ ;}
+        int getIntraCommRank(void) {return intraCommRank_;}
+        int getIntraCommSize(void) {return intraCommSize_;}
       private:
          shared_ptr<CEventScheduler> eventScheduler_ ; //! The local event scheduler for context
