Loading...
Searching...
No Matches

This class defines a grid that keeps track of its boundary: it distinguishes between interior and exterior cells.
More...

#include <ompl/datastructures/GridB.h>

Inheritance diagram for ompl::GridB< _T, LessThanExternal, LessThanInternal >:

Classes

struct  LessThanExternalCell
 Define order for external cells. More...
 
struct  LessThanInternalCell
 Define order for internal cells. More...
 

Public Types

using Cell = typename GridN<_T>::Cell
 Definition of a cell in this grid.
 
using CellArray = typename GridN<_T>::CellArray
 The datatype for arrays of cells.
 
using Coord = typename GridN<_T>::Coord
 Datatype for cell coordinates.
 
using EventCellUpdate = void (*)(Cell *, void *)
 Event to be called when a cell's priority is to be updated.
 
- Public Types inherited from ompl::GridN< _T >
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

 GridB (unsigned int dimension)
 Constructor.
 
void onCellUpdate (EventCellUpdate event, void *arg)
 
CelltopInternal () const
 Return the cell that is at the top of the heap maintaining internal cells.
 
CelltopExternal () const
 Return the cell that is at the top of the heap maintaining external cells.
 
unsigned int countInternal () const
 Return the number of internal cells.
 
unsigned int countExternal () const
 Return the number of external cells.
 
double fracExternal () const
 Return the fraction of external cells.
 
double fracInternal () const
 Return the fraction of internal cells.
 
void update (Cell *cell)
 Update the position in the heaps for a particular cell.
 
void updateAll ()
 Update all cells and reconstruct the heaps.
 
virtual CellcreateCell (const Coord &coord, CellArray *nbh=nullptr)
 Create a cell but do not add it to the grid; update neighboring cells however.
 
virtual void add (Cell *cell)
 Add the cell to the grid.
 
virtual bool remove (Cell *cell)
 Remove a cell from the grid.
 
void clear () override
 Clear all cells in the grid.
 
void status (std::ostream &out=std::cout) const override
 Print information about the data in this grid structure.
 
- Public Member Functions inherited from ompl::GridN< _T >
 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.
 
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 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.
 
iterator begin () const
 Return the begin() iterator for the grid.
 
iterator end () const
 Return the end() iterator for the grid.
 

Protected Types

using internalBHeap = BinaryHeap<CellX *, LessThanInternalCell>
 Datatype for a heap of cells containing interior cells.
 
using externalBHeap = BinaryHeap<CellX *, LessThanExternalCell>
 Datatype for a heap of cells containing exterior cells.
 
- Protected Types inherited from ompl::Grid< _T >
using CoordHash = std::unordered_map<Coord *, Cell *, HashFunCoordPtr, EqualCoordPtr>
 Define the datatype for the used hash structure.
 

Protected Member Functions

void setupHeaps ()
 Set the update procedure for the heaps of internal and external cells.
 
void clearHeaps ()
 Clear the data from both heaps.
 
- Protected Member Functions inherited from ompl::GridN< _T >
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.
 

Static Protected Member Functions

static void noCellUpdate (Cell *, void *)
 Default no-op update routine for a cell.
 
static void setHeapElementI (typename internalBHeap::Element *element, void *)
 Routine used internally for keeping track of binary heap elements for internal cells.
 
static void setHeapElementE (typename externalBHeap::Element *element, void *)
 Routine used internally for keeping track of binary heap elements for external cells.
 

Protected Attributes

EventCellUpdate eventCellUpdate_
 Pointer to function to be called when a cell needs to be updated.
 
void * eventCellUpdateData_
 Data to be passed to function pointer above.
 
internalBHeap internal_
 The heap of interior cells.
 
externalBHeap external_
 The heap of external cells.
 
- Protected Attributes inherited from ompl::GridN< _T >
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.
 

Detailed Description

template<typename _T, class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
class ompl::GridB< _T, LessThanExternal, LessThanInternal >

