Changeset 1205 for XIOS/dev/branch_yushan_merged/src/transformation
- Timestamp:
- 07/10/17 18:17:04 (7 years ago)
- Location:
- XIOS/dev/branch_yushan_merged/src/transformation
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan_merged/src/transformation/Functions/average_reduction.cpp
r1160 r1205 39 39 int nbLocalIndex = localIndex.size(); 40 40 int currentlocalIndex = 0; 41 double currentWeight = 0.0; 42 43 dataOut=std::numeric_limits<double>::quiet_NaN(); 41 double currentWeight = 0.0; 44 42 45 43 for (int idx = 0; idx < nbLocalIndex; ++idx) … … 59 57 weights_(currentlocalIndex) += 1.0; 60 58 } 59 } 60 else 61 { 62 if (flagInitial[currentlocalIndex]) 63 dataOut(currentlocalIndex) = std::numeric_limits<double>::quiet_NaN(); 61 64 } 62 65 } -
XIOS/dev/branch_yushan_merged/src/transformation/Functions/max_reduction.cpp
r1160 r1205 36 36 { 37 37 int nbLocalIndex = localIndex.size(); 38 int currentlocalIndex = 0; 39 dataOut=std::numeric_limits<double>::quiet_NaN(); 38 int currentlocalIndex = 0; 40 39 for (int idx = 0; idx < nbLocalIndex; ++idx) 41 40 { … … 52 51 dataOut(currentlocalIndex) = std::max(*(dataInput + idx), dataOut(currentlocalIndex)); 53 52 } 53 } 54 else 55 { 56 if (flagInitial[currentlocalIndex]) 57 dataOut(currentlocalIndex) = std::numeric_limits<double>::quiet_NaN(); 54 58 } 55 59 } -
XIOS/dev/branch_yushan_merged/src/transformation/Functions/min_reduction.cpp
r1160 r1205 36 36 { 37 37 int nbLocalIndex = localIndex.size(); 38 int currentlocalIndex = 0; 39 dataOut=std::numeric_limits<double>::quiet_NaN(); 38 int currentlocalIndex = 0; 40 39 for (int idx = 0; idx < nbLocalIndex; ++idx) 41 40 { … … 52 51 dataOut(currentlocalIndex) = std::min(*(dataInput + idx), dataOut(currentlocalIndex)); 53 52 } 53 } 54 else 55 { 56 if (flagInitial[currentlocalIndex]) 57 dataOut(currentlocalIndex) = std::numeric_limits<double>::quiet_NaN(); 54 58 } 55 59 } -
XIOS/dev/branch_yushan_merged/src/transformation/Functions/sum_reduction.cpp
r1160 r1205 36 36 { 37 37 int nbLocalIndex = localIndex.size(); 38 int currentlocalIndex = 0; 39 40 dataOut=std::numeric_limits<double>::quiet_NaN(); 38 int currentlocalIndex = 0; 41 39 42 40 for (int idx = 0; idx < nbLocalIndex; ++idx) … … 54 52 dataOut(currentlocalIndex) += *(dataInput + idx); 55 53 } 54 } 55 else 56 { 57 if (flagInitial[currentlocalIndex]) 58 dataOut(currentlocalIndex) = std::numeric_limits<double>::quiet_NaN(); 56 59 } 57 60 } -
XIOS/dev/branch_yushan_merged/src/transformation/axis_algorithm_interpolate.cpp
r937 r1205 148 148 while (it < iteRange) 149 149 { 150 while ( ((*itsecond -*it) < precision) && itsecond < ite)150 while (itsecond < ite && ((*itsecond -*it) < precision)) 151 151 { ++itsecond; ++it; } 152 152 int index = std::distance(itb, it); -
XIOS/dev/branch_yushan_merged/src/transformation/axis_algorithm_zoom.cpp
r933 r1205 53 53 << "Zoom size is " << zoomSize_ ); 54 54 } 55 56 if (!zoomAxis->index.isEmpty()) 57 { 58 int sz = zoomAxis->index.numElements(); 59 zoomIndex_.resize(sz); 60 for (int i = 0; i < sz; ++i) 61 zoomIndex_[i] = zoomAxis->index(i); 62 63 std::sort(zoomIndex_.begin(), zoomIndex_.end()); 64 } 55 65 } 56 66 … … 60 70 void CAxisAlgorithmZoom::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 61 71 { 72 this->transformationMapping_.resize(1); 73 this->transformationWeight_.resize(1); 74 75 TransformationIndexMap& transMap = this->transformationMapping_[0]; 76 TransformationWeightMap& transWeight = this->transformationWeight_[0]; 77 62 78 StdSize niSource = axisSrc_->n.getValue(); 63 79 StdSize ibeginSource = axisSrc_->begin.getValue(); … … 69 85 if (iend < ibegin) ni = 0; 70 86 71 this->transformationMapping_.resize(1); 72 this->transformationWeight_.resize(1); 73 74 TransformationIndexMap& transMap = this->transformationMapping_[0]; 75 TransformationWeightMap& transWeight = this->transformationWeight_[0]; 76 77 for (StdSize idx = 0; idx < ni; ++idx) 87 if (!zoomIndex_.empty()) 78 88 { 79 transMap[ibegin+idx].push_back(ibegin+idx); 80 transWeight[ibegin+idx].push_back(1.0); 89 std::vector<int>::iterator itZoomBegin, itZoomEnd; 90 itZoomBegin = std::lower_bound(zoomIndex_.begin(), zoomIndex_.end(), ibeginSource); 91 itZoomEnd = std::upper_bound(zoomIndex_.begin(), zoomIndex_.end(), iendSource); 92 for (; itZoomBegin != itZoomEnd; ++itZoomBegin) 93 { 94 transMap[*itZoomBegin].push_back(*itZoomBegin); 95 transWeight[*itZoomBegin].push_back(1.0); 96 } 97 } 98 else 99 { 100 for (StdSize idx = 0; idx < ni; ++idx) 101 { 102 transMap[ibegin+idx].push_back(ibegin+idx); 103 transWeight[ibegin+idx].push_back(1.0); 104 } 81 105 } 82 106 … … 92 116 axisDest_->global_zoom_begin = zoomBegin_; 93 117 axisDest_->global_zoom_n = zoomSize_; 118 if (!zoomIndex_.empty()) 119 { 120 axisDest_->global_zoom_index.resize(zoomIndex_.size()); 121 std::copy(zoomIndex_.begin(), zoomIndex_.end(), axisDest_->global_zoom_index.begin()); 122 } 94 123 } 95 124 -
XIOS/dev/branch_yushan_merged/src/transformation/axis_algorithm_zoom.hpp
r933 r1205 48 48 StdSize zoomSize_; 49 49 50 std::vector<int> zoomIndex_; 51 50 52 private: 51 53 -
XIOS/dev/branch_yushan_merged/src/transformation/domain_algorithm_interpolate.cpp
r1155 r1205 111 111 const int constNVertex = 4; // Value by default number of vertex for rectangular domain 112 112 int nVertexSrc, nVertexDest; 113 nVertexSrc = constNVertex; 114 nVertexDest = constNVertex; 113 nVertexSrc = nVertexDest = constNVertex; 115 114 116 115 // First of all, try to retrieve the boundary values of domain source and domain destination … … 389 388 } 390 389 391 if (writeToFile_ && !readFromFile_) 392 writeRemapInfo(interpMapValue);393 exchangeRemapInfo(interpMapValue);390 if (writeToFile_ && !readFromFile_) writeRemapInfo(interpMapValue); 391 // exchangeRemapInfo(interpMapValue); 392 convertRemapInfo(interpMapValue) ; 394 393 395 394 delete [] globalSrc; … … 498 497 } 499 498 499 void CDomainAlgorithmInterpolate::convertRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 500 { 501 CContext* context = CContext::getCurrent(); 502 CContextClient* client=context->client; 503 int clientRank = client->clientRank; 504 505 this->transformationMapping_.resize(1); 506 this->transformationWeight_.resize(1); 507 508 TransformationIndexMap& transMap = this->transformationMapping_[0]; 509 TransformationWeightMap& transWeight = this->transformationWeight_[0]; 510 511 std::map<int,std::vector<std::pair<int,double> > >::const_iterator itb = interpMapValue.begin(), it, 512 ite = interpMapValue.end(); 513 514 for (it = itb; it != ite; ++it) 515 { 516 const std::vector<std::pair<int,double> >& tmp = it->second; 517 for (int i = 0; i < tmp.size(); ++i) 518 { 519 transMap[it->first].push_back(tmp[i].first); 520 transWeight[it->first].push_back(tmp[i].second); 521 } 522 } 523 } 500 524 501 525 /*! -
XIOS/dev/branch_yushan_merged/src/transformation/domain_algorithm_interpolate.hpp
r1134 r1205 47 47 void writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >&); 48 48 void exchangeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue); 49 void convertRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue); 49 50 50 51 private: -
XIOS/dev/branch_yushan_merged/src/transformation/generic_algorithm_transformation.cpp
r1160 r1205 45 45 { 46 46 dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 47 } 48 } 49 50 // for (int idx = 0; idx < nbLocalIndex; ++idx) 51 // { 52 // if (!flagInitial[localIndex[idx].first]) 53 // dataOut(localIndex[idx].first) = defaultValue; 54 // } 47 flagInitial[localIndex[idx].first] = true; // Reset flag to indicate not all data source are nan 48 } 49 } 50 51 // If all data source are nan then data destination must be nan 52 for (int idx = 0; idx < nbLocalIndex; ++idx) 53 { 54 if (!flagInitial[localIndex[idx].first]) 55 dataOut(localIndex[idx].first) = defaultValue; 56 } 55 57 } 56 58 else
Note: See TracChangeset
for help on using the changeset viewer.