RepastHPC  2.3.1
Public Types | Public Member Functions | Public Attributes | List of all members
repast::SharedContext< T > Class Template Reference

Context implementation specialized for the parallel distributed simulation. More...

#include <SharedContext.h>

Inheritance diagram for repast::SharedContext< T >:
repast::Context< T >

Public Types

enum  filterLocalFlag { LOCAL = 1, NON_LOCAL = 0 }
 
typedef boost::filter_iterator< IsLocalAgent< T >, typename Context< T >::const_iterator > const_local_iterator
 
typedef boost::filter_iterator< AgentStateFilter< T >, typename Context< T >::const_iterator > const_state_aware_iterator
 
typedef boost::filter_iterator< AgentStateFilter< T >, typename Context< T >::const_bytype_iterator > const_state_aware_bytype_iterator
 
typedef Projection< T >::RADIUS RADIUS
 
- Public Types inherited from repast::Context< T >
typedef boost::transform_iterator< SecondElement< T >, typename AgentMap::const_iterator > const_iterator
 
typedef boost::filter_iterator< IsAgentType< T >, typename Context< T >::const_iterator > const_bytype_iterator
 

Public Member Functions

 SharedContext (boost::mpi::communicator *comm)
 
const_local_iterator localBegin () const
 Gets the start of iterator over the local agents in this context. More...
 
const_local_iterator localEnd () const
 Gets the end of an iterator over the local agents in this context. More...
 
void removeAgent (const AgentId id)
 Removes the specified agent from this context. More...
 
void removeAgent (T *agent)
 Removes the specified agent from this context. More...
 
void importedAgentRemoved (const AgentId &id)
 Notifies this context that the specified non-local agent has been removed and this context should then delete that agent from itself. More...
 
void incrementProjRefCount (const AgentId &id)
 Increments the projection reference count for the specified agent. More...
 
void decrementProjRefCount (const AgentId &id)
 Decrements the projection reference count for the specified agent. More...
 
const_state_aware_iterator begin (filterLocalFlag local)
 Gets the start of an iterator that will iterate over only local or non-local agents. More...
 
const_state_aware_iterator end (filterLocalFlag local)
 Gets the end of an iterator that will iterate over only local or non-local agents. More...
 
const_state_aware_bytype_iterator byTypeBegin (filterLocalFlag local, int type)
 Gets the start of an iterator that will iterate over only local or non-local agents of a certain type (per their AgentId value) More...
 
const_state_aware_bytype_iterator byTypeEnd (filterLocalFlag local, int type)
 Gets the end of an iterator that will iterate over only local or non-local agents of a certain type (per their AgentId value) More...
 
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename SharedContext< T >::const_state_aware_iterator > filteredBegin (filterLocalFlag local, filterStruct &fStruct)
 Gets the start of an iterator that will iterate over only local or non-local agents meeting the criteria of the user-defined struct (see IsLocalAgent for an example) More...
 
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename SharedContext< T >::const_state_aware_iterator > filteredEnd (filterLocalFlag local, filterStruct &fStruct)
 Gets the end of an iterator that will iterate over only local or non-local agents meeting the criteria of the user-defined struct (see IsLocalAgent for an example) More...
 
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename SharedContext< T >::const_state_aware_bytype_iterator > byTypeFilteredBegin (filterLocalFlag local, int type, filterStruct &fStruct)
 Gets the start of an iterator that will iterate over only local or non-local agents of the specified type and meeting the criteria of the user-defined struct (see IsLocalAgent for an example) More...
 
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename SharedContext< T >::const_state_aware_bytype_iterator > byTypeFilteredEnd (filterLocalFlag local, int type, filterStruct &fStruct)
 Gets the end of an iterator that will iterate over only local or non-local agents of the specified type and meeting the criteria of the user-defined struct (see IsLocalAgent for an example) More...
 
void selectAgents (filterLocalFlag localOrNonLocalOnly, std::set< T * > &selectedAgents, bool remove=false, int popSize=-1)
 Gets a set of pointers to all local or non-local agents in this context. More...
 
