7 #ifndef SRC_INCLUDE_SMASH_PARTICLES_H_ 
    8 #define SRC_INCLUDE_SMASH_PARTICLES_H_ 
   11 #include <type_traits> 
  157   void replace(
const ParticleList &to_remove, ParticleList &to_add);
 
  178     assert(
p.type() == new_state.
type());
 
  200   void update(
const ParticleList &old_state, ParticleList &new_state,
 
  205       for (std::size_t i = 0; i < old_state.size(); ++i) {
 
  232   template <
typename T>
 
  234       : 
public std::iterator<std::bidirectional_iterator_tag, T> {
 
  241     using pointer = 
typename std::add_pointer<T>::type;
 
  243     using reference = 
typename std::add_lvalue_reference<T>::type;
 
  274       } 
while (
ptr_->hole_);
 
  302       } 
while (
ptr_->hole_);
 
  382     while (first->
hole_) {
 
  394     while (first->
hole_) {
 
  423   friend std::ostream &
operator<<(std::ostream &out,
 
  483   std::unique_ptr<ParticleData[]> 
data_;
 
ParticleData contains the dynamic information of a certain particle.
 
unsigned index_
Internal index in the Particles list.
 
const ParticleType & type() const
Get the type of the particle.
 
bool hole_
If true, the object is an entry in Particles::data_ and does not hold valid particle data.
 
uint32_t id_process() const
Get the id of the last action.
 
void copy_to(ParticleData &dst) const
Copies some information of the particle to the given particle dst.
 
int32_t id() const
Get the id of the particle.
 
const FourVector & position() const
Get the particle's position in Minkowski space.
 
bool operator>(const GenericIterator &rhs) const
 
bool operator==(const GenericIterator &rhs) const
 
bool operator<(const GenericIterator &rhs) const
 
typename std::add_const< reference >::type const_reference
add const qualification to a reference
 
GenericIterator & operator--()
Advance the iterator to the previous valid (not a hole) entry in Particles.
 
typename std::remove_const< T >::type value_type
remove const qualification
 
const_reference operator*() const
 
GenericIterator operator--(int)
Postfix variant of the above prefix decrement operator.
 
typename std::add_const< pointer >::type const_pointer
add const qualification to a pointer
 
const_pointer operator->() const
 
typename std::add_pointer< T >::type pointer
provide the pointer of a reference
 
GenericIterator operator++(int)
Postfix variant of the above prefix increment operator.
 
bool operator<=(const GenericIterator &rhs) const
 
typename std::add_lvalue_reference< T >::type reference
creates a lvalue reference
 
bool operator!=(const GenericIterator &rhs) const
 
pointer ptr_
The entry in Particles this iterator points to.
 
GenericIterator & operator++()
Advance the iterator to the next valid (not a hole) entry in Particles.
 
GenericIterator(pointer p)
Constructs an iterator pointing to the ParticleData pointed to by p.
 
bool operator>=(const GenericIterator &rhs) const
 
The Particles class abstracts the storage and manipulation of particles.
 
double time() const
Returns the time of the computational frame.
 
std::unique_ptr< ParticleData[]> data_
Points to a dynamically allocated array of ParticleData objects.
 
const ParticleData & update_particle(const ParticleData &p, const ParticleData &new_state)
Updates the particle identified by p with the state stored in new_state.
 
void update(const ParticleList &old_state, ParticleList &new_state, bool do_replace)
Updates the Particles object, replacing the particles in old_state with the particles in new_state.
 
const_iterator cend() const
 
ParticleList copy_to_vector() const
 
void reset()
Reset the state of the Particles object to an empty list and a new id counter.
 
bool is_valid(const ParticleData ©) const
Check whether the ParticleData copy is still a valid copy of the one stored in the Particles object.
 
std::vector< unsigned > dirty_
Stores the indexes in data_ that do not hold valid particle data and should be reused when new partic...
 
const ParticleData & front() const
const overload of &front()
 
Particles(const Particles &)=delete
Cannot be copied.
 
const_iterator end() const
const overload of end()
 
void copy_in(ParticleData &to, const ParticleData &from)
 
Particles & operator=(const Particles &)=delete
Cannot be copied.
 
int id_max_
Highest id of a given particle.
 
const ParticleData & lookup(const ParticleData &old_state) const
Returns the particle that is currently stored in this object given an old copy of that particle.
 
void ensure_capacity(unsigned to_add)
 
Particles()
Creates a new (empty) Particles object.
 
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.
 
const ParticleData & insert(const ParticleData &p)
Inserts the particle into the list of particles.
 
void create(size_t n, PdgCode pdg)
Add n particles of the same type (pdg) to the list.
 
void increase_capacity(unsigned new_capacity)
 
const_iterator cbegin() const
 
const_iterator begin() const
const overload of begin()
 
const ParticleData & back() const
const overload of &back()
 
void remove(const ParticleData &p)
Remove the given particle p from the list.
 
PdgCode stores a Particle Data Group Particle Numbering Scheme particle type number.
 
friend std::ostream & operator<<(std::ostream &out, const Particles &particles)
Print effective mass and type name for all particles to the stream.