Implement ParticleFile inheritance - generalize ParticleFile #998
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on the performance branches (#862 , #884 , #957 , #958 and #959 ) and in preparation for merging #958 , we establish a a generalized
ParticleFile, with a base particle file (baseparticlefile.py) from whichParticleSet-specific derivatives can inherit. This inheritance and abstract-class implementation is necessary because for array-structures (e.g. AoS, SoA), theparticle.idand the index of a particle is the same, this the particlefile can write-address and house-keep written entries by either ID or index, at not additional performance cost. For ordered sets, the particle's ID and its index are different - the ID is static, the index is chaning (i.e. dynamic). Thus, for those structures, theParticleFileneeds to house-keep and track themaxindex, not themaxid, which comes at steep performance cost. In order to facilitate these differences, a class hierarchy ofParticleFileis necessary to share code and minimize code duplication.This issue is linked with #958 (target ParticleSet to be incorporated after changes), #866 (proper object-oriented programming) and #618 (earlier starting point).