src/Neighbor/GridCellIndex.cc
//------------------------------------------------------------------------------
// Define a global function which returns a vector of GridCellIndex objects
// within a given range of grid cells.
//------------------------------------------------------------------------------
Define a global function which returns a vector of GridCellIndex objects
within a given range of grid cells.
Define a global function which returns a vector of GridCellIndex objects within a given range of grid cells .
inline
vector<GridCellIndex<Dim<1> > >
GridCellIndexRange(const GridCellIndex<Dim<1> >& gridCellMin,
                   const GridCellIndex<Dim<1> >& gridCellMax) {
  int numCells = gridCellMax.xIndex() - gridCellMin.xIndex() + 1;
  CHECK(numCells > 0);
  vector<GridCellIndex<Dim<1> > > result;
  result.reserve(numCells);
  for (int ix = gridCellMin.xIndex(); ix <= gridCellMax.xIndex(); ++ix) {
    result.push_back(GridCellIndex<Dim<1> >(ix));
    CHECK((int)result.size() <= numCells);
  }
  return result;  
}
inline vector < GridCellIndex < Dim < 1 > > > GridCellIndexRange ( const GridCellIndex < Dim < 1 > > & gridCellMin , const GridCellIndex < Dim < 1 > > & gridCellMax ) { int numCells = gridCellMax . xIndex ( ) - gridCellMin . xIndex ( ) + 1 ; CHECK ( numCells > 0 ) ; vector < GridCellIndex < Dim < 1 > > > result ; result . reserve ( numCells ) ; for ( int ix = gridCellMin . xIndex ( ) ; ix <= gridCellMax . xIndex ( ) ; ++ ix ) { result . push_back ( GridCellIndex < Dim < 1 > > ( ix ) ) ; CHECK ( ( int ) result . size ( ) <= numCells ) ; } return result ; }
Define a global function which returns a vector of GridCellIndex objects
within a given range of grid cells.
Define a global function which returns a vector of GridCellIndex objects within a given range of grid cells .