revision: v0.14
PossibleContact Class Reference

Class that describes a possible contact between two BaseParticle. More...

#include <PossibleContact.h>

Public Member Functions

 PossibleContact ()
 Default constructor, sets all pointers to nullptr. More...
 
 PossibleContact (BaseParticle *P1, BaseParticle *P2)
 Constructor that takes two BaseParticle and sets them to be the BaseParticle associated with this PossibleContact. More...
 
 PossibleContact (BaseParticle *P1, BaseParticle *P2, PossibleContact *Next)
 Constructor that takes two BaseParticle and the next global PossibleContact in the list and constructs a PossibleContact from that. More...
 
 PossibleContact (BaseParticle *P1, BaseParticle *P2, PossibleContact *Next, PossibleContact *Next1, PossibleContact *Next2)
 Constructor that should be used, takes all required information as parameters and sets it in the data-members. More...
 
BaseParticlegetP1 ()
 Gets a pointer to the first BaseParticle in this PossibleContact. More...
 
BaseParticlegetP2 ()
 Gets a pointer to the second BaseParticle in this PossibleContact. More...
 
BaseParticlegetOtherParticle (BaseParticle *P)
 Given one BaseParticle of the interacting pair, this function gets the other. More...
 
PossibleContactgetNext ()
 Gets the next PossibleContact in the general linked list of PossibleContact. More...
 
PossibleContactgetNext (BaseParticle *P)
 Gets the next PossibleContact in the linked list of PossibleContact of the given particle. More...
 
PossibleContactgetPrevious ()
 Gets the previous PossibleContact in the general linked list of PossibleContact. More...
 
PossibleContactgetPrevious (BaseParticle *P)
 Gets the previous PossibleContact in the linked list of PossibleContact of the given particle. More...
 
PossibleContactgetNext1 ()
 Gets the next PossibleContact in the linked list of PossibleContact of the first particle in this PossibleContact. More...
 
PossibleContactgetPrevious1 ()
 Gets the previous PossibleContact in the linked list of PossibleContact of the first particle in this PossibleContact. More...
 
PossibleContactgetNext2 ()
 Gets the next PossibleContact in the linked list of PossibleContact of the second particle in this PossibleContact. More...
 
PossibleContactgetPrevious2 ()
 Gets the previous PossibleContact in the linked list of PossibleContact of the second particle in this PossibleContact. More...
 
int getIndex ()
 Gets the index of this PossibleContact. More...
 
void setP1 (BaseParticle *P1)
 Sets the first particle in this PossibleContact. More...
 
void setP2 (BaseParticle *P2)
 Sets the second particle in this PossibleContact. More...
 
void setNextPosition (PossibleContact *Next)
 Sets the next PossibleContact in the linked list of PossibleContac. More...
 
void setNextPosition (BaseParticle *P, PossibleContact *Next)
 Sets the next PossibleContact in the linked list of PossibleContact of the given particle. More...
 
void setPreviousPosition (PossibleContact *Prev)
 Sets the previous PossibleContact in the linked list of PossibleContact of the given particle. More...
 
void setPreviousPosition (BaseParticle *P, PossibleContact *Prev)
 Sets the previous PossibleContact in the linked list of PossibleContact of the given particle. More...
 
void setNextPosition1 (PossibleContact *Next1)
 Sets the next PossibleContact in the linked list of PossibleContact of the first particle in this PossibleContact. More...
 
void setPreviousPosition1 (PossibleContact *Prev1)
 Sets the previous PossibleContact in the linked list of PossibleContact of the first particle in this PossibleContact. More...
 
void setNextPosition2 (PossibleContact *Next2)
 Sets the next PossibleContact in the linked list of PossibleContact of the second particle in this PossibleContact. More...
 
void setPreviousPosition2 (PossibleContact *Prev2)
 Sets the previous PossibleContact in the linked list of PossibleContact of the second particle in this PossibleContact. More...
 

Private Attributes

int index_
 The index of this PossibleContact. More...
 
BaseParticleP1_
 A pointer to the first BaseParticle in this PossibleContact. More...
 
BaseParticleP2_
 A pointer to the second BaseParticle in this PossibleContact. More...
 
