Ignore:
Timestamp:
06/22/15 13:36:21 (9 years ago)
Author:
mhnguyen
Message:

Implementing generic transformation algorithm (local commit)

+) Change a little bit to make sure everything work in order

Test
+) test_new_features passe with inverse

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/filter/axis_inverse.cpp

    r620 r621  
    44 
    55CAxisInverse::CAxisInverse(CAxis* axisDestination, CAxis* axisSource) 
    6  : CAxisAlgorithmTransformation(axisDestination) 
     6 : CConcreteAlgo() 
    77{ 
    88  if (axisDestination->size.getValue() != axisSource->size.getValue()) 
     
    1414  } 
    1515 
     16 
    1617  axisDestGlobalSize_ = axisDestination->size.getValue(); 
     18  int niDest = axisDestination->ni.getValue(); 
     19  int ibeginDest = axisDestination->ibegin.getValue(); 
    1720 
    18   this->computeIndexSourceMapping(); 
     21  for (int idx = 0; idx < niDest; ++idx) axisDestGlobalIndex_.push_back(ibeginDest+idx); 
    1922} 
    2023 
    21 void CAxisInverse::computeIndexSourceMapping() 
     24void CAxisInverse::computeIndexSourceMapping(const std::map<int, std::vector<int> >& transformationMappingOfPreviousAlgo) 
    2225{ 
    2326  std::map<int, std::vector<int> >& transMap = this->transformationMapping_; 
    24   if (!transMap.empty()) transMap.clear(); 
    25  
    26   int globalIndexSize = axisDestGlobalIndex_.size(); 
    27   for (int idx = 0; idx < globalIndexSize; ++idx) 
    28     transMap[axisDestGlobalIndex_[idx]].push_back(axisDestGlobalSize_-axisDestGlobalIndex_[idx]-1); 
     27  if (transformationMappingOfPreviousAlgo.empty()) 
     28  { 
     29    int globalIndexSize = axisDestGlobalIndex_.size(); 
     30    for (int idx = 0; idx < globalIndexSize; ++idx) 
     31      transMap[axisDestGlobalIndex_[idx]].push_back(axisDestGlobalSize_-axisDestGlobalIndex_[idx]-1); 
     32  } 
     33  else 
     34  { 
     35    std::map<int, std::vector<int> >::const_iterator itb = transformationMappingOfPreviousAlgo.begin(), it, 
     36                                                     ite = transformationMappingOfPreviousAlgo.end(); 
     37    for (it = itb; it != ite; ++it) 
     38    { 
     39      transMap[it->first].push_back(axisDestGlobalSize_-it->first-1); 
     40    } 
     41  } 
    2942} 
    3043 
    31  
    3244} 
Note: See TracChangeset for help on using the changeset viewer.