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/scalar.cpp

    r1870 r1875  
    6868 
    6969  } 
    70  
    71   /*! 
    72   \brief Check if a scalar is completed 
    73   Before make any scalar processing, we must be sure that all scalar informations have 
    74   been sent, for exemple when reading a grid in a file or when grid elements are sent by an 
    75   other context (coupling). So all direct reference of the scalar (scalar_ref) must be also completed 
    76   \return true if scalar and scalar reference are completed 
    77   */ 
    78   bool CScalar::checkIfCompleted(void) 
    79   { 
    80     if (hasDirectScalarReference()) if (!getDirectScalarReference()->checkIfCompleted()) return false; 
    81     return isCompleted_ ; 
    82   } 
    83  
    84   /*! 
    85   \brief Set a scalar as completed 
    86    When all information about a scalar have been received, the scalar is tagged as completed and is 
    87    suitable for processing 
    88   */ 
    89   void CScalar::setCompleted(void) 
    90   { 
    91     if (hasDirectScalarReference()) getDirectScalarReference()->setCompleted() ; 
    92     isCompleted_=true ; 
    93   } 
    94  
    95   /*! 
    96   \brief Set a scalar as uncompleted 
    97    When informations about a scalar are expected from a grid reading from file or coupling, the scalar is  
    98    tagged as uncompleted and is not suitable for processing 
    99   */ 
    100   void CScalar::setUncompleted(void) 
    101   { 
    102     if (hasDirectScalarReference()) getDirectScalarReference()->setUncompleted() ; 
    103     isCompleted_=false ; 
    104   } 
    105  
    106  
    107  
    10870 
    10971  /*! 
     
    187149        refScalar[i]->setTransformations(scalar->getAllTransformations()); 
    188150  } 
    189  
     151  
    190152  void CScalar::sendScalarToFileServer(CContextClient* client) 
    191153  { 
    192154    if (sendScalarToFileServer_done_.count(client)!=0) return ; 
    193155    else sendScalarToFileServer_done_.insert(client) ; 
    194  
    195156    StdString scalarDefRoot("scalar_definition"); 
    196157    CScalarGroup* scalarPtr = CScalarGroup::get(scalarDefRoot); 
    197158    this->sendAllAttributesToServer(client); 
    198159  } 
     160 
     161  void CScalar::sendScalarToCouplerOut(CContextClient* client, const string& fieldId, int posInGrid) 
     162  { 
     163    if (sendScalarToCouplerOut_done_.count(client)!=0) return ; 
     164    else sendScalarToCouplerOut_done_.insert(client) ; 
     165 
     166    string scalarId="_scalar["+std::to_string(posInGrid)+"]_of_"+fieldId ; 
     167    
     168    if (!scalar_ref.isEmpty()) 
     169    { 
     170      auto scalar_ref_tmp=scalar_ref.getValue() ; 
     171      scalar_ref.reset() ; // remove the reference, find an other way to do that more cleanly 
     172      this->sendAllAttributesToServer(client, scalarId)  ; 
     173      scalar_ref = scalar_ref_tmp ; 
     174    } 
     175    else this->sendAllAttributesToServer(client, scalarId)  ; 
     176 
     177 
     178    this->sendAllAttributesToServer(client, scalarId); 
     179  }   
     180 
     181  void CScalar::makeAliasForCoupling(const string& fieldId, int posInGrid) 
     182  { 
     183    const string scalarId = "_scalar["+std::to_string(posInGrid)+"]_of_"+fieldId ; 
     184    this->createAlias(scalarId) ; 
     185  } 
     186 
     187  void CScalar::setContextClient(CContextClient* contextClient) 
     188  TRY 
     189  { 
     190    if (clientsSet.find(contextClient)==clientsSet.end()) 
     191    { 
     192      clients.push_back(contextClient) ; 
     193      clientsSet.insert(contextClient); 
     194    } 
     195  } 
     196  CATCH_DUMP_ATTR 
    199197  /*! 
    200198    Parse children nodes of a scalar in xml file. 
Note: See TracChangeset for help on using the changeset viewer.