MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / dumpParticles

Method dumpParticles

cpp/5_Domain_Specific/smokeParticles/ParticleSystem.cpp:379–392  ·  view source on GitHub ↗

dump particles to stdout for debugging

Source from the content-addressed store, hash-verified

377
378// dump particles to stdout for debugging
379void ParticleSystem::dumpParticles(uint start, uint count)
380{
381 m_pos.copy(GpuArray<float4>::DEVICE_TO_HOST);
382 float4 *pos = m_pos.getHostPtr();
383
384 m_vel.copy(GpuArray<float4>::DEVICE_TO_HOST);
385 float4 *vel = m_vel.getHostPtr();
386
387 for (uint i = start; i < start + count; i++) {
388 printf("%d: ", i);
389 printf("pos: (%.4f, %.4f, %.4f, %.4f)\n", pos[i].x, pos[i].y, pos[i].z, pos[i].w);
390 printf("vel: (%.4f, %.4f, %.4f, %.4f)\n", vel[i].x, vel[i].y, vel[i].z, vel[i].w);
391 }
392}
393
394// dump particles to a system memory host
395void ParticleSystem::dumpBin(float4 **posData, float4 **velData)

Callers

nothing calls this directly

Calls 2

copyMethod · 0.80
getHostPtrMethod · 0.80

Tested by

no test coverage detected