Ignore:
Timestamp:
06/06/17 17:58:16 (7 years ago)
Author:
oabramkina
Message:

Two server levels: merging with trunk r1137.
There are bugs.

File:
1 edited

Legend:

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

    r1144 r1158  
    2727      , hasBounds_(false), isCompressible_(false) 
    2828      , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
    29       , transformationMap_(), hasValue(false), doZoomByIndex_(false) 
     29      , transformationMap_(), hasValue(false), doZoomByIndex_(false), hasLabel(false) 
    3030      , computedWrittenIndex_(false) 
    3131   { 
     
    3838      , hasBounds_(false), isCompressible_(false) 
    3939      , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
    40       , transformationMap_(), hasValue(false), doZoomByIndex_(false) 
     40      , transformationMap_(), hasValue(false), doZoomByIndex_(false), hasLabel(false) 
    4141      , computedWrittenIndex_(false) 
    4242   { 
     
    5858 
    5959   ///--------------------------------------------------------------- 
     60 
     61   const std::set<StdString> & CAxis::getRelFiles(void) const 
     62   { 
     63      return (this->relFiles); 
     64   } 
     65 
    6066   bool CAxis::IsWritten(const StdString & filename) const 
    6167   { 
     
    7076   bool CAxis::isDistributed(void) const 
    7177   { 
    72       return (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || 
    73              (!this->n.isEmpty() && (this->n != this->n_glo));; 
     78      bool distributed = (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || 
     79             (!this->n.isEmpty() && (this->n != this->n_glo)); 
     80      // A same stupid condition to make sure that if there is only one client, axis 
     81      // should be considered to be distributed. This should be a temporary solution      
     82      distributed |= (1 == CContext::getCurrent()->client->clientSize); 
     83      return distributed; 
    7484   } 
    7585 
     
    132142   std::map<int, StdSize> CAxis::getAttributesBufferSize() 
    133143   { 
    134 //     CContextClient* client = CContext::getCurrent()->client; 
    135144     // For now the assumption is that secondary server pools consist of the same number of procs. 
    136145     // CHANGE the line below if the assumption changes. 
     
    172181         if (hasBounds_) 
    173182           sizeValEvent += CArray<double,2>::size(2 * it->second.size()); 
     183  
     184         if (hasLabel) 
     185           sizeValEvent += CArray<StdString,1>::size(it->second.size()); 
    174186 
    175187         size_t size = CEventClient::headerSize + getId().size() + sizeof(size_t) + std::max(sizeIndexEvent, sizeValEvent); 
     
    255267      this->checkZoom(); 
    256268      this->checkMask(); 
    257       this->checkBounds();       
     269      this->checkBounds(); 
     270      this->checkLabel(); 
    258271   } 
    259272 
     
    339352   } 
    340353 
    341    void CAxis::checkEligibilityForCompressedOutput() 
    342    { 
    343      // We don't check if the mask is valid here, just if a mask has been defined at this point. 
    344      isCompressible_ = !mask.isEmpty(); 
    345    } 
     354  void CAxis::checkLabel() 
     355  { 
     356    if (!label.isEmpty()) 
     357    { 
     358      if (label.extent(0) != n) 
     359        ERROR("CAxis::checkLabel(void)", 
     360              << "The label array of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be of dimension of axis size." << std::endl 
     361              << "Axis size is " << n.getValue() << "." << std::endl 
     362              << "label size is "<< label.extent(0)<<  " ."); 
     363      hasLabel = true; 
     364    } 
     365    else hasLabel = false; 
     366  } 
     367  void CAxis::checkEligibilityForCompressedOutput() 
     368  { 
     369    // We don't check if the mask is valid here, just if a mask has been defined at this point. 
     370    isCompressible_ = !mask.isEmpty(); 
     371  } 
    346372 
    347373   bool CAxis::dispatchEvent(CEventServer& event) 
     
    437463    CContext* context = CContext::getCurrent(); 
    438464 
    439     // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    440465    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
    441466    for (int p = 0; p < nbSrvPools; ++p) 
     
    729754    CContext* context = CContext::getCurrent(); 
    730755 
    731     // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    732756    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
    733757    for (int p = 0; p < nbSrvPools; ++p) 
     
    10711095      } 
    10721096    } 
     1097 
     1098    if (hasLabel) 
     1099    { 
     1100      //label_srv(ind_srv) = labelVal( ind); 
     1101    } 
    10731102  } 
    10741103 
     
    11141143  } 
    11151144 
     1145  /*! 
     1146    Compare two axis objects.  
     1147    They are equal if only if they have identical attributes as well as their values. 
     1148    Moreover, they must have the same transformations. 
     1149  \param [in] axis Compared axis 
     1150  \return result of the comparison 
     1151  */ 
     1152  bool CAxis::isEqual(CAxis* obj) 
     1153  { 
     1154    vector<StdString> excludedAttr; 
     1155    excludedAttr.push_back("axis_ref"); 
     1156 
     1157    bool objEqual = SuperClass::isEqual(obj, excludedAttr);     
     1158    if (!objEqual) return objEqual; 
     1159 
     1160    TransMapTypes thisTrans = this->getAllTransformations(); 
     1161    TransMapTypes objTrans  = obj->getAllTransformations(); 
     1162 
     1163    TransMapTypes::const_iterator it, itb, ite; 
     1164    std::vector<ETranformationType> thisTransType, objTransType; 
     1165    for (it = thisTrans.begin(); it != thisTrans.end(); ++it) 
     1166      thisTransType.push_back(it->first); 
     1167    for (it = objTrans.begin(); it != objTrans.end(); ++it) 
     1168      objTransType.push_back(it->first); 
     1169 
     1170    if (thisTransType.size() != objTransType.size()) return false; 
     1171    for (int idx = 0; idx < thisTransType.size(); ++idx) 
     1172      objEqual &= (thisTransType[idx] == objTransType[idx]); 
     1173 
     1174    return objEqual; 
     1175  } 
    11161176 
    11171177  CTransformation<CAxis>* CAxis::addTransformation(ETranformationType transType, const StdString& id) 
Note: See TracChangeset for help on using the changeset viewer.