Changeset 889


Ignore:
Timestamp:
07/05/16 15:59:16 (5 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

Location:
XIOS/trunk/src/transformation
Files:
4 edited

Legend:

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

    r888 r889  
    2727  for (int idx = 0; idx < nbLocalIndex; ++idx) 
    2828  { 
    29     dataOut(localIndex[idx].first) = *(dataInput + idx) * localIndex[idx].second; 
     29    dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 
    3030  } 
    3131} 
  • XIOS/trunk/src/transformation/grid_generate.cpp

    r887 r889  
    1414namespace xios { 
    1515CGridGenerate::CGridGenerate(CGrid* destination, CGrid* source) 
    16   : CGridTransformationSelector(destination, source) 
     16  : CGridTransformationSelector(destination, source, special) 
    1717{ 
    1818} 
  • 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} 
  • XIOS/trunk/src/transformation/grid_transformation_selector.hpp

    r888 r889  
    3434  }; 
    3535 
     36protected: 
     37  enum TransformationType { 
     38    special = 0, normal = 1 
     39  }; 
     40 
    3641public: 
    3742  /** Default constructor */ 
    38   CGridTransformationSelector(CGrid* destination, CGrid* source); 
     43  CGridTransformationSelector(CGrid* destination, CGrid* source, TransformationType type = normal); 
    3944  virtual ~CGridTransformationSelector(); 
    4045 
     
    4954  void initializeAxisAlgorithms(int axisPositionInGrid); 
    5055  void initializeScalarAlgorithms(int scalarPositionInGrid); 
    51   void initializeTransformations(); 
     56  void initializeTransformations(TransformationType type); 
    5257  void selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder, AlgoType algo); 
    5358  bool isSpecialTransformation(ETranformationType transType); 
Note: See TracChangeset for help on using the changeset viewer.