MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InfiniteWall Class Reference

This is a class defining walls. More...

#include <InfiniteWall.h>

+ Inheritance diagram for InfiniteWall:

Public Member Functions

 InfiniteWall ()
 
 InfiniteWall (const InfiniteWall &p)
 
InfiniteWallcopy () const
 Wall copy method. It calls the copy contrustor of this Wall, usefull for polymorfism. More...
 
void clear ()
 
void set (Vec3D normal_, Mdouble position_)
 Defines a standard wall, given an outward normal vector s. t. normal*x=position. More...
 
void move (Mdouble position_)
 Allows the wall to be moved to a new position. More...
 
void move (Vec3D velocity_, Mdouble dt)
 Allows the wall to be moved to a new position (also orthogonal to the normal), and setting the velocity. More...
 
void move_time (Mdouble dt)
 Allows the wall to be moved with time. More...
 
Mdouble get_distance (const Vec3D &Position)
 Returns the distance of the wall to the particle. More...
 
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. More...
 
void read (std::istream &is)
 reads wall More...
 
void print (std::ostream &os) const
 outputs wall More...
 
Vec3D get_Normal () const
 access function for normal More...
 
Mdouble get_Position () const
 access function for position More...
 
Vec3D get_Velocity () const
 access function for velocity More...
 
- Public Member Functions inherited from BaseWall
 BaseWall ()
 
 BaseWall (const BaseWall &p)
 
virtual ~BaseWall ()
 
virtual bool get_distance_and_normal (BaseParticle &P UNUSED, Mdouble &distance UNUSED, Vec3D &normal_return UNUSED)=0
 
void set_Velocity (Vec3D new_)
 access function for velocity More...
 
virtual void read (std::istream &is UNUSED)=0
 
virtual void print (std::ostream &os UNUSED) const =0
 
virtual void moveInHandler (int newPos)
 
int getIndSpecies () const
 
void setIndSpecies (const int _new)
 
const Vec3Dget_Force () const
 
const Vec3Dget_Torque () const
 
void set_Force (Vec3D _new)
 
void set_Torque (Vec3D _new)
 
void set_Index (int index)
 
void set_Id (int id)
 
void add_Force (Vec3D _new)
 
void add_Torque (Vec3D _new)
 

Private Attributes

Vec3D normal
 
Mdouble position
 
Mdouble factor
 

Additional Inherited Members

- Public Attributes inherited from BaseWall
int indSpecies
 
- Protected Attributes inherited from BaseWall
Vec3D velocity
 velocity of the wall (used to calculate the relative velocity in the force calculation) More...
 

Detailed Description

This is a class defining walls.

It defines the interaction of regular walls and periodic walls with particles as defined in Particle Modifications: Definition of a wall (planar or finite). A standard wall is a plane defined as {x: normal*x=position}, with normal being the outward unit normal vector of the wall. A particle touches a standard wall if position-normal*x<=radius. A finite wall is convex polygon defined by a set of normals normal_i and positions position_i. A particle touches a finite wall if position_i-normal_i*x<=radius for all i.

