Ignore:
Timestamp:
01/25/17 16:25:17 (7 years ago)
Author:
yushan
Message:

initialize the branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan/src/node/context.cpp

    r1033 r1037  
    339339   } 
    340340 
     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 
    341347   //! Try to send the buffers and receive possible answers 
    342348   bool CContext::checkBuffersAndListen(void) 
    343349   { 
    344350     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(); 
    352352   } 
    353353 
     
    389389   void CContext::closeDefinition(void) 
    390390   { 
     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 
    391396     // There is nothing client need to send to server 
    392397     if (hasClient) 
    393398     { 
    394399       // 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); 
    398404 
    399405     if (hasClient && !hasServer) 
    400406     { 
    401407      // Send all attributes of current context to server 
    402       this->sendAllAttributesToServer(); 
     408      this->sendAllAttributesToServer(); //printf("myRank = %d, this->sendAllAttributesToServer OK\n", myRank); 
    403409 
    404410      // Send all attributes of current calendar 
    405411      CCalendarWrapper::get(CCalendarWrapper::GetDefName())->sendAllAttributesToServer(); 
     412      //printf("myRank = %d, CCalendarWrapper::get(CCalendarWrapper::GetDefName())->sendAllAttributesToServer OK\n", myRank); 
    406413 
    407414      // We have enough information to send to server 
    408415      // First of all, send all enabled files 
    409        sendEnabledFiles(); 
     416       sendEnabledFiles();  //printf("myRank = %d, sendEnabledFiles OK\n", myRank); 
    410417 
    411418      // Then, send all enabled fields 
    412        sendEnabledFields(); 
     419       sendEnabledFields();  //printf("myRank = %d, sendEnabledFields OK\n", myRank); 
    413420 
    414421      // At last, we have all info of domain and axis, then send them 
    415        sendRefDomainsAxis(); 
     422       sendRefDomainsAxis();  //printf("myRank = %d, sendRefDomainsAxis OK\n", myRank); 
    416423 
    417424      // After that, send all grid (if any) 
    418        sendRefGrid(); 
     425       sendRefGrid(); //printf("myRank = %d, sendRefGrid OK\n", myRank); 
    419426    } 
    420427 
    421428    // 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();   
    423430 
    424431    // There are some processings that should be done after all of above. For example: check mask or index 
    425432    if (hasClient) 
    426433    { 
    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); 
    430437    } 
    431438 
     
    434441 
    435442    // Nettoyage de l'arborescence 
    436     if (hasClient && !hasServer) CleanTree(); // Only on client side?? 
     443    if (hasClient && !hasServer) CleanTree(); 
    437444 
    438445    if (hasClient) 
    439446    { 
    440       sendCreateFileHeader(); 
    441  
    442       startPrefetchingOfEnabledReadModeFiles(); 
     447      sendCreateFileHeader();  //printf("myRank = %d, sendCreateFileHeader OK\n", myRank); 
     448 
     449      startPrefetchingOfEnabledReadModeFiles();  //printf("myRank = %d, startPrefetchingOfEnabledReadModeFiles OK\n", myRank); 
    443450    } 
    444451   } 
     
    479486   { 
    480487     int size = this->enabledFiles.size(); 
     488      
    481489     for (int i = 0; i < size; ++i) 
    482490     { 
     
    566574   { 
    567575      const std::vector<CFile*> allFiles = CFile::getAll(); 
    568       const CDate& initDate = calendar->getInitDate(); 
    569576 
    570577      for (unsigned int i = 0; i < allFiles.size(); i++) 
     
    572579         { 
    573580            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()"<<endl 
    578                     << "Output frequency in file \""<<allFiles[i]->getFileOutputName() 
    579                     <<"\" is less than the time step. File will not be written."<<endl; 
    580               } 
    581               else 
    582581               enabledFiles.push_back(allFiles[i]); 
    583             } 
    584582         } 
    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 
    596585 
    597586      if (enabledFiles.size() == 0) 
     
    812801   void CContext::postProcessing() 
    813802   { 
     803     int myRank; 
     804     MPI_Comm_rank(MPI_COMM_WORLD, &myRank); 
     805 
     806     //printf("myRank = %d, in postProcessing, isPostProcessed = %d\n", myRank, isPostProcessed); 
    814807     if (isPostProcessed) return; 
    815808 
     
    820813        ERROR("CContext::postProcessing()", << "A timestep must be defined for the context \"" << getId() << "!\"") 
    821814      // 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); 
    823816 
    824817      // Find all inheritance in xml structure 
    825       this->solveAllInheritance(); 
     818      this->solveAllInheritance();  //printf("myRank = %d, this->solveAllInheritance OK\n", myRank); 
    826819 
    827820      // Check if some axis, domains or grids are eligible to for compressed indexed output. 
    828821      // 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); 
    830823 
    831824      // Check if some automatic time series should be generated 
    832825      // 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); 
    834827 
    835828      //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); 
    838831 
    839832      // 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); 
    842835 
    843836     if (hasClient && !hasServer) 
    844837     { 
    845838      // 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); 
    847840     } 
    848841 
    849842      // 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); 
    851844 
    852845      // 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); 
    854847 
    855848      // Find all fields with read access from the public API 
    856       findFieldsWithReadAccess(); 
     849      findFieldsWithReadAccess();  //printf("myRank = %d, findFieldsWithReadAccess OK\n", myRank); 
    857850      // and solve the all reference for them 
    858       solveAllRefOfFieldsWithReadAccess(); 
     851      solveAllRefOfFieldsWithReadAccess();  //printf("myRank = %d, solveAllRefOfFieldsWithReadAccess OK\n", myRank); 
    859852 
    860853      isPostProcessed = true; 
     
    12401233         event.push(*itRank,1,msg); 
    12411234       client->sendEvent(event); 
    1242      } 
    1243      else client->sendEvent(event); 
     1235    } 
     1236    else client->sendEvent(event); 
    12441237  } 
    12451238 
Note: See TracChangeset for help on using the changeset viewer.