InfiniteWall.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 
30 
31 #ifndef INFINITEWALL_H
32 #define INFINITEWALL_H
33 
34 #include "BaseWall.h"
35 #include "Math/Vector.h"
36 
47 class InfiniteWall final : public BaseWall
48 {
49 public:
50 
54  InfiniteWall();
55 
59  InfiniteWall(const InfiniteWall& w);
60 
64  explicit InfiniteWall(const ParticleSpecies* species);
65 
69  InfiniteWall(Vec3D normal, Vec3D point, const ParticleSpecies* species);
70 
74  InfiniteWall(Vec3D PointA, Vec3D PointB, Vec3D PointC, const ParticleSpecies* species);
75 
79  ~InfiniteWall() override;
80 
84  InfiniteWall* copy() const override;
85 
89  void set(Vec3D normal, Vec3D point);
90 
94  void setNormal(Vec3D normal);
95 
102  void set(Vec3D normal, Mdouble position);
103 
104  using BaseWall::move;
105 
109  Mdouble getDistance(Vec3D position) const;
110 
114  bool getDistanceAndNormal(const BaseParticle& p, Mdouble& distance, Vec3D& normal_return) const override;
115 
119  bool getDistanceNormalOverlapSuperquadric(const SuperQuadricParticle& p, Mdouble& distance, Vec3D& normal_return,
120  Mdouble& overlap) const override;
121 
125  void read(std::istream& is) override;
126 
130  void oldRead(std::istream& is);
131 
135  //void write(std::ostream& os) const override;
136 
140  std::string getName() const override;
141 
145  Vec3D getNormal() const;
146 
150  void createVTK(std::vector<Vec3D>& myPoints) const;
151 
155  void createVTK(std::vector<Vec3D>& myPoints, Vec3D max, Vec3D min) const;
156 
160  void writeVTK(VTKContainer& vtk) const override;
161 
162  Vec3D
163  getFurthestPointSuperQuadric(const Vec3D& normalBodyFixed, const Vec3D& axes, Mdouble eps1, Mdouble eps2) const override;
164 };
165 
166 #endif
#define MERCURYDPM_DEPRECATED
Definition: GeneralDefine.h:37
virtual void move(const Vec3D &move)
Moves this BaseInteractable by adding an amount to the position.
Definition: BaseInteractable.cc:215
Definition: BaseParticle.h:54
Basic class for walls.
Definition: BaseWall.h:49
A infinite wall fills the half-space {point: (position_-point)*normal_<=0}.
Definition: InfiniteWall.h:48
void createVTK(std::vector< Vec3D > &myPoints) const
Definition: InfiniteWall.cc:224
Vec3D getNormal() const
Access function for normal.
Definition: InfiniteWall.cc:213
void setNormal(Vec3D normal)
Changes the normal of the InfiniteWall.
Definition: InfiniteWall.cc:127
bool getDistanceAndNormal(const BaseParticle &p, Mdouble &distance, Vec3D &normal_return) const override
Compute the distance from the wall for a given BaseParticle and return if there is a collision....
Definition: InfiniteWall.cc:168
void read(std::istream &is) override
Reads InfiniteWall from a restart file.
Definition: InfiniteWall.cc:180
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
Definition: InfiniteWall.cc:118
~InfiniteWall() override
Default destructor.
Definition: InfiniteWall.cc:97
Vec3D getFurthestPointSuperQuadric(const Vec3D &normalBodyFixed, const Vec3D &axes, Mdouble eps1, Mdouble eps2) const override
Largely untested, use at your own risk for anything other than ellipsoids.
Definition: InfiniteWall.cc:312
std::string getName() const override
Writes the InfiniteWall to an output stream, usually a restart file.
Definition: InfiniteWall.cc:205
Mdouble getDistance(Vec3D position) const
Returns the distance of the wall to the particle.
Definition: InfiniteWall.cc:151
InfiniteWall * copy() const override
Wall copy method. It calls the copy constructor of this Wall, useful for polymorphism.
Definition: InfiniteWall.cc:105
void writeVTK(VTKContainer &vtk) const override
Definition: InfiniteWall.cc:270
bool getDistanceNormalOverlapSuperquadric(const SuperQuadricParticle &p, Mdouble &distance, Vec3D &normal_return, Mdouble &overlap) const override
Compute the distance from the wall for a given BaseParticle and return if there is a collision....
Definition: InfiniteWall.cc:279
InfiniteWall()
Default constructor, the normal is infinitely long.
Definition: InfiniteWall.cc:34
void oldRead(std::istream &is)
Reads InfiniteWall from an old-style restart file.
Definition: InfiniteWall.cc:190
Definition: ParticleSpecies.h:37
Definition: SuperQuadricParticle.h:57
Definition: Vector.h:51
Definition: BaseWall.h:38