Todo:
remove access to set Nwalls and wall set etc.. and add function add_wall. This would have stoped a lot of bugs in my own (Anthony's) driver codes.

Definition at line 42 of file InfiniteWall.h.

Constructor & Destructor Documentation

InfiniteWall::InfiniteWall ( )
inline

Definition at line 45 of file InfiniteWall.h.

Referenced by copy().

45  : BaseWall()
46  {
47  #ifdef CONSTUCTOR_OUTPUT
48  std::cout<<"InfiniteWall () finished"<<std::endl;
49  #endif
50  }
BaseWall()
Definition: BaseWall.h:38
InfiniteWall::InfiniteWall ( const InfiniteWall p)
inline

Definition at line 52 of file InfiniteWall.h.

References factor, normal, and position.

52  : BaseWall(p)
53  {
54  normal=p.normal;
56  factor=p.factor;
57  #ifdef CONSTUCTOR_OUTPUT
58  std::cout<<"InfiniteWall (const InfiniteWall &p) finished"<<std::endl;
59  #endif
60  }
Mdouble factor
Definition: InfiniteWall.h:138
BaseWall()
Definition: BaseWall.h:38
Mdouble position
Definition: InfiniteWall.h:137

Member Function Documentation

void InfiniteWall::clear ( )
inlinevirtual

Reimplemented from BaseWall.

Definition at line 68 of file InfiniteWall.h.

References BaseWall::indSpecies, Vec3D::set_zero(), and BaseWall::velocity.

69  {
70  indSpecies = 0;
72  }
Vec3D velocity
velocity of the wall (used to calculate the relative velocity in the force calculation) ...
Definition: BaseWall.h:114
void set_zero()
Definition: Vector.h:55
int indSpecies
Definition: BaseWall.h:36
InfiniteWall* InfiniteWall::copy ( ) const
inlinevirtual

Wall copy method. It calls the copy contrustor of this Wall, usefull for polymorfism.

Implements BaseWall.

Definition at line 63 of file InfiniteWall.h.

References InfiniteWall().

64  {
65  return new InfiniteWall(*this);
66  }
Mdouble InfiniteWall::get_distance ( const Vec3D Position)
inline

Returns the distance of the wall to the particle.

Definition at line 101 of file InfiniteWall.h.

References normal, and position.

Referenced by get_distance_and_normal().

101 {return position - Dot(Position, normal);}
Mdouble position
Definition: InfiniteWall.h:137
bool InfiniteWall::get_distance_and_normal ( BaseParticle P,
Mdouble distance,
Vec3D normal_return 
)
inline

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.

Definition at line 104 of file InfiniteWall.h.

References get_distance(), BaseParticle::get_Position(), BaseParticle::get_WallInteractionRadius(), and normal.

105  {
106  distance = get_distance(P.get_Position());
107  if (distance>=P.get_WallInteractionRadius())
108  return false;
109  normal_return = normal;
110  return true;
111  }
Mdouble get_distance(const Vec3D &Position)
Returns the distance of the wall to the particle.
Definition: InfiniteWall.h:101
Mdouble get_WallInteractionRadius() const
const Vec3D & get_Position() const
Vec3D InfiniteWall::get_Normal ( ) const
inline

access function for normal

Definition at line 128 of file InfiniteWall.h.

References normal.

128 {return normal;}
Mdouble InfiniteWall::get_Position ( ) const
inline

access function for position

Definition at line 130 of file InfiniteWall.h.

References position.

130 {return position;}
Mdouble position
Definition: InfiniteWall.h:137
Vec3D InfiniteWall::get_Velocity ( ) const
inlinevirtual

access function for velocity

Implements BaseWall.

Definition at line 133 of file InfiniteWall.h.

References BaseWall::velocity.

133 {return velocity;}
Vec3D velocity
velocity of the wall (used to calculate the relative velocity in the force calculation) ...
Definition: BaseWall.h:114
void InfiniteWall::move ( Mdouble position_  )
inlinevirtual

Allows the wall to be moved to a new position.

Reimplemented from BaseWall.

Definition at line 84 of file InfiniteWall.h.

References factor, and position.

84  {
85  position=position_*factor;
86  }
Mdouble factor
Definition: InfiniteWall.h:138
Mdouble position
Definition: InfiniteWall.h:137
void InfiniteWall::move ( Vec3D velocity_  ,
Mdouble dt   
)
inlinevirtual

Allows the wall to be moved to a new position (also orthogonal to the normal), and setting the velocity.

Reimplemented from BaseWall.

Definition at line 89 of file InfiniteWall.h.

References normal, position, and BaseWall::velocity.

89  {
90  velocity=velocity_;
91  position+=Dot(velocity,normal)*dt;
92  }
Vec3D velocity
velocity of the wall (used to calculate the relative velocity in the force calculation) ...
Definition: BaseWall.h:114
Mdouble position
Definition: InfiniteWall.h:137
void InfiniteWall::move_time ( Mdouble dt  )
inlinevirtual

Allows the wall to be moved with time.

Reimplemented from BaseWall.

Definition at line 95 of file InfiniteWall.h.

References normal, position, and BaseWall::velocity.

95  {
96  position+=Dot(velocity,normal)*dt;
97  }
Vec3D velocity
velocity of the wall (used to calculate the relative velocity in the force calculation) ...
Definition: BaseWall.h:114
Mdouble position
Definition: InfiniteWall.h:137
void InfiniteWall::print ( std::ostream &  os) const
inline

outputs wall

Definition at line 120 of file InfiniteWall.h.

References Vec3D::GetLength2, normal, position, and BaseWall::velocity.

120  {
121  os << "InfiniteWall normal " << normal << " position " << position;
122  //\todo{species should be written}
123  //optional output
124  if (velocity.GetLength2()) os << " velocity " << velocity;
125  }
Vec3D velocity
velocity of the wall (used to calculate the relative velocity in the force calculation) ...
Definition: BaseWall.h:114
friend Mdouble GetLength2(const Vec3D &A)
Definition: Vector.h:183
Mdouble position
Definition: InfiniteWall.h:137
void InfiniteWall::read ( std::istream &  is)
inline

reads wall

Definition at line 114 of file InfiniteWall.h.

References normal, position, and BaseWall::velocity.

114  {
115  std::string dummy;
116  is >> dummy >> normal >> dummy >> position >> dummy >> velocity;
117  }
Vec3D velocity
velocity of the wall (used to calculate the relative velocity in the force calculation) ...
Definition: BaseWall.h:114
Mdouble position
Definition: InfiniteWall.h:137
void InfiniteWall::set ( Vec3D  normal_,
Mdouble  position_ 
)
inline

Defines a standard wall, given an outward normal vector s. t. normal*x=position.

Definition at line 75 of file InfiniteWall.h.

References factor, normal, and position.

Referenced by Chute::create_bottom(), MD::load_par_ini_file(), Chute::setup_particles_initial_conditions(), and ChuteBottom::setup_particles_initial_conditions().

76  {
77  //factor is used to set n to unit length
78  factor = 1. / sqrt(Dot(normal_, normal_));
79  normal = normal_ * factor;
80  position = position_ * factor;
81  }
Mdouble factor
Definition: InfiniteWall.h:138
Mdouble position
Definition: InfiniteWall.h:137

Member Data Documentation

Mdouble InfiniteWall::factor
private

Definition at line 138 of file InfiniteWall.h.

Referenced by InfiniteWall(), move(), and set().

Vec3D InfiniteWall::normal
private
Mdouble InfiniteWall::position
private

Definition at line 137 of file InfiniteWall.h.

Referenced by get_distance(), get_Position(), InfiniteWall(), move(), move_time(), print(), read(), and set().


The documentation for this class was generated from the following file: