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

Adding new transformation for scalar: Reducing an axis to a scalar

+) Add new xml node for new transformation
+) Add new algorithms for axis reduction
+) Make change in some place to make sure everything work fine

Test
+) On Curie
+) Tests pass and are correct

File:
1 edited

Legend:

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

    r873 r888  
    122122    const std::list<size_t>& listNbLocalIndexToReceive = gridTransformation->getNbLocalIndexToReceiveOnGridDest(); 
    123123    const std::list<std::vector<bool> >& listLocalIndexMaskOnDest = gridTransformation->getLocalMaskIndexOnGridDest(); 
     124    const std::vector<CGenericAlgorithmTransformation*>& listAlgos = gridTransformation->getAlgos(); 
    124125 
    125126    CArray<double,1> dataCurrentDest(dataSrc.copy()); 
     
    130131    std::list<size_t>::const_iterator itNbListRecv = listNbLocalIndexToReceive.begin(); 
    131132    std::list<std::vector<bool> >::const_iterator itLocalMaskIndexOnDest = listLocalIndexMaskOnDest.begin(); 
    132  
    133     for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++itLocalMaskIndexOnDest) 
     133    std::vector<CGenericAlgorithmTransformation*>::const_iterator itAlgo = listAlgos.begin(); 
     134 
     135    for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++itLocalMaskIndexOnDest, ++itAlgo) 
    134136    { 
    135137      CArray<double,1> dataCurrentSrc(dataCurrentDest); 
     
    189191        else dataCurrentDest(i) = defaultValue; 
    190192 
     193      std::vector<bool> localInitFlag(dataCurrentDest.size(), true); 
    191194      currentBuff = 0; 
    192195      for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv) 
     
    194197        int countSize = itRecv->second.size(); 
    195198        const std::vector<std::pair<int,double> >& localIndex_p = itRecv->second; 
    196         for (int idx = 0; idx < countSize; ++idx) 
    197         { 
    198           dataCurrentDest(localIndex_p[idx].first) += *(recvBuff+currentBuff+idx) * localIndex_p[idx].second; 
    199         } 
     199//        for (int idx = 0; idx < countSize; ++idx) 
     200//        { 
     201//          dataCurrentDest(localIndex_p[idx].first) += *(recvBuff+currentBuff+idx) * localIndex_p[idx].second; 
     202//        } 
     203        (*itAlgo)->apply(localIndex_p, 
     204                         recvBuff+currentBuff, 
     205                         dataCurrentDest, 
     206                         localInitFlag); 
     207 
    200208        currentBuff += countSize; 
    201209      } 
Note: See TracChangeset for help on using the changeset viewer.