Open RemiLehe opened 2 years ago
You could use a std::variant<WarpXParticleContainer, PinnedMemoryParticleContainer>
if only one of both is passed at a time :)
https://en.cppreference.com/w/cpp/utility/variant
That allows you to not have to template and keep the implementation in a .cpp
file (better compile time).
Discussed: easier to go for the particle container base class and pass extra info separately.
Discussed with Reva: needs to add the member variable that names the particle attributes to the 2nd type (pinned type).
For BTD diagnostics, the
ParticleDiag
uses data from thePinnedMemoryParticleContainer
passed in the constructor: https://github.com/ECP-WarpX/WarpX/blob/development/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp#L16However, it is still need to pass a
WarpXParticleContainer
(otherwise the code segfault, because it extracts from meta-information from theWarpXParticleContainer
.