36     new_memory[i] = 
data_[i];
    39     new_memory[i].index_ = i;
    41   std::swap(
data_, new_memory);
    58     const auto offset = 
dirty_.back();
    61     data_[offset].hole_ = 
false;
    68   while (number && !
dirty_.empty()) {
    69     const auto offset = 
dirty_.back();
    74     data_[offset].hole_ = 
false;
    83       ptr->type_ = pd.
type_;
    97     const auto offset = 
dirty_.back();
   110   const unsigned index = p.
index_;
   114     data_[index].set_id(-1);
   115     data_[index].hole_ = 
true;
   122   for (; i < std::min(to_remove.size(), to_add.size()); ++i) {
   124     const auto index = to_remove[i].index_;
   126     to_add[i].id_ = 
data_[index].id_;
   127     to_add[i].index_ = index;
   129   for (; i < to_remove.size(); ++i) {
   130     remove(to_remove[i]);
   132   for (; i < to_add.size(); ++i) {
   134     to_add[i].id_ = p.
id_;
   135     to_add[i].index_ = p.
index_;
   142   for (
auto index : 
dirty_) {
   143     data_[index].hole_ = 
false;
   149   out << particles.
size() << 
" Particles:\n";
   150   for (
unsigned i = 0; i < particles.
data_size_; ++i) {
   151     const auto &
p = particles.
data_[i];
   155       out << std::setw(5) << std::setprecision(3) << 
p.momentum().abs3()
 void reset()
Reset the state of the Particles object to an empty list and a new id counter. 
 
std::vector< unsigned > dirty_
Stores the indexes in data_ that do not hold valid particle data and should be reused when new partic...
 
int id_max_
Highest id of a given particle. 
 
void create(size_t n, PdgCode pdg)
Add n particles of the same type (pdg) to the list. 
 
void ensure_capacity(unsigned to_add)
 
void copy_to(ParticleData &dst) const 
Copies some information of the particle to the given particle dst. 
 
#define likely(x)
Tell the branch predictor that this expression is likely true. 
 
void copy_in(ParticleData &to, const ParticleData &from)
 
std::unique_ptr< ParticleData[]> data_
Points to a dynamically allocated array of ParticleData objects. 
 
Particles()
Creates a new (empty) Particles object. 
 
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode. 
 
ParticleTypePtr type_
A reference to the ParticleType object for this particle (this contains all the static information)...
 
bool hole_
If true, the object is an entry in Particles::data_ and does not hold valid particle data...
 
const ParticleData & insert(const ParticleData &p)
Inserts the particle into the list of particles. 
 
PdgCode stores a Particle Data Group Particle Numbering Scheme particle type number. 
 
int32_t id_
Each particle has a unique identifier. 
 
void replace(const ParticleList &to_remove, ParticleList &to_add)
Replace the particles in to_remove with the particles in to_add in the list of current particles...
 
unsigned index_
Internal index in the Particles list. 
 
void remove(const ParticleData &p)
Remove the given particle p from the list. 
 
friend std::ostream & operator<<(std::ostream &out, const Particles &particles)
Print effective mass and type name for all particles to the stream. 
 
The Particles class abstracts the storage and manipulation of particles. 
 
bool is_valid(const ParticleData ©) const 
Check whether the ParticleData copy is still a valid copy of the one stored in the Particles object...
 
void increase_capacity(unsigned new_capacity)
 
ParticleData contains the dynamic information of a certain particle.