RepastHPC  2.3.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
repast::RepastProcess Class Reference

Encapsulates the process in which repast is running and manages interprocess communication etc. More...

#include <RepastProcess.h>

Inheritance diagram for repast::RepastProcess:

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...
 
ScheduleRunnergetScheduleRunner ()
 Gets the ScheduleRunner used by this RepastProcess. More...
 
boost::mpi::communicator * getCommunicator ()
 
CartesianTopologygetCartesianTopology (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 RepastProcessinit (std::string propsfile, boost::mpi::communicator *comm=0, int maxConfigFileSize=MAX_CONFIG_FILE_SIZE)
 Initialize this RepastProcess. More...
 
static RepastProcessinstance ()
 Gets this RepastProcess. More...
 
static boost::mpi::communicator * communicator ()
 

Protected Member Functions

 RepastProcess (boost::mpi::communicator *comm=0)
 
void saveProjInfoSRProcs (std::vector< int > &sends, std::vector< int > &recvs)
 
void saveAgentStatusInfoSRProcs (std::vector< int > &sends, std::vector< int > &recvs)
 

Detailed Description

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.

Member Function Documentation

◆ addExportedAgent()

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.

◆ addImportedAgent()

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.

◆ agentRemoved()

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").

◆ done()

void repast::RepastProcess::done ( )

Notifes this RepastProcess that simulation has completed.

This should be called when the simulation has completed.

◆ getScheduleRunner()

ScheduleRunner& repast::RepastProcess::getScheduleRunner ( )
inline

Gets the ScheduleRunner used by this RepastProcess.

Returns
the ScheduleRunner used by this RepastProcess.

◆ init()

RepastProcess * repast::RepastProcess::init ( std::string  propsfile,
boost::mpi::communicator *  comm = 0,
int  maxConfigFileSize = MAX_CONFIG_FILE_SIZE 
)
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.

Parameters
propsfilea configuration properties file. This can be an empty string.

◆ instance()

RepastProcess * repast::RepastProcess::instance ( )
static

Gets this RepastProcess.

Returns
this RepastProcess instance.

◆ moveAgent()

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.

Parameters
idthe id of the agent to be moved
processthe process to move the agent to

◆ rank()

int repast::RepastProcess::rank ( ) const
inline

Gets the rank of this process.

Returns
the rank of this process.

◆ requestAgents()

template<typename T , typename Content , typename Provider , typename Updater , typename AgentCreator >
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.

Parameters
contextthe context to which the requested agents will be added
requestthe AgentRequest containing the ids of the requested agents
providerprovides Content for a given an AgentRequest
creatorcreates agents of type T given Content.
Template Parameters
Tthe type of the agents in the context
Contentthe serializable struct or class that describes the state of agents
Providergiven an AgentRequest, a Provider provides the Content for the requested agents, implementing void provideContent(const AgentRequest&, std::vector<Content>&)
AgentCreatora class that can create agents from Content, implementing T* createAgent(Content&).

◆ synchronizeAgentStates()

template<typename Content , typename Provider , typename Updater >
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.

◆ synchronizeAgentStatus()

template<typename T , typename Content , typename Provider , typename AgentCreator , typename Updater >
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.

Parameters
contextthe SharedContext that contains the agents on this proceses
providerthe class that provides agents given an AgentRequest
creatorcreates agents of type T given Content.
Template Parameters
Tthe type of agents in the context
Contentthe serializable struct or class that describes an agents state.
Providera class that provides Content, when given an AgentRequest, implementing void provideContent(const repast::AgentRequest&, std::vector<Content>& out)
AgentCreatora class that can create agents from Content, implementing T* createAgent(Content&).

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