MercuryDPM  Beta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Screw Class Reference

This function defines an Archimedes' screw in the z-direction from a (constant) starting point, a (constant) length L, a (constant) radius r, a (constant) number or revelations N and a (constant) rotation speed (rev/s) More...

#include <Screw.h>

+ Inheritance diagram for Screw:

Public Member Functions

 Screw ()
 Default constructor: make a screw with default parameters. More...
 
 Screw (const Screw &other)
 Copy constructor, copies another Screw. More...
 
 Screw (Vec3D start, Mdouble l, Mdouble r, Mdouble n, Mdouble omega, Mdouble thickness)
 Constructor in which all parameters of the screw are set. More...
 
 ~Screw ()
 Default destructor. More...
 
Screwcopy () const final
 Copy this screw and return a pointer to the copy. More...
 
bool getDistanceAndNormal (const BaseParticle &P, Mdouble &distance, Vec3D &normal_return) const final
 Compute the distance from the Screw for a given BaseParticle and return if there is a collision. If there is a collision, also return the normal vector of the interaction point. More...
 
void move_time (Mdouble dt)
 Rotate the Screw for a period dt, so that the offset_ changes with omega_*dt. More...
 
void read (std::istream &is) override
 Reads a Screw from an input stream, for example a restart file. More...
 
void oldRead (std::istream &is)
 Reads a Screw in the old style from an input stream, for example a restart file old style. More...
 
void write (std::ostream &os) const override
 Writes this Screw to an output stream, for example a restart file. More...
 
std::string getName () const final
 Returns the name of the object, here the string "Screw". More...
 
BaseInteractiongetInteractionWith (BaseParticle *p, Mdouble timeStamp, InteractionHandler *interactionHandler) final
 Get the interaction between this Screw and given BaseParticle at a given time. More...
 
- Public Member Functions inherited from BaseWall
 BaseWall ()
 Default constructor. It makes an empty BaseWall. More...
 
 BaseWall (const BaseWall &w)
 Copy constructor. More...
 
virtual ~BaseWall ()
 Default destructor. More...
 
virtual MERCURY_DEPRECATED void clear ()
 A function that removes all data from this BaseWall, so sets handler_ to nullptr. More...
 
void setHandler (WallHandler *handler)
 A function which sets the WallHandler for this BaseWall. More...
 
WallHandlergetHandler () const
 A function which returns the WallHandler that handles this BaseWall. More...
 
void setIndSpecies (unsigned int indSpecies)
 Define the species of this wall using the index of the species in the SpeciesHandler in this DPMBase. More...
 
void setSpecies (const ParticleSpecies *species)
 Define the species of this wall. More...
 
- Public Member Functions inherited from BaseInteractable
 BaseInteractable ()
 Default BaseInteractable constructor, it simply creates an empty BaseInteractable. More...
 
 BaseInteractable (const BaseInteractable &p)
 Copy constructor. It copies the BaseInteractable and all objects it contains. More...
 
virtual ~BaseInteractable ()
 Destructor, it simply destructs the BaseInteractable and all the objects it contains. More...
 
unsigned int getIndSpecies () const
 Returns the index of the Species of this BaseInteractable. More...
 
const ParticleSpeciesgetSpecies () const
 Returns a pointer to the species of this BaseInteractable. More...
 
void setSpecies (const ParticleSpecies *species)
 Sets the species of this BaseInteractable. More...
 
const Vec3DgetForce () const
 Returns the force on this BaseInteractable. More...
 
const Vec3DgetTorque () const
 Returns the torque on this BaseInteractable. More...
 
void setForce (Vec3D force)
 Sets the force on this BaseInteractable. More...
 
void setTorque (Vec3D torque)
 Sets the torque on this BaseInteractable. More...
 
void addForce (Vec3D addForce)
 Adds an amount to the force on this BaseInteractable. More...
 
void addTorque (Vec3D addTorque)
 Adds an amount to the torque on this BaseInteractable. More...
 
const Vec3DgetPosition () const
 Returns the position of this BaseInteractable. More...
 
const Vec3DgetOrientation () const
 Returns the orientation of this BaseInteractable. More...
 
void setPosition (const Vec3D &position)
 Sets the position of this BaseInteractable. More...
 
void setOrientation (const Vec3D &orientation)
 Sets the orientation of this BaseInteractable. More...
 
