MercuryDPM  Beta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LeesEdwardsBoundary.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, 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 LEESEDWARDSBOUNDARY_H
27 #define LEESEDWARDSBOUNDARY_H
28 
29 #include "BaseBoundary.h"
30 
31 #include <functional>
32 
33 class ParticleHandler;
34 
43 {
44 public:
45 
49  void set(std::function<double (double)> shift, std::function<double (double)> velocity, Mdouble left, Mdouble right, Mdouble down, Mdouble up);
50 
54  void read(std::istream& is);
55 
59  void write(std::ostream& os) const;
60 
64  virtual std::string getName() const;
65 
69  LeesEdwardsBoundary* copy() const;
70 
74  Mdouble getHorizontalDistance(BaseParticle& p, bool& positive);
75 
79  Mdouble getVerticalDistance(BaseParticle& p, bool& positive);
80 
84  void shiftHorizontalPosition(BaseParticle* p, bool positive);
85 
89  void shiftVerticalPosition(BaseParticle* p, bool positive);
90 
95 
100 
105 
110 private:
115  std::function<double (double)> shift_;
116  std::function<double (double)> velocity_;
117 };
118 #endif
std::function< double(double)> shift_
(signed) Vertical distance between the top wall and the origin
void set(std::function< double(double)> shift, std::function< double(double)> velocity, Mdouble left, Mdouble right, Mdouble down, Mdouble up)
Sets all boundary properties.
Class which creates a boundary with Lees-Edwards type periodic boundary conditions.
std::function< double(double)> velocity_
double Mdouble
void createPeriodicParticles(BaseParticle *p, ParticleHandler &pH)
Creates horizontal and vertical periodic copies of given particle, if needed.
void createHorizontalPeriodicParticles(BaseParticle *p, ParticleHandler &pH)
Creates horizontal periodic copies of given particle, if needed.
virtual std::string getName() const
Returns the name of the object.
void shiftVerticalPosition(BaseParticle *p, bool positive)
Applies a vertical shift to the given particle.
Mdouble up_
(signed) Vertical distance between the bottom wall and the origin
void createVerticalPeriodicParticles(BaseParticle *p, ParticleHandler &pH)
Creates vertical periodic copies of given particle, if needed.
#define UNUSED
Definition: GeneralDefine.h:37
Mdouble down_
(signed) Horizontal distance between the right wall and the origin
void write(std::ostream &os) const
Writes all boundary properties to a stream.
Container to store all BaseParticle.
void shiftHorizontalPosition(BaseParticle *p, bool positive)
Applies a horizontal shift to the given particle.
bool checkBoundaryAfterParticleMoved(BaseParticle *p, ParticleHandler &pH UNUSED)
Checks if particle crossed a boundary wall and if so, applies periodic shift.
LeesEdwardsBoundary * copy() const
Creates a copy of the object.
Mdouble right_
(signed) Horizontal distance between the left wall and the origin
void read(std::istream &is)
Reads all boundary properties from a stream.
Mdouble getHorizontalDistance(BaseParticle &p, bool &positive)
Returns distance from given particle to the closest horizontal wall.
Mdouble getVerticalDistance(BaseParticle &p, bool &positive)
Returns distance from given particle to the closest vertical wall.