PossibleContactNext_
 A pointer to the PossibleContact that comes after this one in the linked list. More...
 
PossibleContactPrev_
 A pointer to the PossibleContact that comes before this one in the linked list. More...
 
PossibleContactNext1_
 A pointer to the PossibleContact that comes after this one in the linked list associated with the first BaseParticle of this PossibleContact. More...
 
PossibleContactPrev1_
 A pointer to the PossibleContact that comes before this one in the linked list associated with the first BaseParticle of this PossibleContact. More...
 
PossibleContactNext2_
 A pointer to the PossibleContact that comes after this one in the linked list associated with the second BaseParticle of this PossibleContact. More...
 
PossibleContactPrev2_
 A pointer to the PossibleContact that comes before this one in the linked list associated with the second BaseParticle of this PossibleContact. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const PossibleContact &o)
 Writes the index of this PossibleContact and the indices of the BaseParticle of this PossibleContact to the given ostream. More...
 

Detailed Description

Class that describes a possible contact between two BaseParticle.

In this class that describes a possible contact two BaseParticle we save both of these BaseParticle, the index of this PossibleContact and the PossibleContact that comes before and after this one in the linked list, both for the general list and the list for each of the particles.

Todo:
Change the names so that they follow the code guidelines.

Constructor & Destructor Documentation

◆ PossibleContact() [1/4]

PossibleContact::PossibleContact ( )
inline

Default constructor, sets all pointers to nullptr.

48  {
49  P1_ = nullptr;
50  P2_ = nullptr;
51  Next_ = nullptr;
52  Prev_ = nullptr;
53  Next1_ = nullptr;
54  Prev1_ = nullptr;
55  Next2_ = nullptr;
56  Prev2_ = nullptr;
57  index_ = 0;
58  }

References index_, Next1_, Next2_, Next_, P1_, P2_, Prev1_, Prev2_, and Prev_.

◆ PossibleContact() [2/4]

PossibleContact::PossibleContact ( BaseParticle P1,
BaseParticle P2 
)
inline

Constructor that takes two BaseParticle and sets them to be the BaseParticle associated with this PossibleContact.

Parameters
[in]P1A pointer to the first BaseParticle in this PossibleContact.
[in]P2A pointer to the second BaseParticle in this PossibleContact.
66  {
67  P1_ = P1;
68  P2_ = P2;
69  Next_ = nullptr;
70  Prev_ = nullptr;
71  Next1_ = nullptr;
72  Prev1_ = nullptr;
73  Next2_ = nullptr;
74  Prev2_ = nullptr;
75  index_ = 0;
76  }

References index_, Next1_, Next2_, Next_, P1_, P2_, Prev1_, Prev2_, and Prev_.

◆ PossibleContact() [3/4]

PossibleContact::PossibleContact ( BaseParticle P1,
BaseParticle P2,
PossibleContact Next 
)
inline

Constructor that takes two BaseParticle and the next global PossibleContact in the list and constructs a PossibleContact from that.

Parameters
[in]P1A pointer to the first BaseParticle in this PossibleContact.
[in]P2A pointer to the second BaseParticle in this PossibleContact.
[in]NextA pointer to the PossibleContact that comes after this one in the linked list.
85  {
86  P1_ = P1;
87  P2_ = P2;
88  Next_ = Next;
89  Prev_ = nullptr;
90  if (Next != nullptr)
91  index_ = Next->getIndex() + 1;
92  else
93  index_ = 0;
94 
95  Next1_ = nullptr;
96  Prev1_ = nullptr;
97  Next2_ = nullptr;
98  Prev2_ = nullptr;
99  }

References getIndex(), index_, Next1_, Next2_, Next_, P1_, P2_, Prev1_, Prev2_, and Prev_.

◆ PossibleContact() [4/4]

PossibleContact::PossibleContact ( BaseParticle P1,
BaseParticle P2,
PossibleContact Next,
PossibleContact Next1,
PossibleContact Next2 
)
inline

Constructor that should be used, takes all required information as parameters and sets it in the data-members.

