MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BasePeriodicBoundary Class Referenceabstract

#include <BasePeriodicBoundary.h>

+ Inheritance diagram for BasePeriodicBoundary:

Public Member Functions

 BasePeriodicBoundary ()
 default constructor. More...
 
 BasePeriodicBoundary (const BasePeriodicBoundary &b)
 copy constructor More...
 
 ~BasePeriodicBoundary () override
 destructor More...
 
void read (std::istream &is) override
 Reads the object's id_ from given istream. More...
 
void write (std::ostream &os) const override
 Adds object's id_ to given ostream. More...
 
BasePeriodicBoundarycopy () const override=0
 Used to create a copy of the object NB: purely virtual function. More...
 
void setPeriodicHandler (PeriodicBoundaryHandler *periodicHandler)
 Sets the periodicBoundaryHandler, required for parallel periodic boundaries. More...
 
PeriodicBoundaryHandlergetPeriodicHandler () const
 Returns the periodic boundary handler. More...
 
virtual Mdouble getDistance (const BaseParticle &particle) const =0
 Returns the distance between a particle and the closest boundary, required for any periodic boundary. More...
 
virtual Mdouble getDistance (const Vec3D &position) const =0
 Returns the distance between a position and the closest boundary. More...
 
virtual bool isClosestToLeftBoundary (const Vec3D &position) const =0
 Returns true if it is closer to the left boundary than the right boundary. More...
 
virtual void shiftPosition (BaseParticle *particle) const =0
 Shifts the position (and velocity) of to the ghost particle. More...
 
void createPeriodicParticles (ParticleHandler &pH) override
 Creates periodic ocpies of given particle in case of periodic boundaries in serial build. More...
 
void checkBoundaryAfterParticlesMove (ParticleHandler &pH) override
 Virtual function that does things to particles, each time step after particles have moved. More...
 
virtual void modifyPeriodicComplexity (std::vector< int > &complexity, int &totalPeriodicComplexity, BaseParticle *particle, int i) const
 Modifies periodic complexity of a particle if necessary (i.e. maser boundary) More...
 
virtual void performActionsBeforeAddingParticles ()
 Actions that need to be performed before adding new ghost particles. More...
 
- Public Member Functions inherited from BaseBoundary
 BaseBoundary ()
 default constructor. More...
 
 BaseBoundary (const BaseBoundary &b)
 copy constructor More...
 
 ~BaseBoundary () override
 destructor More...
 
virtual void createPeriodicParticle (BaseParticle *p UNUSED, ParticleHandler &pH UNUSED)
 Creates a periodic particle in case of periodic boundaries in serial build. More...
 
virtual void createPeriodicParticles (ParticleHandler &pH UNUSED)
 Creates periodic copies of given particle in case of periodic boundaries. More...
 
virtual void checkBoundaryBeforeTimeStep (DPMBase *md)
 Virtual function that does things before each time step. More...
 
virtual void actionsBeforeTimeLoop ()
 Virtual function that does something after DPMBase::setupInitialConditions but before the first time step. More...
 
virtual void modifyGhostAfterCreation (BaseParticle *particle, int i)
 
virtual void writeVTK (std::fstream &file)
 
void setHandler (BoundaryHandler *handler)
 Sets the boundary's BoundaryHandler. More...
 
BoundaryHandlergetHandler () const
 Returns the boundary's BoundaryHandler. More...
 
- Public Member Functions inherited from BaseObject
 BaseObject ()=default
 Default constructor. More...
 
 BaseObject (const BaseObject &p)=default
 Copy constructor, copies all the objects BaseObject contains. More...
 
virtual ~BaseObject ()=default
 virtual destructor More...
 
virtual std::string getName () const =0
 A purely virtual function. More...
 
virtual void moveInHandler (unsigned int index)
 Except that it is virtual, it does the same thing as setIndex() does. More...
 
void setIndex (unsigned int index)
 Allows one to assign an index to an object in the handler/container. More...
 
void setId (unsigned long id)
 Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More...
 
unsigned int getIndex () const
 Returns the index of the object in the handler. More...
 
unsigned int getId () const
 Returns the unique identifier of any particular object. More...
 
void setGroupId (unsigned groupId)
 
unsigned getGroupId () const
 

Private Attributes

PeriodicBoundaryHandlerperiodicHandler_
 pointer to the periodic boundary handler More...
 

