ESyS-Particle  2.3
BasicInteraction.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef __BASICINTERACTION_H
14 #define __BASICINTERACTION_H
15 
16 //-- IO includes --
17 #include <iostream>
18 
28 {
29  public:
30  typedef int Id;
31  typedef int Tag;
32 
33  private:
34  Id m_p1;
35  Id m_p2;
36  Tag m_tag;
37 
38  public:
39 
40  BasicInteraction(Id id1, Id id2,Tag tag=0);
41 
42  Id first() const {return m_p1;}
43 
44  Id second() const {return m_p2;}
45 
46  Id getP1Id() const
47  {
48  return first();
49  }
50 
51  Id getP2Id() const
52  {
53  return second();
54  }
55 
56  Tag getTag() const
57  {
58  return m_tag;
59  }
60 
61  template <typename TmplVisitor>
62  void visit(TmplVisitor &visitor) const
63  {
64  visitor.visitBasicInteraction(*this);
65  }
66 
67  friend std::ostream& operator<<(std::ostream&,const BasicInteraction&);
68  friend class BILess;
69 };
70 
78 class BILess
79 {
80  public:
81  bool operator()(const BasicInteraction&,const BasicInteraction&);
82 };
83 
84 #endif //__BASICINTERACTION_H
Id first() const
Definition: BasicInteraction.h:42
Tag m_tag
Definition: BasicInteraction.h:36
Id m_p2
Definition: BasicInteraction.h:35
Class to represent the common part of a pair interaction, i.e. the IDs of the particles and the inter...
Definition: BasicInteraction.h:27
friend std::ostream & operator<<(std::ostream &, const BasicInteraction &)
Id m_p1
Definition: BasicInteraction.h:34
void visit(TmplVisitor &visitor) const
Definition: BasicInteraction.h:62
Id second() const
Definition: BasicInteraction.h:44
function object for the ordering of BasicInteraction
Definition: BasicInteraction.h:78
Id getP2Id() const
Definition: BasicInteraction.h:51
BasicInteraction(Id id1, Id id2, Tag tag=0)
Definition: BasicInteraction.cpp:19
int Id
Definition: BasicInteraction.h:30
Tag getTag() const
Definition: BasicInteraction.h:56
Id getP1Id() const
Definition: BasicInteraction.h:46
bool operator()(const BasicInteraction &, const BasicInteraction &)
Definition: BasicInteraction.cpp:32
int Tag
Definition: BasicInteraction.h:31