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

Method reset

cpp/5_Domain_Specific/smokeParticles/ParticleSystem.cpp:267–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267void ParticleSystem::reset(ParticleConfig config)
268{
269 switch (config) {
270 default:
271 case CONFIG_RANDOM:
272 initCubeRandom(vec3f(0.0, 1.0, 0.0), vec3f(1.0, 1.0, 1.0), vec3f(0.0f), 100.0);
273 break;
274
275 case CONFIG_GRID: {
276 float jitter = m_particleRadius * 0.01f;
277 uint s = (int)ceilf(powf((float)m_numParticles, 1.0f / 3.0f));
278 uint gridSize[3];
279 gridSize[0] = gridSize[1] = gridSize[2] = s;
280 initGrid(vec3f(-1.0, 0.0, -1.0),
281 make_uint3(s, s, s),
282 vec3f(m_particleRadius * 2.0f),
283 jitter,
284 vec3f(0.0),
285 m_numParticles,
286 100.0);
287 } break;
288 }
289
290 m_pos.copy(GpuArray<float4>::HOST_TO_DEVICE);
291 m_vel.copy(GpuArray<float4>::HOST_TO_DEVICE);
292}
293
294// particle emitters
295void ParticleSystem::discEmitter(uint &index,

Callers 3

initParticlesFunction · 0.45
keyFunction · 0.45
ResetUniquePtrArrayFunction · 0.45

Calls 2

make_uint3Function · 0.85
copyMethod · 0.80

Tested by

no test coverage detected