Ignore:
Timestamp:
08/24/15 14:53:36 (9 years ago)
Author:
mhnguyen
Message:

Implementing some code factoring

+) Replace some slow searching function by faster ones

Test
+) On Curie
+) test_client and test_complete are correct

File:
1 edited

Legend:

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

    r666 r668  
    3939  \param[in] axisPositionInGrid position of the axis in the grid 
    4040  \param[in] gridDestGlobalDim dimension size of destination grid (it should share the same size for all dimension, maybe except the axis on which transformation is performed) 
    41   \param[in] globalIndexGridDestSendToServer global index of destination grid which are to be sent to server(s) 
     41  \param[in] globalIndexGridDestSendToServer global index of destination grid which are to be sent to server(s), this array is already acsending sorted 
    4242  \param[in/out] globalIndexDestGrid array of global index (for 2d grid, this array is a line, for 3d, this array represents a plan). It should be preallocated 
    4343  \param[in/out] globalIndexSrcGrid array of global index of source grid (for 2d grid, this array is a line, for 3d, this array represents a plan). It should be preallocated 
     
    4848                                                                          const std::vector<int>& gridDestGlobalDim, 
    4949                                                                          const std::vector<int>& gridSrcGlobalDim, 
    50                                                                           const CArray<size_t,1>& globalIndexGridDestSendToServer, 
     50                                                                          const std::vector<size_t>& globalIndexGridDestSendToServer, 
    5151                                                                          CArray<size_t,1>& globalIndexDestGrid, 
    5252                                                                          std::vector<std::vector<size_t> >& globalIndexSrcGrid) 
     
    6666  } 
    6767 
    68   CArray<size_t,1>::const_iterator itbArr = globalIndexGridDestSendToServer.begin(), itArr, 
    69                                    iteArr = globalIndexGridDestSendToServer.end(); 
     68  std::vector<size_t>::const_iterator itbArr = globalIndexGridDestSendToServer.begin(), itArr, 
     69                                      iteArr = globalIndexGridDestSendToServer.end(); 
    7070 
    7171  while (idx < ssize) 
     
    9191    } 
    9292 
    93     itArr = std::find(itbArr, iteArr, globIndex); 
    94     if (iteArr != itArr) ++realGlobalIndexSize; 
     93    if (std::binary_search(itbArr, iteArr, globIndex)) ++realGlobalIndexSize; 
    9594    ++idxLoop[0]; 
    9695    ++idx; 
     
    130129    } 
    131130 
    132     itArr = std::find(itbArr, iteArr, globIndex); 
    133     if (iteArr != itArr) 
     131    if (std::binary_search(itbArr, iteArr, globIndex)) 
    134132    { 
    135133      globalIndexDestGrid(realGlobalIndex) = globIndex; 
Note: See TracChangeset for help on using the changeset viewer.