fpmas 1.6
Public Member Functions | Static Public Member Functions | List of all members
fpmas::model::GraphRange< GraphCellType > Class Template Reference

#include <graph.h>

Inheritance diagram for fpmas::model::GraphRange< GraphCellType >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::model::GraphRange< GraphCellType >:
Collaboration graph
[legend]

Public Member Functions

 GraphRange (bool include_location=INCLUDE_LOCATION)
 
std::size_t radius (GraphCellType *) const override
 
bool contains (GraphCellType *root, GraphCellType *cell) const override
 
- Public Member Functions inherited from fpmas::api::model::Range< GraphCell >
virtual bool contains (GraphCell *root, GraphCell *cell) const=0
 
virtual std::size_t radius (GraphCell *origin) const=0
 

Static Public Member Functions

static void synchronize (api::model::SpatialModel< GraphCellType > &model)
 

Detailed Description

template<typename GraphCellType = GraphCell>
class fpmas::model::GraphRange< GraphCellType >

A GraphCell based api::model::Range implementation.

The specified GraphCellType is assumed to extend the two following classes:

  1. api::model::Cell
  2. ReachableCell

A cell is assumed to be contained in this GraphRange, centered in root, if and only if the cell id is contained in the reachable_cells list of the root.

It is currently assumed that ids contained in the reachable_cells list are direct neighbors of the root on the CELL_SUCCESSOR, what means that a cell at a distance of 2 (in term of graph distance) from root can't be added to the range. This behavior might evolve in the future.

The special case cell==root is handled according to the include_location parameter, specified in the constructor.

In order to be usable, is it required to call the synchronize() method after the corresponding SpatialModel initialization, but before any SpatialAgent execution. This requirement will probably be relaxed in a next release.

Constructor & Destructor Documentation

◆ GraphRange()

template<typename GraphCellType = GraphCell>
fpmas::model::GraphRange< GraphCellType >::GraphRange ( bool  include_location = INCLUDE_LOCATION)
inline

GraphRange constructor.

Parameters
include_locationspecifies if the current location of the SpatialAgent (assumed to be root) must be included in this GraphRange

Member Function Documentation

◆ radius()

template<typename GraphCellType = GraphCell>
std::size_t fpmas::model::GraphRange< GraphCellType >::radius ( GraphCellType *  ) const
inlineoverride

Radius of the GraphRange.

Since it is assumed that only direct neighbors of a root on the CELL_SUCCESSOR layer can be added to its reachable_cells collection, the radius of this range is 1.

Returns
radius of this GraphRange (always 1)

◆ contains()

template<typename GraphCellType = GraphCell>
bool fpmas::model::GraphRange< GraphCellType >::contains ( GraphCellType *  root,
GraphCellType *  cell 
) const
inlineoverride

If root==cell:

  • returns true iff include_location is true. Else:
  • returns true iff the cell id is contained in the reachable_cells list of root
Returns
true iff cell is contained in this GraphRange, located on root.

◆ synchronize()

template<typename GraphCellType = GraphCell>
static void fpmas::model::GraphRange< GraphCellType >::synchronize ( api::model::SpatialModel< GraphCellType > &  model)
inlinestatic

Automatically updates the reachable_cells list of GraphCells contained in the specified model.

All out neighbors cells on the CELL_SUCCESSOR layer of each GraphCell are added to its reachable_cells list.

The synchronization can be performed dynamically if the GraphCell network evolves during the simulation.

This method is synchronous, and must be called from all processes.

Parameters
modelinitialized SpatialModel, based on a GraphCell network.

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