BasePeriodicBoundary.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, 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 
117  void createPeriodicParticles(ParticleHandler& pH) override;
118 
123 
127  virtual void modifyPeriodicComplexity(std::vector<int>& complexity, int& totalPeriodicComplexity,
128  BaseParticle* particle, int i) const;
129 
134 
135 private:
140 };
141 
142 #endif
Definition: BaseBoundary.h:49
Definition: BaseParticle.h:54
Definition: BasePeriodicBoundary.h:41
void setPeriodicHandler(PeriodicBoundaryHandler *periodicHandler)
Sets the periodicBoundaryHandler, required for parallel periodic boundaries.
Definition: BasePeriodicBoundary.cc:90
virtual void shiftPosition(BaseParticle *particle) const =0
Shifts the position (and velocity) of to the ghost particle.
void write(std::ostream &os) const override
Adds object's id_ to given ostream.
Definition: BasePeriodicBoundary.cc:80
BasePeriodicBoundary()
default constructor.
Definition: BasePeriodicBoundary.cc:35
virtual Mdouble getDistance(const BaseParticle &particle) const =0
Returns the distance between a particle and the closest boundary, required for any periodic boundary.
void read(std::istream &is) override
Reads the object's id_ from given istream.
Definition: BasePeriodicBoundary.cc:71
void checkBoundaryAfterParticlesMove(ParticleHandler &pH) override
Virtual function that does things to particles, each time step after particles have moved.
Definition: BasePeriodicBoundary.cc:111
PeriodicBoundaryHandler * periodicHandler_
pointer to the periodic boundary handler
Definition: BasePeriodicBoundary.h:139
virtual bool isClosestToLeftBoundary(const Vec3D &position) const =0
Returns true if it is closer to the left boundary than the right boundary.
virtual void performActionsBeforeAddingParticles()
Actions that need to be performed before adding new ghost particles.
Definition: BasePeriodicBoundary.cc:138
void createPeriodicParticles(ParticleHandler &pH) override
Creates periodic ocpies of given particle in case of periodic boundaries in serial build.
Definition: BasePeriodicBoundary.cc:127
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)
Definition: BasePeriodicBoundary.cc:132
PeriodicBoundaryHandler * getPeriodicHandler() const
Returns the periodic boundary handler.
Definition: BasePeriodicBoundary.cc:99
virtual Mdouble getDistance(const Vec3D &position) const =0
Returns the distance between a position and the closest boundary.
BasePeriodicBoundary * copy() const override=0
Used to create a copy of the object NB: purely virtual function.
~BasePeriodicBoundary() override
destructor
Definition: BasePeriodicBoundary.cc:60
Container to store all BaseParticle.
Definition: ParticleHandler.h:48
Container to store pointers to all BasePeriodicBoundary objects.
Definition: PeriodicBoundaryHandler.h:46
Definition: Vector.h:51
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51