DeletionBoundary.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 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  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
double Mdouble
Definition: GeneralDefine.h:34
#define MERCURYDPM_DEPRECATED
Definition: GeneralDefine.h:37
Definition: BaseBoundary.h:49
Definition: BaseParticle.h:54
Used for removing particles from the problem. Inherits from BaseBoundary. By default,...
Definition: DeletionBoundary.h:44
Mdouble distance_
The boundary's distance from the origin.
Definition: DeletionBoundary.h:163
Mdouble scaleFactor_
This is the factor to rescale the given normal vector to a unit vectors.
Definition: DeletionBoundary.h:158
unsigned int getNumberOfParticlesDeleted() const
Gets the number of particles deleted by the boundary.
Definition: DeletionBoundary.cc:295
bool checkBoundaryAfterParticleMoved(BaseParticle *p, ParticleHandler &pH)
Checks if particle is inside the boundary, and deletes the particle if so.
Definition: DeletionBoundary.cc:123
void reset()
Definition: DeletionBoundary.cc:228
double volumeDeleted_
Definition: DeletionBoundary.h:171
void read(std::istream &is) override
Reads some boundary properties from an std::istream.
Definition: DeletionBoundary.cc:239
std::ofstream tracker
Definition: DeletionBoundary.h:181
void activate()
Turns on the DeletionBoundary.
Definition: DeletionBoundary.cc:300
double trackMassDeleted_
Definition: DeletionBoundary.h:170
unsigned int numberOfParticlesDeleted_
Number of particles that have been deleted by this boundary.
Definition: DeletionBoundary.h:168
DeletionBoundary()
default constructor
Definition: DeletionBoundary.cc:39
Vec3D normal_
outward unit normal vector
Definition: DeletionBoundary.h:148
void move(Mdouble position)
Sets the boundary's distance property to the given one.
Definition: DeletionBoundary.cc:97
~DeletionBoundary() override
destructor
Definition: DeletionBoundary.cc:56
bool isActivated_
The DeletionBoundary is activated by default. If the DeletionBoundary is deactivated,...
Definition: DeletionBoundary.h:177
void trackOutflow(bool trackOutflow=true)
Turns on the outflow tracker.
Definition: DeletionBoundary.h:121
void deactivate()
Turns off the DeletionBoundary.
Definition: DeletionBoundary.cc:305
std::string getName() const override
Returns the name of the object.
Definition: DeletionBoundary.cc:285
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...
Definition: DeletionBoundary.cc:108
double getVolumeOfParticlesDeleted() const
Definition: DeletionBoundary.cc:223
bool trackOutflow_
Definition: DeletionBoundary.h:179
double massDeleted_
Definition: DeletionBoundary.h:169
void write(std::ostream &os) const override
Writes the boundary properties to an std::ostream.
Definition: DeletionBoundary.cc:268
DeletionBoundary * copy() const override
Copy method; creates copy on the heap and returns a pointer to it.
Definition: DeletionBoundary.cc:66
void checkBoundaryAfterParticlesMove(ParticleHandler &pH) override
Definition: DeletionBoundary.cc:200
double getMassOfParticlesDeleted() const
Definition: DeletionBoundary.cc:218
MERCURYDPM_DEPRECATED void oldRead(std::istream &is)
Deprecated read method. use DeletionBoundary::read() instead.
Definition: DeletionBoundary.cc:258
DeletionBoundary(DeletionBoundary const &d)
default copy constructor
Definition: DeletionBoundary.h:54
void set(const Vec3D &normal, Mdouble distance)
Sets boundary position based on a normal and distance.
Definition: DeletionBoundary.cc:85
Container to store all BaseParticle.
Definition: ParticleHandler.h:48
Definition: Vector.h:51