Ignore:
Timestamp:
07/10/17 18:17:04 (7 years ago)
Author:
yushan
Message:

branch merged with trunk @1200

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  
    3939    int nbLocalIndex = localIndex.size(); 
    4040    int currentlocalIndex = 0; 
    41     double currentWeight  = 0.0; 
    42  
    43     dataOut=std::numeric_limits<double>::quiet_NaN(); 
     41    double currentWeight  = 0.0;     
    4442 
    4543    for (int idx = 0; idx < nbLocalIndex; ++idx) 
     
    5957          weights_(currentlocalIndex) += 1.0; 
    6058        } 
     59      } 
     60      else 
     61      { 
     62        if (flagInitial[currentlocalIndex])  
     63          dataOut(currentlocalIndex) = std::numeric_limits<double>::quiet_NaN(); 
    6164      } 
    6265    } 
  • XIOS/dev/branch_yushan_merged/src/transformation/Functions/max_reduction.cpp

    r1160 r1205  
    3636  { 
    3737    int nbLocalIndex = localIndex.size(); 
    38     int currentlocalIndex = 0; 
    39     dataOut=std::numeric_limits<double>::quiet_NaN();     
     38    int currentlocalIndex = 0;     
    4039    for (int idx = 0; idx < nbLocalIndex; ++idx) 
    4140    { 
     
    5251          dataOut(currentlocalIndex) = std::max(*(dataInput + idx), dataOut(currentlocalIndex)); 
    5352        } 
     53      } 
     54      else 
     55      { 
     56        if (flagInitial[currentlocalIndex])  
     57          dataOut(currentlocalIndex) = std::numeric_limits<double>::quiet_NaN(); 
    5458      } 
    5559    } 
  • XIOS/dev/branch_yushan_merged/src/transformation/Functions/min_reduction.cpp

    r1160 r1205  
    3636  { 
    3737    int nbLocalIndex = localIndex.size(); 
    38     int currentlocalIndex = 0; 
    39     dataOut=std::numeric_limits<double>::quiet_NaN(); 
     38    int currentlocalIndex = 0;     
    4039    for (int idx = 0; idx < nbLocalIndex; ++idx) 
    4140    { 
     
    5251          dataOut(currentlocalIndex) = std::min(*(dataInput + idx), dataOut(currentlocalIndex)); 
    5352        } 
     53      } 
     54      else 
     55      { 
     56        if (flagInitial[currentlocalIndex])  
     57          dataOut(currentlocalIndex) = std::numeric_limits<double>::quiet_NaN(); 
    5458      } 
    5559    } 
  • XIOS/dev/branch_yushan_merged/src/transformation/Functions/sum_reduction.cpp

    r1160 r1205  
    3636  { 
    3737    int nbLocalIndex = localIndex.size(); 
    38     int currentlocalIndex = 0; 
    39  
    40     dataOut=std::numeric_limits<double>::quiet_NaN(); 
     38    int currentlocalIndex = 0;     
    4139   
    4240    for (int idx = 0; idx < nbLocalIndex; ++idx) 
     
    5452          dataOut(currentlocalIndex) += *(dataInput + idx); 
    5553        } 
     54      } 
     55      else 
     56      { 
     57        if (flagInitial[currentlocalIndex])  
     58          dataOut(currentlocalIndex) = std::numeric_limits<double>::quiet_NaN(); 
    5659      } 
    5760    }     
  • XIOS/dev/branch_yushan_merged/src/transformation/axis_algorithm_interpolate.cpp

    r937 r1205  
    148148      while (it < iteRange) 
    149149      { 
    150         while (((*itsecond -*it) < precision) && itsecond < ite) 
     150        while (itsecond < ite && ((*itsecond -*it) < precision)) 
    151151        { ++itsecond; ++it; } 
    152152        int index = std::distance(itb, it); 
  • XIOS/dev/branch_yushan_merged/src/transformation/axis_algorithm_zoom.cpp

    r933 r1205  
    5353           << "Zoom size is " << zoomSize_ ); 
    5454  } 
     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  } 
    5565} 
    5666 
     
    6070void CAxisAlgorithmZoom::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    6171{ 
     72  this->transformationMapping_.resize(1); 
     73  this->transformationWeight_.resize(1); 
     74 
     75  TransformationIndexMap& transMap = this->transformationMapping_[0]; 
     76  TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
     77 
    6278  StdSize niSource = axisSrc_->n.getValue(); 
    6379  StdSize ibeginSource = axisSrc_->begin.getValue(); 
     
    6985  if (iend < ibegin) ni = 0; 
    7086 
    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()) 
    7888  { 
    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    } 
    81105  } 
    82106 
     
    92116  axisDest_->global_zoom_begin = zoomBegin_; 
    93117  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  } 
    94123} 
    95124 
  • XIOS/dev/branch_yushan_merged/src/transformation/axis_algorithm_zoom.hpp

    r933 r1205  
    4848  StdSize zoomSize_; 
    4949 
     50  std::vector<int> zoomIndex_; 
     51 
    5052private: 
    5153 
  • XIOS/dev/branch_yushan_merged/src/transformation/domain_algorithm_interpolate.cpp

    r1155 r1205  
    111111  const int constNVertex = 4; // Value by default number of vertex for rectangular domain 
    112112  int nVertexSrc, nVertexDest; 
    113   nVertexSrc = constNVertex; 
    114   nVertexDest = constNVertex; 
     113  nVertexSrc = nVertexDest = constNVertex; 
    115114 
    116115  // First of all, try to retrieve the boundary values of domain source and domain destination 
     
    389388  } 
    390389 
    391   if (writeToFile_ && !readFromFile_) 
    392      writeRemapInfo(interpMapValue); 
    393   exchangeRemapInfo(interpMapValue); 
     390  if (writeToFile_ && !readFromFile_) writeRemapInfo(interpMapValue); 
     391//  exchangeRemapInfo(interpMapValue); 
     392  convertRemapInfo(interpMapValue) ; 
    394393 
    395394  delete [] globalSrc; 
     
    498497} 
    499498 
     499void 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} 
    500524 
    501525/*! 
  • XIOS/dev/branch_yushan_merged/src/transformation/domain_algorithm_interpolate.hpp

    r1134 r1205  
    4747  void writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >&); 
    4848  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); 
    4950 
    5051private: 
  • XIOS/dev/branch_yushan_merged/src/transformation/generic_algorithm_transformation.cpp

    r1160 r1205  
    4545      { 
    4646        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    } 
    5557  } 
    5658  else 
Note: See TracChangeset for help on using the changeset viewer.