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

    r663 r668  
    3232  \param[in] gridDestGlobalDim dimension size of destination grid (it should share the same size for all dimension, maybe except the domain on which transformation is performed) 
    3333  \param[in] gridSrcGlobalDim dimension size of source grid (it should share the same size for all dimension, maybe except the domain on which transformation is performed) 
    34   \param[in] globalIndexGridDestSendToServer global index of destination grid which are to be sent to server(s) 
     34  \param[in] globalIndexGridDestSendToServer global index of destination grid which are to be sent to server(s), this array is already acsending sorted 
    3535  \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 
    3636  \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 
     
    4141                                                                          const std::vector<int>& gridDestGlobalDim, 
    4242                                                                          const std::vector<int>& gridSrcGlobalDim, 
    43                                                                           const CArray<size_t,1>& globalIndexGridDestSendToServer, 
     43                                                                          const std::vector<size_t>& globalIndexGridDestSendToServer, 
    4444                                                                          CArray<size_t,1>& globalIndexDestGrid, 
    4545                                                                          std::vector<std::vector<size_t> >& globalIndexSrcGrid) 
     
    7878  for (int i = 0; i< numElement; ++i) ssize *= gridDomainGlobalDim[i]; 
    7979 
    80   CArray<size_t,1>::const_iterator itbArr = globalIndexGridDestSendToServer.begin(), itArr, 
    81                                    iteArr = globalIndexGridDestSendToServer.end(); 
     80  std::vector<size_t>::const_iterator itbArr = globalIndexGridDestSendToServer.begin(), itArr, 
     81                                      iteArr = globalIndexGridDestSendToServer.end(); 
    8282  idx = 0; 
    8383  while (idx < ssize) 
     
    111111    } 
    112112 
    113     itArr = std::find(itbArr, iteArr, globIndex); 
    114     if (iteArr != itArr) ++realGlobalIndexSize; 
     113    if (std::binary_search(itbArr, iteArr, globIndex)) ++realGlobalIndexSize; 
    115114    ++idxLoop[0]; 
    116115    ++idx; 
     
    158157    } 
    159158 
    160     itArr = std::find(itbArr, iteArr, globIndex); 
    161     if (iteArr != itArr) 
     159    if (std::binary_search(itbArr, iteArr, globIndex)) 
    162160    { 
    163161      globalIndexDestGrid(realGlobalIndex) = globIndex; 
Note: See TracChangeset for help on using the changeset viewer.