Parameters
[in]P1A pointer to the first BaseParticle in this PossibleContact.
[in]P2A pointer to the second BaseParticle in this PossibleContact.
[in]NextA pointer to the PossibleContact that comes after this one in the linked list.
[in]Next1A pointer to the PossibleContact that comes after this one in the linked list associated with the first BaseParticle of this PossibleContact.
[in]Next2A pointer to the PossibleContact that comes after this one in the linked list associated with the second BaseParticle of this PossibleContact.
111  {
112  P1_ = P1;
113  P2_ = P2;
114  Next_ = Next;
115  Next1_ = Next1;
116  Next2_ = Next2;
117  Prev_ = 0;
118  Prev1_ = 0;
119  Prev2_ = 0;
120  if (Next != nullptr)
121  index_ = Next->getIndex() + 1;
122  else
123  index_ = 0;
124  }

References getIndex(), index_, Next1_, Next2_, Next_, P1_, P2_, Prev1_, Prev2_, and Prev_.

Member Function Documentation

◆ getIndex()

int PossibleContact::getIndex ( )
inline

Gets the index of this PossibleContact.

Returns
The index of this PossibleContact.
260  {
261  return index_;
262  }

References index_.

Referenced by PossibleContact(), and PossibleContactList::remove_ParticlePosibleContacts().

◆ getNext() [1/2]

PossibleContact* PossibleContact::getNext ( )
inline

Gets the next PossibleContact in the general linked list of PossibleContact.

Returns
A pointer to the next PossibleContact in the linked list.
168  {
169  return Next_;
170  }

References Next_.

Referenced by PossibleContactList::add_PossibleContact(), DPMBase::computeAllForces(), PossibleContactList::remove_ParticlePosibleContacts(), and PossibleContactList::write().

◆ getNext() [2/2]

PossibleContact* PossibleContact::getNext ( BaseParticle P)
inline

Gets the next PossibleContact in the linked list of PossibleContact of the given particle.

Parameters
[in]PA pointer to the BaseParticle for which we want to have the next contact of.
Returns
A pointer to the next PossibleContact in the linked list of PossibleContact of the given particle.
178  {
179  if (P1_ == P)
180  return Next1_;
181  else if (P2_ == P)
182  return Next2_;
183  else
184  {
185  logger(WARN, "PossibleContact* getNext(Particle* P), no match for %. Possibilities are % and %.",
186  P->getIndex(), P1_->getIndex(), P2_->getIndex());
187  return nullptr;
188  }
189  }

References BaseObject::getIndex(), logger, Next1_, Next2_, P1_, P2_, and WARN.

◆ getNext1()

PossibleContact* PossibleContact::getNext1 ( )
inline

Gets the next PossibleContact in the linked list of PossibleContact of the first particle in this PossibleContact.

Returns
A pointer to the next PossibleContact in the linked list of PossibleContact of the first particle in this PossibleContact.
224  {
225  return Next1_;
226  }

References Next1_.

Referenced by PossibleContactList::add_PossibleContact().

◆ getNext2()

PossibleContact* PossibleContact::getNext2 ( )
inline

Gets the next PossibleContact in the linked list of PossibleContact of the second particle in this PossibleContact.

Returns
A pointer to the next PossibleContact in the linked list of PossibleContact of the second particle in this PossibleContact.
242  {
243  return Next2_;
244  }

References Next2_.

Referenced by PossibleContactList::add_PossibleContact().

◆ getOtherParticle()

BaseParticle* PossibleContact::getOtherParticle ( BaseParticle P)
inline

Given one BaseParticle of the interacting pair, this function gets the other.

Parameters
[in]PA pointer to one of the BaseParticle of this PossibleContact.
Returns
The other BaseParticle of this PossibleContact.
150  {
151  if (P1_ == P)
152  return P2_;
153  else if (P2_ == P)
154  return P1_;
155  else
156  {
157  logger(WARN, "Particle* getOtherParticle(Particle *P), no match for % posibilities are % and %",
158  P->getIndex(), P1_->getIndex(), P2_->getIndex());
159  return nullptr;
160  }
161  }

References BaseObject::getIndex(), logger, P1_, P2_, and WARN.

