Ignore:
Timestamp:
05/12/20 11:52:13 (4 years ago)
Author:
ymipsl
Message:

XIOS coupling branch
Some updates.

First coupling test is beginning to work...

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp

    r1872 r1875  
    575575   } 
    576576 
     577   void CAxis::sendAxisToCouplerOut(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid, const string& fieldId, int posInGrid) 
     578   { 
     579     if (sendAxisToFileServer_done_.count(client)!=0) return ; 
     580     else sendAxisToFileServer_done_.insert(client) ; 
     581      
     582     string axisId="_axis["+std::to_string(posInGrid)+"]_of_"+fieldId ; 
     583 
     584     if (!axis_ref.isEmpty()) 
     585    { 
     586      auto axis_ref_tmp=axis_ref.getValue() ; 
     587      axis_ref.reset() ; // remove the reference, find an other way to do that more cleanly 
     588      this->sendAllAttributesToServer(client, axisId)  ;  
     589      axis_ref = axis_ref_tmp ; 
     590    } 
     591    else this->sendAllAttributesToServer(client, axisId)  ;  
     592   
     593    this->sendAttributes(client, globalDim, orderPositionInGrid, CServerDistributionDescription::BAND_DISTRIBUTION, axisId) ; 
     594   } 
     595 
     596  void CAxis::makeAliasForCoupling(const string& fieldId, int posInGrid) 
     597  { 
     598    const string axisId = "_axis["+std::to_string(posInGrid)+"]_of_"+fieldId ; 
     599    this->createAlias(axisId) ; 
     600  } 
     601 
    577602  /*! 
    578603    Send attributes from one client to other clients 
     
    581606  */ 
    582607  void CAxis::sendAttributes(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid, 
    583                              CServerDistributionDescription::ServerDistributionType distType) 
    584   TRY 
    585   { 
    586      sendDistributionAttribute(client, globalDim, orderPositionInGrid, distType); 
     608                             CServerDistributionDescription::ServerDistributionType distType, const string& axisId) 
     609  TRY 
     610  { 
     611     sendDistributionAttribute(client, globalDim, orderPositionInGrid, distType, axisId); 
    587612 
    588613     // if (index.numElements() == n_glo.getValue()) 
     
    590615         || (index.numElements() != n_glo)) 
    591616     { 
    592        sendDistributedAttributes(client);        
     617       sendDistributedAttributes(client, axisId);        
    593618     } 
    594619     else 
    595620     { 
    596        sendNonDistributedAttributes(client);     
     621       sendNonDistributedAttributes(client, axisId);     
    597622     }      
    598623  } 
     
    889914  */ 
    890915  void CAxis::sendDistributionAttribute(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid, 
    891                                         CServerDistributionDescription::ServerDistributionType distType) 
    892   TRY 
    893   { 
     916                                        CServerDistributionDescription::ServerDistributionType distType, const string& axisId) 
     917  TRY 
     918  { 
     919    string serverAxisId = axisId.empty() ? this->getId() : axisId ;  
    894920    int nbServer = client->serverSize; 
    895921 
     
    914940        msgs.push_back(CMessage()); 
    915941        CMessage& msg = msgs.back(); 
    916         msg << this->getId(); 
     942        msg << serverAxisId; 
    917943        msg << ni << begin; 
    918944        msg << isCompressible_;                     
     
    962988    In the future, if new attributes are added, they should also be processed in this function 
    963989  */ 
    964   void CAxis::sendNonDistributedAttributes(CContextClient* client) 
    965   TRY 
    966   { 
     990  void CAxis::sendNonDistributedAttributes(CContextClient* client, const string& axisId) 
     991  TRY 
     992  { 
     993    string serverAxisId = axisId.empty() ? this->getId() : axisId ;  
     994 
    967995    CEventClient event(getType(), EVENT_ID_NON_DISTRIBUTED_ATTRIBUTES); 
    968996    size_t nbIndex = index.numElements(); 
     
    9961024        msgs.push_back(CMessage()); 
    9971025        CMessage& msg = msgs.back(); 
    998         msg << this->getId(); 
     1026        msg << serverAxisId; 
    9991027        msg << index.getValue() << dataIndex << mask.getValue(); 
    10001028        msg << hasValue; 
     
    10871115    In future, if new attributes are added, they should also be processed in this function 
    10881116  */ 
    1089   void CAxis::sendDistributedAttributes(CContextClient* client) 
    1090   TRY 
    1091   { 
     1117  void CAxis::sendDistributedAttributes(CContextClient* client, const string& axisId) 
     1118  TRY 
     1119  { 
     1120    string serverAxisId = axisId.empty() ? this->getId() : axisId ;  
     1121     
    10921122    int ind, idx; 
    10931123    int nbServer = client->serverSize; 
     
    11661196 
    11671197      listData.push_back(CMessage()); 
    1168       listData.back() << this->getId() 
     1198      listData.back() << serverAxisId 
    11691199                      << list_indi.back() << list_dataInd.back(); 
    11701200 
     
    14311461  CATCH_DUMP_ATTR 
    14321462 
    1433 /*! 
    1434   \brief Check if a axis is completed 
    1435   Before make any axis processing, we must be sure that all axis informations have 
    1436   been sent, for exemple when reading a grid in a file or when grid elements are sent by an 
    1437   other context (coupling). So all direct reference of the axis (axis_ref) must be also completed 
    1438   \return true if axis and axis reference are completed 
    1439   */ 
    1440   bool CAxis::checkIfCompleted(void) 
    1441   { 
    1442     if (hasDirectAxisReference()) if (!getDirectAxisReference()->checkIfCompleted()) return false; 
    1443     return isCompleted_ ; 
    1444   } 
    1445  
    1446   /*! 
    1447   \brief Set a axis as completed 
    1448    When all information about a axis have been received, the axis is tagged as completed and is 
    1449    suitable for processing 
    1450   */ 
    1451   void CAxis::setCompleted(void) 
    1452   { 
    1453     if (hasDirectAxisReference()) getDirectAxisReference()->setCompleted() ; 
    1454     isCompleted_=true ; 
    1455   } 
    1456  
    1457   /*! 
    1458   \brief Set a axis as uncompleted 
    1459    When informations about a axis are expected from a grid reading from file or coupling, the axis is  
    1460    tagged as uncompleted and is not suitable for processing 
    1461   */ 
    1462   void CAxis::setUncompleted(void) 
    1463   { 
    1464     if (hasDirectAxisReference()) getDirectAxisReference()->setUncompleted() ; 
    1465     isCompleted_=false ; 
    1466   } 
    1467  
    1468  
    1469  
    14701463  /*! 
    14711464   * Go through the hierarchy to find the axis from which the transformations must be inherited 
Note: See TracChangeset for help on using the changeset viewer.