MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DeletionBoundary.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, 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 DELETIONBOUNDARY_H
27 #define DELETIONBOUNDARY_H
28 
29 #include "BaseBoundary.h"
30 #include "Math/Vector.h"
31 
32 class ParticleHandler;
33 
34 class BaseParticle;
35 
44 {
45 public:
50 
58 
62  ~DeletionBoundary() override;
63 
67  DeletionBoundary* copy() const override;
68 
72  virtual void set(const Vec3D& normal, Mdouble distance);
73 
77  void move(Mdouble position);
78 
83  virtual Mdouble getDistance(const Vec3D& position) const;
84 
90 
95 
99  unsigned int getNumberOfParticlesDeleted() const;
100 
101  double getMassOfParticlesDeleted() const;
102 
103  double getVolumeOfParticlesDeleted() const;
104 
105  void reset();
106 
107 
111  void activate();
112 
116  void deactivate();
117 
122 
126  void read(std::istream& is) override;
127 
132  void oldRead(std::istream& is);
133 
137  void write(std::ostream& os) const override;
138 
142  std::string getName() const override;
143 
144 private:
149 
159 
164 
169  double massDeleted_;
172 
178 
180 
181  std::ofstream tracker;
182 
183 };
184 
185 #endif
Vec3D normal_
outward unit normal vector
void read(std::istream &is) override
Reads some boundary properties from an std::istream.
double Mdouble
Definition: GeneralDefine.h:34
bool checkBoundaryAfterParticleMoved(BaseParticle *p, ParticleHandler &pH)
Checks if particle is inside the boundary, and deletes the particle if so.
Used for removing particles from the problem. Inherits from BaseBoundary. By default, a plane that deletes everything past it, but there are derived classes such as CubeDeletionBoundary.
Mdouble scaleFactor_
This is the factor to rescale the given normal vector to a unit vectors.
void deactivate()
Turns off the DeletionBoundary.
#define MERCURY_DEPRECATED
Definition: GeneralDefine.h:37
std::ofstream tracker
double getMassOfParticlesDeleted() const
DeletionBoundary * copy() const override
Copy method; creates copy on the heap and returns a pointer to it.
void activate()
Turns on the DeletionBoundary.
DeletionBoundary()
default constructor
virtual Mdouble getDistance(const Vec3D &position) const
Returns a negative value if and only if the particle is inside the boundary (and therefore to be dele...
MERCURY_DEPRECATED void oldRead(std::istream &is)
Deprecated read method. use DeletionBoundary::read() instead.
Mdouble distance_
The boundary's distance from the origin.
~DeletionBoundary() override
destructor
void write(std::ostream &os) const override
Writes the boundary properties to an std::ostream.
Container to store all BaseParticle.
DeletionBoundary(DeletionBoundary const &d)
default copy constructor
void checkBoundaryAfterParticlesMove(ParticleHandler &pH) override
unsigned int getNumberOfParticlesDeleted() const
Gets the number of particles deleted by the boundary.
double getVolumeOfParticlesDeleted() const
void trackOutflow(bool trackOutflow=true)
Turns on the outflow tracker.
Definition: Vector.h:49
bool isActivated_
The DeletionBoundary is activated by default. If the DeletionBoundary is deactivated, then it deletes no particles.
unsigned int numberOfParticlesDeleted_
Number of particles that have been deleted by this boundary.
std::string getName() const override
Returns the name of the object.
void move(Mdouble position)
Sets the boundary's distance property to the given one.
virtual void set(const Vec3D &normal, Mdouble distance)
Sets boundary position based on a normal and distance.