Ignore:
Timestamp:
07/11/16 17:36:01 (8 years ago)
Author:
mhnguyen
Message:

Adding a new transformation: Reduce a domain to an axis

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

File:
1 edited

Legend:

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

    r888 r895  
    1919 
    2020CAxisAlgorithmTransformation::CAxisAlgorithmTransformation(CAxis* axisDestination, CAxis* axisSource) 
    21  : CGenericAlgorithmTransformation(), axisDest_(axisDestination), axisSrc_(axisSource) 
     21 : CGenericAlgorithmTransformation(), axisDest_(axisDestination), axisSrc_(axisSource), domainSrc_(0) 
     22{ 
     23  axisDestGlobalSize_ = axisDestination->n_glo.getValue(); 
     24  int niDest = axisDestination->n.getValue(); 
     25  int ibeginDest = axisDestination->begin.getValue(); 
     26 
     27  for (int idx = 0; idx < niDest; ++idx) 
     28    if ((axisDestination->mask)(idx)) axisDestGlobalIndex_.push_back(ibeginDest+idx); 
     29} 
     30 
     31CAxisAlgorithmTransformation::CAxisAlgorithmTransformation(CAxis* axisDestination, CDomain* domainSource) 
     32 : CGenericAlgorithmTransformation(), axisDest_(axisDestination), axisSrc_(0), domainSrc_(domainSource) 
    2233{ 
    2334  axisDestGlobalSize_ = axisDestination->n_glo.getValue(); 
     
    5162  int clientSize = client->clientSize; 
    5263 
    53  
    5464  size_t globalIndex; 
    55   int nIndexSize = axisSrc_->index.numElements(); 
     65  int nIndexSize = 0; 
     66  if (2 == elementType) nIndexSize = domainSrc_->i_index.numElements(); 
     67  else if (1 == elementType) nIndexSize = axisSrc_->index.numElements(); 
    5668  CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank; 
    5769  globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor())); 
    5870  for (int idx = 0; idx < nIndexSize; ++idx) 
    5971  { 
    60     globalIndex = axisSrc_->index(idx); 
     72    if (2 == elementType) 
     73    { 
     74      globalIndex = domainSrc_->i_index(idx) + domainSrc_->j_index(idx) * domainSrc_->ni_glo; 
     75    } 
     76    else if (1 == elementType) 
     77    { 
     78      globalIndex = axisSrc_->index(idx); 
     79    } 
     80 
    6181    globalIndex2ProcRank[globalIndex].resize(1); 
    6282    globalIndex2ProcRank[globalIndex][0] = clientRank; 
Note: See TracChangeset for help on using the changeset viewer.