Screw.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef SCREW_H
27 #define SCREW_H
28 
29 #include "BaseWall.h"
30 #include "Math/Vector.h"
31 
35 enum class ScrewType {singleHelix = 1, doubleHelix = 2};
36 
43 class Screw : public BaseWall
44 {
45 public:
46 
50  Screw();
51 
55  Screw(const Screw& other);
56 
60  Screw(Vec3D start, Mdouble l, Mdouble r, Mdouble n, Mdouble omega, Mdouble thickness, ScrewType screwType = ScrewType::doubleHelix);
61 
65  ~Screw() override;
66 
70  Screw* copy() const final;
71 
75  bool getDistanceAndNormal(const BaseParticle& P, Mdouble& distance, Vec3D& normal_return) const final;
76 
77  bool getDistanceAndNormalLabCoordinates(Vec3D position, Mdouble wallInteractionRadius, Mdouble& distance,
78  Vec3D& normal_return) const;
79 
83  void move_time(Mdouble dt);
84 
85  //MERCURYDPM_DEPRECATED
86  void rotate(const Vec3D& angularVelocityDt) override;
87 
91  void read(std::istream& is) override;
92 
96  void oldRead(std::istream& is);
97 
101  void write(std::ostream& os) const override;
102 
106  std::string getName() const final;
107 
108  void writeVTK(VTKContainer& vtk) const override;
109 
110  void writeVTK(std::string filename) const;
111 
112 private:
145 };
146 
147 #endif
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
ScrewType
Definition: Screw.h:35
Definition: BaseParticle.h:54
Basic class for walls.
Definition: BaseWall.h:49
This function defines an Archimedes' screw in the z-direction from a (constant) starting point,...
Definition: Screw.h:44
Mdouble thickness_
The thickness of the Screw.
Definition: Screw.h:140
void writeVTK(VTKContainer &vtk) const override
Definition: Screw.cc:365
Vec3D start_
The centre of the lower end of the screw.
Definition: Screw.h:116
Mdouble l_
The length of the Screw.
Definition: Screw.h:120
void oldRead(std::istream &is)
Reads a Screw in the old style from an input stream, for example a restart file old style.
Definition: Screw.cc:330
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:108
void write(std::ostream &os) const override
Writes this Screw to an output stream, for example a restart file.
Definition: Screw.cc:344
Mdouble maxR_
The outer radius of the Screw.
Definition: Screw.h:124
std::string getName() const final
Returns the name of the object, here the string "Screw".
Definition: Screw.cc:360
Mdouble n_
The number of revelations.
Definition: Screw.h:128
ScrewType screwType_
Single or double helix screw.
Definition: Screw.h:144
Mdouble omega_
Rotation speed in rev/s.
Definition: Screw.h:132
Screw * copy() const final
Copy this screw and return a pointer to the copy.
Definition: Screw.cc:103
Screw()
Default constructor: make a screw with default parameters.
Definition: Screw.cc:41
void move_time(Mdouble dt)
Rotate the Screw for a period dt, so that the offset_ changes with omega_*dt.
Definition: Screw.cc:289
bool getDistanceAndNormalLabCoordinates(Vec3D position, Mdouble wallInteractionRadius, Mdouble &distance, Vec3D &normal_return) const
Definition: Screw.cc:138
Mdouble offset_
The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation.
Definition: Screw.h:136
~Screw() override
Default destructor.
Definition: Screw.cc:95
void rotate(const Vec3D &angularVelocityDt) override
Definition: Screw.cc:298
void read(std::istream &is) override
Reads a Screw from an input stream, for example a restart file.
Definition: Screw.cc:308
Definition: Vector.h:51
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73
Definition: BaseWall.h:38