virtual void move (const Vec3D &move)
 Moves this BaseInteractable by adding an amount to the position. More...
 
void rotate (const Vec3D &rotate)
 Rotates this BaseInteractable. More...
 
const std::list
< BaseInteraction * > & 
getInteractions () const
 Returns a reference to the list of interactions in this BaseInteractable. More...
 
void addInteraction (BaseInteraction *I)
 Adds an interaction to this BaseInteractable. More...
 
bool removeInteraction (BaseInteraction *I)
 Removes an interaction from this BaseInteractable. More...
 
void copyInteractionsForPeriodicParticles (const BaseInteractable &p)
 Copies interactions to this BaseInteractable whenever a periodic copy made. More...
 
void setVelocity (const Vec3D &velocity)
 set the velocity of the BaseInteractable. More...
 
void setAngularVelocity (const Vec3D &angularVelocity)
 set the angular velocity of the BaseInteractble. More...
 
void addVelocity (const Vec3D &velocity)
 adds an increment to the velocity. More...
 
void addAngularVelocity (const Vec3D &angularVelocity)
 add an increment to the angular velocity. More...
 
virtual const Vec3DgetVelocity () const
 Returns the velocity of this interactable. More...
 
virtual const Vec3DgetAngularVelocity () const
 Returns the angular velocity of this interactable. More...
 
void setPrescribedPosition (std::function< Vec3D(double)> prescribedPosition)
 Allows the position of an infinite mass interactable to be prescribed. More...
 
void applyPrescribedPosition (double time)
 Computes the position from the user defined prescribed position function. More...
 
void setPrescribedVelocity (std::function< Vec3D(double)> prescribedVelocity)
 Allows the velocity of an infinite mass interactable to be prescribed. More...
 
void applyPrescribedVelocity (double time)
 Computes the velocity from the user defined prescribed velocity function. More...
 
void setPrescribedOrientation (std::function< Vec3D(double)> prescribedOrientation)
 Allows the orientation of the infinite mass interactbale to be prescribed. More...
 
void applyPrescribedOrientation (double time)
 Computes the orientation from the user defined prescribed orientation function. More...
 
void setPrescribedAngularVelocity (std::function< Vec3D(double)> prescribedAngularVelocity)
 Allows the angular velocity of the infinite mass interactable to be prescribed. More...
 
void applyPrescribedAngularVelocity (double time)
 Computes the angular velocity from the user defined prescribed angular velocity. More...
 
virtual const Vec3D getVelocityAtContact (const Vec3D &contact) const
 Returns the velocity at the contact point, use by many force laws. More...
 
void integrateBeforeForceComputation (double time, double timeStep)
 This is part of integrate routine for objects with infinite mass. More...
 
void integrateAfterForceComputation (double time, double timeStep)
 This is part of the integration routine for objects with infinite mass. More...
 
- Public Member Functions inherited from BaseObject
 BaseObject ()
 Default constructor. More...
 
 BaseObject (const BaseObject &p)
 Copy constructor, copies all the objects BaseObject contains. More...
 
virtual ~BaseObject ()
 virtual destructor More...
 
virtual void moveInHandler (const unsigned int index)
 Except that it is virtual, it does the same thing as setIndex() does. More...
 
void setIndex (const unsigned int index)
 Allows one to assign an index to an object in the handler/container. More...
 
void setId (const unsigned int id)
 Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More...
 
unsigned int getIndex () const
 Returns the index of the object in the handler. More...
 
unsigned int getId () const
 Returns the unique identifier of any particular object. More...
 

Private Attributes

Vec3D start_
 The centre of the lower end of the screw. More...
 
Mdouble l_
 The length of the Screw. More...
 
Mdouble maxR_
 The outer radius of the Screw. More...
 
Mdouble n_
 The number of revelations. More...
 
Mdouble omega_
 Rotation speed in rev/s. More...
 
Mdouble offset_
 The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation. More...
 
Mdouble thickness_
 The thickness of the Screw. More...
 

Detailed Description

This function defines an Archimedes' screw in the z-direction from a (constant) starting point, a (constant) length L, a (constant) radius r, a (constant) number or revelations N and a (constant) rotation speed (rev/s)

q is a new coordinate going from 0 to 1 and t is the time, x=xs+r*cos(2*pi*(offset+N*q)), y=ys+r*sin(2*pi*(offset+N*q)), z=zs+q*L

