32 #ifndef VSMC_CORE_SINGLE_PARTICLE_HPP 33 #define VSMC_CORE_SINGLE_PARTICLE_HPP 37 #define VSMC_RUNTIME_ASSERT_SINGLE_PARTICLE_COMPARE(sp1, sp2) \ 38 VSMC_RUNTIME_ASSERT((sp1.particle_ptr() == sp2.particle_ptr()), \ 39 "COMPARE TWO SingleParticle OBJECTS THAT BELONG TO TWO PARTICLE " \ 42 #define VSMC_RUNTIME_ASSERT_SINGLE_PARTICLE_DIFFERENCE(sp1, sp2) \ 43 VSMC_RUNTIME_ASSERT((sp1.particle_ptr() == sp2.particle_ptr()), \ 44 "SUBSTRACT TWO SingleParticle OBJECTS THAT BELONG TO TWO PARTICLE " \ 57 : pptr_(pptr), id_(id)
110 template <
typename IntType>
114 static_cast<std::ptrdiff_t
>(this->
id()) +
115 static_cast<std::ptrdiff_t>(n)),
124 template <
typename T>
130 return sp1.id() == sp2.id();
133 template <
typename T>
139 return sp1.id() != sp2.id();
142 template <
typename T>
148 return sp1.id() < sp2.id();
151 template <
typename T>
157 return sp1.id() > sp2.id();
160 template <
typename T>
166 return sp1.id() <= sp2.id();
169 template <
typename T>
175 return sp1.id() >= sp2.id();
178 template <
typename T>
186 template <
typename T>
195 template <
typename T>
203 template <
typename T>
212 template <
typename T,
typename IntType>
216 static_cast<std::ptrdiff_t
>(sp.id()) +
217 static_cast<std::ptrdiff_t>(n)),
221 template <
typename T,
typename IntType>
225 static_cast<std::ptrdiff_t
>(sp.id()) +
226 static_cast<std::ptrdiff_t>(n)),
230 template <
typename T,
typename IntType>
234 static_cast<std::ptrdiff_t
>(sp.id()) -
235 static_cast<std::ptrdiff_t>(n)),
239 template <
typename T,
typename IntType>
247 template <
typename T,
typename IntType>
255 template <
typename T>
261 return static_cast<std::ptrdiff_t
>(sp1.id()) -
262 static_cast<std::ptrdiff_t>(sp2.id());
267 #endif // VSMC_CORE_SINGLE_PARTICLE_HPP
Particle class representing the whole particle set.
typename rng_set_type::rng_type rng_type
SingleParticle< T > operator-(const SingleParticle< T > &sp, IntType n)
SingleParticle< T > & operator*()
SingleParticle(typename Particle< T >::size_type id, Particle< T > *pptr)
#define VSMC_DEFINE_TYPE_TEMPLATE_DISPATCH_TRAIT(Outer, Inner, Default)
Particle< T >::size_type id() const
#define VSMC_RUNTIME_ASSERT_SINGLE_PARTICLE_COMPARE(sp1, sp2)
bool operator!=(const SingleParticle< T > &sp1, const SingleParticle< T > &sp2)
#define VSMC_RUNTIME_ASSERT_SINGLE_PARTICLE_DIFFERENCE(sp1, sp2)
SingleParticle< T > & operator++(SingleParticle< T > &sp)
SingleParticleBase(typename Particle< T >::size_type id, Particle< T > *pptr)
SingleParticle< T > & operator-=(SingleParticle< T > &sp, IntType n)
Particle< T > & particle() const
SingleParticle operator[](IntType n)
bool operator==(const SingleParticle< T > &sp1, const SingleParticle< T > &sp2)
bool operator<(const SingleParticle< T > &sp1, const SingleParticle< T > &sp2)
A thin wrapper over a complete Particle.
Particle< T > * particle_ptr() const
SingleParticle< T > & operator+=(SingleParticle< T > &sp, IntType n)
const SingleParticle< T > & operator*() const
A thin wrapper over a complete Particle.
Particle< T >::rng_type & rng() const
bool operator<=(const SingleParticle< T > &sp1, const SingleParticle< T > &sp2)
SingleParticle< T > & operator--(SingleParticle< T > &sp)
bool operator>(const SingleParticle< T > &sp1, const SingleParticle< T > &sp2)
bool operator>=(const SingleParticle< T > &sp1, const SingleParticle< T > &sp2)
SingleParticle< T > operator+(const SingleParticle< T > &sp, IntType n)