Detailed Description

Inherits from BaseObject

Definition at line 40 of file BasePeriodicBoundary.h.

Constructor & Destructor Documentation

BasePeriodicBoundary::BasePeriodicBoundary ( )

default constructor.

Default constructor

Definition at line 35 of file BasePeriodicBoundary.cc.

References periodicHandler_.

36  : BaseBoundary()
37 {
38  periodicHandler_ = nullptr;
39 #ifdef DEBUG_CONSTRUCTOR
40  std::cout<<"BasePeriodicBoundary::BasePeriodicBoundary() finished"<<std::endl;
41 #endif
42 }
PeriodicBoundaryHandler * periodicHandler_
pointer to the periodic boundary handler
BaseBoundary()
default constructor.
Definition: BaseBoundary.cc:32
BasePeriodicBoundary::BasePeriodicBoundary ( const BasePeriodicBoundary b)

copy constructor

Note: shallow copy! Otherwise the HGrid causes a stack overflow.

Copy constructor

Definition at line 48 of file BasePeriodicBoundary.cc.

49  : BaseBoundary(b)
50 {
52 #ifdef DEBUG_CONSTRUCTOR
53  std::cout<<"BasePeriodicBoundary::BasePeriodicBoundary(const BasePeriodicBoundary&b) finished"<<std::endl;
54 #endif
55 }
PeriodicBoundaryHandler * periodicHandler_
pointer to the periodic boundary handler
BaseBoundary()
default constructor.
Definition: BaseBoundary.cc:32
BasePeriodicBoundary::~BasePeriodicBoundary ( )
override

destructor

Destructor

Definition at line 60 of file BasePeriodicBoundary.cc.

61 {
62 #ifdef DEBUG_DESTRUCTOR
63  std::cout << "BasePeriodicBoundary::~BasePeriodicBoundary() finished"<<std::endl;
64 #endif
65 }

Member Function Documentation

void BasePeriodicBoundary::checkBoundaryAfterParticlesMove ( ParticleHandler pH)
overridevirtual

Virtual function that does things to particles, each time step after particles have moved.

checks whether particles have passed the boundary, and if so, does something special with it. (i.e. deletion boundary, insertion boundary) NB: virtual function

Parameters
[out]pHthe particle handler.
Returns
returns TRUE if given particle actually did pass the boundary

Reimplemented from BaseBoundary.

Reimplemented in PeriodicBoundary, and SubcriticalMaserBoundaryTEST.

Definition at line 111 of file BasePeriodicBoundary.cc.

112 {
113 }
BasePeriodicBoundary* BasePeriodicBoundary::copy ( ) const
overridepure virtual

Used to create a copy of the object NB: purely virtual function.

Implements BaseBoundary.

Implemented in PeriodicBoundary, and SubcriticalMaserBoundaryTEST.

void BasePeriodicBoundary::createPeriodicParticles ( ParticleHandler pH)
override

Creates periodic ocpies of given particle in case of periodic boundaries in serial build.

Checks the distance of given particle to the closest of both periodic walls, and creates a periodic copy of the particle if needed (i.e. if the particle is closer to the periodic wall than the radius of the largest particle in the system). NOTE: This is only for a serial build - periodic particles work different in parallel

Parameters
[in,out]pHSystem's ParticleHandler, (1) from which the interaction radius of its largest particle is retrieved to determine the maximum distance from the wall at which a particle should still have a periodic copy created, and (2) to which a possible periodic copy of the particle will be added

Definition at line 127 of file BasePeriodicBoundary.cc.

128 {
129 }
virtual Mdouble BasePeriodicBoundary::getDistance ( const BaseParticle particle) const
pure virtual

Returns the distance between a particle and the closest boundary, required for any periodic boundary.

Parameters
[in]particleThe distance between this particle and the closest boundary is calculated

Implemented in PeriodicBoundary.

Referenced by PeriodicBoundaryHandler::computePeriodicComplexity().

virtual Mdouble BasePeriodicBoundary::getDistance ( const Vec3D position) const
pure virtual

Returns the distance between a position and the closest boundary.

Parameters
[in]positionThe distance between this particle and the closest boundary is calculated

Implemented in PeriodicBoundary, and SubcriticalMaserBoundaryTEST.

PeriodicBoundaryHandler * BasePeriodicBoundary::getPeriodicHandler ( ) const

Returns the periodic boundary handler.

