Template Class Grid
Defined in File Grid.h
Nested Relationships
Nested Types
Inheritance Relationships
Derived Types
public ompl::GridN< CellData * >
(Template Class GridN)public ompl::GridN< _T >
(Template Class GridN)
Class Documentation
-
template<typename _T>
class Grid Representation of a simple grid.
Subclassed by ompl::GridN< CellData * >, ompl::GridN< _T >
Public Types
-
using Coord = Eigen::VectorXi
Definition of a coordinate within this grid.
Public Functions
-
inline explicit Grid(unsigned int dimension)
The constructor takes the dimension of the grid as argument.
-
inline virtual ~Grid()
Destructor.
-
inline virtual void clear()
Clear all cells in the grid.
-
inline unsigned int getDimension() const
Return the dimension of the grid.
-
inline void setDimension(unsigned int dimension)
Update the dimension of the grid; this should not be done unless the grid is empty
-
inline void neighbors(const Cell *cell, CellArray &list) const
Get the list of neighbors for a given cell.
-
inline void neighbors(const Coord &coord, CellArray &list) const
Get the list of neighbors for a given coordinate.
-
inline void neighbors(Coord &coord, CellArray &list) const
Get the list of neighbors for a given coordinate.
-
inline std::vector<std::vector<Cell*>> components() const
Get the connected components formed by the cells in this grid (based on neighboring relation)
-
inline virtual Cell *createCell(const Coord &coord, CellArray *nbh = nullptr)
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
-
inline virtual bool remove(Cell *cell)
Remove a cell from the grid. If the cell has not been Added to the grid, only update the neighbor list
-
inline virtual void destroyCell(Cell *cell) const
Clear the memory occupied by a cell; do not call this function unless remove() was called first.
-
inline void getContent(std::vector<_T> &content) const
Get the data stored in the cells we are aware of.
-
inline void getCoordinates(std::vector<Coord*> &coords) const
Get the set of coordinates where there are cells.
-
inline void printCoord(Coord &coord, std::ostream &out = std::cout) const
Print the value of a coordinate to a stream.
-
inline bool empty() const
Check if the grid is empty.
-
inline unsigned int size() const
Check the size of the grid.
-
inline virtual void status(std::ostream &out = std::cout) const
Print information about the data in this grid structure.
Protected Types
-
using CoordHash = std::unordered_map<Coord*, Cell*, HashFunCoordPtr, EqualCoordPtr>
Define the datatype for the used hash structure.
Protected Functions
-
inline void freeMemory()
Free the allocated memory.
Protected Attributes
-
unsigned int dimension_
The dimension of the grid.
-
unsigned int maxNeighbors_
The maximum number of neighbors a cell can have (2 * dimension)
-
struct Cell
Definition of a cell in this grid.
-
struct EqualCoordPtr
Equality operator for coordinate pointers.
-
struct HashFunCoordPtr
Hash function for coordinates; see http://www.cs.hmc.edu/~geoff/classes/hmc.cs070.200101/homework10/hashfuncs.html
-
struct SortComponents
Helper to sort components by size.
-
using Coord = Eigen::VectorXi