Changeset 1158 for XIOS/dev/dev_olga/src/node/axis.cpp
- Timestamp:
- 06/06/17 17:58:16 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/axis.cpp
r1144 r1158 27 27 , hasBounds_(false), isCompressible_(false) 28 28 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 29 , transformationMap_(), hasValue(false), doZoomByIndex_(false) 29 , transformationMap_(), hasValue(false), doZoomByIndex_(false), hasLabel(false) 30 30 , computedWrittenIndex_(false) 31 31 { … … 38 38 , hasBounds_(false), isCompressible_(false) 39 39 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 40 , transformationMap_(), hasValue(false), doZoomByIndex_(false) 40 , transformationMap_(), hasValue(false), doZoomByIndex_(false), hasLabel(false) 41 41 , computedWrittenIndex_(false) 42 42 { … … 58 58 59 59 ///--------------------------------------------------------------- 60 61 const std::set<StdString> & CAxis::getRelFiles(void) const 62 { 63 return (this->relFiles); 64 } 65 60 66 bool CAxis::IsWritten(const StdString & filename) const 61 67 { … … 70 76 bool CAxis::isDistributed(void) const 71 77 { 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; 74 84 } 75 85 … … 132 142 std::map<int, StdSize> CAxis::getAttributesBufferSize() 133 143 { 134 // CContextClient* client = CContext::getCurrent()->client;135 144 // For now the assumption is that secondary server pools consist of the same number of procs. 136 145 // CHANGE the line below if the assumption changes. … … 172 181 if (hasBounds_) 173 182 sizeValEvent += CArray<double,2>::size(2 * it->second.size()); 183 184 if (hasLabel) 185 sizeValEvent += CArray<StdString,1>::size(it->second.size()); 174 186 175 187 size_t size = CEventClient::headerSize + getId().size() + sizeof(size_t) + std::max(sizeIndexEvent, sizeValEvent); … … 255 267 this->checkZoom(); 256 268 this->checkMask(); 257 this->checkBounds(); 269 this->checkBounds(); 270 this->checkLabel(); 258 271 } 259 272 … … 339 352 } 340 353 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 } 346 372 347 373 bool CAxis::dispatchEvent(CEventServer& event) … … 437 463 CContext* context = CContext::getCurrent(); 438 464 439 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1;440 465 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 441 466 for (int p = 0; p < nbSrvPools; ++p) … … 729 754 CContext* context = CContext::getCurrent(); 730 755 731 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1;732 756 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 733 757 for (int p = 0; p < nbSrvPools; ++p) … … 1071 1095 } 1072 1096 } 1097 1098 if (hasLabel) 1099 { 1100 //label_srv(ind_srv) = labelVal( ind); 1101 } 1073 1102 } 1074 1103 … … 1114 1143 } 1115 1144 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 } 1116 1176 1117 1177 CTransformation<CAxis>* CAxis::addTransformation(ETranformationType transType, const StdString& id)
Note: See TracChangeset
for help on using the changeset viewer.