Ignore:
Timestamp:
07/05/16 15:59:16 (8 years ago)
Author:
mhnguyen
Message:

Correcting a bug in transformation_selector

+) Make sure transformation selector chose a correct transformation
+) Correct a bug of updating transformation value

Test
+) On Curie
+) All test pass

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/transformation/grid_transformation_selector.cpp

    r887 r889  
    1313namespace xios { 
    1414 
    15 CGridTransformationSelector::CGridTransformationSelector(CGrid* destination, CGrid* source) 
     15CGridTransformationSelector::CGridTransformationSelector(CGrid* destination, CGrid* source, TransformationType type) 
    1616 : gridSource_(source), gridDestination_(destination), 
    1717  listAlgos_(), algoTypes_(), nbNormalAlgos_(0), nbSpecialAlgos_(0), auxInputs_() 
     
    2626       << "Number of elements of grid source " <<gridSource_->getId() << " is " << gridSource_->axis_domain_order.numElements()  << std::endl 
    2727       << "Number of elements of grid destination " <<gridDestination_->getId() << " is " << numElement); 
    28   initializeTransformations(); 
     28  initializeTransformations(type); 
    2929} 
    3030 
     
    3535for each transformation, we need to make sure that the current "temporary source" maps its global index correctly to the original one. 
    3636*/ 
    37 void CGridTransformationSelector::initializeTransformations() 
     37void CGridTransformationSelector::initializeTransformations(TransformationType type) 
    3838{ 
    3939  // Initialize algorithms 
    4040  initializeAlgorithms(); 
    41   ListAlgoType::const_iterator itb = listAlgos_.begin(), 
    42                                ite = listAlgos_.end(), it; 
     41  ListAlgoType::iterator itb = listAlgos_.begin(), 
     42                         ite = listAlgos_.end(), it; 
    4343 
    4444  for (it = itb; it != ite; ++it) 
    4545  { 
    4646    ETranformationType transType = (it->second).first; 
    47     if (!isSpecialTransformation(transType)) ++nbNormalAlgos_; 
    48     else ++nbSpecialAlgos_; 
     47    if (!isSpecialTransformation(transType)) 
     48    { 
     49      ++nbNormalAlgos_; 
     50      if (special == type) 
     51      { 
     52        it = listAlgos_.erase(it); 
     53        --it; 
     54      } 
     55    } 
     56    else 
     57    { 
     58      ++nbSpecialAlgos_; 
     59      if (normal == type) 
     60      { 
     61        it = listAlgos_.erase(it); 
     62        --it; 
     63      } 
     64    } 
     65 
    4966  } 
    5067} 
Note: See TracChangeset for help on using the changeset viewer.