Changeset 1050 for XIOS/trunk/src/node/axis.cpp
- Timestamp:
- 02/07/17 11:52:03 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/axis.cpp
r995 r1050 27 27 , isDistributed_(false), hasBounds_(false), isCompressible_(false) 28 28 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 29 , transformationMap_(), hasValue(false) 29 , transformationMap_(), hasValue(false), hasLabel(false) 30 30 { 31 31 } … … 37 37 , isDistributed_(false), hasBounds_(false), isCompressible_(false) 38 38 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 39 , transformationMap_(), hasValue(false) 39 , transformationMap_(), hasValue(false), hasLabel(false) 40 40 { 41 41 } … … 176 176 if (hasBounds_) 177 177 sizeValEvent += CArray<double,2>::size(2 * it->second.size()); 178 179 if (hasLabel) 180 sizeValEvent += CArray<StdString,1>::size(it->second.size()); 178 181 179 182 size_t size = CEventClient::headerSize + getId().size() + sizeof(size_t) + std::max(sizeIndexEvent, sizeValEvent); … … 261 264 this->checkMask(); 262 265 this->checkBounds(); 266 this->checkLabel(); 263 267 264 268 isDistributed_ = (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || … … 333 337 } 334 338 339 void CAxis::checkLabel() 340 { 341 if (!label.isEmpty()) 342 { 343 if (label.extent(0) != n) 344 ERROR("CAxis::checkLabel(void)", 345 << "The label array of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be of dimension of axis size." << std::endl 346 << "Axis size is " << n.getValue() << "." << std::endl 347 << "label size is "<< label.extent(0)<< " ."); 348 hasLabel = true; 349 } 350 else hasLabel = false; 351 } 335 352 void CAxis::checkEligibilityForCompressedOutput() 336 353 { … … 657 674 list<CArray<double,1> > list_val; 658 675 list<CArray<double,2> > list_bounds; 676 list<CArray<StdString,1> > list_label; 659 677 660 678 std::map<int, std::vector<size_t> >::const_iterator it, iteMap; … … 675 693 list_bounds.push_back(CArray<double,2>(2,nbData)); 676 694 } 695 696 if (hasLabel) 697 { 698 list_label.push_back(CArray<StdString,1>(nbData)); 699 } 677 700 678 701 CArray<int,1>& indi = list_indi.back(); … … 693 716 boundsVal(1, n) = bounds(1,n); 694 717 } 718 719 if (hasLabel) 720 { 721 CArray<StdString,1>& labelVal = list_label.back(); 722 labelVal(n) = label(n); 723 } 695 724 } 696 725 … … 716 745 { 717 746 list_msgsVal.back() << list_bounds.back(); 747 } 748 749 if (hasLabel) 750 { 751 list_msgsVal.back() << list_label.back(); 718 752 } 719 753 … … 783 817 CArray<double,1> val; 784 818 CArray<double,2> boundsVal; 819 CArray<StdString,1> labelVal; 785 820 786 821 buffer >> val; 787 822 if (hasBounds_) buffer >> boundsVal; 823 if (hasLabel) buffer >> labelVal; 788 824 789 825 int i, j, ind_srv; … … 798 834 bound_srv(1,ind_srv) = boundsVal(1, ind); 799 835 } 836 837 if (hasLabel) 838 { 839 label_srv(ind_srv) = labelVal( ind); 840 } 841 800 842 } 801 843 } … … 836 878 bound_srv(0,ind) = bounds(0,ind); 837 879 bound_srv(1,ind) = bounds(1,ind); 880 } 881 if (hasLabel) 882 { 883 label_srv(ind) = label(ind); 838 884 } 839 885 } … … 927 973 value_srv.resize(zoom_size_srv); 928 974 if (hasBounds_) bound_srv.resize(2,zoom_size_srv); 975 if (hasLabel) label_srv.resize(zoom_size_srv); 929 976 } 930 977 }
Note: See TracChangeset
for help on using the changeset viewer.