MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BasePeriodicBoundary.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, 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 BasePeriodicBoundary_H
27 #define BasePeriodicBoundary_H
28 
29 #include "BaseBoundary.h"
30 #include "Math/ExtendedMath.h"
31 #include "Side.h"
32 
34 
41 {
42 public:
47 
52 
56  ~BasePeriodicBoundary() override;
57 
61  void read(std::istream& is) override;
62 
66  void write(std::ostream& os) const override;
67 
72  BasePeriodicBoundary* copy() const override = 0;
73 
77  void setPeriodicHandler(PeriodicBoundaryHandler* periodicHandler);
78 
83 
88  virtual Mdouble getDistance(const BaseParticle& particle) const = 0;
89 
94  virtual Mdouble getDistance(const Vec3D& position) const = 0;
95 
102  virtual bool isClosestToLeftBoundary(const Vec3D& position) const = 0;
103 
111  virtual void shiftPosition(BaseParticle* particle) const = 0;
112 
116  void createPeriodicParticles(ParticleHandler& pH) override;
117 
122 
126  virtual void modifyPeriodicComplexity(std::vector<int>& complexity, int& totalPeriodicComplexity,
127  BaseParticle* particle, int i) const;
128 
133 
134 private:
139 };
140 
141 #endif
void write(std::ostream &os) const override
Adds object's id_ to given ostream.
virtual Mdouble getDistance(const BaseParticle &particle) const =0
Returns the distance between a particle and the closest boundary, required for any periodic boundary...
double Mdouble
Definition: GeneralDefine.h:34
virtual void shiftPosition(BaseParticle *particle) const =0
Shifts the position (and velocity) of to the ghost particle.
PeriodicBoundaryHandler * periodicHandler_
pointer to the periodic boundary handler
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
BasePeriodicBoundary()
default constructor.
PeriodicBoundaryHandler * getPeriodicHandler() const
Returns the periodic boundary handler.
BasePeriodicBoundary * copy() const override=0
Used to create a copy of the object NB: purely virtual function.
void setPeriodicHandler(PeriodicBoundaryHandler *periodicHandler)
Sets the periodicBoundaryHandler, required for parallel periodic boundaries.
Container to store pointers to all BasePeriodicBoundary objects.
void read(std::istream &is) override
Reads the object's id_ from given istream.
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)
void checkBoundaryAfterParticlesMove(ParticleHandler &pH) override
Virtual function that does things to particles, each time step after particles have moved...
void createPeriodicParticles(ParticleHandler &pH) override
Creates periodic ocpies of given particle in case of periodic boundaries in serial build...
Container to store all BaseParticle.
virtual void performActionsBeforeAddingParticles()
Actions that need to be performed before adding new ghost particles.
Definition: Vector.h:49
~BasePeriodicBoundary() override
destructor
virtual bool isClosestToLeftBoundary(const Vec3D &position) const =0
Returns true if it is closer to the left boundary than the right boundary.