Class HostAPI

Class Documentation

class HostAPI

A flame gpu api class for use by host functions only This class should only be used by init/step/exit/exitcondition functions.

Public Types

typedef std::vector<NewAgentStorage> AgentDataBuffer
typedef std::unordered_map<std::string, AgentDataBuffer> AgentDataBufferStateMap
typedef std::unordered_map<std::string, VarOffsetStruct> AgentOffsetMap
typedef std::unordered_map<std::string, AgentDataBufferStateMap> AgentDataMap
typedef std::unordered_map<std::string, std::shared_ptr<detail::CUDAEnvironmentDirectedGraphBuffers>> CUDADirectedGraphMap

Public Functions

explicit HostAPI(CUDASimulation &_agentModel, detail::RandomManager &rng, detail::CUDAScatter &scatter, const AgentOffsetMap &agentOffsets, AgentDataMap &agentData, const std::shared_ptr<detail::EnvironmentManager> &env, const std::shared_ptr<detail::CUDAMacroEnvironment> &macro_env, CUDADirectedGraphMap &directed_graph_map, unsigned int streamId, cudaStream_t stream)

Initailises pointers to 0 Stores reference of CUDASimulation

~HostAPI()

Frees held device memory

HostAgentAPI agent(const std::string &agent_name, const std::string &stateName = ModelData::DEFAULT_STATE)

Returns methods that work on all agents of a certain type currently in a given state

unsigned int getStepCounter() const

Access the current stepCount

Returns:

the current step count, 0 indexed unsigned.

inline const CUDASimulation::Config &getCUDAConfig() const

Returns the current simulation’s CUDA config struct

inline const Simulation::Config &getSimulationConfig() const

Returns the current simulation’s simulation config struct

unsigned int getEnsembleRunIndex() const

Returns the 0-index of the simulation run within the ensembles RunPlanVector If the simulation is not part of an ensemble, UINT_MAX will be returned

Public Members

const HostRandom random

Host API access to seeded random number generation

const HostEnvironment environment

Host API access to environmental properties

Friends

friend class detail::CUDAFatAgent