Changeset 597 for XIOS/trunk/src/node/context.cpp
- Timestamp:
- 05/26/15 16:13:47 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/context.cpp
r595 r597 23 23 CContext::CContext(void) 24 24 : CObjectTemplate<CContext>(), CContextAttributes() 25 , calendar(),hasClient(false),hasServer(false), isPostProcessed(false), dataSize_(), idServer_() 25 , calendar(), hasClient(false), hasServer(false), isPostProcessed(false), finalized(false) 26 , dataSize_(), idServer_(), client(0), server(0) 26 27 { /* Ne rien faire de plus */ } 27 28 28 29 CContext::CContext(const StdString & id) 29 30 : CObjectTemplate<CContext>(id), CContextAttributes() 30 , calendar(),hasClient(false),hasServer(false), isPostProcessed(false), dataSize_(), idServer_() 31 , calendar(), hasClient(false), hasServer(false), isPostProcessed(false), finalized(false) 32 , dataSize_(), idServer_(), client(0), server(0) 31 33 { /* Ne rien faire de plus */ } 32 34 33 35 CContext::~CContext(void) 34 36 { 35 if (hasClient)delete client;36 if (hasServer)delete server;37 delete client; 38 delete server; 37 39 } 38 40 … … 231 233 232 234 //! Initialize client side 233 void CContext::initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer )235 void CContext::initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer /*= 0*/) 234 236 { 235 237 hasClient=true; 236 238 client = new CContextClient(this,intraComm, interComm, cxtServer); 239 MPI_Comm intraCommServer, interCommServer; 240 if (cxtServer) // Attached mode 241 { 242 intraCommServer = intraComm; 243 interCommServer = interComm; 244 } 245 else 246 { 247 MPI_Comm_dup(intraComm, &intraCommServer); 248 MPI_Comm_dup(interComm, &interCommServer); 249 } 250 server = new CContextServer(this,intraCommServer,interCommServer); 237 251 } 238 252 … … 277 291 278 292 //! Initialize server 279 void CContext::initServer(MPI_Comm intraComm,MPI_Comm interComm )293 void CContext::initServer(MPI_Comm intraComm,MPI_Comm interComm, CContext* cxtClient /*= 0*/) 280 294 { 281 295 hasServer=true; 282 296 server = new CContextServer(this,intraComm,interComm); 297 MPI_Comm intraCommClient, interCommClient; 298 if (cxtClient) // Attached mode 299 { 300 intraCommClient = intraComm; 301 interCommClient = interComm; 302 } 303 else 304 { 305 MPI_Comm_dup(intraComm, &intraCommClient); 306 MPI_Comm_dup(interComm, &interCommClient); 307 } 308 client = new CContextClient(this,intraCommClient,interCommClient, cxtClient); 309 // Do something clever instead 310 std::map<int, StdSize> bufferSize; 311 for (int r = 0; r < client->serverSize; r++) 312 bufferSize[r] = 10 * sizeof(size_t) * 1024; 313 client->setBufferSize(bufferSize); 283 314 } 284 315 … … 289 320 } 290 321 322 //! Try to send the buffers and receive possible answers 323 bool CContext::checkBuffersAndListen(void) 324 { 325 client->checkBuffers(); 326 return server->eventLoop(); 327 } 328 291 329 //! Terminate a context 292 330 void CContext::finalize(void) 293 331 { 294 if (hasClient && !hasServer) 295 { 296 client->finalize(); 297 } 298 if (hasServer) 299 { 300 closeAllFile(); 332 if (!finalized) 333 { 334 finalized = true; 335 336 client->finalize(); 337 while (!server->hasFinished()) 338 { 339 server->eventLoop(); 340 } 341 342 if (hasServer) 343 { 344 closeAllFile(); 345 } 301 346 } 302 347 }
Note: See TracChangeset
for help on using the changeset viewer.