I've replaced the Fortran routine (particle_splitter.F) with Grid_CreateChildParticles.C. The algorithm is essentially identical, with only minor modifications to the Fortran algorithm. The C version requires significantly less arguments and I've also hard coded the number of children in macrosandparameters.h as that makes more sense. I've tested only the DM particle splittling although star particle splittling is also possible. In fact it appears that previously the code was incompatible with a DM only particle splittling. That is now fixed but untested with stars.
Just a followup on this: I've now tested this PR for a cosmology dataset, and it works for both dark matter and particle splitting, and appears to maintain particle attributes correctly across the split. So, I am ready to accept this PR as soon as you address the other questions.
Thanks John! This looks good to me except for the following issue. There are a number of variables which should be declared "FLOAT" rather than "float" to match the Enzo mixed-type convention. These are all in Grid_CreateChildParticles and include: ParticlePosition, RefineRegionLeftEdge, RefineRegionRightEdge, CellLeftEdge.
Hi John, I read over your changes again, and I saw that you're passing some global variables (RefineRegionLeftEdge, RefineRegionRightEdge, NumberOfParticleAttributes) into the grid::CreateChildParticles routine. They should be accessible in the routine, unlike the original Fortran routine. After addressing Greg's and my concerns, then I think it's ready to go.