Hello Taichi Wizards,
I’m trying to write MPM code that would have at the beginning particles lying inside a mesh.To make things easier, I voxelise the mesh so that I actually have a 3D volume with 1s tagging the ‘inside’ of the mesh and 0s tagging the outside. My approach has been then to scan the volume and use the coordinates of the voxels as the initial coordinate of the particles. In practice, I have a first python function config_particles
which fills a list X with the coordinates, and then call a kernel seed
to configure the particles (like in the example code). It works, because I can do X.length to know how many particles I want to create.
Here comes the problem: Now I want to have a lot of particles, and my python function config_particles
takes ages to run! (python doesn’t like looping…). I was hoping to translate the config_particles
into a kernel. However, I can’t know how many particles I’m going to create before running the config_particles function… is there a way of making an array grow inside a kernel without knowing how many elements will be added? Is there another approach you would advice for initialising MPM with a mesh (or a binary volume of voxels?)
Thank you in advance!