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

Public Functions

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

Initailises pointers to 0 Stores reference of CUDASimulation


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

Access the current stepCount Sepearate implementation to avoid dependency loop with cuda agent model.


the current step count, 0 indexed unsigned.


the current step count, 0 indexed unsigned.

Public Members

const HostRandom random

Host API access to seeded random number generation

const HostEnvironment environment

Host API access to environmental properties


friend class detail::CUDAFatAgent