Returns the pointer to the BoundaryHandler the boundary belongs to

Returns
pointer to the handler

Definition at line 99 of file BasePeriodicBoundary.cc.

References periodicHandler_.

Referenced by SubcriticalMaserBoundaryTEST::activateMaser().

100 {
101  return periodicHandler_;
102 }
PeriodicBoundaryHandler * periodicHandler_
pointer to the periodic boundary handler
virtual bool BasePeriodicBoundary::isClosestToLeftBoundary ( const Vec3D position) const
pure virtual

Returns true if it is closer to the left boundary than the right boundary.

Computes if a certain position is close to the left boundary (true) or if it is not close to the left boundary (false)

Parameters
[in]positionThe position which is being checked

Implemented in PeriodicBoundary.

Referenced by PeriodicBoundaryHandler::computePeriodicComplexity().

void BasePeriodicBoundary::modifyPeriodicComplexity ( std::vector< int > &  complexity,
int &  totalPeriodicComplexity,
BaseParticle particle,
int  i 
) const
virtual

Modifies periodic complexity of a particle if necessary (i.e. maser boundary)

Reimplemented in SubcriticalMaserBoundaryTEST.

Definition at line 132 of file BasePeriodicBoundary.cc.

134 {
135 }
void BasePeriodicBoundary::performActionsBeforeAddingParticles ( )
virtual

Actions that need to be performed before adding new ghost particles.

Reimplemented in SubcriticalMaserBoundaryTEST.

Definition at line 138 of file BasePeriodicBoundary.cc.

Referenced by PeriodicBoundaryHandler::performActionsBeforeAddingParticles().

139 {
140 }
void BasePeriodicBoundary::read ( std::istream &  is)
overridevirtual

Reads the object's id_ from given istream.

Reads the object's id_ from the given istream

Parameters
[in,out]isistream the id_ is read from

Implements BaseBoundary.

Reimplemented in PeriodicBoundary, and SubcriticalMaserBoundaryTEST.

Definition at line 71 of file BasePeriodicBoundary.cc.

References BaseBoundary::read().

Referenced by PeriodicBoundary::read().

72 {
74 }
void read(std::istream &is) override=0
Reads the object's id_ from given istream NB: purely virtual function, overriding the version of Base...
Definition: BaseBoundary.cc:61
void BasePeriodicBoundary::setPeriodicHandler ( PeriodicBoundaryHandler periodicHandler)

Sets the periodicBoundaryHandler, required for parallel periodic boundaries.

Sets the pointer to the BoundaryHandler the boundary belongs to

Parameters
[in]handlerpointer to the boundary handler

Definition at line 90 of file BasePeriodicBoundary.cc.

References periodicHandler_.

Referenced by PeriodicBoundaryHandler::addObject().

91 {
92  periodicHandler_ = periodicHandler;
93 }
PeriodicBoundaryHandler * periodicHandler_
pointer to the periodic boundary handler
virtual void BasePeriodicBoundary::shiftPosition ( BaseParticle particle) const
pure virtual

Shifts the position (and velocity) of to the ghost particle.

Shifts the position of a particle to the other boundary. Note: In some cases it doesnt only shift the position, but also other quantities such as velocity

Parameters
[in]particlePointer to the particle that will shift position

Implemented in PeriodicBoundary.

Referenced by PeriodicBoundaryHandler::shiftParticle().

void BasePeriodicBoundary::write ( std::ostream &  os) const
overridevirtual

Adds object's id_ to given ostream.

Adds the object's id_ to the given ostream

Parameters
[in]osostream the id_ is added to

Implements BaseBoundary.

Reimplemented in PeriodicBoundary, and SubcriticalMaserBoundaryTEST.

Definition at line 80 of file BasePeriodicBoundary.cc.

References BaseBoundary::write().

Referenced by PeriodicBoundary::write().

81 {
83 }
void write(std::ostream &os) const override=0
Adds object's id_ to given ostream NB: purely virtual function, overriding the version of BaseObject...
Definition: BaseBoundary.cc:70

Member Data Documentation

PeriodicBoundaryHandler* BasePeriodicBoundary::periodicHandler_
private

pointer to the periodic boundary handler

Definition at line 138 of file BasePeriodicBoundary.h.

Referenced by BasePeriodicBoundary(), getPeriodicHandler(), and setPeriodicHandler().


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