37 #ifndef OMPL_DATASTRUCTURES_GRID_N_
38 #define OMPL_DATASTRUCTURES_GRID_N_
40 #include "ompl/datastructures/Grid.h"
45 template <
typename _T>
46 class GridN :
public Grid<_T>
50 using BaseCell =
typename Grid<_T>::Cell;
69 ~Cell()
override =
default;
76 explicit GridN(
unsigned int dimension) :
Grid<_T>(dimension)
83 ~
GridN()
override =
default;
145 list.reserve(list.size() + baselist.size());
146 for (
unsigned int i = 0; i < baselist.size(); ++i)
147 list.push_back(
static_cast<Cell *
>(baselist[i]));
157 auto *cell =
new Cell();
163 for (
auto cl = list->begin(); cl != list->end(); ++cl)
165 auto *c =
static_cast<Cell *
>(*cl);
173 cell->border =
false;
189 for (
auto cl = list->begin(); cl != list->end(); ++cl)
191 auto *c =
static_cast<Cell *
>(*cl);
211 cells.push_back(
static_cast<Cell *
>(i->second));
218 unsigned int result = 0;
221 for (
unsigned int i = 0; i < Grid<_T>::dimension_; ++i)
std::vector< Cell * > CellArray
The datatype for arrays of cells.
iterator begin() const
Return the begin() iterator for the grid.
typename Grid< _T >::Cell BaseCell
Datatype for cell in base class.
typename Grid< _T >::CellArray BaseCellArray
Datatype for array of cells in base class.
bool hasBounds_
Flag indicating whether bounds are in effect for this grid.
bool remove(BaseCell *cell) override
Grid(unsigned int dimension)
The constructor takes the dimension of the grid as argument.
void getCells(CellArray &cells) const
Get the set of instantiated cells in the grid.
void neighbors(const Cell *cell, CellArray &list) const
Get the list of neighbors for a given cell.
Cell * getCell(const Coord &coord) const
Get the cell at a specified coordinate.
typename Grid< _T >::Coord Coord
Datatype for cell coordinates.
std::vector< Cell * > CellArray
The datatype for arrays of cells.
unsigned int numberOfBoundaryDimensions(const Coord &coord) const
Compute how many sides of a coordinate touch the boundaries of the grid.
Definition of a cell in this grid.
std::vector< int > Coord
Definition of a coordinate within this grid.
BaseCell * createCell(const Coord &coord, BaseCellArray *nbh=nullptr) override
Coord upBound_
If bounds are set, this defines the upper corner cell.
void setBounds(const Coord &low, const Coord &up)
unsigned int neighbors
The number of neighbors.
void neighbors(const Cell *cell, CellArray &list) const
Get the list of neighbors for a given cell.
unsigned int interiorCellNeighborsLimit_
void setInteriorCellNeighborLimit(unsigned int count)
iterator end() const
Return the end() iterator for the grid.
bool overrideCellNeighborsLimit_
void setDimension(unsigned int dimension)
Cell * getCell(const Coord &coord) const
Get the cell at a specified coordinate.
GridN(unsigned int dimension)
The constructor takes the dimension of the grid as argument.
Coord lowBound_
If bounds are set, this defines the lower corner cell.
Representation of a grid where cells keep track of how many neighbors they have.
Representation of a simple grid.
Main namespace. Contains everything in this library.
bool border
A flag indicating whether this cell is on the border or not.