MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / initial_conditions_rand

Function initial_conditions_rand

examples/graphics/gravity_sim.cpp:29–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27float min_mass = 0;
28
29void initial_conditions_rand(af::array &mass, vector<af::array> &pos,
30 vector<af::array> &vels,
31 vector<af::array> &forces) {
32 for (int i = 0; i < (int)pos.size(); ++i) {
33 pos[i] = af::randn(total_particles) * width + width;
34 vels[i] = 0 * af::randu(total_particles) - 0.5;
35 forces[i] = af::constant(0, total_particles);
36 }
37 mass = af::constant(gravity_constant, total_particles);
38}
39
40void initial_conditions_galaxy(af::array &mass, vector<af::array> &pos,
41 vector<af::array> &vels,

Callers

nothing calls this directly

Calls 3

randnFunction · 0.85
randuFunction · 0.85
constantFunction · 0.85

Tested by

no test coverage detected