diff --git a/src/lagrangian/basic/Particle/Particle.C b/src/lagrangian/basic/Particle/Particle.C index 9f142e710b..2d94b9c29d 100644 --- a/src/lagrangian/basic/Particle/Particle.C +++ b/src/lagrangian/basic/Particle/Particle.C @@ -528,6 +528,34 @@ void Foam::Particle::hitPatch {} +// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // + +template +bool Foam::operator== +( + const Particle& pA, + const Particle& pB +) +{ + return + ( + pA.origProc() == pB.origProc() + && pA.origId() == pB.origId() + ); +} + + +template +bool Foam::operator!= +( + const Particle& pA, + const Particle& pB +) +{ + return !(pA == pB); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "ParticleIO.C" diff --git a/src/lagrangian/basic/Particle/Particle.H b/src/lagrangian/basic/Particle/Particle.H index 95a4b8e338..e91a4885d3 100644 --- a/src/lagrangian/basic/Particle/Particle.H +++ b/src/lagrangian/basic/Particle/Particle.H @@ -59,6 +59,8 @@ class polyPatch; template class Particle; +// Friend Operators + template Ostream& operator<< ( @@ -66,6 +68,11 @@ Ostream& operator<< const Particle& ); +template +bool operator==(const Particle&, const Particle&); + +template +bool operator!=(const Particle&, const Particle&); /*---------------------------------------------------------------------------*\ Class Particle Declaration @@ -467,13 +474,25 @@ public: //- Write the particle data void write(Ostream& os, bool writeFields) const; - // Ostream Operator + // Friend Operators friend Ostream& operator<< ( Ostream&, const Particle& ); + + friend bool operator== + ( + const Particle& pA, + const Particle& pB + ); + + friend bool operator!= + ( + const Particle& pA, + const Particle& pB + ); };