载入中...
搜索中...
未找到
eve::gpuagents::GpuAgentSimulation类 参考

Fixed-step, double-buffered agent simulation owner. 更多...

#include <GpuAgentSimulation.h>

Public 成员函数

 GpuAgentSimulation ()=default
 Gpu agent simulation.
 
Result< void > configure (const EffectProfile &profile)
 Configure capacity and bind a solver for the profile kind.
 
Result< void > setSolver (std::unique_ptr< IAgentSolver > solver)
 Replace the solver instance (tests / custom kernels). @ownership Simulation takes ownership.
 
Result< void > initialize (int count, const std::function< AgentState(int)> &spawnFn)
 Spawn count alive agents using spawnFn(index) -> AgentState.
 
void reset ()
 Clear all agents and the time accumulator.
 
Result< void > step (float dt, const EnvironmentSnapshot &env)
 Advance wall-clock dt via fixed substeps.
 
int capacity () const
 Active agent capacity.
 
int aliveCount () const
 Number of alive agents.
 
const std::vector< AgentState > & states () const
 Current front-buffer states (read-only).
 
std::vector< AgentState > & states ()
 Mutable front buffer (editor preview / tests).
 
const EffectProfile & profile () const
 Bound profile.
 
bool isConfigured () const
 True after successful configure.
 
float simTime () const
 Accumulated simulation time in seconds.
 
std::uint64_t stepCount () const
 Completed fixed substeps.
 

详细描述

Fixed-step, double-buffered agent simulation owner.

Owns agent capacity, ping/pong state buffers, accumulator, and the active solver. Does not own World environment data — callers pass an EnvironmentSnapshot each step.

在文件 GpuAgentSimulation.h 第 23 行定义.

构造及析构函数说明

◆ GpuAgentSimulation()

eve::gpuagents::GpuAgentSimulation::GpuAgentSimulation ( )
default

Gpu agent simulation.

成员函数说明

◆ aliveCount()

int eve::gpuagents::GpuAgentSimulation::aliveCount ( ) const

Number of alive agents.

在文件 GpuAgentSimulation.cpp 第 113 行定义.

引用了 n , 以及 s.

◆ capacity()

int eve::gpuagents::GpuAgentSimulation::capacity ( ) const
inline

Active agent capacity.

在文件 GpuAgentSimulation.h 第 61 行定义.

◆ configure()

Result< void > eve::gpuagents::GpuAgentSimulation::configure ( const EffectProfile &  profile)

Configure capacity and bind a solver for the profile kind.

参数
profileEffect parameters (copied).
返回
Ok or InvalidArgument when capacity / kind is illegal.

在文件 GpuAgentSimulation.cpp 第 36 行定义.

引用了 eve::gpuagents::EffectProfile::base(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::gpuagents::EffectProfileBase::fixedDt, eve::InvalidArgument, eve::gpuagents::EffectProfileBase::maxAgents, profile() , 以及 eve::Result< T >::success().

被这些函数引用 eve::gpuagents::EffectBackend::configure().

◆ initialize()

Result< void > eve::gpuagents::GpuAgentSimulation::initialize ( int  count,
const std::function< AgentState(int)> &  spawnFn 
)

Spawn count alive agents using spawnFn(index) -> AgentState.

参数
countNumber of agents to activate (≤ capacity).
spawnFnPer-index initializer; age/alive filled if left zero.

在文件 GpuAgentSimulation.cpp 第 75 行定义.

引用了 count, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::PreconditionViolation, s , 以及 eve::Result< T >::success().

被这些函数引用 eve::gpuagents::GpuAgents::spawnCloud().

◆ isConfigured()

bool eve::gpuagents::GpuAgentSimulation::isConfigured ( ) const
inline

True after successful configure.

在文件 GpuAgentSimulation.h 第 71 行定义.

被这些函数引用 eve::gpuagents::GpuAgents::spawnCloud().

◆ profile()

const EffectProfile & eve::gpuagents::GpuAgentSimulation::profile ( ) const
inline

Bound profile.

在文件 GpuAgentSimulation.h 第 69 行定义.

被这些函数引用 configure() , 以及 eve::gpuagents::GpuAgents::spawnCloud().

◆ reset()

void eve::gpuagents::GpuAgentSimulation::reset ( )

Clear all agents and the time accumulator.

在文件 GpuAgentSimulation.cpp 第 103 行定义.

引用了 b , 以及 s.

◆ setSolver()

Result< void > eve::gpuagents::GpuAgentSimulation::setSolver ( std::unique_ptr< IAgentSolver >  solver)

Replace the solver instance (tests / custom kernels). @ownership Simulation takes ownership.

在文件 GpuAgentSimulation.cpp 第 62 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::gpuagents::EffectProfile::kind , 以及 eve::Result< T >::success().

◆ simTime()

float eve::gpuagents::GpuAgentSimulation::simTime ( ) const
inline

Accumulated simulation time in seconds.

在文件 GpuAgentSimulation.h 第 73 行定义.

◆ states() [1/2]

std::vector< AgentState > & eve::gpuagents::GpuAgentSimulation::states ( )
inline

Mutable front buffer (editor preview / tests).

在文件 GpuAgentSimulation.h 第 67 行定义.

◆ states() [2/2]

const std::vector< AgentState > & eve::gpuagents::GpuAgentSimulation::states ( ) const
inline

Current front-buffer states (read-only).

在文件 GpuAgentSimulation.h 第 65 行定义.

被这些函数引用 eve::gpuagents::EffectBackend::configure() , 以及 eve::gpuagents::EffectBackend::step().

◆ step()

Result< void > eve::gpuagents::GpuAgentSimulation::step ( float  dt,
const EnvironmentSnapshot &  env 
)

Advance wall-clock dt via fixed substeps.

参数
dtNon-negative frame delta seconds.
envEnvironment snapshot for this tick.
返回
Ok, or FailedPrecondition when unconfigured.

在文件 GpuAgentSimulation.cpp 第 121 行定义.

引用了 eve::gpuagents::EffectProfile::base(), eve::Diagnostic::error(), EV_PARAM_CHECK, eve::Result< T >::failure(), eve::gpuagents::EffectProfileBase::fixedDt, eve::PreconditionViolation , 以及 eve::Result< T >::success().

被这些函数引用 eve::gpuagents::EffectBackend::step().

◆ stepCount()

std::uint64_t eve::gpuagents::GpuAgentSimulation::stepCount ( ) const
inline

Completed fixed substeps.

在文件 GpuAgentSimulation.h 第 75 行定义.


该类的文档由以下文件生成: