MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AngledPeriodicBoundary.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 
27 #ifndef AngledPeriodicBoundary_H
28 #define AngledPeriodicBoundary_H
29 
30 #include "BaseBoundary.h"
31 #include "Math/Vector.h"
32 #include "Math/Matrix.h"
33 
34 class BaseParticle;
35 
37 
47 {
48 public:
49 
53  AngledPeriodicBoundary* copy() const final;
54 
55  //todo constructors instead of set functions?
56  //AngledPeriodicBoundary (Vec3D normal_left_, Vec3D normal_right_, Vec3D origin_)
57 
61  void set(Vec3D normalLeft, Vec3D normalRight, Vec3D origin);
62 
70  Mdouble distance(const BaseParticle& P);
71 
75  //this function should be cheap, as it has to be computed for all particles
76  Mdouble distance(const Vec3D& P);
77 
82  void shiftPosition(BaseParticle* P);
83 
84 
88  void shiftPositions(Vec3D& P1, Vec3D& P2);
89 
93  void read(std::istream& is) override;
94 
98  void oldRead(std::istream& is);
99 
103  void write(std::ostream& os) const override;
104 
108  std::string getName() const override;
109 
113  Vec3D& getNormal();
114 
119 
120  void createPeriodicParticle(BaseParticle* p, ParticleHandler& pH) override;
121 
125  void createPeriodicParticles(ParticleHandler& pH) override;
126 
132 
134 
135 private:
136  //values set by the user
141 
146 
151  //values set by the code
155  bool leftWall_;
172 
174 
176 
185 
189  //Vec3D angularShift_;
190 };
191 
192 #endif
Vec3D origin_
common point of both walls
AngledPeriodicBoundary * copy() const final
Used to create a copy of the object NB: purely virtual function.
void shiftPositions(Vec3D &P1, Vec3D &P2)
only needed in StatisticsVector
double Mdouble
Definition: GeneralDefine.h:34
void read(std::istream &is) override
reads wall
Vec3D leftRadialAxis_
outward unit normal vector for left wall
void oldRead(std::istream &is)
Mdouble getOpeningAngle()
angle between walls in radians
void write(std::ostream &os) const override
outputs wall
std::string getName() const override
Returns the name of the object.
void createPeriodicParticle(BaseParticle *p, ParticleHandler &pH) override
void createPeriodicParticles(ParticleHandler &pH) override
void checkBoundaryAfterParticleMoved(BaseParticle *P)
void checkBoundaryAfterParticlesMove(ParticleHandler &pH) override
Virtual function that does things to particles, each time step after particles have moved...
Vec3D commonAxis_
The normalized cross product of the left and right normal vector. This vector points in the direction...
Mdouble distance(const BaseParticle &P)
Returns the distance of the wall to the particle and sets left_wall = true, if the left wall is the w...
void set(Vec3D normalLeft, Vec3D normalRight, Vec3D origin)
Defines a periodic wall.
Container to store all BaseParticle.
bool leftWall_
true if closest wall is the left wall
Vec3D rightRadialAxis_
outward unit normal vector for right wall
Vec3D rightNormal_
outward unit normal vector for right wall
Implementation of a 3D matrix.
Definition: Matrix.h:37
Definition: Vector.h:49
void shiftPosition(BaseParticle *P)
shifts the particle (after distance set the left_wall value)