MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CylindricalWall.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 CYLINDRICALWALL_H
28 #define CYLINDRICALWALL_H
29 
30 #include "BaseWall.h"
31 
32 class CylindricalWall : public BaseWall
33 {
34  public:
36  {
37  #ifdef CONSTUCTOR_OUTPUT
38  std::cout<<"CylindricalWall () finished"<<std::endl;
39  #endif
40  }
41 
43  {
44  radius=p.radius;
45  #ifdef CONSTUCTOR_OUTPUT
46  std::cout<<"CylindricalWall (const CylindricalWall &p) finished"<<std::endl;
47  #endif
48  }
49 
51  {
52  this->radius=radius;
53  #ifdef CONSTUCTOR_OUTPUT
54  std::cout<<"CylindricalWall (double radius) finished"<<std::endl;
55  #endif
56  }
57 
60  {
61  return new CylindricalWall(*this);
62  }
63 
64  void clear()
65  {
66  indSpecies = 0;
67  }
68 
71  {
72  this->radius=radius;
73  }
74 
76  bool get_distance_and_normal(BaseParticle &P, Mdouble &distance, Vec3D &normal_return)
77  {
78  double R=sqrt(pow(P.get_Position().X,2)+pow(P.get_Position().Y,2));
79  distance=radius-R;
80  if(distance>=P.get_Radius()) return false;
81 
82  normal_return.X=P.get_Position().X;
83  normal_return.Y=P.get_Position().Y;
84  normal_return.Z=0.0;
85  normal_return/=normal_return.GetLength();
86 
87  /*std::cout<<"Contact Cylindrical Wall"<<std::endl;
88  std::cout<<"Particle index="<<P.get_Index()<<" position="<<P.get_Position()<<" R="<<R<<std::endl;
89  std::cout<<"distance="<<distance<<" normal="<<normal_return<<std::endl;
90  std::cout<<"Overlap="<<distance-P.get_Radius()<<" velocity="<<P.get_Velocity()<<std::endl;*/
91  return true;
92  }
93 
95  void read(std::istream& is) {
96  std::string dummy;
97  is >> dummy >> radius;
98  }
99 
101  void print(std::ostream& os) const {
102  os << "CylindricalWall radius " << radius;
103  }
104 
106  double get_Radius() {return radius;}
107  Vec3D get_Velocity() const {return Vec3D(0.0,0.0,0.0);}
108 
109 private:
111 };
112 
113 #endif
Mdouble X
Definition: Vector.h:44
double get_Radius()
access function for radius
bool get_distance_and_normal(BaseParticle &P, Mdouble &distance, Vec3D &normal_return)
Since this function should be called before calculating any Particle-Wall interactions, it can also be used to set the normal vector in case of curved walls.
CylindricalWall(const CylindricalWall &p)
Mdouble get_Radius() const
double Mdouble
Definition: ExtendedMath.h:33
CylindricalWall * copy() const
Wall copy method. It calls the copy contrustor of this Wall, usefull for polymorfism.
CylindricalWall(double radius)
void print(std::ostream &os) const
outputs wall
const Vec3D & get_Position() const
Mdouble Y
Definition: Vector.h:44
int indSpecies
Definition: BaseWall.h:36
Mdouble GetLength() const
Definition: Vector.h:248
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
void set(Mdouble radius)
Defines a standard wall, given an outward normal vector s. t. normal*x=position.
void read(std::istream &is)
reads wall
Mdouble Z
Definition: Vector.h:44
Vec3D get_Velocity() const