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 : id_(id), pptr_(pptr)
110 template <
typename IntType>
114 static_cast<std::ptrdiff_t
>(this->
id()) +
115 static_cast<std::ptrdiff_t>(n)),
124 template <
typename T>
129 return sp1.id() == sp2.id();
132 template <
typename T>
137 return sp1.id() != sp2.id();
140 template <
typename T>
145 return sp1.id() < sp2.id();
148 template <
typename T>
153 return sp1.id() > sp2.id();
156 template <
typename T>
161 return sp1.id() <= sp2.id();
164 template <
typename T>
169 return sp1.id() >= sp2.id();
172 template <
typename T>
180 template <
typename T>
189 template <
typename T>
197 template <
typename T>
206 template <
typename T,
typename IntType>
210 static_cast<std::ptrdiff_t
>(sp.id()) +
211 static_cast<std::ptrdiff_t>(n)),
215 template <
typename T,
typename IntType>
219 static_cast<std::ptrdiff_t
>(sp.id()) +
220 static_cast<std::ptrdiff_t>(n)),
224 template <
typename T,
typename IntType>
228 static_cast<std::ptrdiff_t
>(sp.id()) -
229 static_cast<std::ptrdiff_t>(n)),
233 template <
typename T,
typename IntType>
241 template <
typename T,
typename IntType>
249 template <
typename T>
255 return static_cast<std::ptrdiff_t
>(sp1.id()) -
256 static_cast<std::ptrdiff_t>(sp2.id());
261 #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)
Particle< T >::rng_type & rng()
#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)
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.
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)