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()
|
default |
Gpu agent simulation.
成员函数说明
◆ aliveCount()
| int eve::gpuagents::GpuAgentSimulation::aliveCount | ( | ) | const |
◆ capacity()
|
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.
- 参数
-
profile Effect 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().
◆ initialize()
| Result< void > eve::gpuagents::GpuAgentSimulation::initialize | ( | int | count, |
| const std::function< AgentState(int)> & | spawnFn | ||
| ) |
Spawn count alive agents using spawnFn(index) -> AgentState.
- 参数
-
count Number of agents to activate (≤ capacity). spawnFn Per-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().
◆ isConfigured()
|
inline |
True after successful configure.
在文件 GpuAgentSimulation.h 第 71 行定义.
◆ profile()
|
inline |
Bound profile.
在文件 GpuAgentSimulation.h 第 69 行定义.
被这些函数引用 configure() , 以及 eve::gpuagents::GpuAgents::spawnCloud().
◆ reset()
| void eve::gpuagents::GpuAgentSimulation::reset | ( | ) |
◆ 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()
|
inline |
Accumulated simulation time in seconds.
在文件 GpuAgentSimulation.h 第 73 行定义.
◆ states() [1/2]
|
inline |
Mutable front buffer (editor preview / tests).
在文件 GpuAgentSimulation.h 第 67 行定义.
◆ states() [2/2]
|
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.
- 参数
-
dt Non-negative frame delta seconds. env Environment 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().
◆ stepCount()
|
inline |
Completed fixed substeps.
在文件 GpuAgentSimulation.h 第 75 行定义.
该类的文档由以下文件生成:
- src/modules/gpuagents/GpuAgentSimulation.h
- src/modules/gpuagents/GpuAgentSimulation.cpp