Referenced by PossibleContactList::remove_ParticlePosibleContacts().

◆ getP1()

BaseParticle* PossibleContact::getP1 ( )
inline

Gets a pointer to the first BaseParticle in this PossibleContact.

Returns
A pointer to the first BaseParticle in this PossibleContact.
131  {
132  return P1_;
133  }

References P1_.

Referenced by DPMBase::computeAllForces(), and PossibleContactList::remove_ParticlePosibleContacts().

◆ getP2()

BaseParticle* PossibleContact::getP2 ( )
inline

Gets a pointer to the second BaseParticle in this PossibleContact.

Returns
A pointer to the second BaseParticle in this PossibleContact.
140  {
141  return P2_;
142  }

References P2_.

Referenced by DPMBase::computeAllForces(), and PossibleContactList::remove_ParticlePosibleContacts().

◆ getPrevious() [1/2]

PossibleContact* PossibleContact::getPrevious ( )
inline

Gets the previous PossibleContact in the general linked list of PossibleContact.

Returns
A pointer to the previous PossibleContact in the general linked list of PossibleContact.
196  {
197  return Prev_;
198  }

References Prev_.

Referenced by PossibleContactList::remove_ParticlePosibleContacts().

◆ getPrevious() [2/2]

PossibleContact* PossibleContact::getPrevious ( BaseParticle P)
inline

Gets the previous PossibleContact in the linked list of PossibleContact of the given particle.

Parameters
[in]PA pointer to the BaseParticle we want to know the previous PossibleContact for.
Returns
A pointer to the previous PossibleContact in the linked list of PossibleContact of the given particle.
206  {
207  if (P1_ == P)
208  return Prev1_;
209  else if (P2_ == P)
210  return Prev2_;
211  else
212  {
213  logger(WARN, "PossibleContact* getPrevious(Particle* P), no match for %. Possibilities are % and %.",
214  P->getIndex(), P1_->getIndex(), P2_->getIndex());
215  return nullptr;
216  }
217  }

References BaseObject::getIndex(), logger, P1_, P2_, Prev1_, Prev2_, and WARN.

◆ getPrevious1()

PossibleContact* PossibleContact::getPrevious1 ( )
inline

Gets the previous PossibleContact in the linked list of PossibleContact of the first particle in this PossibleContact.

Returns
A pointer to the previous PossibleContact in the linked list of PossibleContact of the first particle in this PossibleContact.
233  {
234  return Prev1_;
235  }

References Prev1_.

◆ getPrevious2()

PossibleContact* PossibleContact::getPrevious2 ( )
inline

Gets the previous PossibleContact in the linked list of PossibleContact of the second particle in this PossibleContact.

Returns
A pointer to the previous PossibleContact in the linked list of PossibleContact of the second particle in this PossibleContact.
251  {
252  return Prev2_;
253  }

References Prev2_.

◆ setNextPosition() [1/2]

void PossibleContact::setNextPosition ( BaseParticle P,
PossibleContact Next 
)
inline

Sets the next PossibleContact in the linked list of PossibleContact of the given particle.

Parameters
[in]PA pointer to the BaseParticle for which the next PossibleContact in the linked list must be set for.
[in]NextA pointer to the PossibleContact which is the next PossibleContact for the given BaseParticle.
297  {
298  if (P1_ == P)
299  Next1_ = Next;
300  else if (P2_ == P)
301  Next2_ = Next;
302  else
303  logger(WARN,
304  "void setNextPosition(Particle* P,PossibleContact* Next), no match for %. Possibilities are % and % ",
305  P->getIndex(), P1_->getIndex(), P2_->getIndex());
306  }

References BaseObject::getIndex(), logger, Next1_, Next2_, P1_, P2_, and WARN.

◆ setNextPosition() [2/2]

void PossibleContact::setNextPosition ( PossibleContact Next)
inline

Sets the next PossibleContact in the linked list of PossibleContac.

Parameters
[in]NextA pointer to the PossibleContact which is the next PossibleContact in the linked list of PossibleContact
287  {
288  Next_ = Next;
289  }

References Next_.

Referenced by PossibleContactList::remove_ParticlePosibleContacts().

