MercuryDPM  Beta
 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 ()
 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...
 
BaseInteractiongetInteractionWith (BaseParticle *P, Mdouble timeStamp, InteractionHandler *interactionHandler)
 Get the interaction between this Coil and given BaseParticle at a given time. 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. 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 Coil. More...
 
Mdouble l_
 The length of the Coil. More...
 
Mdouble r_
 
Mdouble n_
 
Mdouble omega_
 
Mdouble offset_
 
Mdouble thickness_
 

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:115
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setZero()
Sets all elements to zero.
Definition: Vector.cc:52
Mdouble offset_
Definition: Coil.h:140
Mdouble l_
The length of the Coil.
Definition: Coil.h:120
Mdouble n_
Definition: Coil.h:130
Mdouble r_
Definition: Coil.h:125
Mdouble thickness_
Definition: Coil.h:145
Mdouble omega_
Definition: Coil.h:135
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:115
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble offset_
Definition: Coil.h:140
BaseWall()
Default constructor. It makes an empty BaseWall.
Definition: BaseWall.cc:31
Mdouble l_
The length of the Coil.
Definition: Coil.h:120
Mdouble n_
Definition: Coil.h:130
Mdouble r_
Definition: Coil.h:125
Mdouble thickness_
Definition: Coil.h:145
Mdouble omega_
Definition: Coil.h:135
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:115
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble offset_
Definition: Coil.h:140
Mdouble l_
The length of the Coil.
Definition: Coil.h:120
Mdouble n_
Definition: Coil.h:130
Mdouble r_
Definition: Coil.h:125
Mdouble thickness_
Definition: Coil.h:145
Mdouble omega_
Definition: Coil.h:135
Coil::~Coil ( )

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 115 of file Coil.cc.

References Coil().

116 {
117  return new Coil(*this);
118 }
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 131 of file Coil.cc.

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

Referenced by getInteractionWith().