This class defines a grid that keeps track of its boundary: it distinguishes between interior and exterior cells.

Definition at line 51 of file GridB.h.

Member Typedef Documentation

◆ Cell

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
using ompl::GridB< _T, LessThanExternal, LessThanInternal >::Cell = typename GridN<_T>::Cell

Definition of a cell in this grid.

Definition at line 55 of file GridB.h.

◆ CellArray

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
using ompl::GridB< _T, LessThanExternal, LessThanInternal >::CellArray = typename GridN<_T>::CellArray

The datatype for arrays of cells.

Definition at line 58 of file GridB.h.

◆ Coord

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
using ompl::GridB< _T, LessThanExternal, LessThanInternal >::Coord = typename GridN<_T>::Coord

Datatype for cell coordinates.

Definition at line 61 of file GridB.h.

◆ EventCellUpdate

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
using ompl::GridB< _T, LessThanExternal, LessThanInternal >::EventCellUpdate = void (*)(Cell *, void *)

Event to be called when a cell's priority is to be updated.

Definition at line 84 of file GridB.h.

◆ externalBHeap

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
using ompl::GridB< _T, LessThanExternal, LessThanInternal >::externalBHeap = BinaryHeap<CellX *, LessThanExternalCell>
protected

Datatype for a heap of cells containing exterior cells.

Definition at line 341 of file GridB.h.

◆ internalBHeap

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
using ompl::GridB< _T, LessThanExternal, LessThanInternal >::internalBHeap = BinaryHeap<CellX *, LessThanInternalCell>
protected

Datatype for a heap of cells containing interior cells.

Definition at line 338 of file GridB.h.

Constructor & Destructor Documentation

◆ GridB()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
ompl::GridB< _T, LessThanExternal, LessThanInternal >::GridB ( unsigned int dimension)
inlineexplicit

Constructor.

Definition at line 87 of file GridB.h.

◆ ~GridB()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
ompl::GridB< _T, LessThanExternal, LessThanInternal >::~GridB ( )
inlineoverride

Definition at line 92 of file GridB.h.

Member Function Documentation

◆ add()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
virtual void ompl::GridB< _T, LessThanExternal, LessThanInternal >::add ( Cell * cell)
inlinevirtual

Add the cell to the grid.

Definition at line 210 of file GridB.h.

◆ clear()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
void ompl::GridB< _T, LessThanExternal, LessThanInternal >::clear ( )
inlineoverridevirtual

Clear all cells in the grid.

Reimplemented from ompl::Grid< _T >.

Definition at line 272 of file GridB.h.

◆ clearHeaps()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
void ompl::GridB< _T, LessThanExternal, LessThanInternal >::clearHeaps ( )
inlineprotected

Clear the data from both heaps.

Definition at line 307 of file GridB.h.

◆ countExternal()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
unsigned int ompl::GridB< _T, LessThanExternal, LessThanInternal >::countExternal ( ) const
inline

Return the number of external cells.

Definition at line 126 of file GridB.h.

◆ countInternal()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
unsigned int ompl::GridB< _T, LessThanExternal, LessThanInternal >::countInternal ( ) const
inline

Return the number of internal cells.

Definition at line 120 of file GridB.h.

◆ createCell()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
virtual Cell * ompl::GridB< _T, LessThanExternal, LessThanInternal >::createCell ( const Coord & coord,
CellArray * nbh = nullptr )
inlinevirtual

Create a cell but do not add it to the grid; update neighboring cells however.

Reimplemented from ompl::Grid< _T >.

Definition at line 167 of file GridB.h.

◆ fracExternal()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
double ompl::GridB< _T, LessThanExternal, LessThanInternal >::fracExternal ( ) const
inline

Return the fraction of external cells.

Definition at line 132 of file GridB.h.

◆ fracInternal()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
double ompl::GridB< _T, LessThanExternal, LessThanInternal >::fracInternal ( ) const
inline

