12int main(
int argc,
char** argv) {
13 Kokkos::initialize(argc, argv);
14 std::vector<std::uint32_t> bits;
16 for (
int shape : {(int)SPHERE, (
int)
BOX, (int)HOLLOW_CYLINDER}) {
18 s.setDomain(1.f, 1.f, 1.f,
true,
true,
true);
19 s.initializeShape(shape, 0.045f, 0.08f, 0.02f);
20 std::uint32_t st = 0x5EED01u;
21 auto u = [&](
float lo,
float hi) {
22 st = st * 1664525u + 1013904223u;
23 return lo + (hi - lo) * ((
float)((st >> 8) & 0xFFFFFFu) / (float)0x1000000u);
25 std::vector<float> pos(3 * 60);
29 s.setGravity(0.f, -9.81f, 0.f);
31 const int NSTEP = std::atoi(argv[2]);
32 for (
int k = 0; k < NSTEP; ++k)
35 std::printf(
" shape=%d static overlap probe: contacts=%d maxOverlap=%.9g\n", shape,
36 s.numContacts(), (
double)s.maxOverlap());
37 for (
const std::vector<float>& arr : {s.getPositions(), s.getVelocities(), s.getInvInertia()})
40 std::memcpy(&b, &v, 4);
46 std::FILE* f = std::fopen(argv[1],
"wb");
47 std::fwrite(bits.data(), 4, bits.size(), f);
49 std::printf(
"wrote %zu values\n", bits.size());