MercuryDPM
Beta
|
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>
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... | |
Coil * | copy () 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... | |
BaseInteraction * | getInteractionWith (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... | |
WallHandler * | getHandler () 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 ParticleSpecies * | getSpecies () const |
Returns a pointer to the species of this BaseInteractable. More... | |
void | setSpecies (const ParticleSpecies *species) |
Sets the species of this BaseInteractable. More... | |
const Vec3D & | getForce () const |
Returns the force on this BaseInteractable. More... | |
const Vec3D & | getTorque () 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 Vec3D & | getPosition () const |
Returns the position of this BaseInteractable. More... | |
const Vec3D & | getOrientation () 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 Vec3D & | getVelocity () const |
Returns the velocity of this interactable. More... | |
virtual const Vec3D & | getAngularVelocity () 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_ |
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
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().
Coil::Coil | ( | const Coil & | other | ) |
Copy constructor, makes a coil with the same properties as the input Coil.
[in] | other | Coil 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_.
Constructor in which all parameters are set.
[in] | start | A Vec3D which denotes the centre of the lower end of the Coil. |
[in] | l | The length of the Coil, must be positive. |
[in] | r | The radius of the Coil, must be positive. |
[in] | n | The number of revelations of the Coil, must be positive. |
[in] | omega | The rotation speed of the Coil in rev/s. |
[in] | thickness | The 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_.
Coil::~Coil | ( | ) |
|
overridevirtual |
|
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.
[in] | p | BaseParticle we want to calculate the distance and whether it collided of. |
[out] | distance | The distance of the BaseParticle to this Coil. |
[out] | normal_return | If there was a collision, the normal vector to this Coil will be placed here. |
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.
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().
|
virtual |
Get the interaction between this Coil and given BaseParticle at a given time.
[in] | p | Pointer to the BaseParticle which we want to check the interaction for. |
[in] | timeStamp | The time at which we want to look at the interaction. |
[in] | interactionHandler | A pointer to the InteractionHandler in which the interaction can be found. |
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().
|
overridevirtual |
Returns the name of the object, in this case the string "Coil".
Implements BaseObject.
void Coil::move_time | ( | Mdouble | dt | ) |
void Coil::oldRead | ( | std::istream & | is | ) |
Reads an old-style Coil from an input stream, for example an old restart file.
[in,out] | is | The input stream from which the Coil is read. |
Definition at line 257 of file Coil.cc.
References l_, n_, offset_, omega_, r_, and start_.
|
overridevirtual |
Reads a Coil from an input stream, for example a restart file.
[in,out] | is | The 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_.
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.
[in] | start | A Vec3D which denotes the centre of the lower end of the Coil. |
[in] | length | The length of the Coil, must be positive. |
[in] | radius | The radius of the Coil, must be positive. |
[in] | numberOfRevelations | The number of revelations of the Coil, must be positive. |
[in] | omega | The rotation speed of the Coil in rev/s. |
[in] | thickness | The 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_.
|
overridevirtual |
Writes a Coil to an output stream, for example a restart file.
[in,out] | os | The 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().
|
private |
|
private |
|
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().
|
private |
|
private |
|
private |
|
private |