Ignore:
Timestamp:
07/24/15 16:40:06 (9 years ago)
Author:
rlacroix
Message:

Distributions and transformations: Avoid using heap allocations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/server_distribution_description.cpp

    r569 r653  
    1818 
    1919CServerDistributionDescription::~CServerDistributionDescription() 
    20 { 
    21   if (!vecGlobalIndex_.empty()) 
    22     for (int i = 0; i < vecGlobalIndex_.size(); ++i) delete vecGlobalIndex_[i]; 
    23 } 
     20{ /* Nothing to do */ } 
    2421 
    2522/*! 
     
    5148      size_t ssize = 1, idx = 0; 
    5249      for (int j = 0; j < dim; ++j) ssize *= dimensionSizes_[idxServer][j]; 
    53       vecGlobalIndex_[idxServer] = new CArray<size_t,1>(ssize); 
     50      vecGlobalIndex_[idxServer].resize(ssize); 
    5451 
    5552      std::vector<int> idxLoop(dim,0); 
     
    7976          { 
    8077            mulDim *= nGlobal_[k-1]; 
    81             globalIndex += (currentIndex[k])*mulDim; 
     78            globalIndex += currentIndex[k] * mulDim; 
    8279          } 
    83           (*vecGlobalIndex_[idxServer])(idx) = globalIndex; 
     80          vecGlobalIndex_[idxServer](idx) = globalIndex; 
    8481          ++idx; 
    8582        } 
     
    241238  \return global index on server(s) 
    242239*/ 
    243 const std::vector<CArray<size_t,1>* >& CServerDistributionDescription::getGlobalIndex() const 
     240const std::vector<CArray<size_t,1> >& CServerDistributionDescription::getGlobalIndex() const 
    244241{ 
    245242  return vecGlobalIndex_; 
Note: See TracChangeset for help on using the changeset viewer.