AngledPeriodicBoundary.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 
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 
36 class ParticleHandler;
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 
71 
75  //this function should be cheap, as it has to be computed for all particles
76  Mdouble distance(const Vec3D& P);
77 
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
Definition: AngledPeriodicBoundary.h:47
void checkBoundaryAfterParticleMoved(BaseParticle *P)
Definition: AngledPeriodicBoundary.cc:317
Vec3D & getNormal()
Definition: AngledPeriodicBoundary.cc:254
void checkBoundaryAfterParticlesMove(ParticleHandler &pH) override
Virtual function that does things to particles, each time step after particles have moved.
Definition: AngledPeriodicBoundary.cc:325
bool leftWall_
true if closest wall is the left wall
Definition: AngledPeriodicBoundary.h:155
Matrix3D rotateLeft
Definition: AngledPeriodicBoundary.h:173
Mdouble getOpeningAngle()
angle between walls in radians
Definition: AngledPeriodicBoundary.cc:265
Vec3D origin_
common point of both walls
Definition: AngledPeriodicBoundary.h:150
Vec3D rightRadialAxis_
outward unit normal vector for right wall
Definition: AngledPeriodicBoundary.h:163
void createPeriodicParticle(BaseParticle *p, ParticleHandler &pH) override
Definition: AngledPeriodicBoundary.cc:273
Vec3D rightNormal_
outward unit normal vector for right wall
Definition: AngledPeriodicBoundary.h:145
Matrix3D rotateRight
Definition: AngledPeriodicBoundary.h:175
void shiftPositions(Vec3D &P1, Vec3D &P2)
only needed in StatisticsVector
Definition: AngledPeriodicBoundary.cc:182
Vec3D commonAxis_
The normalized cross product of the left and right normal vector. This vector points in the direction...
Definition: AngledPeriodicBoundary.h:184
AngledPeriodicBoundary * copy() const final
Used to create a copy of the object NB: purely virtual function.
Definition: AngledPeriodicBoundary.cc:35
Vec3D leftRadialAxis_
outward unit normal vector for left wall
Definition: AngledPeriodicBoundary.h:159
void oldRead(std::istream &is)
Definition: AngledPeriodicBoundary.cc:225
void set(Vec3D normalLeft, Vec3D normalRight, Vec3D origin)
Defines a periodic wall.
Definition: AngledPeriodicBoundary.cc:59
Vec3D leftNormal_
Definition: AngledPeriodicBoundary.h:140
Vec3D differenceNormal_
Definition: AngledPeriodicBoundary.h:171
void createPeriodicParticles(ParticleHandler &pH) override
Definition: AngledPeriodicBoundary.cc:305
std::string getName() const override
Returns the name of the object.
Definition: AngledPeriodicBoundary.cc:246
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...
Definition: AngledPeriodicBoundary.cc:93
void shiftPosition(BaseParticle *P)
shifts the particle (after distance set the left_wall value)
Definition: AngledPeriodicBoundary.cc:124
void write(std::ostream &os) const override
outputs wall
Definition: AngledPeriodicBoundary.cc:235
void read(std::istream &is) override
reads wall
Definition: AngledPeriodicBoundary.cc:214
Vec3D differenceRadialAxis_
Definition: AngledPeriodicBoundary.h:167
Definition: BaseBoundary.h:49
Definition: BaseParticle.h:54
Implementation of a 3D matrix.
Definition: Matrix.h:38
Container to store all BaseParticle.
Definition: ParticleHandler.h:48
Definition: Vector.h:51
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73