MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseWall.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 BASEWALL_H
27 #define BASEWALL_H
28 
29 #include "Particles/BaseParticle.h"
30 //Note the get_Velocity can for some walls be dependend on which point on the wall is meant.
31 
32 class BaseWall
33 {
34  public:
35 
37 
39  {
41  force.set_zero();
42  torque.set_zero();
43  indSpecies=0;
44  _handler=0;
45  _index=0;
46  _id=0;
47 
48  #ifdef CONSTUCTOR_OUTPUT
49  std::cout<<"BaseWall() finished"<<std::endl;
50  #endif
51  }
52 
53  BaseWall(const BaseWall &p)
54  {
56  force=p.force;
57  torque=p.torque;
60  _index=p._index;
61  _id=p._id;
62 
63  #ifdef CONSTUCTOR_OUTPUT
64  std::cout<<"BaseWall(const BaseWall &p) finished"<<std::endl;
65  #endif
66  }
67 
68  virtual ~BaseWall() {};
69 
70  virtual BaseWall* copy() const = 0;
71 
72  virtual void clear() {std::cout<<"BaseWall::clear(), this function shouldn't be called"<<std::endl;}
73 
75  virtual void move(Mdouble position_ UNUSED) {std::cout<<"BaseWall:move(Mdouble position_ UNUSED), this function shouldn't be called"<<std::endl;}
76 
78  virtual void move(Vec3D velocity_ UNUSED, Mdouble dt UNUSED) {std::cout<<"BaseWall::move(Vec3D velocity_, Mdouble dt UNUSED), this function shouldn't be called"<<std::endl;}
79 
81  virtual void move_time(Mdouble dt UNUSED) {std::cout<<"BaseWall::move_time(Mdouble dt UNUSED), this function shouldn't be called"<<std::endl;}
82 
83  virtual bool get_distance_and_normal(BaseParticle &P UNUSED, Mdouble &distance UNUSED, Vec3D &normal_return UNUSED) = 0;
84 
86  void set_Velocity(Vec3D new_) {velocity=new_;}
87 
88  virtual Vec3D get_Velocity() const = 0;
89 
90  friend inline std::ostream& operator<<(std::ostream& os, BaseWall &w);
91 
92  friend inline std::istream& operator>>(std::istream& is, BaseWall &w);
93 
94  virtual void read(std::istream& is UNUSED) = 0;
95 
96  virtual void print(std::ostream& os UNUSED) const = 0;
97 
98  virtual void moveInHandler(int newPos){_index=newPos;}
99 
100  int getIndSpecies() const {return indSpecies;}
101 
102  void setIndSpecies(const int _new) {indSpecies=_new;}
103 
104  const Vec3D& get_Force() const {return force;}
105  const Vec3D& get_Torque() const {return torque;}
106  void set_Force(Vec3D _new) {force=_new;}
107  void set_Torque(Vec3D _new) {torque=_new;}
108  void set_Index(int index) {_index=index;}
109  void set_Id(int id) {_id=id;}
110  void add_Force (Vec3D _new) {force+=_new;}
111  void add_Torque (Vec3D _new) {torque+=_new;}
112 
113 protected:
115 private:
119  int _index;
120  int _id;
121 
122 };
123 
124 inline std::ostream& operator<<(std::ostream& os, BaseWall &w)
125 {
126  w.print(os);
127  return os;
128 }
129 
130 inline std::istream& operator>>(std::istream& is, BaseWall &w)
131 {
132  w.read(is);
133  return(is);
134 }
135 #endif
int _index
Definition: BaseWall.h:119
int getIndSpecies() const
Definition: BaseWall.h:100
void setIndSpecies(const int _new)
Definition: BaseWall.h:102
virtual void move(Vec3D velocity_ UNUSED, Mdouble dt UNUSED)
Allows the wall to be moved to a new position (also orthogonal to the normal), and setting the veloci...
Definition: BaseWall.h:78
Vec3D velocity
velocity of the wall (used to calculate the relative velocity in the force calculation) ...
Definition: BaseWall.h:114
friend std::ostream & operator<<(std::ostream &os, BaseWall &w)
Definition: BaseWall.h:124
const Vec3D & get_Force() const
Definition: BaseWall.h:104
void set_Force(Vec3D _new)
Definition: BaseWall.h:106
virtual void clear()
Definition: BaseWall.h:72
int _id
Definition: BaseWall.h:120
std::istream & operator>>(std::istream &is, BaseWall &w)
Definition: BaseWall.h:130
virtual void move(Mdouble position_ UNUSED)
Allows the wall to be moved to a new position.
Definition: BaseWall.h:75
virtual ~BaseWall()
Definition: BaseWall.h:68
friend std::istream & operator>>(std::istream &is, BaseWall &w)
Definition: BaseWall.h:130
double Mdouble
Definition: ExtendedMath.h:33
void set_Velocity(Vec3D new_)
access function for velocity
Definition: BaseWall.h:86
BaseWall()
Definition: BaseWall.h:38
virtual void read(std::istream &is UNUSED)=0
virtual bool get_distance_and_normal(BaseParticle &P UNUSED, Mdouble &distance UNUSED, Vec3D &normal_return UNUSED)=0
void set_Index(int index)
Definition: BaseWall.h:108
void set_Torque(Vec3D _new)
Definition: BaseWall.h:107
void set_zero()
Definition: Vector.h:55
Container to store all BaseWall.
Definition: WallHandler.h:36
void add_Force(Vec3D _new)
Definition: BaseWall.h:110
virtual void print(std::ostream &os UNUSED) const =0
virtual Vec3D get_Velocity() const =0
#define UNUSED
Definition: ExtendedMath.h:38
BaseWall(const BaseWall &p)
Definition: BaseWall.h:53
virtual void moveInHandler(int newPos)
Definition: BaseWall.h:98
int indSpecies
Definition: BaseWall.h:36
Vec3D torque
Definition: BaseWall.h:117
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
void set_Id(int id)
Definition: BaseWall.h:109
const Vec3D & get_Torque() const
Definition: BaseWall.h:105
virtual BaseWall * copy() const =0
Vec3D force
Definition: BaseWall.h:116
void add_Torque(Vec3D _new)
Definition: BaseWall.h:111
WallHandler * _handler
Definition: BaseWall.h:118
std::ostream & operator<<(std::ostream &os, BaseWall &w)
Definition: BaseWall.h:124
virtual void move_time(Mdouble dt UNUSED)
Allows the wall to be moved to a new position (also orthogonal to the normal), and setting the veloci...
Definition: BaseWall.h:81