Ignore:
Timestamp:
12/12/19 18:15:14 (5 years ago)
Author:
ymipsl
Message:
  • Preparing coupling functionalities.
  • Make some cleaner things

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/group_template_impl.hpp

    r1542 r1784  
    368368    return CGroupFactory::AddGroup<V>(this->getShared(), childGroup->getShared()) ; 
    369369  } 
    370  
    371  
    372    template <class U, class V, class W> 
    373    void CGroupTemplate<U, V, W>::sendCreateChild(const string& id) 
    374    { 
    375     CContext* context=CContext::getCurrent() ;   
    376  
    377     if (context->hasClient) 
    378     // if (!context->hasServer ) 
    379     { 
    380       // Use correct context client to send message 
    381 //      CContextClient* contextClientTmp = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client; 
    382       int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    383       for (int i = 0; i < nbSrvPools; ++i) 
    384       { 
    385          CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; 
    386  
    387          CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD) ; 
    388          if (contextClientTmp->isServerLeader()) 
    389          { 
    390            CMessage msg ; 
    391            msg<<this->getId() ; 
    392            msg<<id ; 
    393            const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    394            for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    395              event.push(*itRank,1,msg) ; 
    396            contextClientTmp->sendEvent(event) ; 
    397          } 
    398          else contextClientTmp->sendEvent(event) ; 
    399       } 
    400     } 
    401        
    402    } 
    403370 
    404371   template <class U, class V, class W> 
     
    420387   } 
    421388 
    422  
    423    template <class U, class V, class W> 
    424    void CGroupTemplate<U, V, W>::sendCreateChildGroup(const string& id) 
    425    { 
    426     CContext* context=CContext::getCurrent() ; 
    427     if (context->hasClient) 
    428     { 
    429       // Use correct context client to send message 
    430       // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    431       int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
    432       for (int i = 0; i < nbSrvPools; ++i) 
    433       { 
    434         CContextClient* contextClientTmp = (context->hasServer) ? context->clientPrimServer[i] : context->client; 
    435         CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD_GROUP) ; 
    436         if (contextClientTmp->isServerLeader()) 
    437         { 
    438           CMessage msg ; 
    439           msg<<this->getId() ; 
    440           msg<<id ; 
    441           const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    442           for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    443             event.push(*itRank,1,msg) ; 
    444           contextClientTmp->sendEvent(event) ; 
    445         } 
    446         else contextClientTmp->sendEvent(event) ; 
    447       } 
    448     } 
    449    } 
    450     
     389   template <class U, class V, class W> 
     390   void CGroupTemplate<U, V, W>::sendCreateChildGroup(const string& id, CContextClient* client) 
     391   { 
     392     CEventClient event(this->getType(),EVENT_ID_CREATE_CHILD_GROUP) ; 
     393     if (client->isServerLeader()) 
     394     { 
     395       CMessage msg ; 
     396       msg<<this->getId() ; 
     397       msg<<id ; 
     398       const std::list<int>& ranks = client->getRanksServerLeader(); 
     399       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     400         event.push(*itRank,1,msg) ; 
     401       client->sendEvent(event) ; 
     402     } 
     403     else client->sendEvent(event) ; 
     404   }    
     405 
     406 
    451407   template <class U, class V, class W> 
    452408   void CGroupTemplate<U, V, W>::recvCreateChild(CEventServer& event) 
Note: See TracChangeset for help on using the changeset viewer.