MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BoundaryHandler Class Reference

Container to store all BaseBoundary. More...

#include <BoundaryHandler.h>

+ Inheritance diagram for BoundaryHandler:

Public Member Functions

void addObject (BaseBoundary *P)
 Adds a BaseBoundary to the BoundaryHandler. More...
 
void readObject (std::istream &is)
 Reads BaseBoundary into the BoundaryHandler from restart data. More...
 
- Public Member Functions inherited from BaseHandler< BaseBoundary >
 BaseHandler ()
 Default BaseHandler constructor, it simply creates an empty BaseHandler. More...
 
 BaseHandler (const BaseHandler< BaseBoundary > &BH)
 Copy constructor, it copies the BaseHandler and all Object it contains. More...
 
virtual ~BaseHandler ()
 Assignment operator. More...
 
void copyAndAddObject (const BaseBoundary &O)
 Creates a copy of a Object and adds it to the BaseHandler. More...
 
void copyAndAddObject (const BaseBoundary *O)
 Creates a copy of a Object and adds it to the BaseHandler. More...
 
virtual void removeObject (unsigned const int id)
 Removes a Object from the BaseHandler. More...
 
void removeLastObject ()
 Removes the last Object from the BaseHandler. More...
 
void clear ()
 Empties the whole BaseHandler by removing all Object. More...
 
BaseBoundarygetObject (const unsigned int id) const
 Gets a pointer to the Object at the specified index in the BaseHandler. More...
 
BaseBoundarygetLastObject () const
 Gets a pointer to the last Object in this BaseHandler. More...
 
unsigned int getNumberOfObjects () const
 Gets the number of Object in this BaseHandler. More...
 
unsigned int getStorageCapacity () const
 Gets the storage capacity of this BaseHandler. More...
 
void setStorageCapacity (const unsigned int N)
 Sets the storage capacity of this BaseHandler. More...
 
const std::vector
< BaseBoundary * >
::const_iterator 
begin () const
 Gets the begin of the const_iterator over all Object in this BaseHandler. More...
 
const std::vector
< BaseBoundary * >::iterator 
begin ()
 Gets the begin of the iterator over all BaseBoundary in this BaseHandler. More...
 
const std::vector
< BaseBoundary * >
::const_iterator 
end () const
 Gets the end of the const_iterator over all BaseBoundary in this BaseHandler. More...
 
const std::vector
< BaseBoundary * >::iterator 
end ()
 Gets the end of the iterator over all BaseBoundary in this BaseHandler. More...
 

Detailed Description

Container to store all BaseBoundary.

The BoundaryHandler is a container to store all BaseBoundary. It is implemented by a vector of pointers to BaseBoundary.

Definition at line 35 of file BoundaryHandler.h.

Member Function Documentation

void BoundaryHandler::addObject ( BaseBoundary P)
virtual

Adds a BaseBoundary to the BoundaryHandler.

Parameters
[in]PA pointer to the BaseBoundary (or derived class) that has to be added.

Reimplemented from BaseHandler< BaseBoundary >.

Definition at line 38 of file BoundaryHandler.cc.

References BaseHandler< T >::addObject(), BaseHandler< BaseBoundary >::getLastObject(), and BaseBoundary::setHandler().

39 {
40  //Puts the particle in the Particle list
42  //set the particleHandler pointer
43  getLastObject()->setHandler(this);
44 }
virtual void addObject(T *O)
Adds a new Object to the BaseHandler.
Definition: BaseHandler.h:106
BaseBoundary * getLastObject() const
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:192
void setHandler(BoundaryHandler *handler)
Definition: BaseBoundary.h:51
void BoundaryHandler::readObject ( std::istream &  is)
virtual

Reads BaseBoundary into the BoundaryHandler from restart data.

Parameters
[in]isThe input stream from which the information is read.

Implements BaseHandler< BaseBoundary >.

Definition at line 47 of file BoundaryHandler.cc.

References BaseHandler< BaseBoundary >::copyAndAddObject().

Referenced by MD::read(), MD::read_v1(), and MD::read_v2().

48 {
49  std::string type;
50  is >> type;
51  if(type.compare("PeriodicBoundary")==0)
52  {
53  PeriodicBoundary periodicBoundary;
54  is>>periodicBoundary;
55  copyAndAddObject(periodicBoundary);
56  }
57  else if(type.compare("DeletionBoundary")==0)
58  {
59  DeletionBoundary deletionBoundary;
60  is>>deletionBoundary;
61  copyAndAddObject(deletionBoundary);
62  }
63  else if(type.compare("CircularPeriodicBoundary")==0)
64  {
65  CircularPeriodicBoundary circularPeriodicBoundary;
66  is>>circularPeriodicBoundary;
67  copyAndAddObject(circularPeriodicBoundary);
68  }
69  else
70  {
71  std::cerr<<"Boundary type: "<<type<<" not understood in restart file"<<std::endl;
72  exit(-1);
73  }
74 }
void copyAndAddObject(const BaseBoundary &O)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:93
Defines a pair of periodic walls. The particles are in {x: position_left<=normal*x
Defines a pair of periodic walls. The particles are in {x: position_left<=normal*x

The documentation for this class was generated from the following files: