Representation of a grid where cells keep track of how many neighbors they have. More...

#include <ompl/datastructures/GridN.h>

Inheritance diagram for ompl::GridN< _T >:

Classes

struct  Cell
 Definition of a cell in this grid. More...
 

Public Types

using BaseCell = typename Grid< _T >::Cell
 Datatype for cell in base class.
 
using BaseCellArray = typename Grid< _T >::CellArray
 Datatype for array of cells in base class.
 
using Coord = typename Grid< _T >::Coord
 Datatype for cell coordinates.
 
using CellArray = std::vector< Cell * >
 The datatype for arrays of cells.
 
- Public Types inherited from ompl::Grid< _T >
using Coord = Eigen::VectorXi
 Definition of a coordinate within this grid.
 
using CellArray = std::vector< Cell * >
 The datatype for arrays of cells.
 
using iterator = typename CoordHash::const_iterator
 We only allow const iterators.
 

Public Member Functions

 GridN (unsigned int dimension)
 The constructor takes the dimension of the grid as argument.
 
void setDimension (unsigned int dimension)
 
void setBounds (const Coord &low, const Coord &up)
 
void setInteriorCellNeighborLimit (unsigned int count)
 
CellgetCell (const Coord &coord) const
 Get the cell at a specified coordinate.
 
void neighbors (const Cell *cell, CellArray &list) const
 Get the list of neighbors for a given cell.
 
void neighbors (const Coord &coord, CellArray &list) const
 Get the list of neighbors for a given coordinate.
 
void neighbors (Coord &coord, CellArray &list) const
 Get the list of neighbors for a given coordinate.
 
BaseCellcreateCell (const Coord &coord, BaseCellArray *nbh=nullptr) override
 
bool remove (BaseCell *cell) override
 
void getCells (CellArray &cells) const
 Get the set of instantiated cells in the grid.
 
- Public Member Functions inherited from ompl::Grid< _T >
 Grid (unsigned int dimension)
 The constructor takes the dimension of the grid as argument.
 
virtual ~Grid ()
 Destructor.
 
virtual void clear ()
 Clear all cells in the grid.
 
unsigned int getDimension () const
 Return the dimension of the grid.
 
void setDimension (unsigned int dimension)
 
bool has (const Coord &coord) const
 Check if a cell exists at the specified coordinate.
 
CellgetCell (const Coord &coord) const
 Get the cell at a specified coordinate.
 
void neighbors (const Cell *cell, CellArray &list) const
 Get the list of neighbors for a given cell.
 
void neighbors (const Coord &coord, CellArray &list) const
 Get the list of neighbors for a given coordinate.
 
void neighbors (Coord &coord, CellArray &list) const
 Get the list of neighbors for a given coordinate.
 
std::vector< std::vector< Cell * > > components () const
 Get the connected components formed by the cells in this grid (based on neighboring relation)
 
virtual CellcreateCell (const Coord &coord, CellArray *nbh=nullptr)
 
virtual bool remove (Cell *cell)
 
virtual void add (Cell *cell)
 Add an instantiated cell to the grid.
 
virtual void destroyCell (Cell *cell) const
 Clear the memory occupied by a cell; do not call this function unless remove() was called first.
 
void getContent (std::vector< _T > &content) const
 Get the data stored in the cells we are aware of.
 
void getCoordinates (std::vector< Coord * > &coords) const
 Get the set of coordinates where there are cells.
 
void getCells (CellArray &cells) const
 Get the set of instantiated cells in the grid.
 
void printCoord (Coord &coord, std::ostream &out=std::cout) const
 Print the value of a coordinate to a stream.
 
bool empty () const
 Check if the grid is empty.
 
unsigned int size () const
 Check the size of the grid.
 
virtual void status (std::ostream &out=std::cout) const
 Print information about the data in this grid structure.
 
iterator begin () const
 Return the begin() iterator for the grid.
 
iterator end () const
 Return the end() iterator for the grid.
 

Protected Member Functions

unsigned int numberOfBoundaryDimensions (const Coord &coord) const
 Compute how many sides of a coordinate touch the boundaries of the grid.
 
- Protected Member Functions inherited from ompl::Grid< _T >
void freeMemory ()
 Free the allocated memory.
 

Protected Attributes

bool hasBounds_
 Flag indicating whether bounds are in effect for this grid.
 
Coord lowBound_
 If bounds are set, this defines the lower corner cell.
 
Coord upBound_
 If bounds are set, this defines the upper corner cell.
 
unsigned int interiorCellNeighborsLimit_
 
bool overrideCellNeighborsLimit_
 
- Protected Attributes inherited from ompl::Grid< _T >
unsigned int dimension_
 The dimension of the grid.
 
unsigned int maxNeighbors_
 The maximum number of neighbors a cell can have (2 * dimension)
 
CoordHash hash_
 The hash holding the cells.
 

Additional Inherited Members

- Protected Types inherited from ompl::Grid< _T >
using CoordHash = std::unordered_map< Coord *, Cell *, HashFunCoordPtr, EqualCoordPtr >
 Define the datatype for the used hash structure.
 

Detailed Description

template<typename _T>
class ompl::GridN< _T >

Representation of a grid where cells keep track of how many neighbors they have.

Definition at line 78 of file GridN.h.

Member Function Documentation

◆ createCell()

template<typename _T >
BaseCell* ompl::GridN< _T >::createCell ( const Coord coord,
BaseCellArray nbh = nullptr 
)
inlineoverride

Instantiate a new cell at given coordinates; Optionally return the list of future neighbors. Note: this call only creates the cell, but does not add it to the grid. It however updates the neighbor count for neighboring cells

Definition at line 221 of file GridN.h.

◆ remove()

template<typename _T >
bool ompl::GridN< _T >::remove ( BaseCell cell)
inlineoverride

Remove a cell from the grid. If the cell has not been Added to the grid, only update the neighbor list

Definition at line 249 of file GridN.h.

◆ setBounds()

template<typename _T >
void ompl::GridN< _T >::setBounds ( const Coord low,
const Coord up 
)
inline

If bounds for the grid need to be considered, we can set them here. When the number of neighbors are counted, whether the Space is bounded matters, in the sense that if a cell is on the boundary, we know some of its neighbors cannot exist. In order to allow such a cell to reflect the fact it has Achieved its maximal number of neighbors, the boundary is counted as the number of neighbors it prevents from existing.

Definition at line 170 of file GridN.h.

◆ setDimension()

template<typename _T >
void ompl::GridN< _T >::setDimension ( unsigned int  dimension)
inline

Update the dimension of the grid; this should not be done unless the grid is empty

Definition at line 153 of file GridN.h.

◆ setInteriorCellNeighborLimit()

template<typename _T >
void ompl::GridN< _T >::setInteriorCellNeighborLimit ( unsigned int  count)
inline

Set the limit of neighboring cells to determine when a cell becomes interior by default, this is 2 * dimension of grid

Definition at line 179 of file GridN.h.

Member Data Documentation

◆ interiorCellNeighborsLimit_

template<typename _T >
unsigned int ompl::GridN< _T >::interiorCellNeighborsLimit_
protected

By default, cells are considered on the border if 2n neighbors are created, for a space of dimension n. this value is overridden and set in this member variable

Definition at line 306 of file GridN.h.

◆ overrideCellNeighborsLimit_

template<typename _T >
bool ompl::GridN< _T >::overrideCellNeighborsLimit_
protected

Flag indicating whether the neighbor count used to determine whether a cell is on the border or not

Definition at line 310 of file GridN.h.


The documentation for this class was generated from the following file: