MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Coil Class Reference

This class defines a coil 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 <Coil.h>

+ Inheritance diagram for Coil:

Public Member Functions

 Coil ()
 Default constructor, sets a coil with default parameters. More...
 
 Coil (const Coil &other)
 Copy constructor, makes a coil with the same properties as the input Coil. More...
 
 Coil (Vec3D Start, Mdouble L, Mdouble r, Mdouble N, Mdouble omega, Mdouble thickness)
 Constructor in which all parameters are set. More...
 
 ~Coil () override
 Default destructor. More...
 
void set (Vec3D Start, Mdouble length, Mdouble radius, Mdouble numberOfRevelations, Mdouble omega, Mdouble thickness)
 Set all parameters of this Coil. More...
 
Coilcopy () const override
 Copy this Coil and return a pointer to the copy, useful for polymorphism. More...
 
bool getDistanceAndNormal (const BaseParticle &P, Mdouble &distance, Vec3D &normal_return) const override
 Compute the distance from the Coil 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 Coil for a period dt, so that the offset_ changes with omega_*dt. More...
 
void read (std::istream &is) override
 Reads a Coil from an input stream, for example a restart file. More...
 
MERCURY_DEPRECATED void oldRead (std::istream &is)
 Reads an old-style Coil from an input stream, for example an old restart file. More...
 
void write (std::ostream &os) const override
 Writes a Coil to an output stream, for example a restart file. More...
 
std::string getName () const override
 Returns the name of the object, in this case the string "Coil". More...
 
- Public Member Functions inherited from BaseWall
 BaseWall ()
 Default constructor. More...
 
 BaseWall (const BaseWall &w)
 Copy constructor. More...
 
 ~BaseWall () override
 Default destructor. More...
 
virtual bool getDistanceNormalOverlap (const BaseParticle &P, Mdouble &distance, Vec3D &normal_return, Mdouble &overlap) const
 
virtual bool getDistanceNormalOverlapSuperquadric (const SuperQuadricParticle &p, Mdouble &distance, Vec3D &normal_return, Mdouble &overlap) const
 
virtual Vec3D getFurthestPointSuperQuadric (const Vec3D &normalBodyFixed, const Vec3D &axes, Mdouble eps1, Mdouble eps2) const
 
virtual 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) override
 Define the species of this wall using the index of the species in the SpeciesHandler in this DPMBase. More...
 
void setSpecies (const ParticleSpecies *species)
 Defines the species of the current wall. More...
 
bool isFixed () const override
 
void setForceControl (Vec3D forceGoal, Vec3D gainFactor, Vec3D baseVelocity={0, 0, 0})
 Slowly adjusts the force on a wall towards a specified goal, by adjusting (prescribing) the velocity of the wall. More...
 
virtual bool isLocal (Vec3D &min, Vec3D &max) const
 
bool getLinePlaneIntersect (Vec3D &intersect, const Vec3D &p0, const Vec3D &p1, const Vec3D &n, const Vec3D &p)
 
bool isInsideWallVTK (const Vec3D &point, const Vec3D &normal, const Vec3D &position) const
 
void projectOntoWallVTK (Vec3D &point0, const Vec3D &point1, const Vec3D &normal, const Vec3D &position) const
 
void intersectVTK (std::vector< Vec3D > &points, Vec3D normal, Vec3D position) const
 
virtual BaseInteractiongetInteractionWithSuperQuad (SuperQuadricParticle *p, unsigned timeStamp, InteractionHandler *interactionHandler)
 
virtual void writeVTK (VTKContainer &vtk) const
 
void getVTK (std::vector< Vec3D > &points, std::vector< std::vector< double >> &triangleStrips)
 
const Vec3D getAxis () const
 
BaseInteractiongetInteractionWith (BaseParticle *p, unsigned timeStamp, InteractionHandler *interactionHandler) override
 Returns the interaction between this wall and a given particle, nullptr if there is no interaction. More...
 
bool getVTKVisibility () const
 
void setVTKVisibility (bool vtkVisibility)
 
