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.
This looks great. I haven't had the chance to test it, but once I do, I'll approve your addition.
Could you remove particle_splitter.F from this PR? It's not being used any more so it should go.
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 for making the updates. Looks great!
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.
Greg & John,
Thanks for reviewing and picking up on those issues. I've updated the source and pushed the changes now. Let me know if you see anything else.
The updated PR looks good to me. @jwise77 and @gbryan , could you guys please take a look and then hit 'accept' if you like what you see?