Changeset 2482 for XIOS3/dev/XIOS_ATTACHED/src/node/context.cpp
- Timestamp:
- 03/28/23 16:42:11 (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/dev/XIOS_ATTACHED/src/node/context.cpp
r2458 r2482 7 7 #include "duration.hpp" 8 8 9 #include "online_context_client.hpp" 9 10 #include "legacy_context_client.hpp" 10 11 #include "legacy_context_server.hpp" … … 678 679 vector<CContextClient*> CContext::getContextClient(const string& poolId, const string& serviceId) 679 680 { 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 } 684 690 return ret ; 685 691 } … … 807 813 if (serviceType_==CServicesManager::CLIENT) 808 814 { 809 //ym doPreTimestepOperationsForEnabledReadModeFiles(); // For now we only use server level 1 to read data810 815 triggerLateFields() ; 811 816 … … 985 990 986 991 CTimer::get("Context : close definition").resume() ; 992 993 onlineContextClient_=CContextClient::getNew<CContextClient::online>(this,intraComm_, intraComm_); 987 994 988 995 // create intercommunicator with servers. … … 1145 1152 { 1146 1153 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 1150 1160 fileInFields_.push_back(field) ; 1151 1161 } … … 1157 1167 for(auto field : fileOutField) 1158 1168 { 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() ; 1162 1174 } 1163 1175 … … 1176 1188 for(auto field : fileInField) 1177 1189 { 1178 field->connectToServerToClient(garbageCollector) ; 1190 if (field->getContextClient()->getType() == CContextClient::online) field->connectToOnlineReader(garbageCollector) ; 1191 else field->connectToServerToClient(garbageCollector) ; 1179 1192 } 1180 1193 } … … 1231 1244 if (serviceType_==CServicesManager::CLIENT) 1232 1245 { 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() ; 1235 1250 } 1236 1251 else if (serviceType_==CServicesManager::GATHERER) … … 1241 1256 for(auto& slaveServer : slaveServers_) sendCloseDefinition(slaveServer) ; 1242 1257 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()); 1249 1263 1250 1264 // send signal to couplerIn context that definition phasis is done … … 1355 1369 CATCH_DUMP_ATTR 1356 1370 1357 1358 void CContext::postProcessFilterGraph()1359 TRY1360 {1361 int size = enabledFiles.size();1362 for (int i = 0; i < size; ++i)1363 {1364 enabledFiles[i]->postProcessFilterGraph();1365 }1366 }1367 CATCH_DUMP_ATTR1368 1369 1371 void CContext::startPrefetchingOfEnabledReadModeFiles() 1370 1372 TRY … … 1374 1376 { 1375 1377 enabledReadModeFiles[i]->prefetchEnabledReadModeFields(); 1376 }1377 }1378 CATCH_DUMP_ATTR1379 1380 void CContext::doPreTimestepOperationsForEnabledReadModeFiles()1381 TRY1382 {1383 int size = enabledReadModeFiles.size();1384 for (int i = 0; i < size; ++i)1385 {1386 enabledReadModeFiles[i]->doPreTimestepOperationsForEnabledReadModeFields();1387 1378 } 1388 1379 } … … 2176 2167 if (serviceType_==CServicesManager::CLIENT) // For now we only use server level 1 to read data 2177 2168 { 2178 doPostTimestepOperationsForEnabledReadModeFiles(); 2169 // doPostTimestepOperationsForEnabledReadModeFiles(); 2170 for(auto& field : fileInFields_) field->sendReadDataRequestIfNeeded() ; 2179 2171 garbageCollector.invalidate(calendar->getCurrentDate()); 2180 2172 } … … 2201 2193 CATCH_DUMP_ATTR 2202 2194 2203 //! Server side:Create header of netcdf file2195 //! Create header of netcdf file 2204 2196 void CContext::createFileHeader(void) 2205 2197 TRY 2206 2198 { 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(); 2214 2200 } 2215 2201 CATCH_DUMP_ATTR
Note: See TracChangeset
for help on using the changeset viewer.