MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PossibleContact.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef POSSIBLECONTACT_H
27 #define POSSIBLECONTACT_H
28 
30 {
31  public:
33  {
34  P1=0;
35  P2=0;
36  Next=0;
37  Prev=0;
38  Next1=0;
39  Prev1=0;
40  Next2=0;
41  Prev2=0;
42  index=0;
43  }
44  PossibleContact(Particle* P1, Particle* P2)
45  {
46  this->P1=P1;
47  this->P2=P2;
48  }
49  PossibleContact(Particle* P1, Particle* P2, PossibleContact* Next)
50  {
51  this->P1=P1;
52  this->P2=P2;
53  this->Next=Next;
54  this->Prev=0;
55  if(Next)
56  index=Next->get_Index()+1;
57  else
58  index=0;
59  }
61  {
62  this->P1=P1;
63  this->P2=P2;
64  this->Next=Next;
65  this->Next1=Next1;
66  this->Next2=Next2;
67  this->Prev=0;
68  this->Prev1=0;
69  this->Prev2=0;
70  if(Next)
71  index=Next->get_Index()+1;
72  else
73  index=0;
74  }
75 
76  Particle* get_P1() {return P1;}
77  Particle* get_P2() {return P2;}
78  Particle* get_OtherParticle(Particle *P)
79  {
80  if(P1==P)
81  return P2;
82  else if(P2==P)
83  return P1;
84  else
85  {
86  std::cout<<"Particle* get_OtherParticle(Particle *P), no match for "<<P->get_Index()<<" posibilities are "<<P1->get_Index()<<" and "<<P2->get_Index()<<std::endl;
87  return 0;
88  }
89  }
91  PossibleContact* get_Next(Particle* P)
92  {
93  if(P1==P)
94  return Next1;
95  else if(P2==P)
96  return Next2;
97  else
98  {
99  std::cout<<"get_Next(Particle* P), no match for "<<P->get_Index()<<" posibilities are "<<P1->get_Index()<<" and "<<P2->get_Index()<<std::endl;
100  return 0;
101  }
102  }
104  PossibleContact* get_Prev(Particle* P)
105  {
106  if(P1==P)
107  return Prev1;
108  else if(P2==P)
109  return Prev2;
110  else
111  {
112  std::cout<<"PossibleContact* get_Prev(Particle* P), no match for "<<P->get_Index()<<" posibilities are "<<P1->get_Index()<<" and "<<P2->get_Index()<<std::endl;
113  return 0;
114  }
115  }
120  int get_Index() {return index;}
121 
122  void set_P1(Particle* P1){this->P1=P1;}
123  void set_P2(Particle* P2){this->P2=P2;}
124  void set_Next(PossibleContact* Next){this->Next=Next;}
125  void set_Next(Particle* P,PossibleContact* Next)
126  {
127  if(P1==P)
128  this->Next1=Next;
129  else if(P2==P)
130  this->Next2=Next;
131  else
132  std::cout<<"void set_Next(Particle* P,PossibleContact* Next), no match for "<<P->get_Index()<<" posibilities are "<<P1->get_Index()<<" and "<<P2->get_Index()<<std::endl;
133  }
134  void set_Prev(PossibleContact* Prev){this->Prev=Prev;}
135  void set_Prev(Particle* P,PossibleContact* Prev)
136  {
137  if(P1==P)
138  this->Prev1=Prev;
139  else if(P2==P)
140  this->Prev2=Prev;
141  else
142  std::cout<<"void set_Prev(Particle* P,PossibleContact* Prev), no match for "<<P->get_Index()<<" posibilities are "<<P1->get_Index()<<" and "<<P2->get_Index()<<std::endl;
143  }
144  void set_Next1(PossibleContact* Next1){this->Next1=Next1;}
145  void set_Prev1(PossibleContact* Prev1){this->Prev1=Prev1;}
146  void set_Next2(PossibleContact* Next2){this->Next2=Next2;}
147  void set_Prev2(PossibleContact* Prev2){this->Prev2=Prev2;}
148 
149 
150  private:
151  int index;
152  Particle* P1;
153  Particle* P2;
160 
161 };
162 
163 #endif
PossibleContact * get_Prev()
Particle * get_OtherParticle(Particle *P)
Particle * get_P2()
PossibleContact * get_Prev1()
void set_P2(Particle *P2)
void set_Next1(PossibleContact *Next1)
PossibleContact * get_Prev2()
void set_Prev1(PossibleContact *Prev1)
PossibleContact(Particle *P1, Particle *P2, PossibleContact *Next)
PossibleContact * get_Next()
PossibleContact(Particle *P1, Particle *P2)
PossibleContact * get_Next2()
PossibleContact * Next
PossibleContact(Particle *P1, Particle *P2, PossibleContact *Next, PossibleContact *Next1, PossibleContact *Next2)
PossibleContact * Prev
PossibleContact * Prev2
PossibleContact * Prev1
PossibleContact * get_Next1()
PossibleContact * Next1
PossibleContact * get_Next(Particle *P)
void set_P1(Particle *P1)
void set_Next2(PossibleContact *Next2)
void set_Prev(PossibleContact *Prev)
void set_Prev2(PossibleContact *Prev2)
PossibleContact * Next2
void set_Next(Particle *P, PossibleContact *Next)
void set_Prev(Particle *P, PossibleContact *Prev)
PossibleContact * get_Prev(Particle *P)
void set_Next(PossibleContact *Next)
Particle * get_P1()