Todo:
IFCD: Can these details about class Screw be made more clear? I don't understand them.

Definition at line 38 of file Screw.h.

Constructor & Destructor Documentation

Screw::Screw ( )

Default constructor: make a screw with default parameters.

Make a Screw which is centered in the origin, has a length of 1, one revelation, a radius of 1, turns with 1 revelation per second, is infinitely thin and starts at its normal initial point.

Definition at line 36 of file Screw.cc.

References DEBUG, l_, logger, maxR_, n_, offset_, omega_, Vec3D::setZero(), start_, and thickness_.

Referenced by copy().

37 {
38  start_.setZero();
39  l_ = 1.0;
40  maxR_ = 1.0;
41  n_ = 1.0;
42  omega_ = 1.0;
43  offset_ = 0.0;
44  thickness_ = 0.0;
45  logger(DEBUG, "Screw() constructor finished.");
46 }
Mdouble maxR_
The outer radius of the Screw.
Definition: Screw.h:114
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setZero()
Sets all elements to zero.
Definition: Vector.cc:52
Vec3D start_
The centre of the lower end of the screw.
Definition: Screw.h:106
Mdouble offset_
The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation.
Definition: Screw.h:126
Mdouble l_
The length of the Screw.
Definition: Screw.h:110
Mdouble n_
The number of revelations.
Definition: Screw.h:118
Mdouble thickness_
The thickness of the Screw.
Definition: Screw.h:130
Mdouble omega_
Rotation speed in rev/s.
Definition: Screw.h:122
Screw::Screw ( const Screw other)

Copy constructor, copies another Screw.

Parameters
[in]otherThe Screw that has to be copied.

Definition at line 51 of file Screw.cc.

References DEBUG, l_, logger, maxR_, n_, offset_, omega_, start_, and thickness_.

52  : BaseWall(other)
53 {
54  start_ = other.start_;
55  l_ = other.l_;
56  maxR_ = other.maxR_;
57  n_ = other.n_;
58  omega_ = other.omega_;
59  thickness_ = other.thickness_;
60  offset_ = other.offset_;
61  logger(DEBUG, "Screw(const Screw&) copy constructor finished.");
62 }
Mdouble maxR_
The outer radius of the Screw.
Definition: Screw.h:114
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Vec3D start_
The centre of the lower end of the screw.
Definition: Screw.h:106
Mdouble offset_
The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation.
Definition: Screw.h:126
Mdouble l_
The length of the Screw.
Definition: Screw.h:110
BaseWall()
Default constructor. It makes an empty BaseWall.
Definition: BaseWall.cc:31
Mdouble n_
The number of revelations.
Definition: Screw.h:118
Mdouble thickness_
The thickness of the Screw.
Definition: Screw.h:130
Mdouble omega_
Rotation speed in rev/s.
Definition: Screw.h:122
Screw::Screw ( Vec3D  start,
Mdouble  l,
Mdouble  r,
Mdouble  n,
Mdouble  omega,
Mdouble  thickness 
)

Constructor in which all parameters of the screw are set.

Parameters
[in]startA Vec3D which denotes the centre of the lower end of the Screw.
[in]lThe length of the Screw, must be positive.
[in]rThe radius of the Screw, must be positive.
[in]nThe number of revelations of the Screw, must be positive.
[in]omegaThe rotation speed of the Screw in rev/s.
[in]thicknessThe thickness of the Screw, must be non-negative.

Make a Screw by assigning all input parameters to the data-members of this class, and setting the offset_ to 0.

Definition at line 74 of file Screw.cc.

References DEBUG, l_, logger, maxR_, n_, offset_, omega_, start_, and thickness_.

75 {
76  start_ = start;
77  l_ = l;
78  maxR_ = r;
79  n_ = n;
80  omega_ = omega;
81  thickness_ = thickness;
82  offset_ = 0.0;
83  logger(DEBUG, "Screw(Vec3D, Mdouble, Mdouble, Mdouble, Mdouble, Mdouble) constructor finished.");
84 }
Mdouble maxR_
The outer radius of the Screw.
Definition: Screw.h:114
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Vec3D start_
The centre of the lower end of the screw.
Definition: Screw.h:106
Mdouble offset_
The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation.
Definition: Screw.h:126
Mdouble l_
The length of the Screw.
Definition: Screw.h:110
Mdouble n_
The number of revelations.
Definition: Screw.h:118
Mdouble thickness_
The thickness of the Screw.
Definition: Screw.h:130
Mdouble omega_
Rotation speed in rev/s.
Definition: Screw.h:122
Screw::~Screw ( )

