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

Method initCubeRandom

cpp/5_Domain_Specific/smokeParticles/ParticleSystem.cpp:223–233  ·  view source on GitHub ↗

initialize in random positions within cube

Source from the content-addressed store, hash-verified

221
222// initialize in random positions within cube
223void ParticleSystem::initCubeRandom(vec3f origin, vec3f size, vec3f vel, float lifetime)
224{
225 float4 *posPtr = m_pos.getHostPtr();
226 float4 *velPtr = m_vel.getHostPtr();
227
228 for (uint i = 0; i < m_numParticles; i++) {
229 vec3f pos = origin + svrand() * size;
230 posPtr[i] = make_float4(pos.x, pos.y, pos.z, 0.0f);
231 velPtr[i] = make_float4(vel.x, vel.y, vel.z, lifetime);
232 }
233}
234
235// add sphere on regular grid
236void ParticleSystem::addSphere(uint &index, vec3f pos, vec3f vel, int r, float spacing, float jitter, float lifetime)

Callers

nothing calls this directly

Calls 3

svrandFunction · 0.85
make_float4Function · 0.85
getHostPtrMethod · 0.80

Tested by

no test coverage detected