132 {
133  Mdouble Rsqr = pow(p.getPosition().X - start_.X, 2) + pow(p.getPosition().Y - start_.Y, 2);
135  {
136  //std::cout<<"Particle is out of first bound checking"<<std::endl;
137  //std::cout<<"Rule 1: "<<pow(r-P.getRadius()-thickness_,2)<<"<"<<Rsqr<<"<"<<pow(r+P.getRadius()+thickness_,2)<<std::endl;
138  //std::cout<<"Rule 2: "<<Start.Z-P.getRadius()-thickness_<<"<"<<P.getPosition().Z<<"<"<<L+Start.Z+P.getRadius()+thickness_<<std::endl;
139  return false;
140  }
141  Mdouble R = sqrt(Rsqr);
142  Mdouble alpha = atan2(p.getPosition().Y - start_.Y, p.getPosition().X - start_.X);
143  Mdouble dz = p.getPosition().Z - start_.Z;
144 
145  //To find the contact point we have to minimize (with respect to q)
146  //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
147  //Using polar coordinated (i.e. x-x0=R*cos(alpha), y-y0=R*sin(alpha) and dz=z-z0)
148  //Distance^2=R^2+r^2-2*R*r*cos(alpha-2*Pi*(offset+N*q))+(dz-q*L)^2
149 
150  //So we have to minimize:
151  //Distance^2=R^2+r^2-2*R*r*cos(alpha-2*Pi*(offset+N*q))+(dz-q*L)^2
152  //For this we use the Euler algoritm
153 
154  Mdouble q; //Current guess
155  Mdouble dd; //Derivative at current guess
156  Mdouble ddd; //Second derivative at current guess
157  Mdouble q0 = dz / l_; //Minimum of the parabolic part
158 
159  //The initial guess will be in the maximum of the cos closest to the minimum of the parabolic part
160  //Minima of the cos are at
161  //alpha-2*Pi*(offset+N*q)=2*k*Pi (k=integer)
162  //q=alpha/(2*Pi*N)-k/N-offset/N (k=integer)
163 
164  Mdouble k = round(alpha / 2.0 / constants::pi - (offset_ + n_ * q0));
165  q = alpha / (2 * constants::pi * n_) - k / n_ - offset_ / n_;
166 
167  //Now apply Newton's method
168  do
169  {
170  dd = -4.0 * R * r_ * constants::pi * n_ * sin(alpha - 2.0 * constants::pi * (n_ * q + offset_)) - 2.0 * l_ * (dz - q * l_);
171  ddd = 8.0 * R * r_ * constants::sqr_pi * n_ * n_ * cos(alpha - 2.0 * constants::pi * (n_ * q + offset_)) + 2.0 * l_ * l_;
172  q -= dd / ddd;
173  } while (fabs(dd / ddd) > 1e-14);
174 
175  //Check if the location is actually on the coil, otherwise a point collision with the end of the coil calculated
176  if (q < 0) //Left boundary of the coil
177  {
178  q = 0;
179  }
180  else if (q > 1) //right boundary of the coil
181  {
182  q = 1;
183  }
184 
185  Mdouble distanceSquared = R * R + r_ * r_ - 2 * R * r_ * cos(alpha - 2 * constants::pi * (offset_ + n_ * q)) + pow(dz - q * l_, 2);
186  //If distance is too large there is no contact
187  if (distanceSquared >= (p.getWallInteractionRadius() + thickness_) * (p.getWallInteractionRadius() + thickness_))
188  {
189  //std::cout<<"Particle is out of second bound checking, distance^2="<<distance<<" max="<<(P.getRadius()+thickness_)*(P.getRadius()+thickness_)<<std::endl;
190  return false;
191  }
192 
193  Vec3D ContactPoint;
194  distance = sqrt(distanceSquared) - thickness_;
195  ContactPoint.X = start_.X + r_ * cos(2.0 * constants::pi * (offset_ + n_ * q));
196  ContactPoint.Y = start_.Y + r_ * sin(2.0 * constants::pi * (offset_ + n_ * q));
197  ContactPoint.Z = start_.Z + q * l_;
198  normal_return = ContactPoint - p.getPosition();
199  normal_return /= normal_return.getLength();
200  return true;
201 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:115
Mdouble X
the vector components
Definition: Vector.h:52
double Mdouble
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...
Mdouble offset_
Definition: Coil.h:140
const Mdouble pi
Definition: ExtendedMath.h:42
Mdouble Y
Definition: Vector.h:52
Mdouble l_
The length of the Coil.
Definition: Coil.h:120
Mdouble n_
Definition: Coil.h:130
Mdouble r_
Definition: Coil.h:125
Mdouble thickness_
Definition: Coil.h:145
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 * Coil::getInteractionWith ( BaseParticle p,
Mdouble  timeStamp,
InteractionHandler interactionHandler 
)
virtual

Get the interaction between this Coil 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 Coil and the BaseParticle at the timeStamp.
Todo:
{DK: What is the contact point for interactions with walls}

Implements BaseInteractable.

Definition at line 210 of file Coil.cc.

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

211 {
212  Mdouble distance;
213  Vec3D normal;
214  if (getDistanceAndNormal(*p,distance,normal))
215  {
216  BaseInteraction* c = interactionHandler->getInteraction(p, this, timeStamp);
217  c->setNormal(-normal);
218  c->setDistance(distance);
219  c->setOverlap(p->getRadius() - distance);
221  c->setContactPoint(p->getPosition() - (p->getRadius()- 0.5 * c->getOverlap()) * c->getNormal());
222  return c;
223  }
224  else
225  {
226  return nullptr;
227  }
228 }
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.
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 ...
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...
Definition: Coil.cc:131
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 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 285 of file Coil.cc.

286 {
287  return "Coil";
288 }
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 233 of file Coil.cc.

References offset_, and omega_.

234 {
235  offset_ += omega_ * dt;
236 }
Mdouble offset_
Definition: Coil.h:140
Mdouble omega_
Definition: Coil.h:135
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 257 of file Coil.cc.

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

258 {
259  std::string dummy;
260  is >> dummy >> start_
261  >> dummy >> l_
262  >> dummy >> r_ >> dummy >> n_
263  >> dummy >> omega_
264  >> dummy >> offset_;
265 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:115
Mdouble offset_
Definition: Coil.h:140
Mdouble l_
The length of the Coil.
Definition: Coil.h:120
Mdouble n_
Definition: Coil.h:130
Mdouble r_
Definition: Coil.h:125
Mdouble omega_
Definition: Coil.h:135
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 241 of file Coil.cc.

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

242 {
243  BaseWall::read(is);
244  std::string dummy;
245  is >> dummy >> start_
246  >> dummy >> l_
247  >> dummy >> r_
248  >> dummy >> n_
249  >> dummy >> omega_
250  >> dummy >> thickness_
251  >> dummy >> offset_;
252 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:115
Mdouble offset_
Definition: Coil.h:140
Mdouble l_
The length of the Coil.
Definition: Coil.h:120
Mdouble n_
Definition: Coil.h:130
Mdouble r_
Definition: Coil.h:125
Mdouble thickness_
Definition: Coil.h:145
Mdouble omega_
Definition: Coil.h:135
void read(std::istream &is)
Function that reads a BaseWall from an input stream, usually a restart file.
Definition: BaseWall.cc:60
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 101 of file Coil.cc.

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

102 {
103  start_ = start;
104  l_ = length;
105  r_ = radius;
106  n_ = numberOfRevelations;
107  omega_ = omega;
108  thickness_ = thickness;
109  offset_ = 0.0;
110 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:115
Mdouble offset_
Definition: Coil.h:140
Mdouble l_
The length of the Coil.
Definition: Coil.h:120
Mdouble n_
Definition: Coil.h:130
Mdouble r_
Definition: Coil.h:125
Mdouble thickness_
Definition: Coil.h:145
Mdouble omega_
Definition: Coil.h:135
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 270 of file Coil.cc.

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

271  {
272  BaseWall::write(os);
273  os << " Start " << start_
274  << " Length " << l_
275  << " Radius " << r_
276  << " Revolutions " << n_
277  << " Omega " << omega_
278  << " Thickness " << thickness_
279  << " Offset " << offset_;
280 }
Vec3D start_
The centre of the lower end of the Coil.
Definition: Coil.h:115
Mdouble offset_
Definition: Coil.h:140
Mdouble l_
The length of the Coil.
Definition: Coil.h:120
Mdouble n_
Definition: Coil.h:130
Mdouble r_
Definition: Coil.h:125
Mdouble thickness_
Definition: Coil.h:145
void write(std::ostream &os) const
Function that writes a BaseWall to an output stream, usually a restart file.
Definition: BaseWall.cc:68
Mdouble omega_
Definition: Coil.h:135

Member Data Documentation

Mdouble Coil::l_
private

The length of the Coil.

Definition at line 120 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 130 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 140 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 135 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 125 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 115 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 145 of file Coil.h.

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


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