MercuryDPM  Beta
 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-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 
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;
36 
46 {
47 public:
48 
52  AngledPeriodicBoundary* copy() const final;
53 
54  //todo constructors instead of set functions?
55  //AngledPeriodicBoundary (Vec3D normal_left_, Vec3D normal_right_, Vec3D origin_)
56 
60  void set(Vec3D normalLeft, Vec3D normalRight, Vec3D origin);
61 
69  Mdouble distance(const BaseParticle &P);
70 
74  //this function should be cheap, as it has to be computed for all particles
75  Mdouble distance(const Vec3D &P);
76 
81  void shiftPosition(BaseParticle* P);
82 
83 
87  void shiftPositions(Vec3D& P1, Vec3D& P2);
88 
92  void read(std::istream& is);
93 
97  void oldRead(std::istream& is);
98 
102  void write(std::ostream& os) const;
103 
107  virtual std::string getName() const;
108 
112  Vec3D& getNormal();
113 
118 
123 
129 
130 private:
131  //values set by the user
136 
141 
146  //values set by the code
150  bool leftWall_;
167 
169 
171 
180 
184  //Vec3D angularShift_;
185 };
186 #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
bool checkBoundaryAfterParticleMoved(BaseParticle *P, ParticleHandler &pH UNUSED)
double Mdouble
void read(std::istream &is)
reads wall
Vec3D leftRadialAxis_
outward unit normal vector for left wall
void oldRead(std::istream &is)
Mdouble getOpeningAngle()
angle between walls in radians
Vec3D commonAxis_
The normalized cross product of the left and right normal vector. This vector points in the direction...
#define UNUSED
Definition: GeneralDefine.h:37
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.
virtual std::string getName() const
Returns the name of the object.
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:36
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
void shiftPosition(BaseParticle *P)
shifts the particle (after distance set the left_wall value)
void createPeriodicParticles(BaseParticle *P, ParticleHandler &pH)
void write(std::ostream &os) const
outputs wall