◆ setNextPosition1()

void PossibleContact::setNextPosition1 ( PossibleContact Next1)
inline

Sets the next PossibleContact in the linked list of PossibleContact of the first particle in this PossibleContact.

Parameters
[in]Next1A pointer to the PossibleContact which is the next PossibleContact for the first BaseParticle.
339  {
340  Next1_ = Next1;
341  }

References Next1_.

◆ setNextPosition2()

void PossibleContact::setNextPosition2 ( PossibleContact Next2)
inline

Sets the next PossibleContact in the linked list of PossibleContact of the second particle in this PossibleContact.

Parameters
[in]Next2A pointer to the PossibleContact which is the next PossibleContact for the second BaseParticle.
357  {
358  Next2_ = Next2;
359  }

References Next2_.

◆ setP1()

void PossibleContact::setP1 ( BaseParticle P1)
inline

Sets the first particle in this PossibleContact.

Parameters
[in]P1A pointer to the BaseParticle that must be set as the first BaseParticle.
269  {
270  P1_ = P1;
271  }

References P1_.

◆ setP2()

void PossibleContact::setP2 ( BaseParticle P2)
inline

Sets the second particle in this PossibleContact.

Parameters
[in]P2A pointer to the BaseParticle that must be set as the second BaseParticle.
278  {
279  P2_ = P2;
280  }

References P2_.

◆ setPreviousPosition() [1/2]

void PossibleContact::setPreviousPosition ( BaseParticle P,
PossibleContact Prev 
)
inline

Sets the previous PossibleContact in the linked list of PossibleContact of the given particle.

Parameters
[in]PA pointer to the BaseParticle for which the previous PossibleContact in the linked list must be set for.
[in]PrevA pointer to the PossibleContact which is the previous PossibleContact for the given BaseParticle.
323  {
324  if (P1_ == P)
325  Prev1_ = Prev;
326  else if (P2_ == P)
327  Prev2_ = Prev;
328  else
329  logger(WARN,
330  "void setPreviousPosition(Particle* P,PossibleContact* Prev), no match for %. Possibilities are % and % ",
331  P->getIndex(), P1_->getIndex(), P2_->getIndex());
332  }

References BaseObject::getIndex(), logger, P1_, P2_, Prev1_, Prev2_, and WARN.

◆ setPreviousPosition() [2/2]

void PossibleContact::setPreviousPosition ( PossibleContact Prev)
inline

Sets the previous PossibleContact in the linked list of PossibleContact of the given particle.

Parameters
[in]PrevA pointer to the PossibleContact which is the previous PossibleContact in the linked list of PossibleContact
313  {
314  Prev_ = Prev;
315  }

References Prev_.

Referenced by PossibleContactList::add_PossibleContact(), and PossibleContactList::remove_ParticlePosibleContacts().

◆ setPreviousPosition1()

void PossibleContact::setPreviousPosition1 ( PossibleContact Prev1)
inline

Sets the previous PossibleContact in the linked list of PossibleContact of the first particle in this PossibleContact.

Parameters
[in]Prev1A pointer to the PossibleContact which is the previous PossibleContact for the first BaseParticle.
348  {
349  Prev1_ = Prev1;
350  }

References Prev1_.

◆ setPreviousPosition2()

void PossibleContact::setPreviousPosition2 ( PossibleContact Prev2)
inline

Sets the previous PossibleContact in the linked list of PossibleContact of the second particle in this PossibleContact.

Parameters
[in]Prev2A pointer to the PossibleContact which is the previous PossibleContact for the second BaseParticle.
366  {
367  Prev2_ = Prev2;
368  }

References Prev2_.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const PossibleContact o 
)
friend

Writes the index of this PossibleContact and the indices of the BaseParticle of this PossibleContact to the given ostream.

Parameters
[in,out]osThe output stream to which this PossibleContact must be written.
[in]oThe PossibleContact that must be written.
Returns
The output stream to which this PossibleContact has been written.
377  {
378  os << o.index_ << " between (" << o.P1_->getIndex() << "," << o.P2_->getIndex() << ")";
379  return os;
380  }

Member Data Documentation

◆ index_

