shawn::GridEdgeModel Class Reference

EdgeModel based on a geometric grid. More...

#include <grid_edge_model.h>

Inheritance diagram for shawn::GridEdgeModel:

Inheritance graph
[legend]
Collaboration diagram for shawn::GridEdgeModel:

Collaboration graph
[legend]

List of all members.

types & constants

static const int MAGIC_UNITIALIZED_NODE_CELL_X_
typedef std::set< Node * > NodeSet
typedef NodeSet::iterator node_set_iterator
typedef NodeSet::const_iterator const_node_set_iterator
class CellData

Public Member Functions

virtual void node_added (Node &) throw ()
 Is called whenever a node gets added to the world.
virtual void node_removed (Node &) throw ()
 Is called whenever a node gets removed from the world.
construction / destruction
 GridEdgeModel ()
virtual ~GridEdgeModel ()
EdgeModel interface
virtual int nof_adjacent_nodes (const Node &, CommunicationDirection d=CD_BIDI) const throw ()
virtual const_adjacency_iterator begin_adjacent_nodes (const Node &, CommunicationDirection d=CD_BIDI) const throw ()
virtual const_adjacency_iterator end_adjacent_nodes (const Node &) const throw ()
virtual adjacency_iterator begin_adjacent_nodes_w (Node &, CommunicationDirection d=CD_BIDI) throw ()
virtual adjacency_iterator end_adjacent_nodes_w (Node &) throw ()
Mobility interfaces
virtual Box observer_initial_zone (Node &, const Vec &pos, const Vec &velo) throw ()
virtual Box observer_update_zone (Node &, const Vec &newpos, const Vec &velo) throw ()
virtual bool supports_mobility (void) const throw ()
User configuration
void set_initial_size (int s) throw ( std::runtime_error )
void set_transmission_scale (double tm) throw ( std::runtime_error )
void set_closeness_fraction (double cf) throw ( std::runtime_error )

Static Public Attributes

environment parameter names
static const std::string INITIAL_GRID_SIZE_PARAMETER
static const std::string INITIAL_CELL_SIZE_PARAMETER
static const std::string CLOSENESS_FRACTION_PARAMETER

Classes

class  CellData
class  GridIteratorHelper
struct  NodeCell


Detailed Description

EdgeModel based on a geometric grid.

The GridEdgeModel uses a geometric grid for fast lookup of node positions. It is much faster than LazyEdgeModel, and it supports node mobility.

Configuration parameters are:

grid_size specifies roughly the initial size of the grid: it will consist of grid_size x grid_size cells.


Member Typedef Documentation

typedef std::set<Node*> shawn::GridEdgeModel::NodeSet

typedef NodeSet::iterator shawn::GridEdgeModel::node_set_iterator

typedef NodeSet::const_iterator shawn::GridEdgeModel::const_node_set_iterator


Constructor & Destructor Documentation

shawn::GridEdgeModel::GridEdgeModel (  ) 

virtual shawn::GridEdgeModel::~GridEdgeModel (  )  [virtual]


Member Function Documentation

virtual int shawn::GridEdgeModel::nof_adjacent_nodes ( const Node ,
CommunicationDirection  d = CD_BIDI 
) const throw () [virtual]

Implements shawn::EdgeModel.

virtual const_adjacency_iterator shawn::GridEdgeModel::begin_adjacent_nodes ( const Node ,
CommunicationDirection  d = CD_BIDI 
) const throw () [virtual]

Implements shawn::EdgeModel.

virtual const_adjacency_iterator shawn::GridEdgeModel::end_adjacent_nodes ( const Node  )  const throw () [virtual]

Implements shawn::EdgeModel.

virtual adjacency_iterator shawn::GridEdgeModel::begin_adjacent_nodes_w ( Node ,
CommunicationDirection  d = CD_BIDI 
) throw () [virtual]

Implements shawn::EdgeModel.

virtual adjacency_iterator shawn::GridEdgeModel::end_adjacent_nodes_w ( Node  )  throw () [virtual]

Implements shawn::EdgeModel.

virtual Box shawn::GridEdgeModel::observer_initial_zone ( Node ,
const Vec newpos,
const Vec velo 
) throw () [virtual]

Returns an initial bounding box. If a node leaves this box, observer_update_zone() must be called - by convention - by the observed movement to retrieve a new box.

Implements shawn::MovementObserver.

virtual Box shawn::GridEdgeModel::observer_update_zone ( Node ,
const Vec newpos,
const Vec velo 
) throw () [virtual]

Informs this Observer that the old box has been left by the NodeMovement / Node. A new box must be provided by this method.

Implements shawn::MovementObserver.

virtual bool shawn::GridEdgeModel::supports_mobility ( void   )  const throw () [virtual]

Implements shawn::EdgeModel.

virtual void shawn::GridEdgeModel::node_added ( Node  )  throw () [virtual]

Is called whenever a node gets added to the world.

Implements shawn::EdgeModel.

virtual void shawn::GridEdgeModel::node_removed ( Node  )  throw () [virtual]

Is called whenever a node gets removed from the world.

Implements shawn::EdgeModel.

void shawn::GridEdgeModel::set_initial_size ( int  s  )  throw ( std::runtime_error )

Sets the initial size of the grid to s x s . Must be called before the first node gets added.

s is rounded up to the next power of 2.

Controlled via env parameter grid_size

void shawn::GridEdgeModel::set_transmission_scale ( double  tm  )  throw ( std::runtime_error )

Sets the edge length of each grid cell to tm x CommunicationModel::communication_upper_bound(). Must be called before the first node gets added.

Argument must be greater than one.

Controlled via env parameter grid_cell_size

void shawn::GridEdgeModel::set_closeness_fraction ( double  cf  )  throw ( std::runtime_error )


Friends And Related Function Documentation

friend class CellData [friend]


Member Data Documentation

only exists in debugging versions. magic value to mark unused node_cells_[id].x so it can be detected if something screws up the correct order of add_node()/update_zone().


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

Generated on Sun Feb 5 00:00:51 2012 for Shawn by  doxygen 1.5.6