Ignore:
Timestamp:
03/28/23 16:42:11 (15 months ago)
Author:
ymipsl
Message:

First guess in supression of attached mode replaced by online reader and write filters

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/dev/XIOS_ATTACHED/src/node/context.cpp

    r2458 r2482  
    77#include "duration.hpp" 
    88 
     9#include "online_context_client.hpp" 
    910#include "legacy_context_client.hpp" 
    1011#include "legacy_context_server.hpp" 
     
    678679  vector<CContextClient*> CContext::getContextClient(const string& poolId, const string& serviceId) 
    679680  { 
    680     vector<pair<CContextClient*,CContextServer*>> clientServers ; 
    681     getServerInterComm(poolId, serviceId, clientServers ) ; 
    682     vector<CContextClient*> ret ; 
    683     for(auto& clientServer : clientServers) ret.push_back(clientServer.first) ; 
     681     vector<CContextClient*> ret ; 
     682     
     683    if (serviceId=="attached") ret.push_back(onlineContextClient_) ; 
     684    else 
     685    { 
     686      vector<pair<CContextClient*,CContextServer*>> clientServers ; 
     687      getServerInterComm(poolId, serviceId, clientServers ) ; 
     688      for(auto& clientServer : clientServers) ret.push_back(clientServer.first) ; 
     689    } 
    684690    return ret ; 
    685691  } 
     
    807813      if (serviceType_==CServicesManager::CLIENT) 
    808814      { 
    809 //ym        doPreTimestepOperationsForEnabledReadModeFiles(); // For now we only use server level 1 to read data 
    810815        triggerLateFields() ; 
    811816 
     
    985990 
    986991     CTimer::get("Context : close definition").resume() ; 
     992 
     993     onlineContextClient_=CContextClient::getNew<CContextClient::online>(this,intraComm_, intraComm_); 
    987994           
    988995     // create intercommunicator with servers.  
     
    11451152    { 
    11461153      for(auto field : fileInField)  
    1147       { 
    1148         field->sendFieldToInputFileServer() ; 
    1149         field->connectToServerInput(garbageCollector) ; // connect the field to server filter 
     1154        if (field->getContextClient()->getType() != CContextClient::online) field->sendFieldToInputFileServer() ; 
     1155 
     1156      for(auto field : fileInField)  
     1157      { 
     1158        if (field->getContextClient()->getType() == CContextClient::online) field->connectToOnlineReader(garbageCollector) ; 
     1159        else field->connectToServerInput(garbageCollector) ; // connect the field to server filter 
    11501160        fileInFields_.push_back(field) ; 
    11511161      } 
     
    11571167      for(auto field : fileOutField)  
    11581168      { 
    1159         field->connectToFileServer(garbageCollector) ; // connect the field to server filter 
    1160       } 
    1161       for(auto field : fileOutField) field->sendFieldToFileServer() ; 
     1169        if (field->getContextClient()->getType() == CContextClient::online)  field->connectToOnlineWriter(garbageCollector) ; 
     1170        else  field->connectToFileServer(garbageCollector) ; // connect the field to server filter 
     1171      } 
     1172      for(auto field : fileOutField)  
     1173        if (field->getContextClient()->getType() != CContextClient::online) field->sendFieldToFileServer() ; 
    11621174    } 
    11631175 
     
    11761188      for(auto field : fileInField)  
    11771189      { 
    1178         field->connectToServerToClient(garbageCollector) ; 
     1190        if (field->getContextClient()->getType() == CContextClient::online) field->connectToOnlineReader(garbageCollector) ; 
     1191        else field->connectToServerToClient(garbageCollector) ; 
    11791192      } 
    11801193    } 
     
    12311244    if (serviceType_==CServicesManager::CLIENT)  
    12321245    { 
    1233       for(auto field : fileOutField) slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ;  
    1234       for(auto field : fileInField) slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ;  
     1246      for(auto field : fileOutField) 
     1247        if (field->getContextClient()->getType()!=CContextClient::online)  slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ;  
     1248      for(auto field : fileInField)  
     1249        if (field->getContextClient()->getType()!=CContextClient::online)  slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ;  
    12351250    } 
    12361251    else if (serviceType_==CServicesManager::GATHERER)  
     
    12411256    for(auto& slaveServer : slaveServers_) sendCloseDefinition(slaveServer) ; 
    12421257 
    1243     if (serviceType_==CServicesManager::WRITER)   
    1244     { 
    1245       createFileHeader(); 
    1246     } 
    1247  
    1248     if (serviceType_==CServicesManager::CLIENT) startPrefetchingOfEnabledReadModeFiles(); 
     1258    createFileHeader(); 
     1259    
     1260    //if (serviceType_==CServicesManager::CLIENT) startPrefetchingOfEnabledReadModeFiles(); 
     1261    if (serviceType_==CServicesManager::CLIENT)  
     1262       for(auto field : fileInField) field->sendReadDataRequest(getCalendar()->getCurrentDate());   
    12491263    
    12501264    // send signal to couplerIn context that definition phasis is done 
     
    13551369   CATCH_DUMP_ATTR 
    13561370 
    1357  
    1358    void CContext::postProcessFilterGraph() 
    1359    TRY 
    1360    { 
    1361      int size = enabledFiles.size(); 
    1362      for (int i = 0; i < size; ++i) 
    1363      { 
    1364         enabledFiles[i]->postProcessFilterGraph(); 
    1365      } 
    1366    } 
    1367    CATCH_DUMP_ATTR 
    1368  
    13691371   void CContext::startPrefetchingOfEnabledReadModeFiles() 
    13701372   TRY 
     
    13741376     { 
    13751377        enabledReadModeFiles[i]->prefetchEnabledReadModeFields(); 
    1376      } 
    1377    } 
    1378    CATCH_DUMP_ATTR 
    1379  
    1380    void CContext::doPreTimestepOperationsForEnabledReadModeFiles() 
    1381    TRY 
    1382    { 
    1383      int size = enabledReadModeFiles.size(); 
    1384      for (int i = 0; i < size; ++i) 
    1385      { 
    1386         enabledReadModeFiles[i]->doPreTimestepOperationsForEnabledReadModeFields(); 
    13871378     } 
    13881379   } 
     
    21762167        if (serviceType_==CServicesManager::CLIENT) // For now we only use server level 1 to read data 
    21772168        { 
    2178           doPostTimestepOperationsForEnabledReadModeFiles(); 
     2169         // doPostTimestepOperationsForEnabledReadModeFiles(); 
     2170          for(auto& field : fileInFields_) field->sendReadDataRequestIfNeeded() ; 
    21792171          garbageCollector.invalidate(calendar->getCurrentDate()); 
    21802172        } 
     
    22012193   CATCH_DUMP_ATTR 
    22022194 
    2203    //! Server side: Create header of netcdf file 
     2195   //! Create header of netcdf file 
    22042196   void CContext::createFileHeader(void) 
    22052197   TRY 
    22062198   { 
    2207       vector<CFile*>::const_iterator it; 
    2208  
    2209       //for (it=enabledFiles.begin(); it != enabledFiles.end(); it++) 
    2210       for (it=enabledWriteModeFiles.begin(); it != enabledWriteModeFiles.end(); it++) 
    2211       { 
    2212          (*it)->initWrite(); 
    2213       } 
     2199      for(auto& file : filesToWrite_) file->initWrite(); 
    22142200   } 
    22152201   CATCH_DUMP_ATTR 
Note: See TracChangeset for help on using the changeset viewer.