int PossibleContact::index_
private

The index of this PossibleContact.

Referenced by getIndex(), and PossibleContact().

◆ Next1_

PossibleContact* PossibleContact::Next1_
private

A pointer to the PossibleContact that comes after this one in the linked list associated with the first BaseParticle of this PossibleContact.

Referenced by getNext(), getNext1(), PossibleContact(), setNextPosition(), and setNextPosition1().

◆ Next2_

PossibleContact* PossibleContact::Next2_
private

A pointer to the PossibleContact that comes after this one in the linked list associated with the second BaseParticle of this PossibleContact.

Referenced by getNext(), getNext2(), PossibleContact(), setNextPosition(), and setNextPosition2().

◆ Next_

PossibleContact* PossibleContact::Next_
private

A pointer to the PossibleContact that comes after this one in the linked list.

Referenced by getNext(), PossibleContact(), and setNextPosition().

◆ P1_

BaseParticle* PossibleContact::P1_
private

A pointer to the first BaseParticle in this PossibleContact.

Referenced by getNext(), getOtherParticle(), getP1(), getPrevious(), PossibleContact(), setNextPosition(), setP1(), and setPreviousPosition().

◆ P2_

BaseParticle* PossibleContact::P2_
private

A pointer to the second BaseParticle in this PossibleContact.

Referenced by getNext(), getOtherParticle(), getP2(), getPrevious(), PossibleContact(), setNextPosition(), setP2(), and setPreviousPosition().

◆ Prev1_

PossibleContact* PossibleContact::Prev1_
private

A pointer to the PossibleContact that comes before this one in the linked list associated with the first BaseParticle of this PossibleContact.

Referenced by getPrevious(), getPrevious1(), PossibleContact(), setPreviousPosition(), and setPreviousPosition1().

◆ Prev2_

PossibleContact* PossibleContact::Prev2_
private

A pointer to the PossibleContact that comes before this one in the linked list associated with the second BaseParticle of this PossibleContact.

Referenced by getPrevious(), getPrevious2(), PossibleContact(), setPreviousPosition(), and setPreviousPosition2().

◆ Prev_

PossibleContact* PossibleContact::Prev_
private

A pointer to the PossibleContact that comes before this one in the linked list.

Referenced by getPrevious(), PossibleContact(), and setPreviousPosition().


The documentation for this class was generated from the following file:
PossibleContact::Next_
PossibleContact * Next_
A pointer to the PossibleContact that comes after this one in the linked list.
Definition: PossibleContact.h:398
PossibleContact::Prev_
PossibleContact * Prev_
A pointer to the PossibleContact that comes before this one in the linked list.
Definition: PossibleContact.h:402
logger
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
PossibleContact::getIndex
int getIndex()
Gets the index of this PossibleContact.
Definition: PossibleContact.h:259
PossibleContact::Next1_
PossibleContact * Next1_
A pointer to the PossibleContact that comes after this one in the linked list associated with the fir...
Definition: PossibleContact.h:406
PossibleContact::P1_
BaseParticle * P1_
A pointer to the first BaseParticle in this PossibleContact.
Definition: PossibleContact.h:390
PossibleContact::Next2_
PossibleContact * Next2_
A pointer to the PossibleContact that comes after this one in the linked list associated with the sec...
Definition: PossibleContact.h:414
PossibleContact::Prev1_
PossibleContact * Prev1_
A pointer to the PossibleContact that comes before this one in the linked list associated with the fi...
Definition: PossibleContact.h:410
WARN
LL< Log::WARN > WARN
Warning log level.
Definition: Logger.cc:54
BaseObject::getIndex
unsigned int getIndex() const
Returns the index of the object in the handler.
Definition: BaseObject.h:118
PossibleContact::index_
int index_
The index of this PossibleContact.
Definition: PossibleContact.h:386
PossibleContact::P2_
BaseParticle * P2_
A pointer to the second BaseParticle in this PossibleContact.
Definition: PossibleContact.h:394
PossibleContact::Prev2_
PossibleContact * Prev2_
A pointer to the PossibleContact that comes before this one in the linked list associated with the se...
Definition: PossibleContact.h:418