RepastHPC  2.3.1
Public Member Functions | Protected Member Functions | Friends | List of all members
repast::SharedNetwork< V, E, Ec, EcM > Class Template Reference

Network implementation that can be shared across processes. More...

#include <SharedNetwork.h>

Inheritance diagram for repast::SharedNetwork< V, E, Ec, EcM >:
repast::Graph< V, E, Ec, EcM > repast::Projection< V >

Public Member Functions

 SharedNetwork (std::string name, bool directed, EcM *edgeContentMgr)
 Creates a SharedNetwork with the specified name and whether or not the network is directed. More...
 
void addSender (int rank)
 NON USER API. More...
 
void removeSender (int rank)
 NON USER API Decrements the count of edges that are sent from rank to this network.
 
void removeEdge (V *source, V *target)
 Removes the edge between source and target from this Graph. More...
 
void addEdge (boost::shared_ptr< E > edge)
 Add an edge to this SharedNetwork. More...
 
void synchRemovedEdges ()
 Synchronizes any removed edges that are have been copied across processes.
 
virtual bool isMaster (E *e)
 Returns true if this is a master link; will be a master link if its master node is local. More...
 
- Public Member Functions inherited from repast::Graph< V, E, Ec, EcM >
 Graph (std::string name, bool directed, EcM *edgeContentMgr)
 Creates a Graph with the specified name. More...
 
 Graph (const Graph< V, E, Ec, EcM > &graph)
 Copy constructor for the graph.
 
Graphoperator= (const Graph &graph)
 
virtual boost::shared_ptr< E > addEdge (V *source, V *target)
 Adds an edge between source and target to this Graph. More...
 
virtual boost::shared_ptr< E > addEdge (V *source, V *target, double weight)
 Adds an edge with the specified weight between source and target to this Graph. More...
 
virtual boost::shared_ptr< E > findEdge (V *source, V *target)
 Gets the edge between the source and target or 0 if no such edge is found. More...
 
virtual void successors (V *vertex, std::vector< V * > &out)
 Gets the sucessors of the specified vertex and puts them in out. More...
 
virtual void predecessors (V *vertex, std::vector< V * > &out)
 Gets the predecessors of the specified vertex and puts them in out. More...
 
virtual void adjacent (V *vertex, std::vector< V * > &out)
 Gets all the agent adjacent to the specified vertex. More...
 
virtual void removeEdge (const AgentId &source, const AgentId &target)
 Removes the edge between source and target from this Graph. More...
 
virtual int inDegree (V *vertex)
 Gets the in-degree of the specified vertex. More...
 
virtual int outDegree (V *vertex)
 Gets the out-degree of the specified vertex. More...
 
int edgeCount () const
 Gets the number of edges in this Graph. More...
 
int vertexCount () const
 Gets the number of vertices in this Graph. More...
 
vertex_iterator verticesBegin ()
 Gets the start of an iterator over all the vertices in this graph. More...
 
vertex_iterator verticesEnd ()
 Gets the end of an iterator over all the vertices in this graph. More...
 
void showEdges ()
 
virtual bool keepsAgentsOnSyncProj ()
 Should return true if the Projection implemented can 'keep' some (non-local) agents during a projection information synchronization operation. More...
 
virtual bool sendsSecondaryAgentsOnStatusExchange ()
 Should return true if the Projection implemented will send secondary agents during a status exchange. More...
 
virtual void getInfoExchangePartners (std::set< int > &psToSendTo, std::set< int > &psToReceiveFrom)
 Gets the set of processes with which this Projection exchanges projection info. More...
 
virtual void getAgentStatusExchangePartners (std::set< int > &psToSendTo, std::set< int > &psToReceiveFrom)
 Gets the set of processes with which this Projection exchanges agent status info- that is, the set of processes from which agents can move to this one or to which they can move when moving from this one. More...
 
virtual void getProjectionInfo (std::vector< AgentId > &agents, std::vector< ProjectionInfoPacket * > &packets, bool secondaryInfo=false, std::set< AgentId > *secondaryIds=0, int destProc=-1)
 Convenience wrapper that gets all of the projection information for the agents specified (calls implementation in child class that gets only the information for one agent).
 
virtual ProjectionInfoPacketgetProjectionInfo (AgentId id, bool secondaryInfo=false, std::set< AgentId > *secondaryIds=0, int destProc=-1)
 
virtual void updateProjectionInfo (ProjectionInfoPacket *pip, Context< V > *context)
 
virtual void getRequiredAgents (std::set< AgentId > &agentsToTest, std::set< AgentId > &agentsRequired, RADIUS radius=Projection< V >::PRIMARY)
 
virtual void getAgentsToPush (std::set< AgentId > &agentsToTest, std::map< int, std::set< AgentId > > &agentsToPush)
 Given a set of agents, gets the agents that this projection implementation must 'push' to other processes. More...
 
virtual void cleanProjectionInfo (std::set< AgentId > &agentsToKeep)
 
void clearConflictedEdges ()
 
void getConflictedEdges (std::set< boost::shared_ptr< E > > &conflictedEdges)
 
- Public Member Functions inherited from repast::Projection< V >
void updateProjectionInfo (std::vector< ProjectionInfoPacket * > &pips, Context< V > *context)
 Updates the projection information for the agents in this projection according to the information contained in the vector of information packets passed.
 
 Projection (std::string name)
 Creates a projection with specified name. More...
 
const std::string name () const
 Gets the name of this projection.
 
void addFilterVal (int type)
 Adds an entry to the list of agent types that can be added to this projection. More...
 
