ParticleContainer: Allocator Could be Runtime?
The allocator in the ParticleContainer classes is a template argument, as in low level C++ objects like std::vector et al.
I think this is a bit of a design issue, impacting at least for me:
- compile-time
- link-time
- maintainability
- extensibility
in downstream codes and pyAMReX, because every template argument needs to be specialized, compiled, linked, etc.
@WeiqunZhang @atmyers do you think that long-term, we could make the PC classes using the allocator as a runtime argument, as we do in MultiFabs? This would simplify a lot for me downstream.
This can already be done by setting the templated allocator to amrex::PolymorphicArenaAllocator. The question is if this should be the default or maybe even the only allocator?
Currently with amrex::PolymorphicArenaAllocator one has to loop over all components of all particle tiles to set the arena. It would be nice if there were some helper functions for this, while also keeping the flexibility of having different allocators for different components.
Thanks @AlexanderSinn, I was not aware of that. I chatted with @WeiqunZhang confirming that we should be good to use the amrex::PolymorphicArenaAllocator for all our classes in BLAST codes, simplifying build times.
Yes, let's add a helper for setting all components at once.