fpmas 1.6
Public Member Functions | List of all members
fpmas::model::GridRange< GridConfig, GridRangeConfig > Class Template Reference

#include <grid.h>

Inheritance diagram for fpmas::model::GridRange< GridConfig, GridRangeConfig >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::model::GridRange< GridConfig, GridRangeConfig >:
Collaboration graph
[legend]

Public Member Functions

 GridRange (DiscreteCoordinate size)
 
DiscreteCoordinate getSize () const
 
void setSize (DiscreteCoordinate size)
 
bool contains (typename GridConfig::CellType *location_cell, typename GridConfig::CellType *cell) const override
 
std::size_t radius (typename GridConfig::CellType *) const override
 
- Public Member Functions inherited from fpmas::api::model::Range< GridConfig::CellType >
virtual bool contains (GridConfig::CellType *root, GridConfig::CellType *cell) const=0
 
virtual std::size_t radius (GridConfig::CellType *origin) const=0
 

Detailed Description

template<typename GridConfig, typename GridRangeConfig>
class fpmas::model::GridRange< GridConfig, GridRangeConfig >

A generic api::model::Range implementation for Grid environments.

The corresponding ranges are uniform ranges constructed using a size threshold and the GridRangeConfig::Distance function object.

Formally a GridRange range centered on p1 is constituted by any point of the Grid p such that GridRangeConfig::Distance()(p1, p) <= range.getSize().

Notice the two following cases:

Template Parameters
GridConfiggrid configuration, that notably defines how a distance between two cells of the grid can be computed, using the GridConfig::Distance function object. The type GridConfig::CellType also defines which type of cells are used to define the Grid.
GridRangeConfiggrid range configuration. The GridRangeConfig::Distance member type is used to define the shape of the range, independently of the current GridConfig. The GridRangeConfig::Perimeter member type is used to define the perimeter of the range.

Constructor & Destructor Documentation

◆ GridRange()

template<typename GridConfig , typename GridRangeConfig >
fpmas::model::GridRange< GridConfig, GridRangeConfig >::GridRange ( DiscreteCoordinate  size)
inline

GridRange constructor.

Parameters
sizeinitial size

Member Function Documentation

◆ getSize()

template<typename GridConfig , typename GridRangeConfig >
DiscreteCoordinate fpmas::model::GridRange< GridConfig, GridRangeConfig >::getSize ( ) const
inline

Returns the size of this range.

Returns
current range size

◆ setSize()

template<typename GridConfig , typename GridRangeConfig >
void fpmas::model::GridRange< GridConfig, GridRangeConfig >::setSize ( DiscreteCoordinate  size)
inline

Sets the size of this range.

This can be used to dynamically update mobility or perception ranges of SpatialAgents during the simulation of a Model.

Parameters
sizenew range size

◆ contains()

template<typename GridConfig , typename GridRangeConfig >
bool fpmas::model::GridRange< GridConfig, GridRangeConfig >::contains ( typename GridConfig::CellType location_cell,
typename GridConfig::CellType cell 
) const
inlineoverride

Returns true if and only if the distance from location_cell->location() to cell->location(), computed using a RangeConfig::Distance instance, is less than or equal to the current range size.

Parameters
location_cellrange center
cellcell to check
Returns
true iff cell is in this range

◆ radius()

template<typename GridConfig , typename GridRangeConfig >
std::size_t fpmas::model::GridRange< GridConfig, GridRangeConfig >::radius ( typename GridConfig::CellType ) const
inlineoverride

Returns the Radius of the current range, depending on the current GridConfig and RangeConfig.

Possible implementation:

std::size_t radius(api::model::GridCell*) const override {
return typename GridConfig::Distance()({0, 0}, typename GridConfig::Perimeter()(*this));
}
std::size_t radius(typename GridConfig::CellType *) const override
Definition: grid.h:697
DistanceType Distance
Definition: grid.h:533

See the fpmas::api::model::Range::radius() documentation for more details about what a "range radius" is.


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