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/grid_transformation.cpp

    r620 r621  
    22#include "axis_inverse.hpp" 
    33#include "transformation_mapping.hpp" 
     4#include "transformation_enum.hpp" 
     5#include "axis_algorithm_transformation.hpp" 
    46 
    57namespace xios { 
     
    8688      if (axisListDestP[i]->hasTransformation()) 
    8789      { 
    88         CGenericAlgorithmTransformation* algo = new CAxisInverse(axisListDestP[i], axisListSrcP[i]); 
     90        CGenericAlgorithmTransformation* algo = 0; 
     91        CAxis::TransMapTypes trans = axisListDestP[i]->getAllTransformations(); 
     92        CAxis::TransMapTypes::const_iterator itb = trans.begin(), it, 
     93                                             ite = trans.end(); 
     94        std::vector<ETranformationType> algoAxis; 
     95        for (it = itb; it != ite; ++it) 
     96        { 
     97          algoAxis.push_back(it->first); 
     98        } 
     99        algo = new CAxisAlgorithmTransformation(axisListDestP[i], axisListSrcP[i], algoAxis); 
    89100        algoTransformation_[axisPositionInGrid[i]].push_back(algo); 
    90101      } 
     
    98109} 
    99110 
     111/*! 
     112  Compute index mapping representing transformation between two grids 
     113  Each domain and each axis can contain some information of transformation, these information are then converted into 
     114form of global index mapping reprensenting transformation between two grids. 
     115*/ 
    100116void CGridTransformation::computeTransformation() 
    101117{ 
     
    122138} 
    123139 
     140/*! 
     141  Compute transformation mapping between grid source and grid destination 
     142  The transformation between grid source and grid destination is represented in form of mapping between global index 
     143of two grids. Then local index mapping between data on each grid will be found out thanks to these global indexes 
     144*/ 
    124145void CGridTransformation::computeTransformationMapping() 
    125146{ 
     
    141162  CArray<size_t,1> globalIndexOnClientSrc = gridSource_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
    142163 
    143  
    144164  std::vector<size_t>::const_iterator itbVec, itVec, iteVec; 
    145165  CArray<size_t, 1>::iterator itbArr, itArr, iteArr; 
    146166 
    147167  std::map<int,std::vector<std::vector<size_t> > >::const_iterator itbMapRecv, itMapRecv, iteMapRecv; 
     168 
    148169  // Find out local index on grid destination (received) 
    149170  itbMapRecv = globalIndexToReceive.begin(); 
     
    166187        { 
    167188          int localIdx = std::distance(itbArr, itArr); 
    168           (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); 
     189//          (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain) 
     190          (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data 
    169191        } 
    170192      } 
    171193    } 
    172  
    173194  } 
    174195 
     
    183204    CArray<int,1>* ptr = new CArray<int,1>((itMap->second).size()); 
    184205    localIndexToSendFromGridSource_[itMap->first] = ptr; 
     206    int destRank = itMap->first; 
    185207    int vecSize = (itMap->second).size(); 
    186208    for (int idx = 0; idx < vecSize; ++idx) 
     
    190212      { 
    191213        int localIdx = std::distance(itbArr, itArr); 
    192         (*localIndexToSendFromGridSource_[itMap->first])(idx) = localIndexOnClientSrc(localIdx); 
    193       } 
    194     } 
    195   } 
    196 } 
    197  
     214//        (*localIndexToSendFromGridSource_[destRank])(idx) = localIndexOnClientSrc(localIdx); 
     215        (*localIndexToSendFromGridSource_[destRank])(idx) = (localIdx); 
     216      } 
     217    } 
     218  } 
     219} 
     220 
     221/*! 
     222  Local index of data which need sending from the grid source 
     223  \return local index of data 
     224*/ 
    198225std::map<int, CArray<int,1>* > CGridTransformation::getLocalIndexToSendFromGridSource() 
    199226{ 
     
    201228} 
    202229 
     230/*! 
     231  Local index of data which will be received on the grid destination 
     232  \return local index of data 
     233*/ 
    203234std::map<int, std::vector<CArray<int,1>* > > CGridTransformation::getLocalIndexToReceiveOnGridDest() 
    204235{ 
Note: See TracChangeset for help on using the changeset viewer.