void selectAgents (filterLocalFlag localOrNonLocalOnly, std::vector< T * > &selectedAgents, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to all local or non-local agents in this context. More...
 
void selectAgents (filterLocalFlag localOrNonLocalOnly, int count, std::set< T * > &selectedAgents, bool remove=false, int popSize=-1)
 Gets a set of pointers to a specified number of randomly selected local or non-local agents. More...
 
void selectAgents (filterLocalFlag localOrNonLocalOnly, int count, std::vector< T * > &selectedAgents, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to a specified number of randomly selected local or non-local agents. More...
 
void selectAgents (filterLocalFlag localOrNonLocalOnly, std::set< T * > &selectedAgents, int type, bool remove=false, int popSize=-1)
 Gets a set of pointers to all local or non-local agents in this context of a specified type (per their AgentId values). More...
 
void selectAgents (filterLocalFlag localOrNonLocalOnly, std::vector< T * > &selectedAgents, int type, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to all local or non-local agents in this context of a specified type (per their AgentId values). More...
 
void selectAgents (filterLocalFlag localOrNonLocalOnly, int count, std::set< T * > &selectedAgents, int type, bool remove=false, int popSize=-1)
 Gets a set of pointers to a specified number of randomly selected local or non-local agents of a specified type (per their AgentId values). More...
 
void selectAgents (filterLocalFlag localOrNonLocalOnly, int count, std::vector< T * > &selectedAgents, int type, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to a specified number of randomly selected local or non-local agents of a specified type (per their AgentId values). More...
 
template<typename filterStruct >
void selectAgents (filterLocalFlag localOrNonLocalOnly, std::set< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a set of pointers to all local or non-local agents in this context matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (filterLocalFlag localOrNonLocalOnly, std::vector< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to all local or non-local agents in this context matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (filterLocalFlag localOrNonLocalOnly, int count, std::set< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a set of pointers to a specified number of randomly selected local or non-local agents matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (filterLocalFlag localOrNonLocalOnly, int count, std::vector< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to a specified number of randomly selected local or non-local agents matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (filterLocalFlag localOrNonLocalOnly, std::set< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a set of pointers to all local or non-local agents in this context of a specified type (per their AgentId values) and matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (filterLocalFlag localOrNonLocalOnly, std::vector< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to all local or non-local agents in this context of a specified type (per their AgentId values) and matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (filterLocalFlag localOrNonLocalOnly, int count, std::set< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a set of pointers to a specified number of randomly selected local or non-local agents of a specified type (per their AgentId values) and matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (filterLocalFlag localOrNonLocalOnly, int count, std::vector< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to a specified number of randomly selected local or non-local agents of a specified type (per their AgentId values) and matching a user-defined filter. More...
 
bool keepsAgentsOnSyncProj ()
 Returns true if any of the projections in this context will try to 'keep' non-local agents during a synchronize projection operation. More...
 
bool sendsSecondaryDataOnStatusExchange ()
 
void getProjInfoExchangePartners (std::set< int > &sends, std::set< int > &recvs)
 
void getAgentStatusInfoExchangePartners (std::set< int > &sends, std::set< int > &recvs)
 
void getRequiredAgents (std::set< AgentId > &agentsToTest, std::set< AgentId > &agentsToKeep, RADIUS radius=Projection< T >::PRIMARY)
 Given a set of agents to test, returns the set of those agents that must be kept in order to keep required projection information.
 
void getNonlocalAgentsToDrop (std::set< AgentId > &agentsToKeep, std::set< AgentId > &agentsToDrop, RADIUS radius=Projection< T >::PRIMARY)
 Given an initial set of agents that must be kept a priori, add any agents that must be kept due to projection requirements, and return the set of all non-local agents that can be dropped.
 
void getAgentsToPushToOtherProcesses (std::map< int, std::set< AgentId > > &agentsToPush)
 
virtual void addProjection (Projection< T > *projection)
 Adds the specified projection to this context. More...
 
- Public Member Functions inherited from repast::Context< T >
virtual ~Context ()
 Destroys this context and the projections it contains.
 
T * addAgent (T *agent)
 Adds the agent to the context. More...
 
Projection< T > * getProjection (const std::string &name)
 Get the named Projection. More...
 
void removeAgent (const AgentId id)
 Removes the specified agent from this context. More...
 
void removeAgent (T *agent)
 Removes the specified agent from this context.
 
T * getAgent (const AgentId &id)
 Gets the specified agent. More...
 
void getRandomAgents (const int count, std::vector< T * > &agents)
 Gets at random the specified count of agents and returns them in the agents vector. More...
 
const_iterator begin () const
 Gets the start of iterator over the agents in this context. More...
 
const_iterator end () const
 Gets the end of an iterator over the agents in this context. More...
 
const_bytype_iterator byTypeBegin (int typeId) const
 Gets the start of an iterator over agents in this context of the specified type. More...
 
const_bytype_iterator byTypeEnd (int typeId) const
 Gets the end of an iterator over agents in this context of the specified type. More...
 
bool contains (const AgentId &id)
 Returns true if the specified agent is in this context, otherwise false.
 
int size () const
 Gets the size (number of agents) in this context.
 
void addValueLayer (BaseValueLayer *valueLayer)
 Adds a value layer to this context. More...
 
template<typename ValueType , typename Borders >
DiscreteValueLayer< ValueType, Borders > * getDiscreteValueLayer (const std::string &valueLayerName)
 Gets the named discrete value layer from this Context. More...
 
template<typename ValueType , typename Borders >
ContinuousValueLayer< ValueType, Borders > * getContinuousValueLayer (const std::string &valueLayerName)
 Gets the named continuous value layer from this Context. More...
 
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename Context< T >::const_iterator > filteredBegin (const filterStruct &fStruct)
 
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename Context< T >::const_iterator > filteredEnd (const filterStruct &fStruct)
 Creates a filtered iterator over the set of agents in this context and returns it with a value equal to one step past end of the list. More...
 
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename Context< T >::const_bytype_iterator > byTypeFilteredBegin (const int type, const filterStruct &fStruct)
 Creates a filtered iterator over the set of agents in this context of the specified type (per their AgentId values), and returns it with a value equal to the beginning of the list. More...
 
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename Context< T >::const_bytype_iterator > byTypeFilteredEnd (const int type, const filterStruct &fStruct)
 Creates a filtered iterator over the set of agents in this context of the specified type (per their AgentId values), and returns it with a value equal to one past the end of the list. More...
 
void selectAgents (std::set< T * > &selectedAgents, bool remove=false)
 Gets a set of pointers to all agents in this context. More...
 
void selectAgents (std::vector< T * > &selectedAgents, bool remove=false)
 Gets a randomly ordered vector of pointers to all agents in this context. More...
 
void selectAgents (int count, std::set< T * > &selectedAgents, bool remove=false)
 Gets a set of pointers to a specified number of randomly selected agents. More...
 
void selectAgents (int count, std::vector< T * > &selectedAgents, bool remove=false)
 Gets a randomly ordered vector of pointers to a specified number of randomly selected agents. More...
 
void selectAgents (std::set< T * > &selectedAgents, int type, bool remove=false, int popSize=-1)
 Gets a set of pointers to all agents in this context of a specified type (per their AgentId values). More...
 
void selectAgents (std::vector< T * > &selectedAgents, int type, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to all agents in this context of a specified type (per their AgentId values). More...
 
void selectAgents (int count, std::set< T * > &selectedAgents, int type, bool remove=false, int popSize=-1)
 Gets a set of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values). More...
 
void selectAgents (int count, std::vector< T * > &selectedAgents, int type, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values). More...
 
template<typename filterStruct >
void selectAgents (std::set< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a set of pointers to all agents in this context matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (std::vector< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to all agents in this context matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (int count, std::set< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a set of pointers to a specified number of randomly selected agents matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (int count, std::vector< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to a specified number of randomly selected agents matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (std::set< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a set of pointers to all agents in this context of a specified type (per their AgentId values) and matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (std::vector< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to all agents in this context of a specified type (per their AgentId values) and matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (int count, std::set< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a set of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values) and matching a user-defined filter. More...
 
template<typename filterStruct >
void selectAgents (int count, std::vector< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1)
 Gets a randomly ordered vector of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values) and matching a user-defined filter. More...
 
void getProjectionInfo (AgentRequest req, std::map< std::string, std::vector< repast::ProjectionInfoPacket * > > &map, bool secondaryInfo=false, std::set< AgentId > *secondaryIds=0, int destProc=-1)
 Gets the projection information for all projections in this context, for all agents whose IDs are listed in the AgentRequest. More...
 
void setProjectionInfo (std::map< std::string, std::vector< repast::ProjectionInfoPacket * > > &projInfo)
 Sets the projection information as specified. More...
 
void cleanProjectionInfo (std::set< AgentId > &agentsToKeep)
 

Public Attributes

IsLocalAgent< T > localPredicate
 
AgentStateFilter< T > LOCAL_FILTER
 
AgentStateFilter< T > NON_LOCAL_FILTER
 
std::vector< std::string > getAgentsToPushProjOrder
 

Additional Inherited Members

- Protected Attributes inherited from repast::Context< T >
std::vector< Projection< T > * > projections
 

Detailed Description

template<typename T>
class repast::SharedContext< T >

Context implementation specialized for the parallel distributed simulation.

A SharedContext contains both local, that is, agents whose behavior is run on the SharedContext's process and foreign agents, that is, copies of agents whose behavior is run on some other process.

Parameters
Tthe type of agents in the context.

Member Function Documentation

◆ addProjection()

template<typename T >
void repast::SharedContext< T >::addProjection ( Projection< T > *  projection)
virtual

Adds the specified projection to this context.

All the agents in this context will be added to the Projection. Any agents subsequently added to this context will also be added to the Projection.

Parameters
projectionthe projection to add

Reimplemented from repast::Context< T >.

◆ begin()

template<typename T >
boost::filter_iterator< AgentStateFilter< T >, typename Context< T >::const_iterator > repast::SharedContext< T >::begin ( filterLocalFlag  local)

Gets the start of an iterator that will iterate over only local or non-local agents.

Parameters
localflag indicating whether local or non-local agents are to be included

◆ byTypeBegin()

template<typename T >
boost::filter_iterator< AgentStateFilter< T >, typename Context< T >::const_bytype_iterator > repast::SharedContext< T >::byTypeBegin ( filterLocalFlag  local,
int  type 
)

Gets the start of an iterator that will iterate over only local or non-local agents of a certain type (per their AgentId value)

Parameters
localflag indicating whether local or non-local agents are to be included
typetype to included

◆ byTypeEnd()

template<typename T >
boost::filter_iterator< AgentStateFilter< T >, typename Context< T >::const_bytype_iterator > repast::SharedContext< T >::byTypeEnd ( filterLocalFlag  local,
int  type 
)

Gets the end of an iterator that will iterate over only local or non-local agents of a certain type (per their AgentId value)

Parameters
localflag indicating whether local or non-local agents are to be included
typetype to included

◆ byTypeFilteredBegin()

template<typename T >
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename SharedContext< T >::const_state_aware_bytype_iterator > repast::SharedContext< T >::byTypeFilteredBegin ( filterLocalFlag  local,
int  type,
filterStruct &  fStruct 
)

Gets the start of an iterator that will iterate over only local or non-local agents of the specified type and meeting the criteria of the user-defined struct (see IsLocalAgent for an example)

Parameters
localflag indicating whether local or non-local agents are to be included
typetype to be included
filterstruct with unary operator (boost::shared_ptr<T>) that returns true or false; used to selectively include agents.
Template Parameters
filterStructthe class of the filter to be used

◆ byTypeFilteredEnd()

template<typename T >
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename SharedContext< T >::const_state_aware_bytype_iterator > repast::SharedContext< T >::byTypeFilteredEnd ( filterLocalFlag  local,
int  type,
filterStruct &  fStruct 
)

Gets the end of an iterator that will iterate over only local or non-local agents of the specified type and meeting the criteria of the user-defined struct (see IsLocalAgent for an example)

Parameters
localflag indicating whether local or non-local agents are to be included
typetype to be included
filterstruct with unary operator (boost::shared_ptr<T>) that returns true or false; used to selectively include agents.
Template Parameters
filterStructthe class of the filter to be used

◆ decrementProjRefCount()

template<typename T >
void repast::SharedContext< T >::decrementProjRefCount ( const AgentId id)

Decrements the projection reference count for the specified agent.

Parameters
idthe id of the agent

◆ end()

template<typename T >
boost::filter_iterator< AgentStateFilter< T >, typename Context< T >::const_iterator > repast::SharedContext< T >::end ( filterLocalFlag  local)

Gets the end of an iterator that will iterate over only local or non-local agents.

Parameters
localflag indicating whether local or non-local agents are to be included

◆ filteredBegin()

template<typename T >
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename SharedContext< T >::const_state_aware_iterator > repast::SharedContext< T >::filteredBegin ( filterLocalFlag  local,
filterStruct &  fStruct 
)

Gets the start of an iterator that will iterate over only local or non-local agents meeting the criteria of the user-defined struct (see IsLocalAgent for an example)

Parameters
localflag indicating whether local or non-local agents are to be included
filterstruct with unary operator (boost::shared_ptr<T>) that returns true or false; used to selectively include agents.
Template Parameters
filterStructthe class of the filter to be used

◆ filteredEnd()

template<typename T >
template<typename filterStruct >
boost::filter_iterator< filterStruct, typename SharedContext< T >::const_state_aware_iterator > repast::SharedContext< T >::filteredEnd ( filterLocalFlag  local,
filterStruct &  fStruct 
)

Gets the end of an iterator that will iterate over only local or non-local agents meeting the criteria of the user-defined struct (see IsLocalAgent for an example)

Parameters
localflag indicating whether local or non-local agents are to be included
filterstruct with unary operator (boost::shared_ptr<T>) that returns true or false; used to selectively include agents.
Template Parameters
filterStructthe class of the filter to be used

◆ importedAgentRemoved()

template<typename T >
void repast::SharedContext< T >::importedAgentRemoved ( const AgentId id)

Notifies this context that the specified non-local agent has been removed and this context should then delete that agent from itself.

Parameters
idthe id of the agent that was removed

◆ incrementProjRefCount()

template<typename T >
void repast::SharedContext< T >::incrementProjRefCount ( const AgentId id)

Increments the projection reference count for the specified agent.

Parameters
idthe id of the agent

◆ keepsAgentsOnSyncProj()

template<typename T >
bool repast::SharedContext< T >::keepsAgentsOnSyncProj

Returns true if any of the projections in this context will try to 'keep' non-local agents during a synchronize projection operation.

(Generally graphs keep local agents that are part of master copies of links, but spaces do not keep any local agents.)

◆ localBegin()

template<typename T >
boost::filter_iterator< IsLocalAgent< T >, typename Context< T >::const_iterator > repast::SharedContext< T >::localBegin

Gets the start of iterator over the local agents in this context.

The iterator derefrences into shared_ptr<T>. The actual agent can be accessed by dereferencing the iter: (*iter)->getId() for example.

Returns
the start of iterator over the local agents in this context.

◆ localEnd()

template<typename T >
boost::filter_iterator< IsLocalAgent< T >, typename Context< T >::const_iterator > repast::SharedContext< T >::localEnd

Gets the end of an iterator over the local agents in this context.

The iterator derefrences into shared_ptr<T>. The actual agent can be accessed by derefrenceing the iter: (*iter)->getId() for example.

◆ removeAgent() [1/2]

template<typename T >
void repast::SharedContext< T >::removeAgent ( const AgentId  id)

Removes the specified agent from this context.

If the agent is non-local, this checks to make sure that it is not referenced by any projection before its removed.

Parameters
idthe id of the agent to remove

◆ removeAgent() [2/2]

template<typename T >
void repast::SharedContext< T >::removeAgent ( T *  agent)

Removes the specified agent from this context.

If the agent is non-local, this checks to make sure that it is not referenced by any projection before its removed.

Parameters
agentthe agent to remove

◆ selectAgents() [1/16]

template<typename T >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
int  count,
std::set< T * > &  selectedAgents,
bool  remove = false,
int  popSize = -1 
)

Gets a set of pointers to a specified number of randomly selected local or non-local agents.

If the set passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.

If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
countthe number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected
[out]selectedAgentsa set into which the pointers to the agents will be placed
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn

◆ selectAgents() [2/16]

template<typename T >
template<typename filterStruct >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
int  count,
std::set< T * > &  selectedAgents,
filterStruct &  filter,
bool  remove = false,
int  popSize = -1 
)

Gets a set of pointers to a specified number of randomly selected local or non-local agents matching a user-defined filter.

If the set passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.

If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
countthe number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected
[out]selectedAgentsa set into which the pointers to the agents will be placed
filteruser-defined filter specifying any criteria agents to be selected must meet
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn
Template Parameters
filterStructthe type of the filter to be applied to the agents

◆ selectAgents() [3/16]

template<typename T >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
int  count,
std::set< T * > &  selectedAgents,
int  type,
bool  remove = false,
int  popSize = -1 
)

Gets a set of pointers to a specified number of randomly selected local or non-local agents of a specified type (per their AgentId values).

If the set passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.

If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
countthe number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected
[out]selectedAgentsa set into which the pointers to the agents will be placed
typenumeric type of agent to be selected
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn

◆ selectAgents() [4/16]

template<typename T >
template<typename filterStruct >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
int  count,
std::set< T * > &  selectedAgents,
int  type,
filterStruct &  filter,
bool  remove = false,
int  popSize = -1 
)

Gets a set of pointers to a specified number of randomly selected local or non-local agents of a specified type (per their AgentId values) and matching a user-defined filter.

If the set passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.

If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
countthe number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected
[out]selectedAgentsa set into which the pointers to the agents will be placed
typenumeric type of agent to be selected
filteruser-defined filter specifying any criteria agents to be selected must meet
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn
Template Parameters
filterStructthe type of the filter to be applied to the agents

◆ selectAgents() [5/16]

template<typename T >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
int  count,
std::vector< T * > &  selectedAgents,
bool  remove = false,
int  popSize = -1 
)

Gets a randomly ordered vector of pointers to a specified number of randomly selected local or non-local agents.

If the vector passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.

If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
countthe number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected
[out]selectedAgentsa vector into which the pointers to the agents will be placed
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn

◆ selectAgents() [6/16]

template<typename T >
template<typename filterStruct >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
int  count,
std::vector< T * > &  selectedAgents,
filterStruct &  filter,
bool  remove = false,
int  popSize = -1 
)

Gets a randomly ordered vector of pointers to a specified number of randomly selected local or non-local agents matching a user-defined filter.

If the vector passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.

If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
countthe number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected
[out]selectedAgentsa vector into which the pointers to the agents will be placed
filteruser-defined filter specifying any criteria agents to be selected must meet
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn
Template Parameters
filterStructthe type of the filter to be applied to the agents

◆ selectAgents() [7/16]

template<typename T >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
int  count,
std::vector< T * > &  selectedAgents,
int  type,
bool  remove = false,
int  popSize = -1 
)

Gets a randomly ordered vector of pointers to a specified number of randomly selected local or non-local agents of a specified type (per their AgentId values).

If the vector passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.

If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
countthe number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected
[out]selectedAgentsa vector into which the pointers to the agents will be placed
typenumeric type of agent to be selected
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn

◆ selectAgents() [8/16]

template<typename T >
template<typename filterStruct >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
int  count,
std::vector< T * > &  selectedAgents,
int  type,
filterStruct &  filter,
bool  remove = false,
int  popSize = -1 
)

Gets a randomly ordered vector of pointers to a specified number of randomly selected local or non-local agents of a specified type (per their AgentId values) and matching a user-defined filter.

If the vector passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.

If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
countthe number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected
[out]selectedAgentsa vector into which the pointers to the agents will be placed
typenumeric type of agent to be selected
filteruser-defined filter specifying any criteria agents to be selected must meet
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn
Template Parameters
filterStructthe type of the filter to be applied to the agents

◆ selectAgents() [9/16]

template<typename T >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
std::set< T * > &  selectedAgents,
bool  remove = false,
int  popSize = -1 
)

Gets a set of pointers to all local or non-local agents in this context.

If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
[out]selectedAgentsa set into which the pointers to the agents will be placed
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn

◆ selectAgents() [10/16]

template<typename T >
template<typename filterStruct >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
std::set< T * > &  selectedAgents,
filterStruct &  filter,
bool  remove = false,
int  popSize = -1 
)

Gets a set of pointers to all local or non-local agents in this context matching a user-defined filter.

If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
[out]selectedAgentsa set into which the pointers to the agents will be placed
filteruser-defined filter specifying any criteria agents to be selected must meet
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn
Template Parameters
filterStructthe type of the filter to be applied to the agents

◆ selectAgents() [11/16]

template<typename T >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
std::set< T * > &  selectedAgents,
int  type,
bool  remove = false,
int  popSize = -1 
)

Gets a set of pointers to all local or non-local agents in this context of a specified type (per their AgentId values).

If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
[out]selectedAgentsa set into which the pointers to the agents will be placed
typenumeric type of agent to be selected
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn

◆ selectAgents() [12/16]

template<typename T >
template<typename filterStruct >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
std::set< T * > &  selectedAgents,
int  type,
filterStruct &  filter,
bool  remove = false,
int  popSize = -1 
)

Gets a set of pointers to all local or non-local agents in this context of a specified type (per their AgentId values) and matching a user-defined filter.

If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
[out]selectedAgentsa set into which the pointers to the agents will be placed
typenumeric type of agent to be selected
filteruser-defined filter specifying any criteria agents to be selected must meet
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn
Template Parameters
filterStructthe type of the filter to be applied to the agents

◆ selectAgents() [13/16]

template<typename T >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
std::vector< T * > &  selectedAgents,
bool  remove = false,
int  popSize = -1 
)

Gets a randomly ordered vector of pointers to all local or non-local agents in this context.

If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
[out]selectedAgentsa vector into which the pointers to the agents will be placed
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn

◆ selectAgents() [14/16]

template<typename T >
template<typename filterStruct >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
std::vector< T * > &  selectedAgents,
filterStruct &  filter,
bool  remove = false,
int  popSize = -1 
)

Gets a randomly ordered vector of pointers to all local or non-local agents in this context matching a user-defined filter.

If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
[out]selectedAgentsa vector into which the pointers to the agents will be placed
filteruser-defined filter specifying any criteria agents to be selected must meet
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn
Template Parameters
filterStructthe type of the filter to be applied to the agents

◆ selectAgents() [15/16]

template<typename T >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
std::vector< T * > &  selectedAgents,
int  type,
bool  remove = false,
int  popSize = -1 
)

Gets a randomly ordered vector of pointers to all local or non-local agents in this context of a specified type (per their AgentId values).

If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
[out]selectedAgentsa vector into which the pointers to the agents will be placed
typenumeric type of agent to be selected
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn

◆ selectAgents() [16/16]

template<typename T >
template<typename filterStruct >
void repast::SharedContext< T >::selectAgents ( filterLocalFlag  localOrNonLocalOnly,
std::vector< T * > &  selectedAgents,
int  type,
filterStruct &  filter,
bool  remove = false,
int  popSize = -1 
)

Gets a randomly ordered vector of pointers to all local or non-local agents in this context of a specified type (per their AgentId values) and matching a user-defined filter.

If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.

The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.

Parameters
localOrNonLocalOnlyflag that indicates that the agents selected will be drawn only from agents either local or non-local to this process
[out]selectedAgentsa vector into which the pointers to the agents will be placed
typenumeric type of agent to be selected
filteruser-defined filter specifying any criteria agents to be selected must meet
removeif true, remove any elements originally in the set before the set is returned (default is false)
popSizesize of the population from which the sample will be drawn
Template Parameters
filterStructthe type of the filter to be applied to the agents

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