void addRenderedWall (BaseWall *w)
 
BaseWallgetRenderedWall (size_t i) const
 
void removeRenderedWalls ()
 
void renderWall (VTKContainer &vtk)
 
void addParticlesAtWall (unsigned numElements=50)
 
void setVelocityControl (Vec3D forceGoal, Vec3D gainFactor, Vec3D baseVelocity)
 
- Public Member Functions inherited from BaseInteractable
 BaseInteractable ()
 Default BaseInteractable constructor. More...
 
 BaseInteractable (const BaseInteractable &p)
 Copy constructor. More...
 
 ~BaseInteractable () override
 Destructor, it simply destructs the BaseInteractable and all the objects it contains. More...
 
unsigned int getIndSpecies () const
 Returns the index of the species associated with the interactable object. 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 (const Vec3D &force)
 Sets the force on this BaseInteractable. More...
 
void setTorque (const Vec3D &torque)
 Sets the torque on this BaseInteractable. More...
 
void addForce (const Vec3D &addForce)
 Adds an amount to the force on this BaseInteractable. More...
 
void addTorque (const Vec3D &addTorque)
 Adds an amount to the torque on this BaseInteractable. More...
 
void resetForceTorque (int numberOfOMPthreads)
 
void sumForceTorqueOMP ()
 
const Vec3DgetPosition () const
 Returns the position of this BaseInteractable. More...
 
const QuaterniongetOrientation () const
 Returns the orientation of this BaseInteractable. More...
 
void setPosition (const Vec3D &position)
 Sets the position of this BaseInteractable. More...
 
void setOrientationViaNormal (Vec3D normal)
 Sets the orientation of this BaseInteractable by defining the vector that results from the rotation of the (1,0,0) vector. More...
 
void setOrientationViaEuler (Vec3D eulerAngle)
 Sets the orientation of this BaseInteractable by defining the euler angles. More...
 