Default destructor.

Definition at line 86 of file Screw.cc.

References DEBUG, and logger.

87 {
88  logger(DEBUG, "~Screw() finished, destroyed the Screw.");
89 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")

Member Function Documentation

Screw * Screw::copy ( ) const
finalvirtual

Copy this screw and return a pointer to the copy.

Returns
A pointer to a copy of this Screw.

Implements BaseWall.

Definition at line 94 of file Screw.cc.

References Screw().

95 {
96  return new Screw(*this);
97 }
Screw()
Default constructor: make a screw with default parameters.
Definition: Screw.cc:36
bool Screw::getDistanceAndNormal ( const BaseParticle p,
Mdouble distance,
Vec3D normal_return 
) const
finalvirtual

Compute the distance from the Screw for a given BaseParticle and return if there is a collision. If there is a collision, also return the normal vector of the interaction point.

Parameters
[in]pBaseParticle we want to calculate the distance and whether it collided of.
[out]distanceThe distance of the BaseParticle to this wall.
[out]normal_returnIf there was a collision, the normal vector to this wall will be placed here.
Returns
A boolean which says whether or not there was a collision.

This function computes whether or not there is a collision between a given BaseParticle and this Screw. If there is a collision, this function also computes the distance between the BaseParticle and Screw and the normal of the IntersectionOfWalls at the intersection point.

Todo:
Make this function readable and explain the steps in the details.

Implements BaseWall.

Definition at line 110 of file Screw.cc.

References Vec3D::getLength(), BaseInteractable::getPosition(), BaseParticle::getWallInteractionRadius(), l_, maxR_, n_, offset_, constants::pi, R, mathsFunc::sign(), constants::sqr_pi, start_, thickness_, Vec3D::X, Vec3D::Y, and Vec3D::Z.

Referenced by getInteractionWith().

111 {
112  Mdouble Rsqr = pow(p.getPosition().X - start_.X, 2) + pow(p.getPosition().Y - start_.Y, 2);
114  {
115  //std::cout<<"Particle is out of first bound checking"<<std::endl;
116  //std::cout<<"Rule 1: "<<Rsqr<<"<"<<pow(r+P.getRadius()+thickness_,2)<<std::endl;
117  //std::cout<<"Rule 2: "<<Start.Z-P.getRadius()-thickness_<<"<"<<P.getPosition().Z<<"<"<<L+Start.Z+P.getRadius()+thickness_<<std::endl;
118  return false;
119  }
120  Mdouble R = sqrt(Rsqr);
121  Mdouble alpha = atan2(p.getPosition().Y - start_.Y, p.getPosition().X - start_.X);
122  Mdouble dz = p.getPosition().Z - start_.Z;
123 
124  //To find the contact point we have to minimize (with respect to r and q)
125  //Distance^2=(x-x0-r*cos(2*Pi*(offset+N*q)))^2+(y-y0-r*sin(2*Pi*(offset+N*q)))^2+(z-z0-q*L)^2
126  //Using polar coordinated (i.e. x-x0=R*cos(alpha), y-y0=R*sin(alpha) and dz=z-z0)
127  //Distance^2=R^2+r^2-2*R*r*cos(alpha-2*Pi*(offset+N*q))+(dz-q*L)^2
128 
129  //Differentiation with respect to r and solve for zero:
130  //0=2*r-2*R*cos(alpha-2*Pi*(offset+N*q)
131  //r=R*cos(alpha-2*Pi*(offset+N*q))
132 
133  //Substitue back
134  //Distance^2=R^2+R^2*cos^2(alpha-2*Pi*(offset+N*q))-2*R^2*cos(alpha-2*Pi*(offset+N*q))*cos(alpha-2*Pi*(offset+N*q))+(dz-q*L)^2
135  //Distance^2=R^2*sin^2(alpha-2*Pi*(offset+N*q))+(dz-q*L)^2
136 
137  //So we have to minimize:
138  //Distance^2=R^2*sin^2(alpha-2*Pi*(offset+N*q))^2+(dz-q*L)^2
139  //For this we use the Euler algoritm
140 
141  Mdouble q; //Current guess
142  Mdouble dd; //Derivative at current guess
143  Mdouble ddd; //Second derivative at current guess
144  Mdouble q0 = dz / l_; //Minimum of the parabolic part
145 
146  //The initial guess will be in the minimum of the sin closest to the minimum of the parabolic part
147  //Minima of the sin are at
148  //alpha-2*Pi*(offset+N*q)=k*Pi (k=integer)
149  //q=alpha/(2*Pi*N)-k/(2*N)-offset/N (k=integer)
150 
151  Mdouble k = round(alpha / constants::pi - 2.0 * (offset_ + n_ * q0));
152  q = alpha / (2.0 * constants::pi * n_) - k / (2.0 * n_) - offset_ / n_;
153 
154  //Now apply Newton's method
155  do
156  {
157  dd = -2.0 * Rsqr * constants::pi * n_ * sin(2.0 * alpha - 4.0 * constants::pi * (n_ * q + offset_)) - 2.0 * l_ * (dz - q * l_);
158  ddd = 8.0 * Rsqr * constants::sqr_pi * n_ * n_ * cos(2.0 * alpha - 4.0 * constants::pi * (n_ * q + offset_)) + 2.0 * l_ * l_;
159  q -= dd / ddd;
160  } while (fabs(dd / ddd) > 1e-14);
161 
162  //Calculate r
163  Mdouble r = R * cos(2.0 * constants::pi * (offset_ + n_ * q) - alpha);
164 
165  //Check if the location is actually on the screw:
166  //First posibility is that the radius is to large:
167  if (fabs(r) > maxR_) //Left boundary of the coil
168  {
169  r = mathsFunc::sign(r) * maxR_;
170  unsigned int steps = 0;
171  //This case reduces to the coil problem
172  do
173  {
174  dd = -4.0 * R * r * constants::pi * n_ * sin(alpha - 2.0 * constants::pi * (n_ * q + offset_)) - 2.0 * l_ * (dz - q * l_);
175  ddd = 8.0 * R * r * constants::sqr_pi * n_ * n_ * cos(alpha - 2.0 * constants::pi * (n_ * q + offset_)) + 2.0 * l_ * l_;
176  q -= dd / ddd;
177  steps++;
178  } while (fabs(dd / ddd) > 1e-14);
179  }
180  //Second possibility is that it occured before the start of after the end
181  if (q < 0)
182  {
183  q = 0;
184  r = R * cos(alpha - 2.0 * constants::pi * (offset_ + q * n_));
185  if (fabs(r) > maxR_)
186  {
187  r = mathsFunc::sign(r) * maxR_;
188  }
189  }
190  else if (q > 1)
191  {
192  q = 1;
193  r = R * cos(alpha - 2.0 * constants::pi * (offset_ + q * n_));
194  if (fabs(r) > maxR_)
195  {
196  r = mathsFunc::sign(r) * maxR_;
197  }
198  }
199 
200  distance = R * R * pow(sin(alpha - 2 * constants::pi * (offset_ + n_ * q)), 2) + pow(dz - q * l_, 2);
201  //If distance is to large there is no contact
203  {
204  return false;
205  }
206 
207  Vec3D ContactPoint;
208  distance = sqrt(distance) - thickness_;
209  ContactPoint.X = start_.X + r * cos(2.0 * constants::pi * (offset_ + n_ * q));
210  ContactPoint.Y = start_.Y + r * sin(2.0 * constants::pi * (offset_ + n_ * q));
211  ContactPoint.Z = start_.Z + q * l_;
212  normal_return = ContactPoint - p.getPosition();
213  normal_return /= normal_return.getLength();
214  return true;
215 }
Mdouble X
the vector components
Definition: Vector.h:52
Mdouble maxR_
The outer radius of the Screw.
Definition: Screw.h:114
double Mdouble
int sign(T val)
This is a sign function, it returns -1 for negative numbers, 1 for positive numbers and 0 for 0...
Definition: ExtendedMath.h:83
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:427
Mdouble getWallInteractionRadius() const
Returns the interaction radius for interaction with walls. See also BaseParticle::getInteractionRadiu...
Vec3D start_
The centre of the lower end of the screw.
Definition: Screw.h:106
Mdouble offset_
The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation.
Definition: Screw.h:126
const Mdouble pi
Definition: ExtendedMath.h:42
Mdouble l_
The length of the Screw.
Definition: Screw.h:110
Mdouble Y
Definition: Vector.h:52
Mdouble n_
The number of revelations.
Definition: Screw.h:118
Mdouble thickness_
The thickness of the Screw.
Definition: Screw.h:130
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Mdouble Z
Definition: Vector.h:52
const Mdouble sqr_pi
Definition: ExtendedMath.h:44
BaseInteraction * Screw::getInteractionWith ( BaseParticle p,
Mdouble  timeStamp,
InteractionHandler interactionHandler 
)
finalvirtual

Get the interaction between this Screw and given BaseParticle at a given time.

Parameters
[in]pPointer to the BaseParticle which we want to check the interaction for.
[in]timeStampThe time at which we want to look at the interaction.
[in]interactionHandlerA pointer to the InteractionHandler in which the interaction can be found.
Returns
A pointer to the BaseInteraction that happened between this Screw and the BaseParticle at the timeStamp.
Todo:
{DK: What is the contact point for interactions with walls}

Implements BaseInteractable.

Definition at line 288 of file Screw.cc.

References getDistanceAndNormal(), InteractionHandler::getInteraction(), BaseInteraction::getNormal(), BaseInteraction::getOverlap(), BaseInteractable::getPosition(), BaseParticle::getRadius(), BaseInteraction::setContactPoint(), BaseInteraction::setDistance(), BaseInteraction::setNormal(), and BaseInteraction::setOverlap().

289 {
290  Mdouble distance;
291  Vec3D normal;
292 
293  if (getDistanceAndNormal(*p,distance,normal))
294  {
295  BaseInteraction* c = interactionHandler->getInteraction(p, this, timeStamp);
296  c->setNormal(-normal);
297  c->setDistance(distance);
298  c->setOverlap(p->getRadius() - distance);
300  c->setContactPoint(p->getPosition()-(p->getRadius() - 0.5 * c->getOverlap()) * c->getNormal());
301  return c;
302  }
303  else
304  {
305  return nullptr;
306  }
307 }
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
void setOverlap(Mdouble overlap)
Set the overlap between the two interacting object.
bool getDistanceAndNormal(const BaseParticle &P, Mdouble &distance, Vec3D &normal_return) const final
Compute the distance from the Screw for a given BaseParticle and return if there is a collision...
Definition: Screw.cc:110
BaseInteraction * getInteraction(BaseInteractable *P, BaseInteractable *I, Mdouble timeStamp)
Returns the Interaction between the BaseInteractable's P and I.
double Mdouble
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Stores information about interactions between two interactable objects; often particles but could be ...
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
Mdouble getRadius() const
Returns the particle's radius_.
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
std::string Screw::getName ( ) const
finalvirtual

Returns the name of the object, here the string "Screw".

Returns
The string "Screw".

Implements BaseObject.

Definition at line 276 of file Screw.cc.

277 {
278  return "Screw";
279 }
void Screw::move_time ( Mdouble  dt)

Rotate the Screw for a period dt, so that the offset_ changes with omega_*dt.

Parameters
[in]dtThe time for which the Screw has to be turned.

Definition at line 220 of file Screw.cc.

References offset_, and omega_.

221 {
222  offset_ += omega_ * dt;
223 }
Mdouble offset_
The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation.
Definition: Screw.h:126
Mdouble omega_
Rotation speed in rev/s.
Definition: Screw.h:122
void Screw::oldRead ( std::istream &  is)

Reads a Screw in the old style from an input stream, for example a restart file old style.

Parameters
[in,out]isInput stream from which the Screw must be read.

Read the Screw in old style, please note that the thickness is not read in this function, so it has either to be set manually or it is 0.0 from the default constructor.

Definition at line 247 of file Screw.cc.

References l_, maxR_, n_, offset_, omega_, and start_.

248 {
249  std::string dummy;
250  is >> dummy >> start_
251  >> dummy >> l_
252  >> dummy >> maxR_
253  >> dummy >> n_
254  >> dummy >> omega_
255  >> dummy >> offset_;
256 }
Mdouble maxR_
The outer radius of the Screw.
Definition: Screw.h:114
Vec3D start_
The centre of the lower end of the screw.
Definition: Screw.h:106
Mdouble offset_
The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation.
Definition: Screw.h:126
Mdouble l_
The length of the Screw.
Definition: Screw.h:110
Mdouble n_
The number of revelations.
Definition: Screw.h:118
Mdouble omega_
Rotation speed in rev/s.
Definition: Screw.h:122
void Screw::read ( std::istream &  is)
overridevirtual

Reads a Screw from an input stream, for example a restart file.

Parameters
[in,out]isInput stream from which the Screw must be read.

Reimplemented from BaseWall.

Definition at line 228 of file Screw.cc.

References l_, maxR_, n_, offset_, omega_, BaseWall::read(), start_, and thickness_.

229 {
230  BaseWall::read(is);
231  std::string dummy;
232  is >> dummy >> start_
233  >> dummy >> l_
234  >> dummy >> maxR_
235  >> dummy >> n_
236  >> dummy >> omega_
237  >> dummy >> thickness_
238  >> dummy >> offset_;
239 }
Mdouble maxR_
The outer radius of the Screw.
Definition: Screw.h:114
Vec3D start_
The centre of the lower end of the screw.
Definition: Screw.h:106
Mdouble offset_
The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation.
Definition: Screw.h:126
Mdouble l_
The length of the Screw.
Definition: Screw.h:110
Mdouble n_
The number of revelations.
Definition: Screw.h:118
Mdouble thickness_
The thickness of the Screw.
Definition: Screw.h:130
Mdouble omega_
Rotation speed in rev/s.
Definition: Screw.h:122
void read(std::istream &is)
Function that reads a BaseWall from an input stream, usually a restart file.
Definition: BaseWall.cc:60
void Screw::write ( std::ostream &  os) const
overridevirtual

Writes this Screw to an output stream, for example a restart file.

Parameters
[in,out]osOutput stream to which the Screw must be written.

Reimplemented from BaseWall.

Definition at line 261 of file Screw.cc.

References l_, maxR_, n_, offset_, omega_, start_, thickness_, and BaseWall::write().

262 {
263  BaseWall::write(os);
264  os << " start " << start_
265  << " Length " << l_
266  << " Radius " << maxR_
267  << " Revolutions " << n_
268  << " Omega " << omega_
269  << " Thickness " << thickness_
270  << " Offset " << offset_;
271 }
Mdouble maxR_
The outer radius of the Screw.
Definition: Screw.h:114
Vec3D start_
The centre of the lower end of the screw.
Definition: Screw.h:106
Mdouble offset_
The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation.
Definition: Screw.h:126
Mdouble l_
The length of the Screw.
Definition: Screw.h:110
Mdouble n_
The number of revelations.
Definition: Screw.h:118
Mdouble thickness_
The thickness of the Screw.
Definition: Screw.h:130
Mdouble omega_
Rotation speed in rev/s.
Definition: Screw.h:122
void write(std::ostream &os) const
Function that writes a BaseWall to an output stream, usually a restart file.
Definition: BaseWall.cc:68

Member Data Documentation

Mdouble Screw::l_
private

The length of the Screw.

Definition at line 110 of file Screw.h.

Referenced by getDistanceAndNormal(), oldRead(), read(), Screw(), and write().

Mdouble Screw::maxR_
private

The outer radius of the Screw.

Definition at line 114 of file Screw.h.

Referenced by getDistanceAndNormal(), oldRead(), read(), Screw(), and write().

Mdouble Screw::n_
private

The number of revelations.

Definition at line 118 of file Screw.h.

Referenced by getDistanceAndNormal(), oldRead(), read(), Screw(), and write().

Mdouble Screw::offset_
private

The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation.

Definition at line 126 of file Screw.h.

Referenced by getDistanceAndNormal(), move_time(), oldRead(), read(), Screw(), and write().

Mdouble Screw::omega_
private

Rotation speed in rev/s.

Definition at line 122 of file Screw.h.

Referenced by move_time(), oldRead(), read(), Screw(), and write().

Vec3D Screw::start_
private

The centre of the lower end of the screw.

Definition at line 106 of file Screw.h.

Referenced by getDistanceAndNormal(), oldRead(), read(), Screw(), and write().

Mdouble Screw::thickness_
private

The thickness of the Screw.

Definition at line 130 of file Screw.h.

Referenced by getDistanceAndNormal(), read(), Screw(), and write().


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