Changeset 1037 for XIOS/dev/branch_yushan/src/node/context.cpp
- Timestamp:
- 01/25/17 16:25:17 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan/src/node/context.cpp
r1033 r1037 339 339 } 340 340 341 //! Server side: Put server into a loop in order to listen message from client 342 bool CContext::eventLoop(void) 343 { 344 return server->eventLoop(); 345 } 346 341 347 //! Try to send the buffers and receive possible answers 342 348 bool CContext::checkBuffersAndListen(void) 343 349 { 344 350 client->checkBuffers(); 345 346 bool hasTmpBufferedEvent = client->hasTemporarilyBufferedEvent(); 347 if (hasTmpBufferedEvent) 348 hasTmpBufferedEvent = !client->sendTemporarilyBufferedEvent(); 349 350 // Don't process events if there is a temporarily buffered event 351 return server->eventLoop(!hasTmpBufferedEvent); 351 return server->eventLoop(); 352 352 } 353 353 … … 389 389 void CContext::closeDefinition(void) 390 390 { 391 int myRank; 392 MPI_Comm_rank(MPI_COMM_WORLD, &myRank); 393 394 //printf("myRank = %d, hasClient = %d, hasServer = %d\n", myRank, hasClient, hasServer); 395 391 396 // There is nothing client need to send to server 392 397 if (hasClient) 393 398 { 394 399 // After xml is parsed, there are some more works with post processing 395 postProcessing(); 396 } 397 setClientServerBuffer(); 400 postProcessing(); 401 //printf("myRank = %d, postProcessing OK\n", myRank); 402 } 403 setClientServerBuffer(); //printf("myRank = %d, setClientServerBuffer OK\n", myRank); 398 404 399 405 if (hasClient && !hasServer) 400 406 { 401 407 // Send all attributes of current context to server 402 this->sendAllAttributesToServer(); 408 this->sendAllAttributesToServer(); //printf("myRank = %d, this->sendAllAttributesToServer OK\n", myRank); 403 409 404 410 // Send all attributes of current calendar 405 411 CCalendarWrapper::get(CCalendarWrapper::GetDefName())->sendAllAttributesToServer(); 412 //printf("myRank = %d, CCalendarWrapper::get(CCalendarWrapper::GetDefName())->sendAllAttributesToServer OK\n", myRank); 406 413 407 414 // We have enough information to send to server 408 415 // First of all, send all enabled files 409 sendEnabledFiles(); 416 sendEnabledFiles(); //printf("myRank = %d, sendEnabledFiles OK\n", myRank); 410 417 411 418 // Then, send all enabled fields 412 sendEnabledFields(); 419 sendEnabledFields(); //printf("myRank = %d, sendEnabledFields OK\n", myRank); 413 420 414 421 // At last, we have all info of domain and axis, then send them 415 sendRefDomainsAxis(); 422 sendRefDomainsAxis(); //printf("myRank = %d, sendRefDomainsAxis OK\n", myRank); 416 423 417 424 // After that, send all grid (if any) 418 sendRefGrid(); 425 sendRefGrid(); //printf("myRank = %d, sendRefGrid OK\n", myRank); 419 426 } 420 427 421 428 // We have a xml tree on the server side and now, it should be also processed 422 if (hasClient && !hasServer) sendPostProcessing(); 429 if (hasClient && !hasServer) sendPostProcessing(); 423 430 424 431 // There are some processings that should be done after all of above. For example: check mask or index 425 432 if (hasClient) 426 433 { 427 this->buildFilterGraphOfEnabledFields(); 428 buildFilterGraphOfFieldsWithReadAccess(); 429 this->solveAllRefOfEnabledFields(true); 434 this->buildFilterGraphOfEnabledFields(); //printf("myRank = %d, buildFilterGraphOfEnabledFields OK\n", myRank); 435 buildFilterGraphOfFieldsWithReadAccess(); //printf("myRank = %d, buildFilterGraphOfFieldsWithReadAccess OK\n", myRank); 436 this->solveAllRefOfEnabledFields(true); //printf("myRank = %d, solveAllRefOfEnabledFields OK\n", myRank); 430 437 } 431 438 … … 434 441 435 442 // Nettoyage de l'arborescence 436 if (hasClient && !hasServer) CleanTree(); // Only on client side??443 if (hasClient && !hasServer) CleanTree(); 437 444 438 445 if (hasClient) 439 446 { 440 sendCreateFileHeader(); 441 442 startPrefetchingOfEnabledReadModeFiles(); 447 sendCreateFileHeader(); //printf("myRank = %d, sendCreateFileHeader OK\n", myRank); 448 449 startPrefetchingOfEnabledReadModeFiles(); //printf("myRank = %d, startPrefetchingOfEnabledReadModeFiles OK\n", myRank); 443 450 } 444 451 } … … 479 486 { 480 487 int size = this->enabledFiles.size(); 488 481 489 for (int i = 0; i < size; ++i) 482 490 { … … 566 574 { 567 575 const std::vector<CFile*> allFiles = CFile::getAll(); 568 const CDate& initDate = calendar->getInitDate();569 576 570 577 for (unsigned int i = 0; i < allFiles.size(); i++) … … 572 579 { 573 580 if (allFiles[i]->enabled.getValue()) // Si l'attribut 'enabled' est fixé à vrai. 574 {575 if ((initDate + allFiles[i]->output_freq.getValue()) < (initDate + this->getCalendar()->getTimeStep()))576 {577 error(0)<<"WARNING: void CContext::findEnabledFiles()"<<endl578 << "Output frequency in file \""<<allFiles[i]->getFileOutputName()579 <<"\" is less than the time step. File will not be written."<<endl;580 }581 else582 581 enabledFiles.push_back(allFiles[i]); 583 }584 582 } 585 else 586 { 587 if ( (initDate + allFiles[i]->output_freq.getValue()) < (initDate + this->getCalendar()->getTimeStep())) 588 { 589 error(0)<<"WARNING: void CContext::findEnabledFiles()"<<endl 590 << "Output frequency in file \""<<allFiles[i]->getFileOutputName() 591 <<"\" is less than the time step. File will not be written."<<endl; 592 } 593 else 594 enabledFiles.push_back(allFiles[i]); // otherwise true by default 595 } 583 else enabledFiles.push_back(allFiles[i]); // otherwise true by default 584 596 585 597 586 if (enabledFiles.size() == 0) … … 812 801 void CContext::postProcessing() 813 802 { 803 int myRank; 804 MPI_Comm_rank(MPI_COMM_WORLD, &myRank); 805 806 //printf("myRank = %d, in postProcessing, isPostProcessed = %d\n", myRank, isPostProcessed); 814 807 if (isPostProcessed) return; 815 808 … … 820 813 ERROR("CContext::postProcessing()", << "A timestep must be defined for the context \"" << getId() << "!\"") 821 814 // Calendar first update to set the current date equals to the start date 822 calendar->update(0); 815 calendar->update(0); //printf("myRank = %d, calendar->update(0) OK\n", myRank); 823 816 824 817 // Find all inheritance in xml structure 825 this->solveAllInheritance(); 818 this->solveAllInheritance(); //printf("myRank = %d, this->solveAllInheritance OK\n", myRank); 826 819 827 820 // Check if some axis, domains or grids are eligible to for compressed indexed output. 828 821 // Warning: This must be done after solving the inheritance and before the rest of post-processing 829 checkAxisDomainsGridsEligibilityForCompressedOutput(); 822 checkAxisDomainsGridsEligibilityForCompressedOutput(); //printf("myRank = %d, checkAxisDomainsGridsEligibilityForCompressedOutput OK\n", myRank); 830 823 831 824 // Check if some automatic time series should be generated 832 825 // Warning: This must be done after solving the inheritance and before the rest of post-processing 833 prepareTimeseries(); 826 prepareTimeseries(); //printf("myRank = %d, prepareTimeseries OK\n", myRank); 834 827 835 828 //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 836 this->findEnabledFiles(); 837 this->findEnabledReadModeFiles(); 829 this->findEnabledFiles(); //printf("myRank = %d, this->findEnabledFiles OK\n", myRank); 830 this->findEnabledReadModeFiles(); //printf("myRank = %d, this->findEnabledReadModeFiles OK\n", myRank); 838 831 839 832 // Find all enabled fields of each file 840 this->findAllEnabledFields(); 841 this->findAllEnabledFieldsInReadModeFiles(); 833 this->findAllEnabledFields(); //printf("myRank = %d, this->findAllEnabledFields OK\n", myRank); 834 this->findAllEnabledFieldsInReadModeFiles(); //printf("myRank = %d, this->findAllEnabledFieldsInReadModeFiles OK\n", myRank); 842 835 843 836 if (hasClient && !hasServer) 844 837 { 845 838 // Try to read attributes of fields in file then fill in corresponding grid (or domain, axis) 846 this->readAttributesOfEnabledFieldsInReadModeFiles(); 839 this->readAttributesOfEnabledFieldsInReadModeFiles(); //printf("myRank = %d, this->readAttributesOfEnabledFieldsInReadModeFiles OK\n", myRank); 847 840 } 848 841 849 842 // Only search and rebuild all reference objects of enable fields, don't transform 850 this->solveOnlyRefOfEnabledFields(false); 843 this->solveOnlyRefOfEnabledFields(false); //printf("myRank = %d, this->solveOnlyRefOfEnabledFields(false) OK\n", myRank); 851 844 852 845 // Search and rebuild all reference object of enabled fields 853 this->solveAllRefOfEnabledFields(false); 846 this->solveAllRefOfEnabledFields(false); //printf("myRank = %d, this->solveAllRefOfEnabledFields(false) OK\n", myRank); 854 847 855 848 // Find all fields with read access from the public API 856 findFieldsWithReadAccess(); 849 findFieldsWithReadAccess(); //printf("myRank = %d, findFieldsWithReadAccess OK\n", myRank); 857 850 // and solve the all reference for them 858 solveAllRefOfFieldsWithReadAccess(); 851 solveAllRefOfFieldsWithReadAccess(); //printf("myRank = %d, solveAllRefOfFieldsWithReadAccess OK\n", myRank); 859 852 860 853 isPostProcessed = true; … … 1240 1233 event.push(*itRank,1,msg); 1241 1234 client->sendEvent(event); 1242 1243 1235 } 1236 else client->sendEvent(event); 1244 1237 } 1245 1238
Note: See TracChangeset
for help on using the changeset viewer.