RepastHPC
2.3.1
|
Encapsulates the process in which repast is running and manages interprocess communication etc. More...
#include <RepastProcess.h>
Public Types | |
enum | EXCHANGE_PATTERN { POLL, USE_CURRENT, USE_LAST_OR_POLL, USE_LAST_OR_USE_CURRENT } |
Public Member Functions | |
void | agentRemoved (const AgentId &id) |
NON USER API. More... | |
void | moveAgent (const AgentId &id, int process) |
NON USER API. More... | |
void | addExportedAgent (int importingProcess, AgentId id) |
NON USER API. More... | |
void | addImportedAgent (AgentId id) |
NON USER API. More... | |
int | rank () const |
Gets the rank of this process. More... | |
int | worldSize () const |
Gets the number of processes in the world. | |
void | done () |
Notifes this RepastProcess that simulation has completed. More... | |
ScheduleRunner & | getScheduleRunner () |
Gets the ScheduleRunner used by this RepastProcess. More... | |
boost::mpi::communicator * | getCommunicator () |
CartesianTopology * | getCartesianTopology (std::vector< int > processesPerDim, bool spaceIsPeriodic) |
void | dropImporterExporterSet (std::string setName) |
std::string | ImporterExporterVersion () |
std::string | ImporterExporterReport () |
template<typename T , typename Content , typename Provider , typename Updater , typename AgentCreator > | |
void | requestAgents (SharedContext< T > &context, AgentRequest &request, Provider &provider, Updater &updater, AgentCreator &creator, std::string setName=DEFAULT_AGENT_REQUEST_SET, AGENT_IMPORTER_EXPORTER_TYPE setType=DEFAULT_ENUM_SYMBOL) |
Request agents from other processes. More... | |
template<typename Content , typename Provider , typename Updater > | |
void | synchronizeAgentStates (Provider &provider, Updater &updater, std::string setName=REQUEST_AGENTS_ALL) |
Synchronizes the state values of shared agents. More... | |
template<typename T , typename Content , typename Provider , typename Updater , typename AgentCreator > | |
void | synchronizeProjectionInfo (SharedContext< T > &context, Provider &provider, Updater &updater, AgentCreator &creator, EXCHANGE_PATTERN exchangePattern=POLL, bool declareNoAgentsKeptOnAnyProcess=false) |
Synchronizes the Projection information for shared projections. | |
template<typename T , typename Content , typename Provider , typename AgentCreator , typename Updater > | |
void | synchronizeAgentStatus (SharedContext< T > &context, Provider &provider, Updater &updater, AgentCreator &creator, EXCHANGE_PATTERN exchangePattern=POLL) |
Synchronizes the status (moved or died) of all agents across processes. More... | |
Static Public Member Functions | |
static RepastProcess * | init (std::string propsfile, boost::mpi::communicator *comm=0, int maxConfigFileSize=MAX_CONFIG_FILE_SIZE) |
Initialize this RepastProcess. More... | |
static RepastProcess * | instance () |
Gets this RepastProcess. More... | |
static boost::mpi::communicator * | communicator () |
Encapsulates the process in which repast is running and manages interprocess communication etc.
This is singleton to insure that there is one per actual process.
void repast::RepastProcess::addExportedAgent | ( | int | importingProcess, |
AgentId | id | ||
) |
NON USER API.
Notifies this RepastProcess that it is exporting the specified agent to the specified process. This sort of notification is done automatically when requesting agents, but agents may get added in other ways.
void repast::RepastProcess::addImportedAgent | ( | AgentId | id | ) |
NON USER API.
Notifies this RepastProcess that it is importing the specified agent. This sort of notification is normally done automatically when requesting agents, but imports can occur in other ways.
void repast::RepastProcess::agentRemoved | ( | const AgentId & | id | ) |
NON USER API.
Notifies this RepastProcess that the specified agent has been removed (e.g. the agent "died").
void repast::RepastProcess::done | ( | ) |
Notifes this RepastProcess that simulation has completed.
This should be called when the simulation has completed.
|
inline |
Gets the ScheduleRunner used by this RepastProcess.
|
static |
Initialize this RepastProcess.
This must be called before the RepastProcess is used. If a configuration properties file is specified this properties file will be used to configure logging.
propsfile | a configuration properties file. This can be an empty string. |
|
static |
Gets this RepastProcess.
void repast::RepastProcess::moveAgent | ( | const AgentId & | id, |
int | process | ||
) |
NON USER API.
Notifies this RepastProcess that the specified agent should be moved from this process to the specified process.
id | the id of the agent to be moved |
process | the process to move the agent to |
|
inline |
Gets the rank of this process.
void repast::RepastProcess::requestAgents | ( | SharedContext< T > & | context, |
AgentRequest & | request, | ||
Provider & | provider, | ||
Updater & | updater, | ||
AgentCreator & | creator, | ||
std::string | setName = DEFAULT_AGENT_REQUEST_SET , |
||
AGENT_IMPORTER_EXPORTER_TYPE | setType = DEFAULT_ENUM_SYMBOL |
||
) |
Request agents from other processes.
Requests agents from one process to others.
Copies of the requested agents' Content are retrieved from their respective processes, created using the AgentCreator and added to the specified context.
context | the context to which the requested agents will be added |
request | the AgentRequest containing the ids of the requested agents |
provider | provides Content for a given an AgentRequest |
creator | creates agents of type T given Content. |
T | the type of the agents in the context |
Content | the serializable struct or class that describes the state of agents |
Provider | given an AgentRequest, a Provider provides the Content for the requested agents, implementing void provideContent(const AgentRequest&, std::vector<Content>&) |
AgentCreator | a class that can create agents from Content, implementing T* createAgent(Content&). |
void repast::RepastProcess::synchronizeAgentStates | ( | Provider & | provider, |
Updater & | updater, | ||
std::string | setName = REQUEST_AGENTS_ALL |
||
) |
Synchronizes the state values of shared agents.
Does not change the Projection information for those agents.
void repast::RepastProcess::synchronizeAgentStatus | ( | SharedContext< T > & | context, |
Provider & | provider, | ||
Updater & | updater, | ||
AgentCreator & | creator, | ||
EXCHANGE_PATTERN | exchangePattern = POLL |
||
) |
Synchronizes the status (moved or died) of all agents across processes.
context | the SharedContext that contains the agents on this proceses |
provider | the class that provides agents given an AgentRequest |
creator | creates agents of type T given Content. |
T | the type of agents in the context |
Content | the serializable struct or class that describes an agents state. |
Provider | a class that provides Content, when given an AgentRequest, implementing void provideContent(const repast::AgentRequest&, std::vector<Content>& out) |
AgentCreator | a class that can create agents from Content, implementing T* createAgent(Content&). |