void removeFilterVal (int type)
 Removes an entry from the list of agent types that can be added to this projection. More...
 
void clearFilter ()
 Clears the list of agent types that can be added to this projection; the result is that the filter is empty, and any agent can be added.
 
bool agentCanBeAdded (boost::shared_ptr< V > agent)
 Returns true if the agent can be added to the projection, which will be the case if the filter list is empty or if the agent's type is in the filter list. More...
 
virtual void getRequiredAgents (std::set< AgentId > &agentsToTest, std::set< AgentId > &agentsRequired, RADIUS radius=PRIMARY)=0
 Given a set of agents to test, gets the subset that must be kept in order to fulfill the projection's 'contract' to the specified radius. More...
 
virtual void balance ()
 

Protected Member Functions

virtual bool addAgent (boost::shared_ptr< V > agent)
 
virtual void removeAgent (V *agent)
 
virtual void doAddEdge (boost::shared_ptr< E > edge)
 
- Protected Member Functions inherited from repast::Graph< V, E, Ec, EcM >
void cleanUp ()
 
void init (const Graph &graph)
 
virtual void doAddEdge (boost::shared_ptr< E > edge, bool allowOverwrite=true)
 

Friends

template<typename Vertex , typename Edge , typename AgentContent , typename EdgeContent , typename EdgeManager , typename AgentCreator >
void createComplementaryEdges (SharedNetwork< Vertex, Edge, EdgeContent, EdgeManager > *net, SharedContext< Vertex > &context, EdgeManager &edgeManager, AgentCreator &creator)
 
template<typename Vertex , typename Edge , typename EdgeContent , typename EdgeManager >
void synchEdges (SharedNetwork< Vertex, Edge, EdgeContent, EdgeManager > *, EdgeManager &)
 

Additional Inherited Members

- Public Types inherited from repast::Graph< V, E, Ec, EcM >
typedef boost::transform_iterator< NodeGetter< V, E >, typename VertexMap::const_iterator > vertex_iterator
 An iterator over the agents that are the vertices in this Graph.
 
- Public Types inherited from repast::Projection< V >
enum  RADIUS
 
- Public Attributes inherited from repast::Graph< V, E, Ec, EcM >
std::set< int > ranksToSendProjInfoTo
 
std::set< int > ranksToReceiveProjInfoFrom
 
std::set< int > ranksToSendAgentStatusInfoTo
 
std::set< int > ranksToReceiveAgentStatusInfoFrom
 
bool keepsAgents
 
bool sendsSecondaryAgents
 
- Protected Types inherited from repast::Graph< V, E, Ec, EcM >
typedef boost::unordered_map< AgentId, Vertex< V, E > *, HashIdVertexMap
 
typedef VertexMap::iterator VertexMapIterator
 
typedef Projection< V >::RADIUS RADIUS
 
- Protected Attributes inherited from repast::Graph< V, E, Ec, EcM >
int edgeCount_
 
bool isDirected
 
VertexMap vertices
 
EcM * edgeContentManager
 
- Protected Attributes inherited from repast::Projection< V >
std::string name_
 
std::set< int > filter
 

Detailed Description

template<typename V, typename E, typename Ec, typename EcM>
class repast::SharedNetwork< V, E, Ec, EcM >

Network implementation that can be shared across processes.

Networks are shared across processes by creating edges between local and non-local agents on a process. The createComplementaryEdges function will create complementary edges across processes in those cases. For example, if an edge is created between A1 and B2 on process 1 where B2 is copy of B1 on process 2, then creating complementary edges will create a copy of that edge on process 2, importing A1 into process 2 if necessary.

Template Parameters
Vthe agent (vertex) type
Ethe edge type. The edge type must be contain a constructor that takes a source and target of type V and extends RepastEdge. RepastEdge can also be used.

Constructor & Destructor Documentation

◆ SharedNetwork()

template<typename V , typename E , typename Ec , typename EcM >
repast::SharedNetwork< V, E, Ec, EcM >::SharedNetwork ( std::string  name,
bool  directed,
EcM *  edgeContentMgr 
)

Creates a SharedNetwork with the specified name and whether or not the network is directed.

Parameters
thenetwork name
directedif true the network will be directed, otherwise not.

Member Function Documentation

◆ addEdge()

template<typename V , typename E , typename Ec , typename EcM >
void repast::SharedNetwork< V, E, Ec, EcM >::addEdge ( boost::shared_ptr< E >  edge)

Add an edge to this SharedNetwork.

Parameters
edgethe edge to add

◆ addSender()

template<typename V , typename E , typename Ec , typename EcM >
void repast::SharedNetwork< V, E, Ec, EcM >::addSender ( int  rank)

NON USER API.

Increments the count of edges that are sent from rank to this network.

◆ isMaster()

template<typename V , typename E , typename Ec , typename EcM >
virtual bool repast::SharedNetwork< V, E, Ec, EcM >::isMaster ( E *  e)
inlinevirtual

Returns true if this is a master link; will be a master link if its master node is local.

The master node is usually the edge 'source', but if the usesTargetAsMaster flag is set to true then the 'target' is the master node.

Implements repast::Graph< V, E, Ec, EcM >.

◆ removeEdge()

template<typename V , typename E , typename Ec , typename EcM >
void repast::SharedNetwork< V, E, Ec, EcM >::removeEdge ( V *  source,
V *  target 
)
virtual

Removes the edge between source and target from this Graph.

Parameters
sourcethe source of the edge
targetthe target of the edge

Reimplemented from repast::Graph< V, E, Ec, EcM >.


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