ESyS-Particle  4.0.1
BasicInteraction.h
00001 
00002 //                                                         //
00003 // Copyright (c) 2003-2011 by The University of Queensland //
00004 // Earth Systems Science Computational Centre (ESSCC)      //
00005 // http://www.uq.edu.au/esscc                              //
00006 //                                                         //
00007 // Primary Business: Brisbane, Queensland, Australia       //
00008 // Licensed under the Open Software License version 3.0    //
00009 // http://www.opensource.org/licenses/osl-3.0.php          //
00010 //                                                         //
00012 
00013 #ifndef __BASICINTERACTION_H
00014 #define __BASICINTERACTION_H
00015 
00016 //-- IO includes --
00017 #include <iostream>
00018 
00027 class BasicInteraction
00028 {
00029  public:
00030   typedef int Id;
00031   typedef int Tag;
00032 
00033  private:
00034   Id  m_p1;
00035   Id  m_p2;
00036   Tag m_tag;
00037 
00038  public:
00039 
00040   BasicInteraction(Id id1, Id id2,Tag tag=0);
00041 
00042   Id first() const {return m_p1;}
00043   
00044   Id second() const {return m_p2;}
00045 
00046   Id getP1Id() const
00047   {
00048     return first();
00049   }
00050 
00051   Id getP2Id() const
00052   {
00053     return second();
00054   }
00055 
00056   Tag getTag() const
00057   {
00058     return m_tag;
00059   }
00060 
00061   template <typename TmplVisitor>
00062   void visit(TmplVisitor &visitor) const
00063   {
00064     visitor.visitBasicInteraction(*this);
00065   }
00066 
00067   friend std::ostream& operator<<(std::ostream&,const BasicInteraction&);
00068   friend class BILess;
00069 };
00070 
00078 class BILess
00079 {
00080  public:
00081   bool operator()(const BasicInteraction&,const BasicInteraction&); 
00082 };
00083 
00084 #endif //__BASICINTERACTION_H