Ignore:
Timestamp:
05/12/20 11:52:13 (4 years ago)
Author:
ymipsl
Message:

XIOS coupling branch
Some updates.

First coupling test is beginning to work...

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp

    r1872 r1875  
    708708    } 
    709709 
    710     for (auto it=couplerClient_.begin(); it!=couplerClient_.end(); ++it) 
    711     { 
    712       if (!finalized) it->second->checkBuffers(); 
    713     } 
    714  
    715     for (auto it=couplerServer_.begin(); it!=couplerServer_.end(); ++it) 
    716     { 
    717       if (!finalized) it->second->eventLoop(enableEventsProcessing); 
    718     } 
    719  
     710    for (auto couplerOut : couplerOutClient_) 
     711      if (!finalized) couplerOut.second->checkBuffers(); 
     712     
     713    for (auto couplerIn : couplerInClient_) 
     714      if (!finalized) couplerIn.second->checkBuffers(); 
     715     
     716    for (auto couplerOut : couplerOutServer_) 
     717      if (!finalized) couplerOut.second->eventLoop(enableEventsProcessing); 
     718 
     719    for (auto couplerIn : couplerInServer_) 
     720      if (!finalized) couplerIn.second->eventLoop(enableEventsProcessing); 
     721     
    720722    if (server!=nullptr) if (!finalized) finished &= server->eventLoop(enableEventsProcessing); 
    721723   
     
    723725  } 
    724726 
    725   void CContext::addCouplingChanel(const std::string& context, bool out) 
     727  void CContext::addCouplingChanel(const std::string& fullContextId, bool out) 
    726728  { 
    727      vector<string> vectStr=splitRegex(context,"::") ; 
    728      string poolId=vectStr[0] ; 
    729      string serviceId=poolId ; 
    730      string contextId=vectStr[1] ; 
    731  
    732729     int contextLeader ; 
    733      int type = CServicesManager::CLIENT ; 
    734      string contextName=CXios::getContextsManager()->getServerContextName(poolId, serviceId, 0, type, contextId) ; 
    735730      
    736      if (couplerClient_.find(contextName)==couplerClient_.end()) 
    737      { 
    738        bool ok=CXios::getContextsManager()->getContextLeader(contextName, contextLeader, getIntraComm()) ; 
     731     if (out) 
     732     {  
     733       if (couplerOutClient_.find(fullContextId)==couplerOutClient_.end())  
     734       { 
     735         bool ok=CXios::getContextsManager()->getContextLeader(fullContextId, contextLeader, getIntraComm()) ; 
    739736      
    740        MPI_Comm interComm, interCommClient, interCommServer  ; 
    741        MPI_Comm intraCommClient, intraCommServer ; 
    742  
    743        if (ok) MPI_Intercomm_create(getIntraComm(), 0, CXios::getXiosComm(), contextLeader, 0, &interComm) ; 
    744  
    745        MPI_Comm_dup(intraComm_, &intraCommClient) ; 
    746        MPI_Comm_dup(intraComm_, &intraCommServer) ; 
    747        if (out) 
    748        { 
    749          MPI_Comm_dup(interComm, &interCommClient) ; 
    750          MPI_Comm_dup(interComm, &interCommServer) ; 
    751          CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); 
    752          CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); 
    753          client->setAssociatedServer(server) ; 
    754          server->setAssociatedClient(client) ; 
    755        } 
    756        else 
    757        { 
    758           MPI_Comm_dup(interComm, &interCommServer) ; 
    759           MPI_Comm_dup(interComm, &interCommClient) ; 
    760           CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); 
    761           CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); 
    762           client->setAssociatedServer(server) ; 
    763           server->setAssociatedClient(client) ; 
    764        } 
    765        MPI_Comm_free(&interComm) ; 
    766  
    767  
     737         MPI_Comm interComm, interCommClient, interCommServer  ; 
     738         MPI_Comm intraCommClient, intraCommServer ; 
     739 
     740         if (ok) MPI_Intercomm_create(getIntraComm(), 0, CXios::getXiosComm(), contextLeader, 0, &interComm) ; 
     741 
     742        MPI_Comm_dup(intraComm_, &intraCommClient) ; 
     743        MPI_Comm_dup(intraComm_, &intraCommServer) ; 
     744        MPI_Comm_dup(interComm, &interCommClient) ; 
     745        MPI_Comm_dup(interComm, &interCommServer) ; 
     746        CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); 
     747        CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); 
     748        client->setAssociatedServer(server) ; 
     749        server->setAssociatedClient(client) ; 
     750        MPI_Comm_free(&interComm) ; 
     751        couplerOutClient_[fullContextId] = client ; 
     752        couplerOutServer_[fullContextId] = server ; 
     753 
     754/* 
    768755      // for now, we don't now which beffer size must be used for client coupler 
    769756      // It will be evaluated later. Fix a constant size for now... 
     
    777764 
    778765       client->setBufferSize(bufferSize, maxEventSize);     
    779         
    780        couplerClient_[contextName] = client ; 
    781        couplerServer_[contextName] = server ; 
    782      } 
     766*/ 
     767      } 
     768    } 
     769    else if (couplerInClient_.find(fullContextId)==couplerInClient_.end()) 
     770    { 
     771      bool ok=CXios::getContextsManager()->getContextLeader(fullContextId, contextLeader, getIntraComm()) ; 
     772      
     773       MPI_Comm interComm, interCommClient, interCommServer  ; 
     774       MPI_Comm intraCommClient, intraCommServer ; 
     775 
     776       if (ok) MPI_Intercomm_create(getIntraComm(), 0, CXios::getXiosComm(), contextLeader, 0, &interComm) ; 
     777 
     778       MPI_Comm_dup(intraComm_, &intraCommClient) ; 
     779       MPI_Comm_dup(intraComm_, &intraCommServer) ; 
     780       MPI_Comm_dup(interComm, &interCommServer) ; 
     781       MPI_Comm_dup(interComm, &interCommClient) ; 
     782       CContextServer* server = new CContextServer(this, intraCommServer, interCommServer); 
     783       CContextClient* client = new CContextClient(this, intraCommClient, interCommClient); 
     784       client->setAssociatedServer(server) ; 
     785       server->setAssociatedClient(client) ; 
     786       MPI_Comm_free(&interComm) ; 
     787 
     788       map<int,size_t> bufferSize, maxEventSize ; 
     789       for(int i=0;i<client->getRemoteSize();i++) 
     790       { 
     791         bufferSize[i]=10000000 ; 
     792         maxEventSize[i]=10000000 ; 
     793       } 
     794 
     795       client->setBufferSize(bufferSize, maxEventSize);     
     796       couplerInClient_[fullContextId] = client ; 
     797       couplerInServer_[fullContextId] = server ;         
     798    } 
    783799  } 
    784800   
     
    798814      if (serviceType_==CServicesManager::CLIENT) 
    799815      { 
    800         doPreTimestepOperationsForEnabledReadModeFiles(); // For now we only use server level 1 to read data 
     816//ym        doPreTimestepOperationsForEnabledReadModeFiles(); // For now we only use server level 1 to read data 
     817 
     818        triggerLateFields() ; 
     819 
     820        // inform couplerIn that I am finished 
     821        for(auto& couplerInClient : couplerInClient_) sendCouplerInContextFinalized(couplerInClient.second) ; 
     822 
     823        // wait until received message from couplerOut that they have finished 
     824        bool couplersInFinalized ; 
     825        do 
     826        { 
     827          couplersInFinalized=true ; 
     828          for(auto& couplerOutClient : couplerOutClient_) couplersInFinalized &= isCouplerInContextFinalized(couplerOutClient.second) ;  
     829          globalEventLoop() ; 
     830        } while (!couplersInFinalized) ; 
    801831 
    802832        info(100)<<"DEBUG: context "<<getId()<<" Send client finalize"<<endl ; 
     
    10551085    vector<CField*>&& fileOutField = findAllEnabledFieldsInFileOut(this->enabledWriteModeFiles); 
    10561086    vector<CField*>&& fileInField = findAllEnabledFieldsInFileIn(this->enabledReadModeFiles); 
    1057     vector<CField*>&& CouplerOutField = findAllEnabledFieldsCouplerOut(this->enabledCouplerOut); 
    1058     vector<CField*>&& CouplerInField = findAllEnabledFieldsCouplerIn(this->enabledCouplerIn); 
     1087    vector<CField*>&& couplerOutField = findAllEnabledFieldsCouplerOut(this->enabledCouplerOut); 
     1088    vector<CField*>&& couplerInField = findAllEnabledFieldsCouplerIn(this->enabledCouplerIn); 
    10591089    findFieldsWithReadAccess(); 
    10601090    vector<CField*>& fieldWithReadAccess = fieldsWithReadAccess_ ; 
     
    10731103    } 
    10741104 
    1075  
    1076  
     1105     
     1106    for (auto& field : couplerInField) 
     1107    { 
     1108      field->unsetGridCompleted() ; 
     1109    } 
    10771110// find all field potentially at workflow end 
    10781111    vector<CField*> endWorkflowFields ; 
    1079     endWorkflowFields.reserve(fileOutField.size()+CouplerOutField.size()+fieldWithReadAccess.size()) ; 
     1112    endWorkflowFields.reserve(fileOutField.size()+couplerOutField.size()+fieldWithReadAccess.size()) ; 
    10801113    endWorkflowFields.insert(endWorkflowFields.end(),fileOutField.begin(), fileOutField.end()) ; 
    1081     endWorkflowFields.insert(endWorkflowFields.end(),CouplerOutField.begin(), CouplerOutField.end()) ; 
     1114    endWorkflowFields.insert(endWorkflowFields.end(),couplerOutField.begin(), couplerOutField.end()) ; 
    10821115    endWorkflowFields.insert(endWorkflowFields.end(),fieldWithReadAccess.begin(), fieldWithReadAccess.end()) ; 
    10831116 
    1084     for(auto endWorkflowField : endWorkflowFields) endWorkflowField->buildWorkflowGraph(garbageCollector) ; 
     1117    bool workflowGraphIsCompleted ; 
     1118 
     1119    bool first=true ; 
     1120    do 
     1121    { 
     1122      workflowGraphIsCompleted=true;  
     1123      for(auto endWorkflowField : endWorkflowFields)  
     1124      { 
     1125        workflowGraphIsCompleted &= endWorkflowField->buildWorkflowGraph(garbageCollector) ; 
     1126      } 
     1127 
     1128      for(auto couplerIn : enabledCouplerIn) couplerIn->assignContext() ; 
     1129      for(auto field : couplerInField) field->makeGridAliasForCoupling(); 
     1130      for(auto field : couplerInField) this->sendCouplerInReady(field->getContextClient()) ; 
    10851131     
     1132 
     1133      // assign context to coupler out and related fields 
     1134      for(auto couplerOut : enabledCouplerOut) couplerOut->assignContext() ; 
     1135      // for now supose that all coupling out endpoint are succesfull. The difficultie is client/server buffer evaluation 
     1136      for(auto field : couplerOutField)  
     1137      { 
     1138        field->computeGridIndexToFileServer() ; // same kind of index than for file server -> in future distribution may change 
     1139      } 
     1140      if (first) setClientServerBuffer(couplerOutField, true) ; // set buffer context 
     1141 
     1142      bool couplersReady ; 
     1143      do  
     1144      { 
     1145        couplersReady=true ; 
     1146        for(auto field : couplerOutField) 
     1147        { 
     1148          bool ready = isCouplerInReady(field->getContextClient()) ;  
     1149          if (ready) field->sendFieldToCouplerOut() ; 
     1150          couplersReady &= ready ; 
     1151        } 
     1152        if (!couplersReady) this->eventLoop() ; 
     1153      } while (!couplersReady) ; 
     1154 
     1155      first=false ; 
     1156      this->eventLoop() ; 
     1157    } while (!workflowGraphIsCompleted) ; 
     1158 
     1159    for( auto field : couplerInField) couplerInFields_.push_back(field) ; 
     1160 
    10861161    // get all field coming potentially from model 
    10871162    for (auto field : CField::getAll() ) if (field->getModelIn()) fieldModelIn.push_back(field) ; 
     
    11011176        field->computeGridIndexToFileServer() ; // compute grid index for transfer to the server context 
    11021177      } 
    1103       setClientServerBuffer(fileOutField, true) ; // set context 
     1178      setClientServerBuffer(fileOutField, true) ; // set buffer context 
    11041179      for(auto field : fileOutField) field->sendFieldToFileServer() ; 
    11051180    } 
     
    11461221    } 
    11471222 
     1223     
     1224    for(auto field : couplerInField)  
     1225    { 
     1226      field->connectToCouplerIn(garbageCollector) ; // connect the field to server filter 
     1227    } 
     1228     
     1229     
     1230    for(auto field : couplerOutField)  
     1231    { 
     1232      field->connectToCouplerOut(garbageCollector) ; // for now the same kind of filter that for file server 
     1233    } 
     1234 
    11481235     // workflow startpoint => data from server on client side 
    11491236    if (serviceType_==CServicesManager::CLIENT) 
     
    11511238      for(auto field : fileInField)  
    11521239      { 
    1153         field->connectToServerInput(garbageCollector) ; // connect the field to server filter 
     1240        field->connectToServerInput(garbageCollector) ; // connect tFhe field to server filter 
    11541241        field->computeGridIndexToFileServer() ; // compute grid index for transfer to the server context 
    11551242        field->sendFieldToInputFileServer() ; 
     
    11621249      // no filter for reading data from file => to be implemented 
    11631250    } 
    1164  
    1165  
    1166     if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER) this->sendCloseDefinition(); 
     1251     
     1252    // construct slave server list 
     1253    if (serviceType_==CServicesManager::CLIENT || serviceType_==CServicesManager::GATHERER)  
     1254    { 
     1255      for(auto field : fileOutField) slaveServers_.insert(field->getContextClient()) ;  
     1256      for(auto field : fileInField)  slaveServers_.insert(field->getContextClient()) ;   
     1257    } 
     1258 
     1259    for(auto& slaveServer : slaveServers_) sendCloseDefinition(slaveServer) ; 
     1260 
    11671261    if (serviceType_==CServicesManager::IO_SERVER || serviceType_==CServicesManager::OUT_SERVER)   
    11681262    { 
     
    11721266    if (serviceType_==CServicesManager::CLIENT) startPrefetchingOfEnabledReadModeFiles(); 
    11731267    
    1174  
    1175  
     1268    // send signal to couplerIn context that definition phasis is done 
     1269 
     1270    for(auto& couplerInClient : couplerInClient_) sendCouplerInCloseDefinition(couplerInClient.second) ; 
     1271 
     1272    // wait until all couplerIn signal that closeDefition is done. 
     1273    bool ok; 
     1274    do 
     1275    { 
     1276      ok = true ; 
     1277      for(auto& couplerOutClient : couplerOutClient_) ok &= isCouplerInCloseDefinition(couplerOutClient.second) ; 
     1278      this->eventLoop() ;  
     1279    } while (!ok) ; 
    11761280 
    11771281    return ; 
     1282 
     1283 
     1284 
     1285 
     1286 
     1287 
     1288 
     1289 
     1290 
     1291 
    11781292    // For now, only read files with client and only one level server 
    11791293    // if (hasClient && !hasServer) findEnabledReadModeFiles();       
     
    19872101             recvPostProcessing(event); 
    19882102             return true; 
    1989             case EVENT_ID_SEND_REGISTRY: 
     2103           case EVENT_ID_SEND_REGISTRY: 
    19902104             recvRegistry(event); 
    19912105             return true; 
    19922106             break; 
    1993             case EVENT_ID_POST_PROCESS_GLOBAL_ATTRIBUTES: 
     2107           case EVENT_ID_POST_PROCESS_GLOBAL_ATTRIBUTES: 
    19942108             recvPostProcessingGlobalAttributes(event); 
    19952109             return true; 
    19962110             break; 
    1997             case EVENT_ID_PROCESS_GRID_ENABLED_FIELDS: 
     2111           case EVENT_ID_PROCESS_GRID_ENABLED_FIELDS: 
    19982112             recvProcessingGridOfEnabledFields(event); 
    19992113             return true; 
    20002114             break; 
     2115           case EVENT_ID_COUPLER_IN_READY: 
     2116             recvCouplerInReady(event); 
     2117             return true; 
     2118             break; 
     2119           case EVENT_ID_COUPLER_IN_CLOSE_DEFINITION: 
     2120             recvCouplerInCloseDefinition(event); 
     2121             return true; 
     2122             break; 
     2123           case EVENT_ID_COUPLER_IN_CONTEXT_FINALIZED: 
     2124             recvCouplerInContextFinalized(event); 
     2125             return true; 
     2126             break;   
    20012127           default : 
    20022128             ERROR("bool CContext::dispatchEvent(CEventServer& event)", 
     
    20092135 
    20102136   //! Client side: Send a message to server to make it close 
     2137   // ym obsolete 
    20112138   void CContext::sendCloseDefinition(void) 
    20122139   TRY 
     
    20352162   } 
    20362163   CATCH_DUMP_ATTR 
     2164    
     2165   //  ! Client side: Send a message to server to make it close 
     2166   void CContext::sendCloseDefinition(CContextClient* client) 
     2167   TRY 
     2168   { 
     2169      if (sendCloseDefinition_done_.count(client)!=0) return ; 
     2170      else sendCloseDefinition_done_.insert(client) ; 
     2171 
     2172      CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION); 
     2173      if (client->isServerLeader()) 
     2174      { 
     2175        CMessage msg; 
     2176        for(auto rank : client->getRanksServerLeader()) event.push(rank,1,msg); 
     2177        client->sendEvent(event); 
     2178      } 
     2179     else client->sendEvent(event); 
     2180   } 
     2181   CATCH_DUMP_ATTR 
    20372182 
    20382183   //! Server side: Receive a message of client announcing a context close 
     
    20492194   TRY 
    20502195   { 
    2051     int nbSrvPools ; 
    2052     if (serviceType_==CServicesManager::CLIENT) nbSrvPools = 1 ; 
    2053     else if (serviceType_==CServicesManager::GATHERER) nbSrvPools = this->clientPrimServer.size() ; 
    2054     else nbSrvPools = 0 ; 
    2055     CContextClient* contextClientTmp ; 
    2056  
    2057     for (int i = 0; i < nbSrvPools; ++i) 
    2058     { 
    2059        if (serviceType_==CServicesManager::CLIENT) contextClientTmp = client ; 
    2060        else if (serviceType_==CServicesManager::GATHERER ) contextClientTmp = clientPrimServer[i] ; 
    2061        CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR); 
    2062  
    2063          if (contextClientTmp->isServerLeader()) 
    2064          { 
    2065            CMessage msg; 
    2066            msg<<step; 
    2067            const std::list<int>& ranks = contextClientTmp->getRanksServerLeader(); 
    2068            for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    2069              event.push(*itRank,1,msg); 
    2070            contextClientTmp->sendEvent(event); 
    2071          } 
    2072          else contextClientTmp->sendEvent(event); 
     2196     CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR); 
     2197     for(auto client : slaveServers_)  
     2198     { 
     2199       if (client->isServerLeader()) 
     2200       { 
     2201         CMessage msg; 
     2202         msg<<step; 
     2203         for (auto& rank : client->getRanksServerLeader() ) event.push(rank,1,msg); 
     2204         client->sendEvent(event); 
     2205       } 
     2206       else client->sendEvent(event); 
    20732207     } 
    20742208   } 
     
    25802714   CATCH_DUMP_ATTR 
    25812715 
     2716   void CContext::triggerLateFields(void) 
     2717   TRY 
     2718   { 
     2719    for(auto& field : fileInFields_) field->triggerLateField() ; 
     2720    for(auto& field : couplerInFields_) field->triggerLateField() ; 
     2721   } 
     2722   CATCH_DUMP_ATTR 
     2723 
    25822724   //! Update calendar in each time step 
    25832725   void CContext::updateCalendar(int step) 
     
    25902732        if (serviceType_==CServicesManager::CLIENT) // For now we only use server level 1 to read data 
    25912733        { 
    2592           doPreTimestepOperationsForEnabledReadModeFiles(); 
     2734          triggerLateFields(); 
    25932735        } 
    25942736 
     
    27712913  } 
    27722914  CATCH_DUMP_ATTR 
     2915 
     2916 
     2917 
     2918 
     2919 //! Client side: Send a message  announcing that context can receive grid definition from coupling 
     2920   void CContext::sendCouplerInReady(CContextClient* client) 
     2921   TRY 
     2922   { 
     2923      if (sendCouplerInReady_done_.count(client)!=0) return ; 
     2924      else sendCouplerInReady_done_.insert(client) ; 
     2925 
     2926      CEventClient event(getType(),EVENT_ID_COUPLER_IN_READY); 
     2927 
     2928      if (client->isServerLeader()) 
     2929      { 
     2930        CMessage msg; 
     2931        msg<<this->getId(); 
     2932        for (auto& rank : client->getRanksServerLeader()) event.push(rank,1,msg); 
     2933        client->sendEvent(event); 
     2934      } 
     2935      else client->sendEvent(event); 
     2936   } 
     2937   CATCH_DUMP_ATTR 
     2938 
     2939   //! Server side: Receive a message announcing that context can send grid definition for context coupling 
     2940   void CContext::recvCouplerInReady(CEventServer& event) 
     2941   TRY 
     2942   { 
     2943      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     2944      getCurrent()->recvCouplerInReady(*buffer); 
     2945   } 
     2946   CATCH 
     2947 
     2948   //! Server side: Receive a message announcing that context can send grid definition for context coupling 
     2949   void CContext::recvCouplerInReady(CBufferIn& buffer) 
     2950   TRY 
     2951   { 
     2952      string contextId ; 
     2953      buffer>>contextId; 
     2954      couplerInReady_.insert(getCouplerOutClient(contextId)) ; 
     2955   } 
     2956   CATCH_DUMP_ATTR 
     2957 
     2958 
     2959 
     2960 
     2961 
     2962 //! Client side: Send a message  announcing that a coupling context have done it closeDefinition, so data can be sent now. 
     2963   void CContext::sendCouplerInCloseDefinition(CContextClient* client) 
     2964   TRY 
     2965   { 
     2966      if (sendCouplerInCloseDefinition_done_.count(client)!=0) return ; 
     2967      else sendCouplerInCloseDefinition_done_.insert(client) ; 
     2968 
     2969      CEventClient event(getType(),EVENT_ID_COUPLER_IN_CLOSE_DEFINITION); 
     2970 
     2971      if (client->isServerLeader()) 
     2972      { 
     2973        CMessage msg; 
     2974        msg<<this->getId(); 
     2975        for (auto& rank : client->getRanksServerLeader()) event.push(rank,1,msg); 
     2976        client->sendEvent(event); 
     2977      } 
     2978      else client->sendEvent(event); 
     2979   } 
     2980   CATCH_DUMP_ATTR 
     2981 
     2982   //! Server side: Receive a message announcing that a coupling context have done it closeDefinition, so data can be sent now. 
     2983   void CContext::recvCouplerInCloseDefinition(CEventServer& event) 
     2984   TRY 
     2985   { 
     2986      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     2987      getCurrent()->recvCouplerInCloseDefinition(*buffer); 
     2988   } 
     2989   CATCH 
     2990 
     2991   //! Server side: Receive a message announcing that a coupling context have done it closeDefinition, so data can be sent now. 
     2992   void CContext::recvCouplerInCloseDefinition(CBufferIn& buffer) 
     2993   TRY 
     2994   { 
     2995      string contextId ; 
     2996      buffer>>contextId; 
     2997      couplerInCloseDefinition_.insert(getCouplerOutClient(contextId)) ; 
     2998   } 
     2999   CATCH_DUMP_ATTR 
     3000 
     3001 
     3002 
     3003 
     3004//! Client side: Send a message  announcing that a coupling context have done it contextFinalize, so it can also close it own context. 
     3005   void CContext::sendCouplerInContextFinalized(CContextClient* client) 
     3006   TRY 
     3007   { 
     3008      if (sendCouplerInContextFinalized_done_.count(client)!=0) return ; 
     3009      else sendCouplerInContextFinalized_done_.insert(client) ; 
     3010 
     3011      CEventClient event(getType(),EVENT_ID_COUPLER_IN_CONTEXT_FINALIZED); 
     3012 
     3013      if (client->isServerLeader()) 
     3014      { 
     3015        CMessage msg; 
     3016        msg<<this->getId(); 
     3017        for (auto& rank : client->getRanksServerLeader()) event.push(rank,1,msg); 
     3018        client->sendEvent(event); 
     3019      } 
     3020      else client->sendEvent(event); 
     3021   } 
     3022   CATCH_DUMP_ATTR 
     3023 
     3024   //! Server side: Receive a message announcing that a coupling context have done it contextFinalize, so it can also close it own context. 
     3025   void CContext::recvCouplerInContextFinalized(CEventServer& event) 
     3026   TRY 
     3027   { 
     3028      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     3029      getCurrent()->recvCouplerInContextFinalized(*buffer); 
     3030   } 
     3031   CATCH 
     3032 
     3033   //! Server side: Receive a message announcing that a coupling context have done it contextFinalize, so it can also close it own context. 
     3034   void CContext::recvCouplerInContextFinalized(CBufferIn& buffer) 
     3035   TRY 
     3036   { 
     3037      string contextId ; 
     3038      buffer>>contextId; 
     3039      couplerInContextFinalized_.insert(getCouplerOutClient(contextId)) ; 
     3040   } 
     3041   CATCH_DUMP_ATTR 
    27733042 
    27743043 
Note: See TracChangeset for help on using the changeset viewer.