void setOrientation (const Quaternion &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...
 
virtual void rotate (const Vec3D &angularVelocityDt)
 Rotates this BaseInteractable. More...
 
const std::vector
< BaseInteraction * > & 
getInteractions () const
 Returns a list of interactions which belong to this interactable. 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 (const 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 (const 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 (const std::function< Quaternion(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 (const 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...
 
virtual Mdouble getInvMass () const
 
virtual Mdouble getCurvature (const Vec3D &labFixedCoordinates) const
 
- Public Member Functions inherited from BaseObject
 BaseObject ()=default
 Default constructor. More...
 
 BaseObject (const BaseObject &p)=default
 Copy constructor, copies all the objects BaseObject contains. More...
 
virtual ~BaseObject ()=default
 virtual destructor More...
 
virtual void moveInHandler (unsigned int index)
 Except that it is virtual, it does the same thing as setIndex() does. More...
 
void setIndex (unsigned int index)
 Allows one to assign an index to an object in the handler/container. More...
 
void setId (unsigned long 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...
 
void setGroupId (unsigned groupId)
 
unsigned getGroupId () const
 

Private Attributes

Vec3D start_
 The centre of the lower end of the Coil. More...
 
Mdouble l_
 The length of the Coil. More...
 
Mdouble r_
 
Mdouble n_
 
Mdouble omega_
 
Mdouble offset_
 
Mdouble thickness_
 

Additional Inherited Members

- Static Public Member Functions inherited from BaseWall
static void addToVTK (const std::vector< Vec3D > &points, VTKContainer &vtk)
 Takes the points provided and adds a triangle strip connecting these points to the vtk container. More...
 

Detailed Description

This class defines a coil 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)) and z=zs+q*L

Todo:

IFCD: Can someone look at the details of the documentation of class Coil? I can't make sense of them.

Coil is now fixed in Z-direction, centered around the Z-axis. Consider converting to more general parameters, with direction of choise and central axis of choice.

Definition at line 40 of file Coil.h.

Constructor & Destructor Documentation

Coil::Coil ( )

Default constructor, sets a coil with default parameters.

Default constructor, make a Coil which is centered in the origin, has length 1, radius 1, 1 revelation, rotates with 1 rev/s, has thickness 0 and has not rotated.

Definition at line 35 of file Coil.cc.

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

Referenced by copy().

36 {
37  start_.setZero();
38  l_ = 1.0;
39  r_ = 1.0;
40  n_ = 1.0;
41  omega_ = 1.0;
42  offset_ = 0.0;
43  thickness_ = 0.0;
44  logger(DEBUG, "Coil() constructor finished");
45 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:111
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
Mdouble offset_
Definition: Coil.h:136
Mdouble l_
The length of the Coil.
Definition: Coil.h:116
Mdouble n_
Definition: Coil.h:126
Mdouble r_
Definition: Coil.h:121
Mdouble thickness_
Definition: Coil.h:141
Mdouble omega_
Definition: Coil.h:131
Coil::Coil ( const Coil other)

Copy constructor, makes a coil with the same properties as the input Coil.

Parameters
[in]otherCoil to be copied into this coil

Definition at line 50 of file Coil.cc.

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

50  : BaseWall(other)
51 {
52  start_ = other.start_;
53  l_ = other.l_;
54  r_ = other.r_;
55  n_ = other.n_;
56  omega_ = other.omega_;
57  offset_ = other.offset_;
58  thickness_ = other.thickness_;
59  logger(DEBUG, "Coil(const Coil&) copy constructor finished");
60 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:111
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble offset_
Definition: Coil.h:136
BaseWall()
Default constructor.
Definition: BaseWall.cc:36
Mdouble l_
The length of the Coil.
Definition: Coil.h:116
Mdouble n_
Definition: Coil.h:126
Mdouble r_
Definition: Coil.h:121
Mdouble thickness_
Definition: Coil.h:141
Mdouble omega_
Definition: Coil.h:131
Coil::Coil ( Vec3D  start,
Mdouble  l,
Mdouble  r,
Mdouble  n,
Mdouble  omega,
Mdouble  thickness 
)

Constructor in which all parameters are set.

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

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

Definition at line 72 of file Coil.cc.

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

73 {
74  start_ = start;
75  l_ = l;
76  r_ = r;
77  n_ = n;
78  omega_ = omega;
79  thickness_ = thickness;
80  offset_ = 0.0;
81  logger(DEBUG, "Coil(params) constructor with parameters finished.");
82 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:111
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble offset_
Definition: Coil.h:136
Mdouble l_
The length of the Coil.
Definition: Coil.h:116
Mdouble n_
Definition: Coil.h:126
Mdouble r_
Definition: Coil.h:121
Mdouble thickness_
Definition: Coil.h:141
Mdouble omega_
Definition: Coil.h:131
Coil::~Coil ( )
override

Default destructor.

Definition at line 84 of file Coil.cc.

References DEBUG, and logger.

85 {
86  logger(DEBUG, "~Coil() destructor finished.");
87 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")

Member Function Documentation

Coil * Coil::copy ( ) const
overridevirtual

Copy this Coil and return a pointer to the copy, useful for polymorphism.

Returns
A pointer to a copy of this Coil.

Implements BaseWall.

Definition at line 116 of file Coil.cc.

References Coil().

117 {
118  return new Coil(*this);
119 }
Coil()
Default constructor, sets a coil with default parameters.
Definition: Coil.cc:35
bool Coil::getDistanceAndNormal ( const BaseParticle p,
Mdouble distance,
Vec3D normal_return 
) const
overridevirtual

Compute the distance from the Coil 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 Coil.
[out]normal_returnIf there was a collision, the normal vector to this Coil 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 Coil. If there is a collision, this function also computes the distance between the BaseParticle and Coil 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 132 of file Coil.cc.

References mathsFunc::cos(), Vec3D::getLength(), BaseInteractable::getPosition(), BaseParticle::getWallInteractionRadius(), l_, n_, offset_, constants::pi, R, r_, helpers::round(), mathsFunc::sin(), constants::sqr_pi, mathsFunc::square(), start_, thickness_, Vec3D::X, Vec3D::Y, and Vec3D::Z.

133 {
134  const Mdouble interactionRadius = p.getWallInteractionRadius(this) + thickness_;
135  Mdouble Rsqr = pow(p.getPosition().X - start_.X, 2) + pow(p.getPosition().Y - start_.Y, 2);
136  if (Rsqr > pow(r_ + interactionRadius, 2) ||
137  Rsqr < pow(r_ - interactionRadius, 2) ||
138  p.getPosition().Z > l_ + start_.Z + interactionRadius ||
139  p.getPosition().Z < start_.Z - interactionRadius)
140  {
141  //std::cout<<"Particle is out of first bound checking"<<std::endl;
142  //std::cout<<"Rule 1: "<<pow(r-P.getRadius()-thickness_,2)<<"<"<<Rsqr<<"<"<<pow(r+P.getRadius()+thickness_,2)<<std::endl;
143  //std::cout<<"Rule 2: "<<Start.Z-P.getRadius()-thickness_<<"<"<<P.getPosition().Z<<"<"<<L+Start.Z+P.getRadius()+thickness_<<std::endl;
144  return false;
145  }
146  Mdouble R = sqrt(Rsqr);
147  Mdouble alpha = atan2(p.getPosition().Y - start_.Y, p.getPosition().X - start_.X);
148  Mdouble dz = p.getPosition().Z - start_.Z;
149 
150  //To find the contact point we have to minimize (with respect to q)
151  //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
152  //Using polar coordinated (i.e. x-x0=R*cos(alpha), y-y0=R*sin(alpha) and dz=z-z0)
153  //Distance^2=R^2+r^2-2*R*r*cos(alpha-2*Pi*(offset+N*q))+(dz-q*L)^2
154 
155  //So we have to minimize:
156  //Distance^2=R^2+r^2-2*R*r*cos(alpha-2*Pi*(offset+N*q))+(dz-q*L)^2
157  //For this we use the Euler algoritm
158 
159  Mdouble q; //Current guess
160  Mdouble dd; //Derivative at current guess
161  Mdouble ddd; //Second derivative at current guess
162  Mdouble q0 = dz / l_; //Minimum of the parabolic part
163 
164  //The initial guess will be in the maximum of the cos closest to the minimum of the parabolic part
165  //Minima of the cos are at
166  //alpha-2*Pi*(offset+N*q)=2*k*Pi (k=integer)
167  //q=alpha/(2*Pi*N)-k/N-offset/N (k=integer)
168 
169  Mdouble k = round(alpha / 2.0 / constants::pi - (offset_ + n_ * q0));
170  q = alpha / (2 * constants::pi * n_) - k / n_ - offset_ / n_;
171 
172  //Now apply Newton's method
173  do
174  {
175  dd = -4.0 * R * r_ * constants::pi * n_ * sin(alpha - 2.0 * constants::pi * (n_ * q + offset_)) -
176  2.0 * l_ * (dz - q * l_);
177  ddd = 8.0 * R * r_ * constants::sqr_pi * n_ * n_ * cos(alpha - 2.0 * constants::pi * (n_ * q + offset_)) +
178  2.0 * l_ * l_;
179  q -= dd / ddd;
180  } while (fabs(dd / ddd) > 1e-14);
181 
182  //Check if the location is actually on the coil, otherwise a point collision with the end of the coil calculated
183  if (q < 0) //Left boundary of the coil
184  {
185  q = 0;
186  }
187  else if (q > 1) //right boundary of the coil
188  {
189  q = 1;
190  }
191 
192  Mdouble distanceSquared =
193  R * R + r_ * r_ - 2 * R * r_ * cos(alpha - 2 * constants::pi * (offset_ + n_ * q)) + pow(dz - q * l_, 2);
194  //If distance is too large there is no contact
195  if (distanceSquared >= mathsFunc::square(p.getWallInteractionRadius(this) + thickness_))
196  {
197  //std::cout<<"Particle is out of second bound checking, distance^2="<<distance<<" max="<<(P.getRadius()+thickness_)*(P.getRadius()+thickness_)<<std::endl;
198  return false;
199  }
200 
201  Vec3D ContactPoint;
202  distance = sqrt(distanceSquared) - thickness_;
203  ContactPoint.X = start_.X + r_ * cos(2.0 * constants::pi * (offset_ + n_ * q));
204  ContactPoint.Y = start_.Y + r_ * sin(2.0 * constants::pi * (offset_ + n_ * q));
205  ContactPoint.Z = start_.Z + q * l_;
206  normal_return = ContactPoint - p.getPosition();
207  normal_return /= normal_return.getLength();
208  return true;
209 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:111
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Mdouble X
the vector components
Definition: Vector.h:65
double Mdouble
Definition: GeneralDefine.h:34
static Mdouble getLength(const Vec3D &a)
Calculates the length of a Vec3D: .
Definition: Vector.cc:331
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:64
Mdouble offset_
Definition: Coil.h:136
Mdouble getWallInteractionRadius(const BaseWall *wall) const
returns the radius plus the interactionDistance
Definition: BaseParticle.h:383
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:44
const Mdouble pi
Definition: ExtendedMath.h:45
Mdouble Y
Definition: Vector.h:65
Mdouble l_
The length of the Coil.
Definition: Coil.h:116
Mdouble round(const Mdouble value, unsigned precision)
Definition: Helpers.cc:600
Mdouble n_
Definition: Coil.h:126
Mdouble r_
Definition: Coil.h:121
Mdouble thickness_
Definition: Coil.h:141
Definition: Vector.h:49
T square(const T val)
squares a number
Definition: ExtendedMath.h:104
Mdouble Z
Definition: Vector.h:65
const Mdouble sqr_pi
Definition: ExtendedMath.h:47
std::string Coil::getName ( ) const
overridevirtual

Returns the name of the object, in this case the string "Coil".

Returns
The string "Coil".

Implements BaseObject.

Definition at line 266 of file Coil.cc.

267 {
268  return "Coil";
269 }
void Coil::move_time ( Mdouble  dt)

Rotate the Coil 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 214 of file Coil.cc.

References offset_, and omega_.

215 {
216  offset_ += omega_ * dt;
217 }
Mdouble offset_
Definition: Coil.h:136
Mdouble omega_
Definition: Coil.h:131
void Coil::oldRead ( std::istream &  is)

Reads an old-style Coil from an input stream, for example an old restart file.

Deprecated:
If you have old restart files, please convert them to the current version of the restart files and use read(std::istream&) instead of oldRead(std::istream&).
Parameters
[in,out]isThe input stream from which the Coil is read.

Definition at line 238 of file Coil.cc.

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

239 {
240  std::string dummy;
241  is >> dummy >> start_
242  >> dummy >> l_
243  >> dummy >> r_ >> dummy >> n_
244  >> dummy >> omega_
245  >> dummy >> offset_;
246 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:111
Mdouble offset_
Definition: Coil.h:136
Mdouble l_
The length of the Coil.
Definition: Coil.h:116
Mdouble n_
Definition: Coil.h:126
Mdouble r_
Definition: Coil.h:121
Mdouble omega_
Definition: Coil.h:131
void Coil::read ( std::istream &  is)
overridevirtual

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

Parameters
[in,out]isThe input stream from which the Coil is read.

Reimplemented from BaseWall.

Definition at line 222 of file Coil.cc.

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

223 {
224  BaseWall::read(is);
225  std::string dummy;
226  is >> dummy >> start_
227  >> dummy >> l_
228  >> dummy >> r_
229  >> dummy >> n_
230  >> dummy >> omega_
231  >> dummy >> thickness_
232  >> dummy >> offset_;
233 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:111
Mdouble offset_
Definition: Coil.h:136
void read(std::istream &is) override
Function that reads a BaseWall from an input stream, usually a restart file.
Definition: BaseWall.cc:80
Mdouble l_
The length of the Coil.
Definition: Coil.h:116
Mdouble n_
Definition: Coil.h:126
Mdouble r_
Definition: Coil.h:121
Mdouble thickness_
Definition: Coil.h:141
Mdouble omega_
Definition: Coil.h:131
void Coil::set ( Vec3D  start,
Mdouble  length,
Mdouble  radius,
Mdouble  numberOfRevelations,
Mdouble  omega,
Mdouble  thickness 
)

Set all parameters of this Coil.

Set the parameters of this Coil by assigning all input parameters to the data-members of this class, and setting the offset_ to 0.

Parameters
[in]startA Vec3D which denotes the centre of the lower end of the Coil.
[in]lengthThe length of the Coil, must be positive.
[in]radiusThe radius of the Coil, must be positive.
[in]numberOfRevelationsThe number of revelations of the Coil, must be positive.
[in]omegaThe rotation speed of the Coil in rev/s.
[in]thicknessThe thickness of the "spiral" of the Coil, must be non-negative.

Definition at line 102 of file Coil.cc.

References l_, n_, offset_, omega_, r_, start_, and thickness_.

103 {
104  start_ = start;
105  l_ = length;
106  r_ = radius;
107  n_ = numberOfRevelations;
108  omega_ = omega;
109  thickness_ = thickness;
110  offset_ = 0.0;
111 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:111
Mdouble offset_
Definition: Coil.h:136
Mdouble l_
The length of the Coil.
Definition: Coil.h:116
Mdouble n_
Definition: Coil.h:126
Mdouble r_
Definition: Coil.h:121
Mdouble thickness_
Definition: Coil.h:141
Mdouble omega_
Definition: Coil.h:131
void Coil::write ( std::ostream &  os) const
overridevirtual

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

Parameters
[in,out]osThe outpus stream to which the Coil is written.

Reimplemented from BaseWall.

Definition at line 251 of file Coil.cc.

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

252 {
253  BaseWall::write(os);
254  os << " Start " << start_
255  << " Length " << l_
256  << " Radius " << r_
257  << " Revolutions " << n_
258  << " Omega " << omega_
259  << " Thickness " << thickness_
260  << " Offset " << offset_;
261 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:111
void write(std::ostream &os) const override
Function that writes a BaseWall to an output stream, usually a restart file.
Definition: BaseWall.cc:102
Mdouble offset_
Definition: Coil.h:136
Mdouble l_
The length of the Coil.
Definition: Coil.h:116
Mdouble n_
Definition: Coil.h:126
Mdouble r_
Definition: Coil.h:121
Mdouble thickness_
Definition: Coil.h:141
Mdouble omega_
Definition: Coil.h:131

Member Data Documentation

Mdouble Coil::l_
private

The length of the Coil.

Definition at line 116 of file Coil.h.

Referenced by Coil(), getDistanceAndNormal(), oldRead(), read(), set(), and write().

Mdouble Coil::n_
private

The number of revelations of the Coil.

Definition at line 126 of file Coil.h.

Referenced by Coil(), getDistanceAndNormal(), oldRead(), read(), set(), and write().

Mdouble Coil::offset_
private

The amount the Coil has rotated, this is a number between 0 and 1.

Definition at line 136 of file Coil.h.

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

Mdouble Coil::omega_
private

The rotation speed of the Coil, in rev/s.

Definition at line 131 of file Coil.h.

Referenced by Coil(), move_time(), oldRead(), read(), set(), and write().

Mdouble Coil::r_
private

The radius of the Coil.

Definition at line 121 of file Coil.h.

Referenced by Coil(), getDistanceAndNormal(), oldRead(), read(), set(), and write().

Vec3D Coil::start_
private

The centre of the lower end of the Coil.

Definition at line 111 of file Coil.h.

Referenced by Coil(), getDistanceAndNormal(), oldRead(), read(), set(), and write().

Mdouble Coil::thickness_
private

The thickness of the "spiral" of the Coil.

Definition at line 141 of file Coil.h.

Referenced by Coil(), getDistanceAndNormal(), read(), set(), and write().


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