Return the fraction of internal cells.

Definition at line 138 of file GridB.h.

◆ noCellUpdate()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
static void ompl::GridB< _T, LessThanExternal, LessThanInternal >::noCellUpdate ( Cell * ,
void *  )
inlinestaticprotected

Default no-op update routine for a cell.

Definition at line 293 of file GridB.h.

◆ onCellUpdate()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
void ompl::GridB< _T, LessThanExternal, LessThanInternal >::onCellUpdate ( EventCellUpdate event,
void * arg )
inline

Set the function callback and to be called when a cell's priority is updated

Definition at line 99 of file GridB.h.

◆ remove()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
virtual bool ompl::GridB< _T, LessThanExternal, LessThanInternal >::remove ( Cell * cell)
inlinevirtual

Remove a cell from the grid.

Definition at line 224 of file GridB.h.

◆ setHeapElementE()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
static void ompl::GridB< _T, LessThanExternal, LessThanInternal >::setHeapElementE ( typename externalBHeap::Element * element,
void *  )
inlinestaticprotected

Routine used internally for keeping track of binary heap elements for external cells.

Definition at line 350 of file GridB.h.

◆ setHeapElementI()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
static void ompl::GridB< _T, LessThanExternal, LessThanInternal >::setHeapElementI ( typename internalBHeap::Element * element,
void *  )
inlinestaticprotected

Routine used internally for keeping track of binary heap elements for internal cells.

Definition at line 344 of file GridB.h.

◆ setupHeaps()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
void ompl::GridB< _T, LessThanExternal, LessThanInternal >::setupHeaps ( )
inlineprotected

Set the update procedure for the heaps of internal and external cells.

Definition at line 298 of file GridB.h.

◆ status()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
void ompl::GridB< _T, LessThanExternal, LessThanInternal >::status ( std::ostream & out = std::cout) const
inlineoverridevirtual

Print information about the data in this grid structure.

Reimplemented from ompl::Grid< _T >.

Definition at line 278 of file GridB.h.

◆ topExternal()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
Cell * ompl::GridB< _T, LessThanExternal, LessThanInternal >::topExternal ( ) const
inline

Return the cell that is at the top of the heap maintaining external cells.

Definition at line 113 of file GridB.h.

◆ topInternal()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
Cell * ompl::GridB< _T, LessThanExternal, LessThanInternal >::topInternal ( ) const
inline

Return the cell that is at the top of the heap maintaining internal cells.

Definition at line 106 of file GridB.h.

◆ update()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
void ompl::GridB< _T, LessThanExternal, LessThanInternal >::update ( Cell * cell)
inline

Update the position in the heaps for a particular cell.

Definition at line 144 of file GridB.h.

◆ updateAll()

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
void ompl::GridB< _T, LessThanExternal, LessThanInternal >::updateAll ( )
inline

Update all cells and reconstruct the heaps.

Definition at line 156 of file GridB.h.

Member Data Documentation

◆ eventCellUpdate_

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
EventCellUpdate ompl::GridB< _T, LessThanExternal, LessThanInternal >::eventCellUpdate_
protected

Pointer to function to be called when a cell needs to be updated.

Definition at line 287 of file GridB.h.

◆ eventCellUpdateData_

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
void* ompl::GridB< _T, LessThanExternal, LessThanInternal >::eventCellUpdateData_
protected

Data to be passed to function pointer above.

Definition at line 290 of file GridB.h.

◆ external_

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
externalBHeap ompl::GridB< _T, LessThanExternal, LessThanInternal >::external_
protected

The heap of external cells.

Definition at line 359 of file GridB.h.

◆ internal_

template<typename _T , class LessThanExternal = std::less<_T>, class LessThanInternal = LessThanExternal>
internalBHeap ompl::GridB< _T, LessThanExternal, LessThanInternal >::internal_
protected

The heap of interior cells.

Definition at line 356 of file GridB.h.


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