Ignore:
Timestamp:
01/20/20 17:55:12 (21 months ago)
Author:
ymipsl
Message:

Coupling branch : replace hasServer and hasClient combination by the name of correct service : CLIENT, GATHERER or OUT_SERVER.

YM

File:
1 edited

Legend:

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

    r1847 r1853  
    143143  CATCH 
    144144 
    145   void CField::sendUpdateData(const CArray<double,1>& data) 
     145  void CField::sendUpdateData(const CArray<double,1>& data, CContextClient* client) 
    146146  TRY 
    147147  { 
    148148    CTimer::get("Field : send data").resume(); 
    149  
    150     CContext* context = CContext::getCurrent(); 
    151     CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); 
    152149    int receiverSize = client->serverSize; 
    153150 
     
    319316    \param [in] tsDataRequested timestamp when the call is made 
    320317  */ 
    321   bool CField::sendReadDataRequest(const CDate& tsDataRequested) 
     318  bool CField::sendReadDataRequest(const CDate& tsDataRequested, CContextClient* client) 
    322319  TRY 
    323320  { 
    324321    CContext* context = CContext::getCurrent(); 
    325     // CContextClient* client = context->client; 
    326  
    327     // This code is for future: If we want to read file with level-2 servers 
    328     CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); 
    329322 
    330323    lastDataRequestedFromServer = tsDataRequested; 
     
    372365      info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ; 
    373366 
    374       dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + file->output_freq); 
     367      dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + file->output_freq, file->getContextClient()); 
    375368    } 
    376369 
     
    385378    StdString fieldId; 
    386379    *buffer >> fieldId; 
    387     get(fieldId)->recvReadDataRequest(); 
     380    get(fieldId)->recvReadDataRequest(event.getContextServer()); 
    388381  } 
    389382  CATCH 
     
    395388    In the future, this should (only) be done by the last level servers. 
    396389  */ 
    397   void CField::recvReadDataRequest(void) 
     390  void CField::recvReadDataRequest(CContextServer* server) 
    398391  TRY 
    399392  { 
    400     CContext* context = CContext::getCurrent(); 
    401     CContextClient* client = context->client; 
    402  
     393    CContextClient* client = server->getAssociatedClient() ; 
    403394    CEventClient event(getType(), EVENT_ID_READ_DATA_READY); 
    404395    std::list<CMessage> msgs; 
     
    532523    if (!nstepMaxRead) 
    533524    { 
    534        MPI_Allreduce(MPI_IN_PLACE, &nstepMax, 1, MPI_INT, MPI_MAX, context->server->intraComm); 
     525       MPI_Allreduce(MPI_IN_PLACE, &nstepMax, 1, MPI_INT, MPI_MAX, context->intraComm_); 
    535526       nstepMaxRead = true; 
    536527    } 
     
    809800   { 
    810801     CContext* context = CContext::getCurrent(); 
    811      if (context->hasClient && !context->hasServer) 
     802     if (context->getServiceType()==CServicesManager::CLIENT) 
    812803     { 
    813804       if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) 
     
    826817   { 
    827818     CContext* context = CContext::getCurrent(); 
    828      if (context->hasClient && !context->hasServer) 
     819     if (context->getServiceType()==CServicesManager::CLIENT) 
    829820     { 
    830821       std::map<CGrid*,std::pair<bool,StdString> >& gridSrcMap = grid->getTransGridSource(); 
     
    913904   { 
    914905     CContext* context = CContext::getCurrent(); 
    915      bool hasClient = context->hasClient; 
    916      bool hasServer = context->hasServer; 
    917906 
    918907     if (!isReferenceSolvedAndTransformed) 
     
    920909        isReferenceSolvedAndTransformed = true; 
    921910 
    922         if (hasClient && !hasServer) 
     911        if (context->getServiceType()==CServicesManager::CLIENT) 
    923912        { 
    924913          solveRefInheritance(true); 
     
    926915        } 
    927916 
    928         if (hasServer) 
     917        if (context->getServiceType()==CServicesManager::GATHERER || context->getServiceType()==CServicesManager::OUT_SERVER) 
    929918          solveServerOperation(); 
    930919 
    931920        solveGridReference(); 
    932921 
    933         if (hasClient && !hasServer) 
     922       if (context->getServiceType()==CServicesManager::CLIENT) 
    934923       { 
    935924         solveGenerateGrid(); 
     
    939928       solveGridDomainAxisRef(false); 
    940929 
    941        if (hasClient && !hasServer) 
     930       if (context->getServiceType()==CServicesManager::CLIENT) 
    942931       { 
    943932         solveTransformedGrid(); 
     
    984973        isReferenceSolved = true; 
    985974 
    986         if (context->hasClient && !context->hasServer) 
     975        if (context->getServiceType()==CServicesManager::CLIENT) 
    987976        { 
    988977          solveRefInheritance(true); 
     
    990979        } 
    991980 
    992         if (context->hasServer) 
     981        if (context->getServiceType()==CServicesManager::GATHERER || context->getServiceType()==CServicesManager::OUT_SERVER) 
    993982          solveServerOperation(); 
    994983 
     
    996985        grid->solveDomainAxisRefInheritance(true); // make it again to solve grid reading from file 
    997986 
    998         if (context->hasClient && !context->hasServer) 
     987       if (context->getServiceType()==CServicesManager::CLIENT) 
    999988       { 
    1000989         solveGenerateGrid(); 
     
    10151004        areAllReferenceSolved = true; 
    10161005        
    1017         if (context->hasClient && !context->hasServer) 
     1006        if (context->getServiceType()==CServicesManager::CLIENT) 
    10181007        { 
    10191008          solveRefInheritance(true); 
    10201009          if (hasDirectFieldReference()) getDirectFieldReference()->solveAllReferenceEnabledField(false); 
    10211010        } 
    1022         else if (context->hasServer) 
     1011        else if (context->getServiceType()==CServicesManager::GATHERER || context->getServiceType()==CServicesManager::OUT_SERVER) 
    10231012          solveServerOperation(); 
    10241013 
     
    10281017     solveGridDomainAxisRef(doSending2Server); 
    10291018 
    1030      if (context->hasClient && !context->hasServer) 
     1019     if (context->getServiceType()==CServicesManager::CLIENT) 
    10311020     { 
    10321021       solveTransformedGrid(); 
     
    10651054      CContext* context = CContext::getCurrent(); 
    10661055 
    1067       if (!context->hasServer || !hasOutputFile) return; 
     1056      if (context->getServiceType()==CServicesManager::CLIENT || !hasOutputFile) return; 
    10681057 
    10691058      if (freq_op.isEmpty()) 
     
    11261115 
    11271116     CContext* context = CContext::getCurrent(); 
    1128      bool hasWriterServer = context->hasServer && !context->hasClient; 
    1129      bool hasIntermediateServer = context->hasServer && context->hasClient; 
     1117     bool hasWriterServer = context->getServiceType()==CServicesManager::OUT_SERVER ; 
     1118     bool hasIntermediateServer = context->getServiceType()==CServicesManager::GATHERER ; 
    11301119 
    11311120     if (hasWriterServer) 
     
    11551144         if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 
    11561145         { 
    1157            fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
     1146           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, file->getContextClient())); 
    11581147           instantDataFilter->connectOutput(fileWriterFilter, 0); 
    11591148         } 
     
    12171206         if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 
    12181207         { 
    1219            fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
     1208           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, file->getContextClient())); 
    12201209           getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 
    12211210         } 
     
    17361725     CContext* context = CContext::getCurrent(); 
    17371726     client = contextClient; 
    1738      if (context->hasClient) 
    1739      { 
    1740        // A grid is sent by a client (both for read or write) or by primary server (write only) 
    1741        if (context->hasServer) 
    1742        { 
    1743          if (file->mode.isEmpty() || (!file->mode.isEmpty() && file->mode == CFile::mode_attr::write)) 
    1744            grid->setContextClient(contextClient); 
    1745        } 
    1746        else 
    1747            grid->setContextClient(contextClient); 
    1748      } 
     1727   
     1728     // A grid is sent by a client (both for read or write) or by primary server (write only) 
     1729     if (context->getServiceType()==CServicesManager::GATHERER) 
     1730     { 
     1731       if (file->mode.isEmpty() || (!file->mode.isEmpty() && file->mode == CFile::mode_attr::write)) 
     1732         grid->setContextClient(contextClient); 
     1733     } 
     1734     else if (context->getServiceType()==CServicesManager::CLIENT) 
     1735       grid->setContextClient(contextClient); 
    17491736   } 
    17501737   CATCH_DUMP_ATTR 
Note: See TracChangeset for help on using the changeset viewer.