RepastHPC
2.3.1
|
Context implementation specialized for the parallel distributed simulation. More...
#include <SharedContext.h>
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 |
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.
T | the type of agents in the context. |
|
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.
projection | the projection to add |
Reimplemented from repast::Context< 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.
local | flag indicating whether local or non-local agents are to be included |
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)
local | flag indicating whether local or non-local agents are to be included |
type | type to included |
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)
local | flag indicating whether local or non-local agents are to be included |
type | type to included |
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)
local | flag indicating whether local or non-local agents are to be included |
type | type to be included |
filter | struct with unary operator (boost::shared_ptr<T>) that returns true or false; used to selectively include agents. |
filterStruct | the class of the filter to be used |
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)
local | flag indicating whether local or non-local agents are to be included |
type | type to be included |
filter | struct with unary operator (boost::shared_ptr<T>) that returns true or false; used to selectively include agents. |
filterStruct | the class of the filter to be used |
void repast::SharedContext< T >::decrementProjRefCount | ( | const AgentId & | id | ) |
Decrements the projection reference count for the specified agent.
id | the id of the agent |
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.
local | flag indicating whether local or non-local agents are to be included |
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)
local | flag indicating whether local or non-local agents are to be included |
filter | struct with unary operator (boost::shared_ptr<T>) that returns true or false; used to selectively include agents. |
filterStruct | the class of the filter to be used |
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)
local | flag indicating whether local or non-local agents are to be included |
filter | struct with unary operator (boost::shared_ptr<T>) that returns true or false; used to selectively include agents. |
filterStruct | the class of the filter to be used |
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.
id | the id of the agent that was removed |
void repast::SharedContext< T >::incrementProjRefCount | ( | const AgentId & | id | ) |
Increments the projection reference count for the specified agent.
id | the id of the agent |
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.)
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.
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.
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.
id | the id of the agent to remove |
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.
agent | the agent to remove |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
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.
localOrNonLocalOnly | flag that indicates that the agents selected will be drawn